diff --git a/app/components/app/person-address/entry-form-relative.vue b/app/components/app/person-address/entry-form-relative.vue index 8704a0d3..ed08fbd2 100644 --- a/app/components/app/person-address/entry-form-relative.vue +++ b/app/components/app/person-address/entry-form-relative.vue @@ -43,7 +43,7 @@ const fieldStates: Record = 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(
diff --git a/app/components/app/person-address/entry-form.vue b/app/components/app/person-address/entry-form.vue index 14978fd5..ffb01eaf 100644 --- a/app/components/app/person-address/entry-form.vue +++ b/app/components/app/person-address/entry-form.vue @@ -268,7 +268,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, @@ -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, diff --git a/app/models/person-address.ts b/app/models/person-address.ts index cab3413a..e177d292 100644 --- a/app/models/person-address.ts +++ b/app/models/person-address.ts @@ -6,7 +6,7 @@ export interface PersonAddress extends Base { address: string rt?: string rw?: string - postal_code?: string + postalCode?: string village_code: string } diff --git a/app/schemas/person-address-relative.schema.ts b/app/schemas/person-address-relative.schema.ts index 89aa65f8..e37fb89c 100644 --- a/app/schemas/person-address-relative.schema.ts +++ b/app/schemas/person-address-relative.schema.ts @@ -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` diff --git a/app/schemas/person-address.schema.ts b/app/schemas/person-address.schema.ts index 66819aa0..f314e921 100644 --- a/app/schemas/person-address.schema.ts +++ b/app/schemas/person-address.schema.ts @@ -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')