fix: update data pengajuan surat
Deskripsi: - loading saat melakukan pencarian - disable select dan input date saat status selesai No Issues
This commit is contained in:
@@ -317,57 +317,60 @@ function SearchData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormSection
|
<>
|
||||||
title="Cari Pengajuan Surat"
|
<FullScreenLoading visible={submitLoading} text="Mencari Data" />
|
||||||
info="Masukkan nomor pengajuan dan nomor telepon yang digunakan saat pengajuan surat."
|
<FormSection
|
||||||
>
|
title="Cari Pengajuan Surat"
|
||||||
<Grid>
|
info="Masukkan nomor pengajuan dan nomor telepon yang digunakan saat pengajuan surat."
|
||||||
<Grid.Col span={6}>
|
>
|
||||||
<TextInput
|
<Grid>
|
||||||
label={
|
<Grid.Col span={6}>
|
||||||
<FieldLabel
|
<TextInput
|
||||||
label="Nomor Pengajuan"
|
label={
|
||||||
hint="Nomor pengajuan surat"
|
<FieldLabel
|
||||||
/>
|
label="Nomor Pengajuan"
|
||||||
}
|
hint="Nomor pengajuan surat"
|
||||||
placeholder="PS-2025-000123"
|
/>
|
||||||
onChange={(e) => {
|
}
|
||||||
setSearchPengajuan(e.target.value);
|
placeholder="PS-2025-000123"
|
||||||
}}
|
onChange={(e) => {
|
||||||
/>
|
setSearchPengajuan(e.target.value);
|
||||||
</Grid.Col>
|
}}
|
||||||
|
/>
|
||||||
|
</Grid.Col>
|
||||||
|
|
||||||
<Grid.Col span={6}>
|
<Grid.Col span={6}>
|
||||||
<TextInput
|
<TextInput
|
||||||
label={
|
label={
|
||||||
<FieldLabel
|
<FieldLabel
|
||||||
label="Nomor Telephone"
|
label="Nomor Telephone"
|
||||||
hint="Nomor telephone yang dapat dihubungi / terhubung dengan whatsapp"
|
hint="Nomor telephone yang dapat dihubungi / terhubung dengan whatsapp"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
placeholder="08123456789"
|
placeholder="08123456789"
|
||||||
type="number"
|
type="number"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSearchPengajuanPhone(e.target.value);
|
setSearchPengajuanPhone(e.target.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|
||||||
<Grid.Col span={12}>
|
<Grid.Col span={12}>
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="light"
|
variant="light"
|
||||||
color="blue"
|
color="blue"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleSearch();
|
handleSearch();
|
||||||
}}
|
}}
|
||||||
loading={submitLoading}
|
loading={submitLoading}
|
||||||
>
|
>
|
||||||
Cari Pengajuan
|
Cari Pengajuan
|
||||||
</Button>
|
</Button>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,6 +390,7 @@ function DataUpdate({
|
|||||||
const [dataSyaratDokumen, setDataSyaratDokumen] = useState<DataItem[]>([]);
|
const [dataSyaratDokumen, setDataSyaratDokumen] = useState<DataItem[]>([]);
|
||||||
const [dataPengajuan, setDataPengajuan] = useState<DataPengajuan | {}>({});
|
const [dataPengajuan, setDataPengajuan] = useState<DataPengajuan | {}>({});
|
||||||
const [status, setStatus] = useState("");
|
const [status, setStatus] = useState("");
|
||||||
|
const [loadingFetchData, setLoadingFetchData] = useState(false);
|
||||||
const [formSurat, setFormSurat] = useState<FormUpdateSurat>({
|
const [formSurat, setFormSurat] = useState<FormUpdateSurat>({
|
||||||
dataPelengkap: [],
|
dataPelengkap: [],
|
||||||
syaratDokumen: [],
|
syaratDokumen: [],
|
||||||
@@ -394,6 +398,7 @@ function DataUpdate({
|
|||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingFetchData(true);
|
||||||
const res = await apiFetch.api.pelayanan["detail-data"].post({
|
const res = await apiFetch.api.pelayanan["detail-data"].post({
|
||||||
nomerPengajuan: noPengajuan,
|
nomerPengajuan: noPengajuan,
|
||||||
});
|
});
|
||||||
@@ -421,6 +426,8 @@ function DataUpdate({
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching data:", error);
|
console.error("Error fetching data:", error);
|
||||||
|
} finally {
|
||||||
|
setLoadingFetchData(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +607,7 @@ function DataUpdate({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FullScreenLoading visible={submitLoading} />
|
<FullScreenLoading visible={submitLoading || loadingFetchData} />
|
||||||
<Modal
|
<Modal
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
@@ -667,6 +674,7 @@ function DataUpdate({
|
|||||||
<Grid.Col span={6} key={index}>
|
<Grid.Col span={6} key={index}>
|
||||||
{item.type == "enum" ? (
|
{item.type == "enum" ? (
|
||||||
<Select
|
<Select
|
||||||
|
disabled={status != "ditolak" && status != "antrian"}
|
||||||
allowDeselect={false}
|
allowDeselect={false}
|
||||||
label={<FieldLabel label={item.name} hint={item.desc} />}
|
label={<FieldLabel label={item.name} hint={item.desc} />}
|
||||||
data={item.options ?? []}
|
data={item.options ?? []}
|
||||||
@@ -686,6 +694,7 @@ function DataUpdate({
|
|||||||
/>
|
/>
|
||||||
) : item.type == "date" ? (
|
) : item.type == "date" ? (
|
||||||
<DateInput
|
<DateInput
|
||||||
|
disabled={status != "ditolak" && status != "antrian"}
|
||||||
locale="id"
|
locale="id"
|
||||||
valueFormat="DD MMMM YYYY"
|
valueFormat="DD MMMM YYYY"
|
||||||
label={<FieldLabel label={item.name} hint={item.desc} />}
|
label={<FieldLabel label={item.name} hint={item.desc} />}
|
||||||
@@ -712,7 +721,7 @@ function DataUpdate({
|
|||||||
(n: any) => n.key === item.key,
|
(n: any) => n.key === item.key,
|
||||||
)?.value,
|
)?.value,
|
||||||
)
|
)
|
||||||
: parseTanggalID(item.value)
|
: parseTanggalID(item.value)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user