|
@@ -53,27 +53,29 @@ const GenerateProjectPandLReport: React.FC<Props> & SubComponents = ({ projects |
|
|
criteria={searchCriteria} |
|
|
criteria={searchCriteria} |
|
|
onSearch={async (query) => { |
|
|
onSearch={async (query) => { |
|
|
setLoading(true); |
|
|
setLoading(true); |
|
|
if (Boolean(query.project) && query.project !== "All") { |
|
|
|
|
|
if(query.project != null && query.startMonth != "" && query.startMonthTo != undefined){ |
|
|
|
|
|
const response = await fetchProjectPandLReport({ projectId: parseFloat(query.project), startMonth: query.startMonth, endMonth: query.startMonthTo }) |
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
|
if (query.project && query.project !== "All") { |
|
|
|
|
|
if (query.project && query.startMonth && query.startMonthTo) { |
|
|
|
|
|
try { |
|
|
|
|
|
const response = await fetchProjectPandLReport({ |
|
|
|
|
|
projectId: parseFloat(query.project), |
|
|
|
|
|
startMonth: query.startMonth, |
|
|
|
|
|
endMonth: query.startMonthTo |
|
|
|
|
|
}); |
|
|
if (response) { |
|
|
if (response) { |
|
|
downloadFile(new Uint8Array(response.blobValue), response.filename!!) |
|
|
|
|
|
|
|
|
downloadFile(new Uint8Array(response.blobValue), response.filename); |
|
|
} |
|
|
} |
|
|
}catch(error){ |
|
|
|
|
|
errorDialogWithContent(t("Download Fail"), |
|
|
|
|
|
t(`Please try it later`), t) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
window.location.reload() |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
errorDialogWithContent(t("Download Fail"), t("Please try it later"), t) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
window.location.reload(); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
}else{ |
|
|
|
|
|
errorDialogWithContent(t("Download Fail"), |
|
|
|
|
|
t(`Please check the required field`), t) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
window.location.reload() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
errorDialogWithContent(t("Download Fail"), t("Please check the required field"), t) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
window.location.reload(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
setLoading(false); |
|
|
setLoading(false); |
|
|
}} |
|
|
}} |
|
|