feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration / RRScratch2 / Polish
This commit is contained in:
@@ -24,10 +24,11 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsAllocationsSummar
|
|||||||
* @param bodyshop
|
* @param bodyshop
|
||||||
* @param jobId
|
* @param jobId
|
||||||
* @param title
|
* @param title
|
||||||
|
* @param minHeight
|
||||||
* @returns {JSX.Element}
|
* @returns {JSX.Element}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export function DmsAllocationsSummary({ mode, socket, bodyshop, jobId, title }) {
|
export function DmsAllocationsSummary({ mode, socket, bodyshop, jobId, title, minHeight }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
||||||
|
|
||||||
@@ -97,6 +98,8 @@ export function DmsAllocationsSummary({ mode, socket, bodyshop, jobId, title })
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
style={minHeight ? { minHeight } : undefined}
|
||||||
|
className="dms-summary-card"
|
||||||
title={title}
|
title={title}
|
||||||
extra={
|
extra={
|
||||||
<Button onClick={fetchAllocations} aria-label={t("general.actions.refresh")}>
|
<Button onClick={fetchAllocations} aria-label={t("general.actions.refresh")}>
|
||||||
@@ -124,12 +127,14 @@ export function DmsAllocationsSummary({ mode, socket, bodyshop, jobId, title })
|
|||||||
{ totalSale: Dinero(), totalCost: Dinero() }
|
{ totalSale: Dinero(), totalCost: Dinero() }
|
||||||
) || { totalSale: Dinero(), totalCost: Dinero() };
|
) || { totalSale: Dinero(), totalCost: Dinero() };
|
||||||
|
|
||||||
|
const hasNonZeroSaleTotal = totals.totalSale.getAmount() !== 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table.Summary.Row>
|
<Table.Summary.Row>
|
||||||
<Table.Summary.Cell>
|
<Table.Summary.Cell>
|
||||||
<Typography.Title level={4}>{t("general.labels.totals")}</Typography.Title>
|
<Typography.Title level={4}>{t("general.labels.totals")}</Typography.Title>
|
||||||
</Table.Summary.Cell>
|
</Table.Summary.Cell>
|
||||||
<Table.Summary.Cell>{totals.totalSale.toFormat()}</Table.Summary.Cell>
|
<Table.Summary.Cell>{hasNonZeroSaleTotal ? totals.totalSale.toFormat() : null}</Table.Summary.Cell>
|
||||||
<Table.Summary.Cell />
|
<Table.Summary.Cell />
|
||||||
<Table.Summary.Cell />
|
<Table.Summary.Cell />
|
||||||
<Table.Summary.Cell />
|
<Table.Summary.Cell />
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function normalizeJobAllocations(ack) {
|
|||||||
* is now done on the backend via buildRogogFromAllocations/buildRolaborFromRogog.
|
* is now done on the backend via buildRogogFromAllocations/buildRolaborFromRogog.
|
||||||
* This component just renders the preview from `ack.rogg` / `ack.rolabor`.
|
* This component just renders the preview from `ack.rogg` / `ack.rolabor`.
|
||||||
*/
|
*/
|
||||||
export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
export function RrAllocationsSummary({ socket, bodyshop, jobId, title, minHeight }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [roggPreview, setRoggPreview] = useState(null);
|
const [roggPreview, setRoggPreview] = useState(null);
|
||||||
const [rolaborPreview, setRolaborPreview] = useState(null);
|
const [rolaborPreview, setRolaborPreview] = useState(null);
|
||||||
@@ -234,21 +234,26 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}}
|
}}
|
||||||
summary={() => (
|
summary={() => {
|
||||||
<Table.Summary.Row>
|
const hasCustTotal = Number(roggTotals.totalCustPrice) !== 0;
|
||||||
<Table.Summary.Cell index={0}>
|
const hasCostTotal = Number(roggTotals.totalDlrCost) !== 0;
|
||||||
<Typography.Title level={5}>{t("general.labels.totals")}</Typography.Title>
|
|
||||||
</Table.Summary.Cell>
|
return (
|
||||||
<Table.Summary.Cell index={1} />
|
<Table.Summary.Row>
|
||||||
<Table.Summary.Cell index={2} />
|
<Table.Summary.Cell index={0}>
|
||||||
<Table.Summary.Cell index={3} />
|
<Typography.Title level={5}>{t("general.labels.totals")}</Typography.Title>
|
||||||
<Table.Summary.Cell index={4} />
|
</Table.Summary.Cell>
|
||||||
<Table.Summary.Cell index={5} />
|
<Table.Summary.Cell index={1} />
|
||||||
<Table.Summary.Cell index={6} />
|
<Table.Summary.Cell index={2} />
|
||||||
<Table.Summary.Cell index={7}>{roggTotals.totalCustPrice}</Table.Summary.Cell>
|
<Table.Summary.Cell index={3} />
|
||||||
<Table.Summary.Cell index={8}>{roggTotals.totalDlrCost}</Table.Summary.Cell>
|
<Table.Summary.Cell index={4} />
|
||||||
</Table.Summary.Row>
|
<Table.Summary.Cell index={5} />
|
||||||
)}
|
<Table.Summary.Cell index={6} />
|
||||||
|
<Table.Summary.Cell index={7}>{hasCustTotal ? roggTotals.totalCustPrice : null}</Table.Summary.Cell>
|
||||||
|
<Table.Summary.Cell index={8}>{hasCostTotal ? roggTotals.totalDlrCost : null}</Table.Summary.Cell>
|
||||||
|
</Table.Summary.Row>
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
@@ -276,6 +281,8 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
style={minHeight ? { minHeight } : undefined}
|
||||||
|
className="dms-summary-card"
|
||||||
title={title}
|
title={title}
|
||||||
extra={
|
extra={
|
||||||
<Button onClick={fetchAllocations} aria-label={t("general.actions.refresh")}>
|
<Button onClick={fetchAllocations} aria-label={t("general.actions.refresh")}>
|
||||||
|
|||||||
@@ -38,10 +38,11 @@ import { DMS_MAP } from "../../utils/dmsUtils";
|
|||||||
* @param job
|
* @param job
|
||||||
* @param logsRef
|
* @param logsRef
|
||||||
* @param mode
|
* @param mode
|
||||||
|
* @param minHeight
|
||||||
* @returns {JSX.Element}
|
* @returns {JSX.Element}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode }) {
|
export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode, minHeight }) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [, /*unused*/ setTick] = useState(0); // handy if you need a forceUpdate later
|
const [, /*unused*/ setTick] = useState(0); // handy if you need a forceUpdate later
|
||||||
@@ -122,7 +123,11 @@ export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode }
|
|||||||
: { totalSale: Dinero(), totalCost: Dinero() };
|
: { totalSale: Dinero(), totalCost: Dinero() };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card title={t("jobs.labels.dms.postingform")}>
|
<Card
|
||||||
|
className="dms-summary-card"
|
||||||
|
style={minHeight ? { minHeight } : undefined}
|
||||||
|
title={t("jobs.labels.dms.postingform")}
|
||||||
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ import dayjs from "../../utils/day";
|
|||||||
* @param socket
|
* @param socket
|
||||||
* @param job
|
* @param job
|
||||||
* @param logsRef
|
* @param logsRef
|
||||||
|
* @param minHeight
|
||||||
* @returns {JSX.Element}
|
* @returns {JSX.Element}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function RRPostForm({ bodyshop, socket, job, logsRef }) {
|
export default function RRPostForm({ bodyshop, socket, job, logsRef, minHeight }) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -125,7 +126,11 @@ export default function RRPostForm({ bodyshop, socket, job, logsRef }) {
|
|||||||
: { totalSale: Dinero(), totalCost: Dinero() };
|
: { totalSale: Dinero(), totalCost: Dinero() };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card title={t("jobs.labels.dms.postingform")}>
|
<Card
|
||||||
|
style={minHeight ? { minHeight } : undefined}
|
||||||
|
className="dms-summary-card"
|
||||||
|
title={t("jobs.labels.dms.postingform")}
|
||||||
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type }))
|
insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type }))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const SUMMARY_MIN_HEIGHT = 545;
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer);
|
export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer);
|
||||||
|
|
||||||
const DMS_SOCKET_EVENTS = {
|
const DMS_SOCKET_EVENTS = {
|
||||||
@@ -390,6 +392,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
|||||||
<Col md={24} lg={10}>
|
<Col md={24} lg={10}>
|
||||||
{!isRrMode ? (
|
{!isRrMode ? (
|
||||||
<DmsAllocationsSummary
|
<DmsAllocationsSummary
|
||||||
|
minHeight={SUMMARY_MIN_HEIGHT}
|
||||||
key={resetKey}
|
key={resetKey}
|
||||||
title={
|
title={
|
||||||
<span>
|
<span>
|
||||||
@@ -407,6 +410,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<RrAllocationsSummary
|
<RrAllocationsSummary
|
||||||
|
minHeight={SUMMARY_MIN_HEIGHT}
|
||||||
key={resetKey}
|
key={resetKey}
|
||||||
title={
|
title={
|
||||||
<span>
|
<span>
|
||||||
@@ -425,7 +429,14 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
|||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col md={24} lg={14}>
|
<Col md={24} lg={14}>
|
||||||
<DmsPostForm key={resetKey} socket={activeSocket} job={data?.jobs_by_pk} logsRef={logsRef} mode={mode} />
|
<DmsPostForm
|
||||||
|
minHeight={SUMMARY_MIN_HEIGHT}
|
||||||
|
key={resetKey}
|
||||||
|
socket={activeSocket}
|
||||||
|
job={data?.jobs_by_pk}
|
||||||
|
logsRef={logsRef}
|
||||||
|
mode={mode}
|
||||||
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<DmsCustomerSelector
|
<DmsCustomerSelector
|
||||||
|
|||||||
Reference in New Issue
Block a user