Parcourir la source

Corte de Cambios

c90Beretta il y a 3 mois
Parent
commit
1fb6e22b5b

+ 41 - 0
lib/core/models/categoria_model.dart

@@ -0,0 +1,41 @@
+import 'package:turquessa_mesas_hoster/core/models/basico_model.dart';
+
+class Categoria {
+  int? id;
+  String? nombre;
+  int? venta;
+  dynamic verEnCaja;
+  bool? destacada;
+  int? maximo;
+  int? esToping;
+  String? creado;
+  String? modificado;
+  String? eliminado;
+
+  Categoria({
+    this.id,
+    this.nombre,
+    this.venta,
+    this.verEnCaja,
+    this.destacada,
+    this.maximo,
+    this.esToping,
+    this.creado,
+    this.modificado,
+    this.eliminado,
+  });
+  factory Categoria.fromJson(Map<String, dynamic> json) {
+    return Categoria(
+      id: Basico.parseInt(json['id']),
+      nombre: Basico.parseString(json['nombre']),
+      venta: Basico.parseInt(json['venta']),
+      verEnCaja: Basico.parseString(json['verEnCaja']),
+      destacada: Basico.parseBolean(json['destaca']),
+      maximo: Basico.parseInt(json['maximo']),
+      esToping: Basico.parseInt(json['esToping']),
+      creado: Basico.parseString(json['creado']),
+      modificado: Basico.parseString(json['modificado']),
+      eliminado: Basico.parseString(json['eliminado']),
+    );
+  }
+}

+ 2 - 0
lib/main.dart

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter/services.dart';
 import 'package:provider/provider.dart';
 import 'package:provider/provider.dart';
 import 'package:sqflite_common_ffi/sqflite_ffi.dart';
 import 'package:sqflite_common_ffi/sqflite_ffi.dart';
+import 'package:turquessa_mesas_hoster/mvvm/views/pedido/creacion_pedido_screen.dart';
 import 'dart:io';
 import 'dart:io';
 
 
 import 'core/models/models.dart';
 import 'core/models/models.dart';
@@ -82,6 +83,7 @@ class MyApp extends StatelessWidget {
       routes: {
       routes: {
         'login': (context) => const LoginScreen(),
         'login': (context) => const LoginScreen(),
         'home': (context) => const HomeScreen(),
         'home': (context) => const HomeScreen(),
+        'creacion-pedido': (context) => const CreacionPedido(),
       },
       },
     );
     );
   }
   }

+ 86 - 56
lib/mvvm/views/home/home_screen.dart

@@ -40,61 +40,81 @@ class Formulario extends State<HomeScreen> {
       appBar: AppBar(
       appBar: AppBar(
         title: const CustomAppbar(),
         title: const CustomAppbar(),
       ),
       ),
-      body: Row(
-        children: [
-          CustomNavigationRail(selectedIndex: _selectedIndex),
-          Expanded(
-            child: Center(
-              child: GridView.builder(
-                gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
-                  crossAxisCount: 4,
-                  childAspectRatio: 1.0,
-                  crossAxisSpacing: 10.0,
-                  mainAxisSpacing: 10.0,
-                ),
-                padding: const EdgeInsets.all(10),
-                itemCount: mesaViewModel.mesas.length,
-                itemBuilder: (context, index) {
-                  final mesa = mesaViewModel.mesas[index];
-                  return GestureDetector(
-                    onTap: () {
-                      setState(() {
-                        mesaViewModel.selectMesa(mesa);
-                      });
-                    },
-                    child: TableCard(
-                      mesa: mesa,
-                    ),
-                  );
-                },
-              ),
-            ),
+      body: Container(
+        decoration: const BoxDecoration(
+          gradient: LinearGradient(
+            begin: Alignment.topCenter,
+            end: Alignment.bottomCenter,
+            colors: [
+              Color(0xFFE0F7FA),
+              Color(0xFFB2EBF2),
+              Color(0xFF80DEEA),
+              Color(0xFF4DD0E1),
+            ],
           ),
           ),
-          if (mesaViewModel.selectedMesa != null)
+        ),
+        child: Row(
+          children: [
+            CustomNavigationRail(selectedIndex: _selectedIndex),
             Expanded(
             Expanded(
+              child: Center(
                 child: Container(
                 child: Container(
-              margin: const EdgeInsets.all(10),
-              decoration: BoxDecoration(
-                color: Colors.white,
-                borderRadius: BorderRadius.circular(10),
-                boxShadow: [
-                  BoxShadow(
-                    color: Colors.grey.withOpacity(0.2),
-                    blurRadius: 5,
-                    spreadRadius: 1,
-                  )
-                ],
+                  decoration: const BoxDecoration(
+                    color: Colors.white,
+                  ),
+                  child: GridView.builder(
+                    gridDelegate:
+                        const SliverGridDelegateWithFixedCrossAxisCount(
+                      crossAxisCount: 4,
+                      childAspectRatio: 1.0,
+                      crossAxisSpacing: 10.0,
+                      mainAxisSpacing: 10.0,
+                    ),
+                    padding: const EdgeInsets.all(10),
+                    itemCount: mesaViewModel.mesas.length,
+                    itemBuilder: (context, index) {
+                      final mesa = mesaViewModel.mesas[index];
+                      return GestureDetector(
+                        onTap: () {
+                          setState(() {
+                            mesaViewModel.selectMesa(mesa);
+                          });
+                        },
+                        child: TableCard(
+                          mesa: mesa,
+                        ),
+                      );
+                    },
+                  ),
+                ),
               ),
               ),
-              child: TablaDetalles(
-                  status: EstadoPedido.disponible,
-                  table: mesaViewModel.selectedMesa ??
-                      Mesa(
-                          activa: false,
-                          id: 0,
-                          nombre: 'Mesa sin nombre',
-                          estado: EstadoPedido.disponible)),
-            )),
-        ],
+            ),
+            if (mesaViewModel.selectedMesa != null)
+              Expanded(
+                  child: Container(
+                margin: const EdgeInsets.symmetric(horizontal: 10),
+                decoration: BoxDecoration(
+                  color: Colors.white,
+                  borderRadius: BorderRadius.circular(10),
+                  boxShadow: [
+                    BoxShadow(
+                      color: Colors.grey.withOpacity(0.2),
+                      blurRadius: 5,
+                      spreadRadius: 1,
+                    )
+                  ],
+                ),
+                child: TablaDetalles(
+                    status: EstadoPedido.disponible,
+                    table: mesaViewModel.selectedMesa ??
+                        Mesa(
+                            activa: false,
+                            id: 0,
+                            nombre: 'Mesa sin nombre',
+                            estado: EstadoPedido.disponible)),
+              )),
+          ],
+        ),
       ),
       ),
     );
     );
   }
   }
@@ -113,10 +133,9 @@ class TablaDetalles extends StatelessWidget {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     return Container(
     return Container(
-      margin: const EdgeInsets.all(10),
+      padding: const EdgeInsets.all(10),
       decoration: BoxDecoration(
       decoration: BoxDecoration(
         color: Colors.white,
         color: Colors.white,
-        borderRadius: BorderRadius.circular(10),
         boxShadow: [
         boxShadow: [
           BoxShadow(
           BoxShadow(
             color: Colors.grey.withOpacity(0.2),
             color: Colors.grey.withOpacity(0.2),
@@ -175,7 +194,7 @@ class TablaDetalles extends StatelessWidget {
           Expanded(
           Expanded(
             child: SingleChildScrollView(
             child: SingleChildScrollView(
               child: Padding(
               child: Padding(
-                padding: const EdgeInsets.all(16),
+                padding: const EdgeInsets.symmetric(horizontal: 10),
                 child: Column(
                 child: Column(
                   crossAxisAlignment: CrossAxisAlignment.start,
                   crossAxisAlignment: CrossAxisAlignment.start,
                   children: [
                   children: [
@@ -196,10 +215,21 @@ class TablaDetalles extends StatelessWidget {
                         ),
                         ),
                       ],
                       ],
                     ),
                     ),
-                    const SizedBox(height: 16),
+                    // const SizedBox(height: 16),
                     // IconDataByStatus(status: status),
                     // IconDataByStatus(status: status),
                     const SizedBox(height: 16),
                     const SizedBox(height: 16),
-                    OrdenesScreen(),
+                    IconButton.outlined(
+                        style: const ButtonStyle(
+                            backgroundColor:
+                                MaterialStatePropertyAll(Colors.lightGreen)),
+                        onPressed: () {
+                          Navigator.of(context).pushNamed('creacion-pedido');
+                        },
+                        icon: const Icon(
+                          Icons.start_rounded,
+                          color: Colors.white,
+                        ))
+                    // const OrdenesScreen(),
                   ],
                   ],
                 ),
                 ),
               ),
               ),

+ 86 - 0
lib/mvvm/views/pedido/categorias_screen.dart

@@ -0,0 +1,86 @@
+import 'package:flutter/material.dart';
+import 'package:turquessa_mesas_hoster/core/models/categoria_model.dart';
+
+
+class CategoriasGrid extends StatefulWidget {
+  const CategoriasGrid({super.key});
+
+  @override
+  State<CategoriasGrid> createState() => _CategoriasGridState();
+}
+
+class _CategoriasGridState extends State<CategoriasGrid> {
+
+  List<Categoria> categorias = [
+    Categoria(
+      id: 1,
+      nombre: 'Bebidas',
+      venta: 100,
+      verEnCaja: true,
+      destacada: true,
+      maximo: 10,
+      esToping: 0,
+      creado: '2023-01-01',
+      modificado: '2023-01-02',
+      eliminado: null,
+    ),
+    Categoria(
+      id: 2,
+      nombre: 'Comidas',
+      venta: 200,
+      verEnCaja: true,
+      destacada: false,
+      maximo: 20,
+      esToping: 0,
+      creado: '2023-01-03',
+      modificado: '2023-01-04',
+      eliminado: null,
+    ),
+    Categoria(
+      id: 3,
+      nombre: 'Postres',
+      venta: 50,
+      verEnCaja: false,
+      destacada: true,
+      maximo: 5,
+      esToping: 1,
+      creado: '2023-01-05',
+      modificado: '2023-01-06',
+      eliminado: null,
+    ),
+  ];
+
+  @override
+  Widget build(BuildContext context) {
+    return GridView.builder(
+        gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
+          crossAxisCount: 6,
+          childAspectRatio: 1.0,
+          crossAxisSpacing: 10.0,
+          mainAxisSpacing: 10.0,
+        ),
+        padding: const EdgeInsets.all(8),
+        itemCount: 20,
+        itemBuilder: (context, index) {
+          return GestureDetector(
+              //* agregar al Carrito
+              // onTap: set,
+            child: CategoriaCard(categoria: categorias[index]),
+              );
+        });
+  }
+}
+
+
+
+class CategoriaCard extends StatelessWidget {
+  final Categoria  categoria;
+  const CategoriaCard({super.key, required this.categoria});
+
+  @override
+  Widget build(BuildContext context) {
+    return Card(
+      child: ,
+    );
+  }
+}G

+ 37 - 0
lib/mvvm/views/pedido/creacion_pedido_screen.dart

@@ -0,0 +1,37 @@
+import 'package:flutter/material.dart';
+import 'package:turquessa_mesas_hoster/utils/widgets/custom_appbar.dart';
+import 'package:turquessa_mesas_hoster/utils/widgets/navigation_rail.dart';
+
+class CreacionPedido extends StatefulWidget {
+  const CreacionPedido({super.key});
+
+  @override
+  State<CreacionPedido> createState() => _CreacionPedidoState();
+}
+
+class _CreacionPedidoState extends State<CreacionPedido> {
+  final _selectedIndex = 0;
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      decoration: const BoxDecoration(
+          gradient: LinearGradient(
+              begin: Alignment.bottomRight,
+              end: Alignment.topLeft,
+              colors: [
+            Color(0xFF7FD4D4),
+            Color(0xFFE5E5E5),
+            Color(0xFFFFFFFF),
+          ])),
+      child: Scaffold(
+        backgroundColor: Colors.transparent,
+        appBar: AppBar(
+          title: const CustomAppbar(),
+        ),
+        body: Row(
+          children: [CustomNavigationRail(selectedIndex: _selectedIndex)],
+        ),
+      ),
+    );
+  }
+}

+ 0 - 1
lib/utils/widgets/ordenes_card.dart

@@ -84,7 +84,6 @@ class OrdenMesaCard extends StatelessWidget {
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
     return Card(
     return Card(
-      margin: const EdgeInsets.all(8.0),
       child: Column(
       child: Column(
         mainAxisSize: MainAxisSize.min,
         mainAxisSize: MainAxisSize.min,
         children: [
         children: [