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