Repo rebuild

This commit is contained in:
Mark Gregory
2026-09-15 12:33:28 +01:00
commit be28c4feec
5629 changed files with 317074 additions and 0 deletions
@@ -0,0 +1,387 @@
@php
$required = '<span class="text-red-600 dark:text-red-400">*</span>';
$textInput =
'mt-2 min-h-11 w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100';
$textareaInput =
'mt-2 min-h-28 w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100';
$labelClass = 'text-sm font-semibold text-zinc-900 dark:text-zinc-100';
@endphp
<div class="grid gap-5 md:grid-cols-3">
<div>
<label class="{{ $labelClass }}" for="alpha2">Alpha-2 {!! $required !!}</label>
<input id="alpha2" name="alpha2" maxlength="2" value="{{ old('alpha2', $country->alpha2) }}"
class="{{ $textInput }} uppercase" placeholder="GB" />
@error('alpha2')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="alpha3">Alpha-3 {!! $required !!}</label>
<input id="alpha3" name="alpha3" maxlength="3" value="{{ old('alpha3', $country->alpha3) }}"
class="{{ $textInput }} uppercase" placeholder="GBR" />
@error('alpha3')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="numeric">Numeric {!! $required !!}</label>
<input id="numeric" name="numeric" maxlength="3" value="{{ old('numeric', $country->numeric) }}"
class="{{ $textInput }}" placeholder="826" />
@error('numeric')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="name">Canonical ISO name {!! $required !!}</label>
<input id="name" name="name" value="{{ old('name', $country->name) }}" class="{{ $textInput }}" />
@error('name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="official_name">Official name</label>
<input id="official_name" name="official_name" value="{{ old('official_name', $country->official_name) }}"
class="{{ $textInput }}" />
@error('official_name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="common_name">Common name</label>
<input id="common_name" name="common_name" value="{{ old('common_name', $country->common_name) }}"
class="{{ $textInput }}" />
@error('common_name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="display_name">Display name override</label>
<input id="display_name" name="display_name" value="{{ old('display_name', $country->display_name) }}"
class="{{ $textInput }}" />
@error('display_name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="native_name">Native name</label>
<input id="native_name" name="native_name" value="{{ old('native_name', $country->native_name) }}"
class="{{ $textInput }}" />
@error('native_name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="capital">Capital</label>
<input id="capital" name="capital" value="{{ old('capital', $country->capital) }}"
class="{{ $textInput }}" />
@error('capital')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
<div class="mt-8 border-t border-zinc-200 pt-6 dark:border-zinc-800">
<h2 class="text-base font-semibold text-zinc-900 dark:text-zinc-100">Regional and sovereignty metadata</h2>
<div class="mt-4 grid gap-5 md:grid-cols-3">
<div>
<label class="{{ $labelClass }}" for="iso_status">ISO lifecycle status {!! $required !!}</label>
<select id="iso_status" name="iso_status" class="{{ $textInput }}">
@foreach (\Modules\Countries\Support\Iso3166::statuses() as $status)
<option value="{{ $status }}" @selected(old('iso_status', $country->iso_status ?? 'official') === $status)>
{{ str($status)->replace('_', ' ')->title() }}</option>
@endforeach
</select>
@error('iso_status')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="sovereignty_status">Sovereignty status</label>
<input id="sovereignty_status" name="sovereignty_status"
value="{{ old('sovereignty_status', $country->sovereignty_status) }}" class="{{ $textInput }}" />
@error('sovereignty_status')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="continent">Continent</label>
<input id="continent" name="continent" value="{{ old('continent', $country->continent) }}"
class="{{ $textInput }}" />
@error('continent')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="region">Region</label>
<input id="region" name="region" value="{{ old('region', $country->region) }}"
class="{{ $textInput }}" />
@error('region')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="subregion">Subregion</label>
<input id="subregion" name="subregion" value="{{ old('subregion', $country->subregion) }}"
class="{{ $textInput }}" />
@error('subregion')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="intermediate_region">Intermediate region</label>
<input id="intermediate_region" name="intermediate_region"
value="{{ old('intermediate_region', $country->intermediate_region) }}"
class="{{ $textInput }}" />
@error('intermediate_region')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div class="mt-8 border-t border-zinc-200 pt-6 dark:border-zinc-800">
<h2 class="text-base font-semibold text-zinc-900 dark:text-zinc-100">Logistics, billing and web metadata</h2>
<div class="mt-4 grid gap-5 md:grid-cols-3">
<div>
<label class="{{ $labelClass }}" for="flag_emoji">Flag emoji</label>
<input id="flag_emoji" name="flag_emoji" value="{{ old('flag_emoji', $country->flag_emoji) }}"
class="{{ $textInput }}" />
@error('flag_emoji')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="calling_code">Calling code</label>
<input id="calling_code" name="calling_code" value="{{ old('calling_code', $country->calling_code) }}"
class="{{ $textInput }}" placeholder="+44" />
@error('calling_code')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="tld">Top-level domain</label>
<input id="tld" name="tld" value="{{ old('tld', $country->tld) }}"
class="{{ $textInput }}" placeholder=".uk" />
@error('tld')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="currency_code">Currency code</label>
<input id="currency_code" name="currency_code" maxlength="3"
value="{{ old('currency_code', $country->currency_code) }}" class="{{ $textInput }} uppercase"
placeholder="GBP" />
@error('currency_code')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="currency_name">Currency name</label>
<input id="currency_name" name="currency_name"
value="{{ old('currency_name', $country->currency_name) }}" class="{{ $textInput }}" />
@error('currency_name')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="currency_symbol">Currency symbol</label>
<input id="currency_symbol" name="currency_symbol"
value="{{ old('currency_symbol', $country->currency_symbol) }}" class="{{ $textInput }}" />
@error('currency_symbol')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="latitude">Latitude</label>
<input id="latitude" name="latitude" type="number" step="0.0000001"
value="{{ old('latitude', $country->latitude) }}" class="{{ $textInput }}" />
@error('latitude')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="longitude">Longitude</label>
<input id="longitude" name="longitude" type="number" step="0.0000001"
value="{{ old('longitude', $country->longitude) }}" class="{{ $textInput }}" />
@error('longitude')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="sort_order">Sort order</label>
<input id="sort_order" name="sort_order" type="number" min="0"
value="{{ old('sort_order', $country->sort_order ?? 0) }}" class="{{ $textInput }}" />
@error('sort_order')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="ioc_code">IOC code</label>
<input id="ioc_code" name="ioc_code" value="{{ old('ioc_code', $country->ioc_code) }}"
class="{{ $textInput }} uppercase" />
@error('ioc_code')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="fifa_code">FIFA code</label>
<input id="fifa_code" name="fifa_code" value="{{ old('fifa_code', $country->fifa_code) }}"
class="{{ $textInput }} uppercase" />
@error('fifa_code')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="postal_code_format">Postal-code format</label>
<input id="postal_code_format" name="postal_code_format"
value="{{ old('postal_code_format', $country->postal_code_format) }}"
class="{{ $textInput }}" />
@error('postal_code_format')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div class="md:col-span-3">
<label class="{{ $labelClass }}" for="flag_svg_url">Flag SVG URL</label>
<input id="flag_svg_url" name="flag_svg_url" value="{{ old('flag_svg_url', $country->flag_svg_url) }}"
class="{{ $textInput }}" />
@error('flag_svg_url')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div class="md:col-span-3">
<label class="{{ $labelClass }}" for="flag_png_url">Flag PNG URL</label>
<input id="flag_png_url" name="flag_png_url" value="{{ old('flag_png_url', $country->flag_png_url) }}"
class="{{ $textInput }}" />
@error('flag_png_url')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div class="mt-8 border-t border-zinc-200 pt-6 dark:border-zinc-800">
<h2 class="text-base font-semibold text-zinc-900 dark:text-zinc-100">JSON metadata</h2>
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Use valid JSON. Examples: languages as <code
class="rounded bg-zinc-100 px-1 dark:bg-zinc-800">["en"]</code>, timezones as <code
class="rounded bg-zinc-100 px-1 dark:bg-zinc-800">["Europe/London"]</code>.</p>
<div class="mt-4 grid gap-5 md:grid-cols-3">
<div>
<label class="{{ $labelClass }}" for="languages">Languages JSON</label>
<textarea id="languages" name="languages" class="{{ $textareaInput }}">{{ old('languages', $country->languages ? json_encode($country->languages, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '') }}</textarea>
@error('languages')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="timezones">Timezones JSON</label>
<textarea id="timezones" name="timezones" class="{{ $textareaInput }}">{{ old('timezones', $country->timezones ? json_encode($country->timezones, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '') }}</textarea>
@error('timezones')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="metadata">Metadata JSON</label>
<textarea id="metadata" name="metadata" class="{{ $textareaInput }}">{{ old('metadata', $country->metadata ? json_encode($country->metadata, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '') }}</textarea>
@error('metadata')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div class="mt-8 border-t border-zinc-200 pt-6 dark:border-zinc-800">
<h2 class="text-base font-semibold text-zinc-900 dark:text-zinc-100">Operational support</h2>
<div class="mt-4 grid gap-5 md:grid-cols-3">
<label
class="flex items-center gap-3 rounded-2xl border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-950">
<input type="hidden" name="is_active" value="0" />
<input type="checkbox" name="is_active" value="1" @checked(old('is_active', $country->exists ? $country->is_active : true))
class="rounded border-zinc-300 text-blue-600 focus:ring-blue-500" />
<span><span class="block text-sm font-semibold">Supported {!! $required !!}</span><span
class="block text-xs text-zinc-500">Available in WMS selectors and workflows.</span></span>
</label>
<label
class="flex items-center gap-3 rounded-2xl border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-950">
<input type="hidden" name="independent" value="0" />
<input type="checkbox" name="independent" value="1" @checked(old('independent', $country->independent))
class="rounded border-zinc-300 text-blue-600 focus:ring-blue-500" />
<span><span class="block text-sm font-semibold">Independent state</span><span
class="block text-xs text-zinc-500">Used for reporting and compliance filters.</span></span>
</label>
<label
class="flex items-center gap-3 rounded-2xl border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-950">
<input type="hidden" name="un_member" value="0" />
<input type="checkbox" name="un_member" value="1" @checked(old('un_member', $country->un_member))
class="rounded border-zinc-300 text-blue-600 focus:ring-blue-500" />
<span><span class="block text-sm font-semibold">UN member</span><span
class="block text-xs text-zinc-500">Optional global reference attribute.</span></span>
</label>
<div>
<label class="{{ $labelClass }}" for="source">Source</label>
<input id="source" name="source" value="{{ old('source', $country->source) }}"
class="{{ $textInput }}" />
@error('source')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="source_version">Source version</label>
<input id="source_version" name="source_version"
value="{{ old('source_version', $country->source_version) }}" class="{{ $textInput }}" />
@error('source_version')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label class="{{ $labelClass }}" for="last_synced_at">Last synced at</label>
<input id="last_synced_at" name="last_synced_at" type="datetime-local"
value="{{ old('last_synced_at', $country->last_synced_at?->format('Y-m-d\\TH:i')) }}"
class="{{ $textInput }}" />
@error('last_synced_at')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div class="md:col-span-3">
<label class="{{ $labelClass }}" for="address_format">Address format</label>
<textarea id="address_format" name="address_format" class="{{ $textareaInput }}">{{ old('address_format', $country->address_format) }}</textarea>
@error('address_format')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
@@ -0,0 +1,41 @@
<x-layouts.app>
<div class="mx-auto max-w-[1400px] space-y-6" dusk="countries-create">
<div
class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">ISO 3166 country
support</p>
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Create country</h1>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Create a governed country reference record for
platform, address, billing, carrier, customs and integration workflows.</p>
</div>
<a href="{{ route('countries.index') }}" wire:navigate
class="rounded-xl bg-white/10 px-4 py-2.5 text-sm font-semibold text-white ring-1 ring-white/20 hover:bg-white/20">Back
to countries</a>
</div>
</div>
</div>
<form method="POST" action="{{ route('countries.store') }}"
class="rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
@csrf
<div
class="mb-5 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200">
Fields marked with <span class="font-bold text-red-600 dark:text-red-300">*</span> are mandatory ISO/WMS
support fields.
</div>
@include('countries::_form', ['country' => $country])
<div class="mt-8 flex flex-wrap gap-2 border-t border-zinc-200 pt-6 dark:border-zinc-800">
<button type="submit"
class="rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Create
country</button>
<a href="{{ route('countries.index') }}" wire:navigate
class="rounded-xl bg-zinc-100 px-4 py-2.5 text-sm font-semibold text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700">Cancel</a>
</div>
</form>
</div>
</x-layouts.app>
@@ -0,0 +1,47 @@
<x-layouts.app>
<div class="mx-auto max-w-[1400px] space-y-6" dusk="countries-edit">
<div
class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">ISO 3166 country
support</p>
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Edit {{ $country->flag_emoji }}
{{ $country->effective_name }}</h1>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Expose and manage every ISO, operational,
regional, currency, logistics and WMS support parameter.</p>
</div>
<div class="flex flex-wrap gap-2">
<a href="{{ route('countries.show', $country) }}" wire:navigate
class="rounded-xl bg-white/10 px-4 py-2.5 text-sm font-semibold text-white ring-1 ring-white/20 hover:bg-white/20">View
country</a>
<a href="{{ route('countries.index') }}" wire:navigate
class="rounded-xl bg-white/10 px-4 py-2.5 text-sm font-semibold text-white ring-1 ring-white/20 hover:bg-white/20">Back</a>
</div>
</div>
</div>
</div>
<form method="POST" action="{{ route('countries.update', $country) }}"
class="rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
@csrf
@method('PUT')
<div
class="mb-5 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200">
Fields marked with <span class="font-bold text-red-600 dark:text-red-300">*</span> are mandatory ISO/WMS
support fields.
</div>
@include('countries::_form', ['country' => $country])
<div class="mt-8 flex flex-wrap gap-2 border-t border-zinc-200 pt-6 dark:border-zinc-800">
<button type="submit"
class="rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Save
country</button>
<a href="{{ route('countries.show', $country) }}" wire:navigate
class="rounded-xl bg-zinc-100 px-4 py-2.5 text-sm font-semibold text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700">Cancel</a>
</div>
</form>
</div>
</x-layouts.app>
@@ -0,0 +1,152 @@
<x-layouts.app>
<div class="mx-auto max-w-[1800px] space-y-6" dusk="countries-index">
<div
class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">Reference data</p>
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Countries</h1>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Governed ISO 3166 country records for tenants,
companies, warehouses, billing, shipping, carriers, customs and integrations.</p>
</div>
<div class="flex flex-wrap gap-2">
<form method="POST" action="{{ route('countries.sync') }}">
@csrf
<button type="submit"
class="rounded-xl bg-white/10 px-4 py-2.5 text-sm font-semibold text-white ring-1 ring-white/20 hover:bg-white/20">Sync
ISO data</button>
</form>
<a href="{{ route('countries.create') }}" wire:navigate
class="rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">New
country</a>
</div>
</div>
</div>
</div>
@if (session('success'))
<div
class="rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm font-medium text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200">
{{ session('success') }}</div>
@endif
<div class="grid gap-4 md:grid-cols-3">
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="text-sm text-zinc-500">Total countries</div>
<div class="mt-2 text-3xl font-semibold">{{ number_format($totalCount) }}</div>
</div>
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="text-sm text-zinc-500">Active</div>
<div class="mt-2 text-3xl font-semibold text-emerald-700 dark:text-emerald-300">
{{ number_format($activeCount) }}</div>
</div>
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="text-sm text-zinc-500">Inactive</div>
<div class="mt-2 text-3xl font-semibold text-amber-700 dark:text-amber-300">
{{ number_format($inactiveCount) }}</div>
</div>
</div>
<form method="GET" action="{{ route('countries.index') }}"
class="grid gap-3 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 md:grid-cols-[1fr_220px_220px_auto] md:items-center">
<input name="search" value="{{ $search }}"
placeholder="Search by country, ISO code, currency or calling code"
class="min-h-11 rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" />
<select name="status"
class="min-h-11 rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="all" @selected($status === 'all')>All statuses</option>
<option value="active" @selected($status === 'active')>Active</option>
<option value="inactive" @selected($status === 'inactive')>Inactive</option>
</select>
<select name="region"
class="min-h-11 rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
<option value="all" @selected($region === 'all')>All regions</option>
@foreach ($regions as $availableRegion)
<option value="{{ $availableRegion }}" @selected($region === $availableRegion)>{{ $availableRegion }}</option>
@endforeach
</select>
<button type="submit"
class="rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Filter</button>
</form>
<div
class="overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-zinc-200 dark:divide-zinc-800">
<thead class="bg-zinc-50 dark:bg-zinc-950">
<tr>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Country</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">ISO
</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Region</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Currency</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Support</th>
<th class="px-4 py-3 text-right text-xs font-bold uppercase tracking-wide text-zinc-500">
Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-zinc-100 dark:divide-zinc-800">
@forelse ($countries as $country)
<tr class="hover:bg-blue-50/50 dark:hover:bg-blue-950/20">
<td class="px-4 py-3">
<div class="flex items-center gap-3">
<span class="text-xl">{{ $country->flag_emoji }}</span>
<div>
<div class="font-semibold text-zinc-900 dark:text-zinc-100">
{{ $country->effective_name }}</div>
<div class="text-xs text-zinc-500">
{{ $country->official_name ?: $country->name }}</div>
</div>
</div>
</td>
<td class="px-4 py-3">
<div class="font-mono text-sm text-blue-700 dark:text-blue-300">
{{ $country->alpha2 }} / {{ $country->alpha3 }} / {{ $country->numeric }}
</div>
<div class="text-xs text-zinc-500">
{{ str($country->iso_status ?? 'official')->replace('_', ' ')->title() }}</div>
</td>
<td class="px-4 py-3 text-sm text-zinc-600 dark:text-zinc-300">
<div>{{ $country->region ?: '—' }}</div>
<div class="text-xs text-zinc-500">{{ $country->subregion ?: '—' }}</div>
</td>
<td class="px-4 py-3 text-sm">
<div class="font-mono text-zinc-900 dark:text-zinc-100">
{{ $country->currency_code ?: '—' }}</div>
<div class="text-xs text-zinc-500">{{ $country->currency_name ?: '—' }}</div>
</td>
<td class="px-4 py-3">
@if ($country->is_active)
<span
class="rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-bold text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200">Active</span>@else<span
class="rounded-full bg-amber-100 px-2.5 py-1 text-xs font-bold text-amber-800 dark:bg-amber-950 dark:text-amber-200">Inactive</span>
@endif
</td>
<td class="px-4 py-3 text-right"><a href="{{ route('countries.show', $country) }}"
wire:navigate
class="rounded-lg bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700">Open</a>
<a href="{{ route('countries.edit', $country) }}" wire:navigate
class="rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-700">Edit</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-4 py-10 text-center text-sm text-zinc-500">No countries
matched your search.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="border-t border-zinc-200 px-4 py-3 dark:border-zinc-800">{{ $countries->links() }}</div>
</div>
</div>
</x-layouts.app>
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Module Countries</title>
{{-- Laravel Mix - CSS File --}}
{{-- <link rel="stylesheet" href="{{ mix('css/countries.css') }}"> --}}
</head>
<body>
<div data-dusk="page-ready" style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);"
aria-hidden="true"></div>
@yield('content')
{{-- Laravel Mix - JS File --}}
{{-- <script src="{{ mix('js/countries.js') }}"></script> --}}
</body>
</html>
@@ -0,0 +1,212 @@
<x-layouts.app>
<div class="mx-auto max-w-[1400px] space-y-6" dusk="countries-show">
<div
class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">ISO 3166 country</p>
<h1 class="mt-2 text-3xl font-semibold tracking-tight">{{ $country->flag_emoji }}
{{ $country->effective_name }}</h1>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">
{{ $country->official_name ?: $country->name }}</p>
</div>
<div class="flex flex-wrap gap-2">
<a href="{{ route('countries.edit', $country) }}" wire:navigate
class="rounded-xl bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-blue-700">Edit
country</a>
<a href="{{ route('countries.index') }}" wire:navigate
class="rounded-xl bg-white/10 px-4 py-2.5 text-sm font-semibold text-white ring-1 ring-white/20 hover:bg-white/20">Back</a>
</div>
</div>
</div>
</div>
@if (session('success'))
<div
class="rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm font-medium text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200">
{{ session('success') }}</div>
@endif
@php
$fields = [
'Alpha-2' => $country->alpha2,
'Alpha-3' => $country->alpha3,
'Numeric' => $country->numeric,
'Canonical name' => $country->name,
'Official name' => $country->official_name ?: '—',
'Common name' => $country->common_name ?: '—',
'Display override' => $country->display_name ?: '—',
'Native name' => $country->native_name ?: '—',
'Capital' => $country->capital ?: '—',
'ISO status' => str($country->iso_status ?? 'official')
->replace('_', ' ')
->title(),
'Sovereignty status' => $country->sovereignty_status ?: '—',
'Independent' => is_null($country->independent) ? '—' : ($country->independent ? 'Yes' : 'No'),
'UN member' => is_null($country->un_member) ? '—' : ($country->un_member ? 'Yes' : 'No'),
'Continent' => $country->continent ?: '—',
'Region' => $country->region ?: '—',
'Subregion' => $country->subregion ?: '—',
'Intermediate region' => $country->intermediate_region ?: '—',
'Calling code' => $country->calling_code ?: '—',
'TLD' => $country->tld ?: '—',
'Currency code' => $country->currency_code ?: '—',
'Currency name' => $country->currency_name ?: '—',
'Currency symbol' => $country->currency_symbol ?: '—',
'Latitude' => $country->latitude ?: '—',
'Longitude' => $country->longitude ?: '—',
'IOC code' => $country->ioc_code ?: '—',
'FIFA code' => $country->fifa_code ?: '—',
'Postal-code format' => $country->postal_code_format ?: '—',
'Active' => $country->is_active ? 'Yes' : 'No',
'Sort order' => $country->sort_order,
'Source' => $country->source ?: '—',
'Source version' => $country->source_version ?: '—',
'Last synced' => $country->last_synced_at?->format('Y-m-d H:i') ?: '—',
];
@endphp
<div class="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
@foreach ($fields as $label => $value)
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="text-xs font-bold uppercase tracking-wide text-zinc-500">{{ $label }}</div>
<div class="mt-2 break-words text-base font-semibold text-zinc-900 dark:text-zinc-100">
{{ $value }}</div>
</div>
@endforeach
</div>
<div class="grid gap-4 lg:grid-cols-3">
@foreach (['Languages' => $country->languages, 'Timezones' => $country->timezones, 'Metadata' => $country->metadata] as $label => $value)
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $label }}</h2>
<pre class="mt-3 max-h-80 overflow-auto rounded-xl bg-zinc-950 p-4 text-xs text-zinc-100">{{ $value ? json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : '—' }}</pre>
</div>
@endforeach
</div>
@if ($country->address_format || $country->flag_svg_url || $country->flag_png_url)
<div class="grid gap-4 lg:grid-cols-3">
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 lg:col-span-2">
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">Address format</h2>
<pre
class="mt-3 whitespace-pre-wrap rounded-xl bg-zinc-100 p-4 text-sm text-zinc-700 dark:bg-zinc-950 dark:text-zinc-200">{{ $country->address_format ?: '—' }}</pre>
</div>
<div
class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">Flag assets</h2>
<div class="mt-3 space-y-2 text-sm text-zinc-600 dark:text-zinc-300">
<div>SVG: {{ $country->flag_svg_url ?: '—' }}</div>
<div>PNG: {{ $country->flag_png_url ?: '—' }}</div>
</div>
</div>
</div>
@endif
<div
class="overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="border-b border-zinc-200 px-5 py-4 dark:border-zinc-800">
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">WMS usage report</h2>
<p class="text-xs text-zinc-500">Best-effort counts across known WMS tables. Missing optional tables are
skipped safely.</p>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-zinc-200 dark:divide-zinc-800">
<thead class="bg-zinc-50 dark:bg-zinc-950">
<tr>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">Area
</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Table</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Column</th>
<th class="px-4 py-3 text-right text-xs font-bold uppercase tracking-wide text-zinc-500">
References</th>
</tr>
</thead>
<tbody class="divide-y divide-zinc-100 dark:divide-zinc-800">
@forelse ($usageRows ?? [] as $row)
<tr>
<td class="px-4 py-3 text-sm font-semibold text-zinc-900 dark:text-zinc-100">
{{ $row['label'] }}</td>
<td class="px-4 py-3 font-mono text-xs text-zinc-500">{{ $row['table'] }}</td>
<td class="px-4 py-3 font-mono text-xs text-blue-700 dark:text-blue-300">
{{ $row['column'] }}</td>
<td class="px-4 py-3 text-right text-sm font-semibold text-zinc-900 dark:text-zinc-100">
{{ number_format($row['count']) }}</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-4 py-8 text-center text-sm text-zinc-500">No country-aware
WMS usage tables were detected yet.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div
class="overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="border-b border-zinc-200 px-5 py-4 dark:border-zinc-800">
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">ISO 3166-2 subdivisions</h2>
<p class="text-xs text-zinc-500">Subdivisions support address, compliance and shipping workflows.</p>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-zinc-200 dark:divide-zinc-800">
<thead class="bg-zinc-50 dark:bg-zinc-950">
<tr>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">Code
</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">Name
</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">Type
</th>
<th class="px-4 py-3 text-left text-xs font-bold uppercase tracking-wide text-zinc-500">
Status</th>
</tr>
</thead>
<tbody class="divide-y divide-zinc-100 dark:divide-zinc-800">
@forelse ($country->subdivisions as $subdivision)
<tr>
<td class="px-4 py-3 font-mono text-sm text-blue-700 dark:text-blue-300">
{{ $subdivision->code }}</td>
<td class="px-4 py-3 text-sm font-semibold text-zinc-900 dark:text-zinc-100">
{{ $subdivision->name }}</td>
<td class="px-4 py-3 text-sm text-zinc-500">{{ $subdivision->type ?: '—' }}</td>
<td class="px-4 py-3 text-sm text-zinc-500">
{{ str($subdivision->iso_status)->replace('_', ' ')->title() }}</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-4 py-8 text-center text-sm text-zinc-500">No subdivisions
have been imported for this country yet.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<form method="POST" action="{{ route('countries.destroy', $country) }}"
class="rounded-2xl border border-red-200 bg-red-50 p-5 dark:border-red-900 dark:bg-red-950">
@csrf
@method('DELETE')
<div class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
<div>
<h2 class="text-sm font-semibold text-red-900 dark:text-red-100">Archive country</h2>
<p class="text-sm text-red-700 dark:text-red-200">Soft-deletes the record for administration. Do not
archive countries referenced by active business data.</p>
</div>
<button type="submit"
class="rounded-xl bg-red-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-red-700"
onclick="return confirm('Archive this country?')">Archive</button>
</div>
</form>
</div>
</x-layouts.app>