| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <div> | 
					
						
							|  |  |  |     <v-switch | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       v-for="(_, key) in model" | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  |       :key="key" | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       v-model="model[key]" | 
					
						
							|  |  |  |       color="primary" | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  |       xs | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       density="compact" | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  |       :disabled="key == 'locked' && !isOwner" | 
					
						
							|  |  |  |       class="my-1" | 
					
						
							|  |  |  |       :label="labels[key]" | 
					
						
							|  |  |  |       hide-details | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |     /> | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  |   </div> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | <script lang="ts" setup> | 
					
						
							|  |  |  | import { defineModel, defineProps } from "vue"; | 
					
						
							|  |  |  | import type { RecipeSettings } from "~/lib/api/types/recipe"; | 
					
						
							|  |  |  | import { useI18n } from "#imports"; | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | defineProps<{ isOwner?: boolean }>(); | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | const model = defineModel<RecipeSettings>({ required: true }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const i18n = useI18n(); | 
					
						
							|  |  |  | const labels: Record<keyof RecipeSettings, string> = { | 
					
						
							|  |  |  |   public: i18n.t("recipe.public-recipe"), | 
					
						
							|  |  |  |   showNutrition: i18n.t("recipe.show-nutrition-values"), | 
					
						
							|  |  |  |   showAssets: i18n.t("asset.show-assets"), | 
					
						
							|  |  |  |   landscapeView: i18n.t("recipe.landscape-view-coming-soon"), | 
					
						
							|  |  |  |   disableComments: i18n.t("recipe.disable-comments"), | 
					
						
							|  |  |  |   disableAmount: i18n.t("recipe.disable-amount"), | 
					
						
							|  |  |  |   locked: i18n.t("recipe.locked"), | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2022-08-14 10:37:44 -08:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss" scoped></style> |