From 2aed392fbe3086658fbef6b77aa826e6d9c4cea1 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 25 Oct 2021 14:46:24 -0700 Subject: [PATCH] IO-658 IO-652 IO-657 add MPI Templates. --- bodyshop_translations.babel | 94 ++++++++++++ .../schedule-calendar.component.jsx | 2 + .../schedule-manual-event.component.jsx | 135 ++++++++++++++++++ client/src/translations/en_us/common.json | 8 ++ client/src/translations/es/common.json | 8 ++ client/src/translations/fr/common.json | 8 ++ client/src/utils/TemplateConstants.js | 33 +++++ 7 files changed, 288 insertions(+) create mode 100644 client/src/components/schedule-manual-event/schedule-manual-event.component.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 6a9284d09..53a60c967 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -33357,6 +33357,69 @@ + + mpi_animal_checklist + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mpi_eglass_auth + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mpi_final_acct_sheet + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + paint_grid false @@ -37015,6 +37078,37 @@ + + schedule + + + labels + + + manualevent + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + scoreboard diff --git a/client/src/components/schedule-calendar/schedule-calendar.component.jsx b/client/src/components/schedule-calendar/schedule-calendar.component.jsx index fd03af182..2158a701c 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.component.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.component.jsx @@ -3,6 +3,7 @@ import { Button, Card, Col, PageHeader, Row, Space } from "antd"; import React from "react"; import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component"; import ScheduleModal from "../schedule-job-modal/schedule-job-modal.container"; +import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component"; import ScheduleProductionList from "../schedule-production-list/schedule-production-list.component"; export default function ScheduleCalendarComponent({ data, refetch }) { @@ -23,6 +24,7 @@ export default function ScheduleCalendarComponent({ data, refetch }) { + } /> diff --git a/client/src/components/schedule-manual-event/schedule-manual-event.component.jsx b/client/src/components/schedule-manual-event/schedule-manual-event.component.jsx new file mode 100644 index 000000000..be4663d45 --- /dev/null +++ b/client/src/components/schedule-manual-event/schedule-manual-event.component.jsx @@ -0,0 +1,135 @@ +import { useMutation, useLazyQuery } from "@apollo/client"; +import { + Button, + Card, + Form, + Input, + InputNumber, + notification, + Popover, + Space, +} from "antd"; +import moment from "moment"; +import React, { useState, useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { logImEXEvent } from "../../firebase/firebase.utils"; +import { + INSERT_APPOINTMENT, + UPDATE_APPOINTMENT, +} from "../../graphql/appointments.queries"; +import { + INSERT_SCOREBOARD_ENTRY, + QUERY_SCOREBOARD_ENTRY, + UPDATE_SCOREBOARD_ENTRY, +} from "../../graphql/scoreboard.queries"; +import FormDatePicker from "../form-date-picker/form-date-picker.component"; +import FormDateTimePickerComponent from "../form-date-time-picker/form-date-time-picker.component"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; + +export default function ScheduleManualEvent({ event }) { + const { t } = useTranslation(); + const [insertAppointment] = useMutation(INSERT_APPOINTMENT); + const [updateAppointment] = useMutation(UPDATE_APPOINTMENT); + const [loading, setLoading] = useState(false); + const [form] = Form.useForm(); + const [visibility, setVisibility] = useState(false); + // const [callQuery, { loading: entryLoading, data: entryData }] = useLazyQuery( + // QUERY_SCOREBOARD_ENTRY + // ); + + useEffect(() => { + if (visibility && event) { + form.setFieldsValue({ event }); + } + }, [visibility, form, event]); + + useEffect(() => { + // if (entryData && entryData.scoreboard && entryData.scoreboard[0]) { + // console.log("Setting FOrm"); + // // form.setFieldsValue(entryData.scoreboard[0]); + // } + }, [form]); + + const handleFinish = async (values) => { + logImEXEvent("job_close_add_to_scoreboard"); + + setLoading(true); + try { + let result; + if (event && event.id) { + } else { + } + } catch (error) { + console.log(error); + } finally { + setLoading(false); + setVisibility(false); + } + }; + + const overlay = ( + +
+
+ + + + + + + + + + + + + + +
+
+
+ ); + + const handleClick = (e) => { + setVisibility(true); + }; + + return ( + + + + ); +} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index b960d0aa3..32500917f 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1991,6 +1991,9 @@ "job_costing_ro": "Job Costing", "job_notes": "Job Notes", "key_tag": "Key Tag", + "mpi_animal_checklist": "MPI - Animal Checklist", + "mpi_eglass_auth": "MPI - eGlass Auth", + "mpi_final_acct_sheet": "MPI - Final Accounting Sheet", "paint_grid": "Paint Grid", "parts_label_single": "Parts Label - Single", "parts_list": "Parts List", @@ -2204,6 +2207,11 @@ "work_in_progress_payables": "Work in Progress - Payables" } }, + "schedule": { + "labels": { + "manualevent": "Add Manual Event" + } + }, "scoreboard": { "actions": { "edit": "Edit" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index eb330f129..7dfca4271 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1991,6 +1991,9 @@ "job_costing_ro": "", "job_notes": "", "key_tag": "", + "mpi_animal_checklist": "", + "mpi_eglass_auth": "", + "mpi_final_acct_sheet": "", "paint_grid": "", "parts_label_single": "", "parts_list": "", @@ -2204,6 +2207,11 @@ "work_in_progress_payables": "" } }, + "schedule": { + "labels": { + "manualevent": "" + } + }, "scoreboard": { "actions": { "edit": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 5ef8e24c0..c59bc8508 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1991,6 +1991,9 @@ "job_costing_ro": "", "job_notes": "", "key_tag": "", + "mpi_animal_checklist": "", + "mpi_eglass_auth": "", + "mpi_final_acct_sheet": "", "paint_grid": "", "parts_label_single": "", "parts_list": "", @@ -2204,6 +2207,11 @@ "work_in_progress_payables": "" } }, + "schedule": { + "labels": { + "manualevent": "" + } + }, "scoreboard": { "actions": { "edit": "" diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 77840f31d..88a7e8e8c 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -374,6 +374,39 @@ export const TemplateList = (type, context) => { CA_SK: true, }, }, + mpi_final_acct_sheet: { + title: i18n.t("printcenter.jobs.mpi_final_acct_sheet"), + description: "Thank You Letter by RO", + key: "mpi_final_acct_sheet", + subject: i18n.t("printcenter.jobs.mpi_final_acct_sheet"), + disabled: false, + group: "post", + regions: { + CA_MB: true, + }, + }, + mpi_eglass_auth: { + title: i18n.t("printcenter.jobs.mpi_eglass_auth"), + description: "Thank You Letter by RO", + key: "mpi_eglass_auth", + subject: i18n.t("printcenter.jobs.mpi_eglass_auth"), + disabled: false, + group: "pre", + regions: { + CA_MB: true, + }, + }, + mpi_animal_checklist: { + title: i18n.t("printcenter.jobs.mpi_animal_checklist"), + description: "Thank You Letter by RO", + key: "mpi_animal_checklist", + subject: i18n.t("printcenter.jobs.mpi_animal_checklist"), + disabled: false, + group: "pre", + regions: { + CA_MB: true, + }, + }, // parts_label_multi: { // title: i18n.t("printcenter.jobs.parts_label_multi"), // description: "Thank You Letter by RO",