Update Member Import

This commit is contained in:
2022-07-24 14:30:19 +07:00
parent 0f4c84da6a
commit 42e4129a79
21 changed files with 1184 additions and 164 deletions

View File

@@ -1,5 +1,21 @@
// ----------------------------------------------------------------------
export type Member = {
id: string,
member_id: string,
record_type: string,
payor_id: string,
user_id: string,
name_prefix: string,
name: string,
name_suffix: string,
birth_date: string,
gender: string,
language: string,
race: string,
marital_status: string,
principal_id: string,
relation_with_principal: string,
bpjs_class: string,
active: string,
};

View File

@@ -151,15 +151,15 @@ export default function PlanCreate() {
},
{
name: 'Corporate Name',
href: '/corporates/'+id,
href: '/corporates/'+corporate_id,
},
{
name: 'Plans',
href: '/corporates/'+id+'/plans',
href: '/corporates/'+corporate_id+'/plans',
},
{
name: 'Create',
href: '/corporates/'+id+'/plans/create',
href: '/corporates/'+corporate_id+'/plans/create',
},
]}
/>

View File

@@ -34,20 +34,10 @@ export default function Divisions() {
]}
/>
<Grid container spacing={2}>
<Grid item xs={8}>
<Card>
<CorporateTabNavigations position={'members'} />
<DivisionsList />
</Card>
</Grid>
<Grid item xs={4}>
<Card sx={{ p: 2 }}>
Corporate Detail Goes Here
&nbsp;
</Card>
</Grid>
</Grid>
<Card>
<CorporateTabNavigations position={'members'} />
<DivisionsList />
</Card>
</Page>
);
}

View File

@@ -13,11 +13,13 @@ import { useParams, useSearchParams } from 'react-router-dom';
import axios from '../../../utils/axios';
import { Plan } from '../../../@types/corporates';
import { LaravelPaginatedData } from '../../../@types/paginated-data';
import { Member } from '../../../@types/member';
export default function CorporatePlanList() {
const { themeStretch } = useSettings();
const { corporate_id } = useParams();
const [searchParams, setSearchParams] = useSearchParams();
const [importResult, setImportResult] = useState(null)
function SearchInput(props: any) {
// SEARCH
@@ -90,13 +92,16 @@ export default function CorporatePlanList() {
formData.append("file", importPlan.current?.files[0])
axios.post(`corporates/${corporate_id}/members/import`, formData )
.then(response => {
setImportResult(response.data)
handleCancelImportButton();
loadDataTableData();
alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows');
})
.catch(response => {
alert('Looks like something went wrong. Please check your data and try again. ' + response.message)
})
.then(x => {
console.log('motherfucker', importResult)
})
} else {
alert('No File Selected')
}
@@ -150,6 +155,11 @@ export default function CorporatePlanList() {
</Button>
</Stack>
)}
{( importResult &&
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
<Box sx={{ color: "text.secondary" }}>Last Import Result : <Box sx={{ color: "success.main", display: "inline" }}>{ importResult.total_success_row ?? 0 }</Box> Row Processed, <Box sx={{ color: "error.main", display: "inline" }}>{ importResult.total_failed_row }</Box> Failed, Report : <a href={importResult.result_file?.url ?? "#"}>{importResult.result_file?.name ?? "-"}</a></Box>
</Stack>
)}
</div>
);
}
@@ -161,6 +171,20 @@ export default function CorporatePlanList() {
}
}
const [columns, setColumns] = React.useState([
{ id: 'member_id', label: 'MemberID', minWidth: 100, align: "left" },
{ id: 'principal_id', label: 'Mapping ID', minWidth: 100, align: "left" },
{ id: 'nik', label: 'NIK', minWidth: 100, align: "left" },
{ id: 'policy_number', label: 'Policy Number', minWidth: 100, align: "left" },
{ id: 'effective_date', label: 'Effective Date', minWidth: 100, align: "left" },
{ id: 'name', label: 'Name', minWidth: 100, align: "left" },
{ id: 'nric', label: 'NRIC', minWidth: 100, align: "left" },
{ id: 'email', label: 'E-mail', minWidth: 100, align: "left" },
{ id: 'plan_id', label: 'PlanID', minWidth: 100, align: "left" },
{ id: 'termination_date', label: 'Termination Date', minWidth: 100, align: 'right' },
{ id: 'activation_date', label: 'Activation Date', minWidth: 100, align: "right" },
]);
// Generate the every row of the table
function Row(props: { row: ReturnType<typeof createData> }) {
const { row } = props;
@@ -178,54 +202,9 @@ export default function CorporatePlanList() {
{open ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
</TableCell>
<TableCell align="left">{row.service_code}</TableCell>
<TableCell align="left">{row.corporate_plan?.code}</TableCell>
<TableCell align="left">{row.code}</TableCell>
<TableCell align="left">{row.type}</TableCell>
<TableCell align="left">{row.start}</TableCell>
<TableCell align="left">{row.end}</TableCell>
<TableCell align="left">{row.require_referral}</TableCell>
<TableCell align="left">{row.referral_source}</TableCell>
<TableCell align="left">{row.referral_duration}</TableCell>
<TableCell align="left">{row.family_plan}</TableCell>
<TableCell align="left">{row.family_plan_share_rules}</TableCell>
<TableCell align="left">{row.limit_rules}</TableCell>
<TableCell align="left">{row.layer}</TableCell>
<TableCell align="left">{row.layer_conditions}</TableCell>
<TableCell align="left">{row.budget_type}</TableCell>
<TableCell align="left">{row.budget_code}</TableCell>
<TableCell align="left">{row.budget_conditions}</TableCell>
<TableCell align="left">{row.surgery_limit}</TableCell>
<TableCell align="left">{row.non_surgery_limit}</TableCell>
<TableCell align="left">{row.max_claim_limit}</TableCell>
<TableCell align="left">{row.max_claim_count}</TableCell>
<TableCell align="left">{row.area_limit}</TableCell>
<TableCell align="left">{row.limit_shared_plans}</TableCell>
<TableCell align="left">{row.limit_shared_plan_type}</TableCell>
<TableCell align="left">{row.cashless_percentage}</TableCell>
<TableCell align="left">{row.reimbursement_percentage}</TableCell>
<TableCell align="left">{row.digital_percentage}</TableCell>
<TableCell align="left">{row.co_share_m_percentage}</TableCell>
<TableCell align="left">{row.co_share_s_percentage}</TableCell>
<TableCell align="left">{row.co_share_c_percentage}</TableCell>
<TableCell align="left">{row.cashless_deductible}</TableCell>
<TableCell align="left">{row.reimbursement_deductible}</TableCell>
<TableCell align="left">{row.digital_deductible}</TableCell>
<TableCell align="left">{row.co_share_m_deductible}</TableCell>
<TableCell align="left">{row.co_share_s_deductible}</TableCell>
<TableCell align="left">{row.co_share_c_deductible}</TableCell>
<TableCell align="left">{row.co_share_deductible_condition}</TableCell>
<TableCell align="left">{row.msc}</TableCell>
<TableCell align="left">{row.genders}</TableCell>
<TableCell align="left">{row.min_age}</TableCell>
<TableCell align="left">{row.max_age}</TableCell>
<TableCell align="left">{row.rule_of_excess}</TableCell>
<TableCell align="left">{row.max_excess_covered}</TableCell>
<TableCell align="left">{row.prorate_type}</TableCell>
<TableCell align="left">{row.prorate_lookup}</TableCell>
<TableCell align="left">{row.currency}</TableCell>
<TableCell align="left">{row.max_surgery_reinstatement_days}</TableCell>
<TableCell align="left">{row.max_surgery_periode_days}</TableCell>
{ columns.map((column, index) =>
<TableCell key={ index } align={ column.align } minwidth={ column.minWidth }>{ row[column.id] ?? '-' }</TableCell>
) }
<TableCell align="right"><Button variant="outlined" color="success" size="small">Active</Button></TableCell>
<TableCell align="right"><Button variant="outlined" color="success" size="small">Edit</Button></TableCell>
</TableRow>
@@ -238,37 +217,7 @@ export default function CorporatePlanList() {
No Extra Data
</Typography>
</Box>
{false && <Box sx={{ margin: 1 }}>
<Typography variant="h6" gutterBottom component="div">
Rules
</Typography>
<Table size="small" aria-label="purchases">
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Customer</TableCell>
<TableCell align="right">Amount</TableCell>
<TableCell align="right">Total price ($)</TableCell>
</TableRow>
</TableHead>
<TableBody>
{/* {row.history ? row.history.map((historyRow) => ( */}
<TableRow key={row.id}>
<TableCell component="th" scope="row">{row.start} - {row.end}</TableCell>
<TableCell>{row.start}</TableCell>
<TableCell align="right">{row.start}</TableCell>
<TableCell align="right">{row.start}</TableCell>
</TableRow>
{/* ))
: (
<TableRow>
<TableCell colSpan={8}>No Data</TableCell>
</TableRow>
)
} */}
</TableBody>
</Table>
</Box>}
{false && <Box sx={{ margin: 1 }} />}
</Collapse>
</TableCell>
</TableRow>
@@ -296,7 +245,7 @@ export default function CorporatePlanList() {
const loadDataTableData = async (appliedFilter = null) => {
setDataTableLoading(true);
const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]);
const response = await axios.get('/corporates/'+corporate_id+'/plans', { params: filter });
const response = await axios.get('/corporates/'+corporate_id+'/members', { params: filter });
// console.log(response.data);
setDataTableLoading(false);
@@ -327,54 +276,9 @@ export default function CorporatePlanList() {
<TableBody>
<TableRow>
<TableCell style={headStyle} align="left" />
<TableCell style={headStyle} align="left">Service</TableCell>
<TableCell style={headStyle} align="left">Plan</TableCell>
<TableCell style={headStyle} align="left">Code</TableCell>
<TableCell style={headStyle} align="left">Type</TableCell>
<TableCell style={headStyle} align="left">Start</TableCell>
<TableCell style={headStyle} align="left">End</TableCell>
<TableCell style={headStyle} align="left">Referral</TableCell>
<TableCell style={headStyle} align="left">Referral Source</TableCell>
<TableCell style={headStyle} align="left">Referral Duration</TableCell>
<TableCell style={headStyle} align="left">Family Plan</TableCell>
<TableCell style={headStyle} align="left">Family Sharing Overflow</TableCell>
<TableCell style={headStyle} align="left">Plan Limit</TableCell>
<TableCell style={headStyle} align="left">Layer ID</TableCell>
<TableCell style={headStyle} align="left">Layer Condition</TableCell>
<TableCell style={headStyle} align="left">Budget Type</TableCell>
<TableCell style={headStyle} align="left">Budget Code</TableCell>
<TableCell style={headStyle} align="left">Budget Condition</TableCell>
<TableCell style={headStyle} align="left">Surgery</TableCell>
<TableCell style={headStyle} align="left">Non Surgery</TableCell>
<TableCell style={headStyle} align="left">Max/Claim</TableCell>
<TableCell style={headStyle} align="left">Max Count of Claim</TableCell>
<TableCell style={headStyle} align="left">Area</TableCell>
<TableCell style={headStyle} align="left">Shared Plan</TableCell>
<TableCell style={headStyle} align="left">Limit Shared Type</TableCell>
<TableCell style={headStyle} align="left">Cashless(%)</TableCell>
<TableCell style={headStyle} align="left">Reimbursement(%)</TableCell>
<TableCell style={headStyle} align="left">Digital(%)</TableCell>
<TableCell style={headStyle} align="left">CoShare M(%)</TableCell>
<TableCell style={headStyle} align="left">CoShare S(%)</TableCell>
<TableCell style={headStyle} align="left">CoShare C(%)</TableCell>
<TableCell style={headStyle} align="left">Cashless Deductible</TableCell>
<TableCell style={headStyle} align="left">Reimbursement Deductible</TableCell>
<TableCell style={headStyle} align="left">Digital Deductible</TableCell>
<TableCell style={headStyle} align="left">DeductibleM</TableCell>
<TableCell style={headStyle} align="left">DeductibleS</TableCell>
<TableCell style={headStyle} align="left">DeductibleC</TableCell>
<TableCell style={headStyle} align="left">CoShare & Deductible Condition</TableCell>
<TableCell style={headStyle} align="left">MSC</TableCell>
<TableCell style={headStyle} align="left">Gender</TableCell>
<TableCell style={headStyle} align="left">Min Age</TableCell>
<TableCell style={headStyle} align="left">Max Age</TableCell>
<TableCell style={headStyle} align="left">Rule of Excess</TableCell>
<TableCell style={headStyle} align="left">Max Excess Covered</TableCell>
<TableCell style={headStyle} align="left">Prorate Type</TableCell>
<TableCell style={headStyle} align="left">Prorate Lookup</TableCell>
<TableCell style={headStyle} align="left">Currency</TableCell>
<TableCell style={headStyle} align="left">Reinstatement Surgery</TableCell>
<TableCell style={headStyle} align="left">Period of Surgery</TableCell>
{ columns.map((column, index) => (
<TableCell style={headStyle} key={index} align={column.align}>{column.label}</TableCell>
)) }
<TableCell style={headStyle} align="right">Status</TableCell>
<TableCell style={headStyle} align="right">Action</TableCell>
</TableRow>
@@ -396,8 +300,8 @@ export default function CorporatePlanList() {
</TableBody>
) : (
<TableBody>
{dataTableData.data.map(row => (
<Row key={row.code} row={row} />
{dataTableData.data.map((row, index) => (
<Row key={index} row={row} />
))}
</TableBody>
)