fix member

This commit is contained in:
unknown
2025-04-07 18:54:11 +07:00
parent 755f68c5e4
commit e2cec8ee07

View File

@ -262,14 +262,14 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
<TextField disabled={viewOnly} fullWidth margin="dense" label="Bank Account" name="bank_account" value={formData.bank_account} onChange={handleChange} /> <TextField disabled={viewOnly} fullWidth margin="dense" label="Bank Account" name="bank_account" value={formData.bank_account} onChange={handleChange} />
<TextField disabled={viewOnly} fullWidth margin="dense" label="iBank Number" name="ibank_number" value={formData.ibank_number} onChange={handleChange} /> <TextField disabled={viewOnly} fullWidth margin="dense" label="iBank Number" name="ibank_number" value={formData.ibank_number} onChange={handleChange} />
<Divider className="pt-7"/> <Divider className="pt-7"/>
{getAdmAccess(page, formData, handleClose, fetchCustomers)} {/* {getAdmAccess(page, formData, handleClose, fetchCustomers)} */}
{ {
page === 'kyc' ? ( page === 'kyc' ? (
<> <>
<Typography sx={{color:'grey'}}>Approval</Typography> <Typography sx={{color:'grey'}}>Approval</Typography>
<TextField fullWidth margin="dense" label="Approval Description" name="description" value={formData.description} onChange={handleChange} /> <TextField fullWidth margin="dense" label="Approval Description" name="description" value={formData.description} onChange={handleChange} />
</> </>
) : ('') ) : (<>{getAdmAccess(page, formData, handleClose, fetchCustomers)}</>)
} }
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
@ -350,7 +350,6 @@ function getAdmAccess(page: string, data: any, handleClose: any, fetchCustomers:
} }
}); });
setGroups(getGroups.data.data.list); setGroups(getGroups.data.data.list);
setChangeGroup(data.group_id);
} catch (error: any) { } catch (error: any) {
console.error(error.message); console.error(error.message);
toast.error(error.message) toast.error(error.message)
@ -394,6 +393,7 @@ function getAdmAccess(page: string, data: any, handleClose: any, fetchCustomers:
customerid: data.id, customerid: data.id,
destination_group: changeGroup destination_group: changeGroup
} }
if (data.group_id === changeGroup) return toast.warning(`You update same group as the exist customer group`)
if (dataObj.customerid && dataObj.destination_group) { if (dataObj.customerid && dataObj.destination_group) {
await axios.post(`${BASE_URL_CUSTOMER}/customer/change-group`, dataObj) await axios.post(`${BASE_URL_CUSTOMER}/customer/change-group`, dataObj)
} }
@ -406,6 +406,11 @@ function getAdmAccess(page: string, data: any, handleClose: any, fetchCustomers:
} }
} }
function openChangeGroupDialog() {
setChangeGroup(data.group_id);
setChangeGroupD(true)
}
if (page !== "kyc") { if (page !== "kyc") {
return ( return (
<Box p={3} boxShadow={3} borderRadius={2} bgcolor="white"> <Box p={3} boxShadow={3} borderRadius={2} bgcolor="white">
@ -424,7 +429,7 @@ function getAdmAccess(page: string, data: any, handleClose: any, fetchCustomers:
<Grid item xs={6} container direction="column" spacing={2}> <Grid item xs={6} container direction="column" spacing={2}>
<Grid item> <Grid item>
<Typography variant="body2">Change Group</Typography> <Typography variant="body2">Change Group</Typography>
<Button onClick={() => setChangeGroupD(true)} variant="contained" color="primary">Change Group</Button> <Button onClick={() => openChangeGroupDialog()} variant="contained" color="primary">Change Group</Button>
</Grid> </Grid>
<Grid item> <Grid item>
<Typography variant="body2">Edit Member</Typography> <Typography variant="body2">Edit Member</Typography>
@ -435,9 +440,9 @@ function getAdmAccess(page: string, data: any, handleClose: any, fetchCustomers:
<Dialog open={changeGroupD} onClose={() => setChangeGroupD(false)} fullWidth> <Dialog open={changeGroupD} onClose={() => setChangeGroupD(false)} fullWidth>
<Grid container padding={3}> <Grid container padding={3}>
<Typography variant="h6" gutterBottom>Groups</Typography> <Typography variant="h6" gutterBottom color="orange">Are you sure to change customer Group?</Typography>
<FormControl fullWidth margin="dense"> <FormControl fullWidth margin="dense">
<InputLabel>Destination Group</InputLabel> <Typography gutterBottom>Destination Group</Typography>
<Select name="groups" value={changeGroup} onChange={(e: any) => setChangeGroup(e.target.value)}> <Select name="groups" value={changeGroup} onChange={(e: any) => setChangeGroup(e.target.value)}>
{ {
groups ? groups.map((el: any) => ( groups ? groups.map((el: any) => (
@ -499,3 +504,7 @@ function getPinStatus(status: string) {
res: null res: null
} }
} }
function showCustomerWallet() {
}