Skip to content

Commit 4b2d805

Browse files
grachosclaude
andcommitted
Fill remesa Descripción from the picked product, and seed new remesas from the solicitud.
Picking a product in "Producto / mercancía" only ever set mercancia_codigo — Descripción stayed whatever it was before, even though the search result already carries the product's name (catalogo.repo.ts's buscarProductos() returns it as `nombre`). Now onSelect fills both, and Descripción remains a plain editable input so it can still be corrected by hand. "Agregar remesa" also built a blank remesa instead of reusing the solicitud's own captured product/naturaleza/empaque/peso/terceros — the same defaults the first remesa already gets via remesaDesde(solicitud). Every remesa added now starts from those same solicitud defaults instead of empty fields. Verified live: added a second remesa (inherited "Aceite de palma crudo CPO" / 000811 from the solicitud), then picked a different product and confirmed Descripción updated to that product's own name while the first remesa was untouched, and that the field still accepts manual edits afterward. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7d299c9 commit 4b2d805

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

frontend/src/pages/despachos/DespachoForm.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,11 @@ export default function DespachoForm() {
325325
<div className="flex items-center justify-between">
326326
<legend className="px-1 text-sm font-semibold text-celeste-700">Remesas del despacho</legend>
327327
{!editar && (
328-
<button type="button" className="btn-ghost text-xs" onClick={() => setRemesas((rs) => [...rs, remesaDesde()])}>
328+
<button
329+
type="button"
330+
className="btn-ghost text-xs"
331+
onClick={() => setRemesas((rs) => [...rs, remesaDesde(sol ?? {})])}
332+
>
329333
<Plus size={14} /> Agregar remesa
330334
</button>
331335
)}
@@ -379,7 +383,10 @@ export default function DespachoForm() {
379383
placeholder="Buscar producto…"
380384
initialLabel={r.mercancia_codigo}
381385
onClear={() => updRemesa(i, 'mercancia_codigo', '')}
382-
onSelect={(it) => updRemesa(i, 'mercancia_codigo', String(it.codigo ?? ''))}
386+
onSelect={(it) => {
387+
updRemesa(i, 'mercancia_codigo', String(it.codigo ?? ''));
388+
updRemesa(i, 'descripcion_producto', String(it.nombre ?? ''));
389+
}}
383390
/>
384391
</div>
385392
<div className="sm:col-span-2">

0 commit comments

Comments
 (0)