<?php
require_once 'db_connect.php';

$user_id = 5; // user_id للمستخدم Ahmed
$screens = [
    'suppliers', 'customers', 'employee_management', 'salary_payment', 'employee_report',
    'items', 'categories', 'units', 'barcode_printing', 'item_movement',
    'sales_invoice', 'sales_invoices', 'pending_invoices', 'sales_return', 'sales_return_invoices',
    'purchase_invoice', 'purchase_invoices', 'purchase_return', 'purchase_return_invoices',
    'safe', 'safe_add_edit', 'safe_transfer', 'daily_revenue', 'expenses', 'expense_types',
    'add_store', 'store_transfer', 'store_inventory', 'settings', 'users', 'backup', 'activation',
    'item_search', 'inventory', 'stores', 'shift_close', 'contact_us'
];

try {
    $stmt = $conn->prepare("INSERT INTO permissions (user_id, screen, access) VALUES (:user_id, :screen, 1)");
    foreach ($screens as $screen) {
        $stmt->execute([':user_id' => $user_id, ':screen' => $screen]);
    }
    echo "تم منح الصلاحيات الكاملة للمستخدم eslam بنجاح!";
} catch (PDOException $e) {
    echo "خطأ أثناء منح الصلاحيات: " . $e->getMessage();
}
?>