diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 391004a70..3912979ea 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -192,7 +192,12 @@ export default { vm.selectedWindshieldOptions.selectedWindshieldReplaceOptions.push( damageLocationsSelected.SINGLE ); - return vm.forwardButtonAction(); + if ( + store.getters.externalParameterState.isExternalParameter && + store.getters.externalParameterDamage.damageType !== "other" + ) { + return vm.forwardButtonAction(); + } } baseMixin.methods.ResetExternalParamsAndHideModal(); } diff --git a/src/store/index.js b/src/store/index.js index 753d8509b..4f360cc18 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3621,25 +3621,25 @@ export function mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItem export function getArrayOfAllLineItemsAndChildParts(lineItems) { let consolidatedLineItemsArray = []; - if (lineItems.glassParts != null) + if (lineItems?.glassParts != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.glassParts), ]; - if (lineItems.supportingItems != null) + if (lineItems?.supportingItems != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.supportingItems), ]; - if (lineItems.vaps != null) + if (lineItems?.vaps != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.vaps), ]; - if (lineItems.promos != null) + if (lineItems?.promos != null) consolidatedLineItemsArray = [ ...consolidatedLineItemsArray, ...getFlattenedArrayOfLineItemsWithChildParts(lineItems.promos), @@ -3789,7 +3789,15 @@ function supportingItemsEqual(supportingItemsA, supportingItemsB) { // if so, make sure it's not in the past. if in the past, clear schedule info in store. // if date not in past, then call schedule service to verify appointment is still available. async function resetScheduleIfUnavailable(context, order, pageNameToLog) { - if (!order.schedule?.date) { + // lineItems empty can happen when a customer goes all the way through scheduling as cash but then + // switches to insurance AND also switches vehicles during policy lookup. If you call shop-time-slots + // without parts, you get 500 errors so skip the call. + const lineItems = getArrayOfAllLineItemsAndChildParts(order.lineItems); + + if (!order.schedule?.date || lineItems.length === 0) { + console.log(new Date() + " no schedule date or lineItems. skip resetSchedule logic."); + console.log(new Date() + " schedule.schedule.date" + JSON.stringify(order.schedule)); + console.log(new Date() + " lineItems" + JSON.stringify(order.lineItems)); return; }