diff --git a/src/components/Checkout/InContext/InContextCheckout.vue b/src/components/Checkout/InContext/InContextCheckout.vue index 1051f5c3f9e..82ffe94f3af 100644 --- a/src/components/Checkout/InContext/InContextCheckout.vue +++ b/src/components/Checkout/InContext/InContextCheckout.vue @@ -45,102 +45,120 @@
- +
+ - -
- -
- - Continue as a guest - + + + -
-

- For existing users, we recommend you log in with your work email address. -

-
- - - +
+ +
+ + Continue as a guest + + + Continue as an existing user + +
+
+

+ For existing users, we recommend you log in with your work email address. +

+
+
- -
+ + + + +
+
+
import numeral from 'numeral'; import { myFTDQuery, formatTransactionData } from '@/util/checkoutUtils'; +import { joinTeamAndReserveLoans } from '@/util/teamUtils'; import { isCCPage } from '@/util/urlUtils'; import checkoutUtils from '@/plugins/checkout-utils-mixin'; import CheckoutDropInPaymentWrapper from '@/components/Checkout/CheckoutDropInPaymentWrapper'; @@ -161,6 +180,7 @@ import KivaCreditGuestPayment from '@/components/Checkout/KivaCreditGuestPayment import KvLoadingOverlay from '@/components/Kv/KvLoadingOverlay'; import BasketItemsList from '@/components/Checkout/BasketItemsList'; import OrderTotals from '@/components/Checkout/OrderTotals'; +import TeamJoinCheckbox from '@/components/Checkout/InContext/TeamJoinCheckbox'; import KvIcon from '@/components/Kv/KvIcon'; import KvButton from '~/@kiva/kv-components/vue/KvButton'; import KvGrid from '~/@kiva/kv-components/vue/KvGrid'; @@ -176,6 +196,7 @@ export default { KivaCreditGuestPayment, KvLoadingOverlay, OrderTotals, + TeamJoinCheckbox, KvIcon, KvGrid }, @@ -223,6 +244,14 @@ export default { type: Object, default: () => {}, }, + promoId: { + type: Number, + default: null + }, + teamId: { + type: Number, + default: null + }, promoName: { type: String, default: () => {}, @@ -250,9 +279,17 @@ export default { }, data() { return { - updatingTotals: false, + isMember: false, + loading: false, + joinStatus: null, + joinTeamIntent: true, + showError: false, + showForm: true, + showSuccess: false, + isChecked: false, continueAsGuest: false, - continueAsExistingUser: false + continueAsExistingUser: false, + updatingTotals: false, }; }, computed: { @@ -295,6 +332,12 @@ export default { && this.lcaLoanPrice > 0; } }, + // mounted() { + // this.loading = true; + // if (this.teamId) { + // this.fetchTeamData(); + // } + // }, methods: { completeTransaction(transactionId) { // compile transaction data @@ -332,7 +375,15 @@ export default { }, setUpdatingTotals(payload) { this.updatingTotals = payload; - } + }, + async processTeamJoin() { + if (!this.joinTeamIntent) { + return false; + } + console.log('proceeding to processTeamJoin'); + console.log(this.apollo, this.teamId, this.promoFund?.id, this.loans?.map(loan => loan.id)); + return joinTeamAndReserveLoans(this.apollo, this.teamId, this.promoFund?.id, this.loans?.filter(id => id)); + }, } }; diff --git a/src/components/Checkout/InContext/TeamJoinCheckbox.vue b/src/components/Checkout/InContext/TeamJoinCheckbox.vue new file mode 100644 index 00000000000..df737dbed0e --- /dev/null +++ b/src/components/Checkout/InContext/TeamJoinCheckbox.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/src/components/Checkout/KivaCreditPayment.vue b/src/components/Checkout/KivaCreditPayment.vue index cdcf8fbb29c..74b052b1752 100644 --- a/src/components/Checkout/KivaCreditPayment.vue +++ b/src/components/Checkout/KivaCreditPayment.vue @@ -13,6 +13,7 @@