From a429510e482964149c53dbfb9ee655f36b82a0d9 Mon Sep 17 00:00:00 2001 From: aldoEMatamala Date: Wed, 13 May 2026 15:31:31 -0300 Subject: [PATCH] =?UTF-8?q?fix(REC-236):=20fix=20Receta=20Andes:=20creaci?= =?UTF-8?q?=C3=B3n=20de=20receta=20con=20cantidad=20otro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/elementos/recetaMedica.component.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/modules/rup/components/elementos/recetaMedica.component.ts b/src/app/modules/rup/components/elementos/recetaMedica.component.ts index 3280821edc..94d956adde 100644 --- a/src/app/modules/rup/components/elementos/recetaMedica.component.ts +++ b/src/app/modules/rup/components/elementos/recetaMedica.component.ts @@ -207,6 +207,11 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha preAgregarMedicamento(form) { if (form.formValid) { + if ((this.ingresoCantidadManual || this.medicamento.cantidad?.valor === 'Otro') && (!this.valorCantidadManual || Number(this.valorCantidadManual) <= 0)) { + this.plex.info('warning', 'Debe ingresar un valor numérico mayor a cero para la cantidad o seleccionar una opción válida.'); + return; + } + // si se ingresó una cantidad manualmente y no se seleccionó ninguna presentación comercial if (this.unidades.length && this.ingresoCantidadManual) { this.showModalCantidadManual(); @@ -259,8 +264,10 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha agregarMedicamento() { if (this.medicamento.cantidad?.valor && this.medicamento.cantidad?.valor !== 'Otro') { this.medicamento.cantidad = Number(this.medicamento.cantidad.valor); - } else if (this.ingresoCantidadManual && this.valorCantidadManual) { - this.medicamento.cantidad = this.valorCantidadManual; + } else if (this.ingresoCantidadManual || this.medicamento.cantidad?.valor === 'Otro') { + this.medicamento.cantidad = this.valorCantidadManual ? Number(this.valorCantidadManual) : null; + } else if (this.medicamento.cantidad && typeof this.medicamento.cantidad === 'object') { + this.medicamento.cantidad = null; } this.registro.valor.medicamentos.push(this.medicamento);