mirror of
				https://github.com/em-squared/5e-drs.git
				synced 2025-10-30 21:24:18 +00:00 
			
		
		
		
	consolidation
This commit is contained in:
		
							parent
							
								
									dcc6e47645
								
							
						
					
					
						commit
						4cb6e1d07b
					
				
					 5 changed files with 157 additions and 15 deletions
				
			
		|  | @ -11,15 +11,40 @@ | |||
|     <h1>Mon grimoire</h1> | ||||
| 
 | ||||
|     <div class="my-4 d-flex flex-wrap d-print-none"> | ||||
|       <v-btn outlined color="accent" class="mr-1 mb-1" depressed @click="print"><v-icon>mdi-printer</v-icon> Imprimer</v-btn> | ||||
|       <v-btn outlined color="accent" class="mr-1 mb-1" depressed @click="download"><v-icon>mdi-file-download</v-icon> Sauvegarder</v-btn> | ||||
|       <v-btn outlined color="accent" class="mr-1 mb-1" depressed @click="print" :disabled="$store.state.mySpells.spells.length <= 0"><v-icon>mdi-printer</v-icon> Imprimer</v-btn> | ||||
|       <v-btn outlined color="accent" class="mr-1 mb-1" depressed @click="download" :disabled="$store.state.mySpells.spells.length <= 0"><v-icon>mdi-file-download</v-icon> Sauvegarder</v-btn> | ||||
|       <v-btn outlined color="accent" class="mr-1 mb-1" depressed :loading="isUploading" @click="onUploadClick"> | ||||
|         <v-icon left>mdi-file-upload</v-icon> Charger | ||||
|       </v-btn> | ||||
|       <input ref="uploader" class="d-none" type="file" @change="upload"> | ||||
|       <v-btn outlined color="error" class="mb-1" depressed @click="$store.commit('mySpells/resetSpells')"><v-icon>mdi-delete</v-icon> Effacer le grimoire</v-btn> | ||||
|       <v-btn outlined color="error" class="mb-1" depressed @click.stop="confirmDeleteDialog = true" :disabled="$store.state.mySpells.spells.length <= 0"><v-icon>mdi-delete</v-icon> Effacer le grimoire</v-btn> | ||||
|     </div> | ||||
| 
 | ||||
|     <v-dialog v-model="confirmDeleteDialog" max-width="290"> | ||||
|       <v-card> | ||||
|         <v-card-title class="headline">Supprimer le grimoire</v-card-title> | ||||
| 
 | ||||
|         <v-card-text> | ||||
|           Cette action supprimera tous les sorts ajoutés à votre grimoire, y compris les sorts que vous avez créés. Souhaitez vous les supprimer ? | ||||
|         </v-card-text> | ||||
| 
 | ||||
|         <v-card-actions> | ||||
|           <v-spacer></v-spacer> | ||||
|           <v-btn depressed @click="confirmDeleteDialog = false"> | ||||
|             Annuler | ||||
|           </v-btn> | ||||
| 
 | ||||
|           <v-btn color="error darken-1" depressed @click="confirmDeletion"> | ||||
|             Supprimer | ||||
|           </v-btn> | ||||
|         </v-card-actions> | ||||
|       </v-card> | ||||
|     </v-dialog> | ||||
| 
 | ||||
|     <v-alert v-model="alertOpen" :type="alertType" dismissible transition="fade-transition"> | ||||
|       {{ alertText }} | ||||
|     </v-alert> | ||||
| 
 | ||||
|     <MySpells /> | ||||
|   </div> | ||||
| </template> | ||||
|  | @ -39,7 +64,11 @@ export default { | |||
| 
 | ||||
|   data () { | ||||
|     return { | ||||
|       isUploading: false | ||||
|       isUploading: false, | ||||
|       confirmDeleteDialog: false, | ||||
|       alertOpen: false, | ||||
|       alertText: null, | ||||
|       alertType: "info" | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|  | @ -52,6 +81,9 @@ export default { | |||
| 
 | ||||
|     upload (e) { | ||||
|       let file = e.target.files[0] | ||||
|       if (!file) { | ||||
|         return | ||||
|       } | ||||
|       let reader = new FileReader() | ||||
|       let self = this | ||||
| 
 | ||||
|  | @ -64,6 +96,8 @@ export default { | |||
|               isValid = false | ||||
|             } | ||||
|           } | ||||
|         } else { | ||||
|           isValid = false | ||||
|         } | ||||
|         if (isValid) { | ||||
|           self.$store.commit('mySpells/setSpells', result.spells) | ||||
|  | @ -73,10 +107,18 @@ export default { | |||
|           if (result.notPrintedSpells) { | ||||
|             self.$store.commit('mySpells/setNotPrintedSpells', result.notPrintedSpells) | ||||
|           } | ||||
|           self.alertText = self.$store.state.mySpells.spells.length + " sorts inscrits dans le grimoire." | ||||
|           self.alertType = "success" | ||||
|           self.alertOpen = true | ||||
|         } else { | ||||
|           self.alertText = "Le fichier est invalide." | ||||
|           self.alertType = "error" | ||||
|           self.alertOpen = true | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       reader.readAsText(file) | ||||
|       this.$refs.uploader.value = '' | ||||
|     }, | ||||
| 
 | ||||
|     onUploadClick () { | ||||
|  | @ -90,6 +132,11 @@ export default { | |||
| 
 | ||||
|     print () { | ||||
|       window.print() | ||||
|     }, | ||||
| 
 | ||||
|     confirmDeletion () { | ||||
|       this.$store.commit('mySpells/resetSpells') | ||||
|       this.confirmDeleteDialog = false | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Maxime Moraine
						Maxime Moraine