Expand member profile fields

This commit is contained in:
2026-01-25 06:37:10 +08:00
parent 29c44f2dbe
commit 2cf0c19b61
4 changed files with 205 additions and 6 deletions

View File

@@ -50,11 +50,21 @@ class ProfileController extends Controller
$request->user()->save(); $request->user()->save();
$memberFields = [ $memberFields = [
'national_id',
'phone', 'phone',
'phone_home',
'phone_fax',
'address_line_1', 'address_line_1',
'address_line_2', 'address_line_2',
'city', 'city',
'postal_code', 'postal_code',
'birth_date',
'gender',
'identity_type',
'identity_other_text',
'occupation',
'employer',
'job_title',
'emergency_contact_name', 'emergency_contact_name',
'emergency_contact_phone', 'emergency_contact_phone',
]; ];

View File

@@ -18,7 +18,17 @@ class ProfileUpdateRequest extends FormRequest
return [ return [
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
'national_id' => ['nullable', 'string', 'max:50'],
'phone' => ['nullable', 'string', 'max:50'], 'phone' => ['nullable', 'string', 'max:50'],
'phone_home' => ['nullable', 'string', 'max:50'],
'phone_fax' => ['nullable', 'string', 'max:50'],
'birth_date' => ['nullable', 'date'],
'gender' => ['nullable', 'in:male,female,other'],
'identity_type' => ['nullable', 'in:patient,parent,social,other'],
'identity_other_text' => ['nullable', 'string', 'max:255', 'required_if:identity_type,other'],
'occupation' => ['nullable', 'string', 'max:120'],
'employer' => ['nullable', 'string', 'max:255'],
'job_title' => ['nullable', 'string', 'max:120'],
'address_line_1' => ['nullable', 'string', 'max:255'], 'address_line_1' => ['nullable', 'string', 'max:255'],
'address_line_2' => ['nullable', 'string', 'max:255'], 'address_line_2' => ['nullable', 'string', 'max:255'],
'city' => ['nullable', 'string', 'max:120'], 'city' => ['nullable', 'string', 'max:120'],

View File

@@ -21,6 +21,9 @@
"Basic Information": "基本資訊", "Basic Information": "基本資訊",
"Full Name": "全名", "Full Name": "全名",
"Phone": "電話", "Phone": "電話",
"Mobile Phone": "行動電話",
"Home Phone": "室內電話",
"Fax": "傳真",
"National ID (Optional)": "身分證字號(選填)", "National ID (Optional)": "身分證字號(選填)",
"Your national ID will be encrypted for security.": "您的身分證字號將會加密儲存以確保安全。", "Your national ID will be encrypted for security.": "您的身分證字號將會加密儲存以確保安全。",
"Address": "地址", "Address": "地址",
@@ -28,6 +31,16 @@
"Address Line 2": "地址第二行", "Address Line 2": "地址第二行",
"City": "城市", "City": "城市",
"Postal Code": "郵遞區號", "Postal Code": "郵遞區號",
"Member Number": "會員編號",
"Application Date": "申請日期",
"Birth Date": "出生年月日",
"Gender": "性別",
"Identity Type": "身份別",
"Identity Type Other": "身份別其他說明",
"National ID": "身分證號",
"Occupation": "現職",
"Employer": "服務單位",
"Job Title": "職稱",
"Emergency Contact": "緊急聯絡人", "Emergency Contact": "緊急聯絡人",
"Emergency Contact Name": "緊急聯絡人姓名", "Emergency Contact Name": "緊急聯絡人姓名",
"Emergency Contact Phone": "緊急聯絡人電話", "Emergency Contact Phone": "緊急聯絡人電話",

View File

@@ -67,7 +67,110 @@
</div> </div>
<div> <div>
<x-input-label for="phone" :value="__('Phone')" /> <x-input-label for="member_number" :value="__('Member Number')" />
<x-text-input
id="member_number"
name="member_number"
type="text"
class="mt-1 block w-full"
:value="old('member_number', optional($member)->member_number)"
disabled
readonly
/>
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">由系統編號,不提供修改。</p>
</div>
<div>
<x-input-label for="applied_at" :value="__('Application Date')" />
<x-text-input
id="applied_at"
name="applied_at"
type="date"
class="mt-1 block w-full"
:value="old('applied_at', optional(optional($member)->applied_at)->toDateString())"
disabled
readonly
/>
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">由系統帶入,無需修改。</p>
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<x-input-label for="birth_date" :value="__('Birth Date')" />
<x-text-input
id="birth_date"
name="birth_date"
type="date"
class="mt-1 block w-full"
:value="old('birth_date', optional(optional($member)->birth_date)->toDateString())"
/>
<x-input-error class="mt-2" :messages="$errors->get('birth_date')" />
</div>
<div>
<x-input-label for="gender" :value="__('Gender')" />
<select
id="gender"
name="gender"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"
>
<option value="">{{ __('Not set') }}</option>
<option value="male" @selected(old('gender', optional($member)->gender) === 'male')></option>
<option value="female" @selected(old('gender', optional($member)->gender) === 'female')></option>
<option value="other" @selected(old('gender', optional($member)->gender) === 'other')>其他</option>
</select>
<x-input-error class="mt-2" :messages="$errors->get('gender')" />
</div>
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<x-input-label for="identity_type" :value="__('Identity Type')" />
<select
id="identity_type"
name="identity_type"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"
>
<option value="">{{ __('Not set') }}</option>
<option value="patient" @selected(old('identity_type', optional($member)->identity_type) === 'patient')>病友</option>
<option value="parent" @selected(old('identity_type', optional($member)->identity_type) === 'parent')>父母</option>
<option value="social" @selected(old('identity_type', optional($member)->identity_type) === 'social')>社會人士</option>
<option value="other" @selected(old('identity_type', optional($member)->identity_type) === 'other')>其他</option>
</select>
<x-input-error class="mt-2" :messages="$errors->get('identity_type')" />
</div>
<div>
<x-input-label for="identity_other_text" :value="__('Identity Type Other')" />
<x-text-input
id="identity_other_text"
name="identity_other_text"
type="text"
class="mt-1 block w-full"
:value="old('identity_other_text', optional($member)->identity_other_text)"
placeholder="若選其他請填寫"
/>
<x-input-error class="mt-2" :messages="$errors->get('identity_other_text')" />
</div>
</div>
<div>
<x-input-label for="national_id" :value="__('National ID')" />
<x-text-input
id="national_id"
name="national_id"
type="text"
class="mt-1 block w-full"
:value="old('national_id', optional($member)->national_id)"
autocomplete="off"
/>
<x-input-error class="mt-2" :messages="$errors->get('national_id')" />
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">將加密儲存以確保安全。</p>
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<x-input-label for="phone" :value="__('Mobile Phone')" />
<x-text-input <x-text-input
id="phone" id="phone"
name="phone" name="phone"
@@ -79,6 +182,69 @@
<x-input-error class="mt-2" :messages="$errors->get('phone')" /> <x-input-error class="mt-2" :messages="$errors->get('phone')" />
</div> </div>
<div>
<x-input-label for="phone_home" :value="__('Home Phone')" />
<x-text-input
id="phone_home"
name="phone_home"
type="text"
class="mt-1 block w-full"
:value="old('phone_home', optional($member)->phone_home)"
/>
<x-input-error class="mt-2" :messages="$errors->get('phone_home')" />
</div>
</div>
<div>
<x-input-label for="phone_fax" :value="__('Fax')" />
<x-text-input
id="phone_fax"
name="phone_fax"
type="text"
class="mt-1 block w-full"
:value="old('phone_fax', optional($member)->phone_fax)"
/>
<x-input-error class="mt-2" :messages="$errors->get('phone_fax')" />
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<x-input-label for="occupation" :value="__('Occupation')" />
<x-text-input
id="occupation"
name="occupation"
type="text"
class="mt-1 block w-full"
:value="old('occupation', optional($member)->occupation)"
/>
<x-input-error class="mt-2" :messages="$errors->get('occupation')" />
</div>
<div>
<x-input-label for="job_title" :value="__('Job Title')" />
<x-text-input
id="job_title"
name="job_title"
type="text"
class="mt-1 block w-full"
:value="old('job_title', optional($member)->job_title)"
/>
<x-input-error class="mt-2" :messages="$errors->get('job_title')" />
</div>
</div>
<div>
<x-input-label for="employer" :value="__('Employer')" />
<x-text-input
id="employer"
name="employer"
type="text"
class="mt-1 block w-full"
:value="old('employer', optional($member)->employer)"
/>
<x-input-error class="mt-2" :messages="$errors->get('employer')" />
</div>
<div> <div>
<x-input-label for="address_line_1" :value="__('Address Line 1')" /> <x-input-label for="address_line_1" :value="__('Address Line 1')" />
<x-text-input <x-text-input