Procházet zdrojové kódy

Propina en Corte de caja

OscarGil03 před 2 měsíci
rodič
revize
1d6c3d91b8

+ 0 - 1
lib/models/item_carrito_model.dart

@@ -1,5 +1,4 @@
 import 'package:flutter/material.dart';
-import 'toping_model.dart';
 import 'producto_model.dart';
 
 class ItemCarrito {

+ 0 - 3
lib/models/pedido_model.dart

@@ -1,7 +1,4 @@
-import 'package:intl/intl.dart';
-
 import 'models.dart';
-import '../services/services.dart';
 
 class Pedido extends Basico {
   int? folio;

+ 0 - 1
lib/models/permiso_model.dart

@@ -21,7 +21,6 @@ class Permiso {
       this.creado,
       this.modificado});
 
-  @override
   Map<String, dynamic> toJson() {
     return {
       'id': id,

+ 41 - 0
lib/services/repo_service.dart

@@ -1663,4 +1663,45 @@ class RepoService<T> {
       whereArgs: [idCategoria],
     );
   }
+
+  Future<List<Pedido>> obtenerPedidosConPropinasPorCorte(
+      String idCorteCaja) async {
+    Database? dbClient = await db;
+
+    List<Map<String, dynamic>> maps = await dbClient!.rawQuery('''
+    SELECT *
+    FROM Pedido
+    WHERE idCorteCaja = ?
+      AND estatus = 'TERMINADO'
+      AND eliminado IS NULL
+      AND id IN (
+        SELECT idPedido
+        FROM Propinas
+        WHERE eliminado IS NULL
+      )
+    ORDER BY id DESC
+  ''', [idCorteCaja]);
+
+    List<Pedido> pedidos = [];
+    for (var map in maps) {
+      Pedido pedido = Pedido.fromJson(map);
+
+      List<Propinas> propinas = await obtenerPropinasPorPedido(pedido.id!);
+      pedido.propinas = propinas;
+
+      pedidos.add(pedido);
+    }
+
+    return pedidos;
+  }
+
+  Future<List<Propinas>> obtenerPropinasPorPedido(int idPedido) async {
+    Database? dbClient = await db;
+    List<Map<String, dynamic>> maps = await dbClient!.query(
+      'Propinas',
+      where: 'idPedido = ? AND eliminado IS NULL',
+      whereArgs: [idPedido],
+    );
+    return maps.map((map) => Propinas.fromJson(map)).toList();
+  }
 }

+ 60 - 2
lib/viewmodels/corte_caja_view_model.dart

@@ -2,13 +2,13 @@ import 'package:collection/collection.dart';
 
 import '../../widgets/widgets.dart';
 import 'package:flutter/material.dart';
-import 'package:intl/intl.dart';
 import 'package:uuid/uuid.dart';
 import '../data/api_response.dart';
 import '../models/models.dart';
-import '../services/repo_service.dart';
 import '../services/services.dart';
 import '../views/corte_caja/corte_caja_ticket.dart';
+import 'dart:convert';
+import 'package:http/http.dart' as http;
 
 class CorteCajaViewModel extends ChangeNotifier {
   List<CorteCaja> _cortes = [];
@@ -62,6 +62,12 @@ class CorteCajaViewModel extends ChangeNotifier {
   TextEditingController get fondoDiaSigController => _fondoDiaSigController;
   TextEditingController get ventaPuntosController => ventaPuntosController;
 
+  List<Pedido> _pedidosConPropinas = [];
+  double _totalPropinas = 0.0;
+
+  List<Pedido> get pedidosConPropinas => _pedidosConPropinas;
+  double get totalPropinas => _totalPropinas;
+
   void setIsLoading(bool loading) {
     _isLoading = loading;
     notifyListeners();
@@ -527,4 +533,56 @@ class CorteCajaViewModel extends ChangeNotifier {
       'ventaEfe': ventaEfe,
     };
   }
+
+  Future<List<Pedido>> fetchPedidosCancelados(String idCorteCaja) async {
+    var db = await RepoService().db;
+    List<Map<String, dynamic>> maps = await db!.query(
+      'Pedido',
+      where: 'idCorteCaja = ? AND eliminado IS NULL AND estatus = ?',
+      whereArgs: [idCorteCaja, 'CANCELADO'],
+    );
+    return maps.map((map) => Pedido.fromJson(map)).toList();
+  }
+
+  Future<DateTime?> fetchHoraLocal() async {
+    try {
+      final url = Uri.parse('https://worldtimeapi.org/api/ip');
+      final response = await http.get(url);
+
+      if (response.statusCode == 200) {
+        final data = jsonDecode(response.body);
+        final dateTimeString = data['datetime'] as String;
+        DateTime serverDateTime = DateTime.parse(dateTimeString);
+        final localTime = serverDateTime.toLocal();
+
+        return localTime;
+      } else {
+        print("Error al consultar la hora: ${response.statusCode}");
+        return null;
+      }
+    } catch (e) {
+      print("Excepción al consultar la hora: $e");
+      return null;
+    }
+  }
+
+  Future<void> fetchPedidosConPropinas(String idCorteCaja) async {
+    RepoService<Pedido> repoPedido = RepoService<Pedido>();
+
+    List<Pedido> pedidosPropina =
+        await repoPedido.obtenerPedidosConPropinasPorCorte(idCorteCaja);
+
+    double sumaPropinas = 0.0;
+    for (var pedido in pedidosPropina) {
+      double sumLocal = pedido.propinas.fold(
+        0.0,
+        (prev, propina) => prev + (propina.cantidad ?? 0.0),
+      );
+      sumaPropinas += sumLocal;
+    }
+    _pedidosConPropinas = pedidosPropina;
+    _totalPropinas = sumaPropinas;
+
+    notifyListeners();
+  }
 }

+ 239 - 0
lib/views/corte_caja/corte_caja_finalizado_screen.dart

@@ -1,3 +1,4 @@
+import '../../models/models.dart';
 import '../../widgets/widgets.dart';
 import 'package:flutter/material.dart';
 import 'package:provider/provider.dart';
@@ -19,11 +20,21 @@ class CorteCajaFinalizadoScreen extends StatefulWidget {
 class _CorteCajaFinalizadoScreenState extends State<CorteCajaFinalizadoScreen> {
   Map<String, bool> _expandedSections = {};
 
+  List<Pedido> _pedidosCancelados = [];
+
   @override
   void initState() {
     super.initState();
     final viewModel = Provider.of<CorteCajaViewModel>(context, listen: false);
     viewModel.fetchDepositosAndRetiros(widget.corteCajaId!);
+
+    viewModel.fetchPedidosCancelados(widget.corteCajaId!).then((pedidos) {
+      setState(() {
+        _pedidosCancelados = pedidos;
+      });
+    });
+
+    viewModel.fetchPedidosConPropinas(widget.corteCajaId!);
   }
 
   @override
@@ -76,6 +87,15 @@ class _CorteCajaFinalizadoScreenState extends State<CorteCajaFinalizadoScreen> {
                   _buildExpandableTable(
                       "Retiros", viewModel.retiros, totalRetiro),
                   _buildExpandableTable("Gastos", viewModel.gastos, totalGasto),
+                  _buildExpandablePropinas(
+                    "Propinas",
+                    viewModel.pedidosConPropinas,
+                    viewModel.totalPropinas,
+                  ),
+                  _buildExpandablePedidosCancelados(
+                    "Pedidos Cancelados",
+                    _pedidosCancelados,
+                  ),
                   Table(
                     defaultVerticalAlignment: TableCellVerticalAlignment.middle,
                     columnWidths: {
@@ -208,4 +228,223 @@ class _CorteCajaFinalizadoScreenState extends State<CorteCajaFinalizadoScreen> {
       ],
     );
   }
+
+  Widget _buildExpandablePedidosCancelados(String title, List<Pedido> pedidos) {
+    final isExpanded = _expandedSections[title] ?? true;
+
+    return Column(
+      children: [
+        GestureDetector(
+          onTap: () {
+            setState(() {
+              _expandedSections[title] = !isExpanded;
+            });
+          },
+          child: Container(
+            child: Table(
+              defaultVerticalAlignment: TableCellVerticalAlignment.middle,
+              columnWidths: {0: FlexColumnWidth(4), 1: FlexColumnWidth(2)},
+              children: [
+                TableRow(
+                  children: [
+                    Container(
+                      padding: const EdgeInsets.all(8.5),
+                      decoration:
+                          BoxDecoration(border: Border.all(color: Colors.grey)),
+                      child: Text(
+                        title,
+                        style: TextStyle(
+                            fontWeight: FontWeight.bold, fontSize: 18),
+                      ),
+                    ),
+                    Container(
+                      padding: const EdgeInsets.all(8.5),
+                      decoration:
+                          BoxDecoration(border: Border.all(color: Colors.grey)),
+                      child: Row(
+                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                        children: [
+                          Text(
+                            "Total: ${pedidos.length}",
+                            style: TextStyle(
+                                fontWeight: FontWeight.bold, fontSize: 18),
+                          ),
+                          Icon(isExpanded
+                              ? Icons.expand_less
+                              : Icons.expand_more),
+                        ],
+                      ),
+                    ),
+                  ],
+                ),
+              ],
+            ),
+          ),
+        ),
+
+        // Contenido expandido
+        if (isExpanded)
+          pedidos.isNotEmpty
+              ? Table(
+                  defaultVerticalAlignment: TableCellVerticalAlignment.middle,
+                  columnWidths: {0: FlexColumnWidth(4), 1: FlexColumnWidth(2)},
+                  children: pedidos.map((pedido) {
+                    // Construir fila con folio, totalPedido y tipoPago si existe
+                    // Observa que en la primer celda pondremos el texto completo
+                    // y la segunda celda podría quedar vacía o un " - "
+                    final tipoPago = (pedido.tipoPago?.isNotEmpty ?? false)
+                        ? " - ${pedido.tipoPago}"
+                        : "";
+                    return TableRow(
+                      children: [
+                        Container(
+                          padding: const EdgeInsets.all(8.5),
+                          decoration: BoxDecoration(
+                              border: Border.all(color: Colors.grey)),
+                          child: Text(
+                            "Folio: ${pedido.folio} "
+                            "$tipoPago",
+                            style: TextStyle(
+                                fontSize: 16, fontWeight: FontWeight.w600),
+                          ),
+                        ),
+                        Container(
+                          padding: const EdgeInsets.all(8.5),
+                          decoration: BoxDecoration(
+                              border: Border.all(color: Colors.grey)),
+                          child: Text(
+                            "\$${pedido.totalPedido?.toStringAsFixed(2) ?? '0.00'}",
+                            style: TextStyle(
+                                fontSize: 16, fontWeight: FontWeight.w600),
+                          ),
+                        ),
+                      ],
+                    );
+                  }).toList(),
+                )
+              : Padding(
+                  padding: const EdgeInsets.all(8.0),
+                  child: Text(
+                    "No hay pedidos cancelados para este corte.",
+                    style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
+                  ),
+                ),
+      ],
+    );
+  }
+
+  Widget _buildExpandablePropinas(
+      String title, List<Pedido> pedidos, double totalPropinas) {
+    final isExpanded = _expandedSections[title] ?? true;
+
+    return Column(
+      children: [
+        GestureDetector(
+          onTap: () {
+            setState(() {
+              _expandedSections[title] = !isExpanded;
+            });
+          },
+          child: Container(
+            child: Table(
+              defaultVerticalAlignment: TableCellVerticalAlignment.middle,
+              columnWidths: {0: FlexColumnWidth(4), 1: FlexColumnWidth(2)},
+              children: [
+                TableRow(
+                  children: [
+                    Container(
+                      padding: const EdgeInsets.all(8.5),
+                      decoration:
+                          BoxDecoration(border: Border.all(color: Colors.grey)),
+                      child: Text(
+                        title,
+                        style: TextStyle(
+                          fontWeight: FontWeight.bold,
+                          fontSize: 18,
+                        ),
+                      ),
+                    ),
+                    Container(
+                      padding: const EdgeInsets.all(8.5),
+                      decoration:
+                          BoxDecoration(border: Border.all(color: Colors.grey)),
+                      child: Row(
+                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                        children: [
+                          // Mostramos el total general de propinas
+                          Text(
+                            "\$${totalPropinas.toStringAsFixed(2)}",
+                            style: TextStyle(
+                              fontWeight: FontWeight.bold,
+                              fontSize: 18,
+                            ),
+                          ),
+                          Icon(isExpanded
+                              ? Icons.expand_less
+                              : Icons.expand_more),
+                        ],
+                      ),
+                    ),
+                  ],
+                ),
+              ],
+            ),
+          ),
+        ),
+        if (isExpanded)
+          pedidos.isNotEmpty
+              ? Table(
+                  defaultVerticalAlignment: TableCellVerticalAlignment.middle,
+                  columnWidths: {0: FlexColumnWidth(4), 1: FlexColumnWidth(2)},
+                  children: pedidos.map((pedido) {
+                    // Sumar propinas para este pedido en particular
+                    double sumaPropinasPedido = pedido.propinas.fold(
+                      0.0,
+                      (prev, propina) => prev + (propina.cantidad ?? 0),
+                    );
+                    return TableRow(
+                      children: [
+                        Container(
+                          padding: const EdgeInsets.all(8.5),
+                          decoration: BoxDecoration(
+                            border: Border.all(color: Colors.grey),
+                          ),
+                          child: Text(
+                            "Folio: ${pedido.folio} - Total: \$${(pedido.totalPedido ?? 0).toStringAsFixed(2)}",
+                            style: TextStyle(
+                              fontSize: 16,
+                              fontWeight: FontWeight.w600,
+                            ),
+                          ),
+                        ),
+                        Container(
+                          padding: const EdgeInsets.all(8.5),
+                          decoration: BoxDecoration(
+                            border: Border.all(color: Colors.grey),
+                          ),
+                          child: Text(
+                            "\$${sumaPropinasPedido.toStringAsFixed(2)}",
+                            style: TextStyle(
+                              fontSize: 16,
+                              fontWeight: FontWeight.w600,
+                            ),
+                          ),
+                        ),
+                      ],
+                    );
+                  }).toList(),
+                )
+              : Padding(
+                  padding: const EdgeInsets.all(8.0),
+                  child: Text(
+                    "No hay propinas registradas para este corte.",
+                    style: TextStyle(
+                      fontSize: 16,
+                      fontWeight: FontWeight.w600,
+                    ),
+                  ),
+                ),
+      ],
+    );
+  }
 }

+ 130 - 9
lib/views/corte_caja/corte_caja_form.dart

@@ -43,6 +43,8 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
   bool isFondoValid = true;
   DateTime? fechaApertura;
   bool isFirst = true;
+  List<Pedido> _pedidosCancelados = [];
+
   String formatNumber(double? value) {
     final formatter = NumberFormat('#,##0.00', 'en_US');
     return formatter.format(value);
@@ -79,8 +81,17 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
           viewModel.cargarVentasPorCorteId(corte.id!).then((_) {
             viewModel.calcularCorteFinal();
           });
+          viewModel.fetchPedidosCancelados(widget.corteCajaId!).then((pedidos) {
+            setState(() {
+              _pedidosCancelados = pedidos;
+            });
+          });
         });
       });
+
+      viewModel.fetchPedidosConPropinas(widget.corteCajaId!).then((_) {
+        setState(() {});
+      });
     }
   }
 
@@ -163,8 +174,8 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
           actions: [
             TextButton(
               style: ButtonStyle(
-                backgroundColor: WidgetStatePropertyAll(AppTheme.rojo),
-                foregroundColor: WidgetStatePropertyAll(AppTheme.quaternary),
+                backgroundColor: MaterialStatePropertyAll(AppTheme.rojo),
+                foregroundColor: MaterialStatePropertyAll(AppTheme.quaternary),
               ),
               child: Text(
                 'Terminar mis pedidos primero',
@@ -182,8 +193,9 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
             ),
             TextButton(
               style: ButtonStyle(
-                  backgroundColor: WidgetStatePropertyAll(AppTheme.verde),
-                  foregroundColor: WidgetStatePropertyAll(AppTheme.quaternary)),
+                  backgroundColor: MaterialStatePropertyAll(AppTheme.verde),
+                  foregroundColor:
+                      MaterialStatePropertyAll(AppTheme.quaternary)),
               child: Text(
                 'Abrir una caja nueva con esos pedidos',
                 style: TextStyle(fontSize: 16),
@@ -245,8 +257,8 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
           actions: [
             TextButton(
               style: ButtonStyle(
-                backgroundColor: WidgetStatePropertyAll(AppTheme.rojo),
-                foregroundColor: WidgetStatePropertyAll(AppTheme.quaternary),
+                backgroundColor: MaterialStatePropertyAll(AppTheme.rojo),
+                foregroundColor: MaterialStatePropertyAll(AppTheme.quaternary),
               ),
               child: Text(
                 'Terminar mis pedidos',
@@ -698,6 +710,114 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
                   ],
                 ),
                 const SizedBox(height: 20),
+                ExpansionTile(
+                  backgroundColor: Colors.white,
+                  collapsedBackgroundColor: Colors.white,
+                  shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(10),
+                    side: BorderSide(color: Colors.grey),
+                  ),
+                  collapsedShape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(10),
+                    side: BorderSide(color: Colors.grey),
+                  ),
+                  title: Row(
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: [
+                      Text(
+                        "Propinas",
+                        style: TextStyle(
+                            fontWeight: FontWeight.bold, fontSize: 18),
+                      ),
+                      Text(
+                        "Total: \$${formatNumber(viewModel.totalPropinas)}",
+                        style: TextStyle(
+                            fontWeight: FontWeight.bold, fontSize: 18),
+                      ),
+                    ],
+                  ),
+                  children: [
+                    if (viewModel.pedidosConPropinas.isEmpty)
+                      Padding(
+                        padding: const EdgeInsets.all(8.0),
+                        child: Text(
+                            "No hay propinas registradas para este corte."),
+                      )
+                    else
+                      ...viewModel.pedidosConPropinas.map((pedido) {
+                        double totalPedidoPropinas = pedido.propinas.fold(
+                          0.0,
+                          (suma, prop) => suma + (prop.cantidad ?? 0.0),
+                        );
+                        return ListTile(
+                          title: Text(
+                            "Folio: ${pedido.folio} "
+                            "- Total: \$${(pedido.totalPedido ?? 0).toStringAsFixed(2)} "
+                            "- Propina: \$${totalPedidoPropinas.toStringAsFixed(2)}",
+                          ),
+                        );
+                      }).toList(),
+                  ],
+                ),
+                const SizedBox(height: 20),
+                ExpansionTile(
+                  backgroundColor: Colors.white,
+                  collapsedBackgroundColor: Colors.white,
+                  shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(10),
+                    side: BorderSide(color: Colors.grey),
+                  ),
+                  collapsedShape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(10),
+                    side: BorderSide(color: Colors.grey),
+                  ),
+                  title: Row(
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: [
+                      Text(
+                        "Pedidos Cancelados",
+                        style: TextStyle(
+                            fontWeight: FontWeight.bold, fontSize: 18),
+                      ),
+                      Row(
+                        children: [
+                          Text(
+                            "Total: ${_pedidosCancelados.length}",
+                            style: TextStyle(fontWeight: FontWeight.bold),
+                          ),
+                          SizedBox(width: 20),
+                        ],
+                      )
+                    ],
+                  ),
+                  children: [
+                    if (_pedidosCancelados.isNotEmpty)
+                      ListView.builder(
+                        shrinkWrap: true,
+                        itemCount: _pedidosCancelados.length,
+                        itemBuilder: (context, index) {
+                          final pedidoCancelado = _pedidosCancelados[index];
+                          final tipoPagoString =
+                              (pedidoCancelado.tipoPago?.isNotEmpty ?? false)
+                                  ? " - ${pedidoCancelado.tipoPago}"
+                                  : "";
+
+                          return ListTile(
+                            title: Text("Folio: ${pedidoCancelado.folio}"
+                                " - \$${pedidoCancelado.totalPedido?.toStringAsFixed(2) ?? '0.00'}"
+                                "$tipoPagoString"),
+                          );
+                        },
+                      )
+                    else
+                      Padding(
+                        padding: const EdgeInsets.all(8.0),
+                        child:
+                            Text("No hay pedidos cancelados para este corte."),
+                      ),
+                  ],
+                ),
+                const SizedBox(height: 20),
                 Align(
                   alignment: Alignment.centerRight,
                   child: Column(
@@ -782,9 +902,10 @@ class _CorteCajaFormState extends State<CorteCajaForm> {
                         }
 
                         // 3) Hay pedidos con estatus NUEVO se va a revisar hora local
-                        DateTime now = DateTime.now().toLocal();
-                        print(DateFormat('dd/MM/yyyy HH:mm:ss').format(now));
-                        if (now.hour < 18) {
+                        final serverDateTime = await viewModel.fetchHoraLocal();
+                        print(DateFormat('dd/MM/yyyy HH:mm:ss')
+                            .format(serverDateTime!));
+                        if (serverDateTime.hour < 18) {
                           // Si son antes de las 6pm mostramos el diálogo para pasar los pedidos al siguiente corte
                           _mostrarDialogoPedidosNuevos(
                             context,

+ 12 - 12
lib/views/corte_caja/corte_caja_screen.dart

@@ -252,18 +252,18 @@ class _CorteCajaScreenState extends State<CorteCajaScreen> {
                         child: Text('Anterior'),
                         style: ButtonStyle(
                           backgroundColor:
-                              WidgetStateProperty.resolveWith<Color?>(
-                            (Set<WidgetState> states) {
-                              if (states.contains(WidgetState.disabled)) {
+                              MaterialStateProperty.resolveWith<Color?>(
+                            (Set<MaterialState> states) {
+                              if (states.contains(MaterialState.disabled)) {
                                 return Colors.grey;
                               }
                               return AppTheme.primary;
                             },
                           ),
                           foregroundColor:
-                              WidgetStateProperty.resolveWith<Color?>(
-                            (Set<WidgetState> states) {
-                              if (states.contains(WidgetState.disabled)) {
+                              MaterialStateProperty.resolveWith<Color?>(
+                            (Set<MaterialState> states) {
+                              if (states.contains(MaterialState.disabled)) {
                                 return Colors.black;
                               }
                               return Colors.white;
@@ -281,18 +281,18 @@ class _CorteCajaScreenState extends State<CorteCajaScreen> {
                         child: Text('Siguiente'),
                         style: ButtonStyle(
                           backgroundColor:
-                              WidgetStateProperty.resolveWith<Color?>(
-                            (Set<WidgetState> states) {
-                              if (states.contains(WidgetState.disabled)) {
+                              MaterialStateProperty.resolveWith<Color?>(
+                            (Set<MaterialState> states) {
+                              if (states.contains(MaterialState.disabled)) {
                                 return Colors.grey;
                               }
                               return AppTheme.primary;
                             },
                           ),
                           foregroundColor:
-                              WidgetStateProperty.resolveWith<Color?>(
-                            (Set<WidgetState> states) {
-                              if (states.contains(WidgetState.disabled)) {
+                              MaterialStateProperty.resolveWith<Color?>(
+                            (Set<MaterialState> states) {
+                              if (states.contains(MaterialState.disabled)) {
                                 return Colors.black;
                               }
                               return Colors.white;

+ 1 - 13
lib/views/pedido/pedido_detalle_screen.dart

@@ -313,19 +313,7 @@ class _PedidoDetalleScreenState extends State<PedidoDetalleScreen> {
                             Spacer(),
                             ElevatedButton(
                               onPressed: () {
-                                showDialog(
-                                  context: context,
-                                  builder: (context) {
-                                    return TotpCuadroConfirmacion(
-                                      title: "Cambiar Método de Pago",
-                                      content:
-                                          "Por favor, ingresa el código de autenticación para continuar.",
-                                      onSuccess: () {
-                                        _mostrarModalCambiarMetodoPago(context);
-                                      },
-                                    );
-                                  },
-                                );
+                                _mostrarModalCambiarMetodoPago(context);
                               },
                               child: Text('Cambiar Método Pago',
                                   style: TextStyle(

+ 22 - 21
lib/views/pedido/pedido_form.dart

@@ -212,12 +212,12 @@ class _PedidoFormState extends State<PedidoForm> {
                       onPressed: () => Navigator.of(context).pop(),
                       child: const Text('Aceptar'),
                       style: ButtonStyle(
-                          padding: WidgetStatePropertyAll(
+                          padding: MaterialStatePropertyAll(
                               EdgeInsets.fromLTRB(20, 10, 20, 10)),
                           backgroundColor:
-                              WidgetStatePropertyAll(AppTheme.tertiary),
+                              MaterialStatePropertyAll(AppTheme.tertiary),
                           foregroundColor:
-                              WidgetStatePropertyAll(AppTheme.quaternary))),
+                              MaterialStatePropertyAll(AppTheme.quaternary))),
                 ],
               );
             },
@@ -358,11 +358,11 @@ class _PedidoFormState extends State<PedidoForm> {
               onPressed: () => Navigator.of(context).pop(false),
               child: const Text('Cancelar'),
               style: ButtonStyle(
-                padding: WidgetStatePropertyAll(
+                padding: MaterialStatePropertyAll(
                   EdgeInsets.fromLTRB(20, 10, 20, 10),
                 ),
-                backgroundColor: WidgetStatePropertyAll(Colors.red),
-                foregroundColor: WidgetStatePropertyAll(AppTheme.secondary),
+                backgroundColor: MaterialStatePropertyAll(Colors.red),
+                foregroundColor: MaterialStatePropertyAll(AppTheme.secondary),
               ),
             ),
             const SizedBox(width: 10),
@@ -380,11 +380,11 @@ class _PedidoFormState extends State<PedidoForm> {
               },
               child: const Text('Guardar'),
               style: ButtonStyle(
-                padding: WidgetStatePropertyAll(
+                padding: MaterialStatePropertyAll(
                   EdgeInsets.fromLTRB(20, 10, 20, 10),
                 ),
-                backgroundColor: WidgetStatePropertyAll(Colors.black),
-                foregroundColor: WidgetStatePropertyAll(AppTheme.quaternary),
+                backgroundColor: MaterialStatePropertyAll(Colors.black),
+                foregroundColor: MaterialStatePropertyAll(AppTheme.quaternary),
               ),
             ),
           ],
@@ -743,10 +743,11 @@ class _PedidoFormState extends State<PedidoForm> {
                   child: const Text('Cancelar', style: TextStyle(fontSize: 18)),
                   onPressed: () => Navigator.of(context).pop(false),
                   style: ButtonStyle(
-                    padding: WidgetStatePropertyAll(
+                    padding: MaterialStatePropertyAll(
                         EdgeInsets.fromLTRB(30, 20, 30, 20)),
-                    backgroundColor: WidgetStatePropertyAll(Colors.red),
-                    foregroundColor: WidgetStatePropertyAll(AppTheme.secondary),
+                    backgroundColor: MaterialStatePropertyAll(Colors.red),
+                    foregroundColor:
+                        MaterialStatePropertyAll(AppTheme.secondary),
                   ),
                 ),
                 const SizedBox(width: 100),
@@ -756,12 +757,12 @@ class _PedidoFormState extends State<PedidoForm> {
                       ? () => Navigator.of(context).pop(true)
                       : null,
                   style: ButtonStyle(
-                    padding: WidgetStatePropertyAll(
+                    padding: MaterialStatePropertyAll(
                         EdgeInsets.fromLTRB(30, 20, 30, 20)),
-                    backgroundColor: WidgetStatePropertyAll(
+                    backgroundColor: MaterialStatePropertyAll(
                         totalCompletado ? AppTheme.tertiary : Colors.grey),
                     foregroundColor:
-                        WidgetStatePropertyAll(AppTheme.quaternary),
+                        MaterialStatePropertyAll(AppTheme.quaternary),
                   ),
                 ),
               ],
@@ -1877,11 +1878,11 @@ class _PedidoFormState extends State<PedidoForm> {
                           style: TextStyle(
                               fontSize: 18, color: AppTheme.secondary)),
                       style: ButtonStyle(
-                          padding: WidgetStatePropertyAll(
+                          padding: MaterialStatePropertyAll(
                               EdgeInsets.fromLTRB(20, 10, 20, 10)),
-                          backgroundColor: WidgetStatePropertyAll(Colors.red),
+                          backgroundColor: MaterialStatePropertyAll(Colors.red),
                           foregroundColor:
-                              WidgetStatePropertyAll(AppTheme.secondary)),
+                              MaterialStatePropertyAll(AppTheme.secondary)),
                     ),
                     TextButton(
                       onPressed: () {
@@ -1926,12 +1927,12 @@ class _PedidoFormState extends State<PedidoForm> {
                           style: TextStyle(
                               fontSize: 18, color: AppTheme.quaternary)),
                       style: ButtonStyle(
-                          padding: WidgetStatePropertyAll(
+                          padding: MaterialStatePropertyAll(
                               EdgeInsets.fromLTRB(20, 10, 20, 10)),
                           backgroundColor:
-                              WidgetStatePropertyAll(AppTheme.secondary),
+                              MaterialStatePropertyAll(AppTheme.secondary),
                           foregroundColor:
-                              WidgetStatePropertyAll(AppTheme.secondary)),
+                              MaterialStatePropertyAll(AppTheme.secondary)),
                     ),
                   ],
                 )

+ 0 - 1
lib/views/pedido/pedido_screen.dart

@@ -2,7 +2,6 @@ import 'dart:typed_data';
 
 import 'package:flutter/material.dart';
 import 'package:intl/intl.dart';
-import 'package:omni_datetime_picker/omni_datetime_picker.dart';
 import 'package:provider/provider.dart';
 import '../pedido/pedido_csv.dart';
 import '../pedido/pedido_detalle_screen.dart';

+ 1 - 1
lib/widgets/app_drawer.dart

@@ -342,7 +342,7 @@ class AppDrawer extends StatelessWidget {
             child: Align(
               alignment: Alignment.bottomCenter,
               child: Text(
-                '$prefijoVersion.1.24.12.27',
+                '$prefijoVersion.1.25.01.24',
                 style: const TextStyle(fontWeight: FontWeight.w300),
               ),
             ),