Bug fixes and formatting for RO guard.

This commit is contained in:
Patrick Fic
2024-04-11 09:49:00 -07:00
parent e5599ff4c4
commit 453236cf3a
11 changed files with 146 additions and 130 deletions

View File

@@ -1,19 +1,19 @@
import React, { useEffect } from 'react';
import React, { useEffect } from "react";
import { Alert, Card } from 'antd';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { selectJobReadOnly } from '../../redux/application/application.selectors';
import { selectBodyshop } from '../../redux/user/user.selectors';
import { useMemo } from 'react';
import Dinero from 'dinero.js';
import DataLabel from '../data-label/data-label.component';
import { Alert, Card } from "antd";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectJobReadOnly } from "../../redux/application/application.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { useMemo } from "react";
import Dinero from "dinero.js";
import DataLabel from "../data-label/data-label.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
jobRO: selectJobReadOnly,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -41,25 +41,21 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallb
useEffect(() => {
if (balance.getAmount() !== 0) {
warningCallback({ key: 'ar', warning: t('jobs.labels.outstanding_ar') });
warningCallback({ key: "ar", warning: t("jobs.labels.outstanding_ar") });
}
}, [balance, t, warningCallback]);
return (
<Card title={t('jobs.labels.accountsreceivable')} style={{ height: '100%' }}>
<DataLabel label={t('payments.labels.totalpayments')}>{total.toFormat()}</DataLabel>
<Card title={t("jobs.labels.accountsreceivable")} style={{ height: "100%" }}>
<DataLabel label={t("payments.labels.totalpayments")}>{total.toFormat()}</DataLabel>
<DataLabel
valueStyle={{ color: balance.getAmount() !== 0 ? 'red' : 'green' }}
label={t('payments.labels.balance')}
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
label={t("payments.labels.balance")}
>
{balance.toFormat()}
</DataLabel>
{balance.getAmount() !== 0 && (
<Alert
style={{ margin: '8px 0px' }}
type="warning"
message={t('jobs.labels.outstanding_ar')}
/>
<Alert style={{ margin: "8px 0px" }} type="warning" message={t("jobs.labels.outstanding_ar")} />
)}
</Card>
);