Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Signature bug fixed
  • Loading branch information
CarliPinell committed Jun 7, 2024
commit d53c928bdca64e86887dc27b8e28e93f384c348c
7 changes: 7 additions & 0 deletions resources/js/tasks/components/QuickFillPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
});
Expand Down
18 changes: 18 additions & 0 deletions resources/views/tasks/preview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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);
});
Expand All @@ -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);
});

Expand Down