approval member
This commit is contained in:
1
.env
1
.env
@ -3,4 +3,5 @@ VITE_APP_VERSION=1=9.1.1
|
||||
GENERATE_SOURCEMAP=false
|
||||
|
||||
VITE_APP_API_URL=https://tpay.shiblysolution.id/api
|
||||
# VITE_APP_API_URL=http://0.0.0.0:4001/api
|
||||
VITE_ENV=default
|
||||
@ -6,6 +6,7 @@ import { ManageKycContextProvider } from './hooks';
|
||||
import { columns, initialMember } from '../manage-members/Columns';
|
||||
import { useAuthContext } from '@/auth';
|
||||
import { apiConfig } from '@/config/api.config';
|
||||
import ConfirmDialog from '@/components/confirm';
|
||||
import axios from 'axios';
|
||||
const BASE_URL = apiConfig.service_customer;
|
||||
import CustomerDialog from '../manage-members/CustomerDetailModal';
|
||||
@ -52,7 +53,7 @@ const Kyc = () => {
|
||||
with_deleted: false,
|
||||
order_field: 'fullname',
|
||||
order_direction: 'ASC',
|
||||
// type: "Reguler"
|
||||
type: "kyc"
|
||||
}
|
||||
});
|
||||
let temp = 1
|
||||
@ -105,6 +106,7 @@ const Kyc = () => {
|
||||
delete updateData.group_deleted_at;
|
||||
try {
|
||||
await axios.put(`${BASE_URL}/customer/update/${customerId}`, updateData)
|
||||
if (updateData.isneedapproval == 1) await axios.post(`${BASE_URL}/customer/approve`, {customerid: customerId})
|
||||
await fetchGroups();
|
||||
setIsDialogOpen(false)
|
||||
} catch (error: any) {
|
||||
@ -116,6 +118,14 @@ const Kyc = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="container mx-auto py-5">
|
||||
<ConfirmDialog
|
||||
open={dialogOpen}
|
||||
onClose={() => setDialogOpen(false)}
|
||||
title="Confirm Action"
|
||||
content={`Are you sure you want to `+( dialogType === 'create' ? "create?" : ( dialogType === 'update' ? "update?" : "delete?"))}
|
||||
onYes={handleYes}
|
||||
onNo={() => setDialogOpen(false)}
|
||||
/>
|
||||
<CustomerDialog open={isDialogOpen} handleClose={closeDialog} handleSubmit={handleSubmit} initialData={member} viewStats={true}/>
|
||||
<h1 className="text-xl font-medium leading-none text-gray-900 mb-7">Manage Member KYC</h1>
|
||||
<DataTable data={members} columns={columns} onUpdate={handleUpdate} onDelete={null}/>
|
||||
|
||||
@ -12,6 +12,7 @@ import {
|
||||
FormControl,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import axios from 'axios';
|
||||
import Divider from '@mui/material/Divider';
|
||||
import { initialMember } from "./Columns";
|
||||
|
||||
@ -45,10 +46,18 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
|
||||
<Dialog open={open} onClose={handleClose} fullWidth maxWidth="sm">
|
||||
<DialogTitle>Customer Form ({viewStats ? 'View' : 'Edit'})</DialogTitle>
|
||||
<DialogContent>
|
||||
<div className="flex justify-between">
|
||||
<div className="flex justify-between pb-5">
|
||||
<Typography sx={{color:'grey'}}>Customer Data</Typography>
|
||||
<Typography sx={{color:'grey'}} display="flex" justifyContent="flex-end">Created: {generateDate(formData.created_at, 'datetime')}</Typography>
|
||||
</div>
|
||||
{
|
||||
formData.isneedapproval == 1 ? (
|
||||
<div className="flex justify-between pb-5">
|
||||
<Typography sx={{color:'orange'}}>User Request for approval </Typography>
|
||||
</div>
|
||||
) : ('')
|
||||
}
|
||||
|
||||
<TextField disabled={viewOnly} fullWidth margin="dense" label="Full Name" name="fullname" value={formData.fullname} onChange={handleChange} />
|
||||
<TextField disabled={viewOnly} fullWidth margin="dense" label="Email" name="email" value={formData.email} onChange={handleChange} />
|
||||
<TextField disabled fullWidth margin="dense" label="Group" name="group" value={formData.group_name} onChange={handleChange} />
|
||||
@ -65,7 +74,14 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
|
||||
<MenuItem value="F">Female</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
<TextField disabled={viewOnly} fullWidth margin="dense" label="Identity Type" name="identity_type" value={formData.identity_type} onChange={handleChange} />
|
||||
<FormControl fullWidth margin="dense">
|
||||
<InputLabel>Identity Type</InputLabel>
|
||||
<Select disabled={viewOnly} name="identity_type" value={formData.identity_type} onChange={handleChange}>
|
||||
<MenuItem value="eleitoral_id">Eleitoral ID</MenuItem>
|
||||
<MenuItem value="bihete_de_identidade">Bihete de Identidade</MenuItem>
|
||||
<MenuItem value="passport">Passport</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
<TextField disabled={viewOnly} fullWidth margin="dense" label="Identity Number" name="identity_number" value={formData.identity_number} onChange={handleChange} />
|
||||
<TextField disabled={viewOnly} type="number" fullWidth margin="dense" label="License Number" name="license_number" value={formData.license_number} onChange={handleChange} />
|
||||
<TextField disabled={viewOnly} fullWidth margin="dense" label="Profession" name="profession" value={formData.profession} onChange={handleChange} />
|
||||
@ -118,8 +134,16 @@ const CustomerDialog = ({ open, handleClose, handleSubmit, initialData, viewStat
|
||||
<TextField disabled={viewOnly} fullWidth margin="dense" label="iBank Number" name="ibank_number" value={formData.ibank_number} onChange={handleChange} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => viewOnly ? setViewOnly(false) : setViewOnly(true)} color="secondary">{ viewOnly ? (`Open Edit`) : (`Close Edit`) }</Button>
|
||||
<Button onClick={handleClose} color="secondary">Cancel</Button>
|
||||
<Button onClick={onSubmit} color="primary" variant="contained">Submit</Button>
|
||||
{
|
||||
formData.isneedapproval == 1 ? (
|
||||
<Button onClick={onSubmit} color="warning" variant="contained">Reject</Button>
|
||||
) : ('')
|
||||
}
|
||||
<Button onClick={onSubmit} color="primary" variant="contained">
|
||||
{ formData.isneedapproval == 1 ? (`Edit & Approve`) : (`Edit`) }
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@ -30,7 +30,6 @@ const ManageMembers = () => {
|
||||
with_deleted: false,
|
||||
order_field: 'fullname',
|
||||
order_direction: 'ASC',
|
||||
type: "Reguler"
|
||||
}
|
||||
});
|
||||
let temp = 1
|
||||
|
||||
Reference in New Issue
Block a user