upd: notif warga
Deskripsi: - tolak pengaduan - terima pengaduan - kerjakan pengaduan - pengaduan selesai NO Issues
This commit is contained in:
@@ -31,7 +31,7 @@ import {
|
||||
IconInfoCircle,
|
||||
IconNotes,
|
||||
IconPhone,
|
||||
IconUpload
|
||||
IconUpload,
|
||||
} from "@tabler/icons-react";
|
||||
import dayjs from "dayjs";
|
||||
import "dayjs/locale/id";
|
||||
@@ -268,9 +268,7 @@ export default function FormSurat() {
|
||||
overlayProps={{ backgroundOpacity: 0.55, blur: 3 }}
|
||||
>
|
||||
<Stack gap="sm">
|
||||
<Text>
|
||||
Apakah anda yakin ingin mengirim pengajuan surat ini?
|
||||
</Text>
|
||||
<Text>Apakah anda yakin ingin mengirim pengajuan surat ini?</Text>
|
||||
<Group justify="center" grow>
|
||||
<Button variant="light" onClick={close}>
|
||||
Tidak
|
||||
@@ -298,8 +296,7 @@ export default function FormSurat() {
|
||||
}}
|
||||
category="create"
|
||||
/>
|
||||
)
|
||||
:
|
||||
) : (
|
||||
<Box>
|
||||
<Stack gap="lg">
|
||||
<Group justify="space-between" align="center">
|
||||
@@ -348,7 +345,6 @@ export default function FormSurat() {
|
||||
</Grid>
|
||||
</FormSection>
|
||||
|
||||
|
||||
{/* Kontak Section */}
|
||||
<FormSection
|
||||
title="Kontak"
|
||||
@@ -385,63 +381,84 @@ export default function FormSurat() {
|
||||
</Grid>
|
||||
</FormSection>
|
||||
|
||||
{jenisSuratFix.id != "" && dataSurat && dataSurat.dataPelengkap && (
|
||||
<>
|
||||
<FormSection
|
||||
title="Data Yang Diperlukan"
|
||||
description="Data yang diperlukan untuk mengajukan surat"
|
||||
icon={<IconNotes size={16} />}
|
||||
>
|
||||
<Grid>
|
||||
{dataSurat.dataPelengkap.map((item: any, index: number) => (
|
||||
<Grid.Col span={6} key={index}>
|
||||
{
|
||||
item.type == "enum"
|
||||
?
|
||||
<Select
|
||||
label={
|
||||
<FieldLabel label={item.name} hint={item.desc} />
|
||||
}
|
||||
data={item.options ?? []}
|
||||
placeholder={item.name}
|
||||
onChange={(e) => {
|
||||
validationForm({
|
||||
key: "dataPelengkap",
|
||||
value: { key: item.key, value: e }
|
||||
})
|
||||
}}
|
||||
value={formSurat.dataPelengkap.find((n: any) => n.key == item.key)?.value}
|
||||
/>
|
||||
: item.type == "date"
|
||||
?
|
||||
{jenisSuratFix.id != "" &&
|
||||
dataSurat &&
|
||||
dataSurat.dataPelengkap && (
|
||||
<>
|
||||
<FormSection
|
||||
title="Data Yang Diperlukan"
|
||||
description="Data yang diperlukan untuk mengajukan surat"
|
||||
icon={<IconNotes size={16} />}
|
||||
>
|
||||
<Grid>
|
||||
{dataSurat.dataPelengkap.map(
|
||||
(item: any, index: number) => (
|
||||
<Grid.Col span={6} key={index}>
|
||||
{item.type == "enum" ? (
|
||||
<Select
|
||||
label={
|
||||
<FieldLabel
|
||||
label={item.name}
|
||||
hint={item.desc}
|
||||
/>
|
||||
}
|
||||
data={item.options ?? []}
|
||||
placeholder={item.name}
|
||||
onChange={(e) => {
|
||||
validationForm({
|
||||
key: "dataPelengkap",
|
||||
value: { key: item.key, value: e },
|
||||
});
|
||||
}}
|
||||
value={
|
||||
formSurat.dataPelengkap.find(
|
||||
(n: any) => n.key == item.key,
|
||||
)?.value
|
||||
}
|
||||
/>
|
||||
) : item.type == "date" ? (
|
||||
<DateInput
|
||||
locale="id"
|
||||
valueFormat="DD MMMM YYYY"
|
||||
label={
|
||||
<FieldLabel label={item.name} hint={item.desc} />
|
||||
<FieldLabel
|
||||
label={item.name}
|
||||
hint={item.desc}
|
||||
/>
|
||||
}
|
||||
placeholder={item.name}
|
||||
onChange={(e) => {
|
||||
const formatted = e
|
||||
? dayjs(e).locale("id").format("DD MMMM YYYY")
|
||||
? dayjs(e)
|
||||
.locale("id")
|
||||
.format("DD MMMM YYYY")
|
||||
: "";
|
||||
validationForm({
|
||||
key: "dataPelengkap",
|
||||
value: { key: item.key, value: formatted },
|
||||
})
|
||||
value: {
|
||||
key: item.key,
|
||||
value: formatted,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
:
|
||||
) : (
|
||||
<TextInput
|
||||
type={item.type}
|
||||
label={
|
||||
<FieldLabel label={item.name} hint={item.desc} />
|
||||
<FieldLabel
|
||||
label={item.name}
|
||||
hint={item.desc}
|
||||
/>
|
||||
}
|
||||
placeholder={item.name}
|
||||
onChange={(e) =>
|
||||
validationForm({
|
||||
key: "dataPelengkap",
|
||||
value: { key: item.key, value: e.target.value },
|
||||
value: {
|
||||
key: item.key,
|
||||
value: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
value={
|
||||
@@ -450,52 +467,53 @@ export default function FormSurat() {
|
||||
)?.value
|
||||
}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
</Grid.Col>
|
||||
),
|
||||
)}
|
||||
</Grid>
|
||||
</FormSection>
|
||||
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
</FormSection>
|
||||
<FormSection
|
||||
title="Syarat Dokumen"
|
||||
description="Syarat dokumen yang diperlukan"
|
||||
icon={<IconFiles size={16} />}
|
||||
>
|
||||
<Grid>
|
||||
{dataSurat.syaratDokumen.map(
|
||||
(item: any, index: number) => (
|
||||
<Grid.Col span={6} key={index}>
|
||||
<FileInputWrapper
|
||||
label={item.desc}
|
||||
placeholder={"Upload file "}
|
||||
accept="image/*,application/pdf"
|
||||
onChange={(file) =>
|
||||
validationForm({
|
||||
key: "syaratDokumen",
|
||||
value: { key: item.key, value: file },
|
||||
})
|
||||
}
|
||||
name={item.name}
|
||||
/>
|
||||
</Grid.Col>
|
||||
),
|
||||
)}
|
||||
</Grid>
|
||||
</FormSection>
|
||||
|
||||
<FormSection
|
||||
title="Syarat Dokumen"
|
||||
description="Syarat dokumen yang diperlukan"
|
||||
icon={<IconFiles size={16} />}
|
||||
>
|
||||
<Grid>
|
||||
{dataSurat.syaratDokumen.map((item: any, index: number) => (
|
||||
<Grid.Col span={6} key={index}>
|
||||
<FileInputWrapper
|
||||
label={item.desc}
|
||||
placeholder={"Upload file "}
|
||||
accept="image/*,application/pdf"
|
||||
onChange={(file) =>
|
||||
validationForm({
|
||||
key: "syaratDokumen",
|
||||
value: { key: item.key, value: file },
|
||||
})
|
||||
}
|
||||
name={item.name}
|
||||
/>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
</FormSection>
|
||||
|
||||
{/* Actions */}
|
||||
<Group justify="right" mt="md">
|
||||
{/* <Button variant="default" onClick={() => { }}>
|
||||
{/* Actions */}
|
||||
<Group justify="right" mt="md">
|
||||
{/* <Button variant="default" onClick={() => { }}>
|
||||
Reset
|
||||
</Button> */}
|
||||
<Button onClick={onChecking}>Kirim</Button>
|
||||
</Group>
|
||||
</>
|
||||
)}
|
||||
<Button onClick={onChecking}>Kirim</Button>
|
||||
</Group>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Box>
|
||||
}
|
||||
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -437,7 +437,12 @@ function DetailDataHistori({ data }: { data: any }) {
|
||||
</Title>
|
||||
</Flex>
|
||||
<Divider my={0} />
|
||||
<Spoiler maxHeight={200} showLabel="Show more" hideLabel="Hide" transitionDuration={1000}>
|
||||
<Spoiler
|
||||
maxHeight={200}
|
||||
showLabel="Show more"
|
||||
hideLabel="Hide"
|
||||
transitionDuration={1000}
|
||||
>
|
||||
<Table>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
|
||||
@@ -38,6 +38,7 @@ import { useEffect, useState } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import useSwr from "swr";
|
||||
|
||||
|
||||
export default function DetailPengaduanPage() {
|
||||
const { search } = useLocation();
|
||||
const query = new URLSearchParams(search);
|
||||
@@ -61,6 +62,7 @@ export default function DetailPengaduanPage() {
|
||||
<Stack gap={"xl"}>
|
||||
<DetailDataPengaduan
|
||||
data={data?.data?.pengaduan}
|
||||
phone={data && data.data && data.data.warga ? data.data.warga.phone : null}
|
||||
onAction={() => {
|
||||
mutate();
|
||||
}}
|
||||
@@ -78,9 +80,11 @@ export default function DetailPengaduanPage() {
|
||||
|
||||
function DetailDataPengaduan({
|
||||
data,
|
||||
phone,
|
||||
onAction,
|
||||
}: {
|
||||
data: any | null;
|
||||
phone?: string | null;
|
||||
onAction: () => void;
|
||||
}) {
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
@@ -122,6 +126,21 @@ function DetailDataPengaduan({
|
||||
});
|
||||
|
||||
if (res?.status === 200) {
|
||||
const resWA = await apiFetch.api["send-wa"].pengaduan.post({
|
||||
noPengaduan: data?.noPengaduan,
|
||||
judulPengaduan: data?.title,
|
||||
status:
|
||||
cat == "tolak"
|
||||
? "ditolak"
|
||||
: data.status == "antrian"
|
||||
? "diterima"
|
||||
: data.status == "diterima"
|
||||
? "dikerjakan"
|
||||
: "selesai",
|
||||
alasan: keterangan,
|
||||
tlp: String(phone),
|
||||
})
|
||||
|
||||
onAction();
|
||||
close();
|
||||
notification({
|
||||
@@ -129,6 +148,28 @@ function DetailDataPengaduan({
|
||||
message: "Success update pengaduan",
|
||||
type: "success",
|
||||
});
|
||||
|
||||
if (resWA?.status === 200) {
|
||||
if (resWA.data?.success) {
|
||||
notification({
|
||||
title: "Success",
|
||||
message: "Success send message to warga",
|
||||
type: "success",
|
||||
});
|
||||
} else {
|
||||
notification({
|
||||
title: "Failed",
|
||||
message: "Failed send message to warga",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
notification({
|
||||
title: "Failed",
|
||||
message: "Failed send message to warga",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
notification({
|
||||
title: "Error",
|
||||
@@ -425,7 +466,12 @@ function DetailDataHistori({ data }: { data: any }) {
|
||||
</Title>
|
||||
</Flex>
|
||||
<Divider my={0} />
|
||||
<Spoiler maxHeight={200} showLabel="Show more" hideLabel="Hide" transitionDuration={1000}>
|
||||
<Spoiler
|
||||
maxHeight={200}
|
||||
showLabel="Show more"
|
||||
hideLabel="Hide"
|
||||
transitionDuration={1000}
|
||||
>
|
||||
<Table>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
|
||||
Reference in New Issue
Block a user