diff --git a/vue3/src/components/display/HorizontalRecipeWindow.vue b/vue3/src/components/display/HorizontalRecipeWindow.vue index f07a09bd91..2cf9588cf2 100644 --- a/vue3/src/components/display/HorizontalRecipeWindow.vue +++ b/vue3/src/components/display/HorizontalRecipeWindow.vue @@ -45,11 +45,12 @@ import {ApiApi, ApiRecipeListRequest, Keyword, Recipe, RecipeOverview} from "@/o import {homePageCols} from "@/utils/breakpoint_utils"; import {useI18n} from "vue-i18n"; import {DateTime} from "luxon"; +import {tr} from "vuetify/locale"; //TODO mode ideas "last year/month/cooked long ago" const props = defineProps( { - mode: {type: String as PropType<'recent' | 'new' | 'keyword' | 'rating'>, required: true}, + mode: {type: String as PropType<'recent' | 'new' | 'keyword' | 'rating' | 'random'>, required: true}, skeletons: {type: Number, default: 0}, } ) @@ -68,6 +69,8 @@ const title = computed(() => { switch (props.mode) { case 'recent': return t('Recently_Viewed') + case 'random': + return t('Random Recipes') case 'new': return t('New') case 'rating': @@ -87,6 +90,8 @@ const icon = computed(() => { switch (props.mode) { case 'recent': return 'fa-solid fa-eye' + case 'random': + return 'fa-solid fa-dice' case 'new': return 'fa-solid fa-calendar-alt' case 'rating': @@ -116,9 +121,11 @@ function loadRecipes() { switch (props.mode) { case 'recent': - // TODO implement correct parameter requestParameters.numRecent = 16 break; + case 'random': + requestParameters.random = 'true' + break; case 'new': requestParameters._new = 'true' break; diff --git a/vue3/src/components/inputs/GlobalSearchDialog.vue b/vue3/src/components/inputs/GlobalSearchDialog.vue index 4f4549b4a6..c29799ded6 100644 --- a/vue3/src/components/inputs/GlobalSearchDialog.vue +++ b/vue3/src/components/inputs/GlobalSearchDialog.vue @@ -91,21 +91,20 @@ const searchResults = computed(() => { let searchResults = [] as Array if (searchQuery.value != '' && searchQuery.value != null) { - // TODO add link to advanced search once it exists - //searchResults.push({name: searchQuery.value, icon: 'fas fa-search', suffix: 'Advanced Search'} as SearchResult) - flatRecipes.value.filter(fr => fr.name.toLowerCase().includes(searchQuery.value.toLowerCase())).slice(0, 10).forEach(r => { - searchResults.push({name: r.name, image: r.image, recipeId: r.id} as SearchResult) + searchResults.push({name: r.name, image: r.image, recipeId: r.id, type: "recipe"} as SearchResult) }) if (searchResults.length < 3) { asyncSearchResults.value.slice(0, 5).forEach(r => { if (searchResults.findIndex(x => x.recipeId == r.id) == -1) { - searchResults.push({name: r.name, image: r.image, recipeId: r.id}) + searchResults.push({name: r.name, image: r.image, recipeId: r.id, type: "recipe"}) } }) } + searchResults.push({name: searchQuery.value, icon: 'fas fa-search', type: "link_advanced_search"} as SearchResult) + } else { // show first 5 recipes by default @@ -212,10 +211,17 @@ function cardVariant(index: number) { function goToSelectedRecipe(index: number) { dialog.value = false let searchResult = searchResults.value[index] - console.log('going to', searchResult.recipeId) - if (searchResult.recipeId != null) { - router.push({name: 'view_recipe', params: {'id': searchResult.recipeId}}) + + if (searchResult.type == 'link_advanced_search') { + router.push({name: 'view_search', query: {'query': searchQuery.value}}) + } else { + console.log('going to', searchResult.recipeId) + if (searchResult.recipeId != null) { + router.push({name: 'view_recipe', params: {'id': searchResult.recipeId}}) + } } + + } diff --git a/vue3/src/components/inputs/ModelSelect.vue b/vue3/src/components/inputs/ModelSelect.vue index 895a04eb37..09895072cf 100644 --- a/vue3/src/components/inputs/ModelSelect.vue +++ b/vue3/src/components/inputs/ModelSelect.vue @@ -19,7 +19,7 @@ :on-create="createObject" :createOption="props.allowCreate" :delay="300" - :object="true" + :object="props.object" :valueProp="itemValue" :label="itemLabel" :searchable="true" @@ -72,6 +72,7 @@ const props = defineProps({ mode: {type: String as PropType<'single' | 'multiple' | 'tags'>, default: 'single'}, appendToBody: {type: Boolean, default: false}, + object: {type: Boolean, default: true}, allowCreate: {type: Boolean, default: false}, diff --git a/vue3/src/components/model_editors/CustomFilterEditor.vue b/vue3/src/components/model_editors/CustomFilterEditor.vue new file mode 100644 index 0000000000..a408b7426b --- /dev/null +++ b/vue3/src/components/model_editors/CustomFilterEditor.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/vue3/src/pages/IngredientEditorPage.vue b/vue3/src/pages/IngredientEditorPage.vue index 3dea67673d..f9b50e8e02 100644 --- a/vue3/src/pages/IngredientEditorPage.vue +++ b/vue3/src/pages/IngredientEditorPage.vue @@ -179,7 +179,6 @@ const selectedFood = ref(null) const selectedUnit = ref(null) const deleteConfirmDialog = ref(false) -const deleteConfirmIngredient = ref({} as EditorIngredient) onMounted(() => { getAndLoadParameters() diff --git a/vue3/src/pages/SearchPage.vue b/vue3/src/pages/SearchPage.vue index ae3756a5de..04a7873d74 100644 --- a/vue3/src/pages/SearchPage.vue +++ b/vue3/src/pages/SearchPage.vue @@ -1,43 +1,137 @@ -