refactor(person-address): change postal_code to camelCase postalCode
Update all references to postal_code field to use camelCase postalCode for consistency with codebase naming conventions. This includes changes to models, schemas, and components.
This commit is contained in:
@@ -43,7 +43,7 @@ const fieldStates: Record<string, { dependsOn?: string; placeholder: string }> =
|
||||
regency_code: { dependsOn: 'province_code', placeholder: 'Pilih provinsi dahulu' },
|
||||
district_code: { dependsOn: 'regency_code', placeholder: 'Pilih kabupaten/kota dahulu' },
|
||||
village_code: { dependsOn: 'district_code', placeholder: 'Pilih kecamatan dahulu' },
|
||||
postal_code: { dependsOn: 'village_code', placeholder: 'Pilih kelurahan dahulu' },
|
||||
postalCode: { dependsOn: 'village_code', placeholder: 'Pilih kelurahan dahulu' },
|
||||
address: { placeholder: 'Masukkan alamat' },
|
||||
rt: { placeholder: '001' },
|
||||
rw: { placeholder: '002' },
|
||||
@@ -73,7 +73,7 @@ function getFieldState(field: string) {
|
||||
const isDisabledByDependency = !dependencyValue
|
||||
|
||||
// Jika isSame, semua field location disabled
|
||||
if (isSame && ['regency_code', 'district_code', 'village_code', 'postal_code'].includes(field)) {
|
||||
if (isSame && ['regency_code', 'district_code', 'village_code', 'postalCode'].includes(field)) {
|
||||
return { placeholder: '-', disabled: true }
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ function getFieldState(field: string) {
|
||||
}
|
||||
|
||||
// Jika isSame dan field location, disabled
|
||||
if (isSame && ['regency_code', 'district_code', 'village_code', 'postal_code'].includes(field)) {
|
||||
if (isSame && ['regency_code', 'district_code', 'village_code', 'postalCode'].includes(field)) {
|
||||
return { placeholder: '-', disabled: true }
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ watch(
|
||||
regency_code: undefined,
|
||||
district_code: undefined,
|
||||
village_code: undefined,
|
||||
postal_code: undefined,
|
||||
postalCode: undefined,
|
||||
},
|
||||
false,
|
||||
)
|
||||
@@ -133,7 +133,7 @@ watch(
|
||||
{
|
||||
district_code: undefined,
|
||||
village_code: undefined,
|
||||
postal_code: undefined,
|
||||
postalCode: undefined,
|
||||
},
|
||||
false,
|
||||
)
|
||||
@@ -157,7 +157,7 @@ watch(
|
||||
formRef.value.setValues(
|
||||
{
|
||||
village_code: undefined,
|
||||
postal_code: undefined,
|
||||
postalCode: undefined,
|
||||
},
|
||||
false,
|
||||
)
|
||||
@@ -180,7 +180,7 @@ watch(
|
||||
|
||||
formRef.value.setValues(
|
||||
{
|
||||
postal_code: undefined,
|
||||
postalCode: undefined,
|
||||
},
|
||||
false,
|
||||
)
|
||||
@@ -214,7 +214,7 @@ watch(
|
||||
if (updatedValues.regency_code === '') updatedValues.regency_code = undefined
|
||||
if (updatedValues.district_code === '') updatedValues.district_code = undefined
|
||||
if (updatedValues.village_code === '') updatedValues.village_code = undefined
|
||||
if (updatedValues.postal_code === '') updatedValues.postal_code = undefined
|
||||
if (updatedValues.postalCode === '') updatedValues.postalCode = undefined
|
||||
if (updatedValues.address === '') updatedValues.address = undefined
|
||||
|
||||
// Update values dan trigger validasi
|
||||
@@ -235,7 +235,7 @@ watch(
|
||||
formRef.value?.setFieldError('regency_code', undefined)
|
||||
formRef.value?.setFieldError('district_code', undefined)
|
||||
formRef.value?.setFieldError('village_code', undefined)
|
||||
formRef.value?.setFieldError('postal_code', undefined)
|
||||
formRef.value?.setFieldError('postalCode', undefined)
|
||||
formRef.value?.setFieldError('address', undefined)
|
||||
formRef.value?.setFieldError('rt', undefined)
|
||||
formRef.value?.setFieldError('rw', undefined)
|
||||
@@ -420,10 +420,10 @@ watch(
|
||||
|
||||
<div class="min-w-0 flex-[2]">
|
||||
<SelectPostal
|
||||
field-name="postal_code"
|
||||
field-name="postalCode"
|
||||
:village-code="values.village_code"
|
||||
:placeholder="getFieldState('postal_code').placeholder"
|
||||
:is-disabled="getFieldState('postal_code').disabled || !values.village_code"
|
||||
:placeholder="getFieldState('postalCode').placeholder"
|
||||
:is-disabled="getFieldState('postalCode').disabled || !values.village_code"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -268,7 +268,7 @@ watch(
|
||||
|
||||
<div class="min-w-0 flex-[2]">
|
||||
<SelectPostal
|
||||
field-name="postal_code"
|
||||
field-name="postalCode"
|
||||
placeholder="Pilih kelurahan dahulu"
|
||||
:village-code="values.village_code"
|
||||
:is-disabled="!values.village_code"
|
||||
|
||||
@@ -42,7 +42,7 @@ onMounted(() => {
|
||||
regency_code: currentAddressValues.regency_code || undefined,
|
||||
district_code: currentAddressValues.district_code || undefined,
|
||||
village_code: currentAddressValues.village_code || undefined,
|
||||
postal_code: currentAddressValues.postal_code || undefined,
|
||||
postalCode: currentAddressValues.postalCode || undefined,
|
||||
address: currentAddressValues.address || undefined,
|
||||
rt: currentAddressValues.rt || undefined,
|
||||
rw: currentAddressValues.rw || undefined,
|
||||
@@ -125,7 +125,7 @@ watch(
|
||||
regency_code: currentAddressValues.regency_code || undefined,
|
||||
district_code: currentAddressValues.district_code || undefined,
|
||||
village_code: currentAddressValues.village_code || undefined,
|
||||
postal_code: currentAddressValues.postal_code || undefined,
|
||||
postalCode: currentAddressValues.postalCode || undefined,
|
||||
address: currentAddressValues.address || undefined,
|
||||
rt: currentAddressValues.rt || undefined,
|
||||
rw: currentAddressValues.rw || undefined,
|
||||
@@ -156,7 +156,7 @@ watch(
|
||||
regency_code: newAddressValues.regency_code || undefined,
|
||||
district_code: newAddressValues.district_code || undefined,
|
||||
village_code: newAddressValues.village_code || undefined,
|
||||
postal_code: newAddressValues.postal_code || undefined,
|
||||
postalCode: newAddressValues.postalCode || undefined,
|
||||
address: newAddressValues.address || undefined,
|
||||
rt: newAddressValues.rt || undefined,
|
||||
rw: newAddressValues.rw || undefined,
|
||||
@@ -182,7 +182,7 @@ watch(
|
||||
regency_code: currentAddressValues.regency_code || undefined,
|
||||
district_code: currentAddressValues.district_code || undefined,
|
||||
village_code: currentAddressValues.village_code || undefined,
|
||||
postal_code: currentAddressValues.postal_code || undefined,
|
||||
postalCode: currentAddressValues.postalCode || undefined,
|
||||
address: currentAddressValues.address || undefined,
|
||||
rt: currentAddressValues.rt || undefined,
|
||||
rw: currentAddressValues.rw || undefined,
|
||||
|
||||
@@ -6,7 +6,7 @@ export interface PersonAddress extends Base {
|
||||
address: string
|
||||
rt?: string
|
||||
rw?: string
|
||||
postal_code?: string
|
||||
postalCode?: string
|
||||
village_code: string
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const PersonAddressRelativeSchema = z
|
||||
'regency_code',
|
||||
'district_code',
|
||||
'village_code',
|
||||
'postal_code',
|
||||
'postalCode',
|
||||
'address'
|
||||
]
|
||||
|
||||
@@ -48,7 +48,7 @@ function getRequiredMessage(field: string): string {
|
||||
regency_code: 'Mohon pilih kabupaten/kota',
|
||||
district_code: 'Mohon pilih kecamatan',
|
||||
village_code: 'Mohon pilih kelurahan',
|
||||
postal_code: 'Mohon lengkapi kode pos',
|
||||
postalCode: 'Mohon lengkapi kode pos',
|
||||
address: 'Mohon lengkapi alamat',
|
||||
}
|
||||
return messages[field] || `${field} wajib diisi`
|
||||
|
||||
@@ -16,7 +16,7 @@ const PersonAddressSchema = z.object({
|
||||
village_code: z.string({
|
||||
required_error: 'Mohon pilih kelurahan',
|
||||
}),
|
||||
postal_code: z.string({
|
||||
postalCode: z.string({
|
||||
required_error: 'Mohon lengkapi kode pos',
|
||||
}),
|
||||
// .min(5, 'Kode pos harus berupa angka 5 digit')
|
||||
|
||||
Reference in New Issue
Block a user