From fd9a51209faf463cf06c19aa1539d54010b6bd35 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 10 Sep 2024 11:21:03 -0700 Subject: [PATCH] IO-2913 ADP Payroll Reports Uses ADPPayroll Split Signed-off-by: Allan Carr --- .../report-center-modal.component.jsx | 46 ++++++++++++------- .../shop-info/shop-info.general.component.jsx | 33 +++++++------ client/src/translations/en_us/common.json | 2 + client/src/translations/es/common.json | 2 + client/src/translations/fr/common.json | 2 + client/src/utils/TemplateConstants.js | 26 +++++++++++ 6 files changed, 82 insertions(+), 29 deletions(-) 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 index 71439f287..974e62de7 100644 --- a/client/src/components/report-center-modal/report-center-modal.component.jsx +++ b/client/src/components/report-center-modal/report-center-modal.component.jsx @@ -34,28 +34,34 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) { const [form] = Form.useForm(); const [search, setSearch] = useState(""); const { - treatments: { Enhanced_Payroll } + treatments: { Enhanced_Payroll, ADPPayroll } } = useSplitTreatments({ attributes: {}, - names: ["Enhanced_Payroll"], + names: ["Enhanced_Payroll", "ADPPayroll"], splitKey: bodyshop.imexshopid }); const [loading, setLoading] = useState(false); const { t } = useTranslation(); const Templates = TemplateList("report_center"); - const ReportsList = - Enhanced_Payroll.treatment === "on" - ? Object.keys(Templates) - .map((key) => { - return Templates[key]; - }) - .filter((temp) => temp.enhanced_payroll === undefined || temp.enhanced_payroll === true) - : Object.keys(Templates) - .map((key) => { - return Templates[key]; - }) - .filter((temp) => temp.enhanced_payroll === undefined || temp.enhanced_payroll === false); + const ReportsList = Object.keys(Templates) + .map((key) => Templates[key]) + .filter((temp) => { + const enhancedPayrollOn = Enhanced_Payroll.treatment === "on"; + const adpPayrollOn = ADPPayroll.treatment === "on"; + + if (enhancedPayrollOn && adpPayrollOn) { + return temp.enhanced_payroll !== false || temp.adp_payroll !== false; + } + if (enhancedPayrollOn) { + return temp.enhanced_payroll !== false && temp.adp_payroll !== true; + } + if (adpPayrollOn) { + return temp.adp_payroll !== false && temp.enhanced_payroll !== true; + } + + return temp.enhanced_payroll !== true && temp.adp_payroll !== true; + }); const { open } = reportCenterModal; @@ -104,7 +110,7 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) { to: values.to, subject: Templates[values.key]?.subject }, - values.sendbyexcel === "excel" ? "x" : values.sendby === "email" ? "e" : "p", + values.sendbytext === "text" ? values.sendbytext : values.sendbyexcel === "excel" ? "x" : values.sendby === "email" ? "e" : "p", id ); setLoading(false); @@ -291,7 +297,15 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) { ); - if (reporttype !== "excel") + if (reporttype === "text") + return ( + + + {t("general.labels.text")} + + + ); + if (reporttype !== "excel" || reporttype !== "text") return ( diff --git a/client/src/components/shop-info/shop-info.general.component.jsx b/client/src/components/shop-info/shop-info.general.component.jsx index 20cc88d36..2a62fdead 100644 --- a/client/src/components/shop-info/shop-info.general.component.jsx +++ b/client/src/components/shop-info/shop-info.general.component.jsx @@ -7,13 +7,13 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import DatePickerRanges from "../../utils/DatePickerRanges"; +import InstanceRenderManager from "../../utils/instanceRenderMgr"; +import FeatureWrapper, { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component"; import FormItemEmail from "../form-items-formatted/email-form-item.component"; import PhoneFormItem, { PhoneItemFormatterValidation } from "../form-items-formatted/phone-form-item.component"; import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; -import InstanceRenderManager from "../../utils/instanceRenderMgr"; -import FeatureWrapper, { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component"; // TODO: Client Update, this might break const timeZonesList = Intl.supportedValuesOf("timeZone"); const mapStateToProps = createStructuredSelector({ @@ -28,10 +28,10 @@ export function ShopInfoGeneral({ form, bodyshop }) { const { t } = useTranslation(); const { - treatments: { ClosingPeriod } + treatments: { ClosingPeriod, ADPPayroll } } = useSplitTreatments({ attributes: {}, - names: ["ClosingPeriod"], + names: ["ClosingPeriod", "ADPPayroll"], splitKey: bodyshop && bodyshop.imexshopid }); @@ -98,7 +98,6 @@ export function ShopInfoGeneral({ form, bodyshop }) { - {ClosingPeriod.treatment === "on" && ( - <> - - - - + + + + )} + {ADPPayroll.treatment === "on" && ( + + + + )} + {ADPPayroll.treatment === "on" && ( + + + )} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 12795c272..45ea63ff1 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2927,6 +2927,8 @@ "vendor": "Vendor" }, "templates": { + "adp_payroll_flat": "ADP Payroll - Flat Rate", + "adp_payroll_straight": "ADP Payroll - Straight Time", "anticipated_revenue": "Anticipated Revenue", "ar_aging": "AR Aging", "attendance_detail": "Attendance (All Employees)", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 91bb9417c..3765acb6c 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2927,6 +2927,8 @@ "vendor": "" }, "templates": { + "adp_payroll_flat": "", + "adp_payroll_straight": "", "anticipated_revenue": "", "ar_aging": "", "attendance_detail": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 642bf0c41..41b3c154a 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2927,6 +2927,8 @@ "vendor": "" }, "templates": { + "adp_payroll_flat": "", + "adp_payroll_straight": "", "anticipated_revenue": "", "ar_aging": "", "attendance_detail": "", diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 2aa482fb6..4fdcf6e3e 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -2158,6 +2158,32 @@ export const TemplateList = (type, context) => { field: i18n.t("tasks.fields.created_at") }, group: "jobs" + }, + adp_payroll_flat: { + title: i18n.t("reportcenter.templates.adp_payroll_flat"), + subject: i18n.t("reportcenter.templates.adp_payroll_flat"), + key: "adp_payroll_flat", + reporttype: "text", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.timetickets"), + field: i18n.t("timetickets.fields.committed_at") + }, + group: "payroll", + adp_payroll: true + }, + adp_payroll_straight: { + title: i18n.t("reportcenter.templates.adp_payroll_straight"), + subject: i18n.t("reportcenter.templates.adp_payroll_straight"), + key: "adp_payroll_straight", + reporttype: "text", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.timetickets"), + field: i18n.t("timetickets.fields.date") + }, + group: "payroll", + adp_payroll: true } } : {}),