updates to page pre-reqs
This commit is contained in:
parent
4eabf29468
commit
446a82def7
1 changed files with 33 additions and 8 deletions
|
|
@ -95,6 +95,7 @@ export default {
|
|||
},
|
||||
mixins: [BaseFormMixin],
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
console.log('beforeRouteEnter just called');
|
||||
useMainStore().createSubmittedOrder();
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
|
@ -271,12 +272,13 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
console.log('arePagePrereqsValid was just called');
|
||||
if (useMainStore().hasSubmittedOrder) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Service Location
|
||||
const { serviceLocation } = this.submittedOrder;
|
||||
const { serviceLocation } = useMainStore().order;
|
||||
const mobileReqs = !!(
|
||||
serviceLocation.address
|
||||
&& serviceLocation.city
|
||||
|
|
@ -284,7 +286,7 @@ export default {
|
|||
&& serviceLocation.zipCode
|
||||
);
|
||||
|
||||
const { providerLocation } = this.submittedOrder.serviceLocation.provider.address;
|
||||
const { providerLocation } = serviceLocation.provider.address;
|
||||
const dropOffInShopReqs = !!(
|
||||
providerLocation.streetAddress
|
||||
&& providerLocation.city
|
||||
|
|
@ -298,15 +300,38 @@ export default {
|
|||
const serviceLocationReqs =
|
||||
(isMobile && mobileReqs) || (!isMobile && dropOffInShopReqs);
|
||||
|
||||
// Insurance
|
||||
const isInsuranceSet = useMainStore().order.payment.isInsurance !== null;
|
||||
|
||||
// Schedule
|
||||
const { schedule } = this.submittedOrder;
|
||||
const scheduleReqs = !!(schedule.date && schedule.startTime && schedule.endTime);
|
||||
const { schedule } = useMainStore().order;
|
||||
const scheduleReqs = !!(
|
||||
schedule.date
|
||||
&& schedule.startTime
|
||||
&& schedule.endTime
|
||||
&& schedule.jobMaxMinutes
|
||||
&& schedule.jobMinMinutes
|
||||
);
|
||||
|
||||
// Customer
|
||||
const { customer } = this.submittedOrder;
|
||||
const customerReqs = !!customer.emailAddress;
|
||||
// Contact Info
|
||||
const { contactInfo } = useMainStore().order;
|
||||
const contactInfoReqs = !!(
|
||||
contactInfo.firstName
|
||||
&& contactInfo.lastName
|
||||
&& contactInfo.phoneNumber
|
||||
&& contactInfo.emailAddress
|
||||
);
|
||||
|
||||
return serviceLocationReqs && scheduleReqs && customerReqs;
|
||||
// Payment
|
||||
const paymentMethodReqs = useMainStore().order.payment.isPayInAdvance === false;
|
||||
|
||||
return (
|
||||
serviceLocationReqs
|
||||
&& isInsuranceSet
|
||||
&& scheduleReqs
|
||||
&& contactInfoReqs
|
||||
&& paymentMethodReqs
|
||||
);
|
||||
},
|
||||
forwardButtonAction() {
|
||||
this.$router.navigateToExternalUrl(this.carrierUrl);
|
||||
|
|
|
|||
Loading…
Reference in a new issue