$acc) {
if (
str_contains(strtolower((string)$acc['name_ar']), $lowerSearch) ||
str_contains(strtolower((string)$acc['name_en']), $lowerSearch) ||
str_contains(strtolower((string)$acc['username']), $lowerSearch)
) {
$filteredAccounts[$key] = $acc;
}
}
} else {
$filteredAccounts = $allAccounts;
}
// Pagination logic
$page = max(1, (int)($_GET['p'] ?? 1));
$limit = 10;
$total = count($filteredAccounts);
$totalPages = max(1, ceil($total / $limit));
$offset = ($page - 1) * $limit;
$accounts = array_slice($filteredAccounts, $offset, $limit, true);
require __DIR__ . '/includes/header.php';
?>
= h(tr('الإصدار الأول يستخدم حسابات تجريبية منفصلة لإثبات هيكل الصلاحيات قبل ربط المستخدمين بقاعدة البيانات.', 'This first version uses separate demo accounts to prove the permissions model before wiring users into the database.')) ?>= h(tr('الوصول حسب الدور', 'Role-based access')) ?>
= h(tr('المستخدم', 'User')) ?>
= h(tr('الدور', 'Role')) ?>
= h(tr('الفرع', 'Branch')) ?>
POS
= h(tr('تقارير', 'Reports')) ?>
= h(tr('مستخدمون', 'Users')) ?>
= h(tr('إجراءات', 'Actions')) ?>
$account): ?>
= h(tr('لا توجد بيانات', 'No data found')) ?>
= h(role_label($account['role'])) ?>
= h(branch_label($account['branch_code'])) ?>
= h(tr('نعم', 'Yes')) ?>
= h(in_array($account['role'], ['owner', 'manager'], true) ? tr('نعم', 'Yes') : tr('لا', 'No')) ?>
= h($account['role'] === 'owner' ? tr('نعم', 'Yes') : tr('لا', 'No')) ?>