1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 05:25:26 +02:00

Feature/shopping lists second try (#927)

* generate types

* use generated types

* ui updates

* init button link for common styles

* add links

* setup label views

* add delete confirmation

* reset when not saved

* link label to foods and auto set when adding to shopping list

* generate types

* use inheritence to manage exception handling

* fix schema generation and add test for open_api generation

* add header to api docs

* move list consilidation to service

* split list and list items controller

* shopping list/list item tests - PARTIAL

* enable recipe add/remove in shopping lists

* generate types

* linting

* init global utility components

* update types and add list item api

* fix import cycle and database error

* add container and border classes

* new recipe list component

* fix tests

* breakout item editor

* refactor item editor

* update bulk actions

* update input / color contrast

* type generation

* refactor controller dependencies

* include food/unit editor

* remove console.logs

* fix and update type generation

* fix incorrect type for column

* fix postgres error

* fix delete by variable

* auto remove refs

* fix typo
This commit is contained in:
Hayden 2022-01-16 15:24:24 -09:00 committed by GitHub
parent f794208862
commit 92cf97e401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 2556 additions and 685 deletions

View file

@ -15,6 +15,14 @@
<v-form ref="domCreateFoodForm">
<v-text-field v-model="workingFoodData.name" label="Name" :rules="[validators.required]"></v-text-field>
<v-text-field v-model="workingFoodData.description" label="Description"></v-text-field>
<v-autocomplete
v-model="workingFoodData.labelId"
clearable
:items="allLabels"
item-value="id"
item-text="name"
>
</v-autocomplete>
</v-form>
</v-card-text>
</BaseDialog>
@ -50,6 +58,11 @@
</v-expand-transition>
<v-data-table :headers="headers" :items="foods || []" item-key="id" class="elevation-0" :search="search">
<template #item.label="{ item }">
<v-chip v-if="item.label" label>
{{ item.label.name }}
</v-chip>
</template>
<template #item.actions="{ item }">
<div class="d-flex justify-end">
<BaseButton
@ -79,8 +92,10 @@
<script lang="ts">
import { defineComponent, reactive, toRefs, ref, computed } from "@nuxtjs/composition-api";
import { useUserApi } from "~/composables/api";
import { useFoods } from "~/composables/recipes";
import { validators } from "~/composables/use-validators";
import { MultiPurposeLabelSummary } from "~/types/api-types/labels";
export default defineComponent({
layout: "admin",
setup() {
@ -111,6 +126,7 @@ export default defineComponent({
{ text: "Id", value: "id" },
{ text: "Name", value: "name" },
{ text: "Description", value: "description" },
{ text: "Label", value: "label" },
{ text: "", value: "actions", sortable: false },
],
filter: false,
@ -118,7 +134,20 @@ export default defineComponent({
search: "",
});
const userApi = useUserApi();
const allLabels = ref([] as MultiPurposeLabelSummary[]);
async function refreshLabels() {
const { data } = await userApi.multiPurposeLabels.getAll();
allLabels.value = data ?? [];
}
refreshLabels();
return {
allLabels,
refreshLabels,
...toRefs(state),
actions,
dialog,