| 
									
										
										
										
											2020-04-10 16:37:48 +02:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <div class="monster"> | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     <div class="d-flex align-center mb-4 d-print-none"> | 
					
						
							|  |  |  |       <Breadcrumb class="mr-auto" /> | 
					
						
							|  |  |  |       <v-btn color="primary" class="mr-4" depressed link to="/creation-de-monstre-pnj/"><v-icon left>mdi-plus</v-icon> Créer un monstre</v-btn> | 
					
						
							|  |  |  |       <v-btn :outlined="!isMonsterInBestiary" color="accent" class="mr-4" depressed @click="toggleMonsterInBestiary"><v-icon>mdi-book</v-icon> {{ displayToggleMonsterButton }}</v-btn> | 
					
						
							|  |  |  |       <v-btn color="primary" class="mr-4" depressed link to="/mon-bestiaire/">Mon Bestiaire</v-btn> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  |     <Monster :monster="$page" /> | 
					
						
							|  |  |  |     <Edit /> | 
					
						
							| 
									
										
										
										
											2020-04-10 16:37:48 +02:00
										 |  |  |   </div> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | import Breadcrumb from '@theme/components/Breadcrumb' | 
					
						
							|  |  |  | import Monster from '@theme/components/Monster' | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  | import Edit from '@theme/components/Edit' | 
					
						
							| 
									
										
										
										
											2020-04-10 16:37:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default { | 
					
						
							|  |  |  |   name: 'MonsterLayout', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   components: { | 
					
						
							|  |  |  |     Breadcrumb, | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     Monster, | 
					
						
							|  |  |  |     Edit | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   computed: { | 
					
						
							|  |  |  |     isMonsterInBestiary () { | 
					
						
							|  |  |  |       let isInBestiary = false | 
					
						
							|  |  |  |       for (let s of this.$store.state.myMonsters.monsters) { | 
					
						
							|  |  |  |         if (s.key == this.$page.key) { | 
					
						
							|  |  |  |           isInBestiary = true | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       return isInBestiary | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     displayToggleMonsterButton () { | 
					
						
							|  |  |  |       if (this.isMonsterInBestiary) { | 
					
						
							|  |  |  |         return 'Supprimer de mon grimoire' | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       return 'Ajouter à mon grimoire' | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     toggleMonsterInBestiary () { | 
					
						
							|  |  |  |       if (this.isMonsterInBestiary) { | 
					
						
							|  |  |  |         this.$store.commit('myMonsters/removeMonster', this.$page) | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         this.$store.commit('myMonsters/addMonster', this.$page) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-04-10 16:37:48 +02:00
										 |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   mounted () { | 
					
						
							|  |  |  |     this.$store.commit('setHasRightDrawer', false) | 
					
						
							|  |  |  |     this.$store.commit('setRightDrawer', false) | 
					
						
							|  |  |  |     this.$store.commit('setInRightDrawer', null) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  | </style> |