summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-08-12 13:31:21 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-08-12 13:31:21 +0700
commit286f4bd39d54a13e21a3c163f92ad4138739ab1d (patch)
tree5c576fe1131346b694e0a0acbbdcc4dacf5aef59 /src
parent5d12d9f89f25b8bceb6d914dfef0581321b726ed (diff)
<miqdad>Done
Diffstat (limited to 'src')
-rw-r--r--src/lib/pengajuan-tempo/component/PengajuanTempo.jsx66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index fe50f8a4..ae3d97fd 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -427,39 +427,40 @@ const PengajuanTempo = () => {
};
const handleDaftarTempo = async () => {
- const phones = [
- { key: 'mobile', label: 'No. HP Perusahaan', value: form.mobile },
- {
- key: 'direkturMobile',
- label: 'No. HP Direktur',
- value: formKontakPerson.direkturMobile,
- },
- {
- key: 'purchasingMobile',
- label: 'No. HP Purchasing',
- value: formKontakPerson.purchasingMobile,
- },
- {
- key: 'financeMobile',
- label: 'No. HP Finance',
- value: formKontakPerson.financeMobile,
- },
- {
- key: 'PICBarangMobile',
- label: 'No. HP PIC Barang',
- value: formKontakPerson.PICBarangMobile,
- },
- {
- key: 'invoicePicMobile',
- label: 'No. HP PIC Invoice',
- value: formKontakPerson.invoicePicMobile,
- },
- ].filter((p) => p.value);
+const phones = [
+ { key: 'mobile', label: 'No. HP Perusahaan', value: form.mobile?.trim() },
+ {
+ key: 'direkturMobile',
+ label: 'No. HP Direktur',
+ value: formKontakPerson.direkturMobile?.trim(),
+ },
+ {
+ key: 'purchasingMobile',
+ label: 'No. HP Purchasing',
+ value: formKontakPerson.purchasingMobile?.trim(),
+ },
+ {
+ key: 'financeMobile',
+ label: 'No. HP Finance',
+ value: formKontakPerson.financeMobile?.trim(),
+ },
+ {
+ key: 'PICBarangMobile',
+ label: 'No. HP PIC Barang',
+ value: formPengiriman.PICBarangMobile?.trim(),
+ },
+ {
+ key: 'invoicePicMobile',
+ label: 'No. HP PIC Invoice',
+ value: formPengiriman.invoicePicMobile?.trim(),
+ },
+].filter((p) => p.value);
+
const seen = new Map();
let firstErrorField = null;
- // 🔹 Reset error manual sebelum cek ulang
+ // Reset error manual
phones.forEach((p) => setError(p.key, { type: 'manual', message: '' }));
for (const phone of phones) {
@@ -468,22 +469,21 @@ const handleDaftarTempo = async () => {
} else {
const first = seen.get(phone.value);
- // 🔹 Tampilkan toast
+ // Tampilkan toast
toast.error(`${phone.label} tidak boleh sama dengan ${first.label}`);
- // 🔹 Tampilkan error merah di bawah input
+ // Error merah di bawah input
setError(phone.key, {
type: 'manual',
message: `${phone.label} tidak boleh sama dengan ${first.label}`,
});
- // 🔹 Juga beri error untuk pasangan duplikat pertama
+ // Pasangan pertama yang duplikat
setError(first.key, {
type: 'manual',
message: `${first.label} tidak boleh sama dengan ${phone.label}`,
});
- // 🔹 Simpan field pertama yang salah untuk scroll
if (!firstErrorField) {
firstErrorField = phone.key;
}