diff --git a/public/css/README.md b/public/css/README.md index f08e6c6d7..74cd82e39 100644 --- a/public/css/README.md +++ b/public/css/README.md @@ -3,11 +3,11 @@ This public/css folder uses a standalone .scss > .css setup. ## Usage -From a Terminal window, run the Sass Watch command on this folder only: +From a Terminal window, run the Sass Watch command from the public folder only: ```bash -sass --no-source-map --watch public/css/hop-styling.scss:public/css/hop-styling.css +sass --no-source-map --watch scss:css ``` -This will output a CSS file that can be consumed by the Payment page. +This will compile and output .css files (into the public/css folder) that can be consumed by the Payment page. -# Do not use the .css file on its own. You must use the .scss file and have Sass compile it to the .css file. +# Do not use the .css files on their own. You must use the .scss files and have Sass compile them to .css files. diff --git a/public/css/site-2020Styling.css b/public/css/site-2020Styling.css new file mode 100644 index 000000000..05232bd31 --- /dev/null +++ b/public/css/site-2020Styling.css @@ -0,0 +1,87 @@ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* Style the modal when PayPal button is selected */ +#pageLoadingModal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.35); + display: flex; +} +#pageLoadingModal .modal-content { + margin: auto auto; +} +#pageLoadingModal p { + margin: 0; + text-transform: uppercase; + font-size: 14px; +} +#pageLoadingModal .modal { + display: none; + overflow: hidden; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + -webkit-overflow-scrolling: touch; + outline: 0; +} +#pageLoadingModal .modal-content { + position: relative; + background-color: #fff; + border-radius: 8px; + background-clip: padding-box; + outline: 0; + width: 168px; + height: 168px; + display: flex; + justify-content: center; + align-items: center; +} +#pageLoadingModal .modal-content:before, #pageLoadingModal .modal-content:after { + content: ""; + border-radius: 50%; + position: absolute; + inset: 0; + box-shadow: 0 0 3px 2px rgba(0, 0, 0, 0.25) inset; + top: 24px; + bottom: 24px; + right: 24px; + left: 24px; +} +#pageLoadingModal .modal-content:after { + box-shadow: 0 3px 0 #da291c inset; + animation: rotate 1s linear infinite; +} +#pageLoadingModal .modal-backdrop { + position: absolute; + top: 0; + right: 0; + left: 0; + background-color: #000000; +} +#pageLoadingModal .modal-backdrop.fade { + opacity: 0; + filter: alpha(opacity=0); +} + +@keyframes rotate { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } +} +.creditCardSpecific { + display: none; +} diff --git a/public/css/hop-styling.scss b/public/scss/hop-styling.scss similarity index 100% rename from public/css/hop-styling.scss rename to public/scss/hop-styling.scss diff --git a/public/scss/site-2020Styling.scss b/public/scss/site-2020Styling.scss new file mode 100644 index 000000000..3f52f4b9e --- /dev/null +++ b/public/scss/site-2020Styling.scss @@ -0,0 +1,91 @@ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ +/* IMPORTANT: READ README.md in this folder! Do not edit .css file directly! */ + +/* Style the modal when PayPal button is selected */ +#pageLoadingModal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + width: 100%; + height: 100%; + background-color: rgba(0,0,0,.35); + display: flex; + + .modal-content { + margin: auto auto; + } + + p { + margin: 0; + text-transform: uppercase; + font-size: 14px; + } + + .modal { + display: none; + overflow: hidden; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + -webkit-overflow-scrolling: touch; + outline: 0; + } + + .modal-content { + position: relative; + background-color: #fff; + border-radius: 8px; + background-clip: padding-box; + outline: 0; + width: 168px; + height: 168px; + display: flex; + justify-content: center; + align-items: center; + &:before, + &:after { + content: ''; + border-radius: 50%; + position: absolute; + inset: 0; + box-shadow: 0 0 3px 2px rgba(0, 0, 0, 0.25) inset; + top: 24px; + bottom: 24px; + right: 24px; + left: 24px; + } + &:after { + box-shadow: 0 3px 0 #da291c inset; + animation: rotate 1s linear infinite; + } + } + + .modal-backdrop { + position: absolute; + top: 0; + right: 0; + left: 0; + background-color: #000000; + &.fade { + opacity: 0; + filter: alpha(opacity=0); + } + } +} + +@keyframes rotate { + 0% { transform: rotate(0)} + 100% { transform: rotate(360deg)} +} + +.creditCardSpecific { + display: none; +} diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 5adcc5613..b958d5b9f 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -244,7 +244,7 @@ export default { diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 10de5cedf..437fbe743 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -20,6 +20,39 @@ scrolling="no"> +
{{ switchPaymentText }}
+
+ +
+
or
+
+ +
+
or
+
+ +
+ @@ -165,6 +199,7 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { applicationConfig } from "@/constants/application-config"; import { paymentMethods } from "@/constants/payment-method-constants"; +import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import baseMixin from "@/mixins/base-mixin.js"; // Validation @@ -232,6 +267,10 @@ export default { }); }, computed: { + dynamicCSSUrl() { + const { protocol, hostname, port } = window.location; + return `${protocol}//${hostname}:${port}/fmg/css/site-2020Styling.css`; + }, dynamicHopCSSUrl() { const { protocol, hostname, port } = window.location; return `${protocol}//${hostname}:${port}/fmg/css/hop-styling.css`; @@ -248,11 +287,71 @@ export default { } return ""; }, + switchPaymentText() { + return this.getCmsContent("PaymentMethodWidget", "QuestionText"); + }, }, methods: { arePagePrerequisitesValid() { - // TODO - return true; + // Line Items + const packageReqs = !!store.getters.order.lineItems.supportingItems; + + // Service Location + const serviceLocation = store.getters.order.serviceLocation; + const mobileReqs = !!( + serviceLocation.address && + serviceLocation.city && + serviceLocation.state && + serviceLocation.zipCode + ); + + const providerLocation = serviceLocation.provider.address; + const dropOffInshopReqs = !!( + providerLocation.streetAddress && + providerLocation.city && + providerLocation.state && + providerLocation.zipCode + ); + + const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE; + + const serviceLocationReqs = + (isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs); + + // Insurance + const isInsuranceSet = store.getters.order.payment.isInsurance !== null; + + // Schedule + const schedule = store.getters.order.schedule; + const scheduleReqs = !!( + schedule.date && + schedule.startTime && + (!isMobile || schedule.endTime) && + schedule.jobMaxMinutes && + schedule.jobMinMinutes + ); + + // Customer + const customer = store.getters.order.customer; + const customerReqs = !!( + customer.firstName && + customer.lastName && + customer.phoneNumber && + customer.emailAddress + ); + + const paymentMethodReqs = + store.getters.order.payment.isPia !== null && + (store.getters.order.payment.isPia || !!store.getters.order.payment.piaType); + + return ( + packageReqs && + serviceLocationReqs && + isInsuranceSet && + scheduleReqs && + customerReqs && + paymentMethodReqs + ); }, getWOrkOrderNumber() { if (store.getters.order.workOrderNumber) { @@ -345,6 +444,28 @@ export default { window.location = applicationConfig.PIA_CANCEL_URL; //this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, + switchPIAMethod(payMethod) { + this.paymentType = payMethod; + this.submitHopForm(); + }, + submitHopForm() { + this.$nextTick(() => { + this.$refs.hopForm.submit(); + + const iframe = this.$refs.paymentFrame; + if (iframe) { + iframe.onload = () => { + if (iframe.contentWindow) { + if (this.paymentType == "cc") { + iframe.contentWindow.postMessage("CreditCardChosen", "*"); + } else if (this.paymentType == "ap") { + iframe.contentWindow.postMessage("afterpay", "*"); + } + } + }; + } + }); + }, async fetchSignatureInfo(signatureInfo) { if (this.isPaypal()) { this.$refs.loadingModal.showModal(); @@ -354,20 +475,7 @@ export default { this.authSignature = signatureInfo.signature; this.authSignatureStart = signatureInfo.startDate; - this.$nextTick(() => { - this.$refs.myForm.submit(); - - if (this.paymentType == "ap") { - const iframe = this.$refs.paymentFrame; - if (iframe) { - iframe.onload = () => { - if (iframe.contentWindow) { - iframe.contentWindow.postMessage("afterpay", "*"); - } - }; - } - } - }); + this.submitHopForm(); }, }, components: { @@ -385,4 +493,7 @@ export default { width: 100%; border: 0 none; } +#pageLoadingModal { + background-color: red; +}