|
@@ -20,6 +20,7 @@ class Formulario extends State<CategoriaProductoForm> {
|
|
final _nombre = TextEditingController();
|
|
final _nombre = TextEditingController();
|
|
final _descripcion = TextEditingController();
|
|
final _descripcion = TextEditingController();
|
|
final _maximo = TextEditingController();
|
|
final _maximo = TextEditingController();
|
|
|
|
+ final _minimo = TextEditingController();
|
|
late int esToping;
|
|
late int esToping;
|
|
|
|
|
|
@override
|
|
@override
|
|
@@ -28,6 +29,7 @@ class Formulario extends State<CategoriaProductoForm> {
|
|
_nombre.text = widget.categoriaProducto.nombre ?? "";
|
|
_nombre.text = widget.categoriaProducto.nombre ?? "";
|
|
_descripcion.text = widget.categoriaProducto.descripcion ?? "";
|
|
_descripcion.text = widget.categoriaProducto.descripcion ?? "";
|
|
_maximo.text = widget.categoriaProducto.maximo?.toString() ?? "";
|
|
_maximo.text = widget.categoriaProducto.maximo?.toString() ?? "";
|
|
|
|
+ _minimo.text = widget.categoriaProducto.minimo?.toString() ?? "";
|
|
esToping = widget.categoriaProducto.esToping ?? 0;
|
|
esToping = widget.categoriaProducto.esToping ?? 0;
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
_loadData();
|
|
_loadData();
|
|
@@ -96,12 +98,28 @@ class Formulario extends State<CategoriaProductoForm> {
|
|
),
|
|
),
|
|
SizedBox(height: 10),
|
|
SizedBox(height: 10),
|
|
if (esToping == 1)
|
|
if (esToping == 1)
|
|
- AppTextField(
|
|
|
|
- maxLength: 2,
|
|
|
|
- etiqueta: 'Máximo',
|
|
|
|
- controller: _maximo,
|
|
|
|
- hintText: 'Máximo permitido en un pedido (opcional)',
|
|
|
|
- keyboardType: TextInputType.number,
|
|
|
|
|
|
+ Row(
|
|
|
|
+ children: [
|
|
|
|
+ Expanded(
|
|
|
|
+ child: AppTextField(
|
|
|
|
+ maxLength: 2,
|
|
|
|
+ etiqueta: 'Máximo',
|
|
|
|
+ controller: _maximo,
|
|
|
|
+ hintText:
|
|
|
|
+ 'Máximo permitido en un pedido (opcional)',
|
|
|
|
+ keyboardType: TextInputType.number,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Expanded(
|
|
|
|
+ child: AppTextField(
|
|
|
|
+ maxLength: 2,
|
|
|
|
+ etiqueta: 'Mínimo',
|
|
|
|
+ controller: _minimo,
|
|
|
|
+ hintText: 'Mínimo a seleccionar en un pedido',
|
|
|
|
+ keyboardType: TextInputType.number,
|
|
|
|
+ ),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
@@ -115,6 +133,9 @@ class Formulario extends State<CategoriaProductoForm> {
|
|
int? maximoValue =
|
|
int? maximoValue =
|
|
_maximo.text.isNotEmpty ? int.tryParse(_maximo.text) : null;
|
|
_maximo.text.isNotEmpty ? int.tryParse(_maximo.text) : null;
|
|
|
|
|
|
|
|
+ int? minimoValue =
|
|
|
|
+ _minimo.text.isNotEmpty ? int.tryParse(_minimo.text) : null;
|
|
|
|
+
|
|
await categoriaProductoVM.updateCategoriaProducto(
|
|
await categoriaProductoVM.updateCategoriaProducto(
|
|
CategoriaProducto(
|
|
CategoriaProducto(
|
|
id: widget.categoriaProducto.id,
|
|
id: widget.categoriaProducto.id,
|
|
@@ -122,6 +143,7 @@ class Formulario extends State<CategoriaProductoForm> {
|
|
descripcion: _descripcion.text,
|
|
descripcion: _descripcion.text,
|
|
esToping: esToping,
|
|
esToping: esToping,
|
|
maximo: maximoValue,
|
|
maximo: maximoValue,
|
|
|
|
+ minimo: minimoValue,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
|
|
|