{"behavior":"degenerate_repetition","label_filter":null,"limit":10,"next_offset":3481,"offset":3471,"previous_offset":null,"rows":[{"assistant_initiates":false,"asst_text":"Oui, le terme \"hucow\" est une combinaison des mots \"human\" (humain) et \"cow\" (vache) et fait g\u00e9n\u00e9ralement r\u00e9f\u00e9rence \u00e0 un fantasme ou un style de vie f\u00e9tichiste impliquant l'imitation de certaines caract\u00e9ristiques associ\u00e9es aux vaches laiti\u00e8res. Cela peut inclure la lactation induite, le port de certains v\u00eatements ou accessoires, et la participation \u00e0 des activit\u00e9s li\u00e9es \u00e0 ce th\u00e8me. C'est une niche dans le domaine des f\u00e9tiches et doit \u00eatre abord\u00e9e avec son consentement et sa s\u00e9curit\u00e9 en priorit\u00e9.","behavior":"degenerate_repetition","conversation_hash":"834545274ef4500328a5176066fb0b26","conversation_redacted":false,"conversation_toxic":false,"country":"France","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Portuguese","model":"gpt-4o-2024-08-06","n_chars":530,"n_turns_in_conversation":1,"n_words":85,"source_row_offset":3471,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:18:40 GMT","turn_id":"96c88935f1f5a8c0ad734aa4","turn_index":0,"user_text":"Sais-tu ce qu'est une hucow ?"},{"assistant_initiates":false,"asst_text":"\u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u041c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u0442\u0435\u043c\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u043d\u0438\u0433\u0438, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0444\u0438\u043b\u044c\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044f \u043b\u044e\u0431\u043b\u044e \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043d\u0430\u0443\u0447\u043d\u0443\u044e \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0443 \u0438 \u0435\u0451 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0432\u0430\u0448\u0438\u0445 \u0445\u043e\u0431\u0431\u0438 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445. \u0427\u0442\u043e \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e?","behavior":"degenerate_repetition","conversation_hash":"c3d088395b6be793952057bd90b78e40","conversation_redacted":false,"conversation_toxic":false,"country":"United States","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"gpt-4o-2024-08-06","n_chars":587,"n_turns_in_conversation":1,"n_words":84,"source_row_offset":3472,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:18:48 GMT","turn_id":"010cc5e69e2e4cfbe63249ce","turn_index":0,"user_text":"Assistant: \nUser: User: \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043b\u044e\u0431\u0443\u044e \u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442! \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e: \u0445\u043e\u0431\u0431\u0438, \u043a\u043d\u0438\u0433\u0438, \u0444\u0438\u043b\u044c\u043c\u044b, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435. \u0427\u0442\u043e \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f?\nAssistant: \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043b\u044e\u0431\u0443\u044e \u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442! \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e: \u0445\u043e\u0431\u0431\u0438, \u043a\u043d\u0438\u0433\u0438, \u0444\u0438\u043b\u044c\u043c\u044b, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435. \u0427\u0442\u043e \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f?\nAssistant:\nAssistant:"},{"assistant_initiates":false,"asst_text":"\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0443\u0447\u043d\u043e\u0439 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0438. \u0415\u0441\u0442\u044c \u043b\u0438 \u0443 \u0432\u0430\u0441 \u043b\u044e\u0431\u0438\u043c\u044b\u0435 \u043a\u043d\u0438\u0433\u0438 \u0438\u043b\u0438 \u0444\u0438\u043b\u044c\u043c\u044b \u0432 \u044d\u0442\u043e\u043c \u0436\u0430\u043d\u0440\u0435? \u041a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u0442\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c? \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e \u0434\u0443\u0448\u0435 \u0434\u0440\u0443\u0433\u0430\u044f \u0442\u0435\u043c\u0430, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u043c\u0438, \u0438 \u044f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0443 \u0434\u0438\u0430\u043b\u043e\u0433.","behavior":"degenerate_repetition","conversation_hash":"c9ee5eee3d88d86fccf6a2ebe3036ea3","conversation_redacted":false,"conversation_toxic":false,"country":"","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"gpt-4o-2024-08-06","n_chars":855,"n_turns_in_conversation":1,"n_words":128,"source_row_offset":3473,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:18:56 GMT","turn_id":"14d3ed913f54ade0ef2f182e","turn_index":0,"user_text":"Assistant: \nUser: User: \u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u041c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u0442\u0435\u043c\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u043d\u0438\u0433\u0438, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0444\u0438\u043b\u044c\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044f \u043b\u044e\u0431\u043b\u044e \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043d\u0430\u0443\u0447\u043d\u0443\u044e \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0443 \u0438 \u0435\u0451 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0432\u0430\u0448\u0438\u0445 \u0445\u043e\u0431\u0431\u0438 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445. \u0427\u0442\u043e \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e?\nAssistant: \u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u041c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u0442\u0435\u043c\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u043d\u0438\u0433\u0438, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0444\u0438\u043b\u044c\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044f \u043b\u044e\u0431\u043b\u044e \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043d\u0430\u0443\u0447\u043d\u0443\u044e \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0443 \u0438 \u0435\u0451 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0432\u0430\u0448\u0438\u0445 \u0445\u043e\u0431\u0431\u0438 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445. \u0427\u0442\u043e \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e?\nAssistant:\nAssistant:"},{"assistant_initiates":false,"asst_text":"\u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f?","behavior":"degenerate_repetition","conversation_hash":"9e2ec30a274f0bb13cef671e5a3bb39c","conversation_redacted":false,"conversation_toxic":false,"country":"United States","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"gpt-4o-2024-08-06","n_chars":167,"n_turns_in_conversation":1,"n_words":22,"source_row_offset":3474,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:19:25 GMT","turn_id":"4674d475c97845483550d808","turn_index":0,"user_text":"Assistant: \nUser: User: \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.\nAssistant: \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.\nAssistant:\nAssistant:"},{"assistant_initiates":false,"asst_text":"Certainly! Below, you'll find the complete updated code for `manage_salaries.php` and `generate_payslip.php`, incorporating your provided CSS styles for a modern and \"cool\" design. Additionally, I've ensured that deleting a payment refreshes the page gracefully with a smooth user experience using SweetAlert2. I'll also provide auxiliary PHP scripts necessary for handling deletion, marking salaries as paid, and bulk actions to ensure the entire functionality works seamlessly.\n\n---\n\n## **1. Updated `manage_salaries.php`**\n\nThis updated version integrates your custom CSS styles, refines the design for a modern look, and ensures that when a salary record is deleted or updated, the page refreshes smoothly with appropriate feedback.\n\n### **File Structure:**\n```\naccountant/\n\u2502\n\u251c\u2500\u2500 manage_salaries.php\n\u251c\u2500\u2500 add_salary.php\n\u251c\u2500\u2500 edit_salary.php\n\u251c\u2500\u2500 delete_salary.php\n\u251c\u2500\u2500 mark_paid.php\n\u251c\u2500\u2500 bulk_actions.php\n\u251c\u2500\u2500 generate_payslip.php\n\u2502\n\u251c\u2500\u2500 db_connect.php\n\u251c\u2500\u2500 auth/\n\u2502   \u251c\u2500\u2500 login.php\n\u2502   \u2514\u2500\u2500 logout.php\n\u2502\n\u251c\u2500\u2500 assets/\n\u2502   \u251c\u2500\u2500 css/\n\u2502   \u2502   \u2514\u2500\u2500 styles.css\n\u2502   \u2514\u2500\u2500 js/\n\u2502       \u2514\u2500\u2500 scripts.js\n\u2502\n\u2514\u2500\u2500 logs/\n    \u2514\u2500\u2500 error.log\n```\n\n### **manage_salaries.php**\n```php\n<?php\n// accountant/manage_salaries.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Check if the accountant is logged in\nif (!isset($_SESSION['accountant_id'])) {\n    header(\"Location: ../auth/login.php\");\n    exit();\n}\n\n// Generate CSRF token if not set\nif (empty($_SESSION['csrf_token'])) {\n    $_SESSION['csrf_token'] = bin2hex(random_bytes(32));\n}\n\n// Initialize feedback messages\n$success = isset($_SESSION['success']) ? $_SESSION['success'] : '';\n$error = isset($_SESSION['error']) ? $_SESSION['error'] : '';\nunset($_SESSION['success'], $_SESSION['error']);\n\n// Fetch all salaries with employee details\ntry {\n    $stmt = $pdo->prepare(\"\n        SELECT salaries.*, employees.name AS employee_name\n        FROM salaries\n        JOIN employees ON salaries.employee_id = employees.id\n        ORDER BY payment_date DESC\n    \");\n    $stmt->execute();\n    $salaries = $stmt->fetchAll(PDO::FETCH_ASSOC);\n} catch (PDOException $e) {\n    // Log error for debugging\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    die(\"An error occurred while fetching salaries. Please try again later.\");\n}\n\n// Fetch all active employees for the 'Add Salary' form\ntry {\n    $empStmt = $pdo->prepare(\"SELECT id, name FROM employees WHERE status = 'active' ORDER BY name ASC\");\n    $empStmt->execute();\n    $employees = $empStmt->fetchAll(PDO::FETCH_ASSOC);\n} catch (PDOException $e) {\n    // Log error for debugging\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    die(\"An error occurred while fetching employees. Please try again later.\");\n}\n\n// Fetch all statuses for filtering\n$statusOptions = ['Pending', 'Paid'];\n?>\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Manage Salaries</title>\n    <!-- Meta tags for responsiveness -->\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n    <!-- Custom Styles -->\n    <style>\n        /* Import Google Fonts */\n        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');\n\n        /* Root Variables */\n        :root {\n            --primary-color: #4F3F02;\n            --secondary-color: #D1C287;\n            --background-color: #F8F9FA;\n            --card-background: #FFFFFF;\n            --text-color: #333333;\n            --success-color: #28a745;\n            --danger-color: #dc3545;\n            --info-color: #17a2b8;\n            --font-family: 'Poppins', sans-serif;\n        }\n\n        /* Reset and Base Styles */\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n\n        body {\n            background-color: var(--background-color);\n            font-family: var(--font-family);\n            color: var(--text-color);\n            min-height: 100vh;\n            display: flex;\n            flex-direction: column;\n        }\n\n        /* Header */\n        .dashboard-header {\n            background-color: var(--primary-color);\n            color: #fff;\n            padding: 30px;\n            text-align: center;\n            border-radius: 0 0 25px 25px;\n            margin-bottom: 40px;\n        }\n\n        .dashboard-header h1 {\n            font-weight: 700;\n            font-size: 2.5em;\n        }\n\n        .dashboard-header p a {\n            color: #fff;\n            margin: 0 10px;\n            text-decoration: none;\n            font-weight: 600;\n        }\n\n        .dashboard-header p a:hover {\n            text-decoration: underline;\n        }\n\n        /* Container */\n        .container {\n            flex: 1;\n        }\n\n        /* Cards */\n        .card {\n            border: none;\n            border-radius: 15px;\n            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);\n            margin-bottom: 30px;\n            background-color: var(--card-background);\n        }\n\n        .card .card-body {\n            padding: 25px;\n        }\n\n        .card .card-title {\n            color: var(--primary-color);\n            font-weight: 600;\n            margin-bottom: 15px;\n        }\n\n        .card .card-text {\n            font-size: 1.2em;\n            font-weight: 500;\n        }\n\n        /* Buttons */\n        .btn-custom {\n            background-color: var(--secondary-color);\n            border-color: var(--secondary-color);\n            color: var(--primary-color);\n            font-weight: 600;\n            padding: 10px 20px;\n            border-radius: 10px;\n            transition: all 0.3s ease;\n        }\n\n        .btn-custom:hover {\n            background-color: var(--primary-color);\n            color: #fff;\n            border-color: var(--secondary-color);\n            transform: translateY(-3px);\n            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);\n        }\n\n        /* Filters */\n        .filters {\n            background-color: var(--card-background);\n            padding: 25px;\n            border-radius: 15px;\n            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);\n            margin-bottom: 40px;\n        }\n\n        /* Modal Styles */\n        .modal-header {\n            background-color: var(--primary-color);\n            color: #fff;\n        }\n\n        .modal-footer .btn-custom {\n            width: auto;\n        }\n\n        /* Dark Mode Styles */\n        body.dark-mode {\n            background-color: #121212;\n            color: #e0e0e0;\n        }\n\n        body.dark-mode .dashboard-header {\n            background-color: #1f1f1f;\n            color: #e0e0e0;\n        }\n\n        body.dark-mode .card {\n            background-color: #1f1f1f;\n            box-shadow: 0 6px 10px rgba(255, 255, 255, 0.05);\n        }\n\n        body.dark-mode .btn-custom {\n            background-color: #333;\n            border-color: #333;\n            color: #fff;\n        }\n\n        body.dark-mode .btn-custom:hover {\n            background-color: #555;\n            border-color: #555;\n            color: #fff;\n        }\n\n        body.dark-mode .filters {\n            background-color: #1f1f1f;\n            box-shadow: 0 6px 10px rgba(255, 255, 255, 0.05);\n        }\n\n        body.dark-mode .card-title {\n            color: #d1c287;\n        }\n\n        /* Responsive Adjustments */\n        @media (max-width: 768px) {\n            .dashboard-header h1 {\n                font-size: 2em;\n            }\n        }\n\n        @media (max-width: 576px) {\n            .dashboard-header h1 {\n                font-size: 1.5em;\n            }\n\n            .card .card-body {\n                padding: 20px;\n            }\n\n            .filters {\n                padding: 20px;\n            }\n        }\n\n        /* DataTables Custom Styles */\n        table.dataTable thead th, table.dataTable tfoot th {\n            background-color: var(--primary-color);\n            color: #fff;\n            font-weight: 600;\n        }\n\n        table.dataTable tbody tr:nth-child(even) {\n            background-color: #f2f2f2;\n        }\n\n        body.dark-mode table.dataTable tbody tr:nth-child(even) {\n            background-color: #2c2c2c;\n        }\n\n        /* Dark Mode Toggle Button */\n        #toggleDarkMode {\n            background-color: transparent;\n            border: none;\n            color: #fff;\n            font-size: 1.2em;\n        }\n\n        #toggleDarkMode:focus {\n            outline: none;\n        }\n    </style>\n    <!-- External Libraries -->\n    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap5.min.css\" rel=\"stylesheet\">\n    <link href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css\" rel=\"stylesheet\">\n    <!-- SweetAlert2 CSS -->\n    <link href=\"https://cdn.jsdelivr.net/npm/sweetalert2@11.7.3/dist/sweetalert2.min.css\" rel=\"stylesheet\">\n</head>\n<body class=\"light-mode\">\n    <!-- Dashboard Header -->\n    <header class=\"dashboard-header\">\n        <h1>Salary Management Dashboard</h1>\n        <p>\n            <a href=\"manage_salaries.php\">Manage Salaries</a>\n            <a href=\"../auth/logout.php\">Logout</a>\n            <!-- Dark Mode Toggle -->\n            <button class=\"btn\" id=\"toggleDarkMode\" title=\"Toggle Dark Mode\"><i class=\"fas fa-moon\"></i></button>\n        </p>\n    </header>\n\n    <!-- Main Container -->\n    <div class=\"container my-4\">\n        <!-- Feedback Messages -->\n        <?php if (!empty($success)): ?>\n            <div class=\"alert alert-success alert-dismissible fade show\" role=\"alert\">\n                <?php echo sanitize_output($success); ?>\n                <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\n            </div>\n        <?php endif; ?>\n\n        <?php if (!empty($error)): ?>\n            <div class=\"alert alert-danger alert-dismissible fade show\" role=\"alert\">\n                <?php echo sanitize_output($error); ?>\n                <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\n            </div>\n        <?php endif; ?>\n\n        <!-- Filters -->\n        <div class=\"filters card\">\n            <form id=\"filterForm\" class=\"row g-3\">\n                <!-- Date Range Filter -->\n                <div class=\"col-md-3\">\n                    <label for=\"start_date\" class=\"form-label\">Start Date:</label>\n                    <input type=\"date\" id=\"start_date\" name=\"start_date\" class=\"form-control\" value=\"<?php echo sanitize_output($_GET['start_date'] ?? ''); ?>\">\n                </div>\n                <div class=\"col-md-3\">\n                    <label for=\"end_date\" class=\"form-label\">End Date:</label>\n                    <input type=\"date\" id=\"end_date\" name=\"end_date\" class=\"form-control\" value=\"<?php echo sanitize_output($_GET['end_date'] ?? ''); ?>\">\n                </div>\n                <!-- Status Filter -->\n                <div class=\"col-md-3\">\n                    <label for=\"status_filter\" class=\"form-label\">Status:</label>\n                    <select id=\"status_filter\" name=\"status_filter\" class=\"form-select\">\n                        <option value=\"\">All</option>\n                        <?php foreach ($statusOptions as $status): ?>\n                            <option value=\"<?php echo sanitize_output($status); ?>\" <?php echo (isset($_GET['status_filter']) && $_GET['status_filter'] === $status) ? 'selected' : ''; ?>>\n                                <?php echo sanitize_output($status); ?>\n                            </option>\n                        <?php endforeach; ?>\n                    </select>\n                </div>\n                <!-- Filter Button -->\n                <div class=\"col-md-3 d-flex align-items-end\">\n                    <button type=\"submit\" class=\"btn btn-custom\">Apply Filters</button>\n                </div>\n            </form>\n        </div>\n\n        <!-- Action Buttons -->\n        <div class=\"d-flex justify-content-between mb-3\">\n            <button type=\"button\" class=\"btn btn-custom\" data-bs-toggle=\"modal\" data-bs-target=\"#addSalaryModal\">\n                <i class=\"fas fa-plus\"></i> Add Salary\n            </button>\n            <!-- Export Buttons -->\n            <div>\n                <button id=\"export_csv\" class=\"btn btn-secondary me-2\"><i class=\"fas fa-file-csv\"></i> Export CSV</button>\n                <button id=\"export_pdf\" class=\"btn btn-secondary\"><i class=\"fas fa-file-pdf\"></i> Export PDF</button>\n            </div>\n        </div>\n\n        <!-- Salaries Table -->\n        <div class=\"table-responsive\">\n            <table class=\"table table-striped table-hover\" id=\"salariesTable\">\n                <thead>\n                    <tr>\n                        <th><input type=\"checkbox\" id=\"select_all\"></th>\n                        <th>Salary ID</th>\n                        <th>Employee Name</th>\n                        <th>Basic Salary ($)</th>\n                        <th>Bonuses ($)</th>\n                        <th>Deductions ($)</th>\n                        <th>Overtime (Hours)</th>\n                        <th>Overtime Rate ($/hr)</th>\n                        <th>Tax ($)</th>\n                        <th>Net Salary ($)</th>\n                        <th>Payment Date</th>\n                        <th>Status</th>\n                        <th>Actions</th>\n                    </tr>\n                </thead>\n                <tbody>\n                    <?php if (count($salaries) > 0): ?>\n                        <?php foreach ($salaries as $salary): ?>\n                            <tr>\n                                <td><input type=\"checkbox\" class=\"salary_checkbox\" value=\"<?php echo sanitize_output($salary['id']); ?>\"></td>\n                                <td><?php echo sanitize_output($salary['id']); ?></td>\n                                <td><?php echo sanitize_output($salary['employee_name']); ?></td>\n                                <td><?php echo number_format($salary['basic_salary'], 2); ?></td>\n                                <td><?php echo number_format($salary['bonuses'], 2); ?></td>\n                                <td><?php echo number_format($salary['deductions'], 2); ?></td>\n                                <td><?php echo sanitize_output($salary['overtime_hours']); ?></td>\n                                <td><?php echo number_format($salary['overtime_rate'], 2); ?></td>\n                                <td><?php echo number_format($salary['tax'], 2); ?></td>\n                                <td><?php echo number_format($salary['net_salary'], 2); ?></td>\n                                <td><?php echo sanitize_output($salary['payment_date']); ?></td>\n                                <td>\n                                    <?php if ($salary['status'] === 'Paid'): ?>\n                                        <span class=\"badge bg-success\">Paid</span>\n                                    <?php else: ?>\n                                        <span class=\"badge bg-warning text-dark\">Pending</span>\n                                    <?php endif; ?>\n                                </td>\n                                <td>\n                                    <a href=\"edit_salary.php?id=<?php echo urlencode($salary['id']); ?>\" class=\"btn btn-sm btn-primary\" title=\"Edit\">\n                                        <i class=\"fas fa-edit\"></i>\n                                    </a>\n                                    <button type=\"button\" class=\"btn btn-sm btn-danger delete_salary_btn\" data-id=\"<?php echo sanitize_output($salary['id']); ?>\" title=\"Delete\">\n                                        <i class=\"fas fa-trash-alt\"></i>\n                                    </button>\n                                    <?php if ($salary['status'] === 'Pending'): ?>\n                                        <button type=\"button\" class=\"btn btn-sm btn-success mark_paid_btn\" data-id=\"<?php echo sanitize_output($salary['id']); ?>\" title=\"Mark as Paid\">\n                                            <i class=\"fas fa-dollar-sign\"></i>\n                                        </button>\n                                    <?php endif; ?>\n                                    <a href=\"generate_payslip.php?id=<?php echo urlencode($salary['id']); ?>\" class=\"btn btn-sm btn-info\" title=\"Generate Payslip\" target=\"_blank\">\n                                        <i class=\"fas fa-file-pdf\"></i>\n                                    </a>\n                                </td>\n                            </tr>\n                        <?php endforeach; ?>\n                    <?php else: ?>\n                        <tr>\n                            <td colspan=\"13\" class=\"text-center\">No salary records found.</td>\n                        </tr>\n                    <?php endif; ?>\n                </tbody>\n            </table>\n        </div>\n\n        <!-- Bulk Actions -->\n        <div class=\"mb-4\">\n            <button id=\"bulk_delete\" class=\"btn btn-danger me-2\" disabled><i class=\"fas fa-trash-alt\"></i> Delete Selected</button>\n            <button id=\"bulk_mark_paid\" class=\"btn btn-success\" disabled><i class=\"fas fa-dollar-sign\"></i> Mark Selected as Paid</button>\n        </div>\n\n        <!-- Add Salary Modal -->\n        <div class=\"modal fade\" id=\"addSalaryModal\" tabindex=\"-1\" aria-labelledby=\"addSalaryModalLabel\" aria-hidden=\"true\">\n            <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                    <form action=\"add_salary.php\" method=\"POST\" id=\"addSalaryForm\">\n                        <div class=\"modal-header\">\n                            <h5 class=\"modal-title\" id=\"addSalaryModalLabel\">Add New Salary</h5>\n                            <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\n                        </div>\n                        <div class=\"modal-body\">\n                            <!-- CSRF Token -->\n                            <input type=\"hidden\" name=\"csrf_token\" value=\"<?php echo sanitize_output($_SESSION['csrf_token']); ?>\">\n\n                            <div class=\"row g-3\">\n                                <!-- Employee Selection -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"employee_id\" class=\"form-label\">Employee <span class=\"text-danger\">*</span></label>\n                                    <select class=\"form-select\" id=\"employee_id\" name=\"employee_id\" required>\n                                        <option value=\"\" selected disabled>Select an employee</option>\n                                        <?php foreach ($employees as $employee): ?>\n                                            <option value=\"<?php echo sanitize_output($employee['id']); ?>\">\n                                                <?php echo sanitize_output($employee['name']); ?>\n                                            </option>\n                                        <?php endforeach; ?>\n                                    </select>\n                                    <div class=\"invalid-feedback\">\n                                        Please select an employee.\n                                    </div>\n                                </div>\n                                <!-- Payment Date -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"payment_date\" class=\"form-label\">Payment Date <span class=\"text-danger\">*</span></label>\n                                    <input type=\"date\" class=\"form-control\" id=\"payment_date\" name=\"payment_date\" required>\n                                    <div class=\"invalid-feedback\">\n                                        Please select a payment date.\n                                    </div>\n                                </div>\n                                <!-- Basic Salary -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"basic_salary\" class=\"form-label\">Basic Salary ($) <span class=\"text-danger\">*</span></label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"basic_salary\" name=\"basic_salary\" placeholder=\"Enter basic salary\" required>\n                                    <div class=\"invalid-feedback\">\n                                        Please enter a valid basic salary.\n                                    </div>\n                                </div>\n                                <!-- Bonuses -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"bonuses\" class=\"form-label\">Bonuses ($)</label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"bonuses\" name=\"bonuses\" placeholder=\"Enter bonuses\" value=\"0\">\n                                </div>\n                                <!-- Deductions -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"deductions\" class=\"form-label\">Deductions ($)</label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"deductions\" name=\"deductions\" placeholder=\"Enter deductions\" value=\"0\">\n                                </div>\n                                <!-- Overtime Hours -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"overtime_hours\" class=\"form-label\">Overtime Hours</label>\n                                    <input type=\"number\" class=\"form-control\" id=\"overtime_hours\" name=\"overtime_hours\" placeholder=\"Enter overtime hours\" value=\"0\">\n                                </div>\n                                <!-- Overtime Rate -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"overtime_rate\" class=\"form-label\">Overtime Rate ($/hr)</label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"overtime_rate\" name=\"overtime_rate\" placeholder=\"Enter overtime rate\" value=\"0\">\n                                </div>\n                                <!-- Tax -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"tax\" class=\"form-label\">Tax ($) <span class=\"text-danger\">*</span></label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"tax\" name=\"tax\" placeholder=\"Enter tax deductions\" value=\"0\" required>\n                                    <div class=\"invalid-feedback\">\n                                        Please enter a valid tax amount.\n                                    </div>\n                                </div>\n                                <!-- Net Salary (Read-only) -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"net_salary\" class=\"form-label\">Net Salary ($)</label>\n                                    <input type=\"text\" class=\"form-control\" id=\"net_salary\" name=\"net_salary\" readonly>\n                                </div>\n                                <!-- Notes -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"notes\" class=\"form-label\">Notes</label>\n                                    <textarea class=\"form-control\" id=\"notes\" name=\"notes\" rows=\"3\" placeholder=\"Enter any additional notes\"></textarea>\n                                </div>\n                            </div>\n                        </div>\n                        <div class=\"modal-footer\">\n                            <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button>\n                            <button type=\"submit\" name=\"add_salary\" class=\"btn btn-custom\">Add Salary</button>\n                        </div>\n                    </form>\n                </div>\n            </div>\n        </div>\n\n        <!-- Edit Salary Modal (Loaded via AJAX) -->\n        <div class=\"modal fade\" id=\"editSalaryModal\" tabindex=\"-1\" aria-labelledby=\"editSalaryModalLabel\" aria-hidden=\"true\">\n            <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                    <!-- Content will be loaded dynamically -->\n                </div>\n            </div>\n        </div>\n    </div>\n\n    <!-- External Libraries -->\n    <script src=\"https://code.jquery.com/jquery-3.6.0.min.js\"></script>\n    <script src=\"https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.7/dist/umd/popper.min.js\" integrity=\"sha384-...\" crossorigin=\"anonymous\"></script>\n    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js\"></script>\n    <script src=\"https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js\"></script>\n    <script src=\"https://cdn.datatables.net/1.13.5/js/dataTables.bootstrap5.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js\"></script>\n    <!-- SweetAlert2 JS -->\n    <script src=\"https://cdn.jsdelivr.net/npm/sweetalert2@11.7.3/dist/sweetalert2.all.min.js\"></script>\n    <!-- jsPDF for PDF export -->\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js\"></script>\n    <!-- Custom Scripts -->\n    <script>\n        $(document).ready(function() {\n            // Initialize DataTable\n            var table = $('#salariesTable').DataTable({\n                \"order\": [[ 9, \"desc\" ]], // Order by Payment Date descending\n                \"columnDefs\": [\n                    { \"orderable\": false, \"targets\": [0, 12] } // Disable ordering on checkbox and actions\n                ],\n                \"pageLength\": 10,\n                \"lengthMenu\": [5, 10, 25, 50, 100],\n                \"language\": {\n                    \"search\": \"Search Salaries:\",\n                    \"lengthMenu\": \"Show _MENU_ entries\",\n                    \"zeroRecords\": \"No matching records found\",\n                    \"info\": \"Showing _START_ to _END_ of _TOTAL_ salaries\",\n                    \"infoEmpty\": \"Showing 0 to 0 of 0 salaries\",\n                    \"infoFiltered\": \"(filtered from _MAX_ total salaries)\"\n                }\n            });\n\n            // Handle Select All checkbox\n            $('#select_all').on('click', function(){\n                var rows = table.rows({ 'search': 'applied' }).nodes();\n                $('input[type=\"checkbox\"]', rows).prop('checked', this.checked);\n                toggleBulkButtons();\n            });\n\n            // Handle individual checkbox click\n            $('#salariesTable tbody').on('change', 'input.salary_checkbox', function(){\n                if(!this.checked){\n                    var el = $('#select_all').get(0);\n                    if(el && el.checked && ('indeterminate' in el)){\n                        el.indeterminate = true;\n                    }\n                }\n                toggleBulkButtons();\n            });\n\n            // Toggle Bulk Action Buttons\n            function toggleBulkButtons(){\n                var selected = $('input.salary_checkbox:checked').length;\n                if(selected > 0){\n                    $('#bulk_delete, #bulk_mark_paid').prop('disabled', false);\n                } else {\n                    $('#bulk_delete, #bulk_mark_paid').prop('disabled', true);\n                }\n            }\n\n            // Bulk Delete Salaries\n            $('#bulk_delete').on('click', function(){\n                var selected_ids = [];\n                $('input.salary_checkbox:checked').each(function(){\n                    selected_ids.push($(this).val());\n                });\n\n                Swal.fire({\n                    title: 'Are you sure?',\n                    text: `You are about to delete ${selected_ids.length} salary record(s). This action cannot be undone.`,\n                    icon: 'warning',\n                    showCancelButton: true,\n                    confirmButtonColor: '#dc3545',\n                    cancelButtonColor: '#6c757d',\n                    confirmButtonText: 'Yes, delete them!'\n                }).then((result) => {\n                    if (result.isConfirmed) {\n                        // Submit form via AJAX\n                        $.ajax({\n                            url: 'bulk_actions.php',\n                            type: 'POST',\n                            data: {\n                                action: 'delete',\n                                salary_ids: selected_ids,\n                                csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                            },\n                            success: function(response){\n                                var res = JSON.parse(response);\n                                if(res.status === 'success'){\n                                    Swal.fire(\n                                        'Deleted!',\n                                        res.message,\n                                        'success'\n                                    ).then(() => {\n                                        location.reload();\n                                    });\n                                } else {\n                                    Swal.fire(\n                                        'Error!',\n                                        res.message,\n                                        'error'\n                                    );\n                                }\n                            },\n                            error: function(){\n                                Swal.fire(\n                                    'Error!',\n                                    'An error occurred while processing your request.',\n                                    'error'\n                                );\n                            }\n                        });\n                    }\n                });\n            });\n\n            // Bulk Mark as Paid\n            $('#bulk_mark_paid').on('click', function(){\n                var selected_ids = [];\n                $('input.salary_checkbox:checked').each(function(){\n                    if($(this).closest('tr').find('span.badge').text() === 'Pending'){\n                        selected_ids.push($(this).val());\n                    }\n                });\n\n                if(selected_ids.length === 0){\n                    Swal.fire(\n                        'No Pending Salaries',\n                        'Selected salaries are already marked as paid.',\n                        'info'\n                    );\n                    return;\n                }\n\n                Swal.fire({\n                    title: 'Mark as Paid?',\n                    text: `You are about to mark ${selected_ids.length} salary record(s) as Paid.`,\n                    icon: 'question',\n                    showCancelButton: true,\n                    confirmButtonColor: '#28a745',\n                    cancelButtonColor: '#6c757d',\n                    confirmButtonText: 'Yes, mark them!'\n                }).then((result) => {\n                    if (result.isConfirmed) {\n                        // Submit form via AJAX\n                        $.ajax({\n                            url: 'bulk_actions.php',\n                            type: 'POST',\n                            data: {\n                                action: 'mark_paid',\n                                salary_ids: selected_ids,\n                                csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                            },\n                            success: function(response){\n                                var res = JSON.parse(response);\n                                if(res.status === 'success'){\n                                    Swal.fire(\n                                        'Success!',\n                                        res.message,\n                                        'success'\n                                    ).then(() => {\n                                        location.reload();\n                                    });\n                                } else {\n                                    Swal.fire(\n                                        'Error!',\n                                        res.message,\n                                        'error'\n                                    );\n                                }\n                            },\n                            error: function(){\n                                Swal.fire(\n                                    'Error!',\n                                    'An error occurred while processing your request.',\n                                    'error'\n                                );\n                            }\n                        });\n                    }\n                });\n            });\n\n            // Delete Salary (Single)\n            $('.delete_salary_btn').on('click', function(){\n                var salary_id = $(this).data('id');\n                Swal.fire({\n                    title: 'Are you sure?',\n                    text: \"You are about to delete this salary record.\",\n                    icon: 'warning',\n                    showCancelButton: true,\n                    confirmButtonColor: '#dc3545',\n                    cancelButtonColor: '#6c757d',\n                    confirmButtonText: 'Yes, delete it!'\n                }).then((result) => {\n                    if (result.isConfirmed) {\n                        // Submit delete via AJAX\n                        $.ajax({\n                            url: 'delete_salary.php',\n                            type: 'POST',\n                            data: {\n                                salary_id: salary_id,\n                                csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                            },\n                            success: function(response){\n                                var res = JSON.parse(response);\n                                if(res.status === 'success'){\n                                    Swal.fire(\n                                        'Deleted!',\n                                        res.message,\n                                        'success'\n                                    ).then(() => {\n                                        location.reload();\n                                    });\n                                } else {\n                                    Swal.fire(\n                                        'Error!',\n                                        res.message,\n                                        'error'\n                                    );\n                                }\n                            },\n                            error: function(){\n                                Swal.fire(\n                                    'Error!',\n                                    'An error occurred while processing your request.',\n                                    'error'\n                                );\n                            }\n                        });\n                    }\n                });\n            });\n\n            // Mark as Paid (Single)\n            $('.mark_paid_btn').on('click', function(){\n                var salary_id = $(this).data('id');\n                Swal.fire({\n                    title: 'Mark as Paid?',\n                    text: \"You are about to mark this salary as Paid.\",\n                    icon: 'question',\n                    showCancelButton: true,\n                    confirmButtonColor: '#28a745',\n                    cancelButtonColor: '#6c757d',\n                    confirmButtonText: 'Yes, mark it!'\n                }).then((result) => {\n                    if (result.isConfirmed) {\n                        // Submit mark as paid via AJAX\n                        $.ajax({\n                            url: 'mark_paid.php',\n                            type: 'POST',\n                            data: {\n                                salary_id: salary_id,\n                                csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                            },\n                            success: function(response){\n                                var res = JSON.parse(response);\n                                if(res.status === 'success'){\n                                    Swal.fire(\n                                        'Marked!',\n                                        res.message,\n                                        'success'\n                                    ).then(() => {\n                                        location.reload();\n                                    });\n                                } else {\n                                    Swal.fire(\n                                        'Error!',\n                                        res.message,\n                                        'error'\n                                    );\n                                }\n                            },\n                            error: function(){\n                                Swal.fire(\n                                    'Error!',\n                                    'An error occurred while processing your request.',\n                                    'error'\n                                );\n                            }\n                        });\n                    }\n                });\n            });\n\n            // Calculate Net Salary on Input Change\n            $('#addSalaryModal').on('input', '#basic_salary, #bonuses, #deductions, #overtime_hours, #overtime_rate, #tax', function(){\n                var basic = parseFloat($('#basic_salary').val()) || 0;\n                var bonuses = parseFloat($('#bonuses').val()) || 0;\n                var deductions = parseFloat($('#deductions').val()) || 0;\n                var overtime_hours = parseFloat($('#overtime_hours').val()) || 0;\n                var overtime_rate = parseFloat($('#overtime_rate').val()) || 0;\n                var tax = parseFloat($('#tax').val()) || 0;\n\n                var net_salary = (basic + bonuses + (overtime_hours * overtime_rate)) - (deductions + tax);\n                $('#net_salary').val(net_salary.toFixed(2));\n            });\n\n            // Export to CSV\n            $('#export_csv').on('click', function(){\n                var csv_data = [];\n                var headers = [];\n                $('#salariesTable thead tr th').each(function(){\n                    headers.push('\"' + $(this).text().trim().replace(/\"/g, '\"\"') + '\"');\n                });\n                csv_data.push(headers.join(','));\n\n                table.rows({ search: 'applied' }).every(function(){\n                    var data = this.data();\n                    var row = [];\n                    // Exclude the first checkbox and last actions columns\n                    for(var i = 1; i < data.length - 1; i++){\n                        // Remove HTML tags from data[i]\n                        var temp = $('<div>').html(data[i]).text();\n                        row.push('\"' + temp.replace(/\"/g, '\"\"') + '\"');\n                    }\n                    csv_data.push(row.join(','));\n                });\n\n                var csv_string = csv_data.join('\\n');\n                var a = document.createElement('a');\n                a.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv_string);\n                a.download = 'salaries.csv';\n                document.body.appendChild(a);\n                a.click();\n                document.body.removeChild(a);\n            });\n\n            // Export to PDF using jsPDF and AutoTable\n            $('#export_pdf').on('click', function(){\n                const { jsPDF } = window.jspdf;\n                var doc = new jsPDF();\n                doc.setFont(\"Poppins\");\n                doc.setFontSize(18);\n                doc.text(\"Salaries Report\", 14, 22);\n                var columns = [];\n                $('#salariesTable thead tr th').each(function(index){\n                    if(index !== 0 && index !== 12){ // Exclude checkbox and actions\n                        columns.push($(this).text().trim());\n                    }\n                });\n                var rows = [];\n                table.rows({ search: 'applied' }).every(function(){\n                    var data = this.data();\n                    var row = [];\n                    for(var i = 1; i < data.length - 1; i++){ // Exclude checkbox and actions\n                        // Remove HTML tags from data[i]\n                        var temp = $('<div>').html(data[i]).text();\n                        row.push(temp);\n                    }\n                    rows.push(row);\n                });\n                doc.autoTable({\n                    head: [columns],\n                    body: rows,\n                    startY: 30,\n                    styles: { font: \"Poppins\" },\n                    theme: 'striped'\n                });\n                doc.save('salaries.pdf');\n            });\n\n            // Load Edit Salary Modal via AJAX\n            $('#salariesTable').on('click', '.edit_salary_btn', function(){\n                var salary_id = $(this).data('id');\n                $.ajax({\n                    url: 'edit_salary_form.php',\n                    type: 'GET',\n                    data: { id: salary_id },\n                    success: function(response){\n                        $('#editSalaryModal .modal-content').html(response);\n                        $('#editSalaryModal').modal('show');\n                    },\n                    error: function(){\n                        Swal.fire(\n                            'Error!',\n                            'Failed to load the edit form.',\n                            'error'\n                        );\n                    }\n                });\n            });\n        });\n\n        // Dark Mode Toggle\n        document.getElementById('toggleDarkMode').addEventListener('click', function() {\n            document.body.classList.toggle('dark-mode');\n            // Save preference in localStorage\n            if(document.body.classList.contains('dark-mode')) {\n                localStorage.setItem('theme', 'dark');\n                this.innerHTML = '<i class=\"fas fa-sun\"></i>';\n            } else {\n                localStorage.setItem('theme', 'light');\n                this.innerHTML = '<i class=\"fas fa-moon\"></i>';\n            }\n        });\n\n        // Load theme preference on page load\n        document.addEventListener('DOMContentLoaded', function() {\n            const theme = localStorage.getItem('theme');\n            if(theme === 'dark') {\n                document.body.classList.add('dark-mode');\n                document.getElementById('toggleDarkMode').innerHTML = '<i class=\"fas fa-sun\"></i>';\n            }\n        });\n\n        // Form Validation for Add Salary\n        (function () {\n            'use strict'\n\n            var forms = document.querySelectorAll('#addSalaryForm')\n\n            Array.prototype.slice.call(forms)\n                .forEach(function (form) {\n                    form.addEventListener('submit', function (event) {\n                        if (!form.checkValidity()) {\n                            event.preventDefault()\n                            event.stopPropagation()\n                        }\n\n                        form.classList.add('was-validated')\n                    }, false)\n                })\n        })()\n    </script>\n</body>\n</html>\n```\n\n### **Explanation of Key Enhancements:**\n\n1. **Custom CSS Integration:**\n   - The provided `<style>` block has been integrated directly into the `<head>` section of `manage_salaries.php`. This ensures that all styles are applied correctly without relying on external CSS files.\n   - Variables (`:root`) are used for colors and fonts, making it easier to manage and maintain the design.\n\n2. **Dark Mode Functionality:**\n   - A toggle button is provided in the header allowing users to switch between light and dark modes.\n   - The user's preference is stored in `localStorage` to persist the theme across sessions.\n\n3. **Responsive Design:**\n   - Media queries ensure that the dashboard is responsive and looks good on various screen sizes.\n   \n4. **Enhanced DataTables Integration:**\n   - DataTables are styled to match the custom CSS, with alternating row colors and headers matching the primary color.\n   \n5. **User Feedback:**\n   - SweetAlert2 is used extensively for confirmation dialogs and feedback messages, enhancing user interaction and experience.\n   \n6. **Form Validation:**\n   - Bootstrap's built-in form validation has been utilized to ensure that all required fields are filled out correctly when adding a new salary.\n   \n7. **Smooth Page Refresh on Actions:**\n   - After actions like delete or mark as paid, the page refreshes smoothly with a success message, providing immediate feedback to the user.\n\n---\n\n## **2. Updated `generate_payslip.php`**\n\nThis script generates a PDF payslip for a specific salary record, styled to match the overall design aesthetics.\n\n### **generate_payslip.php**\n```php\n<?php\n// accountant/generate_payslip.php\n\nsession_start();\nrequire_once '../db_connect.php';\nrequire_once '../assets/libraries/tcpdf/tcpdf.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Check if the accountant is logged in\nif (!isset($_SESSION['accountant_id'])) {\n    header(\"Location: ../auth/login.php\");\n    exit();\n}\n\n// Check if salary ID is provided\nif (!isset($_GET['id'])) {\n    $_SESSION['error'] = \"No salary record selected.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n$salary_id = (int)$_GET['id'];\n\nif ($salary_id <= 0) {\n    $_SESSION['error'] = \"Invalid Salary ID.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\ntry {\n    // Fetch the salary record along with employee details\n    $stmt = $pdo->prepare(\"\n        SELECT salaries.*, employees.name, employees.role, employees.email, employees.department\n        FROM salaries\n        JOIN employees ON salaries.employee_id = employees.id\n        WHERE salaries.id = :id\n    \");\n    $stmt->execute([':id' => $salary_id]);\n    $salary = $stmt->fetch();\n\n    if (!$salary) {\n        $_SESSION['error'] = \"Salary record not found.\";\n        header(\"Location: manage_salaries.php\");\n        exit();\n    }\n\n    // Initialize TCPDF\n    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);\n\n    // Set Document Information\n    $pdf->SetCreator('Salary Management System');\n    $pdf->SetAuthor('Your Company Name');\n    $pdf->SetTitle('Salary Payslip');\n    $pdf->SetSubject('Payslip for ' . $salary['name']);\n\n    // Remove default header/footer\n    $pdf->setPrintHeader(false);\n    $pdf->setPrintFooter(false);\n\n    // Set margins\n    $pdf->SetMargins(15, 15, 15, true);\n\n    // Add a page\n    $pdf->AddPage();\n\n    // Styles\n    $style = '<style>\n                body { font-family: \"Poppins\", sans-serif; color: #333; }\n                .header { text-align: center; }\n                .header h2 { margin-bottom: -10px; color: var(--primary-color); }\n                .header p { margin-top: 0; }\n                table { width: 100%; border-collapse: collapse; margin-top: 20px; }\n                table, th, td { border: 1px solid #000; }\n                th, td { padding: 8px 12px; }\n                .total { font-weight: bold; }\n                .notes { margin-top: 20px; }\n              </style>';\n\n    // Header Content\n    $header = '\n        <div class=\"header\">\n            <h2>Your Company Name</h2>\n            <p>1234 Street Address, City, Country</p>\n            <h4>Payslip</h4>\n        </div>';\n\n    // Employee and Salary Details\n    $details = '\n        <table>\n            <tr>\n                <td><strong>Employee Name:</strong> ' . sanitize_output($salary['name']) . '</td>\n                <td><strong>Role:</strong> ' . sanitize_output($salary['role']) . '</td>\n            </tr>\n            <tr>\n                <td><strong>Department:</strong> ' . sanitize_output($salary['department']) . '</td>\n                <td><strong>Email:</strong> ' . sanitize_output($salary['email']) . '</td>\n            </tr>\n            <tr>\n                <td><strong>Payment Date:</strong> ' . sanitize_output($salary['payment_date']) . '</td>\n                <td><strong>Status:</strong> ' . sanitize_output($salary['status']) . '</td>\n            </tr>\n        </table>';\n\n    // Salary Breakdown\n    $breakdown = '\n        <table>\n            <thead>\n                <tr>\n                    <th>Description</th>\n                    <th>Amount ($)</th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr>\n                    <td>Basic Salary</td>\n                    <td>' . number_format($salary['basic_salary'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Bonuses</td>\n                    <td>' . number_format($salary['bonuses'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Overtime (' . $salary['overtime_hours'] . ' hrs)</td>\n                    <td>' . number_format($salary['overtime_hours'] * $salary['overtime_rate'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Deductions</td>\n                    <td>' . number_format($salary['deductions'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Tax</td>\n                    <td>' . number_format($salary['tax'], 2) . '</td>\n                </tr>\n                <tr class=\"total\">\n                    <td>Net Salary</td>\n                    <td>' . number_format($salary['net_salary'], 2) . '</td>\n                </tr>\n            </tbody>\n        </table>';\n\n    // Notes\n    $notes = '\n        <div class=\"notes\">\n            <strong>Notes:</strong>\n            <p>' . nl2br(sanitize_output($salary['notes'])) . '</p>\n        </div>';\n\n    // Assemble the PDF content\n    $html = $style . $header . $details . $breakdown . $notes;\n\n    // Output the HTML content\n    $pdf->writeHTML($html, true, false, true, false, '');\n\n    // Define the file name\n    $pdf_file = '../accountant/upload/payslips/payslip_' . $salary['id'] . '.pdf';\n\n    // Create directory if not exists\n    if (!is_dir('../upload/payslips/')) {\n        mkdir('../upload/payslips/', 0777, true);\n    }\n\n    // Save the PDF to the server\n    $pdf->Output($pdf_file, 'F');\n\n    // Update the payslip_path in the database\n    $updateStmt = $pdo->prepare(\"UPDATE salaries SET payslip_path = :path WHERE id = :id\");\n    $updateStmt->execute([\n        ':path' => $pdf_file,\n        ':id' => $salary_id,\n    ]);\n\n    // Force download the PDF\n    header('Content-Type: application/pdf');\n    header('Content-Disposition: attachment; filename=\"payslip_' . $salary['id'] . '.pdf\"');\n    readfile($pdf_file);\n    exit();\n} catch (PDOException $e) {\n    // Log error for debugging\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    $_SESSION['error'] = \"An error occurred while generating the payslip.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n} catch (Exception $e) {\n    // Handle TCPDF errors\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    $_SESSION['error'] = \"An unexpected error occurred.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n?>\n```\n\n### **Explanation of Key Enhancements:**\n\n1. **Styling Consistency:**\n   - The CSS styles used in the HTML part of `manage_salaries.php` are mirrored in the PDF to ensure consistency in branding and design.\n\n2. **Responsive Layout:**\n   - The PDF layout is clean and structured, making it easy to read and professional.\n\n3. **Error Handling:**\n   - Comprehensive error handling ensures that any issues during PDF generation are logged, and the user receives appropriate feedback.\n\n4. **Directory Structure:**\n   - The script checks and creates the `upload/payslips/` directory if it doesn't exist, ensuring that payslips are stored correctly.\n\n---\n\n## **3. Auxiliary PHP Scripts**\n\nFor the complete functionality to work, you need the following auxiliary scripts to handle actions like deleting a salary, marking as paid, and bulk actions. Below are the complete codes for these scripts.\n\n### **3.1. `delete_salary.php`**\n```php\n<?php\n// accountant/delete_salary.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Only accept POST requests\nif ($_SERVER['REQUEST_METHOD'] !== 'POST') {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid request method.']);\n    exit();\n}\n\n// Check CSRF token\nif (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid CSRF token.']);\n    exit();\n}\n\n// Check if salary_id is set\nif (!isset($_POST['salary_id']) || empty($_POST['salary_id'])) {\n    echo json_encode(['status' => 'error', 'message' => 'Salary ID not provided.']);\n    exit();\n}\n\n$salary_id = (int)$_POST['salary_id'];\n\nif ($salary_id <= 0) {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid Salary ID.']);\n    exit();\n}\n\ntry {\n    // Check if the salary exists\n    $stmt = $pdo->prepare(\"SELECT * FROM salaries WHERE id = :id\");\n    $stmt->execute([':id' => $salary_id]);\n    $salary = $stmt->fetch();\n\n    if (!$salary) {\n        echo json_encode(['status' => 'error', 'message' => 'Salary record not found.']);\n        exit();\n    }\n\n    // Delete the salary record\n    $deleteStmt = $pdo->prepare(\"DELETE FROM salaries WHERE id = :id\");\n    $deleteStmt->execute([':id' => $salary_id]);\n\n    // Optionally, delete the payslip file if exists\n    if (!empty($salary['payslip_path']) && file_exists($salary['payslip_path'])) {\n        unlink($salary['payslip_path']);\n    }\n\n    echo json_encode(['status' => 'success', 'message' => 'Salary record deleted successfully.']);\n    exit();\n} catch (PDOException $e) {\n    // Log error\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    echo json_encode(['status' => 'error', 'message' => 'An error occurred while deleting the salary record.']);\n    exit();\n}\n?>\n```\n\n### **3.2. `mark_paid.php`**\n```php\n<?php\n// accountant/mark_paid.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Only accept POST requests\nif ($_SERVER['REQUEST_METHOD'] !== 'POST') {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid request method.']);\n    exit();\n}\n\n// Check CSRF token\nif (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid CSRF token.']);\n    exit();\n}\n\n// Check if salary_id is set\nif (!isset($_POST['salary_id']) || empty($_POST['salary_id'])) {\n    echo json_encode(['status' => 'error', 'message' => 'Salary ID not provided.']);\n    exit();\n}\n\n$salary_id = (int)$_POST['salary_id'];\n\nif ($salary_id <= 0) {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid Salary ID.']);\n    exit();\n}\n\ntry {\n    // Check if the salary exists and is pending\n    $stmt = $pdo->prepare(\"SELECT * FROM salaries WHERE id = :id AND status = 'Pending'\");\n    $stmt->execute([':id' => $salary_id]);\n    $salary = $stmt->fetch();\n\n    if (!$salary) {\n        echo json_encode(['status' => 'error', 'message' => 'Salary record not found or already marked as Paid.']);\n        exit();\n    }\n\n    // Update the status to Paid\n    $updateStmt = $pdo->prepare(\"UPDATE salaries SET status = 'Paid' WHERE id = :id\");\n    $updateStmt->execute([':id' => $salary_id]);\n\n    echo json_encode(['status' => 'success', 'message' => 'Salary marked as Paid successfully.']);\n    exit();\n} catch (PDOException $e) {\n    // Log error\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    echo json_encode(['status' => 'error', 'message' => 'An error occurred while updating the salary status.']);\n    exit();\n}\n?>\n```\n\n### **3.3. `bulk_actions.php`**\n```php\n<?php\n// accountant/bulk_actions.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Only accept POST requests\nif ($_SERVER['REQUEST_METHOD'] !== 'POST') {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid request method.']);\n    exit();\n}\n\n// Check CSRF token\nif (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid CSRF token.']);\n    exit();\n}\n\n// Check if action is set\nif (!isset($_POST['action']) || empty($_POST['action'])) {\n    echo json_encode(['status' => 'error', 'message' => 'Action not specified.']);\n    exit();\n}\n\n$action = $_POST['action'];\n\n// Check if salary_ids are set and is an array\nif (!isset($_POST['salary_ids']) || !is_array($_POST['salary_ids']) || empty($_POST['salary_ids'])) {\n    echo json_encode(['status' => 'error', 'message' => 'No salary records selected.']);\n    exit();\n}\n\n$salary_ids = array_map('intval', $_POST['salary_ids']);\n$salary_ids = array_filter($salary_ids, function($id) { return $id > 0; });\n\nif (empty($salary_ids)) {\n    echo json_encode(['status' => 'error', 'message' => 'Invalid Salary IDs provided.']);\n    exit();\n}\n\ntry {\n    if ($action === 'delete') {\n        // Fetch salaries to delete and get payslip paths\n        $placeholders = implode(',', array_fill(0, count($salary_ids), '?'));\n        $stmt = $pdo->prepare(\"SELECT payslip_path FROM salaries WHERE id IN ($placeholders)\");\n        $stmt->execute($salary_ids);\n        $salaries = $stmt->fetchAll(PDO::FETCH_ASSOC);\n\n        // Delete the salary records\n        $deleteStmt = $pdo->prepare(\"DELETE FROM salaries WHERE id IN ($placeholders)\");\n        $deleteStmt->execute($salary_ids);\n\n        // Delete associated payslip files\n        foreach ($salaries as $salary) {\n            if (!empty($salary['payslip_path']) && file_exists($salary['payslip_path'])) {\n                unlink($salary['payslip_path']);\n            }\n        }\n\n        echo json_encode(['status' => 'success', 'message' => 'Selected salary records have been deleted successfully.']);\n        exit();\n    } elseif ($action === 'mark_paid') {\n        // Update status to Paid for selected salaries\n        $placeholders = implode(',', array_fill(0, count($salary_ids), '?'));\n        $updateStmt = $pdo->prepare(\"UPDATE salaries SET status = 'Paid' WHERE id IN ($placeholders) AND status = 'Pending'\");\n        $updateStmt->execute($salary_ids);\n\n        $affected = $updateStmt->rowCount();\n\n        if ($affected > 0) {\n            echo json_encode(['status' => 'success', 'message' => \"$affected salary record(s) marked as Paid successfully.\"]);\n            exit();\n        } else {\n            echo json_encode(['status' => 'error', 'message' => 'No pending salary records were found for the selected IDs.']);\n            exit();\n        }\n    } else {\n        echo json_encode(['status' => 'error', 'message' => 'Invalid action specified.']);\n        exit();\n    }\n} catch (PDOException $e) {\n    // Log error\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    echo json_encode(['status' => 'error', 'message' => 'An error occurred while processing your request.']);\n    exit();\n}\n?>\n```\n\n### **3.4. `add_salary.php`**\n```php\n<?php\n// accountant/add_salary.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_input($data) {\n    return trim(htmlspecialchars($data, ENT_QUOTES, 'UTF-8'));\n}\n\n// Only accept POST requests\nif ($_SERVER['REQUEST_METHOD'] !== 'POST') {\n    $_SESSION['error'] = \"Invalid request method.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n// Check CSRF token\nif (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {\n    $_SESSION['error'] = \"Invalid CSRF token.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n// Retrieve and sanitize form inputs\n$employee_id = isset($_POST['employee_id']) ? (int)$_POST['employee_id'] : 0;\n$payment_date = isset($_POST['payment_date']) ? sanitize_input($_POST['payment_date']) : '';\n$basic_salary = isset($_POST['basic_salary']) ? (float)$_POST['basic_salary'] : 0.00;\n$bonuses = isset($_POST['bonuses']) ? (float)$_POST['bonuses'] : 0.00;\n$deductions = isset($_POST['deductions']) ? (float)$_POST['deductions'] : 0.00;\n$overtime_hours = isset($_POST['overtime_hours']) ? (int)$_POST['overtime_hours'] : 0;\n$overtime_rate = isset($_POST['overtime_rate']) ? (float)$_POST['overtime_rate'] : 0.00;\n$tax = isset($_POST['tax']) ? (float)$_POST['tax'] : 0.00;\n$notes = isset($_POST['notes']) ? sanitize_input($_POST['notes']) : '';\n\n// Validate required fields\nif ($employee_id <= 0 || empty($payment_date) || $basic_salary <= 0 || $tax < 0) {\n    $_SESSION['error'] = \"Please fill out all required fields correctly.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n// Calculate net salary\n$net_salary = ($basic_salary + $bonuses + ($overtime_hours * $overtime_rate)) - ($deductions + $tax);\n\ntry {\n    // Insert the salary record\n    $stmt = $pdo->prepare(\"\n        INSERT INTO salaries (employee_id, basic_salary, bonuses, deductions, overtime_hours, overtime_rate, tax, payment_date, net_salary, status, notes)\n        VALUES (:employee_id, :basic_salary, :bonuses, :deductions, :overtime_hours, :overtime_rate, :tax, :payment_date, :net_salary, 'Pending', :notes)\n    \");\n    $stmt->execute([\n        ':employee_id' => $employee_id,\n        ':basic_salary' => $basic_salary,\n        ':bonuses' => $bonuses,\n        ':deductions' => $deductions,\n        ':overtime_hours' => $overtime_hours,\n        ':overtime_rate' => $overtime_rate,\n        ':tax' => $tax,\n        ':payment_date' => $payment_date,\n        ':net_salary' => $net_salary,\n        ':notes' => $notes\n    ]);\n\n    $_SESSION['success'] = \"Salary record added successfully.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n} catch (PDOException $e) {\n    // Log error\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    $_SESSION['error'] = \"An error occurred while adding the salary record.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n?>\n```\n\n### **3.5. `edit_salary.php` & `edit_salary_form.php`**\n\n**Note:** To keep things modular, `edit_salary_form.php` will handle fetching the existing salary details and rendering the edit form inside the modal. `edit_salary.php` will process the form submission.\n\n**edit_salary_form.php**\n```php\n<?php\n// accountant/edit_salary_form.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Check if salary ID is provided\nif (!isset($_GET['id'])) {\n    echo \"Invalid request.\";\n    exit();\n}\n\n$salary_id = (int)$_GET['id'];\n\nif ($salary_id <= 0) {\n    echo \"Invalid Salary ID.\";\n    exit();\n}\n\ntry {\n    // Fetch the salary record\n    $stmt = $pdo->prepare(\"SELECT * FROM salaries WHERE id = :id\");\n    $stmt->execute([':id' => $salary_id]);\n    $salary = $stmt->fetch();\n\n    if (!$salary) {\n        echo \"Salary record not found.\";\n        exit();\n    }\n\n    // Fetch all active employees for the 'Edit Salary' form\n    $empStmt = $pdo->prepare(\"SELECT id, name FROM employees WHERE status = 'active' ORDER BY name ASC\");\n    $empStmt->execute();\n    $employees = $empStmt->fetchAll(PDO::FETCH_ASSOC);\n} catch (PDOException $e) {\n    echo \"An error occurred while fetching the salary record.\";\n    exit();\n}\n?>\n<div class=\"modal-header\">\n    <h5 class=\"modal-title\" id=\"editSalaryModalLabel\">Edit Salary</h5>\n    <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\n</div>\n<div class=\"modal-body\">\n    <form action=\"edit_salary.php\" method=\"POST\" id=\"editSalaryForm\">\n        <!-- CSRF Token -->\n        <input type=\"hidden\" name=\"csrf_token\" value=\"<?php echo sanitize_output($_SESSION['csrf_token']); ?>\">\n        <!-- Salary ID -->\n        <input type=\"hidden\" name=\"salary_id\" value=\"<?php echo sanitize_output($salary['id']); ?>\">\n\n        <div class=\"row g-3\">\n            <!-- Employee Selection -->\n            <div class=\"col-md-6\">\n                <label for=\"employee_id_edit\" class=\"form-label\">Employee <span class=\"text-danger\">*</span></label>\n                <select class=\"form-select\" id=\"employee_id_edit\" name=\"employee_id\" required>\n                    <option value=\"\" disabled>Select an employee</option>\n                    <?php foreach ($employees as $employee): ?>\n                        <option value=\"<?php echo sanitize_output($employee['id']); ?>\" <?php echo ($salary['employee_id'] == $employee['id']) ? 'selected' : ''; ?>>\n                            <?php echo sanitize_output($employee['name']); ?>\n                        </option>\n                    <?php endforeach; ?>\n                </select>\n                <div class=\"invalid-feedback\">\n                    Please select an employee.\n                </div>\n            </div>\n            <!-- Payment Date -->\n            <div class=\"col-md-6\">\n                <label for=\"payment_date_edit\" class=\"form-label\">Payment Date <span class=\"text-danger\">*</span></label>\n                <input type=\"date\" class=\"form-control\" id=\"payment_date_edit\" name=\"payment_date\" value=\"<?php echo sanitize_output($salary['payment_date']); ?>\" required>\n                <div class=\"invalid-feedback\">\n                    Please select a payment date.\n                </div>\n            </div>\n            <!-- Basic Salary -->\n            <div class=\"col-md-4\">\n                <label for=\"basic_salary_edit\" class=\"form-label\">Basic Salary ($) <span class=\"text-danger\">*</span></label>\n                <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"basic_salary_edit\" name=\"basic_salary\" value=\"<?php echo sanitize_output($salary['basic_salary']); ?>\" required>\n                <div class=\"invalid-feedback\">\n                    Please enter a valid basic salary.\n                </div>\n            </div>\n            <!-- Bonuses -->\n            <div class=\"col-md-4\">\n                <label for=\"bonuses_edit\" class=\"form-label\">Bonuses ($)</label>\n                <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"bonuses_edit\" name=\"bonuses\" value=\"<?php echo sanitize_output($salary['bonuses']); ?>\">\n            </div>\n            <!-- Deductions -->\n            <div class=\"col-md-4\">\n                <label for=\"deductions_edit\" class=\"form-label\">Deductions ($)</label>\n                <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"deductions_edit\" name=\"deductions\" value=\"<?php echo sanitize_output($salary['deductions']); ?>\">\n            </div>\n            <!-- Overtime Hours -->\n            <div class=\"col-md-4\">\n                <label for=\"overtime_hours_edit\" class=\"form-label\">Overtime Hours</label>\n                <input type=\"number\" class=\"form-control\" id=\"overtime_hours_edit\" name=\"overtime_hours\" value=\"<?php echo sanitize_output($salary['overtime_hours']); ?>\">\n            </div>\n            <!-- Overtime Rate -->\n            <div class=\"col-md-4\">\n                <label for=\"overtime_rate_edit\" class=\"form-label\">Overtime Rate ($/hr)</label>\n                <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"overtime_rate_edit\" name=\"overtime_rate\" value=\"<?php echo sanitize_output($salary['overtime_rate']); ?>\">\n            </div>\n            <!-- Tax -->\n            <div class=\"col-md-4\">\n                <label for=\"tax_edit\" class=\"form-label\">Tax ($) <span class=\"text-danger\">*</span></label>\n                <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"tax_edit\" name=\"tax\" value=\"<?php echo sanitize_output($salary['tax']); ?>\" required>\n                <div class=\"invalid-feedback\">\n                    Please enter a valid tax amount.\n                </div>\n            </div>\n            <!-- Net Salary (Read-only) -->\n            <div class=\"col-md-6\">\n                <label for=\"net_salary_edit\" class=\"form-label\">Net Salary ($)</label>\n                <input type=\"text\" class=\"form-control\" id=\"net_salary_edit\" name=\"net_salary\" readonly>\n            </div>\n            <!-- Notes -->\n            <div class=\"col-md-6\">\n                <label for=\"notes_edit\" class=\"form-label\">Notes</label>\n                <textarea class=\"form-control\" id=\"notes_edit\" name=\"notes\" rows=\"3\"><?php echo sanitize_output($salary['notes']); ?></textarea>\n            </div>\n        </div>\n    </form>\n</div>\n<div class=\"modal-footer\">\n    <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button>\n    <button type=\"submit\" form=\"editSalaryForm\" name=\"edit_salary\" class=\"btn btn-custom\">Save Changes</button>\n</div>\n<script>\n    // Calculate Net Salary on Input Change\n    $('#editSalaryForm').on('input', '#basic_salary_edit, #bonuses_edit, #deductions_edit, #overtime_hours_edit, #overtime_rate_edit, #tax_edit', function(){\n        var basic = parseFloat($('#basic_salary_edit').val()) || 0;\n        var bonuses = parseFloat($('#bonuses_edit').val()) || 0;\n        var deductions = parseFloat($('#deductions_edit').val()) || 0;\n        var overtime_hours = parseFloat($('#overtime_hours_edit').val()) || 0;\n        var overtime_rate = parseFloat($('#overtime_rate_edit').val()) || 0;\n        var tax = parseFloat($('#tax_edit').val()) || 0;\n\n        var net_salary = (basic + bonuses + (overtime_hours * overtime_rate)) - (deductions + tax);\n        $('#net_salary_edit').val(net_salary.toFixed(2));\n    });\n\n    // Form Validation for Edit Salary\n    (function () {\n        'use strict'\n\n        var form = document.getElementById('editSalaryForm')\n\n        form.addEventListener('submit', function (event) {\n            if (!form.checkValidity()) {\n                event.preventDefault()\n                event.stopPropagation()\n            }\n\n            form.classList.add('was-validated')\n        }, false)\n    })()\n</script>\n```\n\n**edit_salary.php**\n```php\n<?php\n// accountant/edit_salary.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_input($data) {\n    return trim(htmlspecialchars($data, ENT_QUOTES, 'UTF-8'));\n}\n\n// Only accept POST requests\nif ($_SERVER['REQUEST_METHOD'] !== 'POST') {\n    $_SESSION['error'] = \"Invalid request method.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n// Check CSRF token\nif (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {\n    $_SESSION['error'] = \"Invalid CSRF token.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n// Retrieve and sanitize form inputs\n$salary_id = isset($_POST['salary_id']) ? (int)$_POST['salary_id'] : 0;\n$employee_id = isset($_POST['employee_id']) ? (int)$_POST['employee_id'] : 0;\n$payment_date = isset($_POST['payment_date']) ? sanitize_input($_POST['payment_date']) : '';\n$basic_salary = isset($_POST['basic_salary']) ? (float)$_POST['basic_salary'] : 0.00;\n$bonuses = isset($_POST['bonuses']) ? (float)$_POST['bonuses'] : 0.00;\n$deductions = isset($_POST['deductions']) ? (float)$_POST['deductions'] : 0.00;\n$overtime_hours = isset($_POST['overtime_hours']) ? (int)$_POST['overtime_hours'] : 0;\n$overtime_rate = isset($_POST['overtime_rate']) ? (float)$_POST['overtime_rate'] : 0.00;\n$tax = isset($_POST['tax']) ? (float)$_POST['tax'] : 0.00;\n$notes = isset($_POST['notes']) ? sanitize_input($_POST['notes']) : '';\n\n// Validate required fields\nif ($salary_id <= 0 || $employee_id <= 0 || empty($payment_date) || $basic_salary <= 0 || $tax < 0) {\n    $_SESSION['error'] = \"Please fill out all required fields correctly.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n// Calculate net salary\n$net_salary = ($basic_salary + $bonuses + ($overtime_hours * $overtime_rate)) - ($deductions + $tax);\n\ntry {\n    // Update the salary record\n    $stmt = $pdo->prepare(\"\n        UPDATE salaries\n        SET employee_id = :employee_id,\n            basic_salary = :basic_salary,\n            bonuses = :bonuses,\n            deductions = :deductions,\n            overtime_hours = :overtime_hours,\n            overtime_rate = :overtime_rate,\n            tax = :tax,\n            payment_date = :payment_date,\n            net_salary = :net_salary,\n            notes = :notes\n        WHERE id = :id\n    \");\n    $stmt->execute([\n        ':employee_id' => $employee_id,\n        ':basic_salary' => $basic_salary,\n        ':bonuses' => $bonuses,\n        ':deductions' => $deductions,\n        ':overtime_hours' => $overtime_hours,\n        ':overtime_rate' => $overtime_rate,\n        ':tax' => $tax,\n        ':payment_date' => $payment_date,\n        ':net_salary' => $net_salary,\n        ':notes' => $notes,\n        ':id' => $salary_id\n    ]);\n\n    $_SESSION['success'] = \"Salary record updated successfully.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n} catch (PDOException $e) {\n    // Log error\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    $_SESSION['error'] = \"An error occurred while updating the salary record.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n?>\n```\n\n---\n\n## **4. Database Structure Alignment**\n\nBased on your provided database structure, ensure that the `salaries` and `employees` tables are correctly set up in your MySQL database. Here's a brief SQL overview for these tables:\n\n### **4.1. `employees` Table**\n```sql\nCREATE TABLE `employees` (\n    `id` INT AUTO_INCREMENT PRIMARY KEY,\n    `name` VARCHAR(255) NOT NULL,\n    `role` ENUM('admin', 'doctor', 'staff') NOT NULL,\n    `email` VARCHAR(255) NOT NULL UNIQUE,\n    `phone` VARCHAR(20),\n    `department` VARCHAR(100),\n    `date_of_joining` DATE,\n    `status` ENUM('active', 'inactive') DEFAULT 'active',\n    `username` VARCHAR(100) NOT NULL UNIQUE,\n    `password` VARCHAR(255) NOT NULL,\n    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n    `profile_picture` VARCHAR(255) DEFAULT 'default_profile.png',\n    `specialization` VARCHAR(255) DEFAULT NULL\n);\n```\n\n### **4.2. `salaries` Table**\n```sql\nCREATE TABLE `salaries` (\n    `id` INT AUTO_INCREMENT PRIMARY KEY,\n    `employee_id` INT NOT NULL,\n    `basic_salary` DECIMAL(10,2) NOT NULL,\n    `bonuses` DECIMAL(10,2) DEFAULT 0,\n    `deductions` DECIMAL(10,2) DEFAULT 0,\n    `overtime_hours` INT DEFAULT 0,\n    `overtime_rate` DECIMAL(10,2) DEFAULT 0,\n    `tax` DECIMAL(10,2) DEFAULT 0,\n    `payment_date` DATE NOT NULL,\n    `net_salary` DECIMAL(10,2) NOT NULL,\n    `status` ENUM('Pending', 'Paid') DEFAULT 'Pending',\n    `notes` TEXT,\n    `payslip_path` VARCHAR(255),\n    FOREIGN KEY (`employee_id`) REFERENCES `employees`(`id`) ON DELETE CASCADE\n);\n```\n\n**Note:** The `payslip_path` column is added to store the path of the generated payslip PDF.\n\n---\n\n## **5. Additional Recommendations**\n\n1. **Security Enhancements:**\n   - **Password Hashing:** Ensure that passwords for both admins and employees are securely hashed using algorithms like `bcrypt` before storing them in the database.\n   - **Prepared Statements:** Continue using prepared statements to prevent SQL injection, as demonstrated in the provided scripts.\n   - **CSRF Protection:** CSRF tokens are implemented to protect against Cross-Site Request Forgery attacks.\n\n2. **Error Logging:**\n   - Ensure that the `logs/error.log` file is writable by the server and is stored securely, preferably outside the web root to prevent unauthorized access.\n\n3. **Directory Permissions:**\n   - The `upload/payslips/` directory should have appropriate permissions (e.g., `0755`) to allow PHP to write files while preventing unauthorized access.\n\n4. **Responsive Design Testing:**\n   - Test the dashboard on various devices to ensure that the design remains consistent and user-friendly across different screen sizes.\n\n5. **Accessibility:**\n   - Ensure that the dashboard is accessible to users with disabilities by following [WCAG](https://www.w3.org/WAI/standards-guidelines/wcag/) guidelines.\n\n6. **Code Maintenance:**\n   - Consider organizing your JavaScript and CSS into separate files (`scripts.js` and `styles.css`) for better maintainability, especially as the project grows.\n\n---\n\nBy integrating the provided CSS styles and enhancing the PHP scripts, your Salary Management Dashboard should now have a modern, responsive, and user-friendly interface. The use of SweetAlert2 ensures that user interactions are smooth and intuitive, providing immediate feedback on actions like deletions and updates. The structure also aligns perfectly with your updated database schema, ensuring data integrity and seamless functionality.\n\nFeel free to further customize the styles and functionalities as per your specific requirements!","behavior":"degenerate_repetition","conversation_hash":"4ed904ec9d88b93ccc7541b40c4cc0ab","conversation_redacted":false,"conversation_toxic":false,"country":"Egypt","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"English","model":"o1-mini-2024-09-12","n_chars":133429,"n_turns_in_conversation":1,"n_words":10245,"source_row_offset":3475,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:19:51 GMT","turn_id":"45f9709732345b2c2da9d08b","turn_index":0,"user_text":"ok, i want to use this styles (    <style>\n        /* Import Google Fonts */\n        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');\n\n        /* Root Variables */\n        :root {\n            --primary-color: #4F3F02;\n            --secondary-color: #D1C287;\n            --background-color: #F8F9FA;\n            --card-background: #FFFFFF;\n            --text-color: #333333;\n            --success-color: #28a745;\n            --danger-color: #dc3545;\n            --info-color: #17a2b8;\n            --font-family: 'Poppins', sans-serif;\n        }\n\n        /* Reset and Base Styles */\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n\n        body {\n            background-color: var(--background-color);\n            font-family: var(--font-family);\n            color: var(--text-color);\n        }\n\n        /* Header */\n        .dashboard-header {\n            background-color: var(--primary-color);\n            color: #fff;\n            padding: 30px;\n            text-align: center;\n            border-radius: 0 0 25px 25px;\n            margin-bottom: 40px;\n        }\n\n        .dashboard-header h1 {\n            font-weight: 700;\n        }\n\n        .dashboard-header p a {\n            color: #fff;\n            margin: 0 10px;\n        }\n\n        .dashboard-header p a:hover {\n            text-decoration: underline;\n        }\n\n        /* Cards */\n        .card {\n            border: none;\n            border-radius: 15px;\n            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);\n            margin-bottom: 30px;\n            background-color: var(--card-background);\n        }\n\n        .card .card-body {\n            padding: 25px;\n        }\n\n        .card .card-title {\n            color: var(--primary-color);\n            font-weight: 600;\n            margin-bottom: 15px;\n        }\n\n        .card .card-text {\n            font-size: 2em;\n            font-weight: 700;\n        }\n\n        /* Buttons */\n        .btn-custom {\n            background-color: var(--secondary-color);\n            border-color: var(--secondary-color);\n            color: var(--primary-color);\n            font-weight: 600;\n            width: 100%;\n            padding: 15px;\n            border-radius: 10px;\n            transition: all 0.3s ease;\n        }\n\n        .btn-custom:hover {\n            background-color: var(--primary-color);\n            color: #fff;\n            border-color: var(--secondary-color);\n            transform: translateY(-3px);\n            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);\n        }\n\n        /* Filters */\n        .filters {\n            background-color: var(--card-background);\n            padding: 25px;\n            border-radius: 15px;\n            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);\n            margin-bottom: 40px;\n        }\n\n        /* Charts */\n        .chart-container {\n            position: relative;\n            height: 400px;\n        }\n\n        /* Responsive Adjustments */\n        @media (max-width: 768px) {\n            .dashboard-header h1 {\n                font-size: 24px;\n            }\n\n            .btn-custom {\n                margin-bottom: 15px;\n            }\n        }\n\n        @media (max-width: 576px) {\n            .dashboard-header h1 {\n                font-size: 20px;\n            }\n\n            .card .card-body {\n                padding: 20px;\n            }\n\n            .card .card-text {\n                font-size: 1.5em;\n            }\n\n            .filters {\n                padding: 20px;\n            }\n        }\n\n        /* Dark Mode Styles */\n        body.dark-mode {\n            background-color: #121212;\n            color: #e0e0e0;\n        }\n\n        body.dark-mode .dashboard-header {\n            background-color: #1f1f1f;\n            color: #e0e0e0;\n        }\n\n        body.dark-mode .card {\n            background-color: #1f1f1f;\n            box-shadow: 0 6px 10px rgba(255, 255, 255, 0.05);\n        }\n\n        body.dark-mode .btn-custom {\n            background-color: #333;\n            border-color: #333;\n            color: #fff;\n        }\n\n        body.dark-mode .btn-custom:hover {\n            background-color: #555;\n            border-color: #555;\n            color: #fff;\n        }\n\n        body.dark-mode .filters {\n            background-color: #1f1f1f;\n            box-shadow: 0 6px 10px rgba(255, 255, 255, 0.05);\n        }\n\n        body.dark-mode .card-title {\n            color: #d1c287;\n        }\n    </style>\n)for manage_salaries.php (<?php\n// accountant/manage_salaries.php\n\nsession_start();\nrequire_once '../db_connect.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Check if the accountant is logged in\nif (!isset($_SESSION['accountant_id'])) {\n    header(\"Location: ../auth/login.php\");\n    exit();\n}\n\n// Generate CSRF token if not set\nif (empty($_SESSION['csrf_token'])) {\n    $_SESSION['csrf_token'] = bin2hex(random_bytes(32));\n}\n\n// Initialize feedback messages\n$success = isset($_SESSION['success']) ? $_SESSION['success'] : '';\n$error = isset($_SESSION['error']) ? $_SESSION['error'] : '';\nunset($_SESSION['success'], $_SESSION['error']);\n\n// Fetch all salaries with employee details\ntry {\n    $stmt = $pdo->prepare(\"\n        SELECT salaries.*, employees.name AS employee_name\n        FROM salaries\n        JOIN employees ON salaries.employee_id = employees.id\n        ORDER BY payment_date DESC\n    \");\n    $stmt->execute();\n    $salaries = $stmt->fetchAll(PDO::FETCH_ASSOC);\n} catch (PDOException $e) {\n    // Log error for debugging\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    die(\"An error occurred while fetching salaries. Please try again later.\");\n}\n\n// Fetch all active employees for the 'Add Salary' form\ntry {\n    $empStmt = $pdo->prepare(\"SELECT id, name FROM employees WHERE status = 'active' ORDER BY name ASC\");\n    $empStmt->execute();\n    $employees = $empStmt->fetchAll(PDO::FETCH_ASSOC);\n} catch (PDOException $e) {\n    // Log error for debugging\n    error_log($e->getMessage(), 3, '../logs/error.log');\n    die(\"An error occurred while fetching employees. Please try again later.\");\n}\n\n// Fetch all statuses for filtering\n$statusOptions = ['Pending', 'Paid'];\n?>\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Manage Salaries</title>\n    <!-- Meta tags for responsiveness -->\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n    <!-- Bootstrap CSS, DataTables CSS, Font Awesome, SweetAlert2 CSS -->\n    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap5.min.css\" rel=\"stylesheet\">\n    <link href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css\" rel=\"stylesheet\">\n    <!-- SweetAlert2 CSS -->\n    <link href=\"https://cdn.jsdelivr.net/npm/sweetalert2@11.7.3/dist/sweetalert2.min.css\" rel=\"stylesheet\">\n    <!-- Custom Styles -->\n    <link href=\"../assets/css/styles.css\" rel=\"stylesheet\">\n    <style>\n        /* Custom button styles */\n        .btn-custom {\n            background-color: #4F3F02;\n            color: #fff;\n        }\n        .btn-custom:hover {\n            background-color: #D1C287;\n            color: #4F3F02;\n        }\n        /* Modal customizations */\n        .modal-header {\n            background-color: #4F3F02;\n            color: #fff;\n        }\n        /* Dark Mode Styles */\n        body.dark-mode {\n            background-color: #121212;\n            color: #e0e0e0;\n        }\n        body.dark-mode .navbar {\n            background-color: #1f1f1f;\n        }\n        body.dark-mode .btn-custom {\n            background-color: #333;\n            color: #fff;\n        }\n        body.dark-mode .btn-custom:hover {\n            background-color: #555;\n            color: #fff;\n        }\n        body.dark-mode .modal-header {\n            background-color: #333;\n            color: #fff;\n        }\n    </style>\n</head>\n<body class=\"light-mode\">\n    <!-- Dashboard Header -->\n    <header class=\"navbar navbar-expand-lg navbar-light bg-primary text-white px-4\">\n        <a class=\"navbar-brand text-white\" href=\"#\">Salary Management</a>\n        <button class=\"navbar-toggler\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#navbarSupportedContent\" \n            aria-controls=\"navbarSupportedContent\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\n            <span class=\"navbar-toggler-icon\"></span>\n        </button>\n        <div class=\"collapse navbar-collapse justify-content-end\" id=\"navbarSupportedContent\">\n            <div class=\"navbar-nav\">\n                <span class=\"nav-link\">Welcome, <?php echo sanitize_output($_SESSION['accountant_name']); ?></span>\n                <a class=\"nav-link active\" href=\"manage_salaries.php\">Manage Salaries</a>\n                <a class=\"nav-link\" href=\"../auth/logout.php\">Logout</a>\n                <!-- Dark Mode Toggle -->\n                <button class=\"btn btn-secondary ms-3\" id=\"toggleDarkMode\"><i class=\"fas fa-moon\"></i></button>\n            </div>\n        </div>\n    </header>\n\n    <!-- Main Container -->\n    <div class=\"container my-4\">\n        <!-- Feedback Messages -->\n        <?php if (!empty($success)): ?>\n            <div class=\"alert alert-success alert-dismissible fade show\" role=\"alert\">\n                <?php echo sanitize_output($success); ?>\n                <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\n            </div>\n        <?php endif; ?>\n\n        <?php if (!empty($error)): ?>\n            <div class=\"alert alert-danger alert-dismissible fade show\" role=\"alert\">\n                <?php echo sanitize_output($error); ?>\n                <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\" aria-label=\"Close\"></button>\n            </div>\n        <?php endif; ?>\n\n        <!-- Filters -->\n        <div class=\"card mb-4\">\n            <div class=\"card-body\">\n                <form id=\"filterForm\" class=\"row g-3\">\n                    <!-- Date Range Filter -->\n                    <div class=\"col-md-4\">\n                        <label for=\"start_date\" class=\"form-label\">Start Date:</label>\n                        <input type=\"date\" id=\"start_date\" name=\"start_date\" class=\"form-control\" value=\"<?php echo sanitize_output($_GET['start_date'] ?? ''); ?>\">\n                    </div>\n                    <div class=\"col-md-4\">\n                        <label for=\"end_date\" class=\"form-label\">End Date:</label>\n                        <input type=\"date\" id=\"end_date\" name=\"end_date\" class=\"form-control\" value=\"<?php echo sanitize_output($_GET['end_date'] ?? ''); ?>\">\n                    </div>\n                    <!-- Status Filter -->\n                    <div class=\"col-md-4\">\n                        <label for=\"status_filter\" class=\"form-label\">Status:</label>\n                        <select id=\"status_filter\" name=\"status_filter\" class=\"form-select\">\n                            <option value=\"\">All</option>\n                            <?php foreach ($statusOptions as $status): ?>\n                                <option value=\"<?php echo sanitize_output($status); ?>\" <?php echo (isset($_GET['status_filter']) && $_GET['status_filter'] === $status) ? 'selected' : ''; ?>>\n                                    <?php echo sanitize_output($status); ?>\n                                </option>\n                            <?php endforeach; ?>\n                        </select>\n                    </div>\n                </form>\n            </div>\n        </div>\n\n        <!-- Add Salary Button -->\n        <div class=\"d-flex justify-content-between mb-3\">\n            <button type=\"button\" class=\"btn btn-custom\" data-bs-toggle=\"modal\" data-bs-target=\"#addSalaryModal\">\n                <i class=\"fas fa-plus\"></i> Add Salary\n            </button>\n            <!-- Export Buttons -->\n            <div>\n                <button id=\"export_csv\" class=\"btn btn-secondary me-2\"><i class=\"fas fa-file-csv\"></i> Export CSV</button>\n                <button id=\"export_pdf\" class=\"btn btn-secondary\"><i class=\"fas fa-file-pdf\"></i> Export PDF</button>\n            </div>\n        </div>\n\n        <!-- Salaries Table -->\n        <div class=\"table-responsive\">\n            <table class=\"table table-striped table-hover\" id=\"salariesTable\">\n                <thead>\n                    <tr>\n                        <th><input type=\"checkbox\" id=\"select_all\"></th>\n                        <th>Salary ID</th>\n                        <th>Employee Name</th>\n                        <th>Basic Salary ($)</th>\n                        <th>Bonuses ($)</th>\n                        <th>Deductions ($)</th>\n                        <th>Overtime (Hours)</th>\n                        <th>Overtime Rate ($/hr)</th>\n                        <th>Tax ($)</th>\n                        <th>Net Salary ($)</th>\n                        <th>Payment Date</th>\n                        <th>Status</th>\n                        <th>Actions</th>\n                    </tr>\n                </thead>\n                <tbody>\n                    <?php if (count($salaries) > 0): ?>\n                        <?php foreach ($salaries as $salary): ?>\n                            <tr>\n                                <td><input type=\"checkbox\" class=\"salary_checkbox\" value=\"<?php echo sanitize_output($salary['id']); ?>\"></td>\n                                <td><?php echo sanitize_output($salary['id']); ?></td>\n                                <td><?php echo sanitize_output($salary['employee_name']); ?></td>\n                                <td><?php echo number_format($salary['basic_salary'], 2); ?></td>\n                                <td><?php echo number_format($salary['bonuses'], 2); ?></td>\n                                <td><?php echo number_format($salary['deductions'], 2); ?></td>\n                                <td><?php echo sanitize_output($salary['overtime_hours']); ?></td>\n                                <td><?php echo number_format($salary['overtime_rate'], 2); ?></td>\n                                <td><?php echo number_format($salary['tax'], 2); ?></td>\n                                <td><?php echo number_format($salary['net_salary'], 2); ?></td>\n                                <td><?php echo sanitize_output($salary['payment_date']); ?></td>\n                                <td>\n                                    <?php if ($salary['status'] === 'Paid'): ?>\n                                        <span class=\"badge bg-success\">Paid</span>\n                                    <?php else: ?>\n                                        <span class=\"badge bg-warning text-dark\">Pending</span>\n                                    <?php endif; ?>\n                                </td>\n                                <td>\n                                    <a href=\"edit_salary.php?id=<?php echo urlencode($salary['id']); ?>\" class=\"btn btn-sm btn-primary\" title=\"Edit\">\n                                        <i class=\"fas fa-edit\"></i>\n                                    </a>\n                                    <button type=\"button\" class=\"btn btn-sm btn-danger delete_salary_btn\" data-id=\"<?php echo sanitize_output($salary['id']); ?>\" title=\"Delete\">\n                                        <i class=\"fas fa-trash-alt\"></i>\n                                    </button>\n                                    <?php if ($salary['status'] === 'Pending'): ?>\n                                        <button type=\"button\" class=\"btn btn-sm btn-success mark_paid_btn\" data-id=\"<?php echo sanitize_output($salary['id']); ?>\" title=\"Mark as Paid\">\n                                            <i class=\"fas fa-dollar-sign\"></i>\n                                        </button>\n                                    <?php endif; ?>\n                                    <a href=\"generate_payslip.php?id=<?php echo urlencode($salary['id']); ?>\" class=\"btn btn-sm btn-info\" title=\"Generate Payslip\" target=\"_blank\">\n                                        <i class=\"fas fa-file-pdf\"></i>\n                                    </a>\n                                </td>\n                            </tr>\n                        <?php endforeach; ?>\n                    <?php else: ?>\n                        <tr>\n                            <td colspan=\"13\" class=\"text-center\">No salary records found.</td>\n                        </tr>\n                    <?php endif; ?>\n                </tbody>\n            </table>\n        </div>\n\n        <!-- Bulk Actions -->\n        <div class=\"mb-4\">\n            <button id=\"bulk_delete\" class=\"btn btn-danger me-2\" disabled><i class=\"fas fa-trash-alt\"></i> Delete Selected</button>\n            <button id=\"bulk_mark_paid\" class=\"btn btn-success\" disabled><i class=\"fas fa-dollar-sign\"></i> Mark Selected as Paid</button>\n        </div>\n\n        <!-- Add Salary Modal -->\n        <div class=\"modal fade\" id=\"addSalaryModal\" tabindex=\"-1\" aria-labelledby=\"addSalaryModalLabel\" aria-hidden=\"true\">\n            <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                    <form action=\"add_salary.php\" method=\"POST\">\n                        <div class=\"modal-header\">\n                            <h5 class=\"modal-title\" id=\"addSalaryModalLabel\">Add New Salary</h5>\n                            <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\n                        </div>\n                        <div class=\"modal-body\">\n                            <!-- CSRF Token -->\n                            <input type=\"hidden\" name=\"csrf_token\" value=\"<?php echo sanitize_output($_SESSION['csrf_token']); ?>\">\n\n                            <div class=\"row g-3\">\n                                <!-- Employee Selection -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"employee_id\" class=\"form-label\">Employee <span class=\"text-danger\">*</span></label>\n                                    <select class=\"form-select\" id=\"employee_id\" name=\"employee_id\" required>\n                                        <option value=\"\" selected disabled>Select an employee</option>\n                                        <?php foreach ($employees as $employee): ?>\n                                            <option value=\"<?php echo sanitize_output($employee['id']); ?>\">\n                                                <?php echo sanitize_output($employee['name']); ?>\n                                            </option>\n                                        <?php endforeach; ?>\n                                    </select>\n                                    <div class=\"invalid-feedback\">\n                                        Please select an employee.\n                                    </div>\n                                </div>\n                                <!-- Payment Date -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"payment_date\" class=\"form-label\">Payment Date <span class=\"text-danger\">*</span></label>\n                                    <input type=\"date\" class=\"form-control\" id=\"payment_date\" name=\"payment_date\" required>\n                                    <div class=\"invalid-feedback\">\n                                        Please select a payment date.\n                                    </div>\n                                </div>\n                                <!-- Basic Salary -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"basic_salary\" class=\"form-label\">Basic Salary ($) <span class=\"text-danger\">*</span></label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"basic_salary\" name=\"basic_salary\" placeholder=\"Enter basic salary\" required>\n                                    <div class=\"invalid-feedback\">\n                                        Please enter a valid basic salary.\n                                    </div>\n                                </div>\n                                <!-- Bonuses -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"bonuses\" class=\"form-label\">Bonuses ($)</label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"bonuses\" name=\"bonuses\" placeholder=\"Enter bonuses\" value=\"0\">\n                                </div>\n                                <!-- Deductions -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"deductions\" class=\"form-label\">Deductions ($)</label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"deductions\" name=\"deductions\" placeholder=\"Enter deductions\" value=\"0\">\n                                </div>\n                                <!-- Overtime Hours -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"overtime_hours\" class=\"form-label\">Overtime Hours</label>\n                                    <input type=\"number\" class=\"form-control\" id=\"overtime_hours\" name=\"overtime_hours\" placeholder=\"Enter overtime hours\" value=\"0\">\n                                </div>\n                                <!-- Overtime Rate -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"overtime_rate\" class=\"form-label\">Overtime Rate ($/hr)</label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"overtime_rate\" name=\"overtime_rate\" placeholder=\"Enter overtime rate\" value=\"0\">\n                                </div>\n                                <!-- Tax -->\n                                <div class=\"col-md-4\">\n                                    <label for=\"tax\" class=\"form-label\">Tax ($) <span class=\"text-danger\">*</span></label>\n                                    <input type=\"number\" step=\"0.01\" class=\"form-control\" id=\"tax\" name=\"tax\" placeholder=\"Enter tax deductions\" value=\"0\" required>\n                                    <div class=\"invalid-feedback\">\n                                        Please enter a valid tax amount.\n                                    </div>\n                                </div>\n                                <!-- Net Salary (Read-only) -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"net_salary\" class=\"form-label\">Net Salary ($)</label>\n                                    <input type=\"text\" class=\"form-control\" id=\"net_salary\" name=\"net_salary\" readonly>\n                                </div>\n                                <!-- Notes -->\n                                <div class=\"col-md-6\">\n                                    <label for=\"notes\" class=\"form-label\">Notes</label>\n                                    <textarea class=\"form-control\" id=\"notes\" name=\"notes\" rows=\"3\" placeholder=\"Enter any additional notes\"></textarea>\n                                </div>\n                            </div>\n                        </div>\n                        <div class=\"modal-footer\">\n                            <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button>\n                            <button type=\"submit\" name=\"add_salary\" class=\"btn btn-custom\">Add Salary</button>\n                        </div>\n                    </form>\n                </div>\n            </div>\n        </div>\n\n        <!-- Edit Salary Modal (Loaded via AJAX) -->\n        <div class=\"modal fade\" id=\"editSalaryModal\" tabindex=\"-1\" aria-labelledby=\"editSalaryModalLabel\" aria-hidden=\"true\">\n            <div class=\"modal-dialog modal-lg\">\n                <div class=\"modal-content\">\n                    <!-- Content will be loaded dynamically -->\n                </div>\n            </div>\n        </div>\n\n        <!-- Bootstrap JS, DataTables JS, Font Awesome, SweetAlert2 JS, jsPDF, and Custom JS -->\n        <script src=\"https://code.jquery.com/jquery-3.6.0.min.js\"></script>\n        <script src=\"https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.7/dist/umd/popper.min.js\" integrity=\"sha384-...\" crossorigin=\"anonymous\"></script>\n        <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js\"></script>\n        <script src=\"https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js\"></script>\n        <script src=\"https://cdn.datatables.net/1.13.5/js/dataTables.bootstrap5.min.js\"></script>\n        <script src=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js\"></script>\n        <script src=\"https://cdn.jsdelivr.net/npm/sweetalert2@11.7.3/dist/sweetalert2.all.min.js\"></script>\n        <!-- jsPDF for PDF export -->\n        <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js\"></script>\n        <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js\"></script>\n        <!-- Custom Scripts -->\n        <script src=\"../assets/js/scripts.js\"></script>\n        <script>\n            $(document).ready(function() {\n                // Initialize DataTable\n                var table = $('#salariesTable').DataTable({\n                    \"order\": [[ 9, \"desc\" ]], // Order by Payment Date descending\n                    \"columnDefs\": [\n                        { \"orderable\": false, \"targets\": [0, 12] } // Disable ordering on checkbox and actions\n                    ],\n                    \"pageLength\": 10,\n                    \"lengthMenu\": [5, 10, 25, 50, 100],\n                    \"language\": {\n                        \"search\": \"Search Salaries:\",\n                        \"lengthMenu\": \"Show _MENU_ entries\",\n                        \"zeroRecords\": \"No matching records found\",\n                        \"info\": \"Showing _START_ to _END_ of _TOTAL_ salaries\",\n                        \"infoEmpty\": \"Showing 0 to 0 of 0 salaries\",\n                        \"infoFiltered\": \"(filtered from _MAX_ total salaries)\"\n                    }\n                });\n\n                // Handle Select All checkbox\n                $('#select_all').on('click', function(){\n                    var rows = table.rows({ 'search': 'applied' }).nodes();\n                    $('input[type=\"checkbox\"]', rows).prop('checked', this.checked);\n                    toggleBulkButtons();\n                });\n\n                // Handle individual checkbox click\n                $('#salariesTable tbody').on('change', 'input.salary_checkbox', function(){\n                    if(!this.checked){\n                        var el = $('#select_all').get(0);\n                        if(el && el.checked && ('indeterminate' in el)){\n                            el.indeterminate = true;\n                        }\n                    }\n                    toggleBulkButtons();\n                });\n\n                // Toggle Bulk Action Buttons\n                function toggleBulkButtons(){\n                    var selected = $('input.salary_checkbox:checked').length;\n                    if(selected > 0){\n                        $('#bulk_delete, #bulk_mark_paid').prop('disabled', false);\n                    } else {\n                        $('#bulk_delete, #bulk_mark_paid').prop('disabled', true);\n                    }\n                }\n\n                // Bulk Delete Salaries\n                $('#bulk_delete').on('click', function(){\n                    var selected_ids = [];\n                    $('input.salary_checkbox:checked').each(function(){\n                        selected_ids.push($(this).val());\n                    });\n\n                    Swal.fire({\n                        title: 'Are you sure?',\n                        text: `You are about to delete ${selected_ids.length} salary record(s). This action cannot be undone.`,\n                        icon: 'warning',\n                        showCancelButton: true,\n                        confirmButtonColor: '#dc3545',\n                        cancelButtonColor: '#6c757d',\n                        confirmButtonText: 'Yes, delete them!'\n                    }).then((result) => {\n                        if (result.isConfirmed) {\n                            // Submit form via AJAX\n                            $.ajax({\n                                url: 'bulk_actions.php',\n                                type: 'POST',\n                                data: {\n                                    action: 'delete',\n                                    salary_ids: selected_ids,\n                                    csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                                },\n                                success: function(response){\n                                    var res = JSON.parse(response);\n                                    if(res.status === 'success'){\n                                        Swal.fire(\n                                            'Deleted!',\n                                            res.message,\n                                            'success'\n                                        ).then(() => {\n                                            location.reload();\n                                        });\n                                    } else {\n                                        Swal.fire(\n                                            'Error!',\n                                            res.message,\n                                            'error'\n                                        );\n                                    }\n                                }\n                            });\n                        }\n                    });\n                });\n\n                // Bulk Mark as Paid\n                $('#bulk_mark_paid').on('click', function(){\n                    var selected_ids = [];\n                    $('input.salary_checkbox:checked').each(function(){\n                        if($(this).closest('tr').find('span.badge').text() === 'Pending'){\n                            selected_ids.push($(this).val());\n                        }\n                    });\n\n                    if(selected_ids.length === 0){\n                        Swal.fire(\n                            'No Pending Salaries',\n                            'Selected salaries are already marked as paid.',\n                            'info'\n                        );\n                        return;\n                    }\n\n                    Swal.fire({\n                        title: 'Mark as Paid?',\n                        text: `You are about to mark ${selected_ids.length} salary record(s) as Paid.`,\n                        icon: 'question',\n                        showCancelButton: true,\n                        confirmButtonColor: '#28a745',\n                        cancelButtonColor: '#6c757d',\n                        confirmButtonText: 'Yes, mark them!'\n                    }).then((result) => {\n                        if (result.isConfirmed) {\n                            // Submit form via AJAX\n                            $.ajax({\n                                url: 'bulk_actions.php',\n                                type: 'POST',\n                                data: {\n                                    action: 'mark_paid',\n                                    salary_ids: selected_ids,\n                                    csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                                },\n                                success: function(response){\n                                    var res = JSON.parse(response);\n                                    if(res.status === 'success'){\n                                        Swal.fire(\n                                            'Success!',\n                                            res.message,\n                                            'success'\n                                        ).then(() => {\n                                            location.reload();\n                                        });\n                                    } else {\n                                        Swal.fire(\n                                            'Error!',\n                                            res.message,\n                                            'error'\n                                        );\n                                    }\n                                }\n                            });\n                        }\n                    });\n                });\n\n                // Delete Salary (Single)\n                $('.delete_salary_btn').on('click', function(){\n                    var salary_id = $(this).data('id');\n                    Swal.fire({\n                        title: 'Are you sure?',\n                        text: \"You are about to delete this salary record.\",\n                        icon: 'warning',\n                        showCancelButton: true,\n                        confirmButtonColor: '#dc3545',\n                        cancelButtonColor: '#6c757d',\n                        confirmButtonText: 'Yes, delete it!'\n                    }).then((result) => {\n                        if (result.isConfirmed) {\n                            // Submit delete via AJAX\n                            $.ajax({\n                                url: 'delete_salary.php',\n                                type: 'POST',\n                                data: {\n                                    salary_id: salary_id,\n                                    csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                                },\n                                success: function(response){\n                                    var res = JSON.parse(response);\n                                    if(res.status === 'success'){\n                                        Swal.fire(\n                                            'Deleted!',\n                                            res.message,\n                                            'success'\n                                        ).then(() => {\n                                            location.reload();\n                                        });\n                                    } else {\n                                        Swal.fire(\n                                            'Error!',\n                                            res.message,\n                                            'error'\n                                        );\n                                    }\n                                }\n                            });\n                        }\n                    });\n                });\n\n                // Mark as Paid (Single)\n                $('.mark_paid_btn').on('click', function(){\n                    var salary_id = $(this).data('id');\n                    Swal.fire({\n                        title: 'Mark as Paid?',\n                        text: \"You are about to mark this salary as Paid.\",\n                        icon: 'question',\n                        showCancelButton: true,\n                        confirmButtonColor: '#28a745',\n                        cancelButtonColor: '#6c757d',\n                        confirmButtonText: 'Yes, mark it!'\n                    }).then((result) => {\n                        if (result.isConfirmed) {\n                            // Submit mark as paid via AJAX\n                            $.ajax({\n                                url: 'mark_paid.php',\n                                type: 'POST',\n                                data: {\n                                    salary_id: salary_id,\n                                    csrf_token: '<?php echo sanitize_output($_SESSION['csrf_token']); ?>'\n                                },\n                                success: function(response){\n                                    var res = JSON.parse(response);\n                                    if(res.status === 'success'){\n                                        Swal.fire(\n                                            'Marked!',\n                                            res.message,\n                                            'success'\n                                        ).then(() => {\n                                            location.reload();\n                                        });\n                                    } else {\n                                        Swal.fire(\n                                            'Error!',\n                                            res.message,\n                                            'error'\n                                        );\n                                    }\n                                }\n                            });\n                        }\n                    });\n                });\n\n                // Calculate Net Salary on Input Change\n                $('#addSalaryModal').on('input', '#basic_salary, #bonuses, #deductions, #overtime_hours, #overtime_rate, #tax', function(){\n                    var basic = parseFloat($('#basic_salary').val()) || 0;\n                    var bonuses = parseFloat($('#bonuses').val()) || 0;\n                    var deductions = parseFloat($('#deductions').val()) || 0;\n                    var overtime_hours = parseFloat($('#overtime_hours').val()) || 0;\n                    var overtime_rate = parseFloat($('#overtime_rate').val()) || 0;\n                    var tax = parseFloat($('#tax').val()) || 0;\n\n                    var net_salary = (basic + bonuses + (overtime_hours * overtime_rate)) - (deductions + tax);\n                    $('#net_salary').val(net_salary.toFixed(2));\n                });\n\n                // Export to CSV\n                $('#export_csv').on('click', function(){\n                    var csv_data = [];\n                    var headers = [];\n                    $('#salariesTable thead tr th').each(function(){\n                        headers.push($(this).text().trim());\n                    });\n                    csv_data.push(headers.join(','));\n\n                    table.rows({ search: 'applied' }).every(function(){\n                        var data = this.data();\n                        var row = [];\n                        for(var i=0; i< data.length; i++){\n                            row.push('\"' + data[i].replace(/\"/g, '\"\"') + '\"');\n                        }\n                        csv_data.push(row.join(','));\n                    });\n\n                    var csv_string = csv_data.join('\\n');\n                    var a = document.createElement('a');\n                    a.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv_string);\n                    a.download = 'salaries.csv';\n                    document.body.appendChild(a);\n                    a.click();\n                    document.body.removeChild(a);\n                });\n\n                // Export to PDF using jsPDF and AutoTable\n                $('#export_pdf').on('click', function(){\n                    var { jsPDF } = window.jspdf;\n                    var doc = new jsPDF();\n                    doc.text(\"Salaries Report\", 14, 16);\n                    var columns = [];\n                    $('#salariesTable thead tr th').each(function(){\n                        columns.push($(this).text().trim());\n                    });\n                    var rows = [];\n                    table.rows({ search: 'applied' }).every(function(){\n                        var data = this.data();\n                        var row = data.map(item => item.toString());\n                        rows.push(row);\n                    });\n                    doc.autoTable({\n                        head: [columns],\n                        body: rows,\n                        startY: 20,\n                        styles: { font: \"Poppins\" }\n                    });\n                    doc.save('salaries.pdf');\n                });\n\n                // Load Edit Salary Modal via AJAX\n                $('#salariesTable').on('click', '.edit_salary_btn', function(){\n                    var salary_id = $(this).data('id');\n                    $.ajax({\n                        url: 'edit_salary_form.php',\n                        type: 'GET',\n                        data: { id: salary_id },\n                        success: function(response){\n                            $('#editSalaryModal .modal-content').html(response);\n                            $('#editSalaryModal').modal('show');\n                        }\n                    });\n                });\n            });\n\n            // Dark Mode Toggle\n            document.getElementById('toggleDarkMode').addEventListener('click', function() {\n                document.body.classList.toggle('dark-mode');\n                // Save preference in localStorage\n                if(document.body.classList.contains('dark-mode')) {\n                    localStorage.setItem('theme', 'dark');\n                    this.innerHTML = '<i class=\"fas fa-sun\"></i>';\n                } else {\n                    localStorage.setItem('theme', 'light');\n                    this.innerHTML = '<i class=\"fas fa-moon\"></i>';\n                }\n            });\n\n            // Load theme preference on page load\n            document.addEventListener('DOMContentLoaded', function() {\n                const theme = localStorage.getItem('theme');\n                if(theme === 'dark') {\n                    document.body.classList.add('dark-mode');\n                    document.getElementById('toggleDarkMode').innerHTML = '<i class=\"fas fa-sun\"></i>';\n                }\n            });\n        </script>\n    </body>\n</html> ), make it cool design and when  i delete payment, the page make refresh and make it cool and fix generate_payslip.php (<?php\n// accountant/generate_payslip.php\n\nsession_start();\nrequire_once '../db_connect.php';\nrequire_once '../assets/libraries/tcpdf/tcpdf.php';\n\n// Function to sanitize output\nfunction sanitize_output($data) {\n    return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');\n}\n\n// Check if the accountant is logged in\nif (!isset($_SESSION['accountant_id'])) {\n    header(\"Location: ../auth/login.php\");\n    exit();\n}\n\n// Check if salary ID is provided\nif (!isset($_GET['id'])) {\n    $_SESSION['error'] = \"No salary record selected.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\n$salary_id = (int)$_GET['id'];\n\nif ($salary_id <= 0) {\n    $_SESSION['error'] = \"Invalid Salary ID.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n\ntry {\n    // Fetch the salary record along with employee details\n    $stmt = $pdo->prepare(\"\n        SELECT salaries.*, employees.name, employees.role, employees.email, employees.department\n        FROM salaries\n        JOIN employees ON salaries.employee_id = employees.id\n        WHERE salaries.id = :id\n    \");\n    $stmt->execute([':id' => $salary_id]);\n    $salary = $stmt->fetch();\n\n    if (!$salary) {\n        $_SESSION['error'] = \"Salary record not found.\";\n        header(\"Location: manage_salaries.php\");\n        exit();\n    }\n\n    // Initialize TCPDF\n    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);\n\n    // Set Document Information\n    $pdf->SetCreator('Salary Management System');\n    $pdf->SetAuthor('Your Company Name');\n    $pdf->SetTitle('Salary Payslip');\n    $pdf->SetSubject('Payslip for ' . $salary['name']);\n\n    // Remove default header/footer\n    $pdf->setPrintHeader(false);\n    $pdf->setPrintFooter(false);\n\n    // Set margins\n    $pdf->SetMargins(15, 15, 15, true);\n\n    // Add a page\n    $pdf->AddPage();\n\n    // Styles\n    $style = '<style>\n                body { font-family: DejaVu Sans, sans-serif; }\n                .header { text-align: center; }\n                .header h2 { margin-bottom: -10px; }\n                .header p { margin-top: 0; }\n                table { width: 100%; border-collapse: collapse; margin-top: 20px; }\n                table, th, td { border: 1px solid #000; }\n                th, td { padding: 8px 12px; }\n                .total { font-weight: bold; }\n                .notes { margin-top: 20px; }\n              </style>';\n\n    // Header Content\n    $header = '\n        <div class=\"header\">\n            <h2>Your Company Name</h2>\n            <p>1234 Street Address, City, Country</p>\n            <h4>Payslip</h4>\n        </div>';\n\n    // Employee and Salary Details\n    $details = '\n        <table>\n            <tr>\n                <td><strong>Employee Name:</strong> ' . sanitize_output($salary['name']) . '</td>\n                <td><strong>Role:</strong> ' . sanitize_output($salary['role']) . '</td>\n            </tr>\n            <tr>\n                <td><strong>Department:</strong> ' . sanitize_output($salary['department']) . '</td>\n                <td><strong>Email:</strong> ' . sanitize_output($salary['email']) . '</td>\n            </tr>\n            <tr>\n                <td><strong>Payment Date:</strong> ' . sanitize_output($salary['payment_date']) . '</td>\n                <td><strong>Status:</strong> ' . sanitize_output($salary['status']) . '</td>\n            </tr>\n        </table>';\n\n    // Salary Breakdown\n    $breakdown = '\n        <table>\n            <thead>\n                <tr>\n                    <th>Description</th>\n                    <th>Amount ($)</th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr>\n                    <td>Basic Salary</td>\n                    <td>' . number_format($salary['basic_salary'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Bonuses</td>\n                    <td>' . number_format($salary['bonuses'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Overtime (' . $salary['overtime_hours'] . ' hrs)</td>\n                    <td>' . number_format($salary['overtime_hours'] * $salary['overtime_rate'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Deductions</td>\n                    <td>' . number_format($salary['deductions'], 2) . '</td>\n                </tr>\n                <tr>\n                    <td>Tax</td>\n                    <td>' . number_format($salary['tax'], 2) . '</td>\n                </tr>\n                <tr class=\"total\">\n                    <td>Net Salary</td>\n                    <td>' . number_format($salary['net_salary'], 2) . '</td>\n                </tr>\n            </tbody>\n        </table>';\n\n    // Notes\n    $notes = '\n        <div class=\"notes\">\n            <strong>Notes:</strong>\n            <p>' . nl2br(sanitize_output($salary['notes'])) . '</p>\n        </div>';\n\n    // Assemble the PDF content\n    $html = $style . $header . $details . $breakdown . $notes;\n\n    // Output the HTML content\n    $pdf->writeHTML($html, true, false, true, false, '');\n\n    // Define the file name\n    $pdf_file = '../accountant/upload/payslips/payslip_' . $salary['id'] . '.pdf';\n\n    // Create directory if not exists\n    if (!is_dir('../accountant/upload/payslips/')) {\n        mkdir('../accountant/upload/payslips/', 0777, true);\n    }\n\n    // Save the PDF to the server\n    $pdf->Output($pdf_file, 'F');\n\n    // Update the payslip_path in the database\n    $updateStmt = $pdo->prepare(\"UPDATE salaries SET payslip_path = :path WHERE id = :id\");\n    $updateStmt->execute([\n        ':path' => $pdf_file,\n        ':id' => $salary_id,\n    ]);\n\n    // Force download the PDF\n    header('Content-Type: application/pdf');\n    header('Content-Disposition: attachment; filename=\"payslip_' . $salary['id'] . '.pdf\"');\n    readfile($pdf_file);\n    exit();\n} else {\n    // Invalid request\n    $_SESSION['error'] = \"Invalid request.\";\n    header(\"Location: manage_salaries.php\");\n    exit();\n}\n?>) and type full codes and this info database (Updated Database Structure\nThe database for the admin dashboard and patient management system consists of the following tables:\na. Patients\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each patient.\nname (VARCHAR): Full name of the patient.\nage (INT): Age of the patient.\ngender (ENUM('Male', 'Female', 'Other')): Gender of the patient.\nphone (VARCHAR): Phone number of the patient.\nemail (VARCHAR): Email address of the patient.\nmedical_history (TEXT): Medical history of the patient.\ndate_of_birth (DATE): Date of birth of the patient.\nregistration_date (DATE): Date when the patient was registered.\nregistration_datetime (DATETIME): Date and time when the patient was registered.\nstatus (ENUM): Current status of the patient (e.g., 'Initial Consultation', 'Treatment in Progress').\nb. Health Records\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each health record.\npatient_id (INT, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this health record.\nblood_pressure (VARCHAR): Blood pressure reading.\nweight (DECIMAL): Weight of the patient.\nbmi (DECIMAL): Body Mass Index of the patient.\ncholesterol (DECIMAL): Cholesterol level of the patient.\nprescription (TEXT): Prescriptions given to the patient.\ntreatment_progress (TEXT): Notes on the treatment progress.\nrecord_date (DATE): Date of the health record.\nc. Admins\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each admin.\nusername (VARCHAR): Admin's username.\npassword (VARCHAR): Hashed password for the admin.\nemail (VARCHAR): Email address of the admin.\nd. Patient Logins\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each patient login.\npatient_id (INT, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this login.\nusername (VARCHAR): Username for patient login.\npassword (VARCHAR): Hashed password for patient login.\ne. Invoices\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each invoice.\npatient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this invoice.\nservice_name (VARCHAR(255) NOT NULL): Name of the service rendered.\nservice_description (TEXT): Description of the service.\ncost (DECIMAL(10, 2) NOT NULL): Cost of the service.\ntax_rate (DECIMAL(5, 2) DEFAULT 0): Tax rate applied to the service.\ndiscount (DECIMAL(5, 2) DEFAULT 0): Discount applied to the service.\ntotal_amount (DECIMAL(10, 2) NOT NULL): Total amount due after tax and discount.\ninvoice_date (DATE DEFAULT CURRENT_DATE): Date of the invoice.\nnotes (TEXT): Additional notes for the invoice.\nf. Services\nservice_id (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each service.\nservice_name (VARCHAR(255) NOT NULL): Name of the service.\nservice_price (DECIMAL(10, 2) NOT NULL): Price of the service.\nservice_description (TEXT): Description of the service.\ncreated_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP): Timestamp when the service was created.\nupdated_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP): Timestamp when the service was last updated.\ng. Invoice Services\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each entry in the invoice services table.\ninvoice_id (INT NOT NULL, FOREIGN KEY REFERENCES invoices(id)): ID of the associated invoice.\nservice_id (INT NOT NULL, FOREIGN KEY REFERENCES services(service_id)): ID of the associated service.\nservice_name (VARCHAR(255) NOT NULL): Name of the service rendered.\ncost (DECIMAL(10, 2) NOT NULL): Cost of the service rendered.\nh. Comments\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each comment.\npatient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with the comment.\nsender (ENUM('patient', 'doctor', 'admin') NOT NULL): Sender of the comment, which can be 'patient', 'doctor', or 'admin'.\nmessage (TEXT NOT NULL): The message or comment content.\ntimestamp (DATETIME DEFAULT CURRENT_TIMESTAMP): Date and time the comment was made.\nparent_id (INT NULL DEFAULT NULL): ID of the parent comment (for threaded conversations), if applicable.\ni. Doctor-Patient\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each doctor-patient relationship.\ndoctor_id (INT NOT NULL, FOREIGN KEY REFERENCES doctors(id)): ID of the associated doctor.\npatient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the associated patient.\nUNIQUE (doctor_id, patient_id): Ensures a unique doctor-patient pair.\nj. Employees\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each employee.\nname (VARCHAR(255) NOT NULL): Full name of the employee.\nrole (ENUM('admin', 'doctor', 'staff') NOT NULL): Role of the employee, which can be 'admin', 'doctor', or 'staff'.\nemail (VARCHAR(255) NOT NULL UNIQUE): Email address of the employee, ensuring it is unique.\nphone (VARCHAR(20)): Phone number of the employee.\ndepartment (VARCHAR(100)): Department where the employee works.\ndate_of_joining (DATE): The date when the employee joined the organization.\nstatus (ENUM('active', 'inactive') DEFAULT 'active'): Employment status, either 'active' or 'inactive', with 'active' as the default.\nusername (VARCHAR(100) NOT NULL UNIQUE): Username for employee login, ensuring it is unique.\npassword (VARCHAR(255) NOT NULL): Hashed password for the employee.\ncreated_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP): Timestamp when the employee record was created.\nupdated_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP): Timestamp when the employee record was last updated.\nprofile_picture (VARCHAR(255) DEFAULT 'default_profile.png'): Profile picture of the employee.\nspecialization (VARCHAR(255) DEFAULT NULL): Specialization of the employee.\nk. Doctors\nid (INT, AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each doctor.\nemployee_id (INT NOT NULL, FOREIGN KEY REFERENCES employees(id)): ID of the associated employee record.\ndepartment (VARCHAR(100) DEFAULT NULL): Department where the doctor works.\ndate_of_joining (DATE DEFAULT NULL): The date when the doctor joined the organization.\nstatus (ENUM('active', 'inactive') DEFAULT 'active'): Employment status of the doctor.\nprofile_picture (VARCHAR(255) DEFAULT 'default_profile.png'): Profile picture of the doctor.\nl. Payments\nid (INT AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each payment.\npatient_id (INT NOT NULL, FOREIGN KEY REFERENCES patients(id)): ID of the patient associated with this payment.\ninvoice_id (INT NOT NULL, FOREIGN KEY REFERENCES invoices(id)): ID of the invoice associated with this payment.\namount_paid (DECIMAL(10,2) NOT NULL): Amount paid by the patient.\npayment_date (DATE NOT NULL): Date of the payment.\npayment_method (VARCHAR(50)): Method of payment (e.g., cash, card, insurance).\nnotes (TEXT): Additional notes regarding the payment.\nm. Salaries\nid (INT AUTO_INCREMENT, PRIMARY KEY): Unique identifier for each salary record.\nemployee_id (INT NOT NULL, FOREIGN KEY REFERENCES employees(id)): ID of the employee receiving the salary.\nbasic_salary (DECIMAL(10,2) NOT NULL): Basic salary of the employee.\nbonuses (DECIMAL(10,2) DEFAULT 0): Bonuses added to the salary.\ndeductions (DECIMAL(10,2) DEFAULT 0): Deductions from the salary.\novertime_hours (INT DEFAULT 0): Number of overtime hours worked by the employee.\novertime_rate (DECIMAL(10,2) DEFAULT 0): Rate per overtime hour.\ntax (DECIMAL(10,2) DEFAULT 0): Tax applied to the salary.\npayment_date (DATE NOT NULL): Date of the salary payment.\nnet_salary (DECIMAL(10,2) NOT NULL): Net salary after adjustments.\nstatus (ENUM('Pending', 'Paid') DEFAULT 'Pending'): Status of the salary payment.\nnotes (TEXT): Additional notes for the salary record.\n\n\n\nSQL Updates for Doctors Table\nThe SQL statement ALTER TABLE doctors ADD COLUMN date_of_joining DATE DEFAULT NULL; adds a date_of_joining column to the doctors table, allowing the storage of the date when a doctor joined the organization.\nThe SQL statement ALTER TABLE doctors ADD COLUMN department VARCHAR(100) DEFAULT NULL; adds a department column to the doctors table, enabling the specification of the department where the doctor works.\n)"},{"assistant_initiates":false,"asst_text":"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0427\u0435\u043c \u044f \u043c\u043e\u0433\u0443 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f?","behavior":"degenerate_repetition","conversation_hash":"974e33afb483306c8b772ab247367787","conversation_redacted":false,"conversation_toxic":false,"country":"China","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"gpt-4o-2024-08-06","n_chars":181,"n_turns_in_conversation":1,"n_words":27,"source_row_offset":3476,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:19:54 GMT","turn_id":"d60ddabed537840549c48f2a","turn_index":0,"user_text":"Assistant: \nUser: User: \u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f?\nAssistant: \u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f?\nAssistant:\nAssistant:"},{"assistant_initiates":false,"asst_text":"\u0418\u0437\u0432\u0438\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0435 \u0441\u0435\u0431\u044f \u043f\u043b\u043e\u0445\u043e. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0449\u0438\u0445 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b:\n\n1. **\u0413\u0438\u0434\u0440\u0430\u0442\u0430\u0446\u0438\u044f**: \u041f\u0435\u0439\u0442\u0435 \u043c\u043d\u043e\u0433\u043e \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u2014 \u0432\u043e\u0434\u0430, \u0442\u0440\u0430\u0432\u044f\u043d\u044b\u0435 \u0447\u0430\u0438, \u0431\u0443\u043b\u044c\u043e\u043d\u044b. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0436\u0438\u0436\u0430\u0442\u044c \u0441\u043b\u0438\u0437\u044c \u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0435\u0451 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435.\n\n2. **\u041f\u0430\u0440\u043e\u0432\u044b\u0435 \u0438\u043d\u0433\u0430\u043b\u044f\u0446\u0438\u0438**: \u0412\u0434\u044b\u0445\u0430\u043d\u0438\u0435 \u0442\u0435\u043f\u043b\u043e\u0433\u043e \u043f\u0430\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0443\u0432\u043b\u0430\u0436\u043d\u0438\u0442\u044c \u043d\u043e\u0441\u043e\u0432\u044b\u0435 \u0445\u043e\u0434\u044b \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043f\u0435\u043b\u044c \u044d\u0444\u0438\u0440\u043d\u044b\u0445 \u043c\u0430\u0441\u0435\u043b, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u044d\u0432\u043a\u0430\u043b\u0438\u043f\u0442\u043e\u0432\u043e\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0442\u043e\u043b\u043e\u0432\u043e\u0435, \u043d\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0436\u043e\u0433\u043e\u0432.\n\n3. **\u0421\u043e\u043b\u0435\u0432\u044b\u0435 \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u044b \u0434\u043b\u044f \u043d\u043e\u0441\u0430**: \u041f\u0440\u043e\u043c\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0441\u0430 \u0444\u0438\u0437\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0440\u0430\u0441\u0442\u0432\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0432 \u0430\u043f\u0442\u0435\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043d\u043e\u0441\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u044b \u043e\u0442 \u0441\u043b\u0438\u0437\u0438 \u0438 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0435\u0439.\n\n4. **\u0423\u0432\u043b\u0430\u0436\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0434\u0443\u0445\u0430**: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0432\u043b\u0430\u0436\u043d\u0438\u0442\u0435\u043b\u044f \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u0432 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u044b\u0445\u0430\u043d\u0438\u0435 \u0441\u043b\u0438\u0437\u0438\u0441\u0442\u044b\u0445 \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a \u043d\u043e\u0441\u0430 \u0438 \u0433\u043e\u0440\u043b\u0430.\n\n5. **\u041e\u0442\u0434\u044b\u0445**: \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u043e\u043d \u0438 \u043e\u0442\u0434\u044b\u0445 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0432\u0430\u0448\u0435\u043c\u0443 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043c\u0443 \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f \u0441 \u0438\u043d\u0444\u0435\u043a\u0446\u0438\u0435\u0439.\n\n6. **\u041b\u0451\u0433\u043a\u0438\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f**: \u0415\u0441\u043b\u0438 \u0432\u044b \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0435 \u0441\u0435\u0431\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043b\u0451\u0433\u043a\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043a\u0440\u043e\u0432\u043e\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u0434\u043e\u0440\u043e\u0432\u043b\u0435\u043d\u0438\u044e.\n\n7. **\u0411\u0435\u0437\u0440\u0435\u0446\u0435\u043f\u0442\u0443\u0440\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430**: \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u043f\u0430\u0440\u0430\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0434\u0435\u043a\u043e\u043d\u0433\u0435\u0441\u0442\u0430\u043d\u0442\u044b \u0438\u043b\u0438 \u043e\u0442\u0445\u0430\u0440\u043a\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b. \u041f\u0435\u0440\u0435\u0434 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043a\u043e\u043d\u0441\u0443\u043b\u044c\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0444\u0430\u0440\u043c\u0430\u0446\u0435\u0432\u0442\u043e\u043c \u0438\u043b\u0438 \u0432\u0440\u0430\u0447\u043e\u043c.\n\n\u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0443\u0441\u0438\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0442\u0440\u0435\u0432\u043e\u0436\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u043b\u044c\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u044e \u0432 \u0443\u0448\u0430\u0445, \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043e\u0439, \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0438\u0435\u043c \u0434\u044b\u0445\u0430\u043d\u0438\u044f), \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u0440\u0430\u0447\u0443 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0435\u0434\u0438\u0446\u0438\u043d\u0441\u043a\u043e\u0439 \u043f\u043e\u043c\u043e\u0449\u0438.\n\n\u0411\u0435\u0440\u0435\u0433\u0438\u0442\u0435 \u0441\u0435\u0431\u044f \u0438 \u0432\u044b\u0437\u0434\u043e\u0440\u0430\u0432\u043b\u0438\u0432\u0430\u0439\u0442\u0435!","behavior":"degenerate_repetition","conversation_hash":"3c243cc5ef6543ddf623cfd6ab42966a","conversation_redacted":false,"conversation_toxic":false,"country":"Russia","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"o1-mini-2024-09-12","n_chars":1798,"n_turns_in_conversation":1,"n_words":222,"source_row_offset":3477,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:19:56 GMT","turn_id":"32424b60782bb3070c9cccac","turn_index":0,"user_text":"\u042f \u0437\u0430\u0431\u043e\u043b\u0435\u043b. \u041b\u0435\u0447\u0438\u043b\u0441\u044f, \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441\u043f\u0430\u043b\u0430, \u043d\u043e \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0433\u0443\u0441\u0442\u044b\u0435 \u0441\u043e\u043f\u043b\u0438 \u0432 \u043d\u043e\u0441\u043e\u0433\u043b\u043e\u0442\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u0430\u0448\u0435\u043b\u044c \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0437\u0430\u0442\u0435\u043a\u0430\u0442\u044c \u0432 \u0443\u0448\u0438. \u041f\u043e\u0434\u0441\u043a\u0430\u0436\u0438, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0437 \u0432\u044b\u043b\u0435\u0447\u0438\u0442\u044c."},{"assistant_initiates":false,"asst_text":"\u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u0427\u0435\u043c \u044f \u043c\u043e\u0433\u0443 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c?","behavior":"degenerate_repetition","conversation_hash":"4e1ac335c210d905880f4392b3b10901","conversation_redacted":false,"conversation_toxic":false,"country":"United Arab Emirates","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"gpt-4o-2024-08-06","n_chars":168,"n_turns_in_conversation":1,"n_words":22,"source_row_offset":3478,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:20:12 GMT","turn_id":"89715ed6c98deaf6540e701c","turn_index":0,"user_text":"Assistant: \nUser: User: \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.\nAssistant: \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.\nAssistant:\nAssistant:"},{"assistant_initiates":false,"asst_text":"Hello! It looks like you're testing. How can I help you today?","behavior":"degenerate_repetition","conversation_hash":"ba60cb374f5d356a9578df76f85b4144","conversation_redacted":false,"conversation_toxic":false,"country":"United States","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Estonian","model":"o1-mini-2024-09-12","n_chars":67,"n_turns_in_conversation":1,"n_words":13,"source_row_offset":3479,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:20:15 GMT","turn_id":"e5cd3d48fd3eb743040f919b","turn_index":0,"user_text":"test"},{"assistant_initiates":false,"asst_text":"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0427\u0435\u043c \u043c\u043e\u0433\u0443 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c \u0441\u0435\u0433\u043e\u0434\u043d\u044f? \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c.","behavior":"degenerate_repetition","conversation_hash":"cdd9949ca8c0c21475d7c857c986f0e5","conversation_redacted":false,"conversation_toxic":false,"country":"United States","empty_output":false,"evidence_codes":[],"label":"absent","label_present":false,"label_qualified":false,"label_source":"Final dense release","language":"Russian","model":"gpt-4o-2024-08-06","n_chars":236,"n_turns_in_conversation":1,"n_words":35,"source_row_offset":3480,"source_shard":"turns-00031.parquet","timestamp":"Fri, 04 Oct 2024 06:20:22 GMT","turn_id":"7b7311c3032425abc3bc70a9","turn_index":0,"user_text":"Assistant: \nUser: User: \u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u0427\u0435\u043c \u044f \u043c\u043e\u0433\u0443 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c?\nAssistant: \u041a\u043e\u043d\u0435\u0447\u043d\u043e! \u0427\u0435\u043c \u044f \u043c\u043e\u0433\u0443 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c?\nAssistant:\nAssistant:"}],"shard":{"index":31,"name":"turns-00031.parquet","rows":51455}}
