-- ============================================================
-- HAMMERHEAD WORKSPACE - COMPLETE DATABASE (paste and run once)
-- Part 1: Your original schema + data
-- Part 2: Schema extension (new tables, enum widening, employee login cols)
-- ============================================================

-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `hammerheadstaffi_db`
--

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

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(150) NOT NULL,
  `code` varchar(50) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `code`, `is_active`) VALUES
(1, 'Operations', 'operations', 1),
(2, 'Accounts', 'accounts', 1),
(3, 'SOC', 'soc', 1),
(4, 'RCM', 'rcm', 1),
(5, 'Finance', 'finance', 1),
(6, 'Human Resources', 'human_resources', 1),
(7, 'Office', 'office', 1),
(8, 'Training', 'training', 1),
(9, 'Dispatch', 'dispatch', 1);

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

--
-- Table structure for table `employees`
--

CREATE TABLE `employees` (
  `id` int(11) NOT NULL,
  `name` varchar(200) NOT NULL,
  `phone` varchar(50) DEFAULT '',
  `phone2` varchar(50) DEFAULT '',
  `ext` varchar(50) DEFAULT '',
  `source` enum('import','custom') DEFAULT 'custom',
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employees`
--

INSERT INTO `employees` (`id`, `name`, `phone`, `phone2`, `ext`, `source`, `created_at`) VALUES
(1, 'Abdul Haq Jabarkhyl', '', '', '1670', 'import', '2026-06-29 17:15:42'),
(2, 'Abiy Dessu', '', '', '1739', 'import', '2026-06-29 17:15:42'),
(3, 'Adeel Bhatti', '', '', '1689', 'import', '2026-06-29 17:15:42'),
(4, 'Adrianne Dahl', '', '', '984', 'import', '2026-06-29 17:15:42'),
(5, 'Adrienne Eddings', '', '', '1359', 'import', '2026-06-29 17:15:42'),
(6, 'Ahmet Bozok', '', '', '870', 'import', '2026-06-29 17:15:42'),
(7, 'Aisha Lewis', '', '', '785', 'import', '2026-06-29 17:15:42'),
(8, 'Akashdeep Singh', '', '', '1517', 'import', '2026-06-29 17:15:42'),
(9, 'Ali Prejean', '', '', '1682', 'import', '2026-06-29 17:15:42'),
(10, 'Alton Hirsch', '', '', '1733', 'import', '2026-06-29 17:15:42'),
(11, 'Alyssa Lucero', '', '', '1217', 'import', '2026-06-29 17:15:42'),
(12, 'Aman Kumar', '', '', '1457', 'import', '2026-06-29 17:15:42'),
(13, 'Ambika Maharaj', '', '', '1272', 'import', '2026-06-29 17:15:42'),
(14, 'Amel Madave', '', '', '1399', 'import', '2026-06-29 17:15:42'),
(15, 'Aminah Butler', '', '', '1573', 'import', '2026-06-29 17:15:42'),
(16, 'Amit Kumar', '', '', '1261', 'import', '2026-06-29 17:15:42'),
(17, 'Amritpal Singh', '', '', '1436', 'import', '2026-06-29 17:15:42'),
(18, 'Anand Singh', '', '', '201', 'import', '2026-06-29 17:15:42'),
(19, 'Andre Slade Jr', '', '', '1765', 'import', '2026-06-29 17:15:42'),
(20, 'Andrew A Trescott', '', '', '1745', 'import', '2026-06-29 17:15:42'),
(21, 'Angel Arvizu', '', '', '1298', 'import', '2026-06-29 17:15:42'),
(22, 'Anil Prasad', '', '', '1705', 'import', '2026-06-29 17:15:42'),
(23, 'Anthony Brown', '', '', '1729', 'import', '2026-06-29 17:15:42'),
(24, 'Anthony Thomas', '', '', '1737', 'import', '2026-06-29 17:15:42'),
(25, 'Archana Lata', '', '', '236', 'import', '2026-06-29 17:15:42'),
(26, 'Arda Bozok', '', '', '1476', 'import', '2026-06-29 17:15:42'),
(27, 'Arevalo, Gabriel', '', '', '1592', 'import', '2026-06-29 17:15:42'),
(28, 'Arpinderjit Singh', '', '', '1763', 'import', '2026-06-29 17:15:42'),
(29, 'Arshdeep Singh', '', '', '1415', 'import', '2026-06-29 17:15:42'),
(30, 'Arturo Arizpe', '', '', '1759', 'import', '2026-06-29 17:15:42'),
(31, 'Arturo Moreno Lopez', '', '', '1650', 'import', '2026-06-29 17:15:42'),
(32, 'Arvind Prasad', '', '', '132', 'import', '2026-06-29 17:15:42'),
(33, 'Asaba, Fred', '', '', '1081', 'import', '2026-06-29 17:15:42'),
(34, 'Ashni Kumar', '', '', '745', 'import', '2026-06-29 17:15:42'),
(35, 'Ashraf Ahamed', '', '', '1685', 'import', '2026-06-29 17:15:42'),
(36, 'Ashutosh Gill', '', '', '1469', 'import', '2026-06-29 17:15:42'),
(37, 'Avninder Singh', '', '', '1594', 'import', '2026-06-29 17:15:42'),
(38, 'Baljinder Benipal', '', '', '1284', 'import', '2026-06-29 17:15:42'),
(39, 'Baljinder Singh', '', '', '1472', 'import', '2026-06-29 17:15:42'),
(40, 'Baljinder Toor', '', '', '1287', 'import', '2026-06-29 17:15:42'),
(41, 'Baljit Singh', '', '', '1692', 'import', '2026-06-29 17:15:42'),
(42, 'Balkar Singh', '', '', '300', 'import', '2026-06-29 17:15:42'),
(43, 'Balraj Kaur', '', '', '1157', 'import', '2026-06-29 17:15:42'),
(44, 'Barnett, Michael', '', '', '1523', 'import', '2026-06-29 17:15:42'),
(45, 'Bernice Guerrero', '', '', '1583', 'import', '2026-06-29 17:15:42'),
(46, 'Bhag Wati', '', '', '746', 'import', '2026-06-29 17:15:42'),
(47, 'Bhupinder Bhullar', '', '', '1561', 'import', '2026-06-29 17:15:42'),
(48, 'Bohannon, Christian', '', '', '1560', 'import', '2026-06-29 17:15:42'),
(49, 'Boone, Josiah', '', '', '1603', 'import', '2026-06-29 17:15:42'),
(50, 'Brah\'Jon Thompson', '', '', '1678', 'import', '2026-06-29 17:15:42'),
(51, 'Brian Escobar', '', '', '1229', 'import', '2026-06-29 17:15:42'),
(52, 'Brian Salgado', '', '', '1554', 'import', '2026-06-29 17:15:42'),
(53, 'Bryan Del Rio', '', '', '1280', 'import', '2026-06-29 17:15:42'),
(54, 'Cade, Jashayla', '', '', '1624', 'import', '2026-06-29 17:15:42'),
(55, 'Cairee Garrett', '', '', '1646', 'import', '2026-06-29 17:15:42'),
(56, 'Cameron Brownlee', '', '', '1691', 'import', '2026-06-29 17:15:42'),
(57, 'Carica Gilmore', '', '', '1508', 'import', '2026-06-29 17:15:42'),
(58, 'Carlos Campos Martinez', '', '', '1735', 'import', '2026-06-29 17:15:42'),
(59, 'Carlos Ulloa', '', '', '1527', 'import', '2026-06-29 17:15:42'),
(60, 'Chandra Sharma', '', '', '139', 'import', '2026-06-29 17:15:42'),
(61, 'Charanjit Kaur', '', '', '1704', 'import', '2026-06-29 17:15:42'),
(62, 'Charles Mitchell', '', '', '1695', 'import', '2026-06-29 17:15:42'),
(63, 'Chauhan, Sandhya', '', '', '1572', 'import', '2026-06-29 17:15:42'),
(64, 'Cooper, Khaliah', '', '', '1596', 'import', '2026-06-29 17:15:42'),
(65, 'Cortez, Israel', '', '', '1361', 'import', '2026-06-29 17:15:42'),
(66, 'Daljit Singh', '', '', '1104', 'import', '2026-06-29 17:15:42'),
(67, 'Daljit Singh Randhawa', '', '', '642', 'import', '2026-06-29 17:15:42'),
(68, 'Daniel Rodriguez', '', '', '1612', 'import', '2026-06-29 17:15:42'),
(69, 'Daniel Smith', '', '', '1717', 'import', '2026-06-29 17:15:42'),
(70, 'Daniel Thompson', '', '', '1493', 'import', '2026-06-29 17:15:42'),
(71, 'Daniyha Miller', '', '', '1621', 'import', '2026-06-29 17:15:42'),
(72, 'Dapinder Singh', '', '', '1327', 'import', '2026-06-29 17:15:42'),
(73, 'Darius Ellis-White', '', '', '1715', 'import', '2026-06-29 17:15:42'),
(74, 'Daryl Muyano', '', '', '1741', 'import', '2026-06-29 17:15:42'),
(75, 'David Brecher', '', '', '1313', 'import', '2026-06-29 17:15:42'),
(76, 'David Dunnell', '', '', '1647', 'import', '2026-06-29 17:15:42'),
(77, 'David Rodriguez', '', '', '1687', 'import', '2026-06-29 17:15:42'),
(78, 'David Sanchez', '', '', '1714', 'import', '2026-06-29 17:15:42'),
(79, 'Dawson Brunton', '', '', '902', 'import', '2026-06-29 17:15:42'),
(80, 'Deep, Rubal', '', '', '1269', 'import', '2026-06-29 17:15:42'),
(81, 'Demarcus Mason Jr', '', '', '1601', 'import', '2026-06-29 17:15:42'),
(82, 'Demetrius Moore', '', '', '1756', 'import', '2026-06-29 17:15:42'),
(83, 'Demetrius Wilson', '', '', '1724', 'import', '2026-06-29 17:15:42'),
(84, 'Demond Miller', '', '', '887', 'import', '2026-06-29 17:15:42'),
(85, 'Depty Kenwal', '', '', '1412', 'import', '2026-06-29 17:15:42'),
(86, 'Devon Gilbert', '', '', '1767', 'import', '2026-06-29 17:15:42'),
(87, 'Dezmen Moreno', '', '', '1564', 'import', '2026-06-29 17:15:42'),
(88, 'Dharminder Singh', '', '', '1723', 'import', '2026-06-29 17:15:42'),
(89, 'Diego Ornelas Garcia', '', '', '1541', 'import', '2026-06-29 17:15:42'),
(90, 'Diler Singh', '', '', '1487', 'import', '2026-06-29 17:15:42'),
(91, 'Donald Lewis', '', '', '1706', 'import', '2026-06-29 17:15:42'),
(92, 'Donald Washington', '', '', '1697', 'import', '2026-06-29 17:15:42'),
(93, 'Donato, Johannes', '', '', '326', 'import', '2026-06-29 17:15:42'),
(94, 'Donnie Glasglow Knight', '', '', '1694', 'import', '2026-06-29 17:15:42'),
(95, 'Drumgoole, Diamond', '', '', '1349', 'import', '2026-06-29 17:15:42'),
(96, 'Dunlap, Reginald', '', '', '915', 'import', '2026-06-29 17:15:42'),
(97, 'Dwight Owens', '', '', '421', 'import', '2026-06-29 17:15:42'),
(98, 'Dylan Ellis', '', '', '1725', 'import', '2026-06-29 17:15:42'),
(99, 'Ed\'Deana Johnson', '', '', '961', 'import', '2026-06-29 17:15:42'),
(100, 'Eddie Visperas', '', '', '1713', 'import', '2026-06-29 17:15:42'),
(101, 'Eleazar Vasquez', '', '', '916', 'import', '2026-06-29 17:15:42'),
(102, 'Elham Ahmad', '', '', '1489', 'import', '2026-06-29 17:15:42'),
(103, 'Elijah Silos', '', '', '1638', 'import', '2026-06-29 17:15:42'),
(104, 'Emilio Reyna Rodriguez', '', '', '1677', 'import', '2026-06-29 17:15:42'),
(105, 'Eric Sanchez', '', '', '1518', 'import', '2026-06-29 17:15:42'),
(106, 'Erick Chavez Villalvazo', '', '', '1707', 'import', '2026-06-29 17:15:42'),
(107, 'Exzaver Hughes', '', '', '1600', 'import', '2026-06-29 17:15:42'),
(108, 'Eylar, Nathanael', '', '', '1649', 'import', '2026-06-29 17:15:42'),
(109, 'Farhad Rahimi', '', '', '1773', 'import', '2026-06-29 17:15:42'),
(110, 'Farrell Mccullough', '', '', '1522', 'import', '2026-06-29 17:15:42'),
(111, 'Felicia Chavez', '', '', '1582', 'import', '2026-06-29 17:15:42'),
(112, 'Fidel Ramirez Tellez', '', '', '1656', 'import', '2026-06-29 17:15:42'),
(113, 'Freed Abdullah', '', '', '1775', 'import', '2026-06-29 17:15:42'),
(114, 'Garcia, Erasmo', '', '', '1623', 'import', '2026-06-29 17:15:42'),
(115, 'George Camacho', '', '', '1206', 'import', '2026-06-29 17:15:42'),
(116, 'Gill, Navdeep', '', '', '1559', 'import', '2026-06-29 17:15:42'),
(117, 'Giovanni Reyes', '', '', '1032', 'import', '2026-06-29 17:15:42'),
(118, 'Gomez, Marco Jr', '', '', '1533', 'import', '2026-06-29 17:15:42'),
(119, 'Gonzales, Roland', '', '', '1539', 'import', '2026-06-29 17:15:42'),
(120, 'Gonzalez, Leonardo', '', '', '1556', 'import', '2026-06-29 17:15:42'),
(121, 'Guadalupe Espinosa Perez', '', '', '627', 'import', '2026-06-29 17:15:42'),
(122, 'Guadalupe Robert Cortez', '', '', '904', 'import', '2026-06-29 17:15:42'),
(123, 'Gulnar Singh', '', '', '1544', 'import', '2026-06-29 17:15:42'),
(124, 'Gunjan Tandon', '', '', '1488', 'import', '2026-06-29 17:15:42'),
(125, 'Guntas Sandha', '', '', '1318', 'import', '2026-06-29 17:15:42'),
(126, 'Guntas Singh', '', '', '1720', 'import', '2026-06-29 17:15:42'),
(127, 'Gurjot Singh', '', '', '1275', 'import', '2026-06-29 17:15:42'),
(128, 'Gurlabh Singh', '', '', '1659', 'import', '2026-06-29 17:15:42'),
(129, 'Gurmeet Singh', '', '', '1728', 'import', '2026-06-29 17:15:42'),
(130, 'Gurpal Dosanjh', '', '', '1754', 'import', '2026-06-29 17:15:42'),
(131, 'Gurpreet Singh', '', '', '1526', 'import', '2026-06-29 17:15:42'),
(132, 'Gurpreet Singh.', '', '', '1485', 'import', '2026-06-29 17:15:42'),
(133, 'Gurvinder Singh', '', '', '1242', 'import', '2026-06-29 17:15:42'),
(134, 'Gustavo Negrete', '', '', '1672', 'import', '2026-06-29 17:15:42'),
(135, 'Hardeep Brar', '', '', '1290', 'import', '2026-06-29 17:15:42'),
(136, 'Hardeep Singh', '', '', '1515', 'import', '2026-06-29 17:15:42'),
(137, 'Hardeep Singh Dhaliwal', '', '', '1450', 'import', '2026-06-29 17:15:42'),
(138, 'Harjot Singh', '', '', '1675', 'import', '2026-06-29 17:15:42'),
(139, 'Harmandeep Singh', '', '', '1622', 'import', '2026-06-29 17:15:42'),
(140, 'Harmanjeet Singh', '', '', '1760', 'import', '2026-06-29 17:15:42'),
(141, 'Harpreet Singh.', '', '', '1178', 'import', '2026-06-29 17:15:42'),
(142, 'Harpreet Singh..', '', '', '1351', 'import', '2026-06-29 17:15:42'),
(143, 'Harpreet Singh...', '', '', '1475', 'import', '2026-06-29 17:15:42'),
(144, 'Harrizon-Augustine, Jovan', '', '', '1557', 'import', '2026-06-29 17:15:42'),
(145, 'Harshdeep Singh', '', '', '1568', 'import', '2026-06-29 17:15:42'),
(146, 'Harshdip Singh', '', '', '1761', 'import', '2026-06-29 17:15:42'),
(147, 'Hector Avalos', '', '', '1663', 'import', '2026-06-29 17:15:42'),
(148, 'Himanshu Taya', '', '', '1778', 'import', '2026-06-29 17:15:42'),
(149, 'Hugo Orellana', '', '', '827', 'import', '2026-06-29 17:15:42'),
(150, 'Irmani Harvey-Godfrey', '', '', '1666', 'import', '2026-06-29 17:15:42'),
(151, 'Isaac Daniels', '', '', '1749', 'import', '2026-06-29 17:15:42'),
(152, 'Isaiah Molden', '', '', '1686', 'import', '2026-06-29 17:15:42'),
(153, 'Isaiah Wilson-Lee', '', '', '1709', 'import', '2026-06-29 17:15:42'),
(154, 'Isaiah Wilson-Lee', '', '', '1709', 'import', '2026-06-29 17:15:42'),
(155, 'Iyanda, Abdul Lateef', '', '', '1628', 'import', '2026-06-29 17:15:42'),
(156, 'Jacqueline Gonzalez Espinoza', '', '', '1719', 'import', '2026-06-29 17:15:42'),
(157, 'Jagdeep Bains', '', '', '1323', 'import', '2026-06-29 17:15:42'),
(158, 'Jagdish Chandar', '', '', '1639', 'import', '2026-06-29 17:15:42'),
(159, 'Jaime Ortiz', '', '', '1091', 'import', '2026-06-29 17:15:42'),
(160, 'Jakai Manyweather', '', '', '1164', 'import', '2026-06-29 17:15:42'),
(161, 'Jamel Torrence-Taylor', '', '', '1755', 'import', '2026-06-29 17:15:42'),
(162, 'James Gray', '', '', '1753', 'import', '2026-06-29 17:15:42'),
(163, 'James Lee Wilkins Jr', '', '', '1746', 'import', '2026-06-29 17:15:42'),
(164, 'Janty Singh', '', '', '1387', 'import', '2026-06-29 17:15:42'),
(165, 'Jasbir Kaur', '', '', '1158', 'import', '2026-06-29 17:15:42'),
(166, 'Jaskaran Singh', '', '', '1570', 'import', '2026-06-29 17:15:42'),
(167, 'Jaskaran Singh', '', '', '1766', 'import', '2026-06-29 17:15:42'),
(168, 'Jaskiran Kaur', '', '', '1462', 'import', '2026-06-29 17:15:42'),
(169, 'Jason Dimas', '', '', '1702', 'import', '2026-06-29 17:15:42'),
(170, 'Jason Maestas', '', '', '1712', 'import', '2026-06-29 17:15:42'),
(171, 'Jassan Samran', '', '', '322', 'import', '2026-06-29 17:15:42'),
(172, 'Jayden Due', '', '', '1494', 'import', '2026-06-29 17:15:42'),
(173, 'Jesse Miranda', '', '', '1607', 'import', '2026-06-29 17:15:42'),
(174, 'Jessica Muldrew', '', '', '1627', 'import', '2026-06-29 17:15:42'),
(175, 'Johan Dehaan', '', '', '1167', 'import', '2026-06-29 17:15:42'),
(176, 'John Mcguire', '', '', '1626', 'import', '2026-06-29 17:15:42'),
(177, 'Johnny Andrade', '', '', '1490', 'import', '2026-06-29 17:15:42'),
(178, 'Jonas Torres', '', '', '1550', 'import', '2026-06-29 17:15:42'),
(179, 'Jonathan Al Chammani', '', '', '1631', 'import', '2026-06-29 17:15:42'),
(180, 'Jonathan Hinck', '', '', '1496', 'import', '2026-06-29 17:15:42'),
(181, 'Jonathan Martinez', '', '', '1732', 'import', '2026-06-29 17:15:42'),
(182, 'Jordan Ufland', '', '', '1404', 'import', '2026-06-29 17:15:42'),
(183, 'Jose Barrera-Carrillo', '', '', '1400', 'import', '2026-06-29 17:15:42'),
(184, 'Jose Del Rio Rosales', '', '', '1389', 'import', '2026-06-29 17:15:42'),
(185, 'Jose Felix-Sanchez', '', '', '1536', 'import', '2026-06-29 17:15:42'),
(186, 'Jose Villa', '', '', '1442', 'import', '2026-06-29 17:15:42'),
(187, 'Julio Perales', '', '', '633', 'import', '2026-06-29 17:15:42'),
(188, 'Justin Baylis', '', '', '1700', 'import', '2026-06-29 17:15:42'),
(189, 'Kaleb Booth', '', '', '981', 'import', '2026-06-29 17:15:42'),
(190, 'Kaleb Harrington', '', '', '1648', 'import', '2026-06-29 17:15:42'),
(191, 'Kamal Singh', '', '', '610', 'import', '2026-06-29 17:15:42'),
(192, 'Kamaldeep Singh', '', '', '1390', 'import', '2026-06-29 17:15:42'),
(193, 'Kamaljit Singh', '', '', '1282', 'import', '2026-06-29 17:15:42'),
(194, 'Kanwaljit Kaur', '', '', '1738', 'import', '2026-06-29 17:15:42'),
(195, 'Kanwarpal Singh', '', '', '1152', 'import', '2026-06-29 17:15:42'),
(196, 'Karamveer Singh', '', '', '1467', 'import', '2026-06-29 17:15:42'),
(197, 'Karanpreet Singh (No Given Name)', '', '', '1762', 'import', '2026-06-29 17:15:42'),
(198, 'Karanveer Singh', '', '', '1501', 'import', '2026-06-29 17:15:42'),
(199, 'Karely Iribe-Solian', '', '', '1674', 'import', '2026-06-29 17:15:42'),
(200, 'Karlos Gonzales', '', '', '1535', 'import', '2026-06-29 17:15:42'),
(201, 'Kaur, Navjot', '', '', '1342', 'import', '2026-06-29 17:15:42'),
(202, 'Kehmoni Powell', '', '', '1726', 'import', '2026-06-29 17:15:42'),
(203, 'Keith Rose', '', '', '1635', 'import', '2026-06-29 17:15:42'),
(204, 'Kerry Strong', '', '', '1574', 'import', '2026-06-29 17:15:42'),
(205, 'Kevin Hollins', '', '', '1680', 'import', '2026-06-29 17:15:42'),
(206, 'Kevin Moran', '', '', '1752', 'import', '2026-06-29 17:15:42'),
(207, 'Khan, Baasit', '', '', '1605', 'import', '2026-06-29 17:15:42'),
(208, 'Khan, Bilal', '', '', '1432', 'import', '2026-06-29 17:15:42'),
(209, 'Kidus Hagos', '', '', '1750', 'import', '2026-06-29 17:15:42'),
(210, 'Kilea Jackson', '', '', '1644', 'import', '2026-06-29 17:15:42'),
(211, 'Kirpal Kaur', '', '', '1471', 'import', '2026-06-29 17:15:42'),
(212, 'Kiyana Brown', '', '', '1699', 'import', '2026-06-29 17:15:42'),
(213, 'Kristina Pineda', '', '', '1665', 'import', '2026-06-29 17:15:42'),
(214, 'Kristofer Wynne', '', '', '1645', 'import', '2026-06-29 17:15:42'),
(215, 'Kulwant Singh', '', '', '943', 'import', '2026-06-29 17:15:42'),
(216, 'Kumar, Gourav No Name Given', '', '', '1425', 'import', '2026-06-29 17:15:42'),
(217, 'Kumar, Sunil', '', '', '1552', 'import', '2026-06-29 17:15:42'),
(218, 'Kunwar, Ram', '', '', '1388', 'import', '2026-06-29 17:15:42'),
(219, 'Kya King', '', '', '1718', 'import', '2026-06-29 17:15:42'),
(220, 'Lahkwinder Kaur', '', '', '1478', 'import', '2026-06-29 17:15:42'),
(221, 'Lakhvir Singh', '', '', '174', 'import', '2026-06-29 17:15:42'),
(222, 'Lareshia Sears', '', '', '1668', 'import', '2026-06-29 17:15:42'),
(223, 'Larry Foster', '', '', '1407', 'import', '2026-06-29 17:15:42'),
(224, 'Larry Page', '', '', '1629', 'import', '2026-06-29 17:15:42'),
(225, 'Latisha Beard', '', '', '1688', 'import', '2026-06-29 17:15:42'),
(226, 'Lawrence, Jonathan', '', '', '1534', 'import', '2026-06-29 17:15:42'),
(227, 'Leilani Cabida', '', '', '1579', 'import', '2026-06-29 17:15:42'),
(228, 'Limbrick, Christopher', '', '', '1543', 'import', '2026-06-29 17:15:42'),
(229, 'Lnu, Rahul', '', '', '1363', 'import', '2026-06-29 17:15:42'),
(230, 'Lopez, Ricky', '', '', '1567', 'import', '2026-06-29 17:15:42'),
(231, 'Lorilani Costa', '', '', '1776', 'import', '2026-06-29 17:15:42'),
(232, 'Love, Kyle', '', '', '1547', 'import', '2026-06-29 17:15:42'),
(233, 'Lovepreet Singh', '', '', '1589', 'import', '2026-06-29 17:15:42'),
(234, 'Mahikdeep Singh', '', '', '1742', 'import', '2026-06-29 17:15:42'),
(235, 'Mahip Sarao', '', '', '1566', 'import', '2026-06-29 17:15:42'),
(236, 'Malek Hardy', '', '', '1597', 'import', '2026-06-29 17:15:42'),
(237, 'Malik, Javed', '', '', '1426', 'import', '2026-06-29 17:15:42'),
(238, 'Mandeep Kaur', '', '', '1334', 'import', '2026-06-29 17:15:42'),
(239, 'Mandeep Singh', '', '', '1458', 'import', '2026-06-29 17:15:42'),
(240, 'Mandeep Singh.', '', '', '1616', 'import', '2026-06-29 17:15:42'),
(241, 'Manjinder Kaur', '', '', '189', 'import', '2026-06-29 17:15:42'),
(242, 'Mankirat Pannu', '', '', '1155', 'import', '2026-06-29 17:15:42'),
(243, 'Manpreet Kaur', '', '', '1772', 'import', '2026-06-29 17:15:42'),
(244, 'Manpreet Singh', '', '', '1584', 'import', '2026-06-29 17:15:42'),
(245, 'Marcus Mcelroy', '', '', '1716', 'import', '2026-06-29 17:15:42'),
(246, 'Margarita Castro', '', '', '1727', 'import', '2026-06-29 17:15:42'),
(247, 'Marine Avalos', '', '', '1751', 'import', '2026-06-29 17:15:42'),
(248, 'Mark Collins', '', '', '1774', 'import', '2026-06-29 17:15:42'),
(249, 'Marquis Alvarez Patterson', '', '', '1669', 'import', '2026-06-29 17:15:42'),
(250, 'Maureen Singh Dino', '', '', '586', 'import', '2026-06-29 17:15:42'),
(251, 'Mays-Tucker, Zhyaire', '', '', '1667', 'import', '2026-06-29 17:15:42'),
(252, 'Mccoy, Estell', '', '', '1598', 'import', '2026-06-29 17:15:42'),
(253, 'Mehdi Geravesh', '', '', '1643', 'import', '2026-06-29 17:15:42'),
(254, 'Mehtab Singh', '', '', '1722', 'import', '2026-06-29 17:15:42'),
(255, 'Micah Griffith', '', '', '1558', 'import', '2026-06-29 17:15:42'),
(256, 'Michael Bounds', '', '', '1676', 'import', '2026-06-29 17:15:42'),
(257, 'Michael Costa', '', '', '1625', 'import', '2026-06-29 17:15:42'),
(258, 'Michael Oatez', '', '', '1768', 'import', '2026-06-29 17:15:42'),
(259, 'Michael Perry', '', '', '1662', 'import', '2026-06-29 17:15:42'),
(260, 'Michael Smallwood', '', '', '1604', 'import', '2026-06-29 17:15:42'),
(261, 'Miguel Angelo Ramirez', '', '', '1748', 'import', '2026-06-29 17:15:42'),
(262, 'Miguel R. Chizer Ii', '', '', '1653', 'import', '2026-06-29 17:15:42'),
(263, 'Miguel Solis-Torres', '', '', '1710', 'import', '2026-06-29 17:15:42'),
(264, 'Millicent Belser', '', '', '1693', 'import', '2026-06-29 17:15:42'),
(265, 'Minor, Alia', '', '', '1440', 'import', '2026-06-29 17:15:42'),
(266, 'Mohammed Naizal', '', '', '1590', 'import', '2026-06-29 17:15:42'),
(267, 'Moore, Amber', '', '', '1581', 'import', '2026-06-29 17:15:42'),
(268, 'Muhammad Khan', '', '', '1273', 'import', '2026-06-29 17:15:42'),
(269, 'Mukkar, Gurpreet Singh', '', '', '1486', 'import', '2026-06-29 17:15:42'),
(270, 'Naresh Jakhar', '', '', '1311', 'import', '2026-06-29 17:15:42'),
(271, 'Narinder Singh', '', '', '1495', 'import', '2026-06-29 17:15:42'),
(272, 'Navdeep Kaur', '', '', '1253', 'import', '2026-06-29 17:15:42'),
(273, 'Niaujah Miller', '', '', '1637', 'import', '2026-06-29 17:15:42'),
(274, 'Nicolas Alonso Sibaja', '', '', '615', 'import', '2026-06-29 17:15:42'),
(275, 'Nikhil Saini', '', '', '1591', 'import', '2026-06-29 17:15:42'),
(276, 'Niko Gomez', '', '', '1633', 'import', '2026-06-29 17:15:42'),
(277, 'Nilesh Prakash', '', '', '285', 'import', '2026-06-29 17:15:42'),
(278, 'Nitin Chandra', '', '', '1577', 'import', '2026-06-29 17:15:42'),
(279, 'Nitin Kumar', '', '', '1615', 'import', '2026-06-29 17:15:42'),
(280, 'No Given Name Deepak', '', '', '1711', 'import', '2026-06-29 17:15:42'),
(281, 'No Given Name Manmohan Singh', '', '', '1455', 'import', '2026-06-29 17:15:42'),
(282, 'No Name Given  Rashi', '', '', '1456', 'import', '2026-06-29 17:15:42'),
(283, 'No Name Given Anmol', '', '', '1673', 'import', '2026-06-29 17:15:42'),
(284, 'No Name Given Jagdeep Singh', '', '', '1403', 'import', '2026-06-29 17:15:42'),
(285, 'No Name Given Kartik', '', '', '1285', 'import', '2026-06-29 17:15:42'),
(286, 'Olayinka Ajala', '', '', '1258', 'import', '2026-06-29 17:15:42'),
(287, 'Omar Shakir', '', '', '905', 'import', '2026-06-29 17:15:42'),
(288, 'Omarion Townsend-Ingram', '', '', '1690', 'import', '2026-06-29 17:15:42'),
(289, 'Oscar Chavez', '', '', '1654', 'import', '2026-06-29 17:15:42'),
(290, 'Paige Harris', '', '', '415', 'import', '2026-06-29 17:15:42'),
(291, 'Parvinder Pal', '', '', '117', 'import', '2026-06-29 17:15:42'),
(292, 'Patrice Rose', '', '', '1671', 'import', '2026-06-29 17:15:42'),
(293, 'Paul Tharp', '', '', '1537', 'import', '2026-06-29 17:15:42'),
(294, 'Payne, Trinity', '', '', '1430', 'import', '2026-06-29 17:15:42'),
(295, 'Pizano, Steven', '', '', '1641', 'import', '2026-06-29 17:15:42'),
(296, 'Powell, Lontrel', '', '', '1606', 'import', '2026-06-29 17:15:42'),
(297, 'Prabhjot Singh', '', '', '1506', 'import', '2026-06-29 17:15:42'),
(298, 'Prasad, Ajinesh', '', '', '1546', 'import', '2026-06-29 17:15:42'),
(299, 'Prasad, Dhirendra', '', '', '1150', 'import', '2026-06-29 17:15:42'),
(300, 'Prem Singh', '', '', '596', 'import', '2026-06-29 17:15:42'),
(301, 'Prince Pryor', '', '', '1610', 'import', '2026-06-29 17:15:42'),
(302, 'Quintin Rodriguez', '', '', '1708', 'import', '2026-06-29 17:15:42'),
(303, 'Quinton Pierce', '', '', '1684', 'import', '2026-06-29 17:15:42'),
(304, 'Rachel Resurreccion', '', '', '1580', 'import', '2026-06-29 17:15:42'),
(305, 'Raj Kumar', '', '', '1736', 'import', '2026-06-29 17:15:42'),
(306, 'Rajveer Maan', '', '', '1613', 'import', '2026-06-29 17:15:42'),
(307, 'Rajwinder Kaur', '', '', '318', 'import', '2026-06-29 17:15:42'),
(308, 'Ramanpreet Kaur', '', '', '1703', 'import', '2026-06-29 17:15:42'),
(309, 'Ramirez Mata, Ramon', '', '', '1480', 'import', '2026-06-29 17:15:42'),
(310, 'Ramirez, Juan', '', '', '1576', 'import', '2026-06-29 17:15:42'),
(311, 'Randeep Singh', '', '', '1086', 'import', '2026-06-29 17:15:42'),
(312, 'Randy Hughes', '', '', '1758', 'import', '2026-06-29 17:15:42'),
(313, 'Raul Lopez', '', '', '931', 'import', '2026-06-29 17:15:42'),
(314, 'Ray Gonzales', '', '', '1747', 'import', '2026-06-29 17:15:42'),
(315, 'Rechae James', '', '', '1248', 'import', '2026-06-29 17:15:42'),
(316, 'Reyes, Eddy', '', '', '1620', 'import', '2026-06-29 17:15:42'),
(317, 'Rian Small', '', '', '1619', 'import', '2026-06-29 17:15:42'),
(318, 'Richard Lindsey', '', '', '1757', 'import', '2026-06-29 17:15:42'),
(319, 'Ritik Ritik', '', '', '1466', 'import', '2026-06-29 17:15:42'),
(320, 'Robert Griffith', '', '', '1764', 'import', '2026-06-29 17:15:42'),
(321, 'Robert Wood', '', '', '1358', 'import', '2026-06-29 17:15:42'),
(322, 'Robin Pedrotti', '', '', '1734', 'import', '2026-06-29 17:15:42'),
(323, 'Roderick Colbert', '', '', '1599', 'import', '2026-06-29 17:15:42'),
(324, 'Rogelio Montoya', '', '', '1679', 'import', '2026-06-29 17:15:42'),
(325, 'Rohit Gosai', '', '', '178', 'import', '2026-06-29 17:15:42'),
(326, 'Roig, Cecilia', '', '', '1540', 'import', '2026-06-29 17:15:42'),
(327, 'Ruben Huesca', '', '', '1652', 'import', '2026-06-29 17:15:42'),
(328, 'Russell, Anthony Deandre', '', '', '1630', 'import', '2026-06-29 17:15:42'),
(329, 'Ryan Friedling', '', '', '1658', 'import', '2026-06-29 17:15:42'),
(330, 'Samuel Mccall', '', '', '1563', 'import', '2026-06-29 17:15:42'),
(331, 'Sanchez Pena, Abisai', '', '', '1301', 'import', '2026-06-29 17:15:42'),
(332, 'Sandeep Singh', '', '', '1312', 'import', '2026-06-29 17:15:42'),
(333, 'Sangha, Jagpal', '', '', '1611', 'import', '2026-06-29 17:15:42'),
(334, 'Sania Sahota', '', '', '1427', 'import', '2026-06-29 17:15:42'),
(335, 'Santos Appling-Sanchez', '', '', '1431', 'import', '2026-06-29 17:15:42'),
(336, 'Sarbjit Kaur', '', '', '672', 'import', '2026-06-29 17:15:42'),
(337, 'Sashi Kumari', '', '', '1262', 'import', '2026-06-29 17:15:42'),
(338, 'Satish Kumar', '', '', '1505', 'import', '2026-06-29 17:15:42'),
(339, 'Sean Boler', '', '', '1634', 'import', '2026-06-29 17:15:42'),
(340, 'Sean Lopez', '', '', '1084', 'import', '2026-06-29 17:15:42'),
(341, 'Sehzadpreet Singh', '', '', '1278', 'import', '2026-06-29 17:15:42'),
(342, 'Sejal Sejal', '', '', '1454', 'import', '2026-06-29 17:15:42'),
(343, 'Shaun Sarsuelo', '', '', '1232', 'import', '2026-06-29 17:15:42'),
(344, 'Shaurya Garg', '', '', '1721', 'import', '2026-06-29 17:15:42'),
(345, 'Shawn Barkow', '', '', '1770', 'import', '2026-06-29 17:15:42'),
(346, 'Shawn Rubang', '', '', '1632', 'import', '2026-06-29 17:15:42'),
(347, 'Simaranjot Singh', '', '', '1468', 'import', '2026-06-29 17:15:42'),
(348, 'Singh, Gurmeet', '', '', '1562', 'import', '2026-06-29 17:15:42'),
(349, 'Singh, Gurpreet (Kstjv)', '', '', '1474', 'import', '2026-06-29 17:15:42'),
(350, 'Singh, Harmanpreet', '', '', '1516', 'import', '2026-06-29 17:15:42'),
(351, 'Singh, Harsharan', '', '', '1482', 'import', '2026-06-29 17:15:42'),
(352, 'Singh, Harwinder', '', '', '1353', 'import', '2026-06-29 17:15:42'),
(353, 'Singh, Jagdeep', '', '', '1595', 'import', '2026-06-29 17:15:42'),
(354, 'Singh, Jay', '', '', '924', 'import', '2026-06-29 17:15:42'),
(355, 'Singh, Jobin', '', '', '1228', 'import', '2026-06-29 17:15:42'),
(356, 'Singh, Kamal', '', '', '1303', 'import', '2026-06-29 17:15:42'),
(357, 'Singh, Lovejeet', '', '', '1520', 'import', '2026-06-29 17:15:42'),
(358, 'Singh, Sarabjot', '', '', '1502', 'import', '2026-06-29 17:15:42'),
(359, 'Smith, Ciara', '', '', '1617', 'import', '2026-06-29 17:15:42'),
(360, 'Soane Utalia', '', '', '1740', 'import', '2026-06-29 17:15:42'),
(361, 'Socorro Pimentel', '', '', '1578', 'import', '2026-06-29 17:15:42'),
(362, 'Sonja Ellis', '', '', '1608', 'import', '2026-06-29 17:15:42'),
(363, 'Stephen Mendoza', '', '', '1651', 'import', '2026-06-29 17:15:42'),
(364, 'Subash Bhardwaj', '', '', '1017', 'import', '2026-06-29 17:15:42'),
(365, 'Sukhpavan Dhaliwal', '', '', '1730', 'import', '2026-06-29 17:15:42'),
(366, 'Sumit Singh', '', '', '1701', 'import', '2026-06-29 17:15:42'),
(367, 'Sunghyun Kim (Samuel)', '', '', '1777', 'import', '2026-06-29 17:15:42'),
(368, 'Surjeet Kaur', '', '', '1771', 'import', '2026-06-29 17:15:42'),
(369, 'Tarlochan Singh', '', '', '1614', 'import', '2026-06-29 17:15:42'),
(370, 'Taylor, Charles', '', '', '1661', 'import', '2026-06-29 17:15:42'),
(371, 'Tez Crawford', '', '', '702', 'import', '2026-06-29 17:15:42'),
(372, 'Theresa Velazquez', '', '', '668', 'import', '2026-06-29 17:15:42'),
(373, 'Thind, Rabia', '', '', '1524', 'import', '2026-06-29 17:15:42'),
(374, 'Tiana Lopez', '', '', '1743', 'import', '2026-06-29 17:15:42'),
(375, 'Timeisha Haydon', '', '', '795', 'import', '2026-06-29 17:15:42'),
(376, 'Tommy Guitterez', '', '', '160', 'import', '2026-06-29 17:15:42'),
(377, 'Tran, Jason', '', '', '1445', 'import', '2026-06-29 17:15:42'),
(378, 'Varinderpal Singh', '', '', '675', 'import', '2026-06-29 17:15:42'),
(379, 'Venesh Kumar  Karan', '', '', '1421', 'import', '2026-06-29 17:15:42'),
(380, 'Victor Martinez', '', '', '309', 'import', '2026-06-29 17:15:42'),
(381, 'Vijayant Kesar', '', '', '1731', 'import', '2026-06-29 17:15:42'),
(382, 'Vikram Singh Sheoran', '', '', '1744', 'import', '2026-06-29 17:15:42'),
(383, 'Wesley Moulton', '', '', '1664', 'import', '2026-06-29 17:15:42'),
(384, 'White, Steafone', '', '', '1585', 'import', '2026-06-29 17:15:42'),
(385, 'Wilfong, Cameron', '', '', '1609', 'import', '2026-06-29 17:15:42'),
(386, 'Williams, Frank', '', '', '1571', 'import', '2026-06-29 17:15:42'),
(387, 'Xzaiver Hardiman', '', '', '1696', 'import', '2026-06-29 17:15:42');

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

--
-- Table structure for table `login_sessions`
--

CREATE TABLE `login_sessions` (
  `id` int(11) NOT NULL,
  `user_type` enum('manager','superadmin') NOT NULL,
  `user_id` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `ip` varchar(45) DEFAULT '',
  `user_agent` varchar(300) DEFAULT '',
  `action` varchar(50) DEFAULT 'login',
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `login_sessions`
--

INSERT INTO `login_sessions` (`id`, `user_type`, `user_id`, `username`, `ip`, `user_agent`, `action`, `created_at`) VALUES
(1, 'manager', 1, 'sara.lasher', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-29 17:44:00'),
(2, 'manager', 1, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-29 17:45:02'),
(3, 'superadmin', 1, 'superadmin', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-29 17:46:04'),
(4, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-29 18:09:07'),
(5, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-29 18:12:41'),
(6, 'superadmin', 3, 'navneet', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 18:46:18'),
(7, 'superadmin', 3, 'navneet', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 19:05:01'),
(8, 'superadmin', 3, 'navneet', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 19:06:46'),
(9, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 19:07:11'),
(10, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 19:10:14'),
(11, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 19:11:23'),
(12, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 19:55:01'),
(13, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 19:57:12'),
(14, 'superadmin', 2, 'sara', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 19:58:53'),
(15, 'superadmin', 2, 'sara', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 19:59:20'),
(16, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 20:10:56'),
(17, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 20:11:03'),
(18, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 21:33:11'),
(19, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 21:33:57'),
(20, 'superadmin', 2, 'sara', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0', 'login', '2026-06-30 21:34:51'),
(21, 'superadmin', 2, 'sara', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0', 'logout', '2026-06-30 21:35:05'),
(22, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0', 'login', '2026-06-30 21:35:44'),
(23, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0', 'logout', '2026-06-30 21:36:01'),
(24, 'superadmin', 2, 'sara', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-06-30 21:37:41'),
(25, 'superadmin', 2, 'sara', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-06-30 21:48:21'),
(26, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0', 'login', '2026-06-30 23:13:18'),
(27, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0', 'logout', '2026-06-30 23:40:07'),
(28, 'superadmin', 3, 'navneet', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-07-01 15:40:38'),
(29, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-07-01 15:42:04'),
(30, 'manager', 20, '', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'logout', '2026-07-01 15:42:15'),
(31, 'manager', 20, 'navneet.kaur', '49.205.40.88', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'login', '2026-07-01 15:42:37');

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

--
-- Table structure for table `modules`
--

CREATE TABLE `modules` (
  `id` int(10) UNSIGNED NOT NULL,
  `code` varchar(80) NOT NULL,
  `name` varchar(150) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `modules`
--

INSERT INTO `modules` (`id`, `code`, `name`) VALUES
(1, 'company_dashboard', 'Company Dashboard'),
(2, 'department_dashboard', 'Department Dashboard'),
(3, 'employees', 'Employees'),
(4, 'projects', 'Projects'),
(5, 'tasks', 'Tasks'),
(6, 'reports', 'Reports'),
(7, 'users', 'User Management'),
(8, 'permissions', 'Permissions'),
(9, 'settings', 'Settings');

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `module_id` int(10) UNSIGNED NOT NULL,
  `action` enum('view','create','update','delete','assign','approve','export','manage') NOT NULL,
  `code` varchar(120) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `module_id`, `action`, `code`) VALUES
(1, 1, 'view', 'company_dashboard.view'),
(2, 1, 'create', 'company_dashboard.create'),
(3, 1, 'update', 'company_dashboard.update'),
(4, 1, 'delete', 'company_dashboard.delete'),
(5, 1, 'assign', 'company_dashboard.assign'),
(6, 1, 'approve', 'company_dashboard.approve'),
(7, 1, 'export', 'company_dashboard.export'),
(8, 1, 'manage', 'company_dashboard.manage'),
(9, 2, 'view', 'department_dashboard.view'),
(10, 2, 'create', 'department_dashboard.create'),
(11, 2, 'update', 'department_dashboard.update'),
(12, 2, 'delete', 'department_dashboard.delete'),
(13, 2, 'assign', 'department_dashboard.assign'),
(14, 2, 'approve', 'department_dashboard.approve'),
(15, 2, 'export', 'department_dashboard.export'),
(16, 2, 'manage', 'department_dashboard.manage'),
(17, 3, 'view', 'employees.view'),
(18, 3, 'create', 'employees.create'),
(19, 3, 'update', 'employees.update'),
(20, 3, 'delete', 'employees.delete'),
(21, 3, 'assign', 'employees.assign'),
(22, 3, 'approve', 'employees.approve'),
(23, 3, 'export', 'employees.export'),
(24, 3, 'manage', 'employees.manage'),
(25, 8, 'view', 'permissions.view'),
(26, 8, 'create', 'permissions.create'),
(27, 8, 'update', 'permissions.update'),
(28, 8, 'delete', 'permissions.delete'),
(29, 8, 'assign', 'permissions.assign'),
(30, 8, 'approve', 'permissions.approve'),
(31, 8, 'export', 'permissions.export'),
(32, 8, 'manage', 'permissions.manage'),
(33, 4, 'view', 'projects.view'),
(34, 4, 'create', 'projects.create'),
(35, 4, 'update', 'projects.update'),
(36, 4, 'delete', 'projects.delete'),
(37, 4, 'assign', 'projects.assign'),
(38, 4, 'approve', 'projects.approve'),
(39, 4, 'export', 'projects.export'),
(40, 4, 'manage', 'projects.manage'),
(41, 6, 'view', 'reports.view'),
(42, 6, 'create', 'reports.create'),
(43, 6, 'update', 'reports.update'),
(44, 6, 'delete', 'reports.delete'),
(45, 6, 'assign', 'reports.assign'),
(46, 6, 'approve', 'reports.approve'),
(47, 6, 'export', 'reports.export'),
(48, 6, 'manage', 'reports.manage'),
(49, 9, 'view', 'settings.view'),
(50, 9, 'create', 'settings.create'),
(51, 9, 'update', 'settings.update'),
(52, 9, 'delete', 'settings.delete'),
(53, 9, 'assign', 'settings.assign'),
(54, 9, 'approve', 'settings.approve'),
(55, 9, 'export', 'settings.export'),
(56, 9, 'manage', 'settings.manage'),
(57, 5, 'view', 'tasks.view'),
(58, 5, 'create', 'tasks.create'),
(59, 5, 'update', 'tasks.update'),
(60, 5, 'delete', 'tasks.delete'),
(61, 5, 'assign', 'tasks.assign'),
(62, 5, 'approve', 'tasks.approve'),
(63, 5, 'export', 'tasks.export'),
(64, 5, 'manage', 'tasks.manage'),
(65, 7, 'view', 'users.view'),
(66, 7, 'create', 'users.create'),
(67, 7, 'update', 'users.update'),
(68, 7, 'delete', 'users.delete'),
(69, 7, 'assign', 'users.assign'),
(70, 7, 'approve', 'users.approve'),
(71, 7, 'export', 'users.export'),
(72, 7, 'manage', 'users.manage');

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

--
-- Table structure for table `projects`
--

CREATE TABLE `projects` (
  `id` int(10) UNSIGNED NOT NULL,
  `department_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(180) NOT NULL,
  `code` varchar(80) NOT NULL,
  `status` enum('planned','active','on_hold','completed','archived') NOT NULL DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `code` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `level` tinyint(3) UNSIGNED NOT NULL,
  `description` varchar(500) DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `code`, `name`, `level`, `description`) VALUES
(1, 'super_admin', 'Super Admin / CEO', 1, 'Full company access, settings and approvals'),
(2, 'department_head', 'Department Head', 2, 'Assigned departments, KPIs, reports and users'),
(3, 'manager', 'Manager', 3, 'Assigned projects, teams and tasks'),
(4, 'team_lead', 'Team Lead', 4, 'Assign and review work for assigned teams'),
(5, 'employee', 'Employee', 5, 'Own tasks, notes, files and forms');

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

--
-- Table structure for table `role_permissions`
--

CREATE TABLE `role_permissions` (
  `role_id` smallint(5) UNSIGNED NOT NULL,
  `permission_id` int(10) UNSIGNED NOT NULL,
  `scope` enum('own','project','department','company') NOT NULL DEFAULT 'own'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `role_permissions`
--

INSERT INTO `role_permissions` (`role_id`, `permission_id`, `scope`) VALUES
(1, 1, 'company'),
(1, 2, 'company'),
(1, 3, 'company'),
(1, 4, 'company'),
(1, 5, 'company'),
(1, 6, 'company'),
(1, 7, 'company'),
(1, 8, 'company'),
(1, 9, 'company'),
(1, 10, 'company'),
(1, 11, 'company'),
(1, 12, 'company'),
(1, 13, 'company'),
(1, 14, 'company'),
(1, 15, 'company'),
(1, 16, 'company'),
(1, 17, 'company'),
(1, 18, 'company'),
(1, 19, 'company'),
(1, 20, 'company'),
(1, 21, 'company'),
(1, 22, 'company'),
(1, 23, 'company'),
(1, 24, 'company'),
(1, 25, 'company'),
(1, 26, 'company'),
(1, 27, 'company'),
(1, 28, 'company'),
(1, 29, 'company'),
(1, 30, 'company'),
(1, 31, 'company'),
(1, 32, 'company'),
(1, 33, 'company'),
(1, 34, 'company'),
(1, 35, 'company'),
(1, 36, 'company'),
(1, 37, 'company'),
(1, 38, 'company'),
(1, 39, 'company'),
(1, 40, 'company'),
(1, 41, 'company'),
(1, 42, 'company'),
(1, 43, 'company'),
(1, 44, 'company'),
(1, 45, 'company'),
(1, 46, 'company'),
(1, 47, 'company'),
(1, 48, 'company'),
(1, 49, 'company'),
(1, 50, 'company'),
(1, 51, 'company'),
(1, 52, 'company'),
(1, 53, 'company'),
(1, 54, 'company'),
(1, 55, 'company'),
(1, 56, 'company'),
(1, 57, 'company'),
(1, 58, 'company'),
(1, 59, 'company'),
(1, 60, 'company'),
(1, 61, 'company'),
(1, 62, 'company'),
(1, 63, 'company'),
(1, 64, 'company'),
(1, 65, 'company'),
(1, 66, 'company'),
(1, 67, 'company'),
(1, 68, 'company'),
(1, 69, 'company'),
(1, 70, 'company'),
(1, 71, 'company'),
(1, 72, 'company'),
(2, 1, 'department'),
(2, 2, 'department'),
(2, 3, 'department'),
(2, 4, 'department'),
(2, 5, 'department'),
(2, 6, 'department'),
(2, 7, 'department'),
(2, 8, 'department'),
(2, 9, 'department'),
(2, 10, 'department'),
(2, 11, 'department'),
(2, 12, 'department'),
(2, 13, 'department'),
(2, 14, 'department'),
(2, 15, 'department'),
(2, 16, 'department'),
(2, 17, 'department'),
(2, 18, 'department'),
(2, 19, 'department'),
(2, 20, 'department'),
(2, 21, 'department'),
(2, 22, 'department'),
(2, 23, 'department'),
(2, 24, 'department'),
(2, 25, 'department'),
(2, 26, 'department'),
(2, 27, 'department'),
(2, 28, 'department'),
(2, 29, 'department'),
(2, 30, 'department'),
(2, 31, 'department'),
(2, 33, 'department'),
(2, 34, 'department'),
(2, 35, 'department'),
(2, 36, 'department'),
(2, 37, 'department'),
(2, 38, 'department'),
(2, 39, 'department'),
(2, 40, 'department'),
(2, 41, 'department'),
(2, 42, 'department'),
(2, 43, 'department'),
(2, 44, 'department'),
(2, 45, 'department'),
(2, 46, 'department'),
(2, 47, 'department'),
(2, 48, 'department'),
(2, 49, 'department'),
(2, 50, 'department'),
(2, 51, 'department'),
(2, 52, 'department'),
(2, 53, 'department'),
(2, 54, 'department'),
(2, 55, 'department'),
(2, 57, 'department'),
(2, 58, 'department'),
(2, 59, 'department'),
(2, 60, 'department'),
(2, 61, 'department'),
(2, 62, 'department'),
(2, 63, 'department'),
(2, 64, 'department'),
(2, 65, 'department'),
(2, 66, 'department'),
(2, 67, 'department'),
(2, 69, 'department'),
(2, 70, 'department'),
(2, 71, 'department'),
(2, 72, 'department'),
(3, 9, 'project'),
(3, 17, 'project'),
(3, 33, 'project'),
(3, 41, 'project'),
(3, 47, 'project'),
(3, 57, 'project'),
(3, 58, 'project'),
(3, 59, 'project'),
(3, 61, 'project'),
(3, 62, 'project'),
(4, 17, 'project'),
(4, 33, 'project'),
(4, 57, 'project'),
(4, 58, 'project'),
(4, 59, 'project'),
(4, 61, 'project'),
(4, 62, 'project'),
(5, 57, 'own'),
(5, 59, 'own');

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

--
-- Table structure for table `sites`
--

CREATE TABLE `sites` (
  `id` int(11) NOT NULL,
  `name` varchar(300) NOT NULL,
  `source` enum('import','custom') DEFAULT 'custom',
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sites`
--

INSERT INTO `sites` (`id`, `name`, `source`, `created_at`) VALUES
(1, 'AG Spanos - Residence', 'import', '2026-06-29 17:15:42'),
(2, 'Allen Distribution - Stockton', 'import', '2026-06-29 17:15:42'),
(3, 'Arch Airport Business Park', 'import', '2026-06-29 17:15:42'),
(4, 'ASM - Marina Multiplex', 'import', '2026-06-29 17:15:42'),
(5, 'Atherton - Springfield Drive', 'import', '2026-06-29 17:15:42'),
(6, 'Blossom Hill Estates', 'import', '2026-06-29 17:15:42'),
(7, 'BLR Gill Medical - Patrol', 'import', '2026-06-29 17:15:42'),
(8, 'Blue Oaks Town Center', 'import', '2026-06-29 17:15:42'),
(9, 'BMW of San Francisco', 'import', '2026-06-29 17:15:42'),
(10, 'BMW SF - RCM', 'import', '2026-06-29 17:15:42'),
(11, 'Brimstone Energy - 2nd Shift', 'import', '2026-06-29 17:15:42'),
(12, 'Brimstone Energy Inc', 'import', '2026-06-29 17:15:42'),
(13, 'Brookside - Lake Communities', 'import', '2026-06-29 17:15:42'),
(14, 'Brookside Reclamation District', 'import', '2026-06-29 17:15:42'),
(15, 'Camera Aivres - Milpitas', 'import', '2026-06-29 17:15:42'),
(16, 'CBRE - 1275 N Gertrude', 'import', '2026-06-29 17:15:42'),
(17, 'CBRE - 400 E. Main', 'import', '2026-06-29 17:15:42'),
(18, 'CBRE - 400 E. Main - 0930 am', 'import', '2026-06-29 17:15:42'),
(19, 'CBRE - 400 E. Main - 1330 pm', 'import', '2026-06-29 17:15:42'),
(20, 'CBRE - 400 E. Main - 7 am', 'import', '2026-06-29 17:15:42'),
(21, 'CBRE - Broadway Patrol', 'import', '2026-06-29 17:15:42'),
(22, 'CBRE - Broadway RCM', 'import', '2026-06-29 17:15:42'),
(23, 'CBRE - French Camp', 'import', '2026-06-29 17:15:42'),
(24, 'CBRE - French Camp - RCM', 'import', '2026-06-29 17:15:42'),
(25, 'CBRE 400 - Patrol', 'import', '2026-06-29 17:15:42'),
(26, 'CBRE ARCO', 'import', '2026-06-29 17:15:42'),
(27, 'Church of the Presentation', 'import', '2026-06-29 17:15:42'),
(28, 'Construction Aivres-Milpitas', 'import', '2026-06-29 17:15:42'),
(29, 'Crestwood B Center - Patrol', 'import', '2026-06-29 17:15:42'),
(30, 'Crestwood Behavioral Center', 'import', '2026-06-29 17:15:42'),
(31, 'CUMC', 'import', '2026-06-29 17:15:42'),
(32, 'East Ghilloti Construction', 'import', '2026-06-29 17:15:42'),
(33, 'El Rancho Mobile Park', 'import', '2026-06-29 17:15:42'),
(34, 'Enviroplex INC', 'import', '2026-06-29 17:15:42'),
(35, 'Events', 'import', '2026-06-29 17:15:42'),
(36, 'F4L - Hammer Lane', 'import', '2026-06-29 17:15:42'),
(37, 'F4L - March Lane', 'import', '2026-06-29 17:15:42'),
(38, 'F4L - RSM Lodi', 'import', '2026-06-29 17:15:42'),
(39, 'F4L - RSM Stockton', 'import', '2026-06-29 17:15:42'),
(40, 'F4L - West Hammer Patrol', 'import', '2026-06-29 17:15:42'),
(41, 'F4L - Weston Ranch', 'import', '2026-06-29 17:15:42'),
(42, 'F4L - Wilson Way', 'import', '2026-06-29 17:15:42'),
(43, 'FAA - RCM', 'import', '2026-06-29 17:15:42'),
(44, 'FAA-Static', 'import', '2026-06-29 17:15:42'),
(45, 'Foxwood Townhomes', 'import', '2026-06-29 17:15:42'),
(46, 'Fremont Aivres - Camera', 'import', '2026-06-29 17:15:42'),
(47, 'Fremont Aivres - Gate', 'import', '2026-06-29 17:15:42'),
(48, 'Fremont Aivres - Warehouse 2', 'import', '2026-06-29 17:15:42'),
(49, 'Fresh Innovations', 'import', '2026-06-29 17:15:42'),
(50, 'Front Office - Aivres Milpitas', 'import', '2026-06-29 17:15:42'),
(51, 'General Mills', 'import', '2026-06-29 17:15:42'),
(52, 'George Weaver', 'import', '2026-06-29 17:15:42'),
(53, 'Ghilloti Construction Company', 'import', '2026-06-29 17:15:42'),
(54, 'Gill Medical', 'import', '2026-06-29 17:15:42'),
(55, 'Go Industrial Acquisitions', 'import', '2026-06-29 17:15:42'),
(56, 'Goodlife Building - RCM', 'import', '2026-06-29 17:15:42'),
(57, 'Goodwill Alitalia Way', 'import', '2026-06-29 17:15:42'),
(58, 'Goodwill Manteca', 'import', '2026-06-29 17:15:42'),
(59, 'Greene Property - RCM', 'import', '2026-06-29 17:15:42'),
(60, 'Gross Holmes Building - RCM', 'import', '2026-06-29 17:15:42'),
(61, 'H & H Properties - San Jose', 'import', '2026-06-29 17:15:42'),
(62, 'Hillcrest Professional Center', 'import', '2026-06-29 17:15:42'),
(63, 'Huff Construction - RCM', 'import', '2026-06-29 17:15:42'),
(64, 'In-Shape - Bianchi', 'import', '2026-06-29 17:15:42'),
(65, 'India Office', 'import', '2026-06-29 17:15:42'),
(66, 'InShape - Vallejo', 'import', '2026-06-29 17:15:42'),
(67, 'KSTJV - 28th Street', 'import', '2026-06-29 17:15:42'),
(68, 'KSTJV - 30th Street', 'import', '2026-06-29 17:15:42'),
(69, 'KSTJV - Chase Building', 'import', '2026-06-29 17:15:42'),
(70, 'KSTJV - Goldrock Building', 'import', '2026-06-29 17:15:42'),
(71, 'KSTJV - NewHall - Day Shift', 'import', '2026-06-29 17:15:42'),
(72, 'KSTJV - Orientation Office', 'import', '2026-06-29 17:15:42'),
(73, 'KSTJV-Earthquake - After Hours', 'import', '2026-06-29 17:15:42'),
(74, 'KSTJV-Earthquake - Day Shift', 'import', '2026-06-29 17:15:42'),
(75, 'Laguna Town Hall', 'import', '2026-06-29 17:15:42'),
(76, 'Library Galleria', 'import', '2026-06-29 17:15:42'),
(77, 'Manteca Transit Center', 'import', '2026-06-29 17:15:42'),
(78, 'McCuen Construction - Stockton', 'import', '2026-06-29 17:15:42'),
(79, 'Michels - Crocker Spcl Project', 'import', '2026-06-29 17:15:42'),
(80, 'Monte Vista Crossings', 'import', '2026-06-29 17:15:42'),
(81, 'New Stockton Office', 'import', '2026-06-29 17:15:42'),
(82, 'Office Hours', 'import', '2026-06-29 17:15:42'),
(83, 'Omni Medical Plaza', 'import', '2026-06-29 17:15:42'),
(84, 'Pacific Place Owners Assoc.', 'import', '2026-06-29 17:15:42'),
(85, 'Pardee Drive Property', 'import', '2026-06-29 17:15:42'),
(86, 'PATROL 1', 'import', '2026-06-29 17:15:42'),
(87, 'PATROL 2', 'import', '2026-06-29 17:15:42'),
(88, 'PATROL 6', 'import', '2026-06-29 17:15:42'),
(89, 'PATROL 7', 'import', '2026-06-29 17:15:42'),
(90, 'PATROL 8', 'import', '2026-06-29 17:15:42'),
(91, 'PCC - DIV 1', 'import', '2026-06-29 17:15:42'),
(92, 'PCC - DIV 1 - Rover', 'import', '2026-06-29 17:15:42'),
(93, 'PCC - DIV 30 - Extra Coverage', 'import', '2026-06-29 17:15:42'),
(94, 'PCC - DIV 30 - Shipping Hours', 'import', '2026-06-29 17:15:42'),
(95, 'PCC - DIV 30 -Non Shipping Hrs', 'import', '2026-06-29 17:15:42'),
(96, 'PCC - DIV 5/9', 'import', '2026-06-29 17:15:42'),
(97, 'PCC - DIV 5/9 - Rover', 'import', '2026-06-29 17:15:42'),
(98, 'Performance Food Group Co.', 'import', '2026-06-29 17:15:42'),
(99, 'Power Ridge Rd - Sacramento', 'import', '2026-06-29 17:15:42'),
(100, 'Prime Source - RCM', 'import', '2026-06-29 17:15:42'),
(101, 'Quail Lakes Business Park', 'import', '2026-06-29 17:15:42'),
(102, 'Quail Lakes Homeowners Associa', 'import', '2026-06-29 17:15:42'),
(103, 'Ripon Community Center', 'import', '2026-06-29 17:15:42'),
(104, 'Rosemarie Pet Hospital', 'import', '2026-06-29 17:15:42'),
(105, 'Rover - Taylor Farms', 'import', '2026-06-29 17:15:42'),
(106, 'Rover Position', 'import', '2026-06-29 17:15:42'),
(107, 'Satallite-Stockton', 'import', '2026-06-29 17:15:42'),
(108, 'Spanos Park East', 'import', '2026-06-29 17:15:42'),
(109, 'Special - Catalina Vineyards', 'import', '2026-06-29 17:15:42'),
(110, 'Speed Intermodal', 'import', '2026-06-29 17:15:42'),
(111, 'Speed Intermodal RCM', 'import', '2026-06-29 17:15:42'),
(112, 'Stockton Airport - RCM', 'import', '2026-06-29 17:15:42'),
(113, 'Stockton Airport - Static', 'import', '2026-06-29 17:15:42'),
(114, 'Stockton Arena', 'import', '2026-06-29 17:15:42'),
(115, 'Stockton Emergency Food Bank', 'import', '2026-06-29 17:15:42'),
(116, 'Stockton Food Bank - Patrol', 'import', '2026-06-29 17:15:42'),
(117, 'Stockton Food Bank - RCM', 'import', '2026-06-29 17:15:42'),
(118, 'Stribley Community Center', 'import', '2026-06-29 17:15:42'),
(119, 'Suite #500 - Taylor Farms', 'import', '2026-06-29 17:15:42'),
(120, 'Suite #500 - TF - Night', 'import', '2026-06-29 17:15:42'),
(121, 'Suite #700 - Taylor Farms', 'import', '2026-06-29 17:15:42'),
(122, 'Suite #700 - TF - Night', 'import', '2026-06-29 17:15:42'),
(123, 'Sunpointe Condominium HOA', 'import', '2026-06-29 17:15:42'),
(124, 'The Bridge at Emeryville', 'import', '2026-06-29 17:15:42'),
(125, 'United Facilities - Prism', 'import', '2026-06-29 17:15:42'),
(126, 'United Site - RCM', 'import', '2026-06-29 17:15:42'),
(127, 'Vehicle Patrol Aivres - SJ', 'import', '2026-06-29 17:15:42'),
(128, 'Vehicle Patrol Aivres-Milpitas', 'import', '2026-06-29 17:15:42'),
(129, 'Vulcan Const - Chowchilla', 'import', '2026-06-29 17:15:42'),
(130, 'Vulcan Construction - Stockton', 'import', '2026-06-29 17:15:42'),
(131, 'Warehouse Aivres - Milpitas', 'import', '2026-06-29 17:15:42'),
(132, 'Warehouse Aivres - San Jose', 'import', '2026-06-29 17:15:42'),
(133, 'Weber Point', 'import', '2026-06-29 17:15:42'),
(134, 'Westbound I-80 Truck Scales', 'import', '2026-06-29 17:15:42'),
(135, 'Westcore - Patterson', 'import', '2026-06-29 17:15:42'),
(136, 'Westcore Alpha Poplar - Unpaid', 'import', '2026-06-29 17:15:42'),
(137, 'Westcore Alpha Poplar LLC', 'import', '2026-06-29 17:15:42'),
(138, 'Westcore Alpha Poplar LLC - 2', 'import', '2026-06-29 17:15:42'),
(139, 'Westcore Stockton - Patrol', 'import', '2026-06-29 17:15:42'),
(140, 'Westcore Stockton - Static', 'import', '2026-06-29 17:15:42'),
(141, 'Westcore Woodland', 'import', '2026-06-29 17:15:42'),
(142, 'Stockton Industrial Park', 'import', '2026-06-29 17:15:42'),
(143, 'Conor HHF Stockton', 'import', '2026-06-29 17:15:42'),
(144, 'Medical Offices', 'import', '2026-06-29 17:15:42'),
(145, 'Chroma Neighborhood', 'import', '2026-06-29 17:15:42'),
(146, 'Industrial DR', 'import', '2026-06-29 17:15:42'),
(147, 'Manteca Futbol Club firework', 'import', '2026-06-29 17:15:42');

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

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` varchar(50) NOT NULL,
  `sheetId` varchar(50) DEFAULT '',
  `type` enum('employee','site') DEFAULT 'employee',
  `subj` varchar(500) DEFAULT '',
  `empId` varchar(50) DEFAULT '',
  `concern` varchar(300) DEFAULT '',
  `otherProcessType` varchar(500) DEFAULT '',
  `findings` text DEFAULT NULL,
  `date` varchar(20) DEFAULT '',
  `mgrBy` varchar(200) DEFAULT '',
  `mgrByEmail` varchar(200) DEFAULT '',
  `mgrTo` varchar(200) DEFAULT '',
  `mgrToEmail` varchar(200) DEFAULT '',
  `currentlyAssignedTo` varchar(200) DEFAULT '',
  `startDate` varchar(20) DEFAULT '',
  `endDate` varchar(20) DEFAULT '',
  `followupRequired` varchar(10) DEFAULT 'No',
  `assignedSite` varchar(300) DEFAULT '',
  `assignedDesc` text DEFAULT NULL,
  `followUp` varchar(100) DEFAULT '',
  `followUpDate` varchar(20) DEFAULT '',
  `followUpStartDate` varchar(20) DEFAULT '',
  `nextFollowUpDue` varchar(20) DEFAULT '',
  `transferTo` varchar(200) DEFAULT '',
  `transferEmail` varchar(200) DEFAULT '',
  `transferStatus` varchar(50) DEFAULT '',
  `transferFollowUp` varchar(100) DEFAULT '',
  `status` varchar(50) DEFAULT 'Pending',
  `created` varchar(30) DEFAULT '',
  `createdTasksFiles` text DEFAULT NULL,
  `transferTasksFiles` text DEFAULT NULL,
  `history` longtext DEFAULT NULL,
  `attachments` longtext DEFAULT NULL,
  `links` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tasks`
--

INSERT INTO `tasks` (`id`, `sheetId`, `type`, `subj`, `empId`, `concern`, `otherProcessType`, `findings`, `date`, `mgrBy`, `mgrByEmail`, `mgrTo`, `mgrToEmail`, `currentlyAssignedTo`, `startDate`, `endDate`, `followupRequired`, `assignedSite`, `assignedDesc`, `followUp`, `followUpDate`, `followUpStartDate`, `nextFollowUpDue`, `transferTo`, `transferEmail`, `transferStatus`, `transferFollowUp`, `status`, `created`, `createdTasksFiles`, `transferTasksFiles`, `history`, `attachments`, `links`, `created_at`, `updated_at`) VALUES
('TASK-1782753375617', 'SHT-1782753375616', 'employee', 'Akashdeep Singh', '1517', 'Cell Phone / Conduct Violations', '', 'test', '2026-06-29', 'Karan Kumar', 'Karan@hammerheadprotection.com', 'Harpreet Singh', 'Harry@hammerheadprotection.com', 'Cesar Saona', '2026-06-29', '2026-07-06', 'Yes', '', '', 'Bi Weekly', '2026-07-06', '2026-06-29', '2026-07-13', 'Cesar Saona', 'Cesar@hammerheadprotection.com', '', '', 'Pending', '29/06/2026', '', '=HYPERLINK(\"/uploads/hhp_6a42a8a47e5d75.58338139_logo_instant.png\",\"Open Pic\")', '[{\"ts\":\"Jun 29, 2026, 10:17 AM\",\"actor\":\"Karan Kumar\",\"type\":\"Note\",\"text\":\"test\"},{\"ts\":\"Jun 29, 2026, 10:17 AM\",\"actor\":\"Harpreet Singh\",\"type\":\"Transfer\",\"text\":\"Transferred to Cesar Saona\"},{\"ts\":\"Jun 29, 2026, 10:17 AM\",\"actor\":\"Harpreet Singh\",\"type\":\"Attachment\",\"text\":\"logo instant.png\",\"url\":\"/uploads/hhp_6a42a8a47e5d75.58338139_logo_instant.png\",\"previewUrl\":\"/uploads/hhp_6a42a8a47e5d75.58338139_logo_instant.png\"},{\"ts\":\"Jun 29, 2026, 10:19 AM\",\"actor\":\"System\",\"type\":\"Follow-Up\",\"text\":\"Follow-up due: Bi Weekly (2026-06-29)\",\"followUpDue\":\"2026-06-29\"}]', '[{\"name\":\"logo instant.png\",\"dataUrl\":\"data:image/png;base64,[BLOB]\",\"isImage\":true,\"type\":\"image/png\"},{\"name\":\"logo instant.png\",\"url\":\"/uploads/hhp_6a42a8a47e5d75.58338139_logo_instant.png\",\"previewUrl\":\"/uploads/hhp_6a42a8a47e5d75.58338139_logo_instant.png\",\"mimeType\":\"image/png\",\"isImage\":true}]', '[]', '2026-06-29 17:17:01', '2026-06-29 17:19:51');
INSERT INTO `tasks` (`id`, `sheetId`, `type`, `subj`, `empId`, `concern`, `otherProcessType`, `findings`, `date`, `mgrBy`, `mgrByEmail`, `mgrTo`, `mgrToEmail`, `currentlyAssignedTo`, `startDate`, `endDate`, `followupRequired`, `assignedSite`, `assignedDesc`, `followUp`, `followUpDate`, `followUpStartDate`, `nextFollowUpDue`, `transferTo`, `transferEmail`, `transferStatus`, `transferFollowUp`, `status`, `created`, `createdTasksFiles`, `transferTasksFiles`, `history`, `attachments`, `links`, `created_at`, `updated_at`) VALUES
('TASK-1782756549467', 'SHT-1782756549466', 'employee', 'Adrienne Eddings', '1359', 'Client Complaint', '', 'test', '2026-06-29', 'Navneet Kaur', 'navneet@hammerheadprotection.com', 'Navneet Kaur', 'navneet@hammerheadprotection.com', 'Navneet Kaur', '', '', 'No', '', '', '', '', '', '', '', '', '', '', 'Pending', '29/06/2026', '', '', '[{\"ts\":\"Jun 29, 2026, 11:10 AM\",\"actor\":\"Navneet Kaur\",\"type\":\"Note\",\"text\":\"test\"}]', '[{\"name\":\"logo instant.png\",\"dataUrl\":\"data:image/png;base64,[BLOB]\",\"isImage\":true,\"type\":\"image/png\"}]', '[]', '2026-06-29 18:10:04', '2026-06-29 18:10:04');
INSERT INTO `tasks` (`id`, `sheetId`, `type`, `subj`, `empId`, `concern`, `otherProcessType`, `findings`, `date`, `mgrBy`, `mgrByEmail`, `mgrTo`, `mgrToEmail`, `currentlyAssignedTo`, `startDate`, `endDate`, `followupRequired`, `assignedSite`, `assignedDesc`, `followUp`, `followUpDate`, `followUpStartDate`, `nextFollowUpDue`, `transferTo`, `transferEmail`, `transferStatus`, `transferFollowUp`, `status`, `created`, `createdTasksFiles`, `transferTasksFiles`, `history`, `attachments`, `links`, `created_at`, `updated_at`) VALUES
('TASK-1782849302232', 'SHT-1782849302231', 'employee', 'Abdul Haq Jabarkhyl', '1670', 'Others', 'testtttttttttttttttttt', 'testtttttttttttttttttttttttt', '2026-06-30', 'Jatinder Kumar', 'Jay@hammerheadprotection.com', 'Jasmeet Singh', 'scheduling@hammerheadprotection.com', 'Cesar Saona', '2026-06-30', '2026-06-30', 'Yes', '', '', 'Monthly', '2026-06-30', '2026-06-30', '2026-07-30', 'Cesar Saona', 'Cesar@hammerheadprotection.com', '', '', 'Pending', '30/06/2026', '', '=HYPERLINK(\"/uploads/hhp_6a441f569ed9c9.57828895_logo_instant.png\",\"Open Pic\")', '[{\"ts\":\"Jun 30, 2026, 12:55 PM\",\"actor\":\"Jatinder Kumar\",\"type\":\"Note\",\"text\":\"testtttttttttttttttttttttttt\"},{\"ts\":\"Jun 30, 2026, 12:55 PM\",\"actor\":\"Jasmeet Singh\",\"type\":\"Transfer\",\"text\":\"Transferred to Cesar Saona — testttttttttttttttt\"},{\"ts\":\"Jun 30, 2026, 12:55 PM\",\"actor\":\"Jasmeet Singh\",\"type\":\"Note\",\"text\":\"testttttttttttttttt\"},{\"ts\":\"Jun 30, 2026, 12:56 PM\",\"actor\":\"Jasmeet Singh\",\"type\":\"Attachment\",\"text\":\"logo instant.png\",\"url\":\"/uploads/hhp_6a441f569ed9c9.57828895_logo_instant.png\",\"previewUrl\":\"/uploads/hhp_6a441f569ed9c9.57828895_logo_instant.png\"},{\"ts\":\"Jun 30, 2026, 1:10 PM\",\"actor\":\"System\",\"type\":\"Follow-Up\",\"text\":\"Follow-up due: Monthly (2026-06-30)\",\"followUpDue\":\"2026-06-30\"}]', '[{\"name\":\"logo instant.png\",\"dataUrl\":\"data:image/png;base64,[BLOB]\",\"isImage\":true,\"type\":\"image/png\"},{\"name\":\"logo instant.png\",\"url\":\"/uploads/hhp_6a441f569ed9c9.57828895_logo_instant.png\",\"previewUrl\":\"/uploads/hhp_6a441f569ed9c9.57828895_logo_instant.png\",\"mimeType\":\"image/png\",\"isImage\":true}]', '[]', '2026-06-30 19:55:36', '2026-06-30 20:11:00');

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

--
-- Table structure for table `task_files`
--

CREATE TABLE `task_files` (
  `id` int(11) NOT NULL,
  `task_id` varchar(50) NOT NULL,
  `file_type` enum('created','transfer') DEFAULT 'created',
  `file_name` varchar(300) NOT NULL,
  `file_path` varchar(500) NOT NULL,
  `mime_type` varchar(100) DEFAULT '',
  `is_image` tinyint(1) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `task_files`
--

INSERT INTO `task_files` (`id`, `task_id`, `file_type`, `file_name`, `file_path`, `mime_type`, `is_image`, `created_at`) VALUES
(2, 'TASK-1782753375617', 'transfer', 'logo instant.png', 'hhp_6a42a8a47e5d75.58338139_logo_instant.png', 'image/png', 1, '2026-06-29 17:17:24'),
(5, 'TASK-1782849302232', 'transfer', 'logo instant.png', 'hhp_6a441f569ed9c9.57828895_logo_instant.png', 'image/png', 1, '2026-06-30 19:56:06');

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

--
-- Table structure for table `user_departments`
--

CREATE TABLE `user_departments` (
  `user_type` enum('manager','superadmin') NOT NULL,
  `user_id` int(11) NOT NULL,
  `department_id` int(10) UNSIGNED NOT NULL,
  `is_primary` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_permission_overrides`
--

CREATE TABLE `user_permission_overrides` (
  `user_type` enum('manager','superadmin') NOT NULL,
  `user_id` int(11) NOT NULL,
  `permission_id` int(10) UNSIGNED NOT NULL,
  `effect` enum('allow','deny') NOT NULL,
  `scope` enum('own','project','department','company') NOT NULL DEFAULT 'own'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_projects`
--

CREATE TABLE `user_projects` (
  `user_type` enum('manager','superadmin') NOT NULL,
  `user_id` int(11) NOT NULL,
  `project_id` int(10) UNSIGNED NOT NULL,
  `access_level` enum('view','contribute','manage') NOT NULL DEFAULT 'view'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_roles`
--

CREATE TABLE `user_roles` (
  `user_type` enum('manager','superadmin') NOT NULL,
  `user_id` int(11) NOT NULL,
  `role_id` smallint(5) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_roles`
--

INSERT INTO `user_roles` (`user_type`, `user_id`, `role_id`) VALUES
('manager', 1, 3),
('manager', 2, 3),
('manager', 3, 3),
('manager', 4, 3),
('manager', 5, 3),
('manager', 6, 3),
('manager', 7, 3),
('manager', 8, 3),
('manager', 9, 3),
('manager', 10, 3),
('manager', 11, 3),
('manager', 12, 3),
('manager', 13, 3),
('manager', 14, 3),
('manager', 15, 3),
('manager', 16, 3),
('manager', 17, 3),
('manager', 18, 3),
('manager', 19, 3),
('manager', 20, 5),
('superadmin', 1, 1),
('superadmin', 2, 1),
('superadmin', 3, 1);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_department_code` (`code`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `login_sessions`
--
ALTER TABLE `login_sessions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `modules`
--
ALTER TABLE `modules`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_module_code` (`code`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_permission_code` (`code`),
  ADD KEY `fk_permission_module` (`module_id`);

--
-- Indexes for table `projects`
--
ALTER TABLE `projects`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_project_code` (`department_id`,`code`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_roles_code` (`code`);

--
-- Indexes for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD PRIMARY KEY (`role_id`,`permission_id`),
  ADD KEY `permission_id` (`permission_id`);

--
-- Indexes for table `sites`
--
ALTER TABLE `sites`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `task_files`
--
ALTER TABLE `task_files`
  ADD PRIMARY KEY (`id`),
  ADD KEY `task_id` (`task_id`);

--
-- Indexes for table `user_departments`
--
ALTER TABLE `user_departments`
  ADD PRIMARY KEY (`user_type`,`user_id`,`department_id`),
  ADD KEY `department_id` (`department_id`);

--
-- Indexes for table `user_permission_overrides`
--
ALTER TABLE `user_permission_overrides`
  ADD PRIMARY KEY (`user_type`,`user_id`,`permission_id`),
  ADD KEY `permission_id` (`permission_id`);

--
-- Indexes for table `user_projects`
--
ALTER TABLE `user_projects`
  ADD PRIMARY KEY (`user_type`,`user_id`,`project_id`),
  ADD KEY `project_id` (`project_id`);

--
-- Indexes for table `user_roles`
--
ALTER TABLE `user_roles`
  ADD PRIMARY KEY (`user_type`,`user_id`,`role_id`),
  ADD KEY `role_id` (`role_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `employees`
--
ALTER TABLE `employees`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=388;

--
-- AUTO_INCREMENT for table `login_sessions`
--
ALTER TABLE `login_sessions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT for table `modules`
--
ALTER TABLE `modules`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=73;

--
-- AUTO_INCREMENT for table `projects`
--
ALTER TABLE `projects`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `sites`
--
ALTER TABLE `sites`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=148;

--
-- AUTO_INCREMENT for table `task_files`
--
ALTER TABLE `task_files`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `permissions`
--
ALTER TABLE `permissions`
  ADD CONSTRAINT `fk_permission_module` FOREIGN KEY (`module_id`) REFERENCES `modules` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `projects`
--
ALTER TABLE `projects`
  ADD CONSTRAINT `fk_project_department` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`);

--
-- Constraints for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD CONSTRAINT `role_permissions_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_permissions_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `task_files`
--
ALTER TABLE `task_files`
  ADD CONSTRAINT `task_files_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_departments`
--
ALTER TABLE `user_departments`
  ADD CONSTRAINT `user_departments_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_permission_overrides`
--
ALTER TABLE `user_permission_overrides`
  ADD CONSTRAINT `user_permission_overrides_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_projects`
--
ALTER TABLE `user_projects`
  ADD CONSTRAINT `user_projects_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_roles`
--
ALTER TABLE `user_roles`
  ADD CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);
COMMIT;


-- ============================================================
-- PART 2: SCHEMA EXTENSION
-- ============================================================
-- ============================================================
-- Hammerhead Workspace - Schema Extension
-- Adds tables needed for: Workspace Home, Super Admin Panel,
-- Notifications, Activity/Audit Log, Project Dashboards config.
-- Run AFTER hammerhead_original.sql
-- ============================================================

-- 1. NOTIFICATIONS (Workspace Home > Notifications / Pending Items)
CREATE TABLE `notifications` (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_type` enum('superadmin','manager','employee') NOT NULL,
  `user_id` int(11) NOT NULL,
  `title` varchar(200) NOT NULL,
  `message` varchar(500) DEFAULT '',
  `link` varchar(300) DEFAULT '',
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_notif_user` (`user_type`,`user_id`,`is_read`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 2. ACTIVITY LOG (Workspace Home > Recent Activity, and audit trail)
CREATE TABLE `activity_log` (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_type` enum('superadmin','manager','employee') NOT NULL,
  `user_id` int(11) NOT NULL,
  `user_name` varchar(200) DEFAULT '',
  `department_id` int(10) UNSIGNED DEFAULT NULL,
  `project_id` int(10) UNSIGNED DEFAULT NULL,
  `action` varchar(100) NOT NULL,          -- e.g. 'task_created', 'user_updated', 'login'
  `description` varchar(500) DEFAULT '',
  `ip` varchar(45) DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_activity_user` (`user_type`,`user_id`),
  KEY `idx_activity_dept` (`department_id`),
  KEY `idx_activity_project` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 3. AUDIT LOG (Super Admin > Reports & Audit Logs - sensitive admin actions)
CREATE TABLE `audit_log` (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `actor_type` enum('superadmin','manager','employee') NOT NULL,
  `actor_id` int(11) NOT NULL,
  `actor_name` varchar(200) DEFAULT '',
  `entity_type` varchar(60) NOT NULL,      -- 'user','role','department','project','permission'
  `entity_id` varchar(60) DEFAULT '',
  `action` enum('create','update','delete','enable','disable','role_change','permission_change','password_reset','login','logout','login_failed') NOT NULL,
  `before_data` longtext DEFAULT NULL,     -- JSON snapshot
  `after_data` longtext DEFAULT NULL,      -- JSON snapshot
  `ip` varchar(45) DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_audit_actor` (`actor_type`,`actor_id`),
  KEY `idx_audit_entity` (`entity_type`,`entity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 4. PROJECT DASHBOARD WIDGETS (config-driven, so dashboards are not hardcoded per project)
CREATE TABLE `dashboard_widgets` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `project_id` int(10) UNSIGNED NOT NULL,
  `widget_type` enum('stat_card','pie_chart','bar_chart','line_chart','recent_activity','quick_actions','table') NOT NULL,
  `title` varchar(150) NOT NULL,
  `config` longtext DEFAULT NULL,          -- JSON: data source query key, colors, columns etc.
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  KEY `idx_widget_project` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 5. PROJECT FORMS (generic form builder reference per project)
CREATE TABLE `project_forms` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `project_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(150) NOT NULL,
  `slug` varchar(150) NOT NULL,
  `schema` longtext DEFAULT NULL,          -- JSON field definitions
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_project_slug` (`project_id`,`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 6. PROJECT REPORTS (saved/report definitions per project)
CREATE TABLE `project_reports` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `project_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(150) NOT NULL,
  `description` varchar(400) DEFAULT '',
  `query_config` longtext DEFAULT NULL,    -- JSON: filters, columns, grouping
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 7. UNIFIED SESSIONS (for "One Login" across superadmin/manager/employee)
CREATE TABLE `sessions` (
  `id` varchar(64) NOT NULL,               -- session token (hashed)
  `user_type` enum('superadmin','manager','employee') NOT NULL,
  `user_id` int(11) NOT NULL,
  `ip` varchar(45) DEFAULT '',
  `user_agent` varchar(300) DEFAULT '',
  `last_activity` timestamp NOT NULL DEFAULT current_timestamp(),
  `expires_at` datetime NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_sess_user` (`user_type`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- 8a. Widen user_type enums to include 'employee' — original schema only allowed
--     ('manager','superadmin'), which would silently block employee access assignment.
ALTER TABLE `user_roles`
  MODIFY `user_type` enum('manager','superadmin','employee') NOT NULL;

ALTER TABLE `user_departments`
  MODIFY `user_type` enum('manager','superadmin','employee') NOT NULL;

ALTER TABLE `user_projects`
  MODIFY `user_type` enum('manager','superadmin','employee') NOT NULL;

ALTER TABLE `user_permission_overrides`
  MODIFY `user_type` enum('manager','superadmin','employee') NOT NULL;

-- 8b. Add missing columns to employees for login (spec says employees can also log in)
ALTER TABLE `employees`
  ADD COLUMN IF NOT EXISTS `username` varchar(100) DEFAULT NULL AFTER `name`,
  ADD COLUMN IF NOT EXISTS `email` varchar(200) DEFAULT NULL AFTER `username`,
  ADD COLUMN IF NOT EXISTS `password_hash` varchar(255) DEFAULT NULL AFTER `email`,
  ADD COLUMN IF NOT EXISTS `is_active` tinyint(1) DEFAULT 1 AFTER `password_hash`,
  ADD COLUMN IF NOT EXISTS `reset_token` varchar(100) DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS `reset_expires` datetime DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS `last_login` datetime DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS `reports_to_type` enum('manager','superadmin') DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS `reports_to_id` int(11) DEFAULT NULL;

-- ============================================================
-- NOTE: roles, modules, permissions, role_permissions, and
-- departments are already fully seeded in your existing database
-- (roles: super_admin/CEO, department_head, manager, team_lead,
-- employee — modules 1-9 — permissions 1-72). No re-seeding needed
-- or wanted here; doing so would conflict with your existing IDs.
-- ============================================================

