diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index 3ba45ca94..a1a567b9b 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -1,430 +1,469 @@ import Icon, { - BankFilled, - BarChartOutlined, - CarFilled, - CheckCircleOutlined, - ClockCircleFilled, - DashboardFilled, - DollarCircleFilled, - ExportOutlined, - FieldTimeOutlined, - FileAddFilled, - FileAddOutlined, - FileFilled, - //GlobalOutlined, - HomeFilled, - ImportOutlined, - LineChartOutlined, - PaperClipOutlined, - PhoneOutlined, - QuestionCircleFilled, - ScheduleOutlined, - SettingOutlined, - TeamOutlined, - ToolFilled, - UnorderedListOutlined, - UserOutlined, + BankFilled, + BarChartOutlined, + CarFilled, + CheckCircleOutlined, + ClockCircleFilled, + DashboardFilled, + DollarCircleFilled, + ExportOutlined, + FieldTimeOutlined, + FileAddFilled, + FileAddOutlined, + FileFilled, + HomeFilled, + ImportOutlined, + LineChartOutlined, + PaperClipOutlined, + PhoneOutlined, + QuestionCircleFilled, + ScheduleOutlined, + SettingOutlined, + TeamOutlined, + ToolFilled, + UnorderedListOutlined, + UserOutlined, } from "@ant-design/icons"; import {useSplitTreatments} from "@splitsoftware/splitio-react"; -import { Layout, Menu } from "antd"; +import {Layout, Menu} from "antd"; import React from "react"; -import { useTranslation } from "react-i18next"; -import { BsKanban } from "react-icons/bs"; -import { - FaCalendarAlt, - FaCarCrash, - FaCreditCard, - FaFileInvoiceDollar, -} from "react-icons/fa"; -import { GiPayMoney, GiPlayerTime, GiSettingsKnobs } from "react-icons/gi"; -import { IoBusinessOutline } from "react-icons/io5"; -import { RiSurveyLine } from "react-icons/ri"; -import { connect } from "react-redux"; -import { Link } from "react-router-dom"; -import { createStructuredSelector } from "reselect"; -import { - selectRecentItems, - selectSelectedHeader, -} from "../../redux/application/application.selectors"; -import { setModalContext } from "../../redux/modals/modals.actions"; -import { signOutStart } from "../../redux/user/user.actions"; -import { - selectBodyshop, - selectCurrentUser, -} from "../../redux/user/user.selectors"; +import {useTranslation} from "react-i18next"; +import {BsKanban} from "react-icons/bs"; +import {FaCalendarAlt, FaCarCrash, FaCreditCard, FaFileInvoiceDollar,} from "react-icons/fa"; +import {GiPayMoney, GiPlayerTime, GiSettingsKnobs} from "react-icons/gi"; +import {IoBusinessOutline} from "react-icons/io5"; +import {RiSurveyLine} from "react-icons/ri"; +import {connect} from "react-redux"; +import {Link} from "react-router-dom"; +import {createStructuredSelector} from "reselect"; +import {selectRecentItems, selectSelectedHeader,} from "../../redux/application/application.selectors"; +import {setModalContext} from "../../redux/modals/modals.actions"; +import {signOutStart} from "../../redux/user/user.actions"; +import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors"; +import {FiLogOut} from "react-icons/fi"; const mapStateToProps = createStructuredSelector({ - currentUser: selectCurrentUser, - recentItems: selectRecentItems, - selectedHeader: selectSelectedHeader, - bodyshop: selectBodyshop, + currentUser: selectCurrentUser, + recentItems: selectRecentItems, + selectedHeader: selectSelectedHeader, + bodyshop: selectBodyshop, }); const mapDispatchToProps = (dispatch) => ({ - setBillEnterContext: (context) => - dispatch(setModalContext({ context: context, modal: "billEnter" })), - setTimeTicketContext: (context) => - 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()), - setCardPaymentContext: (context) => - dispatch(setModalContext({ context: context, modal: "cardPayment" })), + setBillEnterContext: (context) => + dispatch(setModalContext({context: context, modal: "billEnter"})), + setTimeTicketContext: (context) => + 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()), + setCardPaymentContext: (context) => + dispatch(setModalContext({context: context, modal: "cardPayment"})), }); -function Header({ - handleMenuClick, - currentUser, - bodyshop, - selectedHeader, - signOutStart, - setBillEnterContext, - setTimeTicketContext, - setPaymentContext, - setReportCenterContext, - recentItems, - setCardPaymentContext, -}) { - // TODO: Client Update - New Split Treatments usage example - const { treatments: {ImEXPay, DmsAp, Simple_Inventory} } = useSplitTreatments({ - attributes: {}, - names: ["ImEXPay", "DmsAp", "Simple_Inventory"], - splitKey: bodyshop && bodyshop.imexshopid, - }); +function Header({handleMenuClick, currentUser, bodyshop, selectedHeader, signOutStart, setBillEnterContext, setTimeTicketContext, setPaymentContext, setReportCenterContext, recentItems, setCardPaymentContext}) { - const { t } = useTranslation(); + const {treatments: {ImEXPay, DmsAp, Simple_Inventory}} = useSplitTreatments({ + attributes: {}, + names: ["ImEXPay", "DmsAp", "Simple_Inventory"], + splitKey: bodyshop && bodyshop.imexshopid, + }); - return ( - - - }> - {t("menus.header.home")} - - }> - {t("menus.header.schedule")} - - } - title={t("menus.header.jobs")} - > - }> - {t("menus.header.activejobs")} - - }> - {t("menus.header.readyjobs")} - - }> - {t("menus.header.parts-queue")} - - }> - - {t("menus.header.availablejobs")} - - - }> - {t("menus.header.newjob")} - - - }> - {t("menus.header.alljobs")} - - - }> - - {t("menus.header.productionlist")} - - - }> - - {t("menus.header.productionboard")} - - - - }> - {t("menus.header.scoreboard")} - - - } - title={t("menus.header.customers")} - > - }> - {t("menus.header.owners")} - - }> - {t("menus.header.vehicles")} - - - } - title={t("menus.header.courtesycars")} - > - }> - - {t("menus.header.courtesycars-all")} - - - }> - - {t("menus.header.courtesycars-contracts")} - - - }> - - {t("menus.header.courtesycars-newcontract")} - - - - } - title={t("menus.header.accounting")} - > - } - > - {t("menus.header.bills")} - - } - onClick={() => { - setBillEnterContext({ - actions: {}, - context: {}, - }); - }} - > - {t("menus.header.enterbills")} - - {Simple_Inventory.treatment === "on" && ( - <> - - } - > - - {t("menus.header.inventory")} - - - - )} - - }> - {t("menus.header.allpayments")} - - { - setPaymentContext({ - actions: {}, - context: null, - }); - }} - icon={} - > - {t("menus.header.enterpayment")} - - {ImEXPay.treatment === "on" && ( - { - setCardPaymentContext({ - actions: {}, - context: {}, + const {t} = useTranslation(); + + const accountingChildren = [ + { + key: 'bills', + icon: , + label: ({t("menus.header.bills")}) + }, + { + key: 'enterbills', + icon: , + label: t("menus.header.enterbills"), + onClick: () => { + setBillEnterContext({ + actions: {}, + context: {}, }); - }} - icon={} - > - {t("menus.header.entercardpayment")} - - )} - - }> - - {t("menus.header.timetickets")} - - - } - onClick={() => { - setTimeTicketContext({ - actions: {}, - context: { - created_by: currentUser.displayName - ? currentUser.email.concat(" | ", currentUser.displayName) - : currentUser.email, + } + }, + ]; + + if (Simple_Inventory.treatment === "on") { + accountingChildren.push( + { + type: 'divider', + }, + { + key: 'inventory', + icon: , + label: ({t("menus.header.inventory")}) + } + ); + } + accountingChildren.push( + { + type: 'divider' + }, + { + key: 'allpayments', + icon: , + label: ({t("menus.header.allpayments")}) + }, + { + key: 'enterpayments', + icon: , + label: t("menus.header.enterpayment"), + onClick: () => { + setPaymentContext({ + actions: {}, + context: null, + }); + }, + } + ); + + if (ImEXPay.treatment === "on") { + accountingChildren.push({ + key: 'entercardpayments', + icon: , + label: t("menus.header.entercardpayment"), + onClick: () => { + setCardPaymentContext({ + actions: {}, + context: {}, + }); + }, + }); + } + + accountingChildren.push( + { + type: 'divider', + }, + { + key: 'timetickets', + icon: , + label: ({t("menus.header.timetickets")}) + }, + { + key: 'entertimetickets', + icon: , + label: t("menus.header.entertimeticket"), + onClick: () => { + setTimeTicketContext({ + actions: {}, + context: { + created_by: currentUser.displayName + ? currentUser.email.concat(" | ", currentUser.displayName) + : currentUser.email, + }, + }); + }, + }, + { + type: 'divider', + } + ); + + const accountingExportChildren = [ + { + key: 'receivables', + label: ({t("menus.header.accounting-receivables")}) + } + ] + + if (!((bodyshop && bodyshop.cdk_dealerid) || (bodyshop && bodyshop.pbs_serialnumber)) || DmsAp.treatment === "on") { + accountingExportChildren.push({ + key: 'payables', + label: ({t("menus.header.accounting-payables")}) + }); + } + + if (!( + (bodyshop && bodyshop.cdk_dealerid) || + (bodyshop && bodyshop.pbs_serialnumber) + )) { + accountingExportChildren.push({ + key: 'payments', + label: ({t("menus.header.accounting-payments")}) + }); + } + + accountingExportChildren.push( + { + key: 'exportlogs', + label: ({t("menus.header.export-logs")}) + }, + { + key: 'accountingexport', + icon: , + label: t("menus.header.export"), + children: accountingExportChildren + } + ); + + const menuItems = [ + { + key: 'home', + icon: , + label: ({t("menus.header.home")}) + }, + { + key: 'schedule', + icon: , + label: ({t("menus.header.schedule")}) + }, + { + key: 'jobssubmenu', + icon: , + label: t("menus.header.jobs"), + children: [ + { + key: 'activejobs', + icon: , + label: ({t("menus.header.activejobs")}) }, - }); - }} - > - {t("menus.header.entertimeticket")} - - - } - > - - - {t("menus.header.accounting-receivables")} - - - {(!( - (bodyshop && bodyshop.cdk_dealerid) || - (bodyshop && bodyshop.pbs_serialnumber) - ) || - DmsAp.treatment === "on") && ( - - - {t("menus.header.accounting-payables")} - - - )} - {!( - (bodyshop && bodyshop.cdk_dealerid) || - (bodyshop && bodyshop.pbs_serialnumber) - ) && ( - - - {t("menus.header.accounting-payments")} - - - )} - - - {t("menus.header.export-logs")} - - - - - }> - {t("menus.header.phonebook")} - - }> - - {t("menus.header.temporarydocs")} - - - } - > - }> - - {t("menus.header.shop_config")} - - - }> - {t("menus.header.dashboard")} - - } - onClick={() => { - setReportCenterContext({ - actions: {}, - context: {}, - }); - }} - > - {t("menus.header.reportcenter")} - - } - > - - {t("menus.header.shop_vendors")} - - - }> - {t("menus.header.shop_csi")} - - - - signOutStart()}> - {t("user.actions.signout")} - - { - window.open("https://help.imex.online/", "_blank"); - }} - icon={} - > - {t("menus.header.help")} - - { - window.open("https://imexrescue.com/", "_blank"); - }} - > - {t("menus.header.rescueme")} - - - {t("menus.header.shiftclock")} - - - {t("menus.currentuser.profile")} - - { - // - // - // {t("menus.currentuser.languageselector")} - // - // } - // > - // - // {t("general.languages.english")} - // - // - // {t("general.languages.french")} - // - // - // {t("general.languages.spanish")} - // - // - } - - }> - {recentItems.map((i, idx) => ( - - {i.label} - - ))} - - - - ); + { + key: 'readyjobs', + icon: , + label: ({t("menus.header.readyjobs")}) + }, + { + key: 'parts-queue', + icon: , + label: ({t("menus.header.parts-queue")}) + }, + { + key: 'availablejobs', + icon: , + label: ({t("menus.header.availablejobs")}) + }, + { + key: 'newjob', + icon: , + label: ({t("menus.header.newjob")}) + }, + { + type: 'divider', + }, + { + key: 'alljobs', + icon: , + label: ({t("menus.header.alljobs")}) + }, + { + key: 'productionlist', + icon: , + label: ({t("menus.header.productionlist")}) + }, + { + key: 'productionboard', + icon: , + label: ({t("menus.header.productionboard")}) + }, + { + type: 'divider', + }, + { + key: 'scoreboard', + icon: , + label: ({t("menus.header.scoreboard")}) + }, + ] + }, + { + key: 'customers', + icon: , + label: t("menus.header.customers"), + children: [ + { + key: 'owners', + icon: , + label: ({t("menus.header.owners")}) + }, + { + key: 'vehicles', + icon: , + label: ({t("menus.header.vehicles")}) + }, + ] + }, + { + key: 'ccs', + icon: , + label: t("menus.header.courtesycars"), + children: [ + { + key: 'courtesycarsall', + icon: , + label: ({t("menus.header.courtesycars-all")}) + }, + { + key: 'contracts', + icon: , + label: ({t("menus.header.courtesycars-contracts")}) + }, + { + key: 'newcontract', + icon: , + label: ({t("menus.header.courtesycars-newcontract")}) + }, + ] + }, + { + key: 'accounting', + icon: , + label: t("menus.header.accounting"), + children: accountingChildren, + }, + { + key: 'phonebook', + icon: , + label: ({t("menus.header.phonebook")}) + }, + { + key: 'temporarydocs', + icon: , + label: ({t("menus.header.temporarydocs")}) + }, + { + key: 'shopsubmenu', + icon: , + label: t("menus.header.shop"), + children: [ + { + key: 'shop', + icon: , + label: ({t("menus.header.shop_config")}) + }, + { + key: 'dashboard', + icon: , + label: ({t("menus.header.dashboard")}) + }, + { + key: 'reportcenter', + icon: , + label: t("menus.header.reportcenter"), + onClick: () => { + setReportCenterContext({ + actions: {}, + context: {}, + }); + } + }, + { + key: 'shop-vendors', + icon: , + label: ({t("menus.header.shop_vendors")}) + }, + { + key: 'shop-csi', + icon: , + label: ({t("menus.header.shop_csi")}) + }, + ] + }, + { + key: 'user', + label: ( + currentUser.displayName || + currentUser.email || + t("general.labels.unknown") + ), + children: [ + { + key: 'signout', + icon: , + danger: true, + label: t("user.actions.signout"), + onClick: () => signOutStart() + }, + { + key: 'help', + icon: , + label: t("menus.header.help"), + onClick: () => { + window.open("https://help.imex.online/", "_blank"); + } + }, + { + key: 'rescue', + icon: , + label: t("menus.header.rescueme"), + onClick: () => { + window.open("https://imexrescue.com/", "_blank"); + } + }, + { + key: 'shiftclock', + icon: , + label: ({t("menus.header.shiftclock")}) + }, + { + key: 'profile', + icon: , + label: ({t("menus.currentuser.profile")}) + }, + // { + // key: 'langselecter', + // label: t("menus.currentuser.languageselector"), + // children: [ + // { + // key: 'en-US', + // label: t("general.languages.english"), + // onClick: () => { + // window.location.href = "/?lang=en-US"; + // } + // }, + // { + // key: 'fr-CA', + // label: t("general.languages.french"), + // onClick: () => { + // window.location.href = "/?lang=fr-CA"; + // } + // }, + // { + // key: 'es-MX', + // label: t("general.languages.spanish"), + // onClick: () => { + // window.location.href = "/?lang=es-MX"; + // } + // }, + // ] + // }, + ] + }, + { + key: 'recent', + icon: , + children: recentItems.map((i, idx) => ({ + key: idx, + label: ({i.label}) + + })), + } + ] + + return ( + + + + + ); } export default connect(mapStateToProps, mapDispatchToProps)(Header); diff --git a/client/src/components/job-at-change/schedule-event.color.component.jsx b/client/src/components/job-at-change/schedule-event.color.component.jsx index d997834e3..7d72ef71f 100644 --- a/client/src/components/job-at-change/schedule-event.color.component.jsx +++ b/client/src/components/job-at-change/schedule-event.color.component.jsx @@ -54,7 +54,7 @@ export function ScheduleEventColor({ bodyshop, event }) { label: color.label, style: { color: color.color.hex }, })), - { key: "divider", label:
, disabled: true }, + { type: "divider" }, { key: "null", label: t("general.actions.clear") }, ] }; diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 0aaf1d953..b1c67ac1b 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -416,7 +416,7 @@ export function JobLinesComponent({ { key: "PAN", label: t("joblines.fields.part_types.PAN") }, { key: "PAL", label: t("joblines.fields.part_types.PAL") }, { key: "PAS", label: t("joblines.fields.part_types.PAS") }, - { key: "divider", label:
, disabled: true }, + { type: 'divider' }, { key: "clear", label: t("general.labels.clear") }, ] } diff --git a/client/src/components/jobs-change-status/jobs-change-status.component.jsx b/client/src/components/jobs-change-status/jobs-change-status.component.jsx index 724e57cc0..13ae86721 100644 --- a/client/src/components/jobs-change-status/jobs-change-status.component.jsx +++ b/client/src/components/jobs-change-status/jobs-change-status.component.jsx @@ -89,7 +89,7 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) { })), ...(job.converted ? [ - { key: "divider", label:
, disabled: true }, + { type: "divider" }, ...otherStages.map((item) => ({ key: item, label: item,