upd: notif warga
Deskripsi: - tolak pengaduan - terima pengaduan - kerjakan pengaduan - pengaduan selesai NO Issues
This commit is contained in:
@@ -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