Final changes for RO closer.

This commit is contained in:
Patrick Fic
2024-04-03 14:18:45 -07:00
parent 815ada0516
commit 5e63ce7271
18 changed files with 1266 additions and 494 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import React, { useEffect } from 'react';
import { Card, Table } from 'antd';
import { Alert, Card, Table } from 'antd';
import { t } from 'i18next';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
@@ -18,11 +18,17 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardPpd);
export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form }) {
const subletsNotDone = job?.joblines.filter(
export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form, warningCallback }) {
const linesWithPPD = job?.joblines.filter(
(j) => j.act_price_before_ppc !== 0 && j.act_price_before_ppc !== null
);
useEffect(() => {
if (linesWithPPD.length > 0) {
warningCallback({ key: 'ppd', warning: t('jobs.labels.outstanding_sublets') });
}
}, [linesWithPPD.length, warningCallback]);
const columns = [
{
title: t('joblines.fields.line_desc'),
@@ -71,15 +77,22 @@ export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form }) {
];
return (
<Card title={t('jobs.labels.subletsnotcompleted')}>
<Card title={t('jobs.labels.ppdnotexported')}>
<Table
dataSource={subletsNotDone}
dataSource={linesWithPPD}
columns={columns}
pagination={false}
rowKey="id"
bordered
size="small"
/>
{linesWithPPD.length > 0 && (
<Alert
style={{ margin: '8px 0px' }}
type="warning"
message={t('jobs.labels.outstanding_ppd')}
/>
)}
</Card>
);
}