[QUDO-97,QUDO-98,QUDO-92] feat:check emergency issue,escalation,collaboration
This commit is contained in:
parent
bc0e169821
commit
706246b013
|
|
@ -96,7 +96,7 @@ const columns: ColumnDef<any>[] = [
|
|||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
router.push(
|
||||
`/supervisor/communications/forward/detail/${row.original.id}`
|
||||
`/supervisor/communications/collaboration/detail/${row.original.id}`
|
||||
)
|
||||
}
|
||||
className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none items-center"
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ export default function CollaborationPage() {
|
|||
<Separator className="my-2" />
|
||||
|
||||
<div className="flex flex-col gap-2 max-h-[360px]">
|
||||
{listDiscussion?.length > 1 ? (
|
||||
listDiscussion?.map((data: any) => (
|
||||
{listDiscussion?.length > 0 ? (
|
||||
listDiscussion.map((data: any) => (
|
||||
<div key={data?.id} className="flex flex-col ">
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<Icon icon="qlementine-icons:user-16" width={36} />
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ const columns: ColumnDef<any>[] = [
|
|||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="p-0" align="end">
|
||||
<Link
|
||||
href={`/supervisor/communications/forward/detail/${row.original.id}`}
|
||||
href={`/supervisor/communications/escalation/forward/${row.original.id}`}
|
||||
>
|
||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||
<Eye className="w-4 h-4 me-1.5" />
|
||||
|
|
|
|||
|
|
@ -71,13 +71,15 @@ export default function FormCollaboration() {
|
|||
const [mainType, setMainType] = useState<number>(1); // untuk Tipe Penugasan
|
||||
const [type, setType] = useState<string>("1");
|
||||
const [options, setOptions] = useState<Option[]>([]);
|
||||
const [ticketPriority, setTicketPriority] = useState([]);
|
||||
const [ticketPriority, setTicketPriority] = useState<
|
||||
{ value: number; label: string }[]
|
||||
>([]);
|
||||
const [selectedOption, setSelectedOption] = useState<Option | undefined>(
|
||||
undefined
|
||||
);
|
||||
const animatedComponent = makeAnimated();
|
||||
const [platformTypeVisible, setPlatformTypeVisible] = useState(false);
|
||||
const [selectedTarget, setSelectedTarget] = useState("");
|
||||
const [selectedTarget, setSelectedTarget] = useState<number | null>(null);
|
||||
|
||||
// Opsi untuk dropdown
|
||||
const priority = [
|
||||
|
|
@ -131,7 +133,14 @@ export default function FormCollaboration() {
|
|||
|
||||
if (res?.data !== null) {
|
||||
const rawData = res?.data?.data;
|
||||
setTicketPriority(rawData);
|
||||
|
||||
// Ubah ke format Select { value: number, label: string }
|
||||
const priorityOptions = rawData.map((item: any) => ({
|
||||
value: item.id, // value dikirim ke API (number)
|
||||
label: item.name, // label yang ditampilkan ke user
|
||||
}));
|
||||
|
||||
setTicketPriority(priorityOptions); // ← ini akan dipakai di komponen Select
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,12 +168,14 @@ export default function FormCollaboration() {
|
|||
const save = async (data: TaskSchema) => {
|
||||
const requestData = {
|
||||
title: data.title,
|
||||
narration: data.naration,
|
||||
target: selectedTarget,
|
||||
typeId: 11,
|
||||
statusId: 1,
|
||||
message: data.naration,
|
||||
priorityId: selectedTarget,
|
||||
isCollaboration: true,
|
||||
isEscalation: true,
|
||||
isCollaborationWithNoneTicket: true,
|
||||
sendToId: selectedOption?.id, // This should work now without the error
|
||||
operatorTeam: selectedOption?.id, // This should work now without the error
|
||||
};
|
||||
|
||||
const response = await saveTicketing(requestData);
|
||||
|
|
@ -179,7 +190,7 @@ export default function FormCollaboration() {
|
|||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "OK",
|
||||
}).then(() => {
|
||||
router.push("/contributor/communication");
|
||||
router.push("/in/supervisor/communications/collaboration");
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -232,15 +243,15 @@ export default function FormCollaboration() {
|
|||
</Label>
|
||||
<Select
|
||||
id="target-select"
|
||||
options={priority}
|
||||
options={ticketPriority}
|
||||
onChange={(selectedOption) =>
|
||||
setSelectedTarget(selectedOption?.value || "")
|
||||
setSelectedTarget(Number(selectedOption?.value))
|
||||
}
|
||||
placeholder="Pilih"
|
||||
styles={{
|
||||
control: (base) => ({
|
||||
...base,
|
||||
minHeight: "40px", // Ukuran sesuai dengan size="md"
|
||||
minHeight: "40px",
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -95,27 +95,38 @@ export default function FormQuestionsForward() {
|
|||
resolver: zodResolver(taskSchema),
|
||||
});
|
||||
|
||||
// useEffect(() => {
|
||||
// async function initState() {
|
||||
// const response = await getQuestionTicket(id);
|
||||
// setDetail(response?.data?.data);
|
||||
|
||||
// if (response?.data !== null) {
|
||||
// setDetailTickets(response?.data?.data);
|
||||
// }
|
||||
|
||||
// if (detailTickets?.emergencyIssue) {
|
||||
// reset({
|
||||
// title: detailTickets.emergencyIssue.title || "",
|
||||
// description: detailTickets.emergencyIssue.description || "",
|
||||
// });
|
||||
// // setSelectedPriority(String(detailTickets.emergencyIssue.urgencyId));
|
||||
// // setSelectedStatus(String(detailTickets.statusId)); // jika ada
|
||||
// }
|
||||
// }
|
||||
// initState();
|
||||
// getTicketReply();
|
||||
// }, [id, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
async function initState() {
|
||||
const response = await getQuestionTicket(id);
|
||||
setDetail(response?.data?.data);
|
||||
|
||||
if (response?.data !== null) {
|
||||
setDetailTickets(response?.data?.data);
|
||||
}
|
||||
|
||||
if (detailTickets?.emergencyIssue) {
|
||||
reset({
|
||||
title: detailTickets.emergencyIssue.title || "",
|
||||
description: detailTickets.emergencyIssue.description || "",
|
||||
});
|
||||
// setSelectedPriority(String(detailTickets.emergencyIssue.urgencyId));
|
||||
// setSelectedStatus(String(detailTickets.statusId)); // jika ada
|
||||
if (id) {
|
||||
const response = await getTicketingDetail(id);
|
||||
setDetail(response?.data?.data);
|
||||
}
|
||||
}
|
||||
initState();
|
||||
getTicketReply();
|
||||
}, [id, reset]);
|
||||
}, [id]);
|
||||
|
||||
async function getTicketReply() {
|
||||
const res = await getTicketingInternalDiscussion(id);
|
||||
|
|
@ -217,74 +228,107 @@ export default function FormQuestionsForward() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
{detailTickets && (
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<div className="gap-5 mb-5 w-[100%] lg:w-auto border bg-white rounded-md">
|
||||
<p className="mx-3 mt-3">Properties</p>
|
||||
<div className="space-y-2 px-3">
|
||||
<Label>Judul</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<Input
|
||||
size="md"
|
||||
type="text"
|
||||
{...field}
|
||||
placeholder="Masukkan judul"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-5 px-3">
|
||||
<Label>Prioritas</Label>
|
||||
<Select
|
||||
onValueChange={setSelectedPriority}
|
||||
value={selectedPriority}
|
||||
>
|
||||
<SelectTrigger size="md">
|
||||
<SelectValue placeholder="Pilih Prioritas" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="1">Low</SelectItem>
|
||||
<SelectItem value="2">Medium</SelectItem>
|
||||
<SelectItem value="3">High</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="mt-5 px-3 mb-3">
|
||||
<Label>Status</Label>
|
||||
<Select onValueChange={setSelectedStatus} value={selectedStatus}>
|
||||
<SelectTrigger size="md">
|
||||
<SelectValue placeholder="Pilih Status" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="1">Open</SelectItem>
|
||||
<SelectItem value="2">Close</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 px-3 py-3">
|
||||
<Label>Deskripsi</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="description"
|
||||
render={({ field }) => (
|
||||
<Textarea {...field} placeholder="Masukkan description" />
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end mt-3 mr-3 py-3">
|
||||
<Button type="submit" color="primary">
|
||||
Simpan
|
||||
</Button>
|
||||
{detail !== undefined && (
|
||||
<div className="gap-5 mb-5 w-full border mt-3 rounded-md bg-white">
|
||||
<div className="space-y-2 px-3 mt-3">
|
||||
<Label>Judul</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<Input
|
||||
size="md"
|
||||
type="text"
|
||||
value={detail?.title}
|
||||
onChange={field.onChange}
|
||||
placeholder="Enter Title"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{/* {errors.title?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.title.message}
|
||||
</p>
|
||||
)} */}
|
||||
</div>
|
||||
<div className="mt-5 px-3">
|
||||
<Label>Prioritas</Label>
|
||||
<Select
|
||||
onValueChange={setSelectedPriority}
|
||||
value={detail?.priority?.name}
|
||||
>
|
||||
<SelectTrigger size="md" className="w-3/12">
|
||||
<SelectValue placeholder="Pilih" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="Low">Low</SelectItem>
|
||||
<SelectItem value="Medium">Medium</SelectItem>
|
||||
<SelectItem value="High">High</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2 px-3 mt-3">
|
||||
<Label>Description</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<Textarea
|
||||
value={detail?.description}
|
||||
onChange={field.onChange}
|
||||
placeholder="Enter Title"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{/* {errors.title?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.title.message}
|
||||
</p>
|
||||
)} */}
|
||||
</div>
|
||||
<div className="mx-3 my-3">
|
||||
<h3 className="text-gray-700 font-medium">Tanggapan</h3>
|
||||
<div className="space-y-4">
|
||||
{replies.map((reply) => (
|
||||
<div key={reply.id} className="border-b pb-2">
|
||||
<p className="font-semibold text-gray-800">{reply.name}</p>
|
||||
<p className="text-gray-600">{reply.message}</p>
|
||||
<p className="text-sm text-gray-400">{reply.timestamp}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div className="mx-3">
|
||||
<label
|
||||
htmlFor="replyMessage"
|
||||
className="block text-gray-700 font-medium mb-2"
|
||||
>
|
||||
Tulis Tanggapan Anda
|
||||
</label>
|
||||
<textarea
|
||||
id="replyMessage"
|
||||
className="w-full h-24 border border-gray-300 rounded-md p-2"
|
||||
value={replyMessage}
|
||||
onChange={(e) => setReplyMessage(e.target.value)}
|
||||
placeholder="Tulis tanggapan anda di sini..."
|
||||
/>
|
||||
<div className="flex justify-end gap-3 mt-2 mb-3">
|
||||
<button
|
||||
onClick={() => setReplyMessage("")}
|
||||
className="px-4 py-2 bg-gray-200 text-gray-800 rounded-md"
|
||||
>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSendReply}
|
||||
className="px-4 py-2 bg-blue-600 text-white rounded-md"
|
||||
>
|
||||
Kirim Pesan
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ const HeroModal = ({
|
|||
}, []);
|
||||
|
||||
const initFetch = async () => {
|
||||
// Ambil data banner dari API listStaticBanner
|
||||
const response = await listStaticBanner(
|
||||
group === "mabes"
|
||||
? ""
|
||||
|
|
@ -102,7 +101,6 @@ const HeroModal = ({
|
|||
: ""
|
||||
);
|
||||
|
||||
// Ambil dan bersihkan data media dari response
|
||||
const banners =
|
||||
response?.data?.data?.map((item: any) => {
|
||||
const media = item?.mediaUpload;
|
||||
|
|
@ -113,7 +111,7 @@ const HeroModal = ({
|
|||
}) || [];
|
||||
|
||||
console.log("banner Modal", banners);
|
||||
setHeroData(banners); // hanya data dari listStaticBanner
|
||||
setHeroData(banners);
|
||||
};
|
||||
return (
|
||||
<div className="fixed inset-0 flex items-center justify-center backdrop-brightness-50 z-50 ">
|
||||
|
|
@ -328,8 +326,6 @@ const HeroNew = (props: { group?: string }) => {
|
|||
{showModal && (
|
||||
<HeroModal onClose={() => setShowModal(false)} group="mabes" />
|
||||
)}
|
||||
|
||||
{/* {showFormModal && <FormSurvey />} */}
|
||||
</div>
|
||||
{isLoading ? (
|
||||
<div className="flex flex-col space-y-3 mx-auto w-full lg:w-2/3">
|
||||
|
|
|
|||
|
|
@ -137,6 +137,11 @@ export async function deleteQuestion(id: string | number) {
|
|||
return httpDeleteInterceptor(url);
|
||||
}
|
||||
|
||||
export async function saveEscalationDiscussion(data: any) {
|
||||
const url = "ticketing/escalation/discussion";
|
||||
return httpPostInterceptor(url, data);
|
||||
}
|
||||
|
||||
export async function getEscalationDiscussion(id: any) {
|
||||
const url = `ticketing/escalation/discussion?ticketId=${id}`;
|
||||
return httpGetInterceptor(url);
|
||||
|
|
|
|||
Loading…
Reference in New Issue