DONE: merge heir tab into profile tab, santize userIcNum and name, rename to malay, add stat card on user list
This commit is contained in:
@@ -22,7 +22,7 @@ import { AlertRoot, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
||||
import { Lucide } from '@/components/ui/lucide'
|
||||
import { getApiErrorMessage, getApiValidationErrors } from '@/core/utils/getApiErrorMessage'
|
||||
import { submitMembershipApplication, lookupMemberByIcNumber } from '../services/membership-application.service'
|
||||
import { sanitizeIcNumberInput } from '../utils/membership-application-form.utils'
|
||||
import { sanitizeIcNumberInput, sanitizeNameInput } from '@/utils/form-input.utils'
|
||||
import type {
|
||||
MembershipApplicationFormState,
|
||||
MembershipApplicationHeirForm,
|
||||
@@ -80,15 +80,15 @@ const RELATIONSHIP_OPTIONS: SelectOption[] = [
|
||||
// TODO: replace with API lookup
|
||||
const EMPLOYERS = [
|
||||
{
|
||||
name: 'INFRA QUEST SDN BHD',
|
||||
name: 'Infra Quest Sdn. Bhd. (IQSB)',
|
||||
address: 'Lot 1045, Jalan Dato’ Lundang, 15200 Kota Bharu, Kelantan',
|
||||
},
|
||||
{
|
||||
name: 'Permodalan Kelantan Berhad',
|
||||
name: 'Permodalan Kelantan Berhad (PKB)',
|
||||
address: 'Permodalan Kelantan Berhad, Tingkat 4, Wisma Permodalan Kelantan Berhad, Jalan Maju, 15000 Kota Bharu Kelantan',
|
||||
},
|
||||
{
|
||||
name: 'Koperasi Permodalan Kelantan Berhad',
|
||||
name: 'Koperasi Permodalan Kelantan Berhad (KOPKB)',
|
||||
address: 'Lot Pt 448, Tingkat 1,Jalan Kuala Krai, Batu 3, Wakaf Che Yeh, 15150 Kota Bharu, Kelantan.',
|
||||
},
|
||||
{
|
||||
@@ -226,11 +226,23 @@ function handleReferenceIcInput(role: 'proposer' | 'supporter') {
|
||||
clearReference(role)
|
||||
}
|
||||
|
||||
function handleApplicantNameInput() {
|
||||
form.applicant.name = sanitizeNameInput(form.applicant.name)
|
||||
delete fieldErrors['applicant.name']
|
||||
}
|
||||
|
||||
function handleApplicantIcInput() {
|
||||
form.applicant.ic_number = sanitizeIcNumberInput(form.applicant.ic_number)
|
||||
delete fieldErrors['applicant.ic_number']
|
||||
}
|
||||
|
||||
function handleHeirNameInput(index: number) {
|
||||
const heir = form.heirs[index]
|
||||
if (!heir) return
|
||||
heir.name = sanitizeNameInput(heir.name)
|
||||
delete fieldErrors[`heirs.${index}.name`]
|
||||
}
|
||||
|
||||
function handleHeirIcInput(index: number) {
|
||||
const heir = form.heirs[index]
|
||||
if (!heir) return
|
||||
@@ -622,7 +634,7 @@ function stepLabelClass(stepId: number) {
|
||||
<template v-if="currentStep === 1">
|
||||
<Field class="col-span-12 sm:col-span-6">
|
||||
<FieldLabel for="name">Nama Penuh</FieldLabel>
|
||||
<Input id="name" v-model="form.applicant.name" type="text" />
|
||||
<Input id="name" v-model="form.applicant.name" type="text" @input="handleApplicantNameInput" />
|
||||
<FieldError v-if="fieldErrors['applicant.name']">{{ fieldErrors['applicant.name'] }}</FieldError>
|
||||
</Field>
|
||||
<Field class="col-span-12 sm:col-span-6">
|
||||
@@ -808,7 +820,8 @@ function stepLabelClass(stepId: number) {
|
||||
<div class="grid grid-cols-12 gap-4">
|
||||
<Field class="col-span-12 sm:col-span-6">
|
||||
<FieldLabel :for="`heir-name-${index}`">Nama</FieldLabel>
|
||||
<Input :id="`heir-name-${index}`" v-model="heir.name" type="text" />
|
||||
<Input :id="`heir-name-${index}`" v-model="heir.name" type="text"
|
||||
@input="handleHeirNameInput(index)" />
|
||||
<FieldError v-if="fieldErrors[`heirs.${index}.name`]">
|
||||
{{ fieldErrors[`heirs.${index}.name`] }}
|
||||
</FieldError>
|
||||
|
||||
Reference in New Issue
Block a user