From 5540872f62ccf115fa5f8de8149386e7e8df01b8 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 17 Nov 2021 20:18:21 -0800 Subject: [PATCH 1/3] IO-1531 CC Contract add to production. --- .../contract-form/contract-form.component.jsx | 3 +- .../contract-create.page.component.jsx | 30 +++++++++++++------ .../contract-create.page.container.jsx | 27 ++++++++++++++++- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/client/src/components/contract-form/contract-form.component.jsx b/client/src/components/contract-form/contract-form.component.jsx index acf1b53fd..803fd59d0 100644 --- a/client/src/components/contract-form/contract-form.component.jsx +++ b/client/src/components/contract-form/contract-form.component.jsx @@ -1,5 +1,5 @@ import { WarningFilled } from "@ant-design/icons"; -import { Form, Input, InputNumber, Space } from "antd"; +import { Form, Input, InputNumber, Space, Switch } from "antd"; import moment from "moment"; import React from "react"; import { useTranslation } from "react-i18next"; @@ -42,7 +42,6 @@ export default function ContractFormComponent({ )} - form.submit()} - loading={loading} - > - {t("general.actions.create")} - + + {selectedJobState[0] && selectedCarState[0] && ( + + + + )} + + ); return ( diff --git a/client/src/pages/contract-create/contract-create.page.container.jsx b/client/src/pages/contract-create/contract-create.page.container.jsx index 95d31e486..7ab35f1c5 100644 --- a/client/src/pages/contract-create/contract-create.page.container.jsx +++ b/client/src/pages/contract-create/contract-create.page.container.jsx @@ -7,6 +7,7 @@ import { useHistory, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; import { INSERT_NEW_CONTRACT } from "../../graphql/cccontracts.queries"; +import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { setBreadcrumbs, setSelectedHeader, @@ -37,8 +38,9 @@ export function ContractCreatePageContainer({ (location.state && location.state.jobId) || null ); const [insertContract] = useMutation(INSERT_NEW_CONTRACT); + const [intakeJob] = useMutation(UPDATE_JOB); - const handleFinish = async (values) => { + const handleFinish = async ({ addtoproduction, ...values }) => { if (!!selectedCarState[0] && !!selectedJobState[0]) { setLoading(true); const result = await insertContract({ @@ -54,12 +56,35 @@ export function ContractCreatePageContainer({ }, }, }); + if (!result.errors) { //Update the courtesy car to have the damage. notification["success"]({ message: t("contracts.successes.saved"), }); + //Intake the job if required + if (addtoproduction) { + const result2 = await intakeJob({ + variables: { + jobId: selectedJobState[0], + job: { + actual_in: new Date(), + inproduction: true, + status: bodyshop.md_ro_statuses.default_arrived, + }, + }, + }); + if (result2.errors) { + notification["error"]({ + message: t("jobs.errors.saving", { + error: JSON.stringify(!result2.errors), + }), + }); + return; + } + } + form.resetFields(); form.resetFields(); history.push( From 696781c8578d498b44bcbccba10ceabbc8af654e Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 17 Nov 2021 21:47:05 -0800 Subject: [PATCH 2/3] IO-1533 Kanban Customizations --- ...production-board-kanban-card.component.jsx | 300 +++++++----------- ...n-board-kanban.card-settings.component.jsx | 89 +++--- .../production-board-kanban.component.jsx | 42 ++- 3 files changed, 177 insertions(+), 254 deletions(-) diff --git a/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx b/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx index b48c09e22..ce5bd679e 100644 --- a/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx +++ b/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx @@ -1,4 +1,4 @@ -import { EyeFilled, CalendarOutlined } from "@ant-design/icons"; +import { EyeFilled, CalendarOutlined, ToolFilled } from "@ant-design/icons"; import { Card, Col, Row, Space, Typography } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -16,7 +16,7 @@ export default function ProductionBoardCard( cardSettings ) { const { t } = useTranslation(); - const [flipped, setFlipped] = useState(false); + let employee_body, employee_prep, employee_refinish, employee_csr; if (card.employee_body) { employee_body = bodyshop.employees.find((e) => e.id === card.employee_body); @@ -35,16 +35,24 @@ export default function ProductionBoardCard( return ( setFlipped(!flipped)} - > -
- - {card.ro_number || t("general.labels.na")} - - - {cardSettings && cardSettings.alert && ( - + className="react-kanban-card imex-kanban-card" + size="small" + title={ + + + + {card.ro_number || t("general.labels.na")} + + + } + extra={ + + {cardSettings && cardSettings.sublets && ( + + + )} {technician ? ( @@ -56,98 +64,10 @@ export default function ProductionBoardCard( )} -
- {flipped ? ( - - {cardSettings && cardSettings.clm_no === "back" && ( - -
{card.clm_no || ""}
- - )} - {cardSettings && cardSettings.ins_co_nm === "back" && ( - -
{card.ins_co_nm || ""}
- - )} - {cardSettings && cardSettings.laborhrs === "back" && ( - - -
{`B: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}
-
{`R: ${card.larhrs.aggregate.sum.mod_lb_hrs || "?"}`}
-
- - )} - {cardSettings && cardSettings.employeeassignments === "back" && ( - - -
{`B: ${ - employee_body - ? `${employee_body.first_name} ${employee_body.last_name}` - : "" - }`}
-
{`P: ${ - employee_prep - ? `${employee_prep.first_name} ${employee_prep.last_name}` - : "" - }`}
-
{`R: ${ - employee_refinish - ? `${employee_refinish.first_name} ${employee_refinish.last_name}` - : "" - }`}
-
{`CSR: ${ - employee_csr - ? `${employee_csr.first_name} ${employee_csr.last_name}` - : "" - }`}
-
- - )} - {cardSettings && cardSettings.scheduled_completion === "back" && ( - - - - - {card.scheduled_completion} - - - - )} - {cardSettings && cardSettings.ats === "back" && ( - - -
{card.alt_transport || ""}
- - - )} - - {cardSettings && cardSettings.sublets === "back" && ( - - - - )} - {cardSettings && cardSettings.production_note === "back" && ( - - {cardSettings && cardSettings.production_note === "back" && ( - - )} - - )} -
- ) : ( - + } + > + + {cardSettings && cardSettings.ownr_nm && ( {cardSettings && cardSettings.compact ? (
{`${card.ownr_ln || ""} ${ @@ -159,97 +79,91 @@ export default function ProductionBoardCard( } ${card.ownr_co_nm || ""}`}
)} - -
{`${card.v_model_yr || ""} ${ - card.v_make_desc || "" - } ${card.v_model_desc || ""}`}
+ )} + +
{`${card.v_model_yr || ""} ${ + card.v_make_desc || "" + } ${card.v_model_desc || ""}`}
+ + {cardSettings && cardSettings.ins_co_nm && ( + +
{card.ins_co_nm || ""}
+ )} + {cardSettings && cardSettings.clm_no && ( + +
{card.clm_no || ""}
+ + )} - {cardSettings && cardSettings.clm_no === "front" && ( - -
{card.clm_no || ""}
- - )} - {cardSettings && cardSettings.ins_co_nm === "front" && ( - -
{card.ins_co_nm || ""}
- - )} - {cardSettings && cardSettings.laborhrs === "front" && ( - - -
{`B: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}
-
{`R: ${card.larhrs.aggregate.sum.mod_lb_hrs || "?"}`}
-
- - )} - {cardSettings && cardSettings.employeeassignments === "front" && ( - - -
{`B: ${ - employee_body - ? `${employee_body.first_name} ${employee_body.last_name}` - : "" - }`}
-
{`P: ${ - employee_prep - ? `${employee_prep.first_name} ${employee_prep.last_name}` - : "" - }`}
-
{`R: ${ - employee_refinish - ? `${employee_refinish.first_name} ${employee_refinish.last_name}` - : "" - }`}
-
{`CSR: ${ - employee_csr - ? `${employee_csr.first_name} ${employee_csr.last_name}` - : "" - }`}
-
- - )} - {cardSettings && cardSettings.scheduled_completion === "front" && ( - - - - - {card.scheduled_completion} - - - - )} - {cardSettings && cardSettings.ats === "front" && ( - -
{card.alt_transport || ""}
- - )} - {cardSettings && cardSettings.sublets === "front" && ( - - - - )} - {cardSettings && cardSettings.production_note === "front" && ( - - {cardSettings && cardSettings.production_note === "front" && ( - - )} - - )} -
- )} + {cardSettings && cardSettings.employeeassignments && ( + + + {`B: ${ + employee_body + ? `${employee_body.first_name} ${employee_body.last_name}` + : "" + }`} + {`P: ${ + employee_prep + ? `${employee_prep.first_name} ${employee_prep.last_name}` + : "" + }`} + {`R: ${ + employee_refinish + ? `${employee_refinish.first_name} ${employee_refinish.last_name}` + : "" + }`} + {/* {`C: ${ + employee_csr + ? `${employee_csr.first_name} ${employee_csr.last_name}` + : "" + }`} */} + + + )} + {cardSettings && cardSettings.laborhrs && ( + + + {`B: ${ + card.labhrs.aggregate.sum.mod_lb_hrs || "?" + } hrs`} + {`R: ${ + card.larhrs.aggregate.sum.mod_lb_hrs || "?" + } hrs`} + + + )} + {cardSettings && cardSettings.scheduled_completion && ( + + + + + {card.scheduled_completion} + + + + )} + {cardSettings && cardSettings.ats && ( + +
{card.alt_transport || ""}
+ + )} + {cardSettings && cardSettings.sublets && ( + + + + )} + {cardSettings && cardSettings.production_note && ( + + {cardSettings && cardSettings.production_note && ( + + )} + + )} +
); } diff --git a/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx b/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx index 9ae6666a1..dba1230c6 100644 --- a/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx +++ b/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx @@ -63,85 +63,74 @@ export default function ProductionBoardKanbanCardSettings({ >
- - - Front - Back - Off - + + + + + - - Front - Back - Off - + - - Front - Back - Off - + - - Front - Back - Off - + - - Front - Back - Off - + {" "} - - - Front - Back - Off - + + - - Front - Back - Off - + - - - Front - Back - Off - - - - - Front - Back - Off - + {/* + + */} + + diff --git a/client/src/components/production-board-kanban/production-board-kanban.component.jsx b/client/src/components/production-board-kanban/production-board-kanban.component.jsx index 4423a23fe..1f3129eeb 100644 --- a/client/src/components/production-board-kanban/production-board-kanban.component.jsx +++ b/client/src/components/production-board-kanban/production-board-kanban.component.jsx @@ -2,7 +2,7 @@ import { useApolloClient } from "@apollo/client"; import Board, { moveCard } from "@asseinfo/react-kanban"; //import "@asseinfo/react-kanban/dist/styles.css"; import "./production-board-kanban.styles.scss"; -import { notification, PageHeader, Space, Statistic } from "antd"; +import { Grid, notification, PageHeader, Space, Statistic } from "antd"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -145,22 +145,42 @@ export function ProductionBoardKanbanComponent({ 0 ) .toFixed(1); + const selectedBreakpoint = Object.entries(Grid.useBreakpoint()) + .filter((screen) => !!screen[1]) + .slice(-1)[0]; + + const standardSizes = { + xs: "250", + sm: "250", + md: "250", + lg: "250", + xl: "250", + xxl: "250", + }; + const compactSizes = { + xs: "150", + sm: "150", + md: "150", + lg: "150", + xl: "155", + xxl: "155", + }; + + const width = selectedBreakpoint + ? associationSettings && + associationSettings.kanban_settings && + associationSettings.kanban_settings.compact + ? compactSizes[selectedBreakpoint[0]] + : standardSizes[selectedBreakpoint[0]] + : "250"; const Container = styled.div` .react-kanban-card-skeleton, .react-kanban-card, .react-kanban-card-adder-form { box-sizing: border-box; - max-width: ${associationSettings && - associationSettings.kanban_settings && - associationSettings.kanban_settings.compact - ? "145" - : "250"}px; - min-width: ${associationSettings && - associationSettings.kanban_settings && - associationSettings.kanban_settings.compact - ? "145" - : "250"}px; + max-width: ${width}px; + min-width: ${width}px; } `; From 49bf461c3689ac07a46cae33588e74f5a51101d7 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 17 Nov 2021 22:07:50 -0800 Subject: [PATCH 3/3] IO-1533 Kanban Customizations --- bodyshop_translations.babel | 126 ++++++++++++++++++ ...production-board-kanban-card.component.jsx | 94 ++++++------- ...n-board-kanban.card-settings.component.jsx | 10 +- .../production-sublets-manage.component.jsx | 10 +- client/src/translations/en_us/common.json | 6 + client/src/translations/es/common.json | 6 + client/src/translations/fr/common.json | 6 + 7 files changed, 205 insertions(+), 53 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 2456b19d5..1db938a77 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -34961,6 +34961,27 @@ + + ats + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + bodyhours false @@ -35024,6 +35045,27 @@ + + clm_no + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + compact false @@ -35108,6 +35150,27 @@ + + ins_co_nm + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + jobdetail false @@ -35171,6 +35234,27 @@ + + ownr_nm + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + paintpriority false @@ -35192,6 +35276,27 @@ + + production_note + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + refinishhours false @@ -35213,6 +35318,27 @@ + + scheduled_completion + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + selectview false diff --git a/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx b/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx index ce5bd679e..952c23b44 100644 --- a/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx +++ b/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx @@ -1,6 +1,6 @@ -import { EyeFilled, CalendarOutlined, ToolFilled } from "@ant-design/icons"; -import { Card, Col, Row, Space, Typography } from "antd"; -import React, { useState } from "react"; +import { CalendarOutlined, EyeFilled } from "@ant-design/icons"; +import { Card, Col, Row, Space } from "antd"; +import React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { DateTimeFormatter } from "../../utils/DateFormatter"; @@ -17,7 +17,7 @@ export default function ProductionBoardCard( ) { const { t } = useTranslation(); - let employee_body, employee_prep, employee_refinish, employee_csr; + let employee_body, employee_prep, employee_refinish; //employee_csr; if (card.employee_body) { employee_body = bodyshop.employees.find((e) => e.id === card.employee_body); } @@ -29,9 +29,9 @@ export default function ProductionBoardCard( (e) => e.id === card.employee_refinish ); } - if (card.employee_csr) { - employee_csr = bodyshop.employees.find((e) => e.id === card.employee_csr); - } + // if (card.employee_csr) { + // employee_csr = bodyshop.employees.find((e) => e.id === card.employee_csr); + // } return ( } extra={ - - {cardSettings && cardSettings.sublets && ( - - - - )} - {technician ? ( - - - - ) : ( - - - - )} - + technician ? ( + + + + ) : ( + + + + ) } > @@ -85,12 +76,12 @@ export default function ProductionBoardCard( card.v_make_desc || "" } ${card.v_model_desc || ""}`} - {cardSettings && cardSettings.ins_co_nm && ( + {cardSettings && cardSettings.ins_co_nm && card.ins_co_nm && (
{card.ins_co_nm || ""}
)} - {cardSettings && cardSettings.clm_no && ( + {cardSettings && cardSettings.clm_no && card.clm_no && (
{card.clm_no || ""}
@@ -101,19 +92,28 @@ export default function ProductionBoardCard( {`B: ${ employee_body - ? `${employee_body.first_name} ${employee_body.last_name}` + ? `${employee_body.first_name.substr( + 0, + 3 + )} ${employee_body.last_name.charAt(0)}` : "" - }`} + } ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}h`} {`P: ${ employee_prep - ? `${employee_prep.first_name} ${employee_prep.last_name}` + ? `${employee_prep.first_name.substr( + 0, + 3 + )} ${employee_prep.last_name.charAt(0)}` : "" }`} {`R: ${ employee_refinish - ? `${employee_refinish.first_name} ${employee_refinish.last_name}` + ? `${employee_refinish.first_name.substr( + 0, + 3 + )} ${employee_refinish.last_name.charAt(0)}` : "" - }`} + } ${card.larhrs.aggregate.sum.mod_lb_hrs || "?"}h`} {/* {`C: ${ employee_csr ? `${employee_csr.first_name} ${employee_csr.last_name}` @@ -122,7 +122,7 @@ export default function ProductionBoardCard( )} - {cardSettings && cardSettings.laborhrs && ( + {/* {cardSettings && cardSettings.laborhrs && ( {`B: ${ @@ -133,19 +133,21 @@ export default function ProductionBoardCard( } hrs`} - )} - {cardSettings && cardSettings.scheduled_completion && ( - - - - - {card.scheduled_completion} - - - - )} - {cardSettings && cardSettings.ats && ( - + )} */} + {cardSettings && + cardSettings.scheduled_completion && + card.scheduled_completion && ( + + + + + {card.scheduled_completion} + + + + )} + {cardSettings && cardSettings.ats && card.alt_transport && ( +
{card.alt_transport || ""}
)} diff --git a/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx b/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx index dba1230c6..cfecf04fa 100644 --- a/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx +++ b/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx @@ -84,13 +84,13 @@ export default function ProductionBoardKanbanCardSettings({ >
- - +
*/} + + - {" "} - - +
handleSubletMark(s, "complete")} + onClick={(e) => { + e.stopPropagation(); + handleSubletMark(s, "complete"); + }} type={s.sublet_completed ? "primary" : "ghost"} > handleSubletMark(s, "ignore")} + onClick={(e) => { + e.stopPropagation(); + handleSubletMark(s, "ignore"); + }} type={s.sublet_ignored ? "primary" : "ghost"} >