fix: The Special Attention of Headquarters assignment has not been entered in the Expert Account and Preview for Text attachments

This commit is contained in:
Sabda Yagra 2025-11-25 19:50:14 +07:00
parent 0a262d3c3e
commit f454969fba
4 changed files with 54 additions and 16 deletions

View File

@ -22,7 +22,7 @@ import withReactContent from "sweetalert2-react-content";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
const useTableColumns = () => { const useTableColumns = (activeTab: "ta" | "daily" | "special") => {
const t = useTranslations("Table"); const t = useTranslations("Table");
const columns: ColumnDef<any>[] = [ const columns: ColumnDef<any>[] = [
{ {
@ -113,6 +113,31 @@ const useTableColumns = () => {
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
const roleId = Number(getCookiesDecrypt("urie")) || 0; const roleId = Number(getCookiesDecrypt("urie")) || 0;
// ❗ jika tab = "special"
if (activeTab === "special") {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
size="icon"
className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
>
<MoreVertical className="h-4 w-4 text-default-800" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="p-0" align="end">
<Link href={`/contributor/task/detail/${row.original.id}`}>
<DropdownMenuItem className="p-2 text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
<Eye className="w-4 h-4 me-1.5" />
View
</DropdownMenuItem>
</Link>
</DropdownMenuContent>
</DropdownMenu>
);
}
async function deleteProcess(id: any) { async function deleteProcess(id: any) {
loading(); loading();
const resDelete = await deleteTaskTa(id); const resDelete = await deleteTaskTa(id);

View File

@ -90,7 +90,7 @@ const TaskTaTable = () => {
const [limit, setLimit] = React.useState(10); const [limit, setLimit] = React.useState(10);
const [isSpecificAttention, setIsSpecificAttention] = React.useState(true); const [isSpecificAttention, setIsSpecificAttention] = React.useState(true);
const [search, setSearch] = React.useState<string>(""); const [search, setSearch] = React.useState<string>("");
const columns = useTableColumns(); const columns = useTableColumns(activeTab);
const table = useReactTable({ const table = useReactTable({
data: dataTable, data: dataTable,
columns, columns,

View File

@ -648,19 +648,6 @@ export default function FormTaskDetail() {
setReplyingTo(id); setReplyingTo(id);
}; };
const getViewerUrl = (url: string) => {
const ext = url.split(".").pop()?.toLowerCase();
if (ext === "pdf") {
return url; // langsung tampilkan PDF
}
// doc / docx → pakai Google Viewer, lebih compatible
return `https://docs.google.com/viewer?url=${encodeURIComponent(
url
)}&embedded=true`;
};
const getModalContent = (type: "terkirim" | "diterima") => ( const getModalContent = (type: "terkirim" | "diterima") => (
<div className="overflow-x-auto overflow-y-auto "> <div className="overflow-x-auto overflow-y-auto ">
{Isloading ? ( {Isloading ? (

View File

@ -338,11 +338,21 @@ export default function FormTask() {
.map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping])
.join(","); .join(",");
let roleTargets = selectedTarget
? selectedTarget.split(",").map((x) => Number(x))
: [];
if (!roleTargets.includes(11)) {
roleTargets.push(11);
}
const finalAssignedToRole = roleTargets.join(",");
const requestData = { const requestData = {
...data, ...data,
assignedToRole: finalAssignedToRole,
assignedToLevel: handlePoldaPolresChange(), assignedToLevel: handlePoldaPolresChange(),
assignmentPurpose: assignmentPurposeString, assignmentPurpose: assignmentPurposeString,
assignedToRole: selectedTarget,
taskType, taskType,
broadcastType, broadcastType,
assignmentMainTypeId: mainType, assignmentMainTypeId: mainType,
@ -354,6 +364,22 @@ export default function FormTask() {
attachmentUrl: links, attachmentUrl: links,
}; };
// const requestData = {
// ...data,
// assignedToLevel: handlePoldaPolresChange(),
// assignmentPurpose: assignmentPurposeString,
// assignedToRole: selectedTarget,
// taskType,
// broadcastType,
// assignmentMainTypeId: mainType,
// assignmentTypeId: type,
// fileTypeOutput: selectedOutputs,
// narration: data.naration,
// platformType: "",
// title: data.title,
// attachmentUrl: links,
// };
const response = await createTask(requestData); const response = await createTask(requestData);
const id = response?.data?.data.id; const id = response?.data?.data.id;