add crud municipio
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { DataGridColumnHeader, DataGridProvider } from '@/components';
|
||||
import { DataGridColumnHeader, DataGridProvider, KeenIcon } from '@/components';
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import { apiConfig } from '@/config/api.config';
|
||||
import { ColumnDef } from '@tanstack/react-table';
|
||||
@ -127,18 +127,29 @@ const ManageMunicipiosProvider = ({ children }: { children: React.ReactNode }) =
|
||||
header: ({ column }) => <DataGridColumnHeader title="Actions" column={column} />,
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[100px], text-center',
|
||||
cellClassName: 'text-center'
|
||||
cell: (data) => {
|
||||
const row = data.row.original;
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
onClick={() => handleEditDialog(true, row.id)}
|
||||
>
|
||||
<KeenIcon icon="notepad-edit" />
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
onClick={() => handleDeleteDialog(true, row.id)}
|
||||
>
|
||||
<KeenIcon icon="trash" />
|
||||
</button>
|
||||
</>
|
||||
);
|
||||
},
|
||||
cell: (info) => (
|
||||
<Button
|
||||
variant={'outline'}
|
||||
onClick={() => navigate(`/master-data/municipios/postoadms/${info.row.original.id}`)}
|
||||
>
|
||||
Details
|
||||
</Button>
|
||||
)
|
||||
meta: {
|
||||
headerClassName: 'w-[100px]',
|
||||
cellClassName: 'text-center'
|
||||
}
|
||||
}
|
||||
],
|
||||
[handleEditDialog, handleDeleteDialog]
|
||||
@ -158,6 +169,11 @@ const ManageMunicipiosProvider = ({ children }: { children: React.ReactNode }) =
|
||||
}
|
||||
});
|
||||
console.log(response.data);
|
||||
// const sortedList = response.data.data.list.sort((a: MunicipiosProps, b: MunicipiosProps) => {
|
||||
// if (a.name < b.name) return -1;
|
||||
// if (a.name > b.name) return 1;
|
||||
// return 0;
|
||||
// });
|
||||
setMunicipios(response.data.data.list);
|
||||
return { data: response?.data.data.list, totalCount: response?.data.data.total_count };
|
||||
} catch (error) {
|
||||
@ -210,7 +226,6 @@ const ManageMunicipiosProvider = ({ children }: { children: React.ReactNode }) =
|
||||
console.error('Error restoring municipios', error);
|
||||
}
|
||||
};
|
||||
console.log(municipios);
|
||||
return (
|
||||
<ManageMunicipiosContext.Provider
|
||||
value={{
|
||||
|
||||
Reference in New Issue
Block a user