| 
									
										
										
										
											2024-02-04 17:15:25 +01:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <div> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |     <v-card-text | 
					
						
							|  |  |  |       v-if="cookbook" | 
					
						
							|  |  |  |       class="px-1" | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       <v-text-field | 
					
						
							|  |  |  |         v-model="cookbook.name" | 
					
						
							|  |  |  |         :label="$t('cookbook.cookbook-name')" | 
					
						
							|  |  |  |         variant="underlined" | 
					
						
							|  |  |  |         color="primary" | 
					
						
							|  |  |  |       /> | 
					
						
							|  |  |  |       <v-textarea | 
					
						
							|  |  |  |         v-model="cookbook.description" | 
					
						
							|  |  |  |         auto-grow | 
					
						
							|  |  |  |         :rows="2" | 
					
						
							|  |  |  |         :label="$t('recipe.description')" | 
					
						
							|  |  |  |         variant="underlined" | 
					
						
							|  |  |  |         color="primary" | 
					
						
							|  |  |  |       /> | 
					
						
							| 
									
										
										
										
											2024-10-17 10:35:39 -05:00
										 |  |  |       <QueryFilterBuilder | 
					
						
							|  |  |  |         :field-defs="fieldDefs" | 
					
						
							|  |  |  |         :initial-query-filter="cookbook.queryFilter" | 
					
						
							|  |  |  |         @input="handleInput" | 
					
						
							|  |  |  |       /> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       <v-switch | 
					
						
							|  |  |  |         v-model="cookbook.public" | 
					
						
							|  |  |  |         hide-details | 
					
						
							|  |  |  |         single-line | 
					
						
							|  |  |  |         color="primary" | 
					
						
							|  |  |  |       > | 
					
						
							| 
									
										
										
										
											2024-02-04 17:15:25 +01:00
										 |  |  |         <template #label> | 
					
						
							|  |  |  |           {{ $t('cookbook.public-cookbook') }} | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |           <HelpIcon | 
					
						
							|  |  |  |             size="small" | 
					
						
							|  |  |  |             right | 
					
						
							|  |  |  |             class="ml-2" | 
					
						
							|  |  |  |           > | 
					
						
							| 
									
										
										
										
											2024-02-04 17:15:25 +01:00
										 |  |  |             {{ $t('cookbook.public-cookbook-description') }} | 
					
						
							|  |  |  |           </HelpIcon> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |       </v-switch> | 
					
						
							|  |  |  |     </v-card-text> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-29 23:43:13 +02:00
										 |  |  | <script setup lang="ts"> | 
					
						
							| 
									
										
										
										
											2024-10-17 10:35:39 -05:00
										 |  |  | import { Organizer } from "~/lib/api/types/non-generated"; | 
					
						
							|  |  |  | import QueryFilterBuilder from "~/components/Domain/QueryFilterBuilder.vue"; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | import type { FieldDefinition } from "~/composables/use-query-filter-builder"; | 
					
						
							| 
									
										
										
										
											2025-07-29 23:43:13 +02:00
										 |  |  | import type { ReadCookBook } from "~/lib/api/types/cookbook"; | 
					
						
							| 
									
										
										
										
											2024-10-17 10:35:39 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-29 23:43:13 +02:00
										 |  |  | const modelValue = defineModel<ReadCookBook>({ required: true }); | 
					
						
							|  |  |  | const i18n = useI18n(); | 
					
						
							|  |  |  | const cookbook = toRef(modelValue); | 
					
						
							|  |  |  | function handleInput(value: string | undefined) { | 
					
						
							|  |  |  |   cookbook.value.queryFilterString = value || ""; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-10-17 10:35:39 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-29 23:43:13 +02:00
										 |  |  | const fieldDefs: FieldDefinition[] = [ | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "recipe_category.id", | 
					
						
							|  |  |  |     label: i18n.t("category.categories"), | 
					
						
							|  |  |  |     type: Organizer.Category, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "tags.id", | 
					
						
							|  |  |  |     label: i18n.t("tag.tags"), | 
					
						
							|  |  |  |     type: Organizer.Tag, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "recipe_ingredient.food.id", | 
					
						
							|  |  |  |     label: i18n.t("recipe.ingredients"), | 
					
						
							|  |  |  |     type: Organizer.Food, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "tools.id", | 
					
						
							|  |  |  |     label: i18n.t("tool.tools"), | 
					
						
							|  |  |  |     type: Organizer.Tool, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "household_id", | 
					
						
							|  |  |  |     label: i18n.t("household.households"), | 
					
						
							|  |  |  |     type: Organizer.Household, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "created_at", | 
					
						
							|  |  |  |     label: i18n.t("general.date-created"), | 
					
						
							|  |  |  |     type: "date", | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     name: "updated_at", | 
					
						
							|  |  |  |     label: i18n.t("general.date-updated"), | 
					
						
							|  |  |  |     type: "date", | 
					
						
							| 
									
										
										
										
											2024-10-17 10:35:39 -05:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2025-07-29 23:43:13 +02:00
										 |  |  | ]; | 
					
						
							| 
									
										
										
										
											2024-02-04 17:15:25 +01:00
										 |  |  | </script> |