add the Manage Access Types page and handle the create transfer type form
This commit is contained in:
@ -1,10 +1,20 @@
|
|||||||
|
import { Container, DataGridInner } from '@/components';
|
||||||
|
import {
|
||||||
|
ManageAccessTypeContext,
|
||||||
|
ManageAccessTypeContextProvider
|
||||||
|
} from './hooks/ManageAccessTypeContext';
|
||||||
|
import AddDialog from './blocks/AddDialog';
|
||||||
|
|
||||||
const AccessType = () => {
|
const AccessType = () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<ManageAccessTypeContextProvider>
|
||||||
<div className="container mx-auto p-5">
|
<Container>
|
||||||
<h1 className="text-xl font-medium leading-none text-gray-900">Access Type</h1>
|
<div className="grid gap-5 lg:gap-7.5">
|
||||||
</div>
|
<DataGridInner />
|
||||||
</div>
|
</div>
|
||||||
|
<AddDialog />
|
||||||
|
</Container>
|
||||||
|
</ManageAccessTypeContextProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
294
src/pages/access/access-type/blocks/AddDialog.tsx
Normal file
294
src/pages/access/access-type/blocks/AddDialog.tsx
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
import { apiConfig } from '@/config/api.config';
|
||||||
|
import { useRef, useState } from 'react';
|
||||||
|
import { useManageAccessTypeContext } from '../hooks/useManageAccessTypeContext';
|
||||||
|
import { Alert, KeenIcon, useDataGrid } from '@/components';
|
||||||
|
import { useCallApi } from '@/hooks';
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogBody,
|
||||||
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle
|
||||||
|
} from '@/components/ui/dialog';
|
||||||
|
import { Input } from '@/components/ui/input';
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue
|
||||||
|
} from '@/components/ui/select';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
|
||||||
|
interface CreateTransferTypeParams {
|
||||||
|
transfer_type_name: string;
|
||||||
|
description: string;
|
||||||
|
from_account: string;
|
||||||
|
to_account: string;
|
||||||
|
minimal_amount: number;
|
||||||
|
maximum_amount: number;
|
||||||
|
otp_threshold: number;
|
||||||
|
maximum_transaction_perDay: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const API_URL = apiConfig.service_dashboard;
|
||||||
|
|
||||||
|
const AddDialog = () => {
|
||||||
|
const parentRef = useRef<any | null>(null);
|
||||||
|
const { showAddDialog, handleAddDialog, accounts } = useManageAccessTypeContext();
|
||||||
|
const { reload } = useDataGrid();
|
||||||
|
const { PostData, PutData } = useCallApi();
|
||||||
|
const [alert, setAlert] = useState({
|
||||||
|
show: false,
|
||||||
|
message: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
transfer_type_name: '',
|
||||||
|
description: '',
|
||||||
|
from_account: '',
|
||||||
|
to_account: '',
|
||||||
|
minimal_amount: 0,
|
||||||
|
maximum_amount: 0,
|
||||||
|
otp_threshold: 0,
|
||||||
|
maximum_transaction_perDay: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const [formField, setFormField] = useState(initialState);
|
||||||
|
const resetForm = () => {
|
||||||
|
setFormField(initialState);
|
||||||
|
};
|
||||||
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
|
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
|
// setIsSubmitting(true);
|
||||||
|
const payload = {
|
||||||
|
transfer_type_name: formField.transfer_type_name,
|
||||||
|
description: formField.description,
|
||||||
|
from_account: formField.from_account,
|
||||||
|
to_account: formField.to_account,
|
||||||
|
minimal_amount: formField.minimal_amount,
|
||||||
|
maximum_amount: formField.maximum_amount,
|
||||||
|
otp_threshold: formField.otp_threshold,
|
||||||
|
maximum_transaction_perDay: formField.maximum_transaction_perDay
|
||||||
|
};
|
||||||
|
console.log(payload);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={showAddDialog} onOpenChange={(open) => handleAddDialog(open)}>
|
||||||
|
<DialogContent className="container-fixed max-w-[768px] flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||||
|
<DialogHeader className="p-5 border-0">
|
||||||
|
<div className="flex items-center justify-between flex-wrap grow">
|
||||||
|
<div className="flex flex-col justify-center">
|
||||||
|
<h1 className="text-xl font-semibold leading-none text-gray-900">
|
||||||
|
Create Transfer Type
|
||||||
|
</h1>
|
||||||
|
<div className="flex items-center gap-2 text-sm font-normal text-gray-700"></div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="cursor-pointer hover:opacity-100 opacity-50"
|
||||||
|
onClick={() => {
|
||||||
|
handleAddDialog(false);
|
||||||
|
resetForm();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<KeenIcon icon="cross" className="text-1.5xl" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DialogHeader>
|
||||||
|
<DialogBody className="scrollable-y px-0 pb-0" ref={parentRef}>
|
||||||
|
<div className="flex flex-col px-0">
|
||||||
|
{alert.show && (
|
||||||
|
<Alert variant="danger" className="mb-3">
|
||||||
|
<h3>{alert.message}</h3>
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
|
<form action="" onSubmit={handleSubmit}>
|
||||||
|
<div className="card-body grid gap-5 p-0">
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Transfer Type Name
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
className="input"
|
||||||
|
type="text"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.transfer_type_name}
|
||||||
|
onChange={({ target }) =>
|
||||||
|
setFormField((prev) => ({ ...prev, transfer_type_name: target.value }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Description
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
className="input"
|
||||||
|
type="text"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.description}
|
||||||
|
onChange={({ target }) =>
|
||||||
|
setFormField((prev) => ({ ...prev, description: target.value }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
|
<label className="form-label max-w-56">From Account</label>
|
||||||
|
|
||||||
|
<div className="grow">
|
||||||
|
<Select
|
||||||
|
value={formField.from_account}
|
||||||
|
onValueChange={(target) =>
|
||||||
|
setFormField((prev) => ({ ...prev, from_account: target }))
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder="Select" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{accounts.map((account, idx) => (
|
||||||
|
<SelectItem value={account.name} key={account.id}>
|
||||||
|
{account.name}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
|
<label className="form-label max-w-56">To Account</label>
|
||||||
|
|
||||||
|
<div className="grow">
|
||||||
|
<Select
|
||||||
|
value={formField.to_account}
|
||||||
|
onValueChange={(target) =>
|
||||||
|
setFormField((prev) => ({ ...prev, to_account: target }))
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder="Select" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{accounts.map((account, idx) => (
|
||||||
|
<SelectItem value={account.name} key={account.id}>
|
||||||
|
{account.name}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Minimal Amount
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
className="input"
|
||||||
|
type="number"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.minimal_amount}
|
||||||
|
onChange={({ target }) =>
|
||||||
|
setFormField((prev) => ({
|
||||||
|
...prev,
|
||||||
|
minimal_amount: Number(target.value)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Maximum Amount
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
className="input"
|
||||||
|
type="number"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.maximum_amount}
|
||||||
|
onChange={({ target }) =>
|
||||||
|
setFormField((prev) => ({
|
||||||
|
...prev,
|
||||||
|
maximum_amount: Number(target.value)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
OTP Threshold
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
className="input"
|
||||||
|
type="number"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.otp_threshold}
|
||||||
|
onChange={({ target }) =>
|
||||||
|
setFormField((prev) => ({
|
||||||
|
...prev,
|
||||||
|
otp_threshold: Number(target.value)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Maximum Transaction / day
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
className="input"
|
||||||
|
type="number"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.maximum_transaction_perDay}
|
||||||
|
onChange={({ target }) =>
|
||||||
|
setFormField((prev) => ({
|
||||||
|
...prev,
|
||||||
|
maximum_transaction_perDay: Number(target.value)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-end pt-2.5 gap-5">
|
||||||
|
<Button variant={'outline'} type="reset">
|
||||||
|
Reset
|
||||||
|
</Button>
|
||||||
|
<Button variant={'default'} type="submit">
|
||||||
|
Save Changes
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</DialogBody>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddDialog;
|
||||||
49
src/pages/access/access-type/blocks/ListToolBar.tsx
Normal file
49
src/pages/access/access-type/blocks/ListToolBar.tsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components';
|
||||||
|
import { useManageAccessTypeContext } from '../hooks/useManageAccessTypeContext';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
|
||||||
|
const ListToolbar = () => {
|
||||||
|
const { table, reload } = useDataGrid();
|
||||||
|
const { handleAddDialog, handleEditDialog } = useManageAccessTypeContext();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="card-header flex-wrap gap-2 border-b-0 px-5">
|
||||||
|
<div className="flex flex-wrap gap-2 lg:gap-5 w-full">
|
||||||
|
<div className="flex justify-between w-full items-center">
|
||||||
|
<div className="flex w-[50%] gap-3 items-center">
|
||||||
|
<label className="input input-sm w-1/3">
|
||||||
|
<KeenIcon icon="magnifier" />
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Search Access Type"
|
||||||
|
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
||||||
|
onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<DefaultTooltip title={'Filter'} placement={'top'}>
|
||||||
|
<Button variant={'outline'} className="h-7.5 disabled:bg-gray-400">
|
||||||
|
<KeenIcon icon="filter" />
|
||||||
|
</Button>
|
||||||
|
</DefaultTooltip>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-3 items-center">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
className="h-7.5 text-[0.8rem]"
|
||||||
|
onClick={() => handleAddDialog(true)}
|
||||||
|
>
|
||||||
|
Add Data
|
||||||
|
</Button>
|
||||||
|
<DefaultTooltip title={'Refresh'} placement={'top'}>
|
||||||
|
<Button variant="outline" className="h-7.5" onClick={() => reload()}>
|
||||||
|
<KeenIcon icon="arrows-circle" />
|
||||||
|
</Button>
|
||||||
|
</DefaultTooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ListToolbar;
|
||||||
178
src/pages/access/access-type/hooks/ManageAccessTypeContext.tsx
Normal file
178
src/pages/access/access-type/hooks/ManageAccessTypeContext.tsx
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
import { DataGridColumnHeader, DataGridProvider } from '@/components';
|
||||||
|
import { Toaster } from '@/components/ui/sonner';
|
||||||
|
import { apiConfig } from '@/config/api.config';
|
||||||
|
import { useCallApi } from '@/hooks';
|
||||||
|
import { ColumnDef } from '@tanstack/react-table';
|
||||||
|
import { createContext, useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import ListToolbar from '../blocks/ListToolBar';
|
||||||
|
|
||||||
|
interface SelectedUser {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
internal_name: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AccountProps {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const accounts: string[] = [
|
||||||
|
'eMoney Account',
|
||||||
|
'Topup Account',
|
||||||
|
'Merchant Account',
|
||||||
|
'Deposit Account',
|
||||||
|
'Cash out/in'
|
||||||
|
];
|
||||||
|
|
||||||
|
interface ContextProps {
|
||||||
|
showEditDialog: boolean;
|
||||||
|
handleEditDialog: (show: boolean, selected_user: string | null) => void;
|
||||||
|
showAddDialog: boolean;
|
||||||
|
handleAddDialog: (show: boolean) => void;
|
||||||
|
selectedUser: string | null;
|
||||||
|
accounts: AccountProps[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const initialProps: ContextProps = {
|
||||||
|
showEditDialog: false,
|
||||||
|
handleEditDialog: () => {},
|
||||||
|
showAddDialog: false,
|
||||||
|
handleAddDialog: () => {},
|
||||||
|
selectedUser: null,
|
||||||
|
accounts: []
|
||||||
|
};
|
||||||
|
|
||||||
|
const ManageAccessTypeContext = createContext<ContextProps>(initialProps);
|
||||||
|
const API_URL = apiConfig.service_dashboard;
|
||||||
|
|
||||||
|
const ManageAccessTypeContextProvider = ({ children }: { children: React.ReactNode }) => {
|
||||||
|
const [showEditDialog, setShowEditDialog] = useState(false);
|
||||||
|
const [showAddDialog, setShowAddDialog] = useState(false);
|
||||||
|
const [selectedUser, setSelectedUser] = useState<string | null>(null);
|
||||||
|
const [accounts, setAccount] = useState<AccountProps[]>([]);
|
||||||
|
const { GetData } = useCallApi();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setAccount([
|
||||||
|
{ id: '1', name: 'eMoney Account' },
|
||||||
|
{ id: '2', name: 'Topup Account' },
|
||||||
|
{ id: '3', name: 'Merchant Account' },
|
||||||
|
{ id: '4', name: 'Deposit Account' },
|
||||||
|
{ id: '5', name: 'Cash in/out Account' }
|
||||||
|
]);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleEditDialog = useCallback((show: boolean, selected_user: string | null) => {
|
||||||
|
setSelectedUser(show ? selected_user : null);
|
||||||
|
setShowEditDialog(show);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleAddDialog = useCallback((show: boolean) => {
|
||||||
|
setShowAddDialog(show);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const columns = useMemo<ColumnDef<any>[]>(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.id,
|
||||||
|
id: 'id',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="ID" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[100px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.name,
|
||||||
|
id: 'name',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Name" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[250px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.internal_name,
|
||||||
|
id: 'internal_name',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Internal Name" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[250px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.description,
|
||||||
|
id: 'description',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[250px]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'actions',
|
||||||
|
enableSorting: false,
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Actions" column={column} />,
|
||||||
|
cell: ({ row }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
className="btn btn-sm btn-primary mr-2"
|
||||||
|
onClick={() => handleEditDialog(true, row.original.id)}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
<button className="btn btn-sm btn-primary" onClick={() => handleAddDialog(true)}>
|
||||||
|
Add
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
meta: {
|
||||||
|
headerClassName: 'w-[100px]',
|
||||||
|
cellClassName: 'text-center'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[handleAddDialog, handleEditDialog]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="container mx-auto py-5">
|
||||||
|
<h1>Manage Access Type</h1>
|
||||||
|
</div>
|
||||||
|
<ManageAccessTypeContext.Provider
|
||||||
|
value={{
|
||||||
|
showEditDialog,
|
||||||
|
handleEditDialog,
|
||||||
|
showAddDialog,
|
||||||
|
handleAddDialog,
|
||||||
|
selectedUser,
|
||||||
|
accounts
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Toaster expand visibleToasts={9} duration={3000} />
|
||||||
|
<DataGridProvider
|
||||||
|
columns={columns}
|
||||||
|
pagination={{ size: 10 }}
|
||||||
|
layout={{ card: true }}
|
||||||
|
toolbar={<ListToolbar />}
|
||||||
|
sorting={[{ id: 'id', desc: true }]}
|
||||||
|
serverSide={true}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</DataGridProvider>
|
||||||
|
</ManageAccessTypeContext.Provider>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { ManageAccessTypeContext, ManageAccessTypeContextProvider };
|
||||||
|
export type { SelectedUser };
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { useContext } from 'react';
|
||||||
|
import { ManageAccessTypeContext } from './ManageAccessTypeContext';
|
||||||
|
|
||||||
|
const useManageAccessTypeContext = () => {
|
||||||
|
const context = useContext(ManageAccessTypeContext);
|
||||||
|
|
||||||
|
if (!context) throw new Error('useManageAccessTypeContext must be used within AuthProvider');
|
||||||
|
|
||||||
|
return context;
|
||||||
|
};
|
||||||
|
|
||||||
|
export { useManageAccessTypeContext };
|
||||||
@ -336,6 +336,7 @@ const AddDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div className="flex justify-end pt-2.5">
|
<div className="flex justify-end pt-2.5">
|
||||||
<Button className="btn btn-primary" type="submit" disabled={isButtonDisabled}>
|
<Button className="btn btn-primary" type="submit" disabled={isButtonDisabled}>
|
||||||
|
|||||||
Reference in New Issue
Block a user