This commit is contained in:
hanif salafi 2025-10-07 13:52:25 +07:00
commit 155baef80b
3 changed files with 39 additions and 14 deletions

View File

@ -7,7 +7,9 @@ import { useSearchParams } from "next/navigation";
export default function EditUserPage() { export default function EditUserPage() {
const router = useRouter(); const router = useRouter();
const params = useSearchParams(); const params = useSearchParams();
const userId = params?.id ? Number(params.id) : undefined; // const userId = params?.id ? Number(params.id) : undefined;
const userIdParam = params.get("id");
const userId = userIdParam ? Number(userIdParam) : undefined;
const handleSuccess = () => { const handleSuccess = () => {
router.push("/admin/management-user"); router.push("/admin/management-user");
@ -22,7 +24,7 @@ export default function EditUserPage() {
<div className="container mx-auto py-6"> <div className="container mx-auto py-6">
<div className="text-center"> <div className="text-center">
<p className="text-red-500">User ID tidak valid</p> <p className="text-red-500">User ID tidak valid</p>
<button <button
onClick={() => router.push("/admin/management-user")} onClick={() => router.push("/admin/management-user")}
className="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600" className="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
> >

View File

@ -31,10 +31,11 @@ export type Group = {
}; };
export function getMenuList(pathname: string, t: any): Group[] { export function getMenuList(pathname: string, t: any): Group[] {
const roleId = Number(getCookiesDecrypt("urie")); const roleId = getCookiesDecrypt("urie");
const levelNumber = getCookiesDecrypt("ulne"); const levelNumber = getCookiesDecrypt("ulne");
const userLevelId = getCookiesDecrypt("ulie"); const userLevelId = getCookiesDecrypt("ulie");
const userParentLevelId = getCookiesDecrypt("uplie"); const userParentLevelId = getCookiesDecrypt("uplie");
const hideForRole14 = roleId === "14";
let menusSelected = <any>[]; let menusSelected = <any>[];
@ -55,8 +56,8 @@ export function getMenuList(pathname: string, t: any): Group[] {
}, },
], ],
}, },
...(roleId === 3 ...(Number(roleId) === 3
? [ ? [
{ {
groupLabel: "", groupLabel: "",
id: "content", id: "content",
@ -132,13 +133,13 @@ export function getMenuList(pathname: string, t: any): Group[] {
icon: "heroicons:arrow-trending-up", icon: "heroicons:arrow-trending-up",
children: [], children: [],
}, },
] ],
}, },
], ],
} },
] ]
: []), : []),
...(roleId === 2 ...(Number(roleId) === 2
? [ ? [
{ {
groupLabel: "", groupLabel: "",

View File

@ -1,5 +1,10 @@
import { httpPost, httpGet, httpPut } from "./http-config/http-base-service"; import { httpPost, httpGet, httpPut } from "./http-config/http-base-service";
import { httpPostInterceptor, httpGetInterceptor, httpPutInterceptor, httpDeleteInterceptor } from "./http-config/http-interceptor-service"; import {
httpPostInterceptor,
httpGetInterceptor,
httpPutInterceptor,
httpDeleteInterceptor,
} from "./http-config/http-interceptor-service";
// Types // Types
export interface ApprovalWorkflowStepRequest { export interface ApprovalWorkflowStepRequest {
@ -222,7 +227,9 @@ export interface Province {
} }
// API Functions // API Functions
export async function createApprovalWorkflowWithClientSettings(data: CreateApprovalWorkflowWithClientSettingsRequest) { export async function createApprovalWorkflowWithClientSettings(
data: CreateApprovalWorkflowWithClientSettingsRequest
) {
const url = "approval-workflows/with-client-settings"; const url = "approval-workflows/with-client-settings";
return httpPostInterceptor(url, data); return httpPostInterceptor(url, data);
} }
@ -242,7 +249,10 @@ export async function createUserLevel(data: UserLevelsCreateRequest) {
return httpPostInterceptor(url, data); return httpPostInterceptor(url, data);
} }
export async function updateUserLevel(id: number, data: UserLevelsCreateRequest) { export async function updateUserLevel(
id: number,
data: UserLevelsCreateRequest
) {
const url = `user-levels/${id}`; const url = `user-levels/${id}`;
return httpPutInterceptor(url, data); return httpPutInterceptor(url, data);
} }
@ -277,7 +287,10 @@ export async function getApprovalWorkflows() {
return httpGetInterceptor(url); return httpGetInterceptor(url);
} }
export async function updateApprovalWorkflow(id: number, data: CreateApprovalWorkflowWithClientSettingsRequest) { export async function updateApprovalWorkflow(
id: number,
data: CreateApprovalWorkflowWithClientSettingsRequest
) {
const url = `approval-workflows/${id}`; const url = `approval-workflows/${id}`;
return httpPutInterceptor(url, data); return httpPutInterceptor(url, data);
} }
@ -287,7 +300,16 @@ export async function deleteApprovalWorkflow(id: number) {
return httpDeleteInterceptor(url); return httpDeleteInterceptor(url);
} }
export async function getApprovalWorkflowComprehensiveDetails() { // export async function getApprovalWorkflowComprehensiveDetails() {
const url = `approval-workflows/comprehensive-details`; // const url = `approval-workflows/comprehensive-details`;
// return httpGetInterceptor(url);
// }
export async function getApprovalWorkflowComprehensiveDetails(
clientId?: string | number
) {
const url = clientId
? `approval-workflows/comprehensive-details/${clientId}`
: `approval-workflows/comprehensive-details`;
return httpGetInterceptor(url); return httpGetInterceptor(url);
} }