This commit is contained in:
@@ -29,145 +29,129 @@ if (!client) return Astro.redirect('/dashboard/clients');
|
||||
<DashboardLayout title={`Edit ${client.name} - Chronus`}>
|
||||
<div class="max-w-2xl mx-auto">
|
||||
<div class="flex items-center gap-3 mb-6">
|
||||
<a href={`/dashboard/clients/${client.id}`} class="btn btn-ghost btn-sm">
|
||||
<Icon name="heroicons:arrow-left" class="w-5 h-5" />
|
||||
<a href={`/dashboard/clients/${client.id}`} class="btn btn-ghost btn-xs">
|
||||
<Icon name="heroicons:arrow-left" class="w-4 h-4" />
|
||||
</a>
|
||||
<h1 class="text-3xl font-bold">Edit Client</h1>
|
||||
<h1 class="text-2xl font-extrabold tracking-tight">Edit Client</h1>
|
||||
</div>
|
||||
|
||||
<form method="POST" action={`/api/clients/${client.id}/update`} class="card bg-base-100 shadow-xl border border-base-200">
|
||||
<div class="card-body">
|
||||
<div class="form-control">
|
||||
<label class="label" for="name">
|
||||
Client Name
|
||||
</label>
|
||||
<form method="POST" action={`/api/clients/${client.id}/update`} class="card card-border bg-base-100">
|
||||
<div class="card-body p-4">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">Client Name</legend>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
name="name"
|
||||
value={client.name}
|
||||
placeholder="Acme Corp"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label" for="email">
|
||||
Email (optional)
|
||||
</label>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">Email (optional)</legend>
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
name="email"
|
||||
value={client.email || ''}
|
||||
placeholder="jason.borne@cia.com"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label" for="phone">
|
||||
Phone (optional)
|
||||
</label>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">Phone (optional)</legend>
|
||||
<input
|
||||
type="tel"
|
||||
id="phone"
|
||||
name="phone"
|
||||
value={client.phone || ''}
|
||||
placeholder="+1 (780) 420-1337"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="divider">Address Details</div>
|
||||
<div class="divider text-xs text-base-content/40">Address Details</div>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label" for="street">
|
||||
Street Address (optional)
|
||||
</label>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">Street Address (optional)</legend>
|
||||
<input
|
||||
type="text"
|
||||
id="street"
|
||||
name="street"
|
||||
value={client.street || ''}
|
||||
placeholder="123 Business Rd"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div class="form-control">
|
||||
<label class="label" for="city">
|
||||
City (optional)
|
||||
</label>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">City (optional)</legend>
|
||||
<input
|
||||
type="text"
|
||||
id="city"
|
||||
name="city"
|
||||
value={client.city || ''}
|
||||
placeholder="Edmonton"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label" for="state">
|
||||
State / Province (optional)
|
||||
</label>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">State / Province (optional)</legend>
|
||||
<input
|
||||
type="text"
|
||||
id="state"
|
||||
name="state"
|
||||
value={client.state || ''}
|
||||
placeholder="AB"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div class="form-control">
|
||||
<label class="label" for="zip">
|
||||
Zip / Postal Code (optional)
|
||||
</label>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">Zip / Postal Code (optional)</legend>
|
||||
<input
|
||||
type="text"
|
||||
id="zip"
|
||||
name="zip"
|
||||
value={client.zip || ''}
|
||||
placeholder="10001"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label" for="country">
|
||||
Country (optional)
|
||||
</label>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend text-xs">Country (optional)</legend>
|
||||
<input
|
||||
type="text"
|
||||
id="country"
|
||||
name="country"
|
||||
value={client.country || ''}
|
||||
placeholder="Canada"
|
||||
class="input input-bordered w-full"
|
||||
class="input w-full"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="card-actions justify-between mt-6">
|
||||
<div class="flex justify-between items-center mt-4">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-error btn-outline"
|
||||
class="btn btn-error btn-outline btn-sm"
|
||||
onclick={`document.getElementById('delete_modal').showModal()`}
|
||||
>
|
||||
Delete Client
|
||||
</button>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<a href={`/dashboard/clients/${client.id}`} class="btn btn-ghost">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||
<a href={`/dashboard/clients/${client.id}`} class="btn btn-ghost btn-sm">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary btn-sm">Save Changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -177,17 +161,17 @@ if (!client) return Astro.redirect('/dashboard/clients');
|
||||
<!-- Delete Confirmation Modal -->
|
||||
<dialog id="delete_modal" class="modal">
|
||||
<div class="modal-box">
|
||||
<h3 class="font-bold text-lg text-error">Delete Client?</h3>
|
||||
<p class="py-4">
|
||||
<h3 class="font-semibold text-base text-error">Delete Client?</h3>
|
||||
<p class="py-4 text-sm">
|
||||
Are you sure you want to delete <strong>{client.name}</strong>?
|
||||
This action cannot be undone and will delete all associated time entries.
|
||||
</p>
|
||||
<div class="modal-action">
|
||||
<form method="dialog">
|
||||
<button class="btn">Cancel</button>
|
||||
<button class="btn btn-sm">Cancel</button>
|
||||
</form>
|
||||
<form method="POST" action={`/api/clients/${client.id}/delete`}>
|
||||
<button type="submit" class="btn btn-error">Delete</button>
|
||||
<button type="submit" class="btn btn-error btn-sm">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user