| 
									
										
										
										
											2020-04-10 16:37:48 +02:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <div class="monster"> | 
					
						
							| 
									
										
										
										
											2020-04-22 14:23:59 +02:00
										 |  |  |     <div class="d-flex flex-wrap align-center d-print-none"> | 
					
						
							|  |  |  |       <Breadcrumb class="mr-auto mb-4" /> | 
					
						
							|  |  |  |       <div class="d-flex flex-wrap align-center"> | 
					
						
							| 
									
										
										
										
											2020-06-10 10:30:32 +02:00
										 |  |  |         <v-btn :outlined="!$store.state.l5r" color="primary" class="mr-4 mb-4" depressed @click="$store.commit('setL5r', !$store.state.l5r)"><span class="orn">8</span> Règles cinq royaumes</v-btn> | 
					
						
							| 
									
										
										
										
											2020-06-10 19:14:34 +02:00
										 |  |  |         <v-btn color="primary" class="mr-4 mb-4" depressed link to="/creation-de-monstre-pnj/"><v-icon left>mdi-plus</v-icon> Créer un monstre/PNJ</v-btn> | 
					
						
							| 
									
										
										
										
											2020-04-22 14:23:59 +02:00
										 |  |  |         <v-btn :outlined="!isMonsterInBestiary" color="accent" class="mr-4 mb-4" depressed @click="toggleMonsterInBestiary"><v-icon>mdi-book</v-icon> {{ displayToggleMonsterButton }}</v-btn> | 
					
						
							| 
									
										
										
										
											2020-05-15 15:48:51 +02:00
										 |  |  |         <MyMonstersButton /> | 
					
						
							| 
									
										
										
										
											2020-04-22 14:23:59 +02:00
										 |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     </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-05-15 15:48:51 +02:00
										 |  |  | import MyMonstersButton from '@theme/global-components/MyMonstersButton' | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  | import Edit from '@theme/components/Edit' | 
					
						
							| 
									
										
										
										
											2020-05-24 13:32:31 +02:00
										 |  |  | import { isResourceInLibrary } from '@theme/util' | 
					
						
							| 
									
										
										
										
											2020-04-10 16:37:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default { | 
					
						
							|  |  |  |   name: 'MonsterLayout', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   components: { | 
					
						
							|  |  |  |     Breadcrumb, | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     Monster, | 
					
						
							| 
									
										
										
										
											2020-05-15 15:48:51 +02:00
										 |  |  |     MyMonstersButton, | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     Edit | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   computed: { | 
					
						
							|  |  |  |     isMonsterInBestiary () { | 
					
						
							| 
									
										
										
										
											2020-05-24 13:32:31 +02:00
										 |  |  |       return isResourceInLibrary(this.$page, this.$store.state.myMonsters.monsters) | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     displayToggleMonsterButton () { | 
					
						
							|  |  |  |       if (this.isMonsterInBestiary) { | 
					
						
							| 
									
										
										
										
											2020-04-22 11:49:57 +02:00
										 |  |  |         return 'Supprimer de mon bestiaire' | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2020-04-22 11:49:57 +02:00
										 |  |  |       return 'Ajouter à mon bestiaire' | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     toggleMonsterInBestiary () { | 
					
						
							|  |  |  |       if (this.isMonsterInBestiary) { | 
					
						
							|  |  |  |         this.$store.commit('myMonsters/removeMonster', this.$page) | 
					
						
							| 
									
										
										
										
											2020-05-23 11:17:42 +02:00
										 |  |  |         this.$store.commit('setSnackbarText', "Le monstre " + this.$page.title + " a été supprimé de votre bestiaire") | 
					
						
							|  |  |  |         this.$store.commit('setIsOpenSnackbar', true) | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |       } else { | 
					
						
							|  |  |  |         this.$store.commit('myMonsters/addMonster', this.$page) | 
					
						
							| 
									
										
										
										
											2020-05-23 11:17:42 +02:00
										 |  |  |         this.$store.commit('setSnackbarText', "Le monstre " + this.$page.title + " a été ajouté à votre bestiaire") | 
					
						
							|  |  |  |         this.$store.commit('setIsOpenSnackbar', true) | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											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> |