merge branch raja
This commit is contained in:
@ -151,7 +151,10 @@ export const DataGridProvider = <TData extends object>(props: TDataGridProps<TDa
|
|||||||
enableRowSelection: mergedProps.rowSelection,
|
enableRowSelection: mergedProps.rowSelection,
|
||||||
onRowSelectionChange: handleRowSelectionChange,
|
onRowSelectionChange: handleRowSelectionChange,
|
||||||
onSortingChange: (newSorting) => !loading && setSorting(newSorting),
|
onSortingChange: (newSorting) => !loading && setSorting(newSorting),
|
||||||
onColumnFiltersChange: (newFilters) => !loading && setColumnFilters(newFilters),
|
onColumnFiltersChange: (newFilters) => {
|
||||||
|
console.log('New Filters:', newFilters); // Debugging
|
||||||
|
!loading && setColumnFilters(newFilters);
|
||||||
|
},
|
||||||
onColumnVisibilityChange: setColumnVisibility,
|
onColumnVisibilityChange: setColumnVisibility,
|
||||||
onPaginationChange: (newPagination) => !loading && setPagination(newPagination),
|
onPaginationChange: (newPagination) => !loading && setPagination(newPagination),
|
||||||
getCoreRowModel: getCoreRowModel(),
|
getCoreRowModel: getCoreRowModel(),
|
||||||
@ -165,6 +168,8 @@ export const DataGridProvider = <TData extends object>(props: TDataGridProps<TDa
|
|||||||
manualFiltering: mergedProps.serverSide
|
manualFiltering: mergedProps.serverSide
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('Filtered Rows:', table.getFilteredRowModel().rows);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataGridContext.Provider
|
<DataGridContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
|||||||
@ -9,7 +9,12 @@ const Footer = () => {
|
|||||||
<div className="flex flex-col md:flex-row justify-center md:justify-between items-center gap-3 py-5">
|
<div className="flex flex-col md:flex-row justify-center md:justify-between items-center gap-3 py-5">
|
||||||
<div className="flex order-2 md:order-1 gap-2 font-normal text-2sm">
|
<div className="flex order-2 md:order-1 gap-2 font-normal text-2sm">
|
||||||
<span className="text-gray-500">{currentYear}©</span>
|
<span className="text-gray-500">{currentYear}©</span>
|
||||||
<a href="https://" target="_blank" className="text-gray-600 hover:text-primary">
|
<a
|
||||||
|
href="https://t-pay.tl/"
|
||||||
|
target="_blank"
|
||||||
|
className="text-gray-600 hover:text-primary"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
Brillian Dev.
|
Brillian Dev.
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const AldeiasMaster = () => {
|
|||||||
return (
|
return (
|
||||||
<ManageAldeiasContextProvider>
|
<ManageAldeiasContextProvider>
|
||||||
<Container>
|
<Container>
|
||||||
<h1 className="text-xl font-medium leading-none text-gray-900 mb-5">Aldeias</h1>
|
<h1 className="text-xl font-medium leading-none text-gray-900 mb-3">Aldeias</h1>
|
||||||
<Breadcrumbs sx={{ mb: 2 }}>
|
<Breadcrumbs sx={{ mb: 2 }}>
|
||||||
<Link underline="none" color="inherit" href="/">
|
<Link underline="none" color="inherit" href="/">
|
||||||
<span className="text-sm hover:underline">Dashboard</span>
|
<span className="text-sm hover:underline">Dashboard</span>
|
||||||
|
|||||||
@ -172,7 +172,10 @@ const AddDialog = () => {
|
|||||||
'Select Sucos'}
|
'Select Sucos'}
|
||||||
</button>
|
</button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="w-[400px] p-0">
|
<PopoverContent
|
||||||
|
className="w-[400px] p-0"
|
||||||
|
onWheel={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
<Command>
|
<Command>
|
||||||
<CommandInput placeholder="Search Sucos..." />
|
<CommandInput placeholder="Search Sucos..." />
|
||||||
<CommandList>
|
<CommandList>
|
||||||
|
|||||||
@ -174,10 +174,13 @@ const AddDialog = () => {
|
|||||||
?.name || 'Select Municipios'}
|
?.name || 'Select Municipios'}
|
||||||
</button>
|
</button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="w-[400px] p-0">
|
<PopoverContent
|
||||||
|
className="w-[400px] p-0"
|
||||||
|
onWheel={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
<Command>
|
<Command>
|
||||||
<CommandInput placeholder="Search Municipios..." />
|
<CommandInput placeholder="Search Municipios..." />
|
||||||
<CommandList>
|
<CommandList className="max-h-[300px] overflow-y-auto pointer-events-auto">
|
||||||
<CommandEmpty>No Municipio found.</CommandEmpty>
|
<CommandEmpty>No Municipio found.</CommandEmpty>
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
{municipios.map((municipio) => (
|
{municipios.map((municipio) => (
|
||||||
|
|||||||
@ -18,9 +18,7 @@ const ListToolbar = () => {
|
|||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Postu"
|
placeholder="Search Postu"
|
||||||
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
||||||
onChange={(event) =>
|
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
||||||
table.getColumn('name')?.setFilterValue(event.target.value)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
{/* <DefaultTooltip title={'Filter'} placement={'top'}>
|
||||||
|
|||||||
@ -99,7 +99,7 @@ const ManagePostoAdmsContextProvider = ({ children }: { children: React.ReactNod
|
|||||||
{
|
{
|
||||||
accessorFn: (row) => row.municipios_name,
|
accessorFn: (row) => row.municipios_name,
|
||||||
id: 'municipios_name',
|
id: 'municipios_name',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Municipio Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Municipios Name" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
|||||||
@ -155,9 +155,11 @@ const AddDialog = () => {
|
|||||||
<DialogBody ref={parentRef} className="overflow-y-auto">
|
<DialogBody ref={parentRef} className="overflow-y-auto">
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
{alert.show && (
|
{alert.show && (
|
||||||
<Alert variant="danger">
|
<div className="fixed top-[70px] left-1/2 -translate-x-1/2 -translate-y-1/2 z-50">
|
||||||
<h3>{alert.message}</h3>
|
<Alert variant="danger">
|
||||||
</Alert>
|
<h3>{alert.message}</h3>
|
||||||
|
</Alert>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const SucosMaster = () => {
|
|||||||
return (
|
return (
|
||||||
<ManageSucosContextProvider>
|
<ManageSucosContextProvider>
|
||||||
<Container>
|
<Container>
|
||||||
<h1 className="text-xl font-medium leading-none text-gray-900 mb-5">Sucos</h1>
|
<h1 className="text-xl font-medium leading-none text-gray-900 mb-3">Sucos</h1>
|
||||||
<Breadcrumbs sx={{ mb: 2 }}>
|
<Breadcrumbs sx={{ mb: 2 }}>
|
||||||
<Link underline="none" color="inherit" href="/">
|
<Link underline="none" color="inherit" href="/">
|
||||||
<span className="text-sm hover:underline">Dashboard</span>
|
<span className="text-sm hover:underline">Dashboard</span>
|
||||||
|
|||||||
@ -45,7 +45,7 @@ const AddDialog = () => {
|
|||||||
});
|
});
|
||||||
const initialState = {
|
const initialState = {
|
||||||
name: '',
|
name: '',
|
||||||
posto_adm_id: 0,
|
postoId: 0,
|
||||||
created_by: '',
|
created_by: '',
|
||||||
created_at: ''
|
created_at: ''
|
||||||
};
|
};
|
||||||
@ -80,7 +80,7 @@ const AddDialog = () => {
|
|||||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (formField.name.trim() === '' || formField.posto_adm_id === 0) {
|
if (formField.name.trim() === '' || formField.postoId === 0) {
|
||||||
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,11 +166,14 @@ const AddDialog = () => {
|
|||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<button type="button" className="input col-span-5 text-left">
|
<button type="button" className="input col-span-5 text-left">
|
||||||
{posto_adms.find((posto) => posto.PostoAdms_id === formField.posto_adm_id)
|
{posto_adms.find((posto) => posto.PostoAdms_id === formField.postoId)
|
||||||
?.PostoAdms_name || 'Select Posto Administrativo'}
|
?.PostoAdms_name || 'Select Posto Administrativo'}
|
||||||
</button>
|
</button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="w-[400px] p-0">
|
<PopoverContent
|
||||||
|
className="w-[400px] p-0"
|
||||||
|
onWheel={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
<Command>
|
<Command>
|
||||||
<CommandInput placeholder="Search Posto Adms..." />
|
<CommandInput placeholder="Search Posto Adms..." />
|
||||||
<CommandList>
|
<CommandList>
|
||||||
@ -183,7 +186,7 @@ const AddDialog = () => {
|
|||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
setFormField({
|
setFormField({
|
||||||
...formField,
|
...formField,
|
||||||
posto_adm_id: posto.PostoAdms_id
|
postoId: posto.PostoAdms_id
|
||||||
});
|
});
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -4,7 +4,14 @@ import { ChangeEvent, useCallback, useState } from 'react';
|
|||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { Alert, useDataGrid } from '@/components';
|
import { Alert, useDataGrid } from '@/components';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { Dialog, DialogContent, DialogFooter, DialogHeader } from '@/components/ui/dialog';
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle
|
||||||
|
} from '@/components/ui/dialog';
|
||||||
import { EnforceSwitch } from '@/components/switch';
|
import { EnforceSwitch } from '@/components/switch';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
|
||||||
@ -39,6 +46,8 @@ const DeleteDialog = () => {
|
|||||||
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
||||||
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||||
<DialogHeader className="p-0 border-0 block">
|
<DialogHeader className="p-0 border-0 block">
|
||||||
|
<DialogTitle></DialogTitle>
|
||||||
|
<DialogDescription></DialogDescription>
|
||||||
<Alert variant="warning">
|
<Alert variant="warning">
|
||||||
<h3 className="text-lg">Are you sure?</h3>
|
<h3 className="text-lg">Are you sure?</h3>
|
||||||
<span className="text-sm">you will delete this data!</span>
|
<span className="text-sm">you will delete this data!</span>
|
||||||
|
|||||||
@ -48,7 +48,7 @@ const EditDialog = () => {
|
|||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
name: '',
|
name: '',
|
||||||
posto_adm_id: 0, // Pastikan ini sesuai dengan PostoAdms_id
|
postoId: 0, // Pastikan ini sesuai dengan PostoAdms_id
|
||||||
updated_by: '',
|
updated_by: '',
|
||||||
updated_at: ''
|
updated_at: ''
|
||||||
};
|
};
|
||||||
@ -110,7 +110,8 @@ const EditDialog = () => {
|
|||||||
setFormField((prev) => ({
|
setFormField((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
name: response.data.name,
|
name: response.data.name,
|
||||||
posto_adm_id: response.data.posto.id // Pastikan ini sesuai dengan PostoAdms_id
|
postoId: response.data.posto?.id || ''
|
||||||
|
// Pastikan ini sesuai dengan PostoAdms_id
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
setFormField((prev) => ({
|
setFormField((prev) => ({
|
||||||
@ -123,7 +124,7 @@ const EditDialog = () => {
|
|||||||
const handleUpdate = (e: React.FormEvent<HTMLFormElement>) => {
|
const handleUpdate = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (formField.name.trim() === '' || formField.posto_adm_id === 0) {
|
if (formField.name.trim() === '' || formField.postoId === 0) {
|
||||||
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -203,7 +204,7 @@ const EditDialog = () => {
|
|||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<button type="button" className="input col-span-5 text-left">
|
<button type="button" className="input col-span-5 text-left">
|
||||||
{postoadms.find((posto) => posto.PostoAdms_id === formField.posto_adm_id)
|
{postoadms.find((posto) => posto.PostoAdms_id === formField.postoId)
|
||||||
?.PostoAdms_name || 'Select Posto Adms'}
|
?.PostoAdms_name || 'Select Posto Adms'}
|
||||||
</button>
|
</button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
@ -220,7 +221,7 @@ const EditDialog = () => {
|
|||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
setFormField({
|
setFormField({
|
||||||
...formField,
|
...formField,
|
||||||
posto_adm_id: posto.PostoAdms_id // Gunakan PostoAdms_id
|
postoId: posto.PostoAdms_id // Gunakan PostoAdms_id
|
||||||
});
|
});
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const ListToolbar = () => {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search Sucos"
|
placeholder="Search Sucos"
|
||||||
value={table.getColumn(`id`)?.getFilterValue() as string}
|
value={String(table.getColumn(`sucos_name`)?.getFilterValue() ?? '')}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
table.getColumn('sucos_name')?.setFilterValue(event.target.value)
|
table.getColumn('sucos_name')?.setFilterValue(event.target.value)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,6 +88,10 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
|
|||||||
{
|
{
|
||||||
accessorFn: (row) => row.sucos_name,
|
accessorFn: (row) => row.sucos_name,
|
||||||
id: 'sucos_name',
|
id: 'sucos_name',
|
||||||
|
filterFn: (row, columnId, filterValue) => {
|
||||||
|
const value = row.getValue<string>(columnId);
|
||||||
|
return String(value).includes(String(filterValue));
|
||||||
|
},
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Sucos Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Sucos Name" column={column} />,
|
||||||
enableSorting: true,
|
enableSorting: true,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
@ -96,8 +100,12 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.posto_name,
|
accessorKey: 'posto_name',
|
||||||
id: 'posto_name',
|
id: 'posto_name',
|
||||||
|
filterFn: (row, columnId, filterValue) => {
|
||||||
|
const value = row.getValue<string>(columnId);
|
||||||
|
return String(value).includes(String(filterValue));
|
||||||
|
},
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Posto Name" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Posto Name" column={column} />,
|
||||||
enableSorting: true,
|
enableSorting: true,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
|
|||||||
@ -27,8 +27,9 @@ const ListToolbar = () => {
|
|||||||
// disabled={isLoading}
|
// disabled={isLoading}
|
||||||
// onClick={handleFilterData}
|
// onClick={handleFilterData}
|
||||||
>
|
>
|
||||||
{loadingButton === 'filter' ? <ContentLoader /> : <KeenIcon icon="filter" />}
|
{/* {loadingButton === 'filter' ? <ContentLoader /> : <KeenIcon icon="filter" />} */}
|
||||||
<KeenIcon icon="filter" />
|
{/* <KeenIcon icon="filter" />
|
||||||
|
>>>>>>> raja
|
||||||
</Button>
|
</Button>
|
||||||
</DefaultTooltip> */}
|
</DefaultTooltip> */}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -29,8 +29,8 @@ const ListToolBar = () => {
|
|||||||
// disabled={isLoading}
|
// disabled={isLoading}
|
||||||
// onClick={handleFilterData}
|
// onClick={handleFilterData}
|
||||||
>
|
>
|
||||||
{loadingButton === 'filter' ? <ContentLoader /> : <KeenIcon icon="filter" />}
|
{/* {loadingButton === 'filter' ? <ContentLoader /> : <KeenIcon icon="filter" />} */}
|
||||||
<KeenIcon icon="filter" />
|
{/* <KeenIcon icon="filter" />
|
||||||
</Button>
|
</Button>
|
||||||
</DefaultTooltip> */}
|
</DefaultTooltip> */}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -110,7 +110,11 @@ const DropdownUser = ({ menuItemRef }: IDropdownUserProps) => {
|
|||||||
</Alert>
|
</Alert>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogFooter className="flex justify-end items-center gap-4 mt-3">
|
<DialogFooter className="flex justify-end items-center gap-4 mt-3">
|
||||||
<Button variant={'outlined'} onClick={() => setShowLogoutDialog(false)}>
|
<Button
|
||||||
|
variant={'outlined'}
|
||||||
|
onClick={() => setShowLogoutDialog(false)}
|
||||||
|
style={{ color: 'grey', borderColor: 'grey' }}
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outlined" color="error" onClick={handleLogout}>
|
<Button variant="outlined" color="error" onClick={handleLogout}>
|
||||||
|
|||||||
Reference in New Issue
Block a user