Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up files to make confira override easier #66

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions resources/views/checkout/overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,7 @@
@section('content')
<checkout v-slot="{ checkout, cart, hasItems, save, goToStep }" :set="checkout.step = Math.max(checkout.step, 2)" v-cloak>
<div class="container">
<x-rapidez-ct::layout class="mt-8 sm:mt-14">
<template v-if="checkout.step == 2 && hasItems">
@include('rapidez-ct::checkout.steps.credentials')
</template>

<template v-if="checkout.step == 3">
@include('rapidez-ct::checkout.steps.payment')
</template>

<template v-if="checkout.step == 4">
@include('rapidez-ct::checkout.steps.success')
</template>

<x-slot:sidebar>
@include('rapidez-ct::checkout.partials.sidebar.sidebar')
</x-slot:sidebar>
</x-rapidez-ct::layout>
@include('rapidez-ct::checkout.partials.layout')
</div>
</checkout>
@endsection
19 changes: 19 additions & 0 deletions resources/views/checkout/partials/address-card.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="grid sm:grid-cols-2 gap-5">
<template v-for="userAddress in $root.user.addresses">
<x-rapidez-ct::card.address
v-bind:key="userAddress.id"
v-bind:address="userAddress"
v-bind:billing="isType('billing', userAddress)"
v-bind:shipping="isType('shipping', userAddress)"
check="isType('billing', userAddress) || isType('shipping', userAddress)"
class="w-full sm:min-w-[350px]"
>
<x-rapidez-ct::button.link v-if="!isType('shipping', userAddress)" v-on:click.prevent="select('shipping', userAddress)">
@lang('Select as shipping')
</x-rapidez-ct::button.link>
<x-rapidez-ct::button.link v-if="!isType('billing', userAddress)" v-on:click.prevent="select('billing', userAddress)">
@lang('Select as billing')
</x-rapidez-ct::button.link>
</x-rapidez-ct::card.address>
</template>
</div>
21 changes: 1 addition & 20 deletions resources/views/checkout/partials/address-cards-popup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,7 @@
<label class="absolute cursor-pointer top-7 right-7 w-5 h-5" for="popup">
<x-heroicon-o-x-mark/>
</label>

<div class="grid sm:grid-cols-2 gap-5">
<template v-for="userAddress in $root.user.addresses">
<x-rapidez-ct::card.address
v-bind:key="userAddress.id"
v-bind:address="userAddress"
v-bind:billing="isType('billing', userAddress)"
v-bind:shipping="isType('shipping', userAddress)"
check="isType('billing', userAddress) || isType('shipping', userAddress)"
class="w-full sm:min-w-[350px]"
>
<x-rapidez-ct::button.link v-if="!isType('shipping', userAddress)" v-on:click.prevent="select('shipping', userAddress)">
@lang('Select as shipping')
</x-rapidez-ct::button.link>
<x-rapidez-ct::button.link v-if="!isType('billing', userAddress)" v-on:click.prevent="select('billing', userAddress)">
@lang('Select as billing')
</x-rapidez-ct::button.link>
</x-rapidez-ct::card.address>
</template>
</div>
@include('rapidez-ct::checkout.partials.address-card')
</x-rapidez-ct::card.inactive>
</x-rapidez-ct::sections>
<label class="absolute cursor-pointer inset-0 bg-ct-primary/60" for="popup"></label>
Expand Down
5 changes: 1 addition & 4 deletions resources/views/checkout/partials/address-cards.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
@lang('Edit')
</x-rapidez-ct::button.link>
</x-rapidez-ct::card.address>
<button v-on:click.prevent="toggleEdit" class="flex flex-col items-center justify-center gap-y-2 font-medium bg-ct-disabled rounded max-sm:hidden">
<span>+</span>
<span>@lang('Add new address')</span>
</button>
@include('rapidez-ct::checkout.partials.buttons.new-address')
</template>
<template v-else>
<x-rapidez-ct::card.address v-bind:address="checkout.shipping_address" shipping check class="h-full">
Expand Down
8 changes: 8 additions & 0 deletions resources/views/checkout/partials/buttons/address.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="mt-5">
<x-rapidez-ct::button.accent v-on:click.prevent="toggleEdit">
@lang('Use a new address')
</x-rapidez-ct::button.accent>
<x-rapidez-ct::button.outline tag="label" for="popup" class="cursor-pointer" v-if="$root.user.addresses.length">
@lang('My addresses')
</x-rapidez-ct::button.outline>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-rapidez-ct::checkout.partials.prev-button :href="route('cart')">
@lang('Back to cart')
</x-rapidez-ct::checkout.partials.prev-button>

<x-rapidez-ct::checkout.partials.next-button form="credentials" loader>
@lang('Next')
</x-rapidez-ct::checkout.partials.next-button>
3 changes: 3 additions & 0 deletions resources/views/checkout/partials/buttons/login.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-rapidez-ct::button.accent v-if="!emailAvailable" v-on:click.prevent="go" dusk="continue">
@lang('Login')
</x-rapidez-ct::button.accent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<button v-on:click.prevent="toggleEdit" class="flex flex-col items-center justify-center gap-y-2 font-medium bg-ct-disabled rounded max-sm:hidden">
<span>+</span>
<span>@lang('Add new address')</span>
</button>
7 changes: 7 additions & 0 deletions resources/views/checkout/partials/buttons/payment.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-rapidez-ct::checkout.partials.prev-button v-on:click.prevent="goToStep(1)">
@lang('Back to credentials')
</x-rapidez-ct::checkout.partials.prev-button>

<x-rapidez-ct::checkout.partials.next-button class="relative" form="payment" type="submit" dusk="continue" loader>
@lang('Place order')
</x-rapidez-ct::checkout.partials.next-button>
17 changes: 17 additions & 0 deletions resources/views/checkout/partials/layout.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<x-rapidez-ct::layout class="mt-8 sm:mt-14">
<template v-if="checkout.step == 2 && hasItems">
@include('rapidez-ct::checkout.steps.credentials')
</template>

<template v-if="checkout.step == 3">
@include('rapidez-ct::checkout.steps.payment')
</template>

<template v-if="checkout.step == 4">
@include('rapidez-ct::checkout.steps.success')
</template>

<x-slot:sidebar>
@include('rapidez-ct::checkout.partials.sidebar.sidebar')
</x-slot:sidebar>
</x-rapidez-ct::layout>
9 changes: 1 addition & 8 deletions resources/views/checkout/partials/sections/address.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<checkout-address v-slot="{ useCards, editing, toggleEdit, isType, select }">
<x-rapidez-ct::card.inactive v-if="useCards && !editing">
@include('rapidez-ct::checkout.partials.address-cards')
<div class="mt-5">
<x-rapidez-ct::button.accent v-on:click.prevent="toggleEdit">
@lang('Use a new address')
</x-rapidez-ct::button.accent>
<x-rapidez-ct::button.outline tag="label" for="popup" class="cursor-pointer" v-if="$root.user.addresses.length">
@lang('My addresses')
</x-rapidez-ct::button.outline>
</div>
@include('rapidez-ct::checkout.partials.buttons.address')
</x-rapidez-ct::card.inactive>

<x-rapidez-ct::card.inactive v-else>
Expand Down
33 changes: 19 additions & 14 deletions resources/views/checkout/partials/sections/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<login v-slot="{ email, password, go, loginInputChange, emailAvailable, logout }">
<x-rapidez-ct::card.inactive>
<div class="grid gap-4 sm:gap-5 md:grid-cols-2">
<div class="grid gap-4 sm:gap-5 md:grid-cols-2 md:items-end">
<template v-if="!loggedIn">
<x-rapidez-ct::input
name="email"
Expand All @@ -9,6 +9,7 @@
v-bind:value="email"
v-on:input="loginInputChange"
v-on:blur="$root.guestEmail = email; if(!password) { go() }"
class="justify-center"
required
:placeholder="__('Enter your e-mail address')"
/>
Expand All @@ -23,26 +24,30 @@
required
/>

<p v-if="!emailAvailable" class="self-end">
<p v-if="!emailAvailable" class="self-end text-ct-inactive">
@lang('You already have an account with this e-mail address. Please log in to continue.')
</p>
<p v-else class="self-end">
<p v-else class="self-end text-ct-inactive">
@lang('We will send your order confirmation to this e-mail address. We will also check if you already have an account so you can checkout more efficiently.')
</p>

<x-rapidez-ct::button.accent v-if="!emailAvailable" v-on:click.prevent="go" dusk="continue">
@lang('Login')
</x-rapidez-ct::button.accent>
@include('rapidez-ct::checkout.partials.buttons.login')
</template>
<template v-else>
<div class="bg-ct-disabled flex h-[52px] items-center rounded border px-4">
<x-heroicon-o-user-circle class="mr-[10px] h-[24px]" />
<span v-text="$root.user?.email"></span>
<x-heroicon-o-lock-closed class="ml-auto h-[24px] text-ct-primary" />
</div>
<x-rapidez-ct::input
name="email"
type="email"
label="Email"
disabeld
v-bind:value="email"
v-on:input="loginInputChange"
v-on:blur="$root.guestEmail = email; if(!password) { go() }"
class="justify-center"
required
:placeholder="__('Enter your e-mail address')"
/>
<div>
<x-rapidez-ct::title.sm>@lang('Welcome back') @{{ $root.user?.firstname }}!</x-rapidez-ct::title.sm>
<span>
<p class="text-sm font-medium text-ct-neutral">@lang('Welcome back') @{{ $root.user?.firstname }}!</p>
<span class="text-ct-inactive text-sm">
@lang('Is this not your account?')
<button class="underline" v-on:click.prevent="logout('/login')">@lang('Log out')</button>
@lang('and use a different e-mail address.')
Expand Down
14 changes: 3 additions & 11 deletions resources/views/checkout/partials/sections/shipping.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<x-rapidez-ct::card.inactive>
<x-rapidez-ct::title.lg>
@lang('Shipping method')
</x-rapidez-ct::title.lg>
@include('rapidez-ct::checkout.partials.shipping-title')

<div v-for="(method, index in checkout.shipping_methods" class="mt-5 flex flex-col gap-2">
<x-rapidez-ct::input.radio
Expand All @@ -11,14 +9,8 @@
name="shipping_method"
required
>
<div class="sm:w-3/5">@{{ method.carrier_title }}</div>
<div class="flex-1">@{{ method.method_title }}</div>
<div class="text-right text-sm font-medium">
<div v-if="method.amount > 0" class="text-ct-inactive">@{{ method.amount | price }}</div>
<div v-else class="text-ct-enhanced">
@lang('Free')
</div>
</div>
@include('rapidez-ct::checkout.partials.shipping.method-titles')
@include('rapidez-ct::checkout.partials.shipping.info')
</x-rapidez-ct::input.radio>
</div>
</x-rapidez-ct::card.inactive>
3 changes: 3 additions & 0 deletions resources/views/checkout/partials/shipping-title.blade.php
Roene-JustBetter marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-rapidez-ct::title.lg>
@lang('Shipping method')
</x-rapidez-ct::title.lg>
6 changes: 6 additions & 0 deletions resources/views/checkout/partials/shipping/info.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="text-right text-sm font-medium">
<div v-if="method.amount > 0" class="text-ct-inactive">@{{ method.amount | price }}</div>
<div v-else class="text-ct-enhanced">
@lang('Free')
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div class="sm:w-3/5">@{{ method.carrier_title }}</div>
<div class="flex-1">@{{ method.method_title }}</div>
15 changes: 5 additions & 10 deletions resources/views/checkout/steps/credentials.blade.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<x-rapidez-ct::title-progress-bar :href="route('cart')">
<x-rapidez-ct::section-title :href="route('cart')">
@lang('Credentials')
</x-rapidez-ct::title-progress-bar>
</x-rapidez-ct::section-title>

<form id="credentials" v-on:submit.prevent="save(['credentials'], 3)">
<x-rapidez-ct::checkout.partials.credentials-form>
<x-rapidez-ct::sections>
@include('rapidez-ct::checkout.partials.sections.login')
@include('rapidez-ct::checkout.partials.sections.address')
@include('rapidez-ct::checkout.partials.sections.newsletter')
@include('rapidez-ct::checkout.partials.sections.shipping')
</x-rapidez-ct::sections>
</form>
</x-rapidez-ct::checkout.partials.credentials-form>

<x-rapidez-ct::toolbar>
<x-rapidez-ct::button.outline :href="route('cart')">
@lang('Back to cart')
</x-rapidez-ct::button.outline>
<x-rapidez-ct::button.enhanced form="credentials" loader>
@lang('Next')
</x-rapidez-ct::button.enhanced>
@include('rapidez-ct::checkout.partials.buttons.credentials')
</x-rapidez-ct::toolbar>
17 changes: 3 additions & 14 deletions resources/views/checkout/steps/payment.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<x-rapidez-ct::title-progress-bar href="#" v-on:click.prevent="goToStep(1)">
<x-rapidez-ct::section-title href="#" v-on:click.prevent="goToStep(1)">
@lang('Payment')
</x-rapidez-ct::title-progress-bar>
</x-rapidez-ct::section-title>

<x-rapidez-ct::sections>
@include('rapidez-ct::checkout.partials.sections.payment')
</x-rapidez-ct::sections>

<x-rapidez-ct::toolbar>
<x-rapidez-ct::button.outline v-on:click.prevent="goToStep(1)">
@lang('Back to credentials')
</x-rapidez-ct::button.outline>
<x-rapidez-ct::button.enhanced
class="relative"
form="payment"
type="submit"
dusk="continue"
loader
>
@lang('Place order')
</x-rapidez-ct::button.enhanced>
@include('rapidez-ct::checkout.partials.buttons.payment')
</x-rapidez-ct::toolbar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<form id="credentials" v-on:submit.prevent="save(['credentials'], 3)">
{{ $slot }}
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-rapidez-ct::button.enhanced {{ $attributes }}>
@lang('Next')
</x-rapidez-ct::button.enhanced>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-rapidez-ct::button.outline {{ $attributes }}>
{{ $slot }}
</x-rapidez-ct::button.outline>
3 changes: 3 additions & 0 deletions resources/views/components/section-title.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-rapidez-ct::title-progress-bar {{ $attributes }}>
{{ $slot }}
</x-rapidez-ct::title-progress-bar>
2 changes: 1 addition & 1 deletion resources/views/components/title-progress-bar.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="flex flex-wrap gap-1 items-baseline justify-between">
<x-rapidez-ct::title {{ $attributes }}>
Roene-JustBetter marked this conversation as resolved.
Show resolved Hide resolved
<x-rapidez-ct::title>
{{ $slot }}
</x-rapidez-ct::title>
<x-rapidez-ct::progress-bar />
Expand Down