yarn and member

This commit is contained in:
unknown
2025-03-04 18:37:15 +07:00
parent 19fa2febad
commit 52eee53002
6 changed files with 250 additions and 110 deletions

View File

@ -3,7 +3,7 @@ import { columns, Group } from './Column';
import { apiConfig } from '@/config/api.config';
import axios, { AxiosResponse } from 'axios';
import { DialogContent, MenuItem, Radio, RadioGroup, FormControlLabel, FormControl,
Dialog, DialogActions, DialogTitle, Typography, Button, Box } from '@mui/material';
Dialog, DialogTitle, Typography, Button, Box } from '@mui/material';
import { useState, useEffect } from 'react';
// import IconButton from '@mui/material/IconButton';
import CloseIcon from '@mui/icons-material/Close';
@ -27,7 +27,7 @@ const ManageGroups = () => {
const [isDialogOpen, setIsDialogOpen] = useState(false);
const [dataGroup, setDataGroup] = useState([]);
const [formData, setFormData] = useState(initGroup);
const [pageIndex, setPageIndex] = useState(0);
const [pageIndex, setPageIndex] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [dialogType, setDialogType] = useState('');
const [dialogOpen, setDialogOpen] = useState(false);
@ -40,8 +40,8 @@ const ManageGroups = () => {
try {
let groups = await axios.get(`${BASE_URL}/groups/list`, {
params: {
limit: 10,
page: 1,
limit: pageSize,
page: pageIndex,
with_deleted: false,
order_field: 'name',
order_direction: 'ASC'
@ -128,10 +128,6 @@ const ManageGroups = () => {
}
};
const handleNo = () => {
setDialogOpen(false);
};
return (
<div>
<div className="container mx-auto pt-2">
@ -141,11 +137,11 @@ const ManageGroups = () => {
title="Confirm Action"
content={`Are you sure you want to `+( dialogType === 'create' ? "create?" : ( dialogType === 'update' ? "update?" : "delete?"))}
onYes={handleYes}
onNo={handleNo}
onNo={() => setDialogOpen(false)}
/>
<h1 className="text-xl font-medium leading-none text-gray-900 p-5">Groups</h1>
<DataTable data={dataGroup} columns={columns} createGroup={createGroup} onUpdate={handleUpdate} onDelete={handleDelete} />
<Dialog open={isDialogOpen} onClose={setIsDialogOpen}>
<Dialog open={isDialogOpen} onClose={closeDialog}>
<DialogContent className="w-[600px]">
<div className="flex justify-between">
<DialogTitle>Create New Group</DialogTitle>
@ -191,51 +187,6 @@ const ManageGroups = () => {
onChange={handleChange}
/>
</div>
{/* <div className="grid grid-cols-4 items-center gap-4 w-full">
<label className="form-label text-sm">
<span className="text-red-500">*</span>PIN Length:
</label>
<input
type="text"
name="pin_length"
className="input w-full col-span-3"
value={formData.pin_length}
onChange={handleChange}
/>
</div>
<div className="grid grid-cols-4 items-center gap-4 w-full">
<label className="form-label text-sm">
<span className="text-red-500">*</span>Max Pin Attempts:
</label>
<input
type="text"
name="max_pin_attempts"
className="input w-full col-span-3"
value={formData.max_pin_attempts}
onChange={handleChange}
/>
</div> */}
{/* <div className="grid grid-cols-4 items-center gap-4 w-full mb-5">
<label className="form-label text-sm">Default Notification:</label>
<Select
onValueChange={(e) => setFormData({ ...formData, default_notification: e })}
>
<SelectTrigger className="w-full col-span-3">
<SelectValue placeholder="Select Default Notification" />
</SelectTrigger>
<SelectContent className="w-full">
<SelectItem value="1 - notifSender">1 - notifSender</SelectItem>
<SelectItem value="2 - notifBenefeciary">2 - notifBenefeciary</SelectItem>
</SelectContent>
</Select>
<input
type="text"
name="default_notification"
className="input w-full col-span-3"
value={formData.default_notification}
onChange={handleChange}
/>
</div> */}
<Button type="submit">Submit</Button>
</form>
</div>