fix group

This commit is contained in:
unknown
2025-04-15 14:38:29 +07:00
parent fc2153ead0
commit 249e09774d
5 changed files with 89 additions and 78 deletions

View File

@ -21,33 +21,33 @@ import ConfirmDialog from '@/components/confirm';
const BASE_URL_CUSTOMER = apiConfig.service_customer;
// ACCESS ADM
export default function AdmAccess({page,formData,handleClose,fetchCustomers,viewOnly,setViewOnly}: any) {
export default function AdmAccess({page,groups,formData,handleClose,fetchCustomers,viewOnly,setViewOnly}: any) {
const [dialogOpen, setDialogOpen] = useState(false);
const [dialogType, setDialogType] = useState('');
const [changeGroup, setChangeGroup] = useState('');
const [changeGroupD, setChangeGroupD] = useState(false);
const [groups, setGroups] = useState([]);
// const [groups, setGroups] = useState([]);
useEffect(() => {
fetchGroups();
// fetchGroups();
}, []);
const fetchGroups = async () => {
try {
let getGroups = await axios.get(`${BASE_URL_CUSTOMER}/groups/list`, {
params: {
limit: 50,
page: 1,
with_deleted: false,
order_field: 'name',
order_direction: 'ASC'
}
});
setGroups(getGroups.data.data.list);
} catch (error: any) {
toast.error(error.message);
}
};
// const fetchGroups = async () => {
// try {
// let getGroups = await axios.get(`${BASE_URL_CUSTOMER}/groups/list`, {
// params: {
// limit: 50,
// page: 1,
// with_deleted: false,
// order_field: 'name',
// order_direction: 'ASC'
// }
// });
// setGroups(getGroups.data.data.list);
// } catch (error: any) {
// toast.error(error.message);
// }
// };
const handleYes = async () => {
try {
@ -119,6 +119,7 @@ export default function AdmAccess({page,formData,handleClose,fetchCustomers,view
function btnConfirmDialog(status: boolean) {
setDialogOpen(status);
}
if (!formData.id) return '';
if (page !== 'kyc') {
return (