| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2021-09-04 20:24:32 -08:00
										 |  |  |   <v-container class="narrow-container"> | 
					
						
							|  |  |  |     <BasePageTitle divider> | 
					
						
							|  |  |  |       <template #header> | 
					
						
							|  |  |  |         <v-img max-height="100" max-width="100" :src="require('~/static/svgs/manage-cookbooks.svg')"></v-img> | 
					
						
							|  |  |  |       </template> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |       <template #title> {{ $t('cookbook.cookbooks') }} </template> | 
					
						
							|  |  |  |       {{ $t('cookbook.description') }} | 
					
						
							| 
									
										
										
										
											2021-09-04 20:24:32 -08:00
										 |  |  |     </BasePageTitle> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |     <BaseButton create @click="actions.createOne()" /> | 
					
						
							|  |  |  |     <v-expansion-panels class="mt-2"> | 
					
						
							|  |  |  |       <draggable v-model="cookbooks" handle=".handle" style="width: 100%" @change="actions.updateOrder()"> | 
					
						
							| 
									
										
										
										
											2022-01-09 21:04:24 -09:00
										 |  |  |         <v-expansion-panel v-for="(cookbook, index) in cookbooks" :key="index" class="my-2 left-border rounded"> | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |           <v-expansion-panel-header disable-icon-rotate class="headline"> | 
					
						
							| 
									
										
										
										
											2021-08-31 18:51:34 -08:00
										 |  |  |             <div class="d-flex align-center"> | 
					
						
							|  |  |  |               <v-icon large left> | 
					
						
							|  |  |  |                 {{ $globals.icons.pages }} | 
					
						
							|  |  |  |               </v-icon> | 
					
						
							|  |  |  |               {{ cookbook.name }} | 
					
						
							|  |  |  |             </div> | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |             <template #actions> | 
					
						
							| 
									
										
										
										
											2021-08-31 18:51:34 -08:00
										 |  |  |               <v-icon class="handle"> | 
					
						
							|  |  |  |                 {{ $globals.icons.arrowUpDown }} | 
					
						
							|  |  |  |               </v-icon> | 
					
						
							| 
									
										
										
										
											2022-01-09 21:04:24 -09:00
										 |  |  |               <v-btn icon small class="ml-2"> | 
					
						
							|  |  |  |                 <v-icon> | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |                   {{ $globals.icons.edit }} | 
					
						
							|  |  |  |                 </v-icon> | 
					
						
							|  |  |  |               </v-btn> | 
					
						
							|  |  |  |             </template> | 
					
						
							|  |  |  |           </v-expansion-panel-header> | 
					
						
							|  |  |  |           <v-expansion-panel-content> | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |             <v-card-text v-if="cookbooks"> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |               <v-text-field v-model="cookbooks[index].name" :label="$t('cookbook.cookbook-name')"></v-text-field> | 
					
						
							|  |  |  |               <v-textarea v-model="cookbooks[index].description" auto-grow :rows="2" :label="$t('recipe.description')"></v-textarea> | 
					
						
							| 
									
										
										
										
											2022-06-03 20:12:32 -08:00
										 |  |  |               <RecipeOrganizerSelector v-model="cookbooks[index].categories" selector-type="categories" /> | 
					
						
							|  |  |  |               <RecipeOrganizerSelector v-model="cookbooks[index].tags" selector-type="tags" /> | 
					
						
							|  |  |  |               <RecipeOrganizerSelector v-model="cookbooks[index].tools" selector-type="tools" /> | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |               <v-switch v-model="cookbooks[index].public" hide-details single-line> | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |                 <template #label> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                   {{ $t('cookbook.public-cookbook') }} | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |                   <HelpIcon small right class="ml-2"> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                     {{ $t('cookbook.public-cookbook-description') }} | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |                   </HelpIcon> | 
					
						
							|  |  |  |                 </template> | 
					
						
							|  |  |  |               </v-switch> | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |               <div class="mt-4"> | 
					
						
							|  |  |  |                 <h3 class="text-subtitle-1 d-flex align-center mb-0 pb-0"> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                   {{ $t('cookbook.filter-options') }} | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |                   <HelpIcon right small class="ml-2"> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                     {{ $t('cookbook.filter-options-description') }} | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |                   </HelpIcon> | 
					
						
							|  |  |  |                 </h3> | 
					
						
							|  |  |  |                 <v-switch v-model="cookbooks[index].requireAllCategories" class="mt-0" hide-details single-line> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                   <template #label> {{ $t('cookbook.require-all-categories') }} </template> | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |                 </v-switch> | 
					
						
							|  |  |  |                 <v-switch v-model="cookbooks[index].requireAllTags" hide-details single-line> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                   <template #label> {{ $t('cookbook.require-all-tags') }} </template> | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |                 </v-switch> | 
					
						
							|  |  |  |                 <v-switch v-model="cookbooks[index].requireAllTools" hide-details single-line> | 
					
						
							| 
									
										
										
										
											2023-01-29 02:39:51 +01:00
										 |  |  |                   <template #label> {{ $t('cookbook.require-all-tools') }} </template> | 
					
						
							| 
									
										
										
										
											2022-04-03 16:32:58 -08:00
										 |  |  |                 </v-switch> | 
					
						
							|  |  |  |               </div> | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |             </v-card-text> | 
					
						
							|  |  |  |             <v-card-actions> | 
					
						
							|  |  |  |               <v-spacer></v-spacer> | 
					
						
							| 
									
										
										
										
											2022-01-09 21:04:24 -09:00
										 |  |  |               <BaseButtonGroup | 
					
						
							|  |  |  |                 :buttons="[ | 
					
						
							|  |  |  |                   { | 
					
						
							|  |  |  |                     icon: $globals.icons.delete, | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |                     text: $tc('general.delete'), | 
					
						
							| 
									
										
										
										
											2022-01-09 21:04:24 -09:00
										 |  |  |                     event: 'delete', | 
					
						
							|  |  |  |                   }, | 
					
						
							|  |  |  |                   { | 
					
						
							|  |  |  |                     icon: $globals.icons.save, | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |                     text: $tc('general.save'), | 
					
						
							| 
									
										
										
										
											2022-01-09 21:04:24 -09:00
										 |  |  |                     event: 'save', | 
					
						
							|  |  |  |                   }, | 
					
						
							|  |  |  |                 ]" | 
					
						
							| 
									
										
										
										
											2022-01-13 13:06:52 -09:00
										 |  |  |                 @delete="actions.deleteOne(cookbook.id)" | 
					
						
							|  |  |  |                 @save="actions.updateOne(cookbook)" | 
					
						
							| 
									
										
										
										
											2022-01-09 21:04:24 -09:00
										 |  |  |               /> | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |             </v-card-actions> | 
					
						
							|  |  |  |           </v-expansion-panel-content> | 
					
						
							|  |  |  |         </v-expansion-panel> | 
					
						
							|  |  |  |       </draggable> | 
					
						
							|  |  |  |     </v-expansion-panels> | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  |   </v-container> | 
					
						
							|  |  |  | </template> | 
					
						
							| 
									
										
										
										
											2022-03-23 04:54:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2024-02-01 07:50:09 +00:00
										 |  |  | import { defineComponent } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  | import draggable from "vuedraggable"; | 
					
						
							| 
									
										
										
										
											2021-09-05 22:05:29 -08:00
										 |  |  | import { useCookbooks } from "@/composables/use-group-cookbooks"; | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  | import RecipeOrganizerSelector from "~/components/Domain/Recipe/RecipeOrganizerSelector.vue"; | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							| 
									
										
										
										
											2022-04-01 09:50:31 -08:00
										 |  |  |   components: { draggable, RecipeOrganizerSelector }, | 
					
						
							| 
									
										
										
										
											2024-02-01 07:50:09 +00:00
										 |  |  |   middleware: "auth", | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  |   setup() { | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  |     const { cookbooks, actions } = useCookbooks(); | 
					
						
							| 
									
										
										
										
											2021-08-31 14:39:02 -08:00
										 |  |  |     return { | 
					
						
							|  |  |  |       cookbooks, | 
					
						
							|  |  |  |       actions, | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   head() { | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2023-10-26 15:26:14 +02:00
										 |  |  |       title: this.$t("cookbook.cookbooks") as string, | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-08-06 16:28:12 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> |