| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <div> | 
					
						
							|  |  |  |     <v-text-field | 
					
						
							|  |  |  |       v-if="value.title || showTitle" | 
					
						
							|  |  |  |       v-model="value.title" | 
					
						
							|  |  |  |       dense | 
					
						
							|  |  |  |       hide-details | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |       class="mx-1 mt-3 mb-4" | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |       :placeholder="$t('recipe.section-title')" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       style="max-width: 500px" | 
					
						
							| 
									
										
										
										
											2022-09-25 15:00:45 -08:00
										 |  |  |       @click="$emit('clickIngredientField', 'title')" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |     > | 
					
						
							|  |  |  |     </v-text-field> | 
					
						
							|  |  |  |     <v-row :no-gutters="$vuetify.breakpoint.mdAndUp" dense class="d-flex flex-wrap my-1"> | 
					
						
							|  |  |  |       <v-col v-if="!disableAmount" sm="12" md="2" cols="12" class="flex-grow-0 flex-shrink-0"> | 
					
						
							|  |  |  |         <v-text-field | 
					
						
							|  |  |  |           v-model="value.quantity" | 
					
						
							|  |  |  |           solo | 
					
						
							|  |  |  |           hide-details | 
					
						
							|  |  |  |           dense | 
					
						
							|  |  |  |           type="number" | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |           :placeholder="$t('recipe.quantity')" | 
					
						
							| 
									
										
										
										
											2022-05-22 11:16:23 -08:00
										 |  |  |           @keypress="quantityFilter" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |         > | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |           <v-icon v-if="$listeners && $listeners.delete" slot="prepend" class="mr-n1 handle"> | 
					
						
							|  |  |  |             {{ $globals.icons.arrowUpDown }} | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           </v-icon> | 
					
						
							|  |  |  |         </v-text-field> | 
					
						
							|  |  |  |       </v-col> | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |       <v-col v-if="!disableAmount" sm="12" md="3" cols="12"> | 
					
						
							| 
									
										
										
										
											2021-08-27 20:05:02 -08:00
										 |  |  |         <v-autocomplete | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |           ref="unitAutocomplete" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           v-model="value.unit" | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |           :search-input.sync="unitSearch" | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |           auto-select-first | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           hide-details | 
					
						
							|  |  |  |           dense | 
					
						
							|  |  |  |           solo | 
					
						
							|  |  |  |           return-object | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |           :items="units || []" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           item-text="name" | 
					
						
							|  |  |  |           class="mx-1" | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |           :placeholder="$t('recipe.choose-unit')" | 
					
						
							| 
									
										
										
										
											2022-03-03 19:43:56 -09:00
										 |  |  |           clearable | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |           @keyup.enter="handleUnitEnter" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |         > | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |           <template #no-data> | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |             <div class="caption text-center pb-2">{{ $t("recipe.press-enter-to-create") }}</div> | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |           </template> | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |           <template #append-item> | 
					
						
							|  |  |  |             <div class="px-2"> | 
					
						
							|  |  |  |               <BaseButton block small @click="createAssignUnit()"></BaseButton> | 
					
						
							|  |  |  |             </div> | 
					
						
							| 
									
										
										
										
											2021-08-27 20:05:02 -08:00
										 |  |  |           </template> | 
					
						
							|  |  |  |         </v-autocomplete> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       </v-col> | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       <!-- Foods Input --> | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |       <v-col v-if="!disableAmount" m="12" md="3" cols="12" class=""> | 
					
						
							| 
									
										
										
										
											2021-08-27 20:05:02 -08:00
										 |  |  |         <v-autocomplete | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |           ref="foodAutocomplete" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           v-model="value.food" | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |           :search-input.sync="foodSearch" | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |           auto-select-first | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           hide-details | 
					
						
							|  |  |  |           dense | 
					
						
							|  |  |  |           solo | 
					
						
							|  |  |  |           return-object | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |           :items="foods || []" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           item-text="name" | 
					
						
							|  |  |  |           class="mx-1 py-0" | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |           :placeholder="$t('recipe.choose-food')" | 
					
						
							| 
									
										
										
										
											2022-03-03 19:43:56 -09:00
										 |  |  |           clearable | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |           @keyup.enter="handleFoodEnter" | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |         > | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |           <template #no-data> | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |             <div class="caption text-center pb-2">{{ $t("recipe.press-enter-to-create") }}</div> | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |           </template> | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |           <template #append-item> | 
					
						
							|  |  |  |             <div class="px-2"> | 
					
						
							|  |  |  |               <BaseButton block small @click="createAssignFood()"></BaseButton> | 
					
						
							|  |  |  |             </div> | 
					
						
							| 
									
										
										
										
											2021-08-27 20:05:02 -08:00
										 |  |  |           </template> | 
					
						
							|  |  |  |         </v-autocomplete> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       </v-col> | 
					
						
							|  |  |  |       <v-col sm="12" md="" cols="12"> | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |         <div class="d-flex"> | 
					
						
							| 
									
										
										
										
											2022-09-25 15:00:45 -08:00
										 |  |  |           <v-text-field | 
					
						
							|  |  |  |             v-model="value.note" | 
					
						
							|  |  |  |             hide-details | 
					
						
							|  |  |  |             dense | 
					
						
							|  |  |  |             solo | 
					
						
							|  |  |  |             :placeholder="$t('recipe.notes')" | 
					
						
							|  |  |  |             @click="$emit('clickIngredientField', 'note')" | 
					
						
							|  |  |  |           > | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |             <v-icon v-if="disableAmount && $listeners && $listeners.delete" slot="prepend" class="mr-n1 handle"> | 
					
						
							|  |  |  |               {{ $globals.icons.arrowUpDown }} | 
					
						
							|  |  |  |             </v-icon> | 
					
						
							|  |  |  |           </v-text-field> | 
					
						
							|  |  |  |           <BaseButtonGroup | 
					
						
							|  |  |  |             hover | 
					
						
							|  |  |  |             :large="false" | 
					
						
							| 
									
										
										
										
											2023-11-24 10:40:35 +01:00
										 |  |  |             class="my-auto d-flex" | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |             :buttons="btns" | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |             @toggle-section="toggleTitle" | 
					
						
							|  |  |  |             @toggle-original="toggleOriginalText" | 
					
						
							| 
									
										
										
										
											2024-06-18 06:45:12 -07:00
										 |  |  |             @insert-above="$emit('insert-above')" | 
					
						
							|  |  |  |             @insert-below="$emit('insert-below')" | 
					
						
							| 
									
										
										
										
											2023-04-01 20:43:59 -05:00
										 |  |  |             @insert-ingredient="$emit('insert-ingredient')" | 
					
						
							| 
									
										
										
										
											2022-05-11 17:14:03 -08:00
										 |  |  |             @delete="$emit('delete')" | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       </v-col> | 
					
						
							|  |  |  |     </v-row> | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  |     <p v-if="showOriginalText" class="text-caption"> | 
					
						
							|  |  |  |       {{ $t("recipe.original-text-with-value", { originalText: value.originalText }) }} | 
					
						
							|  |  |  |     </p> | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |     <v-divider v-if="!$vuetify.breakpoint.mdAndUp" class="my-4"></v-divider> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  | import { computed, defineComponent, reactive, ref, toRefs, useContext } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  | import { useFoodStore, useFoodData, useUnitStore, useUnitData } from "~/composables/store"; | 
					
						
							| 
									
										
										
										
											2021-08-27 20:05:02 -08:00
										 |  |  | import { validators } from "~/composables/use-validators"; | 
					
						
							| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | import { RecipeIngredient } from "~/lib/api/types/recipe"; | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							|  |  |  |   props: { | 
					
						
							|  |  |  |     value: { | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |       type: Object as () => RecipeIngredient, | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       required: true, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     disableAmount: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2023-04-01 20:43:59 -05:00
										 |  |  |     allowInsertIngredient: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |   setup(props, { listeners }) { | 
					
						
							|  |  |  |     const { i18n, $globals } = useContext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const contextMenuOptions = computed(() => { | 
					
						
							|  |  |  |       const options = [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           text: i18n.tc("recipe.toggle-section"), | 
					
						
							|  |  |  |           event: "toggle-section", | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2024-06-18 06:45:12 -07:00
										 |  |  |         { | 
					
						
							|  |  |  |           text: i18n.tc("recipe.insert-above"), | 
					
						
							|  |  |  |           event: "insert-above", | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           text: i18n.tc("recipe.insert-below"), | 
					
						
							|  |  |  |           event: "insert-below", | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |       ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-01 20:43:59 -05:00
										 |  |  |       if (props.allowInsertIngredient) { | 
					
						
							|  |  |  |         options.push({ | 
					
						
							|  |  |  |           text: i18n.tc("recipe.insert-ingredient") , | 
					
						
							|  |  |  |           event: "insert-ingredient", | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |       // FUTURE: add option to parse a single ingredient
 | 
					
						
							|  |  |  |       // if (!value.food && !value.unit && value.note) {
 | 
					
						
							|  |  |  |       //   options.push({
 | 
					
						
							|  |  |  |       //     text: "Parse Ingredient",
 | 
					
						
							|  |  |  |       //     event: "parse-ingredient",
 | 
					
						
							|  |  |  |       //   });
 | 
					
						
							|  |  |  |       // }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (props.value.originalText) { | 
					
						
							|  |  |  |         options.push({ | 
					
						
							|  |  |  |           text: i18n.tc("recipe.see-original-text"), | 
					
						
							|  |  |  |           event: "toggle-original", | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       return options; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const btns = computed(() => { | 
					
						
							|  |  |  |       const out = [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           icon: $globals.icons.dotsVertical, | 
					
						
							|  |  |  |           text: i18n.tc("general.menu"), | 
					
						
							|  |  |  |           event: "open", | 
					
						
							|  |  |  |           children: contextMenuOptions.value, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (listeners && listeners.delete) { | 
					
						
							|  |  |  |         // @ts-expect-error - TODO: fix this
 | 
					
						
							|  |  |  |         out.unshift({ | 
					
						
							|  |  |  |           icon: $globals.icons.delete, | 
					
						
							|  |  |  |           text: i18n.tc("general.delete"), | 
					
						
							|  |  |  |           event: "delete", | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       return out; | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-08-10 07:12:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |     // ==================================================
 | 
					
						
							|  |  |  |     // Foods
 | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |     const foodStore = useFoodStore(); | 
					
						
							|  |  |  |     const foodData = useFoodData(); | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |     const foodSearch = ref(""); | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |     const foodAutocomplete = ref<HTMLInputElement>(); | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     async function createAssignFood() { | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       foodData.data.name = foodSearch.value; | 
					
						
							| 
									
										
										
										
											2023-09-15 12:19:34 -05:00
										 |  |  |       props.value.food = await foodStore.actions.createOne(foodData.data) || undefined; | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       foodData.reset(); | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |       foodAutocomplete.value?.blur(); | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // ==================================================
 | 
					
						
							|  |  |  |     // Units
 | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |     const unitStore = useUnitStore(); | 
					
						
							|  |  |  |     const unitsData = useUnitData(); | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |     const unitSearch = ref(""); | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |     const unitAutocomplete = ref<HTMLInputElement>(); | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     async function createAssignUnit() { | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       unitsData.data.name = unitSearch.value; | 
					
						
							| 
									
										
										
										
											2023-09-15 12:19:34 -05:00
										 |  |  |       props.value.unit = await unitStore.actions.createOne(unitsData.data) || undefined; | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       unitsData.reset(); | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |       unitAutocomplete.value?.blur(); | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const state = reactive({ | 
					
						
							|  |  |  |       showTitle: false, | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  |       showOriginalText: false, | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function toggleTitle() { | 
					
						
							| 
									
										
										
										
											2022-05-16 01:30:18 +02:00
										 |  |  |       if (state.showTitle) { | 
					
						
							| 
									
										
										
										
											2022-05-25 09:38:21 -08:00
										 |  |  |         props.value.title = ""; | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-22 11:16:23 -08:00
										 |  |  |       state.showTitle = !state.showTitle; | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  |     function toggleOriginalText() { | 
					
						
							|  |  |  |       state.showOriginalText = !state.showOriginalText; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |     function handleUnitEnter() { | 
					
						
							| 
									
										
										
										
											2022-05-25 09:38:21 -08:00
										 |  |  |       if ( | 
					
						
							|  |  |  |         props.value.unit === undefined || | 
					
						
							|  |  |  |         props.value.unit === null || | 
					
						
							|  |  |  |         !props.value.unit.name.includes(unitSearch.value) | 
					
						
							|  |  |  |       ) { | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |         createAssignUnit(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function handleFoodEnter() { | 
					
						
							| 
									
										
										
										
											2022-05-25 09:38:21 -08:00
										 |  |  |       if ( | 
					
						
							|  |  |  |         props.value.food === undefined || | 
					
						
							|  |  |  |         props.value.food === null || | 
					
						
							|  |  |  |         !props.value.food.name.includes(foodSearch.value) | 
					
						
							|  |  |  |       ) { | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |         createAssignFood(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 11:16:23 -08:00
										 |  |  |     function quantityFilter(e: KeyboardEvent) { | 
					
						
							|  |  |  |       // if digit is pressed, add to quantity
 | 
					
						
							|  |  |  |       if (e.key === "-" || e.key === "+" || e.key === "e") { | 
					
						
							|  |  |  |         e.preventDefault(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-28 14:14:21 -08:00
										 |  |  |     return { | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       ...toRefs(state), | 
					
						
							| 
									
										
										
										
											2022-05-22 11:16:23 -08:00
										 |  |  |       quantityFilter, | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  |       toggleOriginalText, | 
					
						
							|  |  |  |       contextMenuOptions, | 
					
						
							| 
									
										
										
										
											2021-11-06 14:32:55 -08:00
										 |  |  |       handleUnitEnter, | 
					
						
							|  |  |  |       handleFoodEnter, | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |       foodAutocomplete, | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |       createAssignFood, | 
					
						
							| 
									
										
										
										
											2024-05-22 16:58:16 -05:00
										 |  |  |       unitAutocomplete, | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |       createAssignUnit, | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       foods: foodStore.foods, | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |       foodSearch, | 
					
						
							| 
									
										
										
										
											2021-08-28 14:14:21 -08:00
										 |  |  |       toggleTitle, | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       unitActions: unitStore.actions, | 
					
						
							|  |  |  |       units: unitStore.units, | 
					
						
							| 
									
										
										
										
											2021-10-30 15:46:44 -08:00
										 |  |  |       unitSearch, | 
					
						
							|  |  |  |       validators, | 
					
						
							| 
									
										
										
										
											2022-05-29 17:29:59 -08:00
										 |  |  |       workingUnitData: unitsData.data, | 
					
						
							| 
									
										
										
										
											2023-03-23 09:21:22 -08:00
										 |  |  |       btns, | 
					
						
							| 
									
										
										
										
											2021-08-28 14:14:21 -08:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |   }, | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  | <style> | 
					
						
							| 
									
										
										
										
											2021-08-27 20:05:02 -08:00
										 |  |  | .v-input__append-outer { | 
					
						
							|  |  |  |   margin: 0 !important; | 
					
						
							|  |  |  |   padding: 0 !important; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | </style> |