diff --git a/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx b/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx index ed3eace05..c8b85be38 100644 --- a/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx +++ b/client/src/components/schedule-job-modal/schedule-job-modal.container.jsx @@ -16,13 +16,17 @@ import { QUERY_LBR_HRS_BY_PK, UPDATE_JOBS } from "../../graphql/jobs.queries"; import { setEmailOptions } from "../../redux/email/email.actions"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectSchedule } from "../../redux/modals/modals.selectors"; -import { selectBodyshop } from "../../redux/user/user.selectors"; +import { + selectBodyshop, + selectCurrentUser, +} from "../../redux/user/user.selectors"; import { TemplateList } from "../../utils/TemplateConstants"; import ScheduleJobModalComponent from "./schedule-job-modal.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, scheduleModal: selectSchedule, + currentUser: selectCurrentUser, }); const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("schedule")), @@ -34,6 +38,7 @@ export function ScheduleJobModalContainer({ bodyshop, toggleModalVisible, setEmailOptions, + currentUser, }) { const { visible, context, actions } = scheduleModal; const { jobId, job, previousEvent } = context; @@ -122,6 +127,7 @@ export function ScheduleJobModalContainer({ end: moment(values.start).add(bodyshop.appt_length || 60, "minutes"), color: values.color, note: values.note, + created_by: currentUser.email, }, jobId: jobId, altTransport: values.alt_transport, diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 978bc7ccd..4950b5944 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2597,6 +2597,7 @@ "open_orders_csr": "Open Orders by CSR", "open_orders_estimator": "Open Orders by Estimator", "open_orders_ins_co": "Open Orders by Insurance Company", + "open_orders_referral": "Open Orders by Referral Source", "open_orders_specific_csr": "Open Orders filtered by CSR", "open_orders_status": "Open Orders by Status", "parts_backorder": "IOU Parts List", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index c687b79d5..2f3fca133 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2597,6 +2597,7 @@ "open_orders_csr": "", "open_orders_estimator": "", "open_orders_ins_co": "", + "open_orders_referral": "", "open_orders_specific_csr": "", "open_orders_status": "", "parts_backorder": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index d11d96044..4dba2e141 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2597,6 +2597,7 @@ "open_orders_csr": "", "open_orders_estimator": "", "open_orders_ins_co": "", + "open_orders_referral": "", "open_orders_specific_csr": "", "open_orders_status": "", "parts_backorder": "", diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index cc1c4011a..79d9aa353 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -1502,6 +1502,19 @@ export const TemplateList = (type, context) => { }, group: "jobs", }, + open_orders_specific_csr: { + title: i18n.t("reportcenter.templates.open_orders_specific_csr"), + description: "", + subject: i18n.t("reportcenter.templates.open_orders_specific_csr"), + key: "open_orders_specific_csr", + idtype: "employee", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.jobs"), + field: i18n.t("jobs.fields.date_open"), + }, + group: "jobs", + }, open_orders_estimator: { title: i18n.t("reportcenter.templates.open_orders_estimator"), description: "", @@ -1528,12 +1541,12 @@ export const TemplateList = (type, context) => { }, group: "jobs", }, - open_orders_specific_csr: { - title: i18n.t("reportcenter.templates.open_orders_specific_csr"), + open_orders_referral: { + title: i18n.t("reportcenter.templates.open_orders_referral"), description: "", - subject: i18n.t("reportcenter.templates.open_orders_specific_csr"), - key: "open_orders_specific_csr", - idtype: "employee", + subject: i18n.t("reportcenter.templates.open_orders_referral"), + key: "open_orders_referral", + //idtype: "vendor", disabled: false, rangeFilter: { object: i18n.t("reportcenter.labels.objects.jobs"), diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 701637a9c..69f30251b 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -110,6 +110,7 @@ - canceled - color - created_at + - created_by - end - id - isintake @@ -128,6 +129,7 @@ - canceled - color - created_at + - created_by - end - id - isintake @@ -156,6 +158,7 @@ - canceled - color - created_at + - created_by - end - id - isintake diff --git a/hasura/migrations/1698709322872_alter_table_public_appointments_add_column_created_by/down.sql b/hasura/migrations/1698709322872_alter_table_public_appointments_add_column_created_by/down.sql new file mode 100644 index 000000000..9562a8171 --- /dev/null +++ b/hasura/migrations/1698709322872_alter_table_public_appointments_add_column_created_by/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."appointments" add column "created_by" text +-- null; diff --git a/hasura/migrations/1698709322872_alter_table_public_appointments_add_column_created_by/up.sql b/hasura/migrations/1698709322872_alter_table_public_appointments_add_column_created_by/up.sql new file mode 100644 index 000000000..ef7952cf3 --- /dev/null +++ b/hasura/migrations/1698709322872_alter_table_public_appointments_add_column_created_by/up.sql @@ -0,0 +1,2 @@ +alter table "public"."appointments" add column "created_by" text + null; diff --git a/server/data/claimscorp.js b/server/data/claimscorp.js index a854ff84f..60943aed3 100644 --- a/server/data/claimscorp.js +++ b/server/data/claimscorp.js @@ -17,7 +17,7 @@ let Client = require("ssh2-sftp-client"); const client = require("../graphql-client/graphql-client").client; const { sendServerEmail } = require("../email/sendemail"); const CCDineroFormat = "0,0.00"; -const AhDateFormat = "MMDDYYYY"; +const AhDateFormat = "MM/DD/YYYY"; const repairOpCodes = ["OP4", "OP9", "OP10"]; const replaceOpCodes = ["OP2", "OP5", "OP11", "OP12"]; @@ -104,7 +104,7 @@ exports.default = async (req, res) => { allxmlsToUpload.push({ count: claimsCorpObject.DataFeed.ShopInfo.RO.length, xml: ret, - filename: `${bodyshop.claimscorpid}-MIS-${moment().format( + filename: `${bodyshop.claimscorpid}-${moment().format( "YYYYMMDDTHHMMss" )}.xml`, }); @@ -245,7 +245,7 @@ const CreateRepairOrderTag = (job, errorCallback) => { try { const ret = { - RONumber: job.ro_number, + RoNumber: job.ro_number, Customer: { CustomerZip: (job.ownr_zip && job.ownr_zip.substring(0, 3)) || "", CustomerState: job.ownr_st || "", @@ -312,7 +312,7 @@ const CreateRepairOrderTag = (job, errorCallback) => { (job.date_estimated && moment(job.date_estimated).format(AhDateFormat)) || "", - DateofLoss: + DateLoss: (job.loss_date && moment(job.loss_date).format(AhDateFormat)) || "", DateFNOL: "", DateContact: "", @@ -384,7 +384,7 @@ const CreateRepairOrderTag = (job, errorCallback) => { "", BilledDate: "", PaidInFullDate: "", - RoStatus: job.tlos_ind + ROStatus: job.tlos_ind ? "TOT" : StatusMapping(job.status, job.bodyshop.md_ro_statuses), }, @@ -397,9 +397,7 @@ const CreateRepairOrderTag = (job, errorCallback) => { Paint: Dinero(job.job_totals.rates.lar.total).toFormat(CCDineroFormat), Prep: Dinero().toFormat(CCDineroFormat), Frame: Dinero(job.job_totals.rates.laf.total).toFormat(CCDineroFormat), - Mechanical: Dinero(job.job_totals.rates.lam.total).toFormat( - CCDineroFormat - ), + Mech: Dinero(job.job_totals.rates.lam.total).toFormat(CCDineroFormat), Glass: Dinero(job.job_totals.rates.lag.total).toFormat(CCDineroFormat), Elec: Dinero(job.job_totals.rates.lae.total).toFormat(CCDineroFormat), Detail: detailAdjustments.amount.toFormat(CCDineroFormat), @@ -481,7 +479,7 @@ const CreateRepairOrderTag = (job, errorCallback) => { .filter((line) => repairOpCodes.includes(line.lbr_op)) .reduce((acc, val) => acc + val.mod_lb_hrs, 0) .toFixed(2), - BodyReplaceHours: job.joblines + BodyReplacehours: job.joblines .filter((line) => replaceOpCodes.includes(line.lbr_op)) .reduce((acc, val) => acc + val.mod_lb_hrs, 0) .toFixed(2), @@ -523,7 +521,7 @@ const CreateRepairOrderTag = (job, errorCallback) => { AM: repairCosts.PartsAMCost.toFormat(CCDineroFormat), MechParts: Dinero().toFormat(CCDineroFormat), OtherParts: Dinero().toFormat(CCDineroFormat), //Check Synergy - OtherCosts: repairCosts.PartsOtherCost.toFormat(CCDineroFormat), + OtherCost: repairCosts.PartsOtherCost.toFormat(CCDineroFormat), Sublet: repairCosts.SubletTotalCost.toFormat(CCDineroFormat), Towing: repairCosts.TowingTotalCost.toFormat(CCDineroFormat), Storage: repairCosts.StorageTotalCost.toFormat(CCDineroFormat),