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