|
|
@@ -50,116 +50,112 @@ const ClientPanel = () => { |
|
|
|
|
|
|
|
//const [tagCombo, setTagCombo] = useState({}); |
|
|
|
|
|
|
|
function updateApplicationDetail(applicationData) { |
|
|
|
setApplicationDetail(applicationData); |
|
|
|
} |
|
|
|
// function updateApplicationDetail(applicationData) { |
|
|
|
// setApplicationDetail(applicationData); |
|
|
|
// } |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
getReminderInterval(); |
|
|
|
getReminderBefore(); |
|
|
|
getReminderLimit(); |
|
|
|
getReminderLimitMax(); |
|
|
|
// getReminderInterval(); |
|
|
|
// getReminderBefore(); |
|
|
|
// getReminderLimit(); |
|
|
|
// getReminderLimitMax(); |
|
|
|
if(refId !== null){ |
|
|
|
setIsNewRecord(true); |
|
|
|
setIsNewRecord(false); |
|
|
|
getClientDetail(refId); |
|
|
|
} |
|
|
|
else if(params.id<0){ |
|
|
|
setIsNewRecord(true); |
|
|
|
} |
|
|
|
else{ |
|
|
|
setIsNewRecord(false); |
|
|
|
getClientDetail(params.id); |
|
|
|
} |
|
|
|
getGroupList(); |
|
|
|
getApplicationList(); |
|
|
|
}, []); |
|
|
|
|
|
|
|
function getReminderBefore(){ |
|
|
|
axios.get(`${apiPath}${GET_REMINDER_BEFORE}`, |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setReminderBefore(response.data.data); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error); |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getReminderLimit(){ |
|
|
|
axios.get(`${apiPath}${GET_REMINDER_LIMIT}`, |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setReminderLimit(response.data.data); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error); |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getReminderLimitMax(){ |
|
|
|
axios.get(`${apiPath}${GET_REMINDER_LIMIT_MAX}`, |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setReminderLimitMax(response.data.data); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error); |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
// getGroupList(); |
|
|
|
// getApplicationList(); |
|
|
|
}, [refId, params.id]); |
|
|
|
|
|
|
|
// function getReminderBefore(){ |
|
|
|
// axios.get(`${apiPath}${GET_REMINDER_BEFORE}`, |
|
|
|
// ) |
|
|
|
// .then((response) => { |
|
|
|
// if (response.status === 200) { |
|
|
|
// setReminderBefore(response.data.data); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(error => { |
|
|
|
// console.log(error); |
|
|
|
// return false; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// function getReminderLimit(){ |
|
|
|
// axios.get(`${apiPath}${GET_REMINDER_LIMIT}`, |
|
|
|
// ) |
|
|
|
// .then((response) => { |
|
|
|
// if (response.status === 200) { |
|
|
|
// setReminderLimit(response.data.data); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(error => { |
|
|
|
// console.log(error); |
|
|
|
// return false; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// function getReminderLimitMax(){ |
|
|
|
// axios.get(`${apiPath}${GET_REMINDER_LIMIT_MAX}`, |
|
|
|
// ) |
|
|
|
// .then((response) => { |
|
|
|
// if (response.status === 200) { |
|
|
|
// setReminderLimitMax(response.data.data); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(error => { |
|
|
|
// console.log(error); |
|
|
|
// return false; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (!isObjEmpty(subDivisionCombo)) { |
|
|
|
setOnReady(true); |
|
|
|
} |
|
|
|
else if(isNewRecord && |
|
|
|
Object.keys(clientDetail).length > 0 |
|
|
|
){ |
|
|
|
if(isNewRecord || Object.keys(clientDetail).length > 0) { |
|
|
|
setOnReady(true); |
|
|
|
} |
|
|
|
}, [subDivisionCombo,clientDetail]); |
|
|
|
|
|
|
|
function getApplicationList(){ |
|
|
|
const byDivision = { |
|
|
|
clientId: params.id, |
|
|
|
userSubDivisionId: ability.can('VIEW', 'ALL_RECORD') ? null : localStorage.getItem('subDivisionId'), |
|
|
|
} |
|
|
|
axios.get(`${apiPath}${GET_EVENT_APPLICATION_PATH}`, |
|
|
|
{ |
|
|
|
params: byDivision, |
|
|
|
} |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setApplicationList(response.data.records); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error); |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getReminderInterval(){ |
|
|
|
axios.get(`${apiPath}${GET_REMINDER_INTERVAL}`, |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setReminderInterval(response.data.data); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error); |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, [isNewRecord, clientDetail]); |
|
|
|
|
|
|
|
// function getApplicationList(){ |
|
|
|
// const byDivision = { |
|
|
|
// clientId: params.id, |
|
|
|
// userSubDivisionId: ability.can('VIEW', 'ALL_RECORD') ? null : localStorage.getItem('subDivisionId'), |
|
|
|
// } |
|
|
|
// axios.get(`${apiPath}${GET_EVENT_APPLICATION_PATH}`, |
|
|
|
// { |
|
|
|
// params: byDivision, |
|
|
|
// } |
|
|
|
// ) |
|
|
|
// .then((response) => { |
|
|
|
// if (response.status === 200) { |
|
|
|
// setApplicationList(response.data.records); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(error => { |
|
|
|
// console.log(error); |
|
|
|
// return false; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// function getReminderInterval(){ |
|
|
|
// axios.get(`${apiPath}${GET_REMINDER_INTERVAL}`, |
|
|
|
// ) |
|
|
|
// .then((response) => { |
|
|
|
// if (response.status === 200) { |
|
|
|
// setReminderInterval(response.data.data); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(error => { |
|
|
|
// console.log(error); |
|
|
|
// return false; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
function getClientDetail(clientId) { |
|
|
|
axios.get(`${apiPath}${GET_CLIENT_PATH}/${clientId}`, |
|
|
@@ -167,7 +163,7 @@ const ClientPanel = () => { |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setClientDetail(response.data.data); |
|
|
|
setRefSubDivisionList(response.data.clientDivision); |
|
|
|
// setRefSubDivisionList(response.data.clientDivision); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
@@ -176,19 +172,19 @@ const ClientPanel = () => { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getGroupList() { |
|
|
|
axios.get(`${apiPath}${GET_SUB_DIVISION_COMBO_LIST}`, |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.status === 200) { |
|
|
|
setSubDivisionCombo(response.data.records); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.log(error); |
|
|
|
return false; |
|
|
|
}); |
|
|
|
} |
|
|
|
// function getGroupList() { |
|
|
|
// axios.get(`${apiPath}${GET_SUB_DIVISION_COMBO_LIST}`, |
|
|
|
// ) |
|
|
|
// .then((response) => { |
|
|
|
// if (response.status === 200) { |
|
|
|
// setSubDivisionCombo(response.data.records); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// .catch(error => { |
|
|
|
// console.log(error); |
|
|
|
// return false; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
return ( |
|
|
|
!onReady ? |
|
|
@@ -209,35 +205,11 @@ const ClientPanel = () => { |
|
|
|
{/*row 1*/} |
|
|
|
<Grid item xs={12} md={12} lg={12} > |
|
|
|
<ClientForm |
|
|
|
refReminderInterval={reminderInterval} |
|
|
|
refReminderBefore={reminderBefore} |
|
|
|
refReminderLimit={reminderLimit} |
|
|
|
refReminderLimitMax={reminderLimitMax} |
|
|
|
applicationList={applicationList} |
|
|
|
getClientDetail={getClientDetail} |
|
|
|
refClientDetail={clientDetail} |
|
|
|
applicationDetail={applicationDetail} |
|
|
|
updateApplicationDetail={updateApplicationDetail} |
|
|
|
isNewRecord={isNewRecord} |
|
|
|
refSubDivisionList={refSubDivisionList} |
|
|
|
/> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
{/*row 2*/} |
|
|
|
{ |
|
|
|
params.id > 0 ? |
|
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
|
<MainCard |
|
|
|
sx={{width:CARD_MAX_WIDTH}} |
|
|
|
> |
|
|
|
<ThemeProvider theme={LIONER_FORM_THEME}> |
|
|
|
<ApplicationTable recordList={applicationList}/> |
|
|
|
</ThemeProvider> |
|
|
|
</MainCard> |
|
|
|
</Grid> |
|
|
|
: |
|
|
|
undefined |
|
|
|
} |
|
|
|
</ThemeProvider> |
|
|
|
</Grid> |
|
|
|
|
|
|
|