From 739d5037562dabe1281bf4dab09398bf1dcabf2c Mon Sep 17 00:00:00 2001 From: JULLIEN Baptiste Date: Sat, 27 Apr 2024 11:37:59 +0200 Subject: [PATCH] fix formatting --- backend/internal/db/mongo/item_misc.go | 2 +- backend/internal/models/account.go | 4 +- .../src/lib/components/panel/modules.svelte | 8 +- .../routes/panel/products/course/+page.svelte | 139 +++++++++--------- .../panel/products/fournisseur/+page.svelte | 16 +- 5 files changed, 88 insertions(+), 81 deletions(-) diff --git a/backend/internal/db/mongo/item_misc.go b/backend/internal/db/mongo/item_misc.go index 8b1fb80..fa61183 100644 --- a/backend/internal/db/mongo/item_misc.go +++ b/backend/internal/db/mongo/item_misc.go @@ -75,7 +75,7 @@ func (b *Backend) GetItems(ctx context.Context, categoryID string, page, size ui if fournisseur != "" { filter["fournisseur"] = fournisseur } - + cursor, err := b.db.Collection(ItemsCollection).Find(ctx, filter, options.Find().SetSkip(int64(page*size)).SetLimit(int64(size))) if err != nil { return nil, err diff --git a/backend/internal/models/account.go b/backend/internal/models/account.go index 73abbbd..f4371df 100644 --- a/backend/internal/models/account.go +++ b/backend/internal/models/account.go @@ -32,9 +32,9 @@ func (o *Account) VerifyPin(pwd string) bool { } func (o *Account) VerifyPassword(pwd string) bool { - if (o.Account.Password != nil) { + if o.Account.Password != nil { ok, _ := hash.Verify(*o.Account.Password, pwd) - return ok + return ok } return false } diff --git a/frontend/src/lib/components/panel/modules.svelte b/frontend/src/lib/components/panel/modules.svelte index c67c598..112dddd 100644 --- a/frontend/src/lib/components/panel/modules.svelte +++ b/frontend/src/lib/components/panel/modules.svelte @@ -70,12 +70,12 @@ name: 'Fournisseur', color: 'bg-green-600', link: '/panel/products/fournisseur' - }) + }); modules.push({ - name: "Course", - color: "bg-green-600", + name: 'Course', + color: 'bg-green-600', link: '/panel/products/course' - }) + }); // Sort the modules by name modules.sort((a, b) => a.name.localeCompare(b.name)); diff --git a/frontend/src/routes/panel/products/course/+page.svelte b/frontend/src/routes/panel/products/course/+page.svelte index 1bcdae3..9edff36 100644 --- a/frontend/src/routes/panel/products/course/+page.svelte +++ b/frontend/src/routes/panel/products/course/+page.svelte @@ -4,79 +4,82 @@ import type { CourseItem, Item, RestockType } from '$lib/api'; let items: CourseItem[] = []; - let fournisseur = "promocash"; - function reloadCourse() { - CourseApi() - .getCourse(fournisseur, { - withCredentials: true - }) - .then((res) => { - if (res.data.items != null) { - items = res.data.items; - } else { - items = []; - } - }); - } - reloadCourse() + let fournisseur = 'promocash'; + function reloadCourse() { + CourseApi() + .getCourse(fournisseur, { + withCredentials: true + }) + .then((res) => { + if (res.data.items != null) { + items = res.data.items; + } else { + items = []; + } + }); + } + reloadCourse();
- - + +
- - - - - - - - - + + + + + + + + +
- - Nom - - - - Nombre à acheter - -
- {#each items as item} -

- {item.item.name} -

- {/each} -
- {#each items as item} -

- {item.amountToBuy} -

- {/each} -
+ + Nom + + + + Nombre à acheter + +
+ {#each items as item} +

+ {item.item.name} +

+ {/each} +
+ {#each items as item} +

+ {item.amountToBuy} +

+ {/each} +
- diff --git a/frontend/src/routes/panel/products/fournisseur/+page.svelte b/frontend/src/routes/panel/products/fournisseur/+page.svelte index 22d11ad..1ca0f20 100644 --- a/frontend/src/routes/panel/products/fournisseur/+page.svelte +++ b/frontend/src/routes/panel/products/fournisseur/+page.svelte @@ -6,7 +6,7 @@ ItemPrices, UpdateItem, AccountPriceRole, - RestockType, + RestockType } from '$lib/api'; import ConfirmationPopup from '$lib/components/confirmationPopup.svelte'; import { api } from '$lib/config/config'; @@ -31,7 +31,7 @@ staff_bar: 0, coutant: 0, privilegies: 0, - menu: 0, + menu: 0 } as ItemPrices, amount_left: 0, buy_limit: undefined, @@ -464,12 +464,12 @@ {#if deletingItem} - { deletingItem = false; - }} + }} confirm_callback={deleteItemCallback} /> {/if} @@ -778,7 +778,11 @@ on:input={(e) => { // @ts-ignore let amount_per_bundle = parseInt(e.target?.value); - editItem(item.id, { amount_per_bundle: amount_per_bundle }, item.category_id); + editItem( + item.id, + { amount_per_bundle: amount_per_bundle }, + item.category_id + ); }} /> @@ -859,7 +863,7 @@ deleteItemCallback = () => { deletingItem = false; deleteItem(item.id, item.category_id); - } + }; confirmationMessage = "Supprimer '" + item.name + "' ?"; deletingItem = true; }}