|
@@ -7,7 +7,7 @@
|
|
<div class="description" v-html="product.field_description" />
|
|
<div class="description" v-html="product.field_description" />
|
|
<span class="price">{{ product.price__number }}</span>
|
|
<span class="price">{{ product.price__number }}</span>
|
|
</section>
|
|
</section>
|
|
- <aside class="">
|
|
|
|
|
|
+ <aside v-if="!isAdherent">
|
|
<input
|
|
<input
|
|
v-if="product.field_multiple"
|
|
v-if="product.field_multiple"
|
|
v-model="quantity"
|
|
v-model="quantity"
|
|
@@ -24,11 +24,17 @@
|
|
Commander
|
|
Commander
|
|
</button>
|
|
</button>
|
|
</aside>
|
|
</aside>
|
|
|
|
+
|
|
<Modal
|
|
<Modal
|
|
- v-if="login"
|
|
|
|
|
|
+ v-if="showLoginModal"
|
|
|
|
+ @close="closeModal"
|
|
>
|
|
>
|
|
- i'm a modal
|
|
|
|
|
|
+ <div>
|
|
|
|
+ Please login or register before continue.
|
|
|
|
+ </div>
|
|
|
|
+ <LoginRegisterForm @onLogedIn="logedIn"/>
|
|
</Modal>
|
|
</Modal>
|
|
|
|
+
|
|
</article>
|
|
</article>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -38,6 +44,7 @@ import { REST } from 'vuejs/api/rest-axios'
|
|
import router from 'vuejs/route'
|
|
import router from 'vuejs/route'
|
|
import { mapState, mapActions } from 'vuex'
|
|
import { mapState, mapActions } from 'vuex'
|
|
import Modal from 'vuejs/components/Helper/Modal'
|
|
import Modal from 'vuejs/components/Helper/Modal'
|
|
|
|
+import LoginRegisterForm from 'vuejs/components/Helper/LoginRegisterForm'
|
|
|
|
|
|
let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
|
|
let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
|
|
|
|
|
|
@@ -48,25 +55,28 @@ export default {
|
|
data(){
|
|
data(){
|
|
return {
|
|
return {
|
|
quantity: 1,
|
|
quantity: 1,
|
|
- login:false,
|
|
|
|
- register:false
|
|
|
|
|
|
+ showLoginModal:false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState({
|
|
...mapState({
|
|
- isloggedin: state => state.User.isloggedin
|
|
|
|
|
|
+ isloggedin: state => state.User.isloggedin,
|
|
|
|
+ isAdherent: state => state.User.isAdherent
|
|
})
|
|
})
|
|
},
|
|
},
|
|
methods:{
|
|
methods:{
|
|
- ...mapActions({
|
|
|
|
- userLogin: 'User/userLogin'
|
|
|
|
- }),
|
|
|
|
|
|
+ // ...mapActions({
|
|
|
|
+ // userLogin: 'User/userLogin'
|
|
|
|
+ // }),
|
|
|
|
+ closeModal () {
|
|
|
|
+ this.showLoginModal = false;
|
|
|
|
+ },
|
|
checkaddtocart() {
|
|
checkaddtocart() {
|
|
console.log('checkaddtocart');
|
|
console.log('checkaddtocart');
|
|
|
|
|
|
if(!this.isloggedin){
|
|
if(!this.isloggedin){
|
|
// TODO: show popup login or register
|
|
// TODO: show popup login or register
|
|
- this.login = true
|
|
|
|
|
|
+ this.showLoginModal = true
|
|
// TODO: rest login or register
|
|
// TODO: rest login or register
|
|
// TODO: rest login
|
|
// TODO: rest login
|
|
// TODO: this.addtocart()
|
|
// TODO: this.addtocart()
|
|
@@ -74,6 +84,10 @@ export default {
|
|
this.addtocart()
|
|
this.addtocart()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ logedIn () {
|
|
|
|
+ console.log('Product: logedIn');
|
|
|
|
+ this.closeModal()
|
|
|
|
+ },
|
|
addtocart () {
|
|
addtocart () {
|
|
console.log("addtocart")
|
|
console.log("addtocart")
|
|
|
|
|
|
@@ -93,7 +107,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
- Modal
|
|
|
|
|
|
+ Modal,
|
|
|
|
+ LoginRegisterForm
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|