Merge branch 'development' into feature/exchange-type
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<script lang="ts">
|
||||
import * as AlertDialog from '$lib/components/ui/alert-dialog';
|
||||
import { CircleAlert } from 'lucide-svelte';
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
agentsCount = 0,
|
||||
clientsCount = 0,
|
||||
onAccept,
|
||||
onCancel
|
||||
}: {
|
||||
open?: boolean;
|
||||
agentsCount?: number;
|
||||
clientsCount?: number;
|
||||
onAccept?: () => void;
|
||||
onCancel?: () => void;
|
||||
} = $props();
|
||||
|
||||
const showModal = $derived(agentsCount === 0 || clientsCount === 0);
|
||||
|
||||
const message = $derived(
|
||||
agentsCount === 0 && clientsCount === 0
|
||||
? 'No hay Agentes aduanales ni Clientes registrados. Debes darlos de alta para poder trabajar en este módulo.'
|
||||
: agentsCount === 0
|
||||
? 'No hay Agentes aduanales registrados. Debes darlos de alta para poder trabajar en este módulo.'
|
||||
: 'No hay Clientes registrados. Debes darlos de alta para poder trabajar en este módulo.'
|
||||
);
|
||||
|
||||
function handleOpenChange(newOpen: boolean) {
|
||||
open = newOpen;
|
||||
}
|
||||
|
||||
function handleCancel() {
|
||||
onCancel?.();
|
||||
}
|
||||
|
||||
function handleAccept() {
|
||||
onAccept?.();
|
||||
}
|
||||
</script>
|
||||
|
||||
<AlertDialog.Root bind:open onOpenChange={handleOpenChange}>
|
||||
<AlertDialog.Content>
|
||||
<AlertDialog.Header>
|
||||
<div class="flex items-center gap-3">
|
||||
<CircleAlert class="h-6 w-6 shrink-0 text-amber-500" />
|
||||
<AlertDialog.Title>Aviso</AlertDialog.Title>
|
||||
</div>
|
||||
<AlertDialog.Description class="space-y-3 pt-1">
|
||||
<p>{message}</p>
|
||||
<p class="text-sm text-muted-foreground">
|
||||
Puedes registrarlos en
|
||||
<a
|
||||
href="/dashboard/customs_brokers"
|
||||
class="font-medium text-primary underline underline-offset-4 hover:no-underline"
|
||||
>
|
||||
Agentes Aduanales
|
||||
</a>
|
||||
y
|
||||
<a
|
||||
href="/dashboard/clients_and_providers"
|
||||
class="font-medium text-primary underline underline-offset-4 hover:no-underline"
|
||||
>
|
||||
Clientes y Proveedores
|
||||
</a>.
|
||||
</p>
|
||||
</AlertDialog.Description>
|
||||
</AlertDialog.Header>
|
||||
<AlertDialog.Footer>
|
||||
<AlertDialog.Cancel onclick={handleCancel}>Cancelar</AlertDialog.Cancel>
|
||||
<AlertDialog.Action onclick={handleAccept}>Aceptar</AlertDialog.Action>
|
||||
</AlertDialog.Footer>
|
||||
</AlertDialog.Content>
|
||||
</AlertDialog.Root>
|
||||
@@ -275,7 +275,7 @@
|
||||
<div class="grid grid-cols-4 gap-4">
|
||||
<div class="space-y-2">
|
||||
<Label for="postal_code">C.P.</Label>
|
||||
<Input id="postal_code" bind:value={formData.postal_code} disabled={loading} />
|
||||
<Input id="postal_code" bind:value={formData.postal_code} disabled={loading} oninput={(e) => { formData.postal_code = e.currentTarget.value.replace(/[^a-zA-Z0-9]/g, ''); }} />
|
||||
</div>
|
||||
<div class="space-y-2 col-span-2">
|
||||
<Label for="city">Ciudad</Label>
|
||||
|
||||
@@ -318,6 +318,7 @@
|
||||
placeholder="C.P."
|
||||
maxlength={15}
|
||||
disabled={loading}
|
||||
oninput={(e) => { formData.postal_code = e.currentTarget.value.replace(/[^a-zA-Z0-9]/g, ''); }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user