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 3 commits
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,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>
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
48 changes: 3 additions & 45 deletions resources/views/checkout/partials/sections/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,53 +1,11 @@
<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"
type="email"
label="Email"
v-bind:value="email"
v-on:input="loginInputChange"
v-on:blur="$root.guestEmail = email; if(!password) { go() }"
required
:placeholder="__('Enter your e-mail address')"
/>

<x-rapidez-ct::input
name="password"
type="password"
v-if="!emailAvailable"
label="Password"
ref="password"
v-on:input="loginInputChange"
required
/>

<p v-if="!emailAvailable" class="self-end">
@lang('You already have an account with this e-mail address. Please log in to continue.')
</p>
<p v-else class="self-end">
@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.sections.login.logged-out')
</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>
<div>
<x-rapidez-ct::title.sm>@lang('Welcome back') @{{ $root.user?.firstname }}!</x-rapidez-ct::title.sm>
<span>
@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.')
</span>
</div>
@include('rapidez-ct::checkout.partials.sections.login.logged-in')
</template>
</div>
</x-rapidez-ct::card.inactive>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<x-rapidez-ct::input
name="email"
type="email"
label="Email"
disabeld
v-bind:value="email"
class="justify-center"
required
:placeholder="__('Enter your e-mail address')"
/>
<div>
<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.')
</span>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<x-rapidez-ct::input
name="email"
type="email"
label="Email"
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')"
/>

<x-rapidez-ct::input
name="password"
type="password"
v-if="!emailAvailable"
label="Password"
ref="password"
v-on:input="loginInputChange"
required
/>

<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 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>
19 changes: 1 addition & 18 deletions resources/views/checkout/partials/sections/shipping.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,5 @@
@lang('Shipping method')
</x-rapidez-ct::title.lg>

<div v-for="(method, index in checkout.shipping_methods" class="mt-5 flex flex-col gap-2">
<x-rapidez-ct::input.radio
v-bind:value="method.carrier_code+'_'+method.method_code"
v-bind:dusk="'method-'+index"
v-model="checkout.shipping_method"
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>
</x-rapidez-ct::input.radio>
</div>
@include('rapidez-ct::checkout.partials.shipping.methods')
</x-rapidez-ct::card.inactive>
18 changes: 18 additions & 0 deletions resources/views/checkout/partials/shipping/methods.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div v-for="(method, index) in checkout.shipping_methods" class="mt-5 flex flex-col gap-2">
<x-rapidez-ct::input.radio
v-bind:value="method.carrier_code+'_'+method.method_code"
v-bind:dusk="'method-'+index"
v-model="checkout.shipping_method"
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>
</x-rapidez-ct::input.radio>
</div>
5 changes: 3 additions & 2 deletions resources/views/checkout/steps/credentials.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<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>

<x-rapidez-ct::button.accent form="credentials" loader>
@lang('Next')
</x-rapidez-ct::button.enhanced>
</x-rapidez-ct::button.accent>
</x-rapidez-ct::toolbar>
11 changes: 3 additions & 8 deletions resources/views/checkout/steps/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@
<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
>

<x-rapidez-ct::button.accent class="relative" form="payment" type="submit" dusk="continue" loader>
@lang('Place order')
</x-rapidez-ct::button.enhanced>
</x-rapidez-ct::button.accent>
</x-rapidez-ct::toolbar>
53 changes: 17 additions & 36 deletions resources/views/components/address-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,24 @@

<div class="grid gap-4 sm:gap-5 sm:grid-cols-4">
@if (Rapidez::config('customer/address/company_show', 0) || Rapidez::config('customer/address/taxvat_show', 0))
<toggler :open="Boolean({{ $address }}.company || {{ $address }}.vat_id)">
<div slot-scope="{ toggle, isOpen }" class="contents">
<x-rapidez-ct::input.checkbox
class="col-span-full"
id="{{ $type }}_isb2b"
name="{{ $type }}_isb2b"
v-model="isOpen"
v-on:click="toggle"
>
@lang('This is a business address')
</x-rapidez-ct::input.checkbox>
@if (Rapidez::config('customer/address/company_show', 0))
<x-rapidez-ct::input
class="sm:col-span-2"
name="{{ $type }}_company"
label="Company"
v-model.lazy="{{ $address }}.company"
/>
@endif

@if (Rapidez::config('customer/address/company_show', 0))
<x-rapidez-ct::input
v-cloak
v-if="isOpen"
class="sm:col-span-2"
name="{{ $type }}_company"
label="Company"
v-model.lazy="{{ $address }}.company"
required
/>
@endif

@if(Rapidez::config('customer/address/taxvat_show', 0))
<x-rapidez-ct::input
v-cloak
v-if="isOpen"
class="sm:col-span-2"
name="{{ $type }}_vat_id"
label="Tax ID"
v-model.lazy="{{ $address }}.vat_id"
:required="Rapidez::config('customer/address/taxvat_show', 0) == 'req'"
/>
@endif
</div>
</toggler>
@if(Rapidez::config('customer/address/taxvat_show', 0))
<x-rapidez-ct::input
class="sm:col-span-2"
name="{{ $type }}_vat_id"
label="Tax ID"
v-model.lazy="{{ $address }}.vat_id"
:required="Rapidez::config('customer/address/taxvat_show', 0) == 'req'"
/>
@endif
@endif
<x-rapidez-ct::input.country-select
class="sm:col-span-2"
Expand Down