53 lines
1.9 KiB
PHP
53 lines
1.9 KiB
PHP
{{--
|
|
The state/region + country pair for one address (billing or shipping).
|
|
|
|
Single-country store ($storeCountry set): region is a <select> of that
|
|
country's Lunar states, submitting `->name` (table-rate-shipping resolves
|
|
zones with State::whereName()), and country is a fixed hidden field + label.
|
|
Otherwise: free-text region + full country <select>, as before.
|
|
--}}
|
|
@props([
|
|
'prefix',
|
|
'storeCountry' => null,
|
|
'regions' => [],
|
|
'countries' => [],
|
|
'address' => null,
|
|
])
|
|
|
|
<div class="bbk-field-row">
|
|
@if ($storeCountry)
|
|
<x-checkout::select
|
|
:name="$prefix . '_state'"
|
|
label="{{ __('checkout.page.state') }}"
|
|
:options="$regions"
|
|
value-field="name"
|
|
translation-group="states"
|
|
:value="$address?->state"
|
|
placeholder="{{ __('checkout.page.state_placeholder') }}"
|
|
required
|
|
/>
|
|
|
|
<div class="bbk-field">
|
|
<span class="bbk-field-label">{{ __('checkout.page.country') }}</span>
|
|
<p class="bbk-field-static">
|
|
{{ \Illuminate\Support\Facades\Lang::has("core::countries.{$storeCountry->name}")
|
|
? __("core::countries.{$storeCountry->name}")
|
|
: $storeCountry->name }}
|
|
</p>
|
|
<input type="hidden" name="{{ $prefix }}_country_id" value="{{ $storeCountry->id }}">
|
|
</div>
|
|
@else
|
|
<x-checkout::field :name="$prefix . '_state'" label="{{ __('checkout.page.state') }}" :value="$address?->state" />
|
|
|
|
<x-checkout::select
|
|
:name="$prefix . '_country_id'"
|
|
label="{{ __('checkout.page.country') }}"
|
|
:options="$countries"
|
|
translation-group="countries"
|
|
:value="$address?->country_id"
|
|
placeholder="{{ __('checkout.page.country_placeholder') }}"
|
|
required
|
|
/>
|
|
@endif
|
|
</div>
|