From f222ac3989a0658f514aee9facfd371371f36a97 Mon Sep 17 00:00:00 2001 From: grabowski Date: Wed, 15 Apr 2026 09:58:38 +0700 Subject: [PATCH] Add personal/address/emergency sections to new-employee form Three new form blocks slot in between Tax & Bank and Salary: - Personal: date of birth, gender (select), nationality (defaults to Thai), marital status (select) - Address: line 1/2, subdistrict (Tambon), district (Amphoe), province (Changwat), postal code, country (defaults to Thailand) - Emergency Contact: name, phone, relationship Server action pulls each new field from formData (all optional) and includes them in the employees insert. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../[companyId]/employees/new/+page.server.ts | 29 ++++ .../[companyId]/employees/new/+page.svelte | 139 ++++++++++++++++++ 2 files changed, 168 insertions(+) diff --git a/src/routes/(app)/companies/[companyId]/employees/new/+page.server.ts b/src/routes/(app)/companies/[companyId]/employees/new/+page.server.ts index 7761963..a3cdbb5 100644 --- a/src/routes/(app)/companies/[companyId]/employees/new/+page.server.ts +++ b/src/routes/(app)/companies/[companyId]/employees/new/+page.server.ts @@ -32,6 +32,21 @@ export const actions: Actions = { const taxId = formData.get('taxId')?.toString().trim() || null; const bankName = formData.get('bankName')?.toString().trim() || null; const bankAccount = formData.get('bankAccount')?.toString().trim() || null; + const dateOfBirth = formData.get('dateOfBirth')?.toString().trim() || null; + const gender = formData.get('gender')?.toString().trim() || null; + const nationality = formData.get('nationality')?.toString().trim() || null; + const maritalStatus = formData.get('maritalStatus')?.toString().trim() || null; + const addressLine1 = formData.get('addressLine1')?.toString().trim() || null; + const addressLine2 = formData.get('addressLine2')?.toString().trim() || null; + const subdistrict = formData.get('subdistrict')?.toString().trim() || null; + const district = formData.get('district')?.toString().trim() || null; + const province = formData.get('province')?.toString().trim() || null; + const postalCode = formData.get('postalCode')?.toString().trim() || null; + const country = formData.get('country')?.toString().trim() || null; + const emergencyContactName = formData.get('emergencyContactName')?.toString().trim() || null; + const emergencyContactPhone = formData.get('emergencyContactPhone')?.toString().trim() || null; + const emergencyContactRelationship = + formData.get('emergencyContactRelationship')?.toString().trim() || null; const initialSalaryRaw = formData.get('initialSalary')?.toString().trim(); if (!firstName) return fail(400, { error: 'First name is required' }); @@ -60,6 +75,20 @@ export const actions: Actions = { taxId, bankName, bankAccount, + dateOfBirth, + gender, + nationality, + maritalStatus, + addressLine1, + addressLine2, + subdistrict, + district, + province, + postalCode, + country, + emergencyContactName, + emergencyContactPhone, + emergencyContactRelationship, isActive: true }) .returning(); diff --git a/src/routes/(app)/companies/[companyId]/employees/new/+page.svelte b/src/routes/(app)/companies/[companyId]/employees/new/+page.svelte index 0ada9b6..4c46a20 100644 --- a/src/routes/(app)/companies/[companyId]/employees/new/+page.svelte +++ b/src/routes/(app)/companies/[companyId]/employees/new/+page.svelte @@ -190,6 +190,145 @@ + +
+

+ Personal +

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+

+ Address +

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+

+ Emergency Contact +

+
+
+ + +
+
+ + +
+
+ + +
+
+
+