still trying to get modal to work

This commit is contained in:
CuriousMagpie
2022-08-02 16:05:41 -04:00
parent 9bee9d0a06
commit 999071a15c
2 changed files with 97 additions and 206 deletions

View File

@@ -1,10 +1,10 @@
<template> <template>
<div>
<b-modal <b-modal
id="group-plan-modal" id="group-plan-creation-modal"
:title="activePage === PAGES.CREATE_GROUP ? 'Create your Group' : 'Select Payment'" :title="activePage === PAGES.CREATE_GROUP ? 'Create your Group' : 'Select Payment'"
:hide-footer="true"
size="md" size="md"
hide-footer="hide-footer" @hide="onHide()"
> >
<div <div
v-if="activePage === PAGES.CREATE_GROUP" v-if="activePage === PAGES.CREATE_GROUP"
@@ -95,7 +95,6 @@
</div> </div>
</div> </div>
</b-modal> </b-modal>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -122,11 +121,6 @@
margin-left: .3em; margin-left: .3em;
} }
.plus {
width: 100%;
text-align: center;
}
div { div {
display: inline-block; display: inline-block;
} }
@@ -142,7 +136,6 @@
<script> <script>
import paymentsMixin from '../../mixins/payments'; import paymentsMixin from '../../mixins/payments';
import { mapState } from '@/libs/store'; import { mapState } from '@/libs/store';
import positiveIcon from '@/assets/svg/positive.svg';
import paymentsButtons from '@/components/payments/buttons/list'; import paymentsButtons from '@/components/payments/buttons/list';
export default { export default {
@@ -154,7 +147,7 @@ export default {
return { return {
amazonPayments: {}, amazonPayments: {},
icons: Object.freeze({ icons: Object.freeze({
positiveIcon, // positiveIcon,
}), }),
PAGES: { PAGES: {
CREATE_GROUP: 'create-group', CREATE_GROUP: 'create-group',
@@ -179,22 +172,19 @@ export default {
}; };
}, },
computed: { computed: {
...mapState({ user: 'user.data' }),
newGroupIsReady () { newGroupIsReady () {
return Boolean(this.newGroup.name); return Boolean(this.newGroup.name);
}, },
upgradingGroup () {
return this.$store.state.upgradingGroup;
},
// @TODO: can we move this to payment mixin?
...mapState({ user: 'user.data' }),
}, },
mounted () { mounted () {
this.activePage = this.PAGES.BENEFITS; console.log('i am mounted');
this.$store.dispatch('common:setTitle', {
section: this.$t('groupPlans'),
});
}, },
methods: { methods: {
changePage (page) {
this.activePage = page;
window.scrollTo(0, 0);
},
createGroup () { createGroup () {
this.changePage(this.PAGES.PAY); this.changePage(this.PAGES.PAY);
}, },

View File

@@ -1,6 +1,7 @@
<template> <template>
<!-- @TODO: Move to group plans folder--> <!-- @TODO: Move to group plans folder-->
<div> <div>
<group-plan-creation=modal />
<div> <div>
<div class="header"> <div class="header">
<h1 class="text-center"> <h1 class="text-center">
@@ -114,7 +115,7 @@
<div class="col-12 text-center"> <div class="col-12 text-center">
<button <button
class="btn btn-primary create-group" class="btn btn-primary create-group"
@click="launchModal('create')" @click="launchModal('group-plan-creation-modal')"
> >
Create Your New Group Create Your New Group
</button> </button>
@@ -153,102 +154,6 @@
</div> </div>
</div> </div>
</div> </div>
<b-modal
id="group-plan-modal"
:title="activePage === PAGES.CREATE_GROUP ? 'Create your Group' : 'Select Payment'"
size="md"
hide-footer="hide-footer"
>
<div
v-if="activePage === PAGES.CREATE_GROUP"
class="col-12"
>
<div class="form-group">
<label
class="control-label"
for="new-group-name"
>Name</label>
<input
id="new-group-name"
v-model="newGroup.name"
class="form-control input-medium option-content"
required="required"
type="text"
placeholder="Name"
>
</div>
<div class="form-group">
<label for="new-group-description">{{ $t('description') }}</label>
<textarea
id="new-group-description"
v-model="newGroup.description"
class="form-control option-content"
cols="3"
:placeholder="$t('description')"
></textarea>
</div>
<div
v-if="type === 'guild'"
class="form-group"
>
<div class="custom-control custom-radio">
<input
v-model="newGroup.privacy"
class="custom-control-input"
type="radio"
name="new-group-privacy"
value="private"
>
<label class="custom-control-label">{{ $t('inviteOnly') }}</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input
id="create-group-leaderOnlyChallenges-checkbox"
v-model="newGroup.leaderOnly.challenges"
class="custom-control-input"
type="checkbox"
>
<label
class="custom-control-label"
for="create-group-leaderOnlyChallenges-checkbox"
>{{ $t('leaderOnlyChallenges') }}</label>
</div>
</div>
<div
v-if="type === 'party'"
class="form-group"
>
<button
class="btn btn-secondary form-control"
:value="$t('create')"
@click="createGroup()"
></button>
</div>
<div class="form-group">
<button
class="btn btn-primary btn-lg btn-block"
:disabled="!newGroupIsReady"
@click="createGroup()"
>
{{ $t('create') }}
</button>
</div>
</div>
<div
v-if="activePage === PAGES.PAY"
class="col-12"
>
<div class="text-center">
<h3>Choose your payment method</h3>
<payments-buttons
:stripe-fn="() => pay(PAYMENTS.STRIPE)"
:amazon-data="pay(PAYMENTS.AMAZON)"
/>
</div>
</div>
</b-modal>
</div> </div>
</template> </template>
@@ -440,10 +345,12 @@ import paymentsMixin from '../../mixins/payments';
import { mapState } from '@/libs/store'; import { mapState } from '@/libs/store';
import positiveIcon from '@/assets/svg/positive.svg'; import positiveIcon from '@/assets/svg/positive.svg';
import paymentsButtons from '@/components/payments/buttons/list'; import paymentsButtons from '@/components/payments/buttons/list';
import groupPlanCreationModal from '../group-plans/groupPlanCreationModal';
export default { export default {
components: { components: {
paymentsButtons, paymentsButtons,
groupPlanCreationModal,
}, },
mixins: [paymentsMixin], mixins: [paymentsMixin],
data () { data () {
@@ -492,16 +399,10 @@ export default {
}, },
methods: { methods: {
launchModal () { launchModal () {
console.log('hello world');
this.changePage(this.PAGES.CREATE_GROUP); this.changePage(this.PAGES.CREATE_GROUP);
this.$root.$emit('bv::show::modal', 'group-plan-modal'); this.$root.$emit('bv::show::modal', 'group-plan-creation-modal');
}, },
// launchModal () {
// this.$root.$on('group-plan-modal') {
// console.log('hello i am a modal');
// this.activePage = page;
// this.$root.$emit('bv::show::modal', 'group-plan-modal');
// };
// },
changePage (page) { changePage (page) {
this.activePage = page; this.activePage = page;
window.scrollTo(0, 0); window.scrollTo(0, 0);