| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |   <v-dialog | 
					
						
							|  |  |  |     v-model="dialog" | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |     :max-width="width" | 
					
						
							|  |  |  |     :style="{ zIndex: zIndex }" | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |     @click:outside="cancel" | 
					
						
							|  |  |  |     @keydown.esc="cancel" | 
					
						
							|  |  |  |   > | 
					
						
							|  |  |  |     <v-card> | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |       <v-toolbar v-if="Boolean(title)" :color="color" dense flat> | 
					
						
							|  |  |  |         <v-icon v-if="Boolean(icon)" left> {{ icon }}</v-icon> | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |         <v-toolbar-title v-text="title" /> | 
					
						
							|  |  |  |       </v-toolbar> | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |       <v-card-text | 
					
						
							|  |  |  |         v-show="!!message" | 
					
						
							|  |  |  |         class="pa-4 text--primary" | 
					
						
							|  |  |  |         v-html="message" | 
					
						
							|  |  |  |       /> | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  |       <v-card-actions> | 
					
						
							|  |  |  |         <v-spacer></v-spacer> | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |         <v-btn color="grey" text @click="cancel"> Cancel </v-btn> | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |         <v-btn :color="color" text @click="confirm"> Confirm </v-btn> | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  |       </v-card-actions> | 
					
						
							|  |  |  |     </v-card> | 
					
						
							|  |  |  |   </v-dialog> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Confirmation Component used to add a second validaion step to an action. | 
					
						
							|  |  |  |  * @version 1.0.1 | 
					
						
							|  |  |  |  * @author [zackbcom](https://github.com/zackbcom)
 | 
					
						
							|  |  |  |  * @since Version 1.0.0 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  | export default { | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |   name: "Confirmation", | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |   props: { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Message to be in body. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     message: String, | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Optional Title message to be used in title. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     title: String, | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Optional Icon to be used in title. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     icon: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: "mid-alert-circle" | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Color theme of the component. Chose one of the defined theme colors. | 
					
						
							|  |  |  |      * @values primary, secondary, accent, success, info, warning, error | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     color: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: "error" | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Define the max width of the component. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     width: { | 
					
						
							|  |  |  |       type: Number, | 
					
						
							|  |  |  |       default: 400 | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * zIndex of the component. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     zIndex: { | 
					
						
							|  |  |  |       type: Number, | 
					
						
							|  |  |  |       default: 200 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   data: () => ({ | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Keep state of open or closed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     dialog: false | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |   }), | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  |   methods: { | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Sets the modal to be visiable. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     open() { | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |       this.dialog = true; | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Cancel button handler. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |     cancel() { | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |       /** | 
					
						
							|  |  |  |        * Cancel event. | 
					
						
							|  |  |  |        * | 
					
						
							|  |  |  |        * @event Cancel | 
					
						
							|  |  |  |        * @property {string} content content of the first prop passed to the event | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       this.$emit("cancel"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       //Hide Modal
 | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |       this.dialog = false; | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * confirm button handler. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  |     confirm() { | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |       /** | 
					
						
							|  |  |  |        * confirm event. | 
					
						
							|  |  |  |        * | 
					
						
							|  |  |  |        * @event confirm | 
					
						
							|  |  |  |        * @property {string} content content of the first prop passed to the event | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       this.$emit("confirm"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       //Hide Modal
 | 
					
						
							| 
									
										
										
										
											2021-01-04 23:10:14 -06:00
										 |  |  |       this.dialog = false; | 
					
						
							| 
									
										
										
										
											2021-01-05 12:43:28 -06:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-01-04 16:41:13 -09:00
										 |  |  | }; | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  | </style> |