From 327130da9a554ed0eafc87227893a996f85b9f42 Mon Sep 17 00:00:00 2001 From: lizerk Date: Fri, 22 May 2026 14:09:25 +0300 Subject: [PATCH] procurement: collapse optional item fields --- frontend/src/app/procurement/page.tsx | 137 +++++++++++++++----------- 1 file changed, 79 insertions(+), 58 deletions(-) diff --git a/frontend/src/app/procurement/page.tsx b/frontend/src/app/procurement/page.tsx index 03ef7dca..fd30c9e2 100644 --- a/frontend/src/app/procurement/page.tsx +++ b/frontend/src/app/procurement/page.tsx @@ -1273,69 +1273,90 @@ export default function ProcurementPage() {
- {form.items.map((it, idx) => ( -
- {form.items.length > 1 && ( - - )} -
- updateItemRow(idx, { name: e.target.value })} - placeholder="Название позиции *" - className="app-input w-full rounded-lg px-3 py-2 text-sm" - /> - updateItemRow(idx, { description: e.target.value })} - placeholder="Описание (необязательно)" - className="app-input w-full rounded-lg px-3 py-2 text-sm" - /> -
+ {form.items.map((it, idx) => { + const hasOptionalFields = Boolean( + it.description.trim() || it.supplier_info.trim() || it.linksText.trim(), + ); + + return ( +
+ {form.items.length > 1 && ( + + )} +
updateItemRow(idx, { quantity: e.target.value })} - placeholder="Кол-во" - min={1} - className="app-input rounded-lg px-3 py-2 text-sm" + value={it.name} + onChange={(e) => updateItemRow(idx, { name: e.target.value })} + placeholder="Название позиции *" + className="app-input w-full rounded-lg px-3 py-2 text-sm" /> - updateItemRow(idx, { unit: e.target.value })} - placeholder="Ед." - className="app-input rounded-lg px-3 py-2 text-sm" - /> - updateItemRow(idx, { estimated_unit_price: e.target.value })} - placeholder="Цена/ед." - className="app-input rounded-lg px-3 py-2 text-sm" - /> -
- {it.quantity && it.estimated_unit_price ? money(Number(it.quantity) * Number(it.estimated_unit_price)) : "—"} +
+ updateItemRow(idx, { quantity: e.target.value })} + placeholder="Кол-во" + min={1} + className="app-input rounded-lg px-3 py-2 text-sm" + /> + updateItemRow(idx, { unit: e.target.value })} + placeholder="Ед." + className="app-input rounded-lg px-3 py-2 text-sm" + /> + updateItemRow(idx, { estimated_unit_price: e.target.value })} + placeholder="Цена/ед." + className="app-input rounded-lg px-3 py-2 text-sm" + /> +
+ {it.quantity && it.estimated_unit_price ? money(Number(it.quantity) * Number(it.estimated_unit_price)) : "—"} +
+
+ + + + Дополнительные поля + + {hasOptionalFields ? ( + + заполнено + + ) : null} + +
+ updateItemRow(idx, { description: e.target.value })} + placeholder="Описание (необязательно)" + className="app-input w-full rounded-lg px-3 py-2 text-sm" + /> + updateItemRow(idx, { supplier_info: e.target.value })} + placeholder="Информация о поставщике (необязательно)" + className="app-input w-full rounded-lg px-3 py-2 text-sm" + /> +