Files
2026-09-21 10:14:57 +01:00

215 lines
13 KiB
PHP
Executable File

<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">
<caption class="sr-only">Data table</caption>
<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">
<caption class="sr-only">Data table</caption>
<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>