WIP RO Closer.
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
import {Card, Col, Row, Space, Statistic, Tooltip, Typography} from "antd";
|
||||
import { Alert, Card, Col, Row, Space, Statistic, Tooltip, Typography } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import "./job-bills-total.styles.scss";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
export default function JobBillsTotalComponent({
|
||||
loading,
|
||||
bills,
|
||||
partsOrders,
|
||||
jobTotals,
|
||||
showWarning,
|
||||
warningCallback
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
|
||||
if (loading) return <LoadingSkeleton/>;
|
||||
if (!!!jobTotals)
|
||||
return (
|
||||
<AlertComponent type="error" message={t("jobs.errors.nofinancial")}/>
|
||||
);
|
||||
if (!!!jobTotals){
|
||||
|
||||
if(showWarning && warningCallback && typeof warningCallback === 'function'){
|
||||
warningCallback(t("jobs.errors.nofinancial"))
|
||||
}
|
||||
return (
|
||||
<AlertComponent type="error" message={t("jobs.errors.nofinancial")}/>
|
||||
);
|
||||
}
|
||||
|
||||
const totals = jobTotals;
|
||||
|
||||
@@ -99,9 +106,24 @@ export default function JobBillsTotalComponent({
|
||||
const discrepWithCms = discrepWithLbrAdj.add(totalReturns);
|
||||
const calculatedCreditsNotReceived = totalReturns.subtract(billCms); //billCms is tracked as a negative number.
|
||||
|
||||
|
||||
if (showWarning && warningCallback && typeof warningCallback === 'function') {
|
||||
if (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) {
|
||||
warningCallback(t('jobs.labels.outstanding_reconciliation_discrep'));
|
||||
}
|
||||
if (calculatedCreditsNotReceived.getAmount() > 0) {
|
||||
warningCallback(t('jobs.labels.outstanding_credit_memos'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Row gutter={16}>
|
||||
<Col span={18}>
|
||||
<Row gutter={[16,16]}>
|
||||
<Col md={24} lg={18}>
|
||||
<Card title={t("jobs.labels.jobtotals")} style={{height: "100%"}}>
|
||||
<Space wrap size="large">
|
||||
<Tooltip
|
||||
@@ -218,9 +240,15 @@ export default function JobBillsTotalComponent({
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
|
||||
{showWarning && (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) && <Alert style={{margin: "8px 0px"}} type="warning" message={t("jobs.labels.outstanding_reconciliation_discrep")}/>}
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Col md={24} lg={6} >
|
||||
<Card title={t("jobs.labels.returntotals")} style={{height: "100%"}}>
|
||||
<Space wrap>
|
||||
<Tooltip
|
||||
@@ -288,6 +316,9 @@ export default function JobBillsTotalComponent({
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{showWarning && (
|
||||
calculatedCreditsNotReceived.getAmount() > 0
|
||||
) && <Alert style={{margin: "8px 0px"}} type="warning" message={t("jobs.labels.outstanding_credit_memos")}/>}
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user