Skip to content

Products ​

The / page is the back office's only screen. It shows the number of products, an add form and the product table.

The interface is in French: the labels below are quoted as they appear, with a translation.

Displaying the list ​

ColumnRule
Produit (product)The name in bold, the description below it if any
Prix (price)Two decimals, French comma, euro sign: 2.5 → 2,50 €
StockThe raw number
État (status)A badge computed from the stock (see below)
(action)A Supprimer (delete) button

The stock badge ​

StockBadgeColour
0Rupture (out of stock)red
1 to 9Stock faible (low stock)orange
10 and moreEn stock (in stock)green

The threshold of 10 is written in stockStatus(), in web/components/ProductList.js. See The product list.

The counter ​

Next to the title: "1 produit", "3 produits". It disappears if the API is unavailable.

Empty list, missing API ​

SituationDisplay
No products"Aucun produit." (no products)
The API does not answerA banner "API indisponible : …", without form or table

Adding a product ​

FieldRequiredRule in the formRule in the API
Nom (name)yesat most 120 charactersat most 120 characters
Prix (€) (price)yesnumber ≥ 0, step 0.01decimal ≥ 0, 2 decimals
Stockyesinteger ≥ 0, 0 by defaultinteger ≥ 0
Descriptionnofree textfree text

The browser already blocks invalid values. But the API decides: if it refuses (code 400), the message "Ajout impossible : API responded with status 400" appears under the form. The API rules are in Products (API).

While sending, the button shows "Ajout…" and cannot be clicked again.

Deleting a product ​

The Supprimer button on each row deletes the product immediately, without confirmation. The page then refreshes.

No confirmation, no undo

A delete is final. There is no "Are you sure?" dialog yet. It is listed in the Limits.

The full code is explained in Adding and deleting.