diff --git a/frontend/api/class-interfaces/cookbooks.ts b/frontend/api/class-interfaces/cookbooks.ts new file mode 100644 index 000000000000..2a2dc6e18e7e --- /dev/null +++ b/frontend/api/class-interfaces/cookbooks.ts @@ -0,0 +1,31 @@ +import { BaseCRUDAPI } from "./_base"; +import { Category } from "./categories"; +import { CategoryBase } from "~/types/api-types/recipe"; + +const prefix = "/api"; + +export interface CreateCookBook { + name: string; +} + +export interface CookBook extends CreateCookBook { + id: number; + slug: string; + position: number; + group_id: number; + categories: Category[] | CategoryBase[]; +} + +const routes = { + cookbooks: `${prefix}/groups/cookbooks`, + cookbooksId: (id: number) => `${prefix}/groups/cookbooks/${id}`, +}; + +export class CookbookAPI extends BaseCRUDAPI { + baseRoute: string = routes.cookbooks; + itemRoute = routes.cookbooksId; + + async updateAll(payload: CookBook[]) { + return await this.requests.put(this.baseRoute, payload); + } +} diff --git a/frontend/api/index.ts b/frontend/api/index.ts index eccf97a29e8a..bce4725f1676 100644 --- a/frontend/api/index.ts +++ b/frontend/api/index.ts @@ -11,6 +11,7 @@ import { UtilsAPI } from "./class-interfaces/utils"; import { NotificationsAPI } from "./class-interfaces/event-notifications"; import { FoodAPI } from "./class-interfaces/recipe-foods"; import { UnitAPI } from "./class-interfaces/recipe-units"; +import { CookbookAPI } from "./class-interfaces/cookbooks"; import { ApiRequestInstance } from "~/types/api"; class Api { @@ -27,6 +28,7 @@ class Api { public notifications: NotificationsAPI; public foods: FoodAPI; public units: UnitAPI; + public cookbooks: CookbookAPI; // Utils public upload: UploadFile; @@ -46,6 +48,7 @@ class Api { // Users this.users = new UserApi(requests); this.groups = new GroupAPI(requests); + this.cookbooks = new CookbookAPI(requests); // Admin this.debug = new DebugAPI(requests); diff --git a/frontend/components/Domain/Recipe/RecipeIngredients.vue b/frontend/components/Domain/Recipe/RecipeIngredients.vue index afeeb34de013..2feebc514676 100644 --- a/frontend/components/Domain/Recipe/RecipeIngredients.vue +++ b/frontend/components/Domain/Recipe/RecipeIngredients.vue @@ -46,6 +46,7 @@ export default { if (props.disableAmount) { return ingredient.note; } + const { quantity, food, unit, note } = ingredient; let return_qty = ""; @@ -59,7 +60,7 @@ export default { return_qty += ` ${fraction[1]}${fraction[2]}`; } } else { - return_qty = quantity; + return_qty = quantity * props.scale; } return `${return_qty} ${unit?.name || " "} ${food?.name || " "} ${note}`; diff --git a/frontend/components/Layout/AppSidebar.vue b/frontend/components/Layout/AppSidebar.vue index 888a70472b3f..ae3fcbfc6e93 100644 --- a/frontend/components/Layout/AppSidebar.vue +++ b/frontend/components/Layout/AppSidebar.vue @@ -2,7 +2,7 @@ - + {{ child.icon }} @@ -47,7 +47,7 @@ v-model="secondarySelected" color="primary" > - + {{ nav.icon }} @@ -62,7 +62,7 @@