diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 00a2dffea..fc0daf323 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -86,6 +86,7 @@ const storeActions = { "saveSupportingItemsSuppressingStateResetting", SAVE_VAPS: "saveVaps", SAVE_CUSTOMER_DETAILS: "saveCustomerDetails", + SAVE_SERVICE_LOCATION_TECH_NOTES: "saveServiceLocationTechNotes", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 76d510507..7b57187c2 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -34,11 +34,13 @@ const storeMutations = { UPDATE_SERVICE_ZIP: "updateServiceZip", UPDATE_SERVICE_LOCATION: "updateServiceLocation", + UPDATE_SERVICE_LOCATION_TECH_NOTES: "updateServiceLocationTechNotes", + UPDATE_TECH_NOTES: "updateTechNotes", UPDATE_SCHEDULE: "updateSchedule", UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress", - //CUSTOMER MUTATIONS + // CUSTOMER MUTATIONS UPDATE_CUSTOMER_DETAILS: "updateCustomerDetails", // ORDER MUTATIONS diff --git a/src/digital-components/textarea-question/textarea-question.vue b/src/digital-components/textarea-question/textarea-question.vue index 0ffe5ec0a..83d718976 100644 --- a/src/digital-components/textarea-question/textarea-question.vue +++ b/src/digital-components/textarea-question/textarea-question.vue @@ -54,7 +54,7 @@ export default { }, }, remainingCount() { - return this.maxLength - this.value.length; + return this.maxLength - (this.value?.length ?? 0); }, urgentCountdown() { return this.remainingCount <= this.maxLength * 0.1 ? true : false; diff --git a/src/layouts/customer-details/customer-details.vue b/src/layouts/customer-details/customer-details.vue index 753bf8fc1..be533117f 100644 --- a/src/layouts/customer-details/customer-details.vue +++ b/src/layouts/customer-details/customer-details.vue @@ -32,7 +32,7 @@ + v-model="isSmsOptin" /> { zipCodeCtu: null, }, }, + techNotes: null, }, customer: { + firstName: null, + lastName: null, emailAddress: null, + phoneNumber: null, + isSmsOptin: null, }, damage: { isRepair: null, @@ -272,6 +277,9 @@ export const mutations = { }, }; }, + updateServiceLocationTechNotes(state, techNotes) { + state.order.serviceLocation.techNotes = techNotes; + }, updateSchedule(state, scheduleInfo) { if (scheduleInfo) { state.order.schedule.date = scheduleInfo.date; @@ -281,14 +289,13 @@ export const mutations = { state.order.schedule.jobMaxMinutes = scheduleInfo.jobMaxMinutes; } }, - updateCustomerDetails(state, detailsInfo) { - if (detailsInfo) { - state.order.customerDetails.firstName = detailsInfo.firstName; - state.order.customerDetails.lastName = detailsInfo.lastName; - state.order.customerDetails.email = detailsInfo.email; - state.order.customerDetails.telephone = detailsInfo.telephone; - state.order.customerDetails.textUpdates = detailsInfo.textUpdates; - state.order.customerDetails.techNotes = detailsInfo.techNotes; + updateCustomerDetails(state, customerDetails) { + if (customerDetails) { + state.order.customer.firstName = customerDetails.firstName; + state.order.customer.lastName = customerDetails.lastName; + state.order.customer.emailAddress = customerDetails.emailAddress; + state.order.customer.phoneNumber = customerDetails.phoneNumber; + state.order.customer.isSmsOptin = customerDetails.isSmsOptin; } }, @@ -1966,8 +1973,8 @@ export const actions = { context.commit(storeMutations.UPDATE_SCHEDULE, scheduleInfo); }, - saveDetails(context, scheduleInfo) { - context.commit(storeMutations.UPDATE_DETAILS, scheduleInfo); + saveCustomerDetails(context, customerDetails) { + context.commit(storeMutations.UPDATE_CUSTOMER_DETAILS, customerDetails); }, saveServiceZipCodeInfo(context, serviceZipCodeInfo) { @@ -2001,6 +2008,10 @@ export const actions = { context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo); }, + saveServiceLocationTechNotes(context, techNotesInfo) { + context.commit(storeMutations.UPDATE_SERVICE_LOCATION_TECH_NOTES, techNotesInfo); + }, + saveEmail(context, email) { context.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email === "" ? null : email); },