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

START TRANSACTION;



--
-- Database: `nursery_mgmt`
--

DELIMITER $$
--
-- Procedures
--
CREATE DEFINER=`jana`@`%` PROCEDURE `sp_activity_statistics` (IN `date_from` DATE, IN `date_to` DATE)   BEGIN
    -- إحصائيات العمليات حسب النوع
    SELECT 
        action_type,
        CASE action_type
            WHEN 'create' THEN 'إضافة'
            WHEN 'update' THEN 'تعديل'
            WHEN 'delete' THEN 'حذف'
            WHEN 'login' THEN 'تسجيل دخول'
            WHEN 'logout' THEN 'تسجيل خروج'
            ELSE action_type
        END as action_type_ar,
        COUNT(*) as count
    FROM activity_logs
    WHERE DATE(created_at) BETWEEN date_from AND date_to
    GROUP BY action_type
    ORDER BY count DESC$$

CREATE DEFINER=`jana`@`%` PROCEDURE `sp_calculate_student_balance` (IN `p_student_id` INT)   BEGIN
  DECLARE v_invoices_total DECIMAL(12,2)$$

CREATE DEFINER=`jana`@`%` PROCEDURE `sp_cleanup_old_logs` (IN `days_to_keep` INT)   BEGIN
    DELETE FROM activity_logs 
    WHERE created_at < DATE_SUB(NOW(), INTERVAL days_to_keep DAY)$$

CREATE DEFINER=`jana`@`%` PROCEDURE `sp_generate_student_invoice` (IN `p_student_id` INT, IN `p_date` DATE)   BEGIN
  DECLARE v_section_id INT$$

CREATE DEFINER=`jana`@`%` PROCEDURE `sp_register_payment` (IN `p_student_id` INT, IN `p_invoice_id` BIGINT, IN `p_amount` DECIMAL(12,2), IN `p_method` ENUM('cash','bank','transfer','other'), IN `p_created_by` INT)   BEGIN
  INSERT INTO student_payments (student_id, invoice_id, amount, method, created_by)
  VALUES (p_student_id, p_invoice_id, p_amount, p_method, p_created_by)$$

DELIMITER ;

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

--
-- Table structure for table `active_sessions`
--

CREATE TABLE `active_sessions` (
  `id` varchar(128) NOT NULL COMMENT 'معرف الجلسة',
  `user_id` int(11) NOT NULL COMMENT 'معرف المستخدم',
  `ip_address` varchar(45) DEFAULT NULL COMMENT 'عنوان IP',
  `user_agent` text DEFAULT NULL COMMENT 'معلومات المتصفح',
  `last_activity` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'آخر نشاط',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ إنشاء الجلسة'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول الجلسات النشطة';

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

--
-- Table structure for table `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` bigint(20) NOT NULL,
  `user_id` int(11) DEFAULT NULL COMMENT 'معرف المستخدم الذي قام بالعملية',
  `user_name` varchar(120) DEFAULT NULL COMMENT 'اسم المستخدم',
  `action_type` enum('create','update','delete','login','logout','view','export','import','approve','reject') NOT NULL COMMENT 'نوع العملية',
  `module` varchar(50) NOT NULL COMMENT 'القسم/الموديول',
  `record_id` int(11) DEFAULT NULL COMMENT 'معرف السجل المتأثر',
  `description` text NOT NULL COMMENT 'وصف العملية بالعربية',
  `old_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'القيم القديمة قبل التعديل' CHECK (json_valid(`old_values`)),
  `new_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'القيم الجديدة بعد التعديل' CHECK (json_valid(`new_values`)),
  `ip_address` varchar(45) DEFAULT NULL COMMENT 'عنوان IP',
  `user_agent` text DEFAULT NULL COMMENT 'معلومات المتصفح',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ ووقت العملية'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='سجل جميع أحداث وعمليات النظام';

--
-- Dumping data for table `activity_logs`
--

INSERT INTO `activity_logs` (`id`, `user_id`, `user_name`, `action_type`, `module`, `record_id`, `description`, `old_values`, `new_values`, `ip_address`, `user_agent`, `created_at`) VALUES
(1, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:13:26'),
(2, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:14:10'),
(3, 3, 'نظام', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:14:35'),
(4, 3, 'نظام', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:15:16'),
(5, 3, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:18:37'),
(6, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:18:38'),
(7, 4, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:18:43'),
(8, 4, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:18:47'),
(9, 4, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:18:57'),
(10, 4, 'نظام', 'view', 'tasks', NULL, 'عرض صفحة: tasks/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:19:09'),
(11, 4, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:19:13'),
(12, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:19:14'),
(13, 3, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:19:17'),
(14, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:19:19'),
(15, 3, 'نظام', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:19:25'),
(16, 3, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:30:54'),
(17, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:30:54'),
(18, 4, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:01'),
(19, 4, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:07'),
(20, 4, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:31'),
(21, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:32'),
(22, 5, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:36'),
(23, 5, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:41'),
(24, 5, 'نظام', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:31:53'),
(25, 5, 'نظام', 'view', 'profile', NULL, 'عرض صفحة: profile/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:32:08'),
(26, 5, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:32:23'),
(27, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:32:23'),
(28, 3, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:32:27'),
(29, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:32:29'),
(30, 3, 'نظام', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:32:47'),
(31, 3, 'نظام', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:33:27'),
(32, 3, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:33:41'),
(33, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:33:41'),
(34, 4, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:33:46'),
(35, 4, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:33:54'),
(36, 4, 'نظام', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:12'),
(37, 4, 'نظام', 'view', 'profile', NULL, 'عرض صفحة: profile/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:33'),
(38, 4, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:38'),
(39, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:38'),
(40, 3, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:42'),
(41, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:44'),
(42, 3, 'نظام', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:34:49'),
(43, 3, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:00'),
(44, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:01'),
(45, 3, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:20'),
(46, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:22'),
(47, 3, 'نظام', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:29'),
(48, 3, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:56'),
(49, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:35:56'),
(50, 3, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:36:35'),
(51, 3, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:36:37'),
(52, 3, 'نظام', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:36:43'),
(53, 3, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:39:13'),
(54, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:39:14'),
(55, 9, 'نظام', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:39:25'),
(56, 9, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:39:26'),
(57, 9, 'نظام', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:39:33'),
(58, 9, 'نظام', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:42:52'),
(59, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: صفحة سجل الأحداث - عرض صفحة سجل أحداث النظام', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:42:58'),
(60, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: activity_logs/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:42:58'),
(61, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: إحصائيات سجل الأحداث - عرض الإحصائيات العامة', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:42:59'),
(62, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: قائمة سجلات الأحداث (فلترة: {\"limit\":50,\"offset\":0})', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:00'),
(63, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: خيارات فلترة سجل الأحداث - طلب خيارات الفلترة', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:01'),
(64, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: صفحة سجل الأحداث - عرض صفحة سجل أحداث النظام', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:18'),
(65, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: activity_logs/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:19'),
(66, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: خيارات فلترة سجل الأحداث - طلب خيارات الفلترة', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:19'),
(67, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: إحصائيات سجل الأحداث - عرض الإحصائيات العامة', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:21'),
(68, 9, 'نظام', 'view', 'activity_logs', NULL, 'عرض صفحة: قائمة سجلات الأحداث (فلترة: {\"limit\":50,\"offset\":0})', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:22'),
(69, 9, 'نظام', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:22'),
(70, 9, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:43:35'),
(71, 9, 'نظام', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:45:43'),
(72, 9, 'نظام', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:45:57'),
(73, 9, 'نظام', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:46:41'),
(74, 9, 'نظام', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:49:09'),
(75, 9, 'نظام', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:19'),
(76, 9, 'نظام', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:24'),
(77, 9, 'نظام', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:33'),
(78, 9, 'نظام', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:42'),
(79, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:43'),
(80, 3, 'وسام حسين علي', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:47'),
(81, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:50:48'),
(82, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:53:47'),
(83, 3, 'وسام حسين علي', 'logout', 'system', NULL, 'تسجيل خروج', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:54:00'),
(84, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:54:01'),
(85, 3, 'وسام حسين علي', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:54:06'),
(86, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:54:08'),
(87, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:54:18'),
(88, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:24'),
(89, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:30'),
(90, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:33'),
(91, 3, 'وسام حسين علي', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:41'),
(92, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:44'),
(93, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:47'),
(94, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:50'),
(95, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:54'),
(96, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:58:59'),
(97, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:59:02'),
(98, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:59:06'),
(99, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:59:14'),
(100, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:59:24'),
(101, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:59:27'),
(102, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 10:59:31'),
(103, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:00:14'),
(104, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:06:17'),
(105, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:06:26'),
(106, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:07:09'),
(107, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:07:12'),
(108, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:11:27'),
(109, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:12:10'),
(110, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:13:37'),
(111, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:14:02'),
(112, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:14:23'),
(113, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:16:46'),
(114, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:17:00'),
(115, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:17:12'),
(116, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:19:49'),
(117, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:20:23'),
(118, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:20:56'),
(119, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:24:49'),
(120, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:24:56'),
(121, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:19'),
(122, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:33'),
(123, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:38'),
(124, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:43'),
(125, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:46'),
(126, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/categories', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:49'),
(127, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:25:53'),
(128, 3, 'وسام حسين علي', 'view', 'reports', NULL, 'عرض صفحة: reports/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:26:07'),
(129, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:13'),
(130, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:20'),
(131, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:32'),
(132, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:38'),
(133, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:43'),
(134, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:48'),
(135, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:35:51'),
(136, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:48:51'),
(137, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:48:55'),
(138, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:02'),
(139, 3, 'وسام حسين علي', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:05'),
(140, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:07'),
(141, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:10'),
(142, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:12'),
(143, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:16'),
(144, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/categories', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:18'),
(145, 3, 'وسام حسين علي', 'view', 'employees', NULL, 'عرض صفحة: employees/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:21'),
(146, 3, 'وسام حسين علي', 'view', 'salary_contracts', NULL, 'عرض صفحة: salary_contracts/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:23'),
(147, 3, 'وسام حسين علي', 'view', 'salary_payments', NULL, 'عرض صفحة: salary_payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:25'),
(148, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/types', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:28'),
(149, 3, 'وسام حسين علي', 'view', 'drivers', NULL, 'عرض صفحة: drivers/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:34'),
(150, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:36'),
(151, 3, 'وسام حسين علي', 'view', 'reports', NULL, 'عرض صفحة: reports/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:39'),
(152, 3, 'وسام حسين علي', 'view', 'tasks', NULL, 'عرض صفحة: tasks/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:45'),
(153, 3, 'وسام حسين علي', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:49'),
(154, 3, 'وسام حسين علي', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:51'),
(155, 3, 'وسام حسين علي', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:49:53'),
(156, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:50:37'),
(157, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/categories', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:50:47'),
(158, 3, 'وسام حسين علي', 'view', 'employees', NULL, 'عرض صفحة: employees/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:50:52'),
(159, 3, 'وسام حسين علي', 'view', 'salary_contracts', NULL, 'عرض صفحة: salary_contracts/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:50:54'),
(160, 3, 'وسام حسين علي', 'view', 'salary_payments', NULL, 'عرض صفحة: salary_payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:50:56'),
(161, 3, 'وسام حسين علي', 'view', 'reports', NULL, 'عرض صفحة: reports/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:51:04'),
(162, 3, 'وسام حسين علي', 'view', 'reports', NULL, 'عرض صفحة: reports/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:56:55'),
(163, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:57:10'),
(164, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 11:57:30'),
(165, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:02:44'),
(166, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:02:54'),
(167, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:02:57'),
(168, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:01'),
(169, 3, 'وسام حسين علي', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:04'),
(170, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:07'),
(171, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:10'),
(172, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:13'),
(173, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:16'),
(174, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:03:33'),
(175, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:04:14'),
(176, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:04:21'),
(177, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:15'),
(178, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:24'),
(179, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:28'),
(180, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:32'),
(181, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:51'),
(182, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:54'),
(183, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:09:59'),
(184, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:08'),
(185, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:27'),
(186, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:31'),
(187, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/categories', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:34'),
(188, 3, 'وسام حسين علي', 'view', 'employees', NULL, 'عرض صفحة: employees/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:37'),
(189, 3, 'وسام حسين علي', 'view', 'salary_contracts', NULL, 'عرض صفحة: salary_contracts/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:39'),
(190, 3, 'وسام حسين علي', 'view', 'salary_payments', NULL, 'عرض صفحة: salary_payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:42'),
(191, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/types', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:46'),
(192, 3, 'وسام حسين علي', 'view', 'drivers', NULL, 'عرض صفحة: drivers/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:49'),
(193, 3, 'وسام حسين علي', 'view', 'drivers', NULL, 'عرض صفحة: drivers/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:51'),
(194, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:53'),
(195, 3, 'وسام حسين علي', 'view', 'reports', NULL, 'عرض صفحة: reports/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:10:55'),
(196, 3, 'وسام حسين علي', 'view', 'reports', NULL, 'عرض صفحة: reports/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:03'),
(197, 3, 'وسام حسين علي', 'view', 'admin', NULL, 'عرض صفحة: admin/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:12'),
(198, 3, 'وسام حسين علي', 'view', 'activity_logs', NULL, 'عرض صفحة: صفحة سجل الأحداث - عرض صفحة سجل أحداث النظام', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:14'),
(199, 3, 'وسام حسين علي', 'view', 'activity_logs', NULL, 'عرض صفحة: activity_logs/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:14'),
(200, 3, 'وسام حسين علي', 'view', 'activity_logs', NULL, 'عرض صفحة: خيارات فلترة سجل الأحداث - طلب خيارات الفلترة', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:15'),
(201, 3, 'وسام حسين علي', 'view', 'activity_logs', NULL, 'عرض صفحة: قائمة سجلات الأحداث (فلترة: {\"limit\":50,\"offset\":0})', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:16'),
(202, 3, 'وسام حسين علي', 'view', 'activity_logs', NULL, 'عرض صفحة: إحصائيات سجل الأحداث - عرض الإحصائيات العامة', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:17'),
(203, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:18'),
(204, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:28'),
(205, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:51'),
(206, 3, 'وسام حسين علي', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:11:57'),
(207, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:00'),
(208, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:02'),
(209, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/categories', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:06'),
(210, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:11'),
(211, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/types', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:18'),
(212, 3, 'وسام حسين علي', 'view', 'employees', NULL, 'عرض صفحة: employees/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:26');
INSERT INTO `activity_logs` (`id`, `user_id`, `user_name`, `action_type`, `module`, `record_id`, `description`, `old_values`, `new_values`, `ip_address`, `user_agent`, `created_at`) VALUES
(213, 3, 'وسام حسين علي', 'view', 'salary_contracts', NULL, 'عرض صفحة: salary_contracts/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:35'),
(214, 3, 'وسام حسين علي', 'view', 'salary_payments', NULL, 'عرض صفحة: salary_payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:37'),
(215, 3, 'وسام حسين علي', 'view', 'salary_contracts', NULL, 'عرض صفحة: salary_contracts/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:40'),
(216, 3, 'وسام حسين علي', 'view', 'salary_payments', NULL, 'عرض صفحة: salary_payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:55'),
(217, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/types', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:12:59'),
(218, 3, 'وسام حسين علي', 'view', 'drivers', NULL, 'عرض صفحة: drivers/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:13:04'),
(219, 3, 'وسام حسين علي', 'view', 'drivers', NULL, 'عرض صفحة: drivers/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:17:35'),
(220, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:17:38'),
(221, 3, 'وسام حسين علي', 'view', 'transport', NULL, 'عرض صفحة: transport/ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:17:42'),
(222, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/categories', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:17:57'),
(223, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:18:02'),
(224, 3, 'وسام حسين علي', 'view', 'profile', NULL, 'عرض صفحة: profile/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:18:27'),
(225, 3, 'وسام حسين علي', 'view', 'profile', NULL, 'عرض صفحة: profile/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:20:38'),
(226, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:23:31'),
(227, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:23:46'),
(228, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:24:06'),
(229, 3, 'وسام حسين علي', 'view', 'profile', NULL, 'عرض صفحة: profile/index', NULL, NULL, '::1', 'Mozilla/5.0 (Linux; Android 11.0; Surface Duo) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36', '2025-10-11 12:27:16'),
(230, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:27:29'),
(231, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:56:01'),
(232, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:56:10'),
(233, 3, 'وسام حسين علي', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:56:15'),
(234, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:56:24'),
(235, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/cash_ledger', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 12:56:29'),
(236, NULL, 'نظام', 'view', 'auth', NULL, 'عرض صفحة: auth/login', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:01:25'),
(237, 3, 'وسام حسين علي', 'login', 'system', NULL, 'تسجيل دخول ناجح', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:01:29'),
(238, 3, 'وسام حسين علي', 'view', 'dashboard', NULL, 'عرض صفحة: dashboard/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:01:31'),
(239, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:01:39'),
(240, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:01:59'),
(241, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:04:22'),
(242, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:04:26'),
(243, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:04:30'),
(244, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:06:41'),
(245, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:06:46'),
(246, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:07:00'),
(247, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:07:35'),
(248, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:08:13'),
(249, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Linux; Android 11.0; Surface Duo) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36', '2025-10-11 13:09:22'),
(250, 3, 'وسام حسين علي', 'view', 'sections', NULL, 'عرض صفحة: sections/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:09:38'),
(251, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:09:45'),
(252, 3, 'وسام حسين علي', 'view', 'attendance', NULL, 'عرض صفحة: attendance/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:09:47'),
(253, 3, 'وسام حسين علي', 'view', 'invoices', NULL, 'عرض صفحة: invoices/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:09:50'),
(254, 3, 'وسام حسين علي', 'view', 'payments', NULL, 'عرض صفحة: payments/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:09:54'),
(255, 3, 'وسام حسين علي', 'view', 'expenses', NULL, 'عرض صفحة: expenses/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:09:58'),
(256, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:10:02'),
(257, 3, 'وسام حسين علي', 'view', 'students', NULL, 'عرض صفحة: students/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:20:34'),
(258, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:20:42'),
(259, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:22:32'),
(260, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:39:55'),
(261, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:41:32'),
(262, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:42:28'),
(263, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:42:39'),
(264, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:43:24'),
(265, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:43:30'),
(266, 3, 'وسام حسين علي', 'view', 'settings', NULL, 'عرض صفحة: settings/index', NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-10-11 13:43:35');

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

--
-- Table structure for table `attendance_students`
--

CREATE TABLE `attendance_students` (
  `id` bigint(20) NOT NULL,
  `attendance_date` date NOT NULL,
  `student_id` int(11) NOT NULL,
  `section_id` int(11) NOT NULL,
  `status` enum('present','absent','late','excused') NOT NULL DEFAULT 'present',
  `note` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `attendance_transport`
--

CREATE TABLE `attendance_transport` (
  `id` bigint(20) NOT NULL,
  `attendance_date` date NOT NULL,
  `student_id` int(11) NOT NULL,
  `transport_line_id` int(11) NOT NULL,
  `pickup_present` tinyint(4) NOT NULL DEFAULT 0,
  `dropoff_present` tinyint(4) NOT NULL DEFAULT 0,
  `note` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `backups`
--

CREATE TABLE `backups` (
  `id` int(11) NOT NULL,
  `backup_name` varchar(255) NOT NULL COMMENT 'اسم النسخة الاحتياطية',
  `file_name` varchar(255) NOT NULL COMMENT 'اسم الملف',
  `file_path` varchar(500) NOT NULL COMMENT 'مسار الملف',
  `file_size` bigint(20) NOT NULL DEFAULT 0 COMMENT 'حجم الملف بالبايت',
  `backup_type` enum('manual','automatic','scheduled') NOT NULL DEFAULT 'manual' COMMENT 'نوع النسخة',
  `backup_status` enum('success','failed','in_progress') NOT NULL DEFAULT 'in_progress' COMMENT 'حالة النسخة',
  `compression` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'ضغط الملف',
  `includes_files` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'تضمين الملفات',
  `includes_uploads` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'تضمين المرفقات',
  `error_message` text DEFAULT NULL COMMENT 'رسالة الخطأ',
  `tables_count` int(11) DEFAULT NULL COMMENT 'عدد الجداول',
  `records_count` bigint(20) DEFAULT NULL COMMENT 'عدد السجلات',
  `duration_seconds` int(11) DEFAULT NULL COMMENT 'مدة النسخ بالثواني',
  `created_by` int(11) DEFAULT NULL COMMENT 'منشئ النسخة',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `notes` text DEFAULT NULL COMMENT 'ملاحظات'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول النسخ الاحتياطية';

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

--
-- Table structure for table `backup_logs`
--

CREATE TABLE `backup_logs` (
  `id` int(11) NOT NULL,
  `backup_type` enum('full','incremental','differential') NOT NULL COMMENT 'نوع النسخة',
  `file_path` varchar(500) NOT NULL COMMENT 'مسار الملف',
  `file_size` bigint(20) NOT NULL COMMENT 'حجم الملف بالبايت',
  `status` enum('success','failed','in_progress') DEFAULT 'in_progress' COMMENT 'حالة النسخة',
  `error_message` text DEFAULT NULL COMMENT 'رسالة الخطأ',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ البدء',
  `completed_at` datetime DEFAULT NULL COMMENT 'تاريخ الانتهاء'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول سجل النسخ الاحتياطي';

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

--
-- Table structure for table `backup_restores`
--

CREATE TABLE `backup_restores` (
  `id` int(11) NOT NULL,
  `backup_id` int(11) NOT NULL,
  `restore_status` enum('success','failed','in_progress') NOT NULL DEFAULT 'in_progress',
  `restore_point` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'نقطة الاستعادة',
  `restored_by` int(11) DEFAULT NULL,
  `restored_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `duration_seconds` int(11) DEFAULT NULL,
  `error_message` text DEFAULT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='سجل عمليات الاستعادة';

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

--
-- Table structure for table `cash_ledger`
--

CREATE TABLE `cash_ledger` (
  `id` bigint(20) NOT NULL,
  `txn_date` datetime NOT NULL DEFAULT current_timestamp(),
  `type` enum('income','expense','withdrawal','deposit') NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `source_type` varchar(50) NOT NULL,
  `source_id` bigint(20) DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `drivers`
--

CREATE TABLE `drivers` (
  `id` int(11) NOT NULL,
  `full_name` varchar(120) NOT NULL COMMENT 'الاسم الكامل للسائق',
  `phone` varchar(30) DEFAULT NULL COMMENT 'رقم الهاتف',
  `license_number` varchar(50) DEFAULT NULL COMMENT 'رقم الرخصة',
  `license_expiry` date DEFAULT NULL COMMENT 'تاريخ انتهاء الرخصة',
  `address` varchar(200) DEFAULT NULL COMMENT 'العنوان',
  `hire_date` date DEFAULT NULL COMMENT 'تاريخ التعيين',
  `status` enum('active','inactive','suspended') DEFAULT 'active' COMMENT 'حالة السائق',
  `photo` varchar(255) DEFAULT NULL COMMENT 'صورة السائق',
  `monthly_salary` decimal(12,2) DEFAULT 0.00 COMMENT 'الراتب الشهري',
  `commission_rate` decimal(5,2) NOT NULL DEFAULT 100.00 COMMENT 'نسبة العمولة من رسوم النقل (%) - افتراضي 100%',
  `vehicle_info` varchar(200) DEFAULT NULL COMMENT 'معلومات المركبة',
  `notes` text DEFAULT NULL COMMENT 'ملاحظات إضافية',
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول السائقين المنفصل عن الموظفين';

--
-- Dumping data for table `drivers`
--

INSERT INTO `drivers` (`id`, `full_name`, `phone`, `license_number`, `license_expiry`, `address`, `hire_date`, `status`, `photo`, `monthly_salary`, `commission_rate`, `vehicle_info`, `notes`, `created_at`, `updated_at`) VALUES
(1, 'سيف محمد احمد', '07728476333', '231331254325', '2030-01-01', 'Alluaa street house 203', '2025-10-10', 'active', NULL, 0.00, 100.00, 'كوستر 24 راكب', NULL, '2025-10-10 14:47:56', '2025-10-10 14:47:56');

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

--
-- Table structure for table `driver_ledger`
--

CREATE TABLE `driver_ledger` (
  `id` int(11) NOT NULL,
  `driver_id` int(11) NOT NULL COMMENT 'معرف السائق',
  `transaction_type` enum('credit','debit') NOT NULL COMMENT 'نوع العملية: credit=إيداع, debit=سحب',
  `amount` decimal(12,2) NOT NULL COMMENT 'المبلغ',
  `description` varchar(255) NOT NULL COMMENT 'الوصف',
  `student_id` int(11) DEFAULT NULL COMMENT 'معرف الطالب (إن كان متعلق بطالب)',
  `transport_line_id` int(11) DEFAULT NULL COMMENT 'معرف خط النقل',
  `transport_type_id` int(11) DEFAULT NULL COMMENT 'معرف نوع النقل',
  `payment_id` int(11) DEFAULT NULL COMMENT 'معرف عملية الدفع (عند سحب المبلغ)',
  `balance_after` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'الرصيد بعد العملية',
  `created_by` int(11) DEFAULT NULL COMMENT 'المستخدم الذي أنشأ العملية',
  `created_at` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'تاريخ العملية',
  `notes` text DEFAULT NULL COMMENT 'ملاحظات إضافية'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='دفتر أستاذ السائقين - تتبع الإيداعات والسحوبات';

--
-- Triggers `driver_ledger`
--
DELIMITER $$
CREATE TRIGGER `before_insert_driver_ledger` BEFORE INSERT ON `driver_ledger` FOR EACH ROW BEGIN
    DECLARE current_bal DECIMAL(12,2)$$
DELIMITER ;

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

--
-- Table structure for table `driver_salaries`
--

CREATE TABLE `driver_salaries` (
  `id` int(11) NOT NULL,
  `driver_id` int(11) NOT NULL,
  `salary_month` tinyint(4) NOT NULL COMMENT 'شهر الراتب (1-12)',
  `salary_year` smallint(6) NOT NULL COMMENT 'سنة الراتب',
  `base_salary` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'الراتب الأساسي',
  `commission_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'مبلغ العمولة',
  `bonus_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'مبلغ المكافأة',
  `deduction_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'مبلغ الخصم',
  `total_amount` decimal(12,2) NOT NULL COMMENT 'المبلغ الإجمالي',
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'المبلغ المدفوع',
  `remaining_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'المبلغ المتبقي',
  `payment_date` date DEFAULT NULL COMMENT 'تاريخ الدفع',
  `payment_method` enum('cash','bank','other') DEFAULT NULL COMMENT 'طريقة الدفع',
  `status` enum('pending','paid','partial') DEFAULT 'pending' COMMENT 'حالة الراتب',
  `notes` varchar(255) DEFAULT NULL COMMENT 'ملاحظات',
  `created_by` int(11) DEFAULT NULL COMMENT 'المستخدم الذي أنشأ السجل',
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول رواتب السائقين';

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

--
-- Table structure for table `driver_withdrawals`
--

CREATE TABLE `driver_withdrawals` (
  `id` int(11) NOT NULL,
  `driver_id` int(11) NOT NULL COMMENT 'معرف السائق',
  `amount` decimal(12,2) NOT NULL COMMENT 'المبلغ المسحوب',
  `payment_date` date NOT NULL COMMENT 'تاريخ الدفع',
  `payment_method` enum('cash','bank_transfer','check') NOT NULL DEFAULT 'cash' COMMENT 'طريقة الدفع',
  `check_number` varchar(50) DEFAULT NULL COMMENT 'رقم الشيك (إن وجد)',
  `notes` text DEFAULT NULL COMMENT 'ملاحظات',
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'completed' COMMENT 'الحالة',
  `created_by` int(11) DEFAULT NULL COMMENT 'المستخدم الذي أنشأ العملية',
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='سحوبات السائقين';

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

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

CREATE TABLE `employees` (
  `id` int(11) NOT NULL,
  `full_name` varchar(120) NOT NULL,
  `birth_date` date DEFAULT NULL,
  `job_title` varchar(100) DEFAULT NULL COMMENT 'المسمى الوظيفي (مثل: سائق، معلم، إداري)',
  `education_level` varchar(120) DEFAULT NULL,
  `certificate` varchar(120) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `linked_user_id` int(11) DEFAULT NULL,
  `hire_date` date DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `transport_type_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'نوع النقل (باقة النقل)',
  `license_number` varchar(50) DEFAULT NULL COMMENT 'رقم الرخصة',
  `photo` varchar(255) DEFAULT NULL COMMENT 'صورة الموظف',
  `emergency_contact` varchar(120) DEFAULT NULL COMMENT 'جهة الاتصال الطارئ',
  `emergency_phone` varchar(30) DEFAULT NULL COMMENT 'هاتف الطوارئ',
  `salary` decimal(12,2) DEFAULT 0.00 COMMENT 'الراتب الشهري',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'تاريخ آخر تحديث'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` bigint(20) NOT NULL,
  `expense_date` date NOT NULL,
  `category_id` int(11) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `details` varchar(255) DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `expenses`
--
DELIMITER $$
CREATE TRIGGER `trg_expense_cash` AFTER INSERT ON `expenses` FOR EACH ROW BEGIN
  INSERT INTO cash_ledger (type, amount, source_type, source_id, note, created_by)
  VALUES ('expense', NEW.amount, 'expense', NEW.id, CONCAT('مصروف: ', NEW.details), NEW.created_by)$$
DELIMITER ;

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

--
-- Table structure for table `expense_categories`
--

CREATE TABLE `expense_categories` (
  `id` int(11) NOT NULL,
  `name` varchar(80) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expense_categories`
--

INSERT INTO `expense_categories` (`id`, `name`) VALUES
(2, 'طعام'),
(1, 'لوازم روضة');

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

--
-- Table structure for table `inventory_items`
--

CREATE TABLE `inventory_items` (
  `id` int(11) NOT NULL,
  `name` varchar(200) NOT NULL COMMENT 'اسم الصنف',
  `category` varchar(100) DEFAULT NULL COMMENT 'فئة الصنف',
  `description` text DEFAULT NULL COMMENT 'وصف الصنف',
  `quantity` int(11) DEFAULT 0 COMMENT 'الكمية المتاحة',
  `min_quantity` int(11) DEFAULT 0 COMMENT 'الحد الأدنى للكمية',
  `unit_price` decimal(10,2) DEFAULT 0.00 COMMENT 'سعر الوحدة',
  `supplier` varchar(200) DEFAULT NULL COMMENT 'المورد',
  `supplier_contact` varchar(100) DEFAULT NULL COMMENT 'جهة الاتصال بالمورد',
  `location` varchar(100) DEFAULT NULL COMMENT 'مكان التخزين',
  `last_updated` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'تاريخ آخر تحديث',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ الإنشاء'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول أصناف المخزون';

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

--
-- Table structure for table `inventory_transactions`
--

CREATE TABLE `inventory_transactions` (
  `id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL COMMENT 'معرف الصنف',
  `transaction_type` enum('in','out','adjustment','transfer') NOT NULL COMMENT 'نوع المعاملة',
  `quantity` int(11) NOT NULL COMMENT 'الكمية',
  `unit_price` decimal(10,2) DEFAULT 0.00 COMMENT 'سعر الوحدة',
  `total_amount` decimal(12,2) DEFAULT 0.00 COMMENT 'المبلغ الإجمالي',
  `reference` varchar(200) DEFAULT NULL COMMENT 'مرجع المعاملة',
  `notes` text DEFAULT NULL COMMENT 'ملاحظات',
  `created_by` int(11) DEFAULT NULL COMMENT 'منشئ المعاملة',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ المعاملة'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول معاملات المخزون';

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

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` bigint(20) NOT NULL,
  `student_id` int(11) NOT NULL,
  `issue_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `bill_month` tinyint(4) DEFAULT NULL,
  `bill_year` smallint(6) DEFAULT NULL,
  `status` enum('unpaid','partial','paid','cancelled') DEFAULT 'unpaid',
  `subtotal` decimal(12,2) NOT NULL DEFAULT 0.00,
  `discount_total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `note` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `invoice_items`
--

CREATE TABLE `invoice_items` (
  `id` bigint(20) NOT NULL,
  `invoice_id` bigint(20) NOT NULL,
  `item_type` enum('tuition','transport','other') NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `quantity` decimal(10,2) NOT NULL DEFAULT 1.00,
  `unit_price` decimal(12,2) NOT NULL,
  `line_total` decimal(12,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `login_logs`
--

CREATE TABLE `login_logs` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL COMMENT 'معرف المستخدم',
  `email` varchar(120) DEFAULT NULL COMMENT 'البريد الإلكتروني',
  `ip_address` varchar(45) DEFAULT NULL COMMENT 'عنوان IP',
  `user_agent` text DEFAULT NULL COMMENT 'معلومات المتصفح',
  `status` enum('success','failed','blocked') NOT NULL COMMENT 'حالة تسجيل الدخول',
  `failure_reason` varchar(200) DEFAULT NULL COMMENT 'سبب الفشل',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ المحاولة'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول سجل تسجيل الدخول';

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

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `title` varchar(200) NOT NULL COMMENT 'عنوان الإشعار',
  `message` text NOT NULL COMMENT 'نص الإشعار',
  `type` enum('info','warning','error','success') DEFAULT 'info' COMMENT 'نوع الإشعار',
  `is_read` tinyint(1) DEFAULT 0 COMMENT 'تم القراءة',
  `priority` enum('low','medium','high') DEFAULT 'medium' COMMENT 'أولوية الإشعار',
  `expires_at` datetime DEFAULT NULL COMMENT 'تاريخ انتهاء الإشعار',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ الإنشاء'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول الإشعارات';

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

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) NOT NULL,
  `invoice_id` bigint(20) DEFAULT NULL,
  `student_id` int(11) NOT NULL,
  `pay_date` datetime NOT NULL DEFAULT current_timestamp(),
  `amount` decimal(12,2) NOT NULL,
  `method` enum('cash','card','bank','other') NOT NULL DEFAULT 'cash',
  `reference` varchar(120) DEFAULT NULL,
  `received_by` int(11) DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `permissions` (
  `id` int(11) NOT NULL,
  `code` varchar(100) NOT NULL,
  `label_ar` varchar(150) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `permissions` (`id`, `code`, `label_ar`) VALUES
(1, 'students.read', 'عرض الطلاب'),
(2, 'students.write', 'إدارة الطلاب'),
(3, 'attendance.write', 'تسجيل الحضور'),
(4, 'transport.write', 'إدارة النقل'),
(5, 'finance.read', 'عرض التقارير المالية'),
(6, 'finance.write', 'إدارة الفواتير والمدفوعات'),
(7, 'expenses.write', 'تسجيل المصروفات'),
(8, 'salaries.write', 'إدارة الرواتب'),
(9, 'notifications.read', 'عرض الإشعارات'),
(10, 'notifications.write', 'إدارة الإشعارات'),
(11, 'reports.create', 'إنشاء التقارير'),
(12, 'reports.manage', 'إدارة قوالب التقارير'),
(13, 'tasks.read', 'عرض المهام'),
(14, 'tasks.write', 'إدارة المهام'),
(15, 'inventory.read', 'عرض المخزون'),
(16, 'inventory.write', 'إدارة المخزون'),
(18, 'system.logs', 'عرض سجلات النظام'),
(19, 'attendance.read', 'عرض الحضور'),
(20, 'expenses.read', 'عرض المصروفات'),
(21, 'salaries.read', 'عرض الرواتب'),
(22, 'transport.read', 'عرض النقل'),
(23, 'reports.read', 'عرض التقارير'),
(24, 'settings.read', 'عرض الإعدادات'),
(25, 'settings.write', 'تعديل الإعدادات'),
(84, 'students.delete', 'حذف الطلاب'),
(85, 'sections.read', 'قراءة الأقسام'),
(86, 'sections.write', 'كتابة وتعديل الأقسام'),
(93, 'backup.read', 'عرض النسخ الاحتياطية'),
(94, 'backup.create', 'إنشاء نسخة احتياطية'),
(95, 'backup.download', 'تحميل النسخ الاحتياطية'),
(96, 'backup.restore', 'استعادة النسخ الاحتياطية'),
(97, 'backup.delete', 'حذف النسخ الاحتياطية'),
(98, 'backup.settings', 'إدارة إعدادات النسخ الاحتياطي');

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

--
-- Table structure for table `report_templates`
--

CREATE TABLE `report_templates` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL COMMENT 'اسم القالب',
  `description` text DEFAULT NULL COMMENT 'وصف القالب',
  `query` text NOT NULL COMMENT 'استعلام قاعدة البيانات',
  `parameters` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'المعاملات المطلوبة' CHECK (json_valid(`parameters`)),
  `category` varchar(50) DEFAULT 'general' COMMENT 'فئة التقرير',
  `is_public` tinyint(1) DEFAULT 0 COMMENT 'متاح للجميع',
  `created_by` int(11) DEFAULT NULL COMMENT 'منشئ القالب',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ الإنشاء',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'تاريخ آخر تحديث'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول قوالب التقارير';

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

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

CREATE TABLE `roles` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `label_ar` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `roles` (`id`, `name`, `label_ar`) VALUES
(1, 'admin', 'مدير النظام'),
(2, 'manager', 'مدير'),
(3, 'accountant', 'محاسب'),
(4, 'staff', 'إداري');

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

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

CREATE TABLE `role_permissions` (
  `role_id` int(11) NOT NULL,
  `perm_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `role_permissions` (`role_id`, `perm_id`) VALUES
(1, 1),
(1, 2),
(1, 3),
(1, 4),
(1, 5),
(1, 6),
(1, 7),
(1, 8),
(1, 9),
(1, 10),
(1, 11),
(1, 12),
(1, 13),
(1, 14),
(1, 15),
(1, 16),
(1, 18),
(1, 19),
(1, 20),
(1, 21),
(1, 22),
(1, 23),
(1, 24),
(1, 25),
(1, 84),
(1, 85),
(1, 86),
(1, 93),
(1, 94),
(1, 95),
(1, 96),
(1, 97),
(1, 98),
(2, 1),
(2, 2),
(2, 3),
(2, 4),
(2, 5),
(2, 6),
(2, 7),
(2, 8),
(2, 9),
(2, 10),
(2, 11),
(2, 13),
(2, 14),
(2, 19),
(2, 20),
(2, 21),
(2, 22),
(2, 23),
(2, 84),
(2, 85),
(2, 86),
(3, 1),
(3, 5),
(3, 6),
(3, 7),
(3, 8),
(3, 11),
(3, 20),
(3, 21),
(3, 22),
(3, 23),
(3, 85),
(4, 1),
(4, 2),
(4, 3),
(4, 9),
(4, 13),
(4, 14),
(4, 19),
(4, 22),
(4, 23),
(4, 85);

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

--
-- Table structure for table `salary_contracts`
--

CREATE TABLE `salary_contracts` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `base_salary` decimal(12,2) NOT NULL,
  `allowance` decimal(12,2) NOT NULL DEFAULT 0.00,
  `effective_from` date NOT NULL,
  `effective_to` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `salary_payments`
--

CREATE TABLE `salary_payments` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `pay_month` tinyint(4) NOT NULL,
  `pay_year` smallint(6) NOT NULL,
  `pay_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `status` enum('paid','pending','cancelled') DEFAULT 'paid',
  `note` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `salary_payments`
--
DELIMITER $$
CREATE TRIGGER `trg_salary_cash` AFTER INSERT ON `salary_payments` FOR EACH ROW BEGIN
  IF NEW.status = 'paid' THEN
    INSERT INTO cash_ledger (type, amount, source_type, source_id, note)
    VALUES ('expense', NEW.amount, 'salary', NEW.id, CONCAT('راتب ', NEW.employee_id, ' لشهر ', NEW.pay_month, '/', NEW.pay_year))$$
DELIMITER ;

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

--
-- Table structure for table `sections`
--

CREATE TABLE `sections` (
  `id` int(11) NOT NULL,
  `name` varchar(60) NOT NULL,
  `monthly_tuition` decimal(12,2) NOT NULL,
  `daily_tuition` decimal(12,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sections`
--

INSERT INTO `sections` (`id`, `name`, `monthly_tuition`, `daily_tuition`) VALUES
(1, 'روضة', 100000.00, 3333.00),
(2, 'حضانة', 120000.00, 4000.00),
(3, 'تمهيدي', 150000.00, 5000.00);

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

--
-- Table structure for table `staff_users`
--

CREATE TABLE `staff_users` (
  `id` int(11) NOT NULL,
  `full_name` varchar(120) NOT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `email` varchar(120) DEFAULT NULL,
  `password_hash` varchar(255) NOT NULL,
  `role_id` int(11) NOT NULL,
  `manager_id` int(11) DEFAULT NULL COMMENT 'معرف المدير المباشر',
  `hierarchy_level` tinyint(2) DEFAULT 0 COMMENT 'المستوى الهرمي (0=CEO, 1=Manager, 2=Supervisor, etc.)',
  `department` varchar(100) DEFAULT NULL COMMENT 'القسم/الإدارة',
  `job_title` varchar(100) DEFAULT NULL COMMENT 'المسمى الوظيفي',
  `employee_code` varchar(50) DEFAULT NULL COMMENT 'الرقم الوظيفي',
  `status` enum('active','disabled') DEFAULT 'active',
  `created_at` datetime DEFAULT current_timestamp(),
  `last_login` datetime DEFAULT NULL COMMENT 'آخر تسجيل دخول',
  `login_attempts` int(11) DEFAULT 0 COMMENT 'عدد محاولات تسجيل الدخول',
  `locked_until` datetime DEFAULT NULL COMMENT 'مقفل حتى',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'تاريخ آخر تحديث'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `staff_users`
--

INSERT INTO `staff_users` (`id`, `full_name`, `phone`, `email`, `password_hash`, `role_id`, `manager_id`, `hierarchy_level`, `department`, `job_title`, `employee_code`, `status`, `created_at`, `last_login`, `login_attempts`, `locked_until`, `updated_at`) VALUES
(2, 'وسام', '07833365666', 'admin@admin.com', '$2y$10$qlxwx6GAqTQ5EkF5RuGZFuCqmE9Zk7odrZEp7YG/j0UKgF88WeiiO', 1, NULL, 0, NULL, NULL, NULL, 'active', '2025-09-04 16:38:52', NULL, 0, NULL, '2025-10-05 13:07:39'),
(3, 'وسام حسين علي', '0770-000-0001', 'admin@nursery.local', '$2y$10$hm.5hmdjfx05ZGEy.SVWX.TPnVPowCq4ANM0CQLa8jznZGGpeCeWS', 1, NULL, 0, NULL, NULL, NULL, 'active', '2025-09-04 17:04:18', '2025-10-11 13:01:29', 0, NULL, '2025-10-11 13:01:29'),
(4, 'مدير الروضة', '0770-000-0002', 'manager@nursery.local', '$2y$10$gc1Tv6FTX8lt5765s//lL.DR7ILyaJAvX0B/H8SXbuXnp92ATlHRy', 2, NULL, 0, NULL, NULL, NULL, 'active', '2025-09-04 17:04:18', '2025-10-11 10:33:45', 0, NULL, '2025-10-11 10:33:45'),
(5, 'محاسب الروضة', '0770-000-0003', 'accountant@nursery.local', '$2y$10$Z53dRhcF3yPy7Y5KpelFs.sxWKmbMwhY3ZDa1dcMnD9PEnnfuwfrK', 3, NULL, 0, NULL, NULL, NULL, 'active', '2025-09-04 17:04:18', '2025-10-11 10:31:36', 0, NULL, '2025-10-11 10:31:36'),
(6, 'إداري تسجيل 1', '0770-000-0004', 'staff1@nursery.local', '$2y$12$6dqGy8tCKhnTSXSH2Pi8reZbAY5LIDDs8zybBoaE7vv02t/UnkRsy', 4, NULL, 0, NULL, NULL, NULL, 'active', '2025-09-04 17:04:18', '2025-10-08 01:17:26', 0, NULL, '2025-10-08 01:17:26'),
(9, 'حارث وعد ابرهيم', '07728476465', 'wesamazade@gmail.com', '$2y$12$X4RTeoAP2XV.fCLsZMd2kugAN3kUWIvOWXy075/TfeiDmDmuLQxJO', 1, NULL, 0, NULL, NULL, NULL, 'active', '2025-10-08 01:19:53', '2025-10-11 10:39:24', 0, NULL, '2025-10-11 10:39:24');

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

--
-- Table structure for table `students`
--

CREATE TABLE `students` (
  `id` int(11) NOT NULL COMMENT 'المعرف الفريد للطالب (Primary Key)',
  `full_name` varchar(120) NOT NULL COMMENT 'الاسم الكامل للطالب',
  `mother_name` varchar(120) DEFAULT NULL COMMENT 'اسم الأم',
  `guardian_name` varchar(120) DEFAULT NULL COMMENT 'اسم ولي الأمر',
  `guardian_phone` varchar(30) DEFAULT NULL COMMENT 'هاتف ولي الأمر',
  `guardian_relation` varchar(60) DEFAULT NULL COMMENT 'صلة القرابة (أب/أم/أخ/جد/وصي)',
  `guardian_has_gov_income` tinyint(4) NOT NULL DEFAULT 0 COMMENT '1 = ولي الأمر لديه دخل حكومي ثابت (راتب دولة)',
  `birth_date` date DEFAULT NULL COMMENT 'تاريخ ميلاد الطالب',
  `address` varchar(200) DEFAULT NULL COMMENT 'عنوان السكن',
  `section_id` int(11) NOT NULL COMMENT 'القسم المسجل فيه الطالب (مفتاح أجنبي إلى sections)',
  `transport_line_id` int(11) DEFAULT NULL COMMENT 'خط النقل (للاستخدام المستقبلي)',
  `status` enum('active','inactive','graduated','transferred') DEFAULT 'active' COMMENT 'حالة الطالب (نشط/موقوف/متخرج/منقول)',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ ووقت إدخال السجل',
  `created_by` varchar(10) DEFAULT NULL,
  `student_photo` varchar(255) DEFAULT NULL COMMENT 'اسم ملف صورة الطالب',
  `subscription_type` enum('monthly','partial_days') NOT NULL DEFAULT 'monthly' COMMENT 'نوع الاشتراك: شهر كامل أو جزئي بالأيام',
  `days_count` int(11) DEFAULT 0 COMMENT 'عدد الأيام للاشتراك الجزئي',
  `payment_status` enum('cash','partial','unpaid') NOT NULL DEFAULT 'unpaid' COMMENT 'حالة السداد: نقداً، جزئي، غير مدفوع',
  `total_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'المبلغ الإجمالي لأجور الطالب',
  `transport_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'أجور النقل',
  `net_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'المبلغ الصافي بدون أجور النقل',
  `transport_type_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'نوع النقل (باقة النقل)',
  `driver_employee_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'السائق المسؤول عن النقل',
  `emergency_contact_name` varchar(120) DEFAULT NULL COMMENT 'اسم جهة الاتصال الطارئ',
  `emergency_contact_phone` varchar(30) DEFAULT NULL COMMENT 'هاتف جهة الاتصال الطارئ',
  `medical_conditions` text DEFAULT NULL COMMENT 'الحالات الطبية',
  `allergies` text DEFAULT NULL COMMENT 'الحساسيات',
  `enrollment_date` date DEFAULT NULL COMMENT 'تاريخ التسجيل',
  `graduation_date` date DEFAULT NULL COMMENT 'تاريخ التخرج',
  `notes` text DEFAULT NULL COMMENT 'ملاحظات إضافية',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'تاريخ آخر تحديث',
  `accounting_type` enum('activation_based','calendar_based') DEFAULT 'calendar_based' COMMENT 'نوع نظام المحاسبة',
  `activation_date` date DEFAULT curdate() COMMENT 'تاريخ تفعيل الحساب'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `student_enrollments`
--

CREATE TABLE `student_enrollments` (
  `id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `subscription_type` enum('monthly','partial_days') NOT NULL,
  `days_count` int(11) DEFAULT NULL,
  `tuition_amount` decimal(12,2) NOT NULL,
  `transport_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(12,2) NOT NULL,
  `discount_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `transport_line_id` int(11) DEFAULT NULL,
  `section_id` int(11) NOT NULL,
  `note` varchar(255) DEFAULT NULL,
  `status` enum('active','completed','cancelled') DEFAULT 'active',
  `created_by` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `student_payments`
--

CREATE TABLE `student_payments` (
  `id` bigint(20) NOT NULL,
  `student_id` int(11) NOT NULL,
  `invoice_id` bigint(20) DEFAULT NULL,
  `payment_date` datetime DEFAULT current_timestamp(),
  `amount` decimal(12,2) NOT NULL,
  `method` enum('cash','bank','transfer','other') DEFAULT 'cash',
  `note` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='دفعات الطلاب';

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

--
-- Table structure for table `system_settings`
--

CREATE TABLE `system_settings` (
  `id` int(11) NOT NULL,
  `setting_key` varchar(100) NOT NULL COMMENT 'مفتاح الإعداد',
  `setting_value` text DEFAULT NULL COMMENT 'قيمة الإعداد',
  `setting_type` enum('text','number','boolean','json','file') DEFAULT 'text' COMMENT 'نوع الإعداد',
  `category` varchar(50) DEFAULT 'general' COMMENT 'فئة الإعداد',
  `description` varchar(255) DEFAULT NULL COMMENT 'وصف الإعداد',
  `is_required` tinyint(4) DEFAULT 0 COMMENT 'هل الإعداد مطلوب',
  `updated_by` int(11) DEFAULT NULL COMMENT 'المستخدم الذي حدث الإعداد',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول إعدادات النظام';

--
-- Dumping data for table `system_settings`
--

INSERT INTO `system_settings` (`id`, `setting_key`, `setting_value`, `setting_type`, `category`, `description`, `is_required`, `updated_by`, `updated_at`, `created_at`) VALUES
(1, 'nursery_name', 'روضة طيور الجنة', 'text', 'nursery', 'اسم الروضة', 1, 3, '2025-10-11 11:14:10', '2025-01-01 00:00:00'),
(2, 'nursery_name_en', 'Tour Al-jana Nursery', 'text', 'nursery', 'اسم الروضة بالإنجليزية', 0, 3, '2025-10-11 11:14:11', '2025-01-01 00:00:00'),
(3, 'nursery_address', 'كركوك - الحويجة - حي القادة', 'text', 'nursery', 'عنوان الروضة', 1, 3, '2025-10-11 11:14:11', '2025-01-01 00:00:00'),
(4, 'nursery_phone', '07701234567', 'text', 'nursery', 'رقم هاتف الروضة', 1, 3, '2025-10-11 11:14:11', '2025-01-01 00:00:00'),
(5, 'nursery_email', 'info@alamal-nursery.com', 'text', 'nursery', 'البريد الإلكتروني للروضة', 0, 3, '2025-10-11 11:14:11', '2025-01-01 00:00:00'),
(6, 'nursery_website', 'www.alamal-nursery.com', 'text', 'nursery', 'موقع الروضة الإلكتروني', 0, 3, '2025-10-11 11:14:12', '2025-01-01 00:00:00'),
(7, 'nursery_logo', 'uploads/logos/logo_1760170813_68ea133dc4a45.png', 'file', 'nursery', 'شعار الروضة', 0, 3, '2025-10-11 11:20:12', '2025-01-01 00:00:00'),
(8, 'nursery_license', '123456789', 'text', 'nursery', 'رقم ترخيص الروضة', 0, 3, '2025-10-11 11:14:12', '2025-01-01 00:00:00'),
(9, 'nursery_director', 'أ. مصطفى برهان', 'text', 'nursery', 'اسم مدير الروضة', 0, 3, '2025-10-11 11:14:12', '2025-01-01 00:00:00'),
(10, 'currency_symbol', 'د.ع', 'text', 'system', 'رمز العملة', 1, 3, '2025-10-11 11:14:13', '2025-01-01 00:00:00'),
(11, 'currency_name', 'دينار عراقي', 'text', 'system', 'اسم العملة', 1, 3, '2025-10-11 11:14:13', '2025-01-01 00:00:00'),
(12, 'date_format', 'Y-m-d', 'text', 'system', 'تنسيق التاريخ', 1, 3, '2025-10-11 11:14:14', '2025-01-01 00:00:00'),
(13, 'timezone', 'Asia/Baghdad', 'text', 'system', 'المنطقة الزمنية', 1, 3, '2025-10-11 11:14:13', '2025-01-01 00:00:00'),
(14, 'language', 'ar', 'text', 'system', 'لغة النظام', 1, NULL, '2025-09-06 13:41:55', '2025-01-01 00:00:00'),
(15, 'items_per_page', '25', 'number', 'system', 'عدد العناصر في الصفحة الواحدة', 1, 3, '2025-10-11 11:14:14', '2025-01-01 00:00:00'),
(16, 'backup_enabled', '1', 'boolean', 'system', 'تفعيل نظام النسخ الاحتياطي', 0, 3, '2025-10-11 13:36:48', '2025-01-01 00:00:00'),
(17, 'backup_frequency', 'daily', 'text', 'system', 'تكرار النسخ الاحتياطي', 0, NULL, '2025-01-01 00:00:00', '2025-01-01 00:00:00'),
(18, 'email_notifications', '0', 'boolean', 'system', 'تفعيل الإشعارات الإلكترونية', 0, 3, '2025-10-11 11:14:18', '2025-01-01 00:00:00'),
(19, 'sms_notifications', '0', 'boolean', 'system', 'تفعيل الإشعارات النصية', 0, 3, '2025-10-11 11:14:18', '2025-01-01 00:00:00'),
(20, 'print_header', 'روضة طيور الجنة - إدارة الطلاب', 'text', 'printing', 'عنوان الطباعة', 1, 3, '2025-10-11 11:14:16', '2025-01-01 00:00:00'),
(21, 'print_footer', '\"نهتمّ بأبنائكم كأنّهم أبناؤنا... راحتهم ونجاحهم هدفُنا\"', 'text', 'printing', 'تذييل الطباعة', 0, 3, '2025-10-11 11:14:16', '2025-01-01 00:00:00'),
(22, 'print_logo', '1', 'boolean', 'printing', 'طباعة الشعار في التقارير', 0, 3, '2025-10-11 11:14:17', '2025-01-01 00:00:00'),
(23, 'print_watermark', '1', 'boolean', 'printing', 'طباعة العلامة المائية', 0, 3, '2025-10-11 11:14:17', '2025-01-01 00:00:00'),
(24, 'default_printer', '', 'text', 'printing', 'الطابعة الافتراضية', 0, NULL, '2025-09-06 13:41:56', '2025-01-01 00:00:00'),
(25, 'paper_size', 'A4', 'text', 'printing', 'حجم الورق الافتراضي', 1, 3, '2025-10-11 11:14:16', '2025-01-01 00:00:00'),
(26, 'print_orientation', 'portrait', 'text', 'printing', 'اتجاه الطباعة', 1, 3, '2025-10-11 11:14:16', '2025-01-01 00:00:00'),
(27, 'auto_save', '1', 'boolean', 'system', 'الحفظ التلقائي', 0, 3, '2025-10-11 11:14:15', '2025-01-01 00:00:00'),
(28, 'session_timeout', '30', 'number', 'system', 'مهلة انتهاء الجلسة (بالدقائق)', 1, 3, '2025-10-11 11:14:14', '2025-01-01 00:00:00'),
(29, 'max_file_size', '5', 'number', 'system', 'الحد الأقصى لحجم الملف (بالميجابايت)', 1, 3, '2025-10-11 11:14:14', '2025-01-01 00:00:00'),
(30, 'allowed_file_types', 'jpg,jpeg,png,pdf,doc,docx', 'text', 'system', 'أنواع الملفات المسموحة', 1, 3, '2025-10-11 11:14:15', '2025-01-01 00:00:00'),
(31, 'maintenance_mode', '0', 'number', 'maintenance', 'maintenance mode', 0, 3, '2025-10-11 11:14:19', '2025-09-06 13:40:07'),
(32, 'maintenance_message', 'النظام تحت الصيانة، يرجى المحاولة لاحقاً', 'text', 'maintenance', 'maintenance message', 0, 3, '2025-10-11 11:14:19', '2025-09-06 13:40:07'),
(33, 'backup_retention_days', '30', 'number', 'backup', 'عدد أيام الاحتفاظ بالنسخ', 0, 3, '2025-10-11 13:36:48', '2025-10-05 11:37:07'),
(34, 'max_login_attempts', '5', 'number', 'security', 'الحد الأقصى لمحاولات تسجيل الدخول', 0, 3, '2025-10-11 11:14:17', '2025-10-05 11:37:07'),
(35, 'session_timeout_minutes', '30', 'number', 'security', 'مهلة انتهاء الجلسة بالدقائق', 0, 3, '2025-10-11 11:14:17', '2025-10-05 11:37:07'),
(36, 'inventory_low_stock_alert', '1', 'boolean', 'inventory', 'تفعيل تنبيه المخزون المنخفض', 0, 3, '2025-10-11 11:14:20', '2025-10-05 11:37:07'),
(37, 'task_reminder_days', '3', 'number', 'tasks', 'عدد أيام تذكير المهام', 0, 3, '2025-10-11 11:14:19', '2025-10-05 11:37:07'),
(38, 'notification_retention_days', '90', 'number', 'notifications', 'عدد أيام الاحتفاظ بالإشعارات', 0, 3, '2025-10-11 11:14:19', '2025-10-05 11:37:07'),
(39, 'database_version', '2.0', 'text', 'system', 'إصدار قاعدة البيانات', 0, NULL, '2025-10-05 11:37:07', '2025-10-05 11:37:07'),
(40, 'last_upgrade_date', '2025-10-05 11:37:07', 'text', 'system', 'تاريخ آخر ترقية', 0, NULL, '2025-10-05 11:37:07', '2025-10-05 11:37:07'),
(65, 'print_page_size', 'A4', 'text', 'printing', 'حجم ورقة الطباعة (A4, A5, Letter)', 0, NULL, '2025-10-07 06:49:52', '2025-10-07 06:49:52'),
(66, 'print_margin', '10mm', 'text', 'printing', 'هامش الطباعة بالملليمتر', 0, NULL, '2025-10-07 06:49:52', '2025-10-07 06:49:52'),
(69, 'auto_print', '0', 'text', 'printing', 'تفعيل الطباعة التلقائية (0 = لا، 1 = نعم)', 0, NULL, '2025-10-07 06:49:52', '2025-10-07 06:49:52'),
(71, 'backup_auto_enabled', '0', 'boolean', 'backup', 'تفعيل النسخ الاحتياطي التلقائي', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(72, 'backup_auto_time', '03:00', 'text', 'backup', 'وقت النسخ الاحتياطي التلقائي', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(73, 'backup_auto_frequency', 'daily', 'text', 'backup', 'تكرار النسخ التلقائي (daily, weekly, monthly)', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(74, 'backup_path', 'storage/backups/', 'text', 'backup', 'مسار حفظ النسخ الاحتياطية', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(75, 'backup_max_size', '500', 'number', 'backup', 'الحد الأقصى لحجم النسخة (MB)', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(77, 'backup_max_backups', '10', 'number', 'backup', 'الحد الأقصى لعدد النسخ المحفوظة', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(78, 'backup_compression', '1', 'boolean', 'backup', 'ضغط ملفات النسخ الاحتياطي', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(79, 'backup_compression_level', '6', 'number', 'backup', 'مستوى الضغط (1-9)', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(80, 'backup_include_files', '0', 'boolean', 'backup', 'تضمين الملفات في النسخة', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(81, 'backup_include_uploads', '1', 'boolean', 'backup', 'تضمين المرفقات في النسخة', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(82, 'backup_include_logs', '0', 'boolean', 'backup', 'تضمين السجلات في النسخة', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(83, 'backup_encrypt', '0', 'boolean', 'backup', 'تشفير ملفات النسخ الاحتياطي', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(84, 'backup_require_password', '0', 'boolean', 'backup', 'طلب كلمة مرور للاستعادة', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(85, 'backup_allowed_ips', '', 'text', 'backup', 'عناوين IP المسموح لها (فاصلة)', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(86, 'backup_notify_email', '', 'text', 'backup', 'البريد الإلكتروني للإشعارات', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(87, 'backup_notify_success', '1', 'boolean', 'backup', 'إرسال إشعار عند النجاح', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(88, 'backup_notify_failure', '1', 'boolean', 'backup', 'إرسال إشعار عند الفشل', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(89, 'backup_exclude_tables', '', 'text', 'backup', 'جداول مستثناة من النسخ (فاصلة)', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(90, 'backup_db_only', '0', 'boolean', 'backup', 'نسخ قاعدة البيانات فقط', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(91, 'backup_incremental', '0', 'boolean', 'backup', 'نسخ احتياطي تزايدي', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48'),
(92, 'backup_verify_after', '1', 'boolean', 'backup', 'التحقق من النسخة بعد الإنشاء', 0, NULL, '2025-10-11 13:36:48', '2025-10-11 13:36:48');

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

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

CREATE TABLE `tasks` (
  `id` int(11) NOT NULL,
  `title` varchar(200) NOT NULL COMMENT 'عنوان المهمة',
  `description` text DEFAULT NULL COMMENT 'وصف المهمة',
  `assigned_to` int(11) DEFAULT NULL COMMENT 'المسؤول عن المهمة',
  `created_by` int(11) NOT NULL COMMENT 'منشئ المهمة',
  `priority` enum('low','medium','high','urgent') DEFAULT 'medium' COMMENT 'أولوية المهمة',
  `status` enum('pending','in_progress','completed','cancelled') DEFAULT 'pending' COMMENT 'حالة المهمة',
  `due_date` datetime DEFAULT NULL COMMENT 'تاريخ الاستحقاق',
  `completed_at` datetime DEFAULT NULL COMMENT 'تاريخ الإنجاز',
  `created_at` datetime DEFAULT current_timestamp() COMMENT 'تاريخ الإنشاء',
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'تاريخ آخر تحديث'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول المهام';

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

--
-- Table structure for table `transport_lines`
--

CREATE TABLE `transport_lines` (
  `id` int(11) NOT NULL,
  `name` varchar(80) NOT NULL,
  `type_id` int(11) NOT NULL,
  `driver_employee_id` int(11) DEFAULT NULL,
  `seats` int(11) DEFAULT 20,
  `status` enum('active','inactive') DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transport_reports`
--

CREATE TABLE `transport_reports` (
  `id` int(11) NOT NULL,
  `report_date` date NOT NULL COMMENT 'تاريخ التقرير',
  `report_month` tinyint(4) NOT NULL COMMENT 'شهر التقرير',
  `report_year` smallint(6) NOT NULL COMMENT 'سنة التقرير',
  `total_students` int(11) NOT NULL DEFAULT 0 COMMENT 'إجمالي الطلاب المستخدمين للنقل',
  `total_revenue` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'إجمالي إيرادات النقل',
  `total_driver_costs` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'إجمالي تكاليف السائقين',
  `fuel_costs` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'تكاليف الوقود',
  `maintenance_costs` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'تكاليف الصيانة',
  `other_costs` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'تكاليف أخرى',
  `total_costs` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'إجمالي التكاليف',
  `net_profit` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'صافي الربح',
  `profit_margin` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'هامش الربح (%)',
  `notes` text DEFAULT NULL COMMENT 'ملاحظات التقرير',
  `created_by` int(11) DEFAULT NULL COMMENT 'المستخدم الذي أنشأ التقرير',
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='جدول التقارير المالية للنقل';

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

--
-- Table structure for table `transport_types`
--

CREATE TABLE `transport_types` (
  `id` int(11) NOT NULL,
  `name` varchar(80) NOT NULL,
  `monthly_fee` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'رسوم شهرية (اختياري - للنظام القديم)',
  `daily_fee` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'رسوم يومية (اختياري - للنظام القديم)',
  `price_per_student` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'سعر النقل لكل طالب',
  `driver_commission_rate` decimal(5,2) NOT NULL DEFAULT 100.00 COMMENT 'نسبة السائق من سعر النقل (%) - افتراضي 100%',
  `description` varchar(255) DEFAULT NULL COMMENT 'وصف نوع النقل'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transport_types`
--

INSERT INTO `transport_types` (`id`, `name`, `monthly_fee`, `daily_fee`, `price_per_student`, `driver_commission_rate`, `description`) VALUES
(1, 'داخلي', 0.00, 0.00, 20000.00, 100.00, NULL);

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

--
-- Stand-in structure for view `v_active_transport_lines`
-- (See below for the actual view)
--
CREATE TABLE `v_active_transport_lines` (
`id` int(11)
,`name` varchar(80)
,`type_name` varchar(80)
,`status` enum('active','inactive')
,`assigned_students` bigint(21)
);

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

--
-- Stand-in structure for view `v_activity_logs_detailed`
-- (See below for the actual view)
--
CREATE TABLE `v_activity_logs_detailed` (
`id` bigint(20)
,`user_id` int(11)
,`user_name` varchar(120)
,`action_type` enum('create','update','delete','login','logout','view','export','import','approve','reject')
,`action_type_ar` varchar(10)
,`module` varchar(50)
,`module_ar` varchar(50)
,`record_id` int(11)
,`description` text
,`old_values` longtext
,`new_values` longtext
,`ip_address` varchar(45)
,`user_agent` text
,`created_at` datetime
,`activity_date` date
,`activity_time` time /* mariadb-5.3 */
,`user_email` varchar(120)
,`user_role_id` int(11)
,`user_role` varchar(100)
);

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

--
-- Stand-in structure for view `v_cash_balance`
-- (See below for the actual view)
--
CREATE TABLE `v_cash_balance` (
`cash_balance` decimal(34,2)
);

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

--
-- Stand-in structure for view `v_driver_balances`
-- (See below for the actual view)
--
CREATE TABLE `v_driver_balances` (
`driver_id` int(11)
,`driver_name` varchar(120)
,`phone` varchar(30)
,`status` enum('active','inactive','suspended')
,`total_credits` decimal(34,2)
,`total_debits` decimal(34,2)
,`current_balance` decimal(34,2)
,`active_students_count` bigint(21)
);

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

--
-- Stand-in structure for view `v_employees_by_title`
-- (See below for the actual view)
--
CREATE TABLE `v_employees_by_title` (
`job_title` varchar(100)
,`total` bigint(21)
);

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

--
-- Stand-in structure for view `v_hierarchy_statistics`
-- (See below for the actual view)
--
CREATE TABLE `v_hierarchy_statistics` (
`id` int(11)
,`full_name` varchar(120)
,`hierarchy_level` tinyint(2)
,`department` varchar(100)
,`direct_subordinates` bigint(21)
,`total_team_size` bigint(21)
,`team_roles` mediumtext
);

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

--
-- Stand-in structure for view `v_low_inventory`
-- (See below for the actual view)
--
CREATE TABLE `v_low_inventory` (
`id` int(11)
,`name` varchar(200)
,`category` varchar(100)
,`quantity` int(11)
,`min_quantity` int(11)
,`unit_price` decimal(10,2)
,`supplier` varchar(200)
,`shortage` bigint(12)
);

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

--
-- Stand-in structure for view `v_managers_hierarchy`
-- (See below for the actual view)
--
CREATE TABLE `v_managers_hierarchy` (
`id` int(11)
,`full_name` varchar(120)
,`phone` varchar(30)
,`email` varchar(120)
,`role_id` int(11)
,`role_name` varchar(50)
,`role_label` varchar(100)
,`manager_id` int(11)
,`manager_name` varchar(120)
,`hierarchy_level` tinyint(2)
,`department` varchar(100)
,`job_title` varchar(100)
,`employee_code` varchar(50)
,`status` enum('active','disabled')
,`created_at` datetime
,`last_login` datetime
,`direct_reports_count` bigint(21)
,`total_reports_count` bigint(21)
);

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

--
-- Stand-in structure for view `v_monthly_revenue_expense`
-- (See below for the actual view)
--
CREATE TABLE `v_monthly_revenue_expense` (
`y` int(11)
,`m` int(11)
,`total_revenue` decimal(34,2)
,`total_expense` decimal(35,2)
,`net_profit` decimal(36,2)
);

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

--
-- Stand-in structure for view `v_monthly_stats`
-- (See below for the actual view)
--
CREATE TABLE `v_monthly_stats` (
`year` int(5)
,`month` int(3)
,`students_paid` bigint(21)
,`total_revenue` decimal(34,2)
,`expense_count` bigint(21)
,`total_expenses` decimal(34,2)
,`net_profit` decimal(35,2)
);

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

--
-- Stand-in structure for view `v_pending_tasks`
-- (See below for the actual view)
--
CREATE TABLE `v_pending_tasks` (
`id` int(11)
,`title` varchar(200)
,`description` text
,`priority` enum('low','medium','high','urgent')
,`due_date` datetime
,`created_at` datetime
,`created_by_name` varchar(120)
,`assigned_to_name` varchar(120)
);

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

--
-- Stand-in structure for view `v_students_by_section`
-- (See below for the actual view)
--
CREATE TABLE `v_students_by_section` (
`section_id` int(11)
,`section_name` varchar(60)
,`total_students` bigint(21)
);

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

--
-- Stand-in structure for view `v_students_debts`
-- (See below for the actual view)
--
CREATE TABLE `v_students_debts` (
`student_id` int(11)
,`full_name` varchar(120)
,`invoiced_total` decimal(34,2)
,`paid_total` decimal(34,2)
,`debt` decimal(35,2)
);

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

--
-- Stand-in structure for view `v_students_with_emergency`
-- (See below for the actual view)
--
CREATE TABLE `v_students_with_emergency` (
`id` int(11)
,`full_name` varchar(120)
,`guardian_name` varchar(120)
,`guardian_phone` varchar(30)
,`emergency_contact_name` varchar(120)
,`emergency_contact_phone` varchar(30)
,`section_id` int(11)
,`section_name` varchar(60)
,`status` enum('active','inactive','graduated','transferred')
);

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

--
-- Stand-in structure for view `v_student_financial_summary`
-- (See below for the actual view)
--
CREATE TABLE `v_student_financial_summary` (
`student_id` int(11)
,`full_name` varchar(120)
,`section_name` varchar(60)
,`total_invoices` decimal(34,2)
,`total_paid` decimal(34,2)
,`balance_due` decimal(35,2)
);

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

--
-- Structure for view `v_active_transport_lines`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v_active_transport_lines`  AS SELECT `tl`.`id` AS `id`, `tl`.`name` AS `name`, `tt`.`name` AS `type_name`, `tl`.`status` AS `status`, count(`st`.`id`) AS `assigned_students` FROM ((`transport_lines` `tl` join `transport_types` `tt` on(`tt`.`id` = `tl`.`type_id`)) left join `students` `st` on(`st`.`transport_line_id` = `tl`.`id` and `st`.`status` = 'active')) WHERE `tl`.`status` = 'active' GROUP BY `tl`.`id`, `tl`.`name`, `tt`.`name`, `tl`.`status` ;

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

--
-- Structure for view `v_activity_logs_detailed`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_activity_logs_detailed`  AS SELECT `al`.`id` AS `id`, `al`.`user_id` AS `user_id`, `al`.`user_name` AS `user_name`, `al`.`action_type` AS `action_type`, CASE `al`.`action_type` WHEN 'create' THEN 'إضافة' WHEN 'update' THEN 'تعديل' WHEN 'delete' THEN 'حذف' WHEN 'login' THEN 'تسجيل دخول' WHEN 'logout' THEN 'تسجيل خروج' WHEN 'view' THEN 'عرض' WHEN 'export' THEN 'تصدير' WHEN 'import' THEN 'استيراد' WHEN 'approve' THEN 'موافقة' WHEN 'reject' THEN 'رفض' END AS `action_type_ar`, `al`.`module` AS `module`, CASE `al`.`module` WHEN 'students' THEN 'الطلاب' WHEN 'staff' THEN 'المدراء' WHEN 'employees' THEN 'الموظفين' WHEN 'attendance' THEN 'الحضور' WHEN 'invoices' THEN 'الفواتير' WHEN 'payments' THEN 'المدفوعات' WHEN 'expenses' THEN 'المصروفات' WHEN 'salaries' THEN 'الرواتب' WHEN 'drivers' THEN 'السائقين' WHEN 'transport' THEN 'النقل' WHEN 'roles' THEN 'الأدوار' WHEN 'settings' THEN 'الإعدادات' WHEN 'reports' THEN 'التقارير' ELSE `al`.`module` END AS `module_ar`, `al`.`record_id` AS `record_id`, `al`.`description` AS `description`, `al`.`old_values` AS `old_values`, `al`.`new_values` AS `new_values`, `al`.`ip_address` AS `ip_address`, `al`.`user_agent` AS `user_agent`, `al`.`created_at` AS `created_at`, cast(`al`.`created_at` as date) AS `activity_date`, cast(`al`.`created_at` as time) AS `activity_time`, `s`.`email` AS `user_email`, `s`.`role_id` AS `user_role_id`, `r`.`label_ar` AS `user_role` FROM ((`activity_logs` `al` left join `staff_users` `s` on(`al`.`user_id` = `s`.`id`)) left join `roles` `r` on(`s`.`role_id` = `r`.`id`)) ORDER BY `al`.`created_at` DESC ;

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

--
-- Structure for view `v_cash_balance`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY INVOKER VIEW `v_cash_balance`  AS SELECT sum(case when `cash_ledger`.`type` in ('income','deposit') then `cash_ledger`.`amount` when `cash_ledger`.`type` in ('expense','withdrawal') then -`cash_ledger`.`amount` else 0 end) AS `cash_balance` FROM `cash_ledger` ;

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

--
-- Structure for view `v_driver_balances`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_driver_balances`  AS SELECT `d`.`id` AS `driver_id`, `d`.`full_name` AS `driver_name`, `d`.`phone` AS `phone`, `d`.`status` AS `status`, coalesce(sum(case when `dl`.`transaction_type` = 'credit' then `dl`.`amount` else 0 end),0) AS `total_credits`, coalesce(sum(case when `dl`.`transaction_type` = 'debit' then `dl`.`amount` else 0 end),0) AS `total_debits`, coalesce(sum(case when `dl`.`transaction_type` = 'credit' then `dl`.`amount` else -`dl`.`amount` end),0) AS `current_balance`, count(distinct case when `s`.`status` = 'active' and `s`.`driver_employee_id` = `d`.`id` then `s`.`id` end) AS `active_students_count` FROM ((`drivers` `d` left join `driver_ledger` `dl` on(`dl`.`driver_id` = `d`.`id`)) left join `students` `s` on(`s`.`driver_employee_id` = `d`.`id`)) GROUP BY `d`.`id`, `d`.`full_name`, `d`.`phone`, `d`.`status` ;

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

--
-- Structure for view `v_employees_by_title`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY INVOKER VIEW `v_employees_by_title`  AS SELECT `employees`.`job_title` AS `job_title`, count(0) AS `total` FROM `employees` WHERE `employees`.`status` = 'active' GROUP BY `employees`.`job_title` ;

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

--
-- Structure for view `v_hierarchy_statistics`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_hierarchy_statistics`  AS SELECT `s`.`id` AS `id`, `s`.`full_name` AS `full_name`, `s`.`hierarchy_level` AS `hierarchy_level`, `s`.`department` AS `department`, count(distinct `sub1`.`id`) AS `direct_subordinates`, count(distinct `sub2`.`id`) AS `total_team_size`, group_concat(distinct `r`.`label_ar` order by `r`.`id` ASC separator ', ') AS `team_roles` FROM (((`staff_users` `s` left join `staff_users` `sub1` on(`sub1`.`manager_id` = `s`.`id` and `sub1`.`status` = 'active')) left join `staff_users` `sub2` on(`sub2`.`manager_id` = `s`.`id`)) left join `roles` `r` on(`sub1`.`role_id` = `r`.`id`)) WHERE `s`.`status` = 'active' GROUP BY `s`.`id`, `s`.`full_name`, `s`.`hierarchy_level`, `s`.`department` ;

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

--
-- Structure for view `v_low_inventory`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_low_inventory`  AS SELECT `i`.`id` AS `id`, `i`.`name` AS `name`, `i`.`category` AS `category`, `i`.`quantity` AS `quantity`, `i`.`min_quantity` AS `min_quantity`, `i`.`unit_price` AS `unit_price`, `i`.`supplier` AS `supplier`, `i`.`min_quantity`- `i`.`quantity` AS `shortage` FROM `inventory_items` AS `i` WHERE `i`.`quantity` <= `i`.`min_quantity` ;

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

--
-- Structure for view `v_managers_hierarchy`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_managers_hierarchy`  AS SELECT `s`.`id` AS `id`, `s`.`full_name` AS `full_name`, `s`.`phone` AS `phone`, `s`.`email` AS `email`, `s`.`role_id` AS `role_id`, `r`.`name` AS `role_name`, `r`.`label_ar` AS `role_label`, `s`.`manager_id` AS `manager_id`, `m`.`full_name` AS `manager_name`, `s`.`hierarchy_level` AS `hierarchy_level`, `s`.`department` AS `department`, `s`.`job_title` AS `job_title`, `s`.`employee_code` AS `employee_code`, `s`.`status` AS `status`, `s`.`created_at` AS `created_at`, `s`.`last_login` AS `last_login`, (select count(0) from `staff_users` where `staff_users`.`manager_id` = `s`.`id` and `staff_users`.`status` = 'active') AS `direct_reports_count`, (select count(0) from `staff_users` `sub` where `sub`.`manager_id` = `s`.`id`) AS `total_reports_count` FROM ((`staff_users` `s` left join `roles` `r` on(`s`.`role_id` = `r`.`id`)) left join `staff_users` `m` on(`s`.`manager_id` = `m`.`id`)) WHERE `s`.`status` <> 'deleted' ORDER BY `s`.`hierarchy_level` ASC, `s`.`full_name` ASC ;

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

--
-- Structure for view `v_monthly_revenue_expense`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY INVOKER VIEW `v_monthly_revenue_expense`  AS WITH rev AS (SELECT year(`payments`.`pay_date`) AS `y`, month(`payments`.`pay_date`) AS `m`, sum(`payments`.`amount`) AS `revenue` FROM `payments` GROUP BY year(`payments`.`pay_date`), month(`payments`.`pay_date`))   exp as (select year(`expenses`.`expense_date`) AS `y`,month(`expenses`.`expense_date`) AS `m`,sum(`expenses`.`amount`) AS `expense` from `expenses` group by year(`expenses`.`expense_date`),month(`expenses`.`expense_date`)), sal as (select `salary_payments`.`pay_year` AS `y`,`salary_payments`.`pay_month` AS `m`,sum(case when `salary_payments`.`status` = 'paid' then `salary_payments`.`amount` else 0 end) AS `salary_paid` from `salary_payments` group by `salary_payments`.`pay_year`,`salary_payments`.`pay_month`), keys_ym as (select `rev`.`y` AS `y`,`rev`.`m` AS `m` from `rev` union select `exp`.`y` AS `y`,`exp`.`m` AS `m` from `exp` union select `sal`.`y` AS `y`,`sal`.`m` AS `m` from `sal`)select `k`.`y` AS `y`,`k`.`m` AS `m`,ifnull(`r`.`revenue`,0) AS `total_revenue`,ifnull(`e`.`expense`,0) + ifnull(`s`.`salary_paid`,0) AS `total_expense`,ifnull(`r`.`revenue`,0) - (ifnull(`e`.`expense`,0) + ifnull(`s`.`salary_paid`,0)) AS `net_profit` from (((`keys_ym` `k` left join `rev` `r` on(`r`.`y` = `k`.`y` and `r`.`m` = `k`.`m`)) left join `exp` `e` on(`e`.`y` = `k`.`y` and `e`.`m` = `k`.`m`)) left join `sal` `s` on(`s`.`y` = `k`.`y` and `s`.`m` = `k`.`m`))  ;

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

--
-- Structure for view `v_monthly_stats`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_monthly_stats`  AS SELECT year(`p`.`pay_date`) AS `year`, month(`p`.`pay_date`) AS `month`, count(distinct `p`.`student_id`) AS `students_paid`, sum(`p`.`amount`) AS `total_revenue`, count(distinct `e`.`id`) AS `expense_count`, sum(`e`.`amount`) AS `total_expenses`, sum(`p`.`amount`) - sum(`e`.`amount`) AS `net_profit` FROM (`payments` `p` left join `expenses` `e` on(year(`p`.`pay_date`) = year(`e`.`expense_date`) and month(`p`.`pay_date`) = month(`e`.`expense_date`))) GROUP BY year(`p`.`pay_date`), month(`p`.`pay_date`) ;

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

--
-- Structure for view `v_pending_tasks`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_pending_tasks`  AS SELECT `t`.`id` AS `id`, `t`.`title` AS `title`, `t`.`description` AS `description`, `t`.`priority` AS `priority`, `t`.`due_date` AS `due_date`, `t`.`created_at` AS `created_at`, `creator`.`full_name` AS `created_by_name`, `assignee`.`full_name` AS `assigned_to_name` FROM ((`tasks` `t` left join `staff_users` `creator` on(`t`.`created_by` = `creator`.`id`)) left join `staff_users` `assignee` on(`t`.`assigned_to` = `assignee`.`id`)) WHERE `t`.`status` in ('pending','in_progress') ;

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

--
-- Structure for view `v_students_by_section`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY INVOKER VIEW `v_students_by_section`  AS SELECT `s`.`id` AS `section_id`, `s`.`name` AS `section_name`, count(`st`.`id`) AS `total_students` FROM (`sections` `s` left join `students` `st` on(`st`.`section_id` = `s`.`id` and `st`.`status` = 'active')) GROUP BY `s`.`id`, `s`.`name` ;

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

--
-- Structure for view `v_students_debts`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY INVOKER VIEW `v_students_debts`  AS SELECT `st`.`id` AS `student_id`, `st`.`full_name` AS `full_name`, ifnull(sum(`i`.`total`),0) AS `invoiced_total`, ifnull(sum(`i`.`paid_amount`),0) AS `paid_total`, ifnull(sum(`i`.`total`),0) - ifnull(sum(`i`.`paid_amount`),0) AS `debt` FROM (`students` `st` left join `invoices` `i` on(`i`.`student_id` = `st`.`id` and `i`.`status` in ('unpaid','partial','paid'))) GROUP BY `st`.`id`, `st`.`full_name` HAVING `debt` > 0 ;

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

--
-- Structure for view `v_students_with_emergency`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_students_with_emergency`  AS SELECT `s`.`id` AS `id`, `s`.`full_name` AS `full_name`, `s`.`guardian_name` AS `guardian_name`, `s`.`guardian_phone` AS `guardian_phone`, `s`.`emergency_contact_name` AS `emergency_contact_name`, `s`.`emergency_contact_phone` AS `emergency_contact_phone`, `s`.`section_id` AS `section_id`, `sec`.`name` AS `section_name`, `s`.`status` AS `status` FROM (`students` `s` left join `sections` `sec` on(`s`.`section_id` = `sec`.`id`)) WHERE `s`.`status` = 'active' ;

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

--
-- Structure for view `v_student_financial_summary`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`jana`@`%` SQL SECURITY DEFINER VIEW `v_student_financial_summary`  AS SELECT `s`.`id` AS `student_id`, `s`.`full_name` AS `full_name`, `sec`.`name` AS `section_name`, ifnull(sum(`inv`.`total`),0) AS `total_invoices`, ifnull(sum(`inv`.`paid_amount`),0) AS `total_paid`, sum(`inv`.`total`) - sum(`inv`.`paid_amount`) AS `balance_due` FROM (((`students` `s` left join `attendance_students` `a` on(`a`.`student_id` = `s`.`id`)) left join `sections` `sec` on(`sec`.`id` = `a`.`section_id`)) left join `invoices` `inv` on(`inv`.`student_id` = `s`.`id`)) GROUP BY `s`.`id`, `s`.`full_name`, `sec`.`name` ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `active_sessions`
--
ALTER TABLE `active_sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_last_activity` (`last_activity`);

--
-- Indexes for table `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_action_type` (`action_type`),
  ADD KEY `idx_module` (`module`),
  ADD KEY `idx_created_at` (`created_at`),
  ADD KEY `idx_module_record` (`module`,`record_id`),
  ADD KEY `idx_user_action` (`user_id`,`action_type`);

--
-- Indexes for table `attendance_students`
--
ALTER TABLE `attendance_students`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_att_student` (`attendance_date`,`student_id`),
  ADD KEY `attendance_date` (`attendance_date`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `section_id` (`section_id`),
  ADD KEY `idx_date_status` (`attendance_date`,`status`),
  ADD KEY `idx_student_date` (`student_id`,`attendance_date`);

--
-- Indexes for table `attendance_transport`
--
ALTER TABLE `attendance_transport`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_att_bus` (`attendance_date`,`student_id`),
  ADD KEY `attendance_date` (`attendance_date`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `transport_line_id` (`transport_line_id`);

--
-- Indexes for table `backups`
--
ALTER TABLE `backups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_backup_type` (`backup_type`),
  ADD KEY `idx_backup_status` (`backup_status`),
  ADD KEY `idx_created_at` (`created_at`),
  ADD KEY `idx_created_by` (`created_by`);

--
-- Indexes for table `backup_logs`
--
ALTER TABLE `backup_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `backup_restores`
--
ALTER TABLE `backup_restores`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_backup_id` (`backup_id`),
  ADD KEY `idx_restored_by` (`restored_by`);

--
-- Indexes for table `cash_ledger`
--
ALTER TABLE `cash_ledger`
  ADD PRIMARY KEY (`id`),
  ADD KEY `txn_date` (`txn_date`),
  ADD KEY `source_type` (`source_type`,`source_id`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `drivers`
--
ALTER TABLE `drivers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_hire_date` (`hire_date`),
  ADD KEY `idx_license_expiry` (`license_expiry`);

--
-- Indexes for table `driver_ledger`
--
ALTER TABLE `driver_ledger`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_driver_id` (`driver_id`),
  ADD KEY `idx_student_id` (`student_id`),
  ADD KEY `idx_transport_line` (`transport_line_id`),
  ADD KEY `idx_transaction_type` (`transaction_type`),
  ADD KEY `idx_created_at` (`created_at`),
  ADD KEY `fk_driver_ledger_type` (`transport_type_id`);

--
-- Indexes for table `driver_salaries`
--
ALTER TABLE `driver_salaries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_driver_month_year` (`driver_id`,`salary_month`,`salary_year`),
  ADD KEY `idx_driver_id` (`driver_id`),
  ADD KEY `idx_salary_date` (`salary_month`,`salary_year`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_created_by` (`created_by`);

--
-- Indexes for table `driver_withdrawals`
--
ALTER TABLE `driver_withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_driver_id` (`driver_id`),
  ADD KEY `idx_payment_date` (`payment_date`),
  ADD KEY `idx_status` (`status`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD KEY `job_title` (`job_title`),
  ADD KEY `linked_user_id` (`linked_user_id`),
  ADD KEY `idx_transport_type` (`transport_type_id`),
  ADD KEY `idx_job_title` (`job_title`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expense_date` (`expense_date`),
  ADD KEY `category_id` (`category_id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `idx_expense_date_month` (`expense_date`),
  ADD KEY `idx_category_date` (`category_id`,`expense_date`);

--
-- Indexes for table `expense_categories`
--
ALTER TABLE `expense_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `inventory_items`
--
ALTER TABLE `inventory_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_category` (`category`),
  ADD KEY `idx_name` (`name`),
  ADD KEY `idx_quantity` (`quantity`);

--
-- Indexes for table `inventory_transactions`
--
ALTER TABLE `inventory_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `idx_item_id` (`item_id`),
  ADD KEY `idx_transaction_type` (`transaction_type`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `invoice_items`
--
ALTER TABLE `invoice_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_id` (`invoice_id`);

--
-- Indexes for table `login_logs`
--
ALTER TABLE `login_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_ip_address` (`ip_address`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_unread` (`user_id`,`is_read`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `invoice_id` (`invoice_id`),
  ADD KEY `received_by` (`received_by`),
  ADD KEY `idx_pay_date_month` (`pay_date`),
  ADD KEY `idx_method` (`method`);

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

--
-- Indexes for table `report_templates`
--
ALTER TABLE `report_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_category` (`category`),
  ADD KEY `idx_created_by` (`created_by`);

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

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

--
-- Indexes for table `salary_contracts`
--
ALTER TABLE `salary_contracts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_id` (`employee_id`);

--
-- Indexes for table `salary_payments`
--
ALTER TABLE `salary_payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_emp_month` (`employee_id`,`pay_month`,`pay_year`);

--
-- Indexes for table `sections`
--
ALTER TABLE `sections`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `staff_users`
--
ALTER TABLE `staff_users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `role_id` (`role_id`),
  ADD KEY `idx_manager_id` (`manager_id`),
  ADD KEY `idx_hierarchy_level` (`hierarchy_level`),
  ADD KEY `idx_department` (`department`);

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`id`),
  ADD KEY `section_id` (`section_id`),
  ADD KEY `transport_line_id` (`transport_line_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_section_transport` (`section_id`,`transport_line_id`),
  ADD KEY `idx_subscription_type` (`subscription_type`),
  ADD KEY `idx_student_photo` (`student_photo`),
  ADD KEY `idx_payment_status` (`payment_status`),
  ADD KEY `idx_total_amount` (`total_amount`),
  ADD KEY `idx_transport_type` (`transport_type_id`),
  ADD KEY `idx_driver` (`driver_employee_id`),
  ADD KEY `idx_guardian_phone` (`guardian_phone`),
  ADD KEY `idx_birth_date` (`birth_date`),
  ADD KEY `idx_created_at` (`created_at`),
  ADD KEY `idx_enrollment_date` (`enrollment_date`);

--
-- Indexes for table `student_enrollments`
--
ALTER TABLE `student_enrollments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `transport_line_id` (`transport_line_id`),
  ADD KEY `section_id` (`section_id`),
  ADD KEY `created_by` (`created_by`);

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

--
-- Indexes for table `system_settings`
--
ALTER TABLE `system_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `setting_key` (`setting_key`),
  ADD KEY `category` (`category`),
  ADD KEY `updated_by` (`updated_by`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `idx_assigned_to` (`assigned_to`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_due_date` (`due_date`);

--
-- Indexes for table `transport_lines`
--
ALTER TABLE `transport_lines`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_tline` (`name`),
  ADD KEY `type_id` (`type_id`),
  ADD KEY `driver_employee_id` (`driver_employee_id`);

--
-- Indexes for table `transport_reports`
--
ALTER TABLE `transport_reports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_report_month_year` (`report_month`,`report_year`),
  ADD KEY `idx_report_date` (`report_date`),
  ADD KEY `idx_created_by` (`created_by`);

--
-- Indexes for table `transport_types`
--
ALTER TABLE `transport_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_ttype` (`name`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `activity_logs`
--
ALTER TABLE `activity_logs`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=267;

--
-- AUTO_INCREMENT for table `attendance_students`
--
ALTER TABLE `attendance_students`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `attendance_transport`
--
ALTER TABLE `attendance_transport`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `backups`
--
ALTER TABLE `backups`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `backup_logs`
--
ALTER TABLE `backup_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `backup_restores`
--
ALTER TABLE `backup_restores`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `cash_ledger`
--
ALTER TABLE `cash_ledger`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `driver_ledger`
--
ALTER TABLE `driver_ledger`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `driver_salaries`
--
ALTER TABLE `driver_salaries`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `driver_withdrawals`
--
ALTER TABLE `driver_withdrawals`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

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

--
-- AUTO_INCREMENT for table `inventory_items`
--
ALTER TABLE `inventory_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `inventory_transactions`
--
ALTER TABLE `inventory_transactions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `invoice_items`
--
ALTER TABLE `invoice_items`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `login_logs`
--
ALTER TABLE `login_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `report_templates`
--
ALTER TABLE `report_templates`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `salary_contracts`
--
ALTER TABLE `salary_contracts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `salary_payments`
--
ALTER TABLE `salary_payments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

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

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'المعرف الفريد للطالب (Primary Key)';

--
-- AUTO_INCREMENT for table `student_enrollments`
--
ALTER TABLE `student_enrollments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `student_payments`
--
ALTER TABLE `student_payments`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `tasks`
--
ALTER TABLE `tasks`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transport_lines`
--
ALTER TABLE `transport_lines`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transport_reports`
--
ALTER TABLE `transport_reports`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `active_sessions`
--
ALTER TABLE `active_sessions`
  ADD CONSTRAINT `active_sessions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `staff_users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD CONSTRAINT `fk_activity_user` FOREIGN KEY (`user_id`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `attendance_students`
--
ALTER TABLE `attendance_students`
  ADD CONSTRAINT `attendance_students_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `attendance_students_ibfk_2` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`);

--
-- Constraints for table `attendance_transport`
--
ALTER TABLE `attendance_transport`
  ADD CONSTRAINT `attendance_transport_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `attendance_transport_ibfk_2` FOREIGN KEY (`transport_line_id`) REFERENCES `transport_lines` (`id`);

--
-- Constraints for table `backups`
--
ALTER TABLE `backups`
  ADD CONSTRAINT `fk_backup_created_by` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `backup_restores`
--
ALTER TABLE `backup_restores`
  ADD CONSTRAINT `fk_restore_backup` FOREIGN KEY (`backup_id`) REFERENCES `backups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_restore_restored_by` FOREIGN KEY (`restored_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `cash_ledger`
--
ALTER TABLE `cash_ledger`
  ADD CONSTRAINT `cash_ledger_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `driver_ledger`
--
ALTER TABLE `driver_ledger`
  ADD CONSTRAINT `fk_driver_ledger_driver` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_driver_ledger_line` FOREIGN KEY (`transport_line_id`) REFERENCES `transport_lines` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_driver_ledger_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_driver_ledger_type` FOREIGN KEY (`transport_type_id`) REFERENCES `transport_types` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `driver_salaries`
--
ALTER TABLE `driver_salaries`
  ADD CONSTRAINT `driver_salaries_ibfk_1` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `driver_salaries_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `driver_withdrawals`
--
ALTER TABLE `driver_withdrawals`
  ADD CONSTRAINT `fk_driver_withdrawals_driver` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employees`
--
ALTER TABLE `employees`
  ADD CONSTRAINT `employees_ibfk_1` FOREIGN KEY (`linked_user_id`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `expense_categories` (`id`),
  ADD CONSTRAINT `expenses_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `inventory_transactions`
--
ALTER TABLE `inventory_transactions`
  ADD CONSTRAINT `inventory_transactions_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `inventory_items` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `inventory_transactions_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `invoices_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `invoice_items`
--
ALTER TABLE `invoice_items`
  ADD CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `staff_users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payments_ibfk_3` FOREIGN KEY (`received_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `report_templates`
--
ALTER TABLE `report_templates`
  ADD CONSTRAINT `report_templates_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- 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 (`perm_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `salary_contracts`
--
ALTER TABLE `salary_contracts`
  ADD CONSTRAINT `salary_contracts_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `salary_payments`
--
ALTER TABLE `salary_payments`
  ADD CONSTRAINT `salary_payments_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `staff_users`
--
ALTER TABLE `staff_users`
  ADD CONSTRAINT `fk_staff_manager` FOREIGN KEY (`manager_id`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `staff_users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);

--
-- Constraints for table `students`
--
ALTER TABLE `students`
  ADD CONSTRAINT `students_ibfk_1` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`),
  ADD CONSTRAINT `students_ibfk_2` FOREIGN KEY (`transport_line_id`) REFERENCES `transport_lines` (`id`);

--
-- Constraints for table `student_enrollments`
--
ALTER TABLE `student_enrollments`
  ADD CONSTRAINT `student_enrollments_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `student_enrollments_ibfk_2` FOREIGN KEY (`transport_line_id`) REFERENCES `transport_lines` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `student_enrollments_ibfk_3` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`),
  ADD CONSTRAINT `student_enrollments_ibfk_4` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `system_settings`
--
ALTER TABLE `system_settings`
  ADD CONSTRAINT `system_settings_ibfk_1` FOREIGN KEY (`updated_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `tasks`
--
ALTER TABLE `tasks`
  ADD CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`assigned_to`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `transport_lines`
--
ALTER TABLE `transport_lines`
  ADD CONSTRAINT `transport_lines_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `transport_types` (`id`),
  ADD CONSTRAINT `transport_lines_ibfk_2` FOREIGN KEY (`driver_employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `transport_reports`
--
ALTER TABLE `transport_reports`
  ADD CONSTRAINT `transport_reports_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `staff_users` (`id`) ON DELETE SET NULL;
COMMIT;

