feat: update category, admin settings, management user
This commit is contained in:
parent
4d3aaab4e2
commit
b60ac3a9b4
|
|
@ -26,12 +26,13 @@ import {
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
AdministrationLevelList,
|
AdministrationLevelList,
|
||||||
|
checkRolePlacementsAvailability,
|
||||||
getListCompetencies,
|
getListCompetencies,
|
||||||
getListExperiences,
|
getListExperiences,
|
||||||
saveUserInternal,
|
saveUserInternal,
|
||||||
saveUserRolePlacements,
|
saveUserRolePlacements,
|
||||||
} from "@/service/management-user/management-user";
|
} from "@/service/management-user/management-user";
|
||||||
import { loading } from "@/config/swal";
|
import { error, loading } from "@/config/swal";
|
||||||
import { Eye, EyeOff } from "lucide-react";
|
import { Eye, EyeOff } from "lucide-react";
|
||||||
|
|
||||||
const FormSchema = z.object({
|
const FormSchema = z.object({
|
||||||
|
|
@ -134,6 +135,26 @@ export default function AddExpertForm() {
|
||||||
};
|
};
|
||||||
|
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
|
// check availability first
|
||||||
|
var placementArr: any[] = [];
|
||||||
|
placementRows.forEach((row: any) => {
|
||||||
|
placementArr.push({
|
||||||
|
roleId: Number(row.roleId),
|
||||||
|
userLevelId: Number(row.userLevelId),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const dataReqAvail = {
|
||||||
|
placements: placementArr,
|
||||||
|
};
|
||||||
|
const resAvail = await checkRolePlacementsAvailability(dataReqAvail);
|
||||||
|
if (resAvail?.error) {
|
||||||
|
close();
|
||||||
|
error(resAvail.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const res = await saveUserInternal(dataReq);
|
const res = await saveUserInternal(dataReq);
|
||||||
const resData = res?.data?.data;
|
const resData = res?.data?.data;
|
||||||
const userProfileId = resData?.id;
|
const userProfileId = resData?.id;
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,16 @@ const columns: ColumnDef<any>[] = [
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "created",
|
||||||
|
accessorKey: "created",
|
||||||
|
header: "Dibuat Oleh",
|
||||||
|
cell: ({ row }) => (
|
||||||
|
<div className="flex flex-col items-center">
|
||||||
|
<span className="text-sm text-gray-500">{row.original.createdByName}</span><span className="text-xs font-bold">({row.original.createdByUserLevelName})</span>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
accessorKey: "action",
|
accessorKey: "action",
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ const ContentCategory = (props: { group?: string; type: string }) => {
|
||||||
alt="category"
|
alt="category"
|
||||||
width={2560}
|
width={2560}
|
||||||
height={1440}
|
height={1440}
|
||||||
src={category?.smallThumbnailLink}
|
src={category?.thumbnailLink}
|
||||||
className="w-full lg:h-[300px] h-40 object-cover group-hover:scale-110 transition-transform duration-300"
|
className="w-full lg:h-[300px] h-40 object-cover group-hover:scale-110 transition-transform duration-300"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ export async function getTagsBySubCategoryId(subCategory: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listEnableCategory(type: any) {
|
export async function listEnableCategory(type: any) {
|
||||||
const url = `media/categories/list/enable?enablePage=0&sort=desc&sortBy=id&type=${type}`;
|
const url = `media/categories/list?enablePage=0&sort=desc&sortBy=id&type=${type}`;
|
||||||
return httpGetInterceptor(url);
|
return httpGetInterceptor(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,11 @@ export async function saveUserInternal(data: any) {
|
||||||
return httpPostInterceptor(url, data);
|
return httpPostInterceptor(url, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function checkRolePlacementsAvailability(data: any) {
|
||||||
|
const url = "users/role-placements/availability";
|
||||||
|
return httpPostInterceptor(url, data);
|
||||||
|
}
|
||||||
|
|
||||||
export async function saveUserRolePlacements(data: any) {
|
export async function saveUserRolePlacements(data: any) {
|
||||||
const url = "users/role-placements";
|
const url = "users/role-placements";
|
||||||
return httpPostInterceptor(url, data);
|
return httpPostInterceptor(url, data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue