Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions resources/js/components/AddressCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
return this.address?.country_id ?? this.address?.country_code ?? ''
},

region() {
return this.address?.region?.region ?? this.address?.region?.region_code ?? ''
},

isEmpty() {
return [this.company, this.street, this.name, this.city].filter(Boolean).length == 0
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/account/partials/address-form.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form slot-scope="{ variables, mutate, mutated }" v-on:submit.prevent="mutate">
<x-rapidez-ct::sections>
<x-rapidez-ct::card.inactive>
<x-rapidez-ct::address-form type="edit" address="variables" country-key="country_code"/>
<x-rapidez-ct::address-form type="edit"/>
<div class="flex gap-5 py-5">
<x-rapidez::input.checkbox v-model="variables.default_shipping">@lang('Default shipping address')</x-input.checkbox>
<x-rapidez::input.checkbox v-model="variables.default_billing">@lang('Default billing address')</x-input.checkbox>
Expand Down
6 changes: 4 additions & 2 deletions resources/views/checkout/partials/sections/address.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
cart_id: mask,
...window.address_defaults,
...cart.shipping_addresses[0],
country_code: cart.shipping_addresses[0]?.country.code || window.address_defaults.country_code
country_code: cart.shipping_addresses[0]?.country.code || window.address_defaults.country_code,
region_id: cart.shipping_addresses[0]?.region.region_id || window.address_defaults.region_id,
}"
group="shipping"
:callback="updateCart"
Expand All @@ -34,7 +35,8 @@
...window.address_defaults,
...cart.billing_address,
same_as_shipping: !cart.is_virtual && (cart?.billing_address?.same_as_shipping ?? true),
country_code: cart.billing_address?.country.code || window.address_defaults.country_code
country_code: cart.billing_address?.country.code || window.address_defaults.country_code,
region_id: cart.billing_address?.region.region_id || window.address_defaults.region_id,
}))"
:callback="updateCart"
:error-callback="checkResponseForExpiredCart"
Expand Down
10 changes: 10 additions & 0 deletions resources/views/components/address-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@
<x-rapidez::input.select.country
name="{{ $type }}_country"
v-model="{{ $address }}.{{ $countryKey }}"
v-on:change="() => {{ $address }}.region_id = null"
required
/>
</label>
<label class="sm:col-span-2 has-[.exists]:block hidden">
<x-rapidez::label>@lang('Region')</x-rapidez::label>
<x-rapidez::input.select.region
class="exists"
name="{{ $type }}_region"
v-model="{{ $address }}.region_id"
country="{{ $address }}.{{ $countryKey }}"
/>
</label>
<div class="max-sm:hidden sm:col-span-2"></div>
<label @class([ 'sm:col-span-2' => !Rapidez::config('customer/address/middlename_show', 0)])>
<x-rapidez::label>@lang('Firstname')</x-rapidez::label>
Expand Down
3 changes: 2 additions & 1 deletion resources/views/components/address.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'v-bind:shipping' => var_export($shipping, true),
'v-bind:billing' => var_export($billing, true),
]) }}
v-slot="{ company, name, street, city, country, billing, shipping, isEmpty, customTitle, disabled, check }"
v-slot="{ company, name, street, city, country, region, billing, shipping, isEmpty, customTitle, disabled, check }"
>
<div {{ $attributes->whereDoesntStartWith('v-')->class('flex flex-col') }}>
<template v-if="!isEmpty">
Expand All @@ -32,6 +32,7 @@
<li v-if="name">@{{ name }}</li>
<li v-if="street">@{{ street }}</li>
<li v-if="city">@{{ city }}</li>
<li v-if="region">@{{ region }}</li>
<li v-if="country">@{{ country }}</li>
</ul>
@if (!empty($slot))
Expand Down
Loading