From 053c4fcdcb064399170be01ac6dfd42cd15f438b Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 24 Mar 2021 16:23:48 -0700
Subject: [PATCH] IO-586 Resolve CSI texting issues.
---
bodyshop_translations.babel | 63 +++++++++++++++++++
.../chat-media-selector.component.jsx | 2 +-
...bs-detail-header-actions.csi.component.jsx | 42 +++++++++----
client/src/translations/en_us/common.json | 3 +
client/src/translations/es/common.json | 3 +
client/src/translations/fr/common.json | 3 +
6 files changed, 104 insertions(+), 12 deletions(-)
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index cefdf5565..f3cad4697 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -10759,6 +10759,27 @@
+
+ copylink
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
create
false
@@ -14292,6 +14313,27 @@
+
+ generatecsi
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
gotojob
false
@@ -21932,6 +21974,27 @@
+
+ rescueme
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
schedule
false
diff --git a/client/src/components/chat-media-selector/chat-media-selector.component.jsx b/client/src/components/chat-media-selector/chat-media-selector.component.jsx
index 47371bdd4..1004f5dbf 100644
--- a/client/src/components/chat-media-selector/chat-media-selector.component.jsx
+++ b/client/src/components/chat-media-selector/chat-media-selector.component.jsx
@@ -24,7 +24,7 @@ export function ChatMediaSelector({
conversation,
}) {
const { t } = useTranslation();
- console.log("conversation", conversation);
+
const { loading, error, data } = useQuery(GET_DOCUMENTS_BY_JOB, {
variables: {
jobId:
diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx
index b2ab847ac..70a009a05 100644
--- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx
+++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx
@@ -46,7 +46,7 @@ export function JobsDetailHeaderCsi({
logImEXEvent("job_create_csi");
//Is tehre already a CSI?
- if (job.csi_invites.length === 0) {
+ if (!job.csiinvites || job.csiinvites.length === 0) {
const questionSetResult = await client.query({
query: GET_CURRENT_QUESTIONSET_ID,
});
@@ -110,10 +110,10 @@ export function JobsDetailHeaderCsi({
if (e.key === "text") {
const p = parsePhoneNumber(job.ownr_ph1, "CA");
if (p && p.isValid()) {
- // openChatByPhone({
- // phone_num: p.formatInternational(),
- // jobid: job.id,
- // });
+ openChatByPhone({
+ phone_num: p.formatInternational(),
+ jobid: job.id,
+ });
setMessage(
`${window.location.protocol}//${window.location.host}/csi/${result.data.insert_csi.returning[0].id}`
);
@@ -123,6 +123,12 @@ export function JobsDetailHeaderCsi({
});
}
}
+ if (e.key === "generate") {
+ //copy it to clipboard.
+ navigator.clipboard.writeText(
+ `${window.location.protocol}//${window.location.host}/csi/${result.data.insert_csi.returning[0].id}`
+ );
+ }
} else {
notification["error"]({
message: t("csi.errors.notconfigured"),
@@ -138,7 +144,7 @@ export function JobsDetailHeaderCsi({
template: {
name: TemplateList("job").csi_invitation.key,
variables: {
- id: job.csi_invites[0].id,
+ id: job.csiinvites[0].id,
},
},
});
@@ -146,12 +152,12 @@ export function JobsDetailHeaderCsi({
if (e.key === "text") {
const p = parsePhoneNumber(job.ownr_ph1, "CA");
if (p && p.isValid()) {
- // openChatByPhone({
- // phone_num: p.formatInternational(),
- // jobid: job.id,
- // });
+ openChatByPhone({
+ phone_num: p.formatInternational(),
+ jobid: job.id,
+ });
setMessage(
- `${window.location.protocol}//${window.location.host}/csi/${job.csi_invites[0].id}`
+ `${window.location.protocol}//${window.location.host}/csi/${job.csiinvites[0].id}`
);
} else {
notification["error"]({
@@ -159,6 +165,13 @@ export function JobsDetailHeaderCsi({
});
}
}
+
+ if (e.key === "generate") {
+ //copy it to clipboard.
+ navigator.clipboard.writeText(
+ `${window.location.protocol}//${window.location.host}/csi/${job.csiinvites[0].id}`
+ );
+ }
}
};
@@ -178,6 +191,13 @@ export function JobsDetailHeaderCsi({
>
{t("general.labels.text")}
+ 0}
+ >
+ {t("jobs.actions.generatecsi")}
+
{job.csiinvites.map((item, idx) => {
return item.completedon ? (
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index eba3ba4f0..8bc03ecc1 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -707,6 +707,7 @@
"calculate": "Calculate",
"cancel": "Cancel",
"close": "Close",
+ "copylink": "Copy Link",
"create": "Create",
"delete": "Delete",
"deleteall": "Delete All",
@@ -914,6 +915,7 @@
"export": "Export",
"exportselected": "Export Selected",
"filterpartsonly": "Filter Parts Only",
+ "generatecsi": "Generate CSI & Copy Link",
"gotojob": "Go to Job",
"intake": "Intake",
"manualnew": "Create New Job Manually",
@@ -1306,6 +1308,7 @@
"productionlist": "Production Board - List",
"recent": "Recent Items",
"reportcenter": "Report Center",
+ "rescueme": "Rescue me!",
"schedule": "Schedule",
"scoreboard": "Scoreboard",
"search": {
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 0fe165865..cbf8d7cb7 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -707,6 +707,7 @@
"calculate": "",
"cancel": "",
"close": "",
+ "copylink": "",
"create": "",
"delete": "Borrar",
"deleteall": "",
@@ -914,6 +915,7 @@
"export": "",
"exportselected": "",
"filterpartsonly": "",
+ "generatecsi": "",
"gotojob": "",
"intake": "",
"manualnew": "",
@@ -1306,6 +1308,7 @@
"productionlist": "",
"recent": "",
"reportcenter": "",
+ "rescueme": "",
"schedule": "Programar",
"scoreboard": "",
"search": {
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index 526459af3..d8e896df9 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -707,6 +707,7 @@
"calculate": "",
"cancel": "",
"close": "",
+ "copylink": "",
"create": "",
"delete": "Effacer",
"deleteall": "",
@@ -914,6 +915,7 @@
"export": "",
"exportselected": "",
"filterpartsonly": "",
+ "generatecsi": "",
"gotojob": "",
"intake": "",
"manualnew": "",
@@ -1306,6 +1308,7 @@
"productionlist": "",
"recent": "",
"reportcenter": "",
+ "rescueme": "",
"schedule": "Programme",
"scoreboard": "",
"search": {