update fitur delete all import
This commit is contained in:
@@ -38,9 +38,12 @@ import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import HistoryIcon from '@mui/icons-material/History';
|
||||
import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
||||
import FindInPageOutlinedIcon from '@mui/icons-material/FindInPageOutlined';
|
||||
import { DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
||||
|
||||
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
|
||||
// hooks
|
||||
import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react';
|
||||
@@ -77,6 +80,7 @@ import { fData, fNumber } from '@/utils/formatNumber';
|
||||
import DialogUpdateStatus from '@/components/DialogUpdateStatus';
|
||||
|
||||
import { ro } from 'date-fns/locale';
|
||||
import { Dialog } from '@mui/material';
|
||||
|
||||
export default function PlanList() {
|
||||
const { themeStretch } = useSettings();
|
||||
@@ -264,6 +268,7 @@ export default function PlanList() {
|
||||
<MenuItem onClick={handleImportButton}>Import</MenuItem>
|
||||
<MenuItem onClick={() => {handleGetTemplate('plan-benefit')}}>Download Template</MenuItem>
|
||||
<MenuItem onClick={() => {handleGetData('data-plan-benefit')}}>Download Data Plan & Benefit</MenuItem>
|
||||
<MenuItem onClick={() => {setDialogDeleteOpen(true)}}>Delete All Import</MenuItem>
|
||||
</Menu>
|
||||
</Stack>
|
||||
)}
|
||||
@@ -954,7 +959,6 @@ export default function PlanList() {
|
||||
} = methods;
|
||||
|
||||
const handleUpdate = (active: number, id: number, reason:string) => {
|
||||
console.log(active)
|
||||
axios
|
||||
.put(`/benefits/${id}/activation`, {
|
||||
active: active,
|
||||
@@ -966,6 +970,19 @@ export default function PlanList() {
|
||||
}
|
||||
|
||||
|
||||
const handleDeleteAllImport = () => {
|
||||
axios
|
||||
.post(`/corporates/${corporate_id}/delete-import-plan-benefit`)
|
||||
.then((res) => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
const [isOpenDialogDelete, setDialogDeleteOpen] = useState(false);
|
||||
const handleCloseDialogDelete = () => {
|
||||
setDialogDeleteOpen(false);
|
||||
};
|
||||
|
||||
|
||||
const getContent = () => (
|
||||
<>
|
||||
<Stack paddingX={2} paddingY={2}>
|
||||
@@ -1153,6 +1170,27 @@ export default function PlanList() {
|
||||
content={getContent()}
|
||||
// maxWidth='50px'
|
||||
/>
|
||||
<Dialog open={isOpenDialogDelete} onClose={handleCloseDialogDelete} fullWidth={true} >
|
||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||
<Stack direction="row" alignItems='center' spacing={1}>
|
||||
<Typography variant="h6">Delete Import Benefit</Typography>
|
||||
</Stack>
|
||||
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogDelete}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<Stack spacing={2} sx={{marginTop: 2, padding: 2}}>
|
||||
<Typography variant='subtitle1'>Are you sure delete all data benefit and plan?</Typography>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialogDelete}>Cancel</Button>
|
||||
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" onClick={() => handleDeleteAllImport()}>Delete</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ import { Download, Edit } from '@mui/icons-material';
|
||||
import TableMoreMenu from '@/components/table/TableMoreMenu';
|
||||
import Label from '@/components/Label';
|
||||
import DialogUpdateStatus from '@/components/DialogUpdateStatus';
|
||||
import {Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
|
||||
|
||||
export default function CorporatePlanList() {
|
||||
const { themeStretch } = useSettings();
|
||||
@@ -327,6 +330,8 @@ export default function CorporatePlanList() {
|
||||
<MenuItem onClick={handleImportButton}>Import</MenuItem>
|
||||
<MenuItem onClick={() => {handleGetTemplate('plan-benefit')}}>Download Template</MenuItem>
|
||||
<MenuItem onClick={() => {handleGetData('data-plan-benefit')}}>Download Plans & Benefit</MenuItem>
|
||||
<MenuItem onClick={() => {setDialogDeleteOpen(true)}}>Delete All Import</MenuItem>
|
||||
|
||||
</Menu>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@@ -891,6 +896,18 @@ export default function CorporatePlanList() {
|
||||
});
|
||||
}
|
||||
|
||||
const handleDeleteAllImport = () => {
|
||||
axios
|
||||
.post(`/corporates/${corporate_id}/delete-import-plan-benefit`)
|
||||
.then((res) => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
const [isOpenDialogDelete, setDialogDeleteOpen] = useState(false);
|
||||
const handleCloseDialogDelete = () => {
|
||||
setDialogDeleteOpen(false);
|
||||
};
|
||||
|
||||
const getContent = () => (
|
||||
<>
|
||||
<Stack paddingX={2} paddingY={2}>
|
||||
@@ -1062,6 +1079,28 @@ export default function CorporatePlanList() {
|
||||
content={getContent()}
|
||||
// maxWidth='50px'
|
||||
/>
|
||||
|
||||
<Dialog open={isOpenDialogDelete} onClose={handleCloseDialogDelete} fullWidth={true} >
|
||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||
<Stack direction="row" alignItems='center' spacing={1}>
|
||||
<Typography variant="h6">Delete Import Benefit</Typography>
|
||||
</Stack>
|
||||
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogDelete}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<Stack spacing={2} sx={{marginTop: 2, padding: 2}}>
|
||||
<Typography variant='subtitle1'>Are you sure delete all data benefit and plan?</Typography>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialogDelete}>Cancel</Button>
|
||||
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" onClick={() => handleDeleteAllImport()}>Delete</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ export default function Divisions() {
|
||||
<Card sx={{'marginTop': 5}}>
|
||||
<Grid container padding={2}>
|
||||
<Grid item xs={12} paddingY={2}>
|
||||
<Typography color={'#19BBBB'} variant='subtitle1'>Free Admin Fee*</Typography>
|
||||
<Typography color={'#19BBBB'} variant='subtitle1'>Admin Fee*</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12} paddingX={2} paddingY={2}>
|
||||
<FormControlLabel
|
||||
|
||||
@@ -496,7 +496,7 @@ export default function List() {
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell colSpan={4} sx={{ py: 1 }}>
|
||||
Free Admin Fee
|
||||
Admin Fee
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
|
||||
Reference in New Issue
Block a user