Pull Request branch dev-clone to main #1
|
|
@ -8,6 +8,7 @@ import { Flex } from "@mantine/core";
|
|||
import createActionButtons from "@/utils/createActionButton";
|
||||
import { TbEye, TbPencil, TbTrash } from "react-icons/tb";
|
||||
import AspectDeleteModal from "@/modules/aspectManagement/modals/AspectDeleteModal";
|
||||
import { Button } from "@/shadcn/components/ui/button";
|
||||
|
||||
export const Route = createLazyFileRoute("/_dashboardLayout/aspect/")({
|
||||
component: AspectPage,
|
||||
|
|
@ -18,6 +19,13 @@ type DataType = ExtractQueryDataType<typeof aspectQueryOptions>;
|
|||
const columnHelper = createColumnHelper<DataType>();
|
||||
|
||||
export default function AspectPage() {
|
||||
// Function to update URL query string without refreshing
|
||||
const updateQueryString = (key: string, value: string) => {
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
searchParams.set(key, value);
|
||||
window.history.pushState({}, "", `?${searchParams.toString()}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<PageTemplate
|
||||
title="Manajemen Aspek"
|
||||
|
|
@ -30,7 +38,7 @@ export default function AspectPage() {
|
|||
cell: (props) => props.row.index + 1,
|
||||
}),
|
||||
|
||||
// Aspect columns
|
||||
// Aspect Columns
|
||||
columnHelper.display({
|
||||
header: "Nama Aspek",
|
||||
cell: (props) => props.row.original.name || "Tidak ada Aspek",
|
||||
|
|
@ -60,31 +68,29 @@ export default function AspectPage() {
|
|||
columnHelper.display({
|
||||
header: "Aksi",
|
||||
cell: (props) => (
|
||||
<Flex gap="xs">
|
||||
{createActionButtons([
|
||||
{
|
||||
label: "Detail",
|
||||
permission: true,
|
||||
action: `?detail=${props.row.original.id}`,
|
||||
color: "black",
|
||||
icon: <TbEye />,
|
||||
},
|
||||
{
|
||||
label: "Ubah",
|
||||
permission: true,
|
||||
action: `?edit=${props.row.original.id}`,
|
||||
color: "black",
|
||||
icon: <TbPencil />,
|
||||
},
|
||||
{
|
||||
label: "Hapus",
|
||||
permission: true,
|
||||
action: `?delete=${props.row.original.id}`,
|
||||
color: "black",
|
||||
icon: <TbTrash />,
|
||||
},
|
||||
])}
|
||||
</Flex>
|
||||
<div className="flex flex-row w-fit items-center rounded gap-2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="w-fit items-center hover:bg-gray-300 border"
|
||||
onClick={() => updateQueryString("detail", props.row.original.id)}
|
||||
>
|
||||
<TbEye className="text-black" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="w-fit items-center hover:bg-gray-300 border"
|
||||
onClick={() => updateQueryString("edit", props.row.original.id)}
|
||||
>
|
||||
<TbPencil className="text-black" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="w-fit items-center hover:bg-gray-300 border"
|
||||
onClick={() => updateQueryString("delete", props.row.original.id)}
|
||||
>
|
||||
<TbTrash className="text-black" />
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user