From 3b756beba694987bebc3cd3f340c2b9ae165452d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Dec 2021 12:32:10 -0800 Subject: [PATCH 1/5] IO-244 IOU updates to remove act price. --- .../job-line-note-popup.component.jsx | 16 +++++++++++----- .../jobs-detail-header-actions.duplicate.util.js | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx b/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx index 7a5c998a4..ccc43ed7f 100644 --- a/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx +++ b/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx @@ -56,17 +56,23 @@ export default function JobLineNotePopup({ jobline, disabled }) { ); return ( -
!disabled && setEditing(true)} - > +
{jobline.ioucreated && ( {t("joblines.labels.ioucreated")} )} - {jobline.notes} +
!disabled && setEditing(true)} + > + {jobline.notes} +
); } diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js index e0c949536..1ddf4f87c 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js @@ -108,6 +108,8 @@ export async function CreateIouForJob( _tempLines.forEach((line) => { delete line.id; delete line.__typename; + line.oem_partno = `line.oem_partno - IOU Price $${line.act_price}` + delete line.act_price; line.manual_line = true; }); From 28cc092bb7772ade564d4f560a577b9f261743fa Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Dec 2021 12:58:56 -0800 Subject: [PATCH 2/5] IO-1551 Include outbound fcm to update timestamps. --- .../chat-send-message.component.jsx | 1 + client/src/utils/fcm-handler.js | 16 ++++++++++++++++ server/sms/receive.js | 2 -- server/sms/send.js | 16 ++++++++++++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/client/src/components/chat-send-message/chat-send-message.component.jsx b/client/src/components/chat-send-message/chat-send-message.component.jsx index 33b5656fa..bc0c0af7c 100644 --- a/client/src/components/chat-send-message/chat-send-message.component.jsx +++ b/client/src/components/chat-send-message/chat-send-message.component.jsx @@ -55,6 +55,7 @@ function ChatSendMessageComponent({ messagingServiceSid: bodyshop.messagingservicesid, conversationid: conversation.id, selectedMedia: selectedImages, + imexshopid: bodyshop.imexshopid, }); setSelectedMedia( selectedMedia.map((i) => { diff --git a/client/src/utils/fcm-handler.js b/client/src/utils/fcm-handler.js index 0418f97cf..0b4999b9c 100644 --- a/client/src/utils/fcm-handler.js +++ b/client/src/utils/fcm-handler.js @@ -14,6 +14,22 @@ export default async function FcmHandler({ client, payload }) { }, }); break; + case "messaging-outbound": + client.cache.modify({ + id: client.cache.identify({ + __typename: "conversations", + id: payload.conversationid, + }), + fields: { + updated_at(oldupdated0) { + return new Date(); + }, + messages_aggregate(cached) { + return { aggregate: { count: cached.aggregate.count + 1 } }; + }, + }, + }); + break; case "messaging-mark-conversation-read": client.cache.modify({ id: client.cache.identify({ diff --git a/server/sms/receive.js b/server/sms/receive.js index 36d30cb34..e081b96b3 100644 --- a/server/sms/receive.js +++ b/server/sms/receive.js @@ -96,8 +96,6 @@ exports.receive = async (req, res) => { type: "messaging-inbound", conversationid: message.conversationid || "", text: message.text || "", - image_path: message.image_path || "", - image: (message.image && message.image.toString()) || "", messageid: message.id || "", phone_num: message.conversation.phone_num || "", }; diff --git a/server/sms/send.js b/server/sms/send.js index f19a51dfd..916cc01aa 100644 --- a/server/sms/send.js +++ b/server/sms/send.js @@ -13,11 +13,12 @@ const logger = require("../utils/logger"); const client = twilio( process.env.TWILIO_AUTH_TOKEN, process.env.TWILIO_AUTH_KEY -); +);const { admin } = require("../firebase/firebase-handler"); + const gqlClient = require("../graphql-client/graphql-client").client; exports.send = (req, res) => { - const { to, messagingServiceSid, body, conversationid, selectedMedia } = + const { to, messagingServiceSid, body, conversationid, selectedMedia, imexshopid } = req.body; logger.log("sms-outbound", "DEBUG", req.user.email, null, { @@ -63,6 +64,17 @@ exports.send = (req, res) => { conversationid, }); + const data = { + type: "messaging-outbound", + conversationid: newMessage.conversationid || "", + + }; + + admin.messaging().send({ + topic: `${imexshopid}-messaging`, + data, + }); + res.sendStatus(200); }) .catch((e2) => { From a933a1d58710efc171951e4ce7018bcd05832c9e Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Dec 2021 13:22:02 -0800 Subject: [PATCH 3/5] IO-1572 Search bill lines by act price. --- .../bill-line-search-select.component.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx index e470fce33..910d29856 100644 --- a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx +++ b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx @@ -20,7 +20,11 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => { .toLowerCase() .includes(inputValue.toLowerCase())) || (option.oem_partno && - option.oem_partno.toLowerCase().includes(inputValue.toLowerCase())) + option.oem_partno + .toLowerCase() + .includes(inputValue.toLowerCase())) || + (option.act_price && + option.act_price.toString().startsWith(inputValue.toString())) ); }} notFoundContent={"Removed."} @@ -40,13 +44,14 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => { line_desc={item.line_desc} part_qty={item.part_qty} oem_partno={item.oem_partno} + act_price={item.act_price} style={{ ...(item.removed ? { textDecoration: "line-through" } : {}), }} > {`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${ item.oem_partno ? ` - ${item.oem_partno}` : "" - }`} + }${item.act_price ? ` - $${item.act_price}` : ``}`} )) : null} From e052a0d23260ba85887a5cc6a785be93fad7ee66 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Dec 2021 13:26:47 -0800 Subject: [PATCH 4/5] IO-1568 Force render manual job creation panels. --- .../jobs-create-jobs-info.component.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx b/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx index a81d64e84..e92970fdf 100644 --- a/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx +++ b/client/src/components/jobs-create-jobs-info/jobs-create-jobs-info.component.jsx @@ -31,6 +31,7 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) { @@ -145,7 +146,7 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) { - + @@ -192,7 +193,7 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) { - From 3c9f66c95c50c7a0c5f3c263cc0a03112f592a40 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Dec 2021 13:54:07 -0800 Subject: [PATCH 5/5] IO-1524 Resolve CC form create issue with decimals. --- .../contract-convert-to-ro.component.jsx | 18 +++++++++--------- .../courtesy-car-form.component.jsx | 2 +- .../courtesy-car-return-modal.component.jsx | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx index e4acf9286..eec385fca 100644 --- a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx +++ b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx @@ -53,7 +53,7 @@ export function ContractConvertToRo({ const billingLines = []; if (contractLength > 0) billingLines.push({ - manual_line:true, + manual_line: true, unq_seq: 1, line_no: 1, line_ref: 1, @@ -71,7 +71,7 @@ export function ContractConvertToRo({ contract.kmend - contract.kmstart - contract.dailyfreekm * contractLength; if (mileageDiff > 0) { billingLines.push({ - manual_line:true, + manual_line: true, unq_seq: 2, line_no: 2, line_ref: 2, @@ -88,7 +88,7 @@ export function ContractConvertToRo({ if (values.refuelqty > 0) { billingLines.push({ - manual_line:true, + manual_line: true, unq_seq: 3, line_no: 3, line_ref: 3, @@ -104,7 +104,7 @@ export function ContractConvertToRo({ } if (values.applyCleanupCharge) { billingLines.push({ - manual_line:true, + manual_line: true, unq_seq: 4, line_no: 4, line_ref: 4, @@ -121,7 +121,7 @@ export function ContractConvertToRo({ if (contract.damagewaiver) { //Add for cleanup fee. billingLines.push({ - manual_line:true, + manual_line: true, unq_seq: 5, line_no: 5, line_ref: 5, @@ -153,10 +153,10 @@ export function ContractConvertToRo({ ownr_co_nm: contract.job.owner.ownr_co_nm, ownr_ph1: contract.job.owner.ownr_ph1, ownr_ea: contract.job.owner.ownr_ea, - v_model_desc: contract.job.vehicle.v_model_desc, - v_model_yr: contract.job.vehicle.v_model_yr, - v_make_desc: contract.job.vehicle.v_make_desc, - v_vin: contract.job.vehicle.v_vin, + v_model_desc: contract.job.vehicle && contract.job.vehicle.v_model_desc, + v_model_yr: contract.job.vehicle && contract.job.vehicle.v_model_yr, + v_make_desc: contract.job.vehicle && contract.job.vehicle.v_make_desc, + v_vin: contract.job.vehicle && contract.job.vehicle.v_vin, status: bodyshop.md_ro_statuses.default_completed, notes: { data: [ diff --git a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx index 78eaa28eb..e9486afa9 100644 --- a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx +++ b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx @@ -118,7 +118,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) { }, ]} > - + - +