diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 87757eb30..1ceeb8e5f 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -20306,6 +20306,27 @@ + + reportcenter + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + schedule false @@ -24357,6 +24378,131 @@ + + reportcenter + + + actions + + + generate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + labels + + + dates + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + generateasemail + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + key + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + templates + + + payment_by_date + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + scoreboard diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index 347a77eb9..d45210a20 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -48,6 +48,8 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(setModalContext({ context: context, modal: "timeTicket" })), setPaymentContext: (context) => dispatch(setModalContext({ context: context, modal: "payment" })), + setReportCenterContext: (context) => + dispatch(setModalContext({ context: context, modal: "reportCenter" })), signOutStart: () => dispatch(signOutStart()), }); @@ -59,6 +61,7 @@ function Header({ setBillEnterContext, setTimeTicketContext, setPaymentContext, + setReportCenterContext, recentItems, }) { const { t } = useTranslation(); @@ -268,7 +271,17 @@ function Header({ {t("menus.header.shop_templates")} - + { + setReportCenterContext({ + actions: {}, + context: {}, + }); + }} + > + {t("menus.header.reportcenter")} + {t("menus.header.shop_vendors")} diff --git a/client/src/components/print-center-speed-print/print-center-speed-print.component.jsx b/client/src/components/print-center-speed-print/print-center-speed-print.component.jsx index ac12718f0..fa05515d3 100644 --- a/client/src/components/print-center-speed-print/print-center-speed-print.component.jsx +++ b/client/src/components/print-center-speed-print/print-center-speed-print.component.jsx @@ -72,8 +72,16 @@ const renderTemplateList = (templates) => { {templates.map((template, idx) => { if (idx === templates.length - 1) - return TemplateListGenerated[template].title; - return `${TemplateListGenerated[template].title}, `; + return ( + (TemplateListGenerated[template] && + TemplateListGenerated[template].title) || + "" + ); + return `${ + (TemplateListGenerated[template] && + TemplateListGenerated[template].title) || + "" + }, `; })} ); diff --git a/client/src/components/report-center-modal/report-center-modal.component.jsx b/client/src/components/report-center-modal/report-center-modal.component.jsx new file mode 100644 index 000000000..59a6333c7 --- /dev/null +++ b/client/src/components/report-center-modal/report-center-modal.component.jsx @@ -0,0 +1,131 @@ +import { Button, DatePicker, Form, Select, Switch } from "antd"; +import moment from "moment"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { GenerateDocument } from "../../utils/RenderTemplate"; +import { TemplateList } from "../../utils/TemplateConstants"; + +export default function ReportCenterModalComponent({ context }) { + const [form] = Form.useForm(); + const { t } = useTranslation(); + + const Templates = TemplateList("report_center"); + + const handleFinish = (values) => { + const start = values.dates[0]; + const end = values.dates[1]; + console.log("values", values); + GenerateDocument( + { + name: values.key, + variables: { + ...(start ? { start: start } : {}), + ...(end ? { end: end } : {}), + }, + }, + { + to: values.to, + }, + values.email ? "e" : "p" + ); + }; + + return ( +
+
+ + + + + + + + + + + +
+ +
+
+
+ ); +} diff --git a/client/src/components/report-center-modal/report-center-modal.container.jsx b/client/src/components/report-center-modal/report-center-modal.container.jsx new file mode 100644 index 000000000..1ef5b5ec4 --- /dev/null +++ b/client/src/components/report-center-modal/report-center-modal.container.jsx @@ -0,0 +1,42 @@ +import { Modal } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { toggleModalVisible } from "../../redux/modals/modals.actions"; +import { selectReportCenter } from "../../redux/modals/modals.selectors"; +import ReportCenterModalComponent from "./report-center-modal.component"; + +const mapStateToProps = createStructuredSelector({ + reportCenterModal: selectReportCenter, +}); + +const mapDispatchToProps = (dispatch) => ({ + toggleModalVisible: () => dispatch(toggleModalVisible("reportCenter")), +}); + +export function ReportCenterModalContainer({ + reportCenterModal, + toggleModalVisible, +}) { + const { t } = useTranslation(); + + const { visible } = reportCenterModal; + + return ( + toggleModalVisible()} + cancelButtonProps={{ style: { display: "none" } }} + destroyOnClose + > + + + ); +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(ReportCenterModalContainer); diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 9c58fee67..e220ebf99 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -80,6 +80,9 @@ const BillsListPage = lazy(() => import("../bills/bills.page.container")); const JobCostingModal = lazy(() => import("../../components/job-costing-modal/job-costing-modal.container") ); +const ReportCenterModal = lazy(() => + import("../../components/report-center-modal/report-center-modal.container") +); const BillEnterModalContainer = lazy(() => import("../../components/bill-enter-modal/bill-enter-modal.container") ); @@ -183,6 +186,7 @@ export function Manage({ match, conflict }) { + diff --git a/client/src/redux/modals/modals.reducer.js b/client/src/redux/modals/modals.reducer.js index d97fa55f6..3855215aa 100644 --- a/client/src/redux/modals/modals.reducer.js +++ b/client/src/redux/modals/modals.reducer.js @@ -20,12 +20,12 @@ const INITIAL_STATE = { reconciliation: { ...baseModal }, payment: { ...baseModal }, jobCosting: { ...baseModal }, + reportCenter: { ...baseModal }, }; const modalsReducer = (state = INITIAL_STATE, action) => { switch (action.type) { case ModalsActionTypes.TOGGLE_MODAL_VISIBLE: - //logImEXEvent("redux_toggle_modal_visible", { modal: action.payload }); return { ...state, [action.payload]: { @@ -34,8 +34,6 @@ const modalsReducer = (state = INITIAL_STATE, action) => { }, }; case ModalsActionTypes.SET_MODAL_CONTEXT: - // logImEXEvent("redux_set_modal_context", { modal: action.payload.modal }); - return { ...state, [action.payload.modal]: { diff --git a/client/src/redux/modals/modals.selectors.js b/client/src/redux/modals/modals.selectors.js index 5f5074c1e..3a1e8bd87 100644 --- a/client/src/redux/modals/modals.selectors.js +++ b/client/src/redux/modals/modals.selectors.js @@ -55,3 +55,8 @@ export const selectJobCosting = createSelector( [selectModals], (modals) => modals.jobCosting ); + +export const selectReportCenter = createSelector( + [selectModals], + (modals) => modals.reportCenter +); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 79eb815e7..f52518aca 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1218,6 +1218,7 @@ "productionboard": "Production Board - Visual", "productionlist": "Production Board - List", "recent": "Recent Items", + "reportcenter": "Report Center", "schedule": "Schedule", "scoreboard": "Scoreboard", "search": { @@ -1492,6 +1493,19 @@ "activeshop": "Active Shop" } }, + "reportcenter": { + "actions": { + "generate": "Generate" + }, + "labels": { + "dates": "Dates", + "generateasemail": "Generate as Email?", + "key": "Report" + }, + "templates": { + "payment_by_date": "Payments by Date Range" + } + }, "scoreboard": { "actions": { "edit": "Edit" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index e32b72e04..dea4de92a 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1218,6 +1218,7 @@ "productionboard": "", "productionlist": "", "recent": "", + "reportcenter": "", "schedule": "Programar", "scoreboard": "", "search": { @@ -1492,6 +1493,19 @@ "activeshop": "" } }, + "reportcenter": { + "actions": { + "generate": "" + }, + "labels": { + "dates": "", + "generateasemail": "", + "key": "" + }, + "templates": { + "payment_by_date": "" + } + }, "scoreboard": { "actions": { "edit": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 7b8e136a0..95c3c7997 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1218,6 +1218,7 @@ "productionboard": "", "productionlist": "", "recent": "", + "reportcenter": "", "schedule": "Programme", "scoreboard": "", "search": { @@ -1492,6 +1493,19 @@ "activeshop": "" } }, + "reportcenter": { + "actions": { + "generate": "" + }, + "labels": { + "dates": "", + "generateasemail": "", + "key": "" + }, + "templates": { + "payment_by_date": "" + } + }, "scoreboard": { "actions": { "edit": "" diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 4565dc5a5..4c3cdce5e 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -136,6 +136,18 @@ export const TemplateList = (type, context) => { }, } : {}), - ...(!type || type === "job" ? {} : {}), + ...(!type || type === "report_center" + ? { + payment_by_date: { + title: i18n.t("reportcenter.templates.payment_by_date"), + description: "Est Detail", + subject: `${i18n.t("reportcenter.templates.payment_by_date")} - ${ + context && context.job && context.job.ro_number + }`, + key: "payment_by_date", + disabled: false, + }, + } + : {}), }; };