diff --git a/backend/internal/db/mongo/restock_misc.go b/backend/internal/db/mongo/restock_misc.go index c1d7932..d24eed4 100644 --- a/backend/internal/db/mongo/restock_misc.go +++ b/backend/internal/db/mongo/restock_misc.go @@ -51,7 +51,18 @@ func (b *Backend) GetAllRestocks(ctx context.Context, page uint64, size uint64) ctx, cancel := b.TimeoutContext(ctx) defer cancel() - filter := bson.M{} + filter := bson.M{ + "$or": []bson.M{ + { + "deleted_at": bson.M{ + "$exists": false, + }, + }, + { + "deleted_at": nil, + }, + }, + } // Get "size" restocks from "page" using aggregation var restocks []*models.Restock @@ -72,7 +83,18 @@ func (b *Backend) CountAllRestocks(ctx context.Context) (uint64, error) { ctx, cancel := b.TimeoutContext(ctx) defer cancel() - filter := bson.M{} + filter := bson.M{ + "$or": []bson.M{ + { + "deleted_at": bson.M{ + "$exists": false, + }, + }, + { + "deleted_at": nil, + }, + }, + } count, err := b.db.Collection(RestocksCollection).CountDocuments(ctx, filter) if err != nil { diff --git a/frontend/src/routes/panel/products/reappro/+page.svelte b/frontend/src/routes/panel/products/reappro/+page.svelte index a94a1ad..be309a4 100644 --- a/frontend/src/routes/panel/products/reappro/+page.svelte +++ b/frontend/src/routes/panel/products/reappro/+page.svelte @@ -1,5 +1,6 @@
@@ -605,15 +620,33 @@ Prix total TTC

+ +

+ Actions +

+ - {#each restoks as restok} + + {#if deletingRestock} + { + deletingRestock = false; + }} + confirm_callback={deleteRestockCallback} + /> + {/if} + {#each restocks as restock}
-

{restok.created_at}

+

{restock.created_at}

@@ -622,7 +655,7 @@
-

{restok.type}

+

{restock.type}

@@ -631,7 +664,7 @@
-

{restok.created_by_name}

+

{restock.created_by_name}

@@ -639,11 +672,189 @@

- {formatPrice(restok.total_cost_ttc)} + {formatPrice(restock.total_cost_ttc)}

+ +
+ + +
+ {/each} + {#if selectedRestock != undefined} + + + + + + + + + + + + + + {#each selectedRestock.items as item} + + + + + + + + + + + {/each} +
+ + Nom + + + + Prix coûtant HT + + + + Prix coûtant TTC + + + + Nombre de lots + + + + Nbr produits par lots + + + + Prix d'un lot HT + + + + TVA + + + + Prix d'un lot TTC + +
+
+
+

{item.item_name}

+
+
+
+
+
+

{formatPrice(item.bundle_cost_ht * item.amount_of_bundle)}

+
+
+
+
+
+

+ {formatPrice(item.bundle_cost_ttc * item.amount_of_bundle)} +

+
+
+
+
+
+

{item.amount_of_bundle}

+
+
+
+
+
+

{item.amount_per_bundle}

+
+
+
+
+
+

{formatPrice(item.bundle_cost_ht)}

+
+
+
+
+
+

{item.tva / 100}%

+
+
+
+
+
+

{formatPrice(item.bundle_cost_ttc)}

+
+
+
+ {/if}