-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 19-10-2023 a las 16:27:24
-- Versión del servidor: 10.4.19-MariaDB
-- Versión de PHP: 8.0.7

START TRANSACTION;



--
-- Base de datos: `sge`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `apps`
--

CREATE TABLE `apps` (
  `appID` int(11) NOT NULL,
  `appTitle` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `appNamespace` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
  `appIcon` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
  `appDescription` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `categoryID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `apps`
--

INSERT INTO `apps` (`appID`, `appTitle`, `appNamespace`, `appIcon`, `appDescription`, `categoryID`) VALUES
(1, 'Iniciar sesión', 'login', 'log', 'Aplicación para iniciar sesión', 1),
(2, 'Inicio', 'home', 'home', 'Aplicación de inicio', 2),
(3, 'Administrador de usuarios', 'userManager', 'user-edit', 'Aplicación para administrar usuarios', 3),
(4, 'Administrador de aplicaciones', 'appManager', 'create', 'Aplicación para administrar aplicaciones', 3),
(5, 'Administrador de roles', 'roleManager', 'role', 'Aplicación para administrar roles', 3),
(6, 'Administrador de permisos', 'permissionManager', 'permission', 'Aplicación para administrar permisos', 3),
(7, 'Asignar permisos', 'permissionAssigner', 'action', 'Aplicación para asignar permisos', 3),
(8, 'Asignar accesos', 'accessAssigner', 'activity-assigned-to-goal', 'Gestión de accesos', 3),
(9, 'Pedidos', 'orders', 'create', 'Gestión de pedidos', 2),
(10, 'Despacho', 'dispatch', 'shipping-status', 'Gestión de despacho', 2),
(11, 'Metas', 'goals', 'activity-assigned-to-goal', 'Gestión de metas', 2),
(12, 'Vehículos', 'vehicles', 'bus-public-transport', 'Gestión de vehículos', 2),
(13, 'Servicios Médicos', 'medicalServices', 'electrocardiogram', 'electrocardiogram', 2),
(14, 'Devoluciones', 'returns', 'request', 'Devoluciones de productos despachados', 2),
(17, 'Caja chica', 'pettycash', 'commission-check', 'Aplicaciones caja chica', 2),
(18, 'sistema SGE', 'initial', 'home', 'Página de bienvenida al sistema SGE', 1),
(19, 'Planificación Pagos', 'payments', 'monitor-payments', 'Gestión de Planificación de Pagos', 2);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `categories`
--

CREATE TABLE `categories` (
  `categoryID` int(11) NOT NULL,
  `categoryTitle` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `categoryIcon` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `categories`
--

INSERT INTO `categories` (`categoryID`, `categoryTitle`, `categoryIcon`) VALUES
(1, 'No visible', 'circle-task'),
(2, 'No categorizada', 'circle-task'),
(3, 'Administración', 'action-settings');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `favorites`
--

CREATE TABLE `favorites` (
  `userID` int(11) NOT NULL,
  `appID` int(11) NOT NULL,
  `isFav` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `favorites`
--

INSERT INTO `favorites` (`userID`, `appID`, `isFav`) VALUES
(18, 2, 1);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `permissions`
--

CREATE TABLE `permissions` (
  `permissionID` int(11) NOT NULL,
  `permissionTitle` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `permissions`
--

INSERT INTO `permissions` (`permissionID`, `permissionTitle`) VALUES
(1, 'editable'),
(2, 'enabled'),
(3, 'visible'),
(4, 'createUser'),
(5, 'createApp'),
(6, 'newClientSellerSelection'),
(7, 'ordersSellerSelection'),
(8, 'ordersDisapproval'),
(9, 'ordersApproval'),
(10, 'createOrder'),
(11, 'Medicos'),
(12, 'ordersCheck'),
(13, 'changeOrders'),
(14, 'cancelOrders'),
(15, 'createCash'),
(16, 'overviewCash');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `roles`
--

CREATE TABLE `roles` (
  `roleID` int(11) NOT NULL,
  `roleTitle` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `roleIcon` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `roles`
--

INSERT INTO `roles` (`roleID`, `roleTitle`, `roleIcon`) VALUES
(1, 'Administrador', 'key-user-settings'),
(2, 'Editor', 'user-edit'),
(3, 'Usuario', 'user-settings'),
(4, 'Superusuario', 'key'),
(5, 'Vendedor', 'accelerated'),
(6, 'Analista de pedidos', 'accelerated'),
(7, 'Facturación', 'accelerated'),
(8, 'Despacho', 'accelerated'),
(9, 'Transporte', 'accelerated'),
(10, 'Gerencia', 'accelerated'),
(11, 'Vehiculos', 'create'),
(12, 'Medicos', 'electrocardiogram'),
(13, 'Tesorería', 'capital-projects'),
(14, 'Gerente General', 'accelerated'),
(15, 'Supervisor Despacho', 'activity-individual');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `role_access`
--

CREATE TABLE `role_access` (
  `roleID` int(11) NOT NULL,
  `appID` int(11) NOT NULL,
  `access` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `role_access`
--

INSERT INTO `role_access` (`roleID`, `appID`, `access`) VALUES
(1, 1, 1),
(1, 2, 1),
(1, 3, 1),
(1, 4, 1),
(1, 5, 1),
(1, 6, 1),
(1, 7, 1),
(1, 8, 1),
(1, 9, 1),
(1, 10, 1),
(1, 11, 1),
(1, 12, 1),
(1, 13, 1),
(1, 14, 1),
(1, 17, 1),
(1, 18, 1),
(1, 19, 1),
(2, 2, 1),
(2, 18, 1),
(3, 2, 1),
(3, 18, 1),
(4, 2, 1),
(4, 18, 1),
(5, 2, 1),
(5, 9, 1),
(5, 18, 1),
(6, 2, 1),
(6, 9, 1),
(6, 11, 1),
(6, 17, 1),
(6, 18, 1),
(7, 2, 1),
(7, 18, 1),
(8, 10, 1),
(8, 12, 1),
(8, 14, 1),
(8, 18, 1),
(9, 2, 1),
(9, 18, 1),
(10, 2, 1),
(10, 9, 1),
(10, 11, 1),
(10, 18, 1),
(11, 2, 1),
(11, 12, 1),
(11, 18, 1),
(12, 13, 1),
(12, 18, 1),
(13, 17, 1),
(13, 18, 1),
(14, 2, 1),
(14, 11, 1),
(14, 17, 1),
(14, 18, 1),
(14, 19, 1),
(15, 10, 1),
(15, 14, 1),
(15, 18, 1);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `role_permissions`
--

CREATE TABLE `role_permissions` (
  `roleID` int(11) NOT NULL,
  `permissionID` int(11) NOT NULL,
  `hasPermission` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `role_permissions`
--

INSERT INTO `role_permissions` (`roleID`, `permissionID`, `hasPermission`) VALUES
(1, 1, 1),
(1, 2, 1),
(1, 3, 1),
(1, 4, 1),
(1, 5, 1),
(1, 6, 1),
(1, 7, 1),
(1, 8, 1),
(1, 9, 1),
(1, 10, 1),
(1, 11, 1),
(1, 12, 1),
(1, 13, 1),
(1, 14, 1),
(1, 15, 1),
(5, 10, 1),
(5, 13, 1),
(5, 14, 1),
(6, 6, 1),
(6, 7, 1),
(6, 8, 1),
(6, 9, 1),
(6, 10, 1),
(6, 12, 1),
(6, 13, 1),
(6, 14, 1),
(6, 15, 1),
(8, 10, 1),
(10, 6, 1),
(10, 7, 1),
(10, 10, 1),
(10, 12, 1),
(10, 13, 1),
(10, 14, 1),
(12, 11, 1),
(13, 1, 1),
(13, 2, 1),
(13, 3, 1),
(13, 15, 1),
(14, 1, 1),
(14, 2, 1),
(14, 3, 1),
(14, 6, 1),
(14, 7, 1),
(14, 8, 1),
(14, 9, 1),
(14, 10, 1),
(14, 12, 1),
(14, 13, 1),
(14, 14, 1),
(14, 15, 1),
(14, 16, 1);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `users_guard`
--

CREATE TABLE `users_guard` (
  `userID` int(11) NOT NULL DEFAULT 0,
  `ownerID` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;

--
-- Volcado de datos para la tabla `users_guard`
--

INSERT INTO `users_guard` (`userID`, `ownerID`) VALUES
(29, 14),
(29, 29),
(29, 30),
(29, 31),
(29, 32),
(29, 33),
(30, 31),
(30, 33),
(30, 32);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `users_names`
--

CREATE TABLE `users_names` (
  `userID` int(11) NOT NULL,
  `nombre` varchar(50) COLLATE latin1_spanish_ci NOT NULL,
  `cedula` varchar(50) COLLATE latin1_spanish_ci NOT NULL,
  `cargo` varchar(50) COLLATE latin1_spanish_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;

--
-- Volcado de datos para la tabla `users_names`
--

INSERT INTO `users_names` (`userID`, `nombre`, `cedula`, `cargo`) VALUES
(1, 'ADMINISTRADOR', 'V-22.222.222', 'ADMON'),
(14, 'ZULEYMA VILLEGAS', 'V-16.400.435', 'ANALISTA'),
(29, 'JOANA RODRIGUEZ', 'V-14.251.679', 'GERENTE'),
(30, 'MAGDELYS RODRIGUEZ', 'V-4.865.000', 'GERENTE'),
(31, 'MARIMERC RIVERO', 'V-15.397.848', 'ANALISTA'),
(32, 'SHAYLI CONTRERAS', 'V-6.325.860', 'GERENTE'),
(33, 'YOSMAIRA HERNANDEZ', 'V-14.463.095', 'ANALISTA');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `users_units`
--

CREATE TABLE `users_units` (
  `userID` int(11) NOT NULL,
  `busunit` varchar(10) COLLATE latin1_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;

--
-- Volcado de datos para la tabla `users_units`
--

INSERT INTO `users_units` (`userID`, `busunit`) VALUES
(27, 'CYBERLUX'),
(27, 'VENELUX'),
(27, 'AVANTI'),
(29, 'AVANTI'),
(29, 'CYBERLUX'),
(29, 'VENELUX'),
(30, 'CYBERLUX'),
(31, 'CYBERLUX'),
(32, 'AVANTI'),
(33, 'VENELUX'),
(1, 'AVANTI'),
(1, 'CYBERLUX'),
(1, 'VENELUX'),
(14, 'CYBERLUX'),
(29, 'CAFEAVT'),
(32, 'CAFEAVT'),
(31, 'AVANTI'),
(30, 'AVANTI');

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `apps`
--
ALTER TABLE `apps`
  ADD PRIMARY KEY (`appID`);

--
-- Indices de la tabla `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`categoryID`);

--
-- Indices de la tabla `favorites`
--
ALTER TABLE `favorites`
  ADD PRIMARY KEY (`userID`,`appID`);

--
-- Indices de la tabla `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`permissionID`);

--
-- Indices de la tabla `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`roleID`);

--
-- Indices de la tabla `role_access`
--
ALTER TABLE `role_access`
  ADD PRIMARY KEY (`roleID`,`appID`);

--
-- Indices de la tabla `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD PRIMARY KEY (`roleID`,`permissionID`);

--
-- Indices de la tabla `users_names`
--
ALTER TABLE `users_names`
  ADD PRIMARY KEY (`userID`);

--
-- Indices de la tabla `users_units`
--
ALTER TABLE `users_units`
  ADD KEY `userID` (`userID`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `apps`
--
ALTER TABLE `apps`
  MODIFY `appID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT de la tabla `categories`
--
ALTER TABLE `categories`
  MODIFY `categoryID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de la tabla `permissions`
--
ALTER TABLE `permissions`
  MODIFY `permissionID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT de la tabla `roles`
--
ALTER TABLE `roles`
  MODIFY `roleID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
COMMIT;

