diff --git a/src/routes/backoffice/timesheets/+page.svelte b/src/routes/backoffice/timesheets/+page.svelte index 25f941c..82cff4b 100644 --- a/src/routes/backoffice/timesheets/+page.svelte +++ b/src/routes/backoffice/timesheets/+page.svelte @@ -1,8 +1,6 @@ + +
+
+ Villa Logo + +

Timesheet Entry

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
{form.total_work_hour}
+
+ +
+ + +
+ + +
+
diff --git a/src/routes/timesheet/+page.svelte b/src/routes/timesheet/+page.svelte index f5aa5bd..44b8898 100644 --- a/src/routes/timesheet/+page.svelte +++ b/src/routes/timesheet/+page.svelte @@ -20,6 +20,7 @@ datetime_out: string; total_work_hour: number; remarks: string; + approved_date: string | null; approval: boolean | null; // Allow null for new entries }; @@ -46,9 +47,9 @@ datetime_out: "", total_work_hour: 0, remarks: "", + approved_date: null, approval: null, // Default null }; - const typeOfWorkOptions: TimesheetForm["type_of_work"][] = [ "Running", "Periodic", @@ -115,7 +116,16 @@ alert("Please select a villa."); return; } - + if (form.approval) { + const today = new Date(); + const yyyy = today.getFullYear(); + const mm = String(today.getMonth() + 1).padStart(2, "0"); + const dd = String(today.getDate()).padStart(2, "0"); + form.approved_date = `${yyyy}/${mm}/${dd}`; + } else { + form.approved_date = null; + } + form.approval = form.total_work_hour <= 1; const { error } = await supabase.from("vb_timesheet").insert([form]); if (error) { @@ -263,7 +273,6 @@ placeholder="Optional remarks" > -