From d53c928bdca64e86887dc27b8e28e93f384c348c Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Fri, 7 Jun 2024 15:10:37 +0000 Subject: [PATCH 1/6] Signature bug fixed --- .../js/tasks/components/QuickFillPreview.vue | 7 +++++++ resources/views/tasks/preview.blade.php | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/resources/js/tasks/components/QuickFillPreview.vue b/resources/js/tasks/components/QuickFillPreview.vue index 5cdc27e8a0..294b7528ee 100644 --- a/resources/js/tasks/components/QuickFillPreview.vue +++ b/resources/js/tasks/components/QuickFillPreview.vue @@ -269,6 +269,10 @@ export default { } this.$emit("close"); }, + validateBase64(field) { + var regex = /^data:image\/\w+;base64,/; + return regex.test(field) ? true : false; + }, buttonThisDataFromFullTask(quickFillData) { // If the task does not have a draft yet, use the task data const dataToUse = this.task.draft?.data ?? this.task.data; @@ -284,6 +288,9 @@ export default { // use the value from the quick fill quickFillValue = _.get(quickFillData, field, null); } + if(this.validateBase64(quickFillValue)) { + return; + } // Set the value. This handles nested values using dot notation in 'field' string _.set(draftData, field, quickFillValue); }); diff --git a/resources/views/tasks/preview.blade.php b/resources/views/tasks/preview.blade.php index 2ecd3141b2..cc10318a1a 100644 --- a/resources/views/tasks/preview.blade.php +++ b/resources/views/tasks/preview.blade.php @@ -428,6 +428,10 @@ class="card border-0" this.sendEvent('taskReady', this.task?.id); }); }, + validateBase64(field) { + var regex = /^data:image\/\w+;base64,/; + return regex.test(field) ? true : false; + }, }, mounted() { this.prepareData(); @@ -438,6 +442,8 @@ class="card border-0" window.addEventListener('fillData', event => { const newData = {}; + console.log("Event Detail: ", event.detail); + console.log("screenFields: ", screenFields); screenFields.forEach((field) => { const existingValue = _.get(this.formData, field, null); @@ -450,6 +456,9 @@ class="card border-0" // use the value from the quick fill(event.detail) quickFillValue = _.get(event.detail, field, null); } + if(this.validateBase64(quickFillValue)) { + return; + } // Set the value. This handles nested values using dot notation in 'field' string _.set(newData, field, quickFillValue); }); @@ -461,6 +470,15 @@ class="card border-0" // want to use all data saved in the inbox rule db record, regardless // if the field exists or not. window.addEventListener('fillDataOverwriteExistingFields', event => { + for (let key in event.detail) { + if (event.detail.hasOwnProperty(key)) { + let value = event.detail[key]; + if (this.validateBase64(value)) { + delete this.formData[key]; + delete event.detail[key]; + } + } + } this.formData = _.merge(_.cloneDeep(this.formData), event.detail); }); From 3db20668615ff1fcbea9d7095b67823977a09537 Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Fri, 7 Jun 2024 15:21:03 +0000 Subject: [PATCH 2/6] fixing --- resources/views/tasks/preview.blade.php | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/views/tasks/preview.blade.php b/resources/views/tasks/preview.blade.php index cc10318a1a..bece1741e2 100644 --- a/resources/views/tasks/preview.blade.php +++ b/resources/views/tasks/preview.blade.php @@ -474,7 +474,6 @@ class="card border-0" if (event.detail.hasOwnProperty(key)) { let value = event.detail[key]; if (this.validateBase64(value)) { - delete this.formData[key]; delete event.detail[key]; } } From 714d388c0848591d48a7744f129030a0f3bca4ca Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Fri, 7 Jun 2024 20:36:29 +0000 Subject: [PATCH 3/6] Fixing quickfill signature issue --- resources/js/tasks/components/QuickFillPreview.vue | 10 ++++++---- resources/views/tasks/preview.blade.php | 10 +++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/resources/js/tasks/components/QuickFillPreview.vue b/resources/js/tasks/components/QuickFillPreview.vue index 294b7528ee..3587286f92 100644 --- a/resources/js/tasks/components/QuickFillPreview.vue +++ b/resources/js/tasks/components/QuickFillPreview.vue @@ -280,6 +280,11 @@ export default { const draftData = {}; this.screenFields.forEach((field) => { const existingValue = _.get(dataToUse, field, null); + + if(this.validateBase64(existingValue)) { + _.set(draftData, field, existingValue); + return; + } let quickFillValue; if (existingValue) { // If the value exists in the task data (or task draft data), don't overwrite it @@ -288,10 +293,7 @@ export default { // use the value from the quick fill quickFillValue = _.get(quickFillData, field, null); } - if(this.validateBase64(quickFillValue)) { - return; - } - // Set the value. This handles nested values using dot notation in 'field' string + _.set(draftData, field, quickFillValue); }); diff --git a/resources/views/tasks/preview.blade.php b/resources/views/tasks/preview.blade.php index bece1741e2..193b789a80 100644 --- a/resources/views/tasks/preview.blade.php +++ b/resources/views/tasks/preview.blade.php @@ -442,11 +442,14 @@ class="card border-0" window.addEventListener('fillData', event => { const newData = {}; - console.log("Event Detail: ", event.detail); - console.log("screenFields: ", screenFields); screenFields.forEach((field) => { const existingValue = _.get(this.formData, field, null); + + if(this.validateBase64(existingValue)) { + _.set(newData, field, existingValue); + return; + } let quickFillValue; if (existingValue) { @@ -456,9 +459,6 @@ class="card border-0" // use the value from the quick fill(event.detail) quickFillValue = _.get(event.detail, field, null); } - if(this.validateBase64(quickFillValue)) { - return; - } // Set the value. This handles nested values using dot notation in 'field' string _.set(newData, field, quickFillValue); }); From d57f473a0ebcd221ac67f08892a34222a8109ca8 Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Fri, 7 Jun 2024 20:41:50 +0000 Subject: [PATCH 4/6] Adding comments --- resources/js/tasks/components/QuickFillPreview.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/tasks/components/QuickFillPreview.vue b/resources/js/tasks/components/QuickFillPreview.vue index 3587286f92..befd47948a 100644 --- a/resources/js/tasks/components/QuickFillPreview.vue +++ b/resources/js/tasks/components/QuickFillPreview.vue @@ -293,7 +293,7 @@ export default { // use the value from the quick fill quickFillValue = _.get(quickFillData, field, null); } - + // Set the value. This handles nested values using dot notation in 'field' string _.set(draftData, field, quickFillValue); }); From 34b40b5f59cb9842754ff97a668779ecc13e5bb8 Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Fri, 7 Jun 2024 20:59:59 +0000 Subject: [PATCH 5/6] solving SonarQube --- resources/js/tasks/components/QuickFillPreview.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/tasks/components/QuickFillPreview.vue b/resources/js/tasks/components/QuickFillPreview.vue index befd47948a..c3eb12c5ad 100644 --- a/resources/js/tasks/components/QuickFillPreview.vue +++ b/resources/js/tasks/components/QuickFillPreview.vue @@ -270,8 +270,8 @@ export default { this.$emit("close"); }, validateBase64(field) { - var regex = /^data:image\/\w+;base64,/; - return regex.test(field) ? true : false; + const regex = /^data:image\/\w+;base64,/; + return regex.test(field); }, buttonThisDataFromFullTask(quickFillData) { // If the task does not have a draft yet, use the task data From 9f065a2122b71495f0ef5c7857ba3acf2389fb8a Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Tue, 11 Jun 2024 15:35:47 +0000 Subject: [PATCH 6/6] Solving signature component issue --- resources/js/tasks/components/QuickFillPreview.vue | 9 +++++---- resources/views/tasks/preview.blade.php | 14 ++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/resources/js/tasks/components/QuickFillPreview.vue b/resources/js/tasks/components/QuickFillPreview.vue index c3eb12c5ad..efe5bd8938 100644 --- a/resources/js/tasks/components/QuickFillPreview.vue +++ b/resources/js/tasks/components/QuickFillPreview.vue @@ -281,10 +281,6 @@ export default { this.screenFields.forEach((field) => { const existingValue = _.get(dataToUse, field, null); - if(this.validateBase64(existingValue)) { - _.set(draftData, field, existingValue); - return; - } let quickFillValue; if (existingValue) { // If the value exists in the task data (or task draft data), don't overwrite it @@ -293,6 +289,11 @@ export default { // use the value from the quick fill quickFillValue = _.get(quickFillData, field, null); } + + if(this.validateBase64(quickFillValue)) { + _.set(draftData, field, existingValue); + return; + } // Set the value. This handles nested values using dot notation in 'field' string _.set(draftData, field, quickFillValue); }); diff --git a/resources/views/tasks/preview.blade.php b/resources/views/tasks/preview.blade.php index 193b789a80..73228e45b1 100644 --- a/resources/views/tasks/preview.blade.php +++ b/resources/views/tasks/preview.blade.php @@ -429,8 +429,8 @@ class="card border-0" }); }, validateBase64(field) { - var regex = /^data:image\/\w+;base64,/; - return regex.test(field) ? true : false; + const regex = /^data:image\/\w+;base64,/; + return regex.test(field); }, }, mounted() { @@ -446,10 +446,6 @@ class="card border-0" const existingValue = _.get(this.formData, field, null); - if(this.validateBase64(existingValue)) { - _.set(newData, field, existingValue); - return; - } let quickFillValue; if (existingValue) { @@ -459,8 +455,14 @@ class="card border-0" // use the value from the quick fill(event.detail) quickFillValue = _.get(event.detail, field, null); } + + if(this.validateBase64(quickFillValue)) { + _.set(newData, field, existingValue); + return; + } // Set the value. This handles nested values using dot notation in 'field' string _.set(newData, field, quickFillValue); + }); this.formData = newData;