fix: table task mabes=>koorkurator
This commit is contained in:
parent
c67a0e5a0a
commit
8a88bf6372
|
|
@ -190,7 +190,7 @@ const useTableColumns = (activeTab: "ta" | "daily" | "special" |"mabes-koor") =>
|
|||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="p-0" align="end">
|
||||
{(roleId == 11 || roleId == 12 || roleId == 19) && (
|
||||
{(roleId == 11 || roleId == 12 || roleId == 19 || roleId ==3) && (
|
||||
<Link href={`/contributor/task-ta/detail/${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" />
|
||||
|
|
@ -198,7 +198,7 @@ const useTableColumns = (activeTab: "ta" | "daily" | "special" |"mabes-koor") =>
|
|||
</DropdownMenuItem>
|
||||
</Link>
|
||||
)}
|
||||
{roleId == 11 && (
|
||||
{roleId == 11 || roleId ==3 && (
|
||||
<Link href={`/contributor/task-ta/update/${row.original.id}`}>
|
||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||
<SquarePen className="w-4 h-4 me-1.5" />
|
||||
|
|
@ -216,7 +216,7 @@ const useTableColumns = (activeTab: "ta" | "daily" | "special" |"mabes-koor") =>
|
|||
</DropdownMenuItem>
|
||||
</Link>
|
||||
)}
|
||||
{roleId == 11 && (
|
||||
{roleId == 11 || roleId ==3 && (
|
||||
<DropdownMenuItem
|
||||
onClick={() => TaskDelete(row.original.id)}
|
||||
className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export default function TaskTaTable() {
|
|||
const [page, setPage] = React.useState(1);
|
||||
const [totalPage, setTotalPage] = React.useState(1);
|
||||
|
||||
const KOOR_KURATOR_USER_ID = "464";
|
||||
const KOOR_KURATOR_USER_IDS = ["464", "8258"];
|
||||
|
||||
// ✅ columns based on tab
|
||||
const columns = useTableColumns(activeTab);
|
||||
|
|
@ -135,7 +135,7 @@ export default function TaskTaTable() {
|
|||
activeTab,
|
||||
]);
|
||||
|
||||
const isKoorKurator = String(userId) === KOOR_KURATOR_USER_ID;
|
||||
const isKoorKurator = KOOR_KURATOR_USER_IDS.includes(String(userId));
|
||||
|
||||
async function fetchData() {
|
||||
const formattedStartDate = dateFilter
|
||||
|
|
@ -208,7 +208,10 @@ export default function TaskTaTable() {
|
|||
if (activeTab === "ta") {
|
||||
contentData = contentData.filter((item: any) => {
|
||||
const assignedUsers = String(item?.assignedToUsers || "");
|
||||
return !assignedUsers.split(",").includes(KOOR_KURATOR_USER_ID);
|
||||
// return !assignedUsers.split(",").includes(KOOR_KURATOR_USER_ID);
|
||||
return !assignedUsers
|
||||
.split(",")
|
||||
.some((id) => KOOR_KURATOR_USER_IDS.includes(id.trim()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +256,10 @@ export default function TaskTaTable() {
|
|||
|
||||
return (
|
||||
/MABES/i.test(createdByLevel) &&
|
||||
assignedUsers.split(",").includes(KOOR_KURATOR_USER_ID)
|
||||
// assignedUsers.split(",").includes(KOOR_KURATOR_USER_ID)
|
||||
assignedUsers
|
||||
.split(",")
|
||||
.some((id) => KOOR_KURATOR_USER_IDS.includes(id.trim()))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ const CustomEditor = dynamic(
|
|||
() => {
|
||||
return import("@/components/editor/custom-editor");
|
||||
},
|
||||
{ ssr: false }
|
||||
{ ssr: false },
|
||||
);
|
||||
|
||||
export default function FormTaskTa() {
|
||||
|
|
@ -136,7 +136,7 @@ export default function FormTaskTa() {
|
|||
const [userLevels, setUserLevels] = useState<any>();
|
||||
const [userCompetencies, setUserCompetencies] = useState<any[]>([]);
|
||||
const [selectedCompetencies, setSelectedCompetencies] = useState<Set<number>>(
|
||||
new Set()
|
||||
new Set(),
|
||||
);
|
||||
const [listExpert, setListExpert] = useState<any[]>([]);
|
||||
const [checkedLevels, setCheckedLevels] = useState<Set<number>>(new Set());
|
||||
|
|
@ -245,7 +245,7 @@ export default function FormTaskTa() {
|
|||
}
|
||||
|
||||
const uniqueExperts = Array.from(
|
||||
new Map(allExperts.map((e) => [e.id, e])).values()
|
||||
new Map(allExperts.map((e) => [e.id, e])).values(),
|
||||
);
|
||||
|
||||
setListExpert(uniqueExperts);
|
||||
|
|
@ -449,7 +449,7 @@ export default function FormTaskTa() {
|
|||
const requestData = {
|
||||
...data,
|
||||
// assignedToUsers: isMabesApprover ? "464" : handleExpertChange(),
|
||||
assignedToUsers: isMabesApprover ? "464" : handleExpertChange(),
|
||||
assignedToUsers: isMabesApprover ? "464,8258" : handleExpertChange(),
|
||||
assignmentType: taskType,
|
||||
assignmentTypeId: type,
|
||||
expertCompetencies: Array.from(selectedCompetencies).join(","),
|
||||
|
|
@ -467,19 +467,19 @@ export default function FormTaskTa() {
|
|||
const uploads: Promise<any>[] = [];
|
||||
|
||||
imageFiles.forEach((file, i) =>
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "1", "0"))
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "1", "0")),
|
||||
);
|
||||
|
||||
videoFiles.forEach((file, i) =>
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "2", "0"))
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "2", "0")),
|
||||
);
|
||||
|
||||
textFiles.forEach((file, i) =>
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "3", "0"))
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "3", "0")),
|
||||
);
|
||||
|
||||
audioFiles.forEach((file, i) =>
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "4", "0"))
|
||||
uploads.push(uploadResumableFile(i, assignmentId, file, "4", "0")),
|
||||
);
|
||||
|
||||
await Promise.all(uploads);
|
||||
|
|
@ -557,7 +557,7 @@ export default function FormTaskTa() {
|
|||
// Convert Blob to File and add preview
|
||||
const fileWithPreview: FileWithPreview = Object.assign(
|
||||
new File([blob], "voiceNote.webm", { type: "audio/webm" }),
|
||||
{ preview: url }
|
||||
{ preview: url },
|
||||
);
|
||||
|
||||
// Add to state
|
||||
|
|
@ -687,7 +687,7 @@ export default function FormTaskTa() {
|
|||
id: string,
|
||||
file: File,
|
||||
fileTypeId: string,
|
||||
duration: string
|
||||
duration: string,
|
||||
) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
|
|
@ -829,7 +829,7 @@ export default function FormTaskTa() {
|
|||
variant={"outline"}
|
||||
className={cn(
|
||||
"w-[280px] lg:w-[250px] justify-start text-left font-normal border border-slate-300 px-0 md:px-0 lg:px-4",
|
||||
!date && "text-muted-foreground"
|
||||
!date && "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
<CalendarIcon size={15} className="mr-3" />
|
||||
|
|
@ -928,7 +928,7 @@ export default function FormTaskTa() {
|
|||
<div className="flex flex-wrap gap-2">
|
||||
{Array.from(checkedLevels).map((expertId) => {
|
||||
const expert = listExpert?.find(
|
||||
(exp: any) => exp.id === expertId
|
||||
(exp: any) => exp.id === expertId,
|
||||
);
|
||||
return expert ? (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Reference in New Issue