diff --git a/assets/referencia/nethive_tablas.md b/assets/referencia/nethive_tablas.md deleted file mode 100644 index 454fcc5..0000000 --- a/assets/referencia/nethive_tablas.md +++ /dev/null @@ -1,182 +0,0 @@ -# 📘 Estructura de Base de Datos — NETHIVE (Esquema: `nethive`) - ---- - -## 🏢 `empresa` - -| Columna | Tipo de dato | Descripción | -|-----------------|----------------|-----------------------------------| -| id | UUID | PRIMARY KEY | -| nombre | TEXT | Nombre de la empresa | -| rfc | TEXT | Registro fiscal | -| direccion | TEXT | Dirección | -| telefono | TEXT | Teléfono de contacto | -| email | TEXT | Correo electrónico | -| fecha_creacion | TIMESTAMP | Fecha de creación (default: now) | -| logo_url | TEXT | URL del logo | -| imagen_url | TEXT | URL de imagen principal | - ---- - -## 🏪 `negocio` - -| Columna | Tipo de dato | Descripción | -|-----------------|----------------|-----------------------------------| -| id | UUID | PRIMARY KEY | -| empresa_id | UUID | FK → empresa.id | -| nombre | TEXT | Nombre del negocio | -| direccion | TEXT | Dirección | -| latitud | DECIMAL(9,6) | Latitud geográfica | -| longitud | DECIMAL(9,6) | Longitud geográfica | -| tipo_local | TEXT | Tipo de local (Sucursal, etc.) | -| fecha_creacion | TIMESTAMP | Default: now() | -| logo_url | TEXT | Logo del negocio | -| imagen_url | TEXT | Imagen del negocio | - ---- - -## 🧾 `categoria_componente` - -| Columna | Tipo de dato | Descripción | -|---------|--------------|--------------------------| -| id | SERIAL | PRIMARY KEY | -| nombre | TEXT | Nombre único de categoría| - ---- - -## 📦 `componente` - -| Columna | Tipo de dato | Descripción | -|-----------------|----------------|------------------------------------| -| id | UUID | PRIMARY KEY | -| negocio_id | UUID | FK → negocio.id | -| categoria_id | INT | FK → categoria_componente.id | -| nombre | TEXT | Nombre del componente | -| descripcion | TEXT | Descripción general | -| en_uso | BOOLEAN | Si está en uso | -| activo | BOOLEAN | Si está activo | -| ubicacion | TEXT | Ubicación física (rack, bandeja) | -| imagen_url | TEXT | URL de imagen | -| fecha_registro | TIMESTAMP | Default: now() | - ---- - -## 🔌 `detalle_cable` - -| Columna | Tipo de dato | -|----------------|----------------| -| componente_id | UUID (PK, FK) | -| tipo_cable | TEXT | -| color | TEXT | -| tamaño | DECIMAL(5,2) | -| tipo_conector | TEXT | - ---- - -## 📶 `detalle_switch` - -| Columna | Tipo de dato | -|----------------------|----------------| -| componente_id | UUID (PK, FK) | -| marca | TEXT | -| modelo | TEXT | -| numero_serie | TEXT | -| administrable | BOOLEAN | -| poe | BOOLEAN | -| cantidad_puertos | INT | -| velocidad_puertos | TEXT | -| tipo_puertos | TEXT | -| ubicacion_en_rack | TEXT | -| direccion_ip | TEXT | -| firmware | TEXT | - ---- - -## 🧱 `detalle_patch_panel` - -| Columna | Tipo de dato | -|---------------------|----------------| -| componente_id | UUID (PK, FK) | -| tipo_conector | TEXT | -| numero_puertos | INT | -| categoria | TEXT | -| tipo_montaje | TEXT | -| numeracion_frontal | BOOLEAN | -| panel_ciego | BOOLEAN | - ---- - -## 🗄 `detalle_rack` - -| Columna | Tipo de dato | -|------------------------|----------------| -| componente_id | UUID (PK, FK) | -| tipo | TEXT | -| altura_u | INT | -| profundidad_cm | INT | -| ancho_cm | INT | -| ventilacion_integrada | BOOLEAN | -| puertas_con_llave | BOOLEAN | -| ruedas | BOOLEAN | -| color | TEXT | - ---- - -## 🧰 `detalle_organizador` - -| Columna | Tipo de dato | -|--------------|----------------| -| componente_id| UUID (PK, FK) | -| tipo | TEXT | -| material | TEXT | -| tamaño | TEXT | -| color | TEXT | - ---- - -## ⚡ `detalle_ups` - -| Columna | Tipo de dato | -|--------------------|----------------| -| componente_id | UUID (PK, FK) | -| tipo | TEXT | -| marca | TEXT | -| modelo | TEXT | -| voltaje_entrada | TEXT | -| voltaje_salida | TEXT | -| capacidad_va | INT | -| autonomia_minutos | INT | -| cantidad_tomas | INT | -| rackeable | BOOLEAN | - ---- - -## 🔐 `detalle_router_firewall` - -| Columna | Tipo de dato | -|--------------------------|----------------| -| componente_id | UUID (PK, FK) | -| tipo | TEXT | -| marca | TEXT | -| modelo | TEXT | -| numero_serie | TEXT | -| interfaces | TEXT | -| capacidad_routing_gbps | DECIMAL(5,2) | -| direccion_ip | TEXT | -| firmware | TEXT | -| licencias | TEXT | - ---- - -## 🧿 `detalle_equipo_activo` - -| Columna | Tipo de dato | -|-------------------|----------------| -| componente_id | UUID (PK, FK) | -| tipo | TEXT | -| marca | TEXT | -| modelo | TEXT | -| numero_serie | TEXT | -| especificaciones | TEXT | -| direccion_ip | TEXT | -| firmware | TEXT | diff --git a/assets/referencia/nethive_tablas_actualizado.md b/assets/referencia/nethive_tablas_actualizado.md index 196aae7..44af195 100644 --- a/assets/referencia/nethive_tablas_actualizado.md +++ b/assets/referencia/nethive_tablas_actualizado.md @@ -59,6 +59,7 @@ | ubicacion | TEXT | Ubicación física (rack, bandeja) | | imagen_url | TEXT | URL de imagen | | fecha_registro | TIMESTAMP | Default: now() | +| distribucion_id | UUID | FK → distribucion.id | --- diff --git a/assets/referencia/referenciamain.txt b/assets/referencia/referenciamain.txt deleted file mode 100644 index bbdd69b..0000000 --- a/assets/referencia/referenciamain.txt +++ /dev/null @@ -1,193 +0,0 @@ -import 'package:cbluna_crm_lu/providers/book_details_provider.dart'; -import 'package:dio/dio.dart'; -import 'package:flutter/material.dart'; -import 'package:go_router/go_router.dart'; -import 'package:provider/provider.dart'; -import 'package:url_strategy/url_strategy.dart'; -import 'package:supabase_flutter/supabase_flutter.dart'; -import 'package:flutter_portal/flutter_portal.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; - -import 'package:cbluna_crm_lu/helpers/constants.dart'; -import 'package:cbluna_crm_lu/helpers/globals.dart'; -import 'package:cbluna_crm_lu/helpers/scroll_behavior.dart'; -import 'package:cbluna_crm_lu/internationalization/internationalization.dart'; -import 'package:cbluna_crm_lu/models/sales/suggestions_api.dart'; -import 'package:cbluna_crm_lu/models/sales/suggestions_repository_impl.dart'; -import 'package:cbluna_crm_lu/providers/cart_provider.dart'; -import 'package:cbluna_crm_lu/providers/content_manager_provider.dart'; -import 'package:cbluna_crm_lu/providers/content_manager_lu_provider.dart'; -import 'package:cbluna_crm_lu/providers/purchase_order_provider.dart'; -import 'package:cbluna_crm_lu/providers/step1_form_provider.dart'; -import 'package:cbluna_crm_lu/providers/providers.dart'; -import 'package:cbluna_crm_lu/providers/sales_form_view_provider.dart'; -import 'package:cbluna_crm_lu/providers/step2_form_provider.dart'; -import 'package:cbluna_crm_lu/providers/step3_form_provider.dart'; -import 'package:cbluna_crm_lu/providers/step4_form_provider.dart'; -import 'package:cbluna_crm_lu/providers/support_provider.dart'; -import 'package:cbluna_crm_lu/router/router.dart'; -import 'package:cbluna_crm_lu/theme/theme.dart'; - -void main() async { - WidgetsFlutterBinding.ensureInitialized(); - - setPathUrlStrategy(); - await Supabase.initialize( - url: supabaseUrl, - anonKey: anonKey, - realtimeClientOptions: const RealtimeClientOptions( - eventsPerSecond: 2, - ), - ); - - supabaseLU = SupabaseClient(supabaseUrl, anonKey, schema: 'lectores_urb'); - - await initGlobals(); - - GoRouter.optionURLReflectsImperativeAPIs = true; - - runApp( - MultiProvider( - providers: [ - ChangeNotifierProvider( - create: (_) => UserState(), - ), - ChangeNotifierProvider( - create: (context) => VisualStateProvider(context), - ), - ChangeNotifierProvider( - create: (_) => CustomersProvider(), - ), - ChangeNotifierProvider( - create: (_) => UsersProvider(), - ), - ChangeNotifierProvider( - create: (_) => OrdersProvider(), - ), - ChangeNotifierProvider( - create: (_) => InventoryProvider(), - ), - ChangeNotifierProvider( - create: (_) => PurchaseOrderProvider(), - ), - ChangeNotifierProvider( - create: (_) => ServiceOrderProvider(), - ), - ChangeNotifierProvider( - create: (_) => VideosProvider(), - ), - ChangeNotifierProvider( - create: (_) => BooksProvider(), - ), - ChangeNotifierProvider( - create: (_) => BillingProvider(), - ), - ChangeNotifierProvider( - create: (_) => CartProvider(), - ), - ChangeNotifierProvider(create: (_) => SupportProvider()), - ChangeNotifierProvider( - create: (_) => SalesFormViewProvider(), - ), - ChangeNotifierProvider( - create: (_) => Step1FormProvider(), - ), - ChangeNotifierProvider( - create: (_) => Step2FormProvider( - SuggestionsRepositoryImpl( - SuggestionsAPI(Dio()), - ), - UniqueKey(), - notify: true), - ), - ChangeNotifierProvider( - create: (_) => Step3FormProvider(), - ), - ChangeNotifierProvider( - create: (_) => Step4FormProvider( - SuggestionsRepositoryImpl( - SuggestionsAPI(Dio()), - ), - UniqueKey(), - notify: true), - ), - ChangeNotifierProvider( - create: (_) => ContentManagerProvider(), - ), - ChangeNotifierProvider( - create: (_) => CRMProvider(), - ), - ChangeNotifierProvider( - create: (_) => ContentManagerLUProvider(), - ), - ChangeNotifierProvider( - create: (_) => QRCodeProvider(), - ), - ChangeNotifierProvider( - create: (_) => BookDetailsProvider(), - ), - ChangeNotifierProvider( - create: (_) => CouponsProvider(), - ), - ChangeNotifierProvider( - create: (_) => BibliotecaVideosProvider(), - ), - ChangeNotifierProvider( - create: (_) => BibliotecaProvider(), - ), - ], - child: const MyApp(), - ), - ); -} - -class MyApp extends StatefulWidget { - const MyApp({Key? key}) : super(key: key); - - // This widget is the root of your application. - @override - State createState() => _MyAppState(); - - static _MyAppState of(BuildContext context) => - context.findAncestorStateOfType<_MyAppState>()!; -} - -class _MyAppState extends State { - Locale _locale = const Locale('es'); - ThemeMode _themeMode = AppTheme.themeMode; - - void setLocale(Locale value) => setState(() => _locale = value); - void setThemeMode(ThemeMode mode) => setState(() { - _themeMode = mode; - AppTheme.saveThemeMode(mode); - }); - - @override - Widget build(BuildContext context) { - return Portal( - child: MaterialApp.router( - title: 'CRM LU', - debugShowCheckedModeBanner: false, - locale: _locale, - localizationsDelegates: const [ - AppLocalizationsDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: const [Locale('en', 'US')], - theme: ThemeData( - brightness: Brightness.light, - dividerColor: Colors.grey, - ), - darkTheme: ThemeData( - brightness: Brightness.dark, - dividerColor: Colors.grey, - ), - themeMode: _themeMode, - routerConfig: router, - scrollBehavior: MyCustomScrollBehavior(), - ), - ); - } -} diff --git a/assets/referencia/tablas_nethive.txt b/assets/referencia/tablas_nethive.txt new file mode 100644 index 0000000..ddc5f5a --- /dev/null +++ b/assets/referencia/tablas_nethive.txt @@ -0,0 +1,277 @@ +-- cable_por_conexion -- + +id (uuid) (PK), +conexion_id (uuid), +cable_id (uuid), +observaciones (text), + +-- categoria_componente -- + +id (int4) (PK), +nombre (text), + + +-- componente -- + +id (uuid) (PK), +negocio_id (uuid) (FK) REFERENCES nethive.negocio.id, +categoria_id (int4) (FK) REFERENCES nethive.categoria_componente.id, +nombre (text), +descripcion (text), +ubicacion (text), +imagen_url (text), +en_uso (bool), +activo (bool), +fecha_registro (timestamp), +distribucion_id (uuid) (FK) REFERENCES nethive.distribucion.id + + +-- conexion_componente -- + +id (uuid) (PK), +componente_origen_id (uuid) (FK) REFERENCES nethive.componente.id, +componente_destino_id (uuid) (FK) REFERENCES nethive.componente.id, +descripcion (text), +activo (bool), +cable_id (uuid) (FK) REFERENCES nethive.componente.id + +-- detalle_cable -- + +componente_id (uuid) (FK) REFERENCES nethive.componente.id, +tipo_cable (text), +color (text), +tamaño (numeric), +tipo_conector (text), + + +-- detalle_equipo_activo -- + +componente_id (uuid) (PK) (FK de nethive.componente.id) +tipo (text) +marca (text) +modelo (text) +numero_serie (text) +especificaciones (text) +direccion_ip (text) +firmware (text) + + +-- detalle_organizador -- + +componente_id (PK) (uuid) (FK de nethive.componente.id), +tipo (text), +material (text), +tamaño (text), +color (text) + +-- detalle_patch_panel -- + +componente_id (PK) (uuid) (FK de nethive.componente.id), +tipo_conector (text), +numero_puertos (int4), +categoria (text), +tipo_montaje (text), +numeracion_frontal (bool), +panel_ciego (bool) + + +-- detalle_rack -- + +componente_id (PK) (uuid) (FK de nethive.componente.id), +tipo (text), +altura_u (int4), +profundidad_cm (int4), +ancho_cm (int4), +ventilacion_integrada (bool), +puertas_con_llave (bool), +ruedas (bool), +color (text), + +-- detalle_router_firewall -- + +componente_id (PK) (uuid) (FK de nethive.componente.id), +tipo (text), +marca (text), +modelo (text), +numero_serie (text), +interfaces (text), +capacidad_routing_gbps (numeric), +direccion_ip (text), +firmware (text), +licencias (text), + +-- detalle_switch -- + +componente_id (PK) (uuid) (FK de nethive.componente.id), +marca (text), +modelo (text), +numero_serie (text), +administrable (bool), +poe (bool), +cantidad_puertos (int4), +velocidad_puertos (text), +tipo_puertos (text), +ubicacion_en_rack (text), +direccion_ip (text), +firmware (text), + + +-- detalle_ups -- + +componente_id (PK) (uuid) (FK de nethive.componente.id), +tipo (text), +marca (text), +modelo (text), +voltaje_entrada (text), +voltaje_salida (text), +capacidad_va (int4), +autonomia_minutos (int4), +cantidad_tomas (int4), +rackeable (bool), + + +-- empresa -- + +id (PK) (uuid), +nombre (text), +rfc (text), +direccion (text), +telefono (text), +email (text), +fecha_creacion (timestamp), +logo_url (text), + + +-- negocio -- +id (PK) (uuid), +empresa_id (uuid) (FK de nethive.empresa.id) +nombre (text), +direccion (text), +latitud (numeric), +longitud (numeric), +tipo_local (text), +fecha_creacion (timestamp), +logo_url (text), +imagen_url (text) + +-- distribucion -- +id (PK) (uuid), +negocio_id (uuid) (FK de nethive.negocio.id) +tipo (text), +nombre (text), +descripcion (text), + + +******* VISTAS: ******* + +-- vista_cables_en_uso -- + +cable_id (uuid), +cable_nombre (text), +tipo_cable (text), +color (text), +tamaño (numeric), +tipo_conector (text), +conexion_id (uuid), + +-- vista_conexiones_por_cables -- + +conexion_id (uuid), +descripcion (text), +activo (bool), +origen_id (uuid), +componente_origen (text), +destino_id (uuid), +componente_destino (text), +cable_id (uuid), +cable_usado (text), +tipo_cable (text), +color (text), +tamaño (numeric), +tipo_conector (text), + + +-- vista_conexiones_por_negocio -- + +id (uuid), +componente_origen_id (uuid), +componente_destino_id (uuid), +descripcion (text), +activo (bool), + +-- vista_detalle_cables -- + +componente_id (uuid), +nombre (text), +tipo_cable (text), +color (text), +tamaño (numeric), +tipo_conector (text), +en_uso (bool), +activo (bool), +ubicacion (text), +imagen_componente (text), +nombre_negocio (text), +logo_negocio (text), +nombre_empresa (text), +logo_empresa (text), + + +-- vista_inventario_por_negocio -- + +componente_id (uuid), +nombre_componente (text), +categoria (text), +en_uso (bool), +activo (bool), +ubicacion (text), +imagen_componente (text), +negocio_id (uuid), +nombre_negocio (text), +logo_negocio (text), +imagen_negocio (text), +empresa_id (uuid), +nombre_empresa (text), +logo_empresa (text), +imagen_empresa (text) + + +-- vista_negocios_con_coordenadas -- + +negocio_id (uuid), +nombre_negocio (text), +latitud (numeric), +longitud (numeric), +logo_negocio (text), +imagen_negocio (text), +empresa_id (uuid), +nombre_empresa (text), +logo_empresa (text), +imagen_empresa (text), + +-- vista_resumen_componentes_activos -- + +nombre_empresa (text), +nombre_negocio (text), +categoría (text), +cantidad_activos (int8), + + + +-- vista_topologia_por_negocio -- + +negocio_id (uuid), +nombre_negocio (text), +distribucion_id (uuid), +tipo_distribucion (text), +distribucion_nombre (text), +componente_id (uuid), +componente_nombre (text), +descripcion (text), +categoria_componente (text), +en_uso (bool), +activo (bool), +ubicacion (text), +imagen_url (text), +fecha_registro (timestamp), +