[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: index.php
<?php require_once '../config/config.php'; requirePermission(); $pageTitle = 'إدارة الورديات'; $db = Database::getInstance(); $userRole = $_SESSION['user_role']; $userId = $_SESSION['user_id']; if ($userRole === 'representative') { $sql = "SELECT s.*, u.name as representative_name, u1.name as start_approved_by_name, u2.name as end_approved_by_name FROM shifts s LEFT JOIN users u ON s.representative_id = u.id LEFT JOIN users u1 ON s.start_approved_by = u1.id LEFT JOIN users u2 ON s.end_approved_by = u2.id WHERE s.representative_id = ? ORDER BY s.created_at DESC"; $shifts = $db->query($sql, [$userId])->fetchAll(); } else { $sql = "SELECT s.*, u.name as representative_name, u1.name as start_approved_by_name, u2.name as end_approved_by_name FROM shifts s LEFT JOIN users u ON s.representative_id = u.id LEFT JOIN users u1 ON s.start_approved_by = u1.id LEFT JOIN users u2 ON s.end_approved_by = u2.id ORDER BY s.created_at DESC"; $shifts = $db->query($sql)->fetchAll(); } $statusLabels = [ 'pending_start' => 'في انتظار الموافقة على البدء', 'active' => 'نشطة', 'pending_end' => 'في انتظار الموافقة على الإغلاق', 'closed' => 'مغلقة' ]; $statusColors = [ 'pending_start' => 'warning', 'active' => 'success', 'pending_end' => 'info', 'closed' => 'secondary' ]; include '../includes/header.php'; ?> <div class="row"> <div class="col-12"> <div class="d-flex justify-content-between align-items-center mb-4"> <h2><i class="bi bi-clock-history"></i> إدارة الورديات</h2> <?php if ($userRole === 'representative'): ?> <a href="request.php" class="btn btn-primary"> <i class="bi bi-plus-lg"></i> طلب وردية جديدة </a> <?php endif; ?> </div> <?php if (isset($_GET['success'])): ?> <div class="alert alert-success alert-dismissible fade show" role="alert"> <?php $messages = [ 'shift_requested' => 'تم إرسال طلب الوردية بنجاح، في انتظار الموافقة', 'shift_approved' => 'تم الموافقة على بداية الوردية', 'end_requested' => 'تم طلب إغلاق الوردية، في انتظار الموافقة', 'shift_closed' => 'تم إغلاق الوردية بنجاح' ]; echo $messages[$_GET['success']] ?? 'تمت العملية بنجاح'; ?> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> </div> <?php endif; ?> <div class="card shadow-sm"> <div class="card-body"> <div class="table-responsive"> <table class="table table-hover"> <thead class="table-light"> <tr> <th>#</th> <th>المندوب</th> <th>الحالة</th> <th>المخزون الأولي</th> <th>الرصيد الأولي</th> <th>وقت البداية</th> <th>وقت الإغلاق</th> <th>الإجراءات</th> </tr> </thead> <tbody> <?php if (empty($shifts)): ?> <tr> <td colspan="8" class="text-center text-muted py-4">لا توجد ورديات</td> </tr> <?php else: ?> <?php foreach ($shifts as $index => $shift): ?> <tr> <td><?php echo $index + 1; ?></td> <td><?php echo htmlspecialchars($shift['representative_name']); ?></td> <td> <span class="badge bg-<?php echo $statusColors[$shift['status']]; ?>"> <?php echo $statusLabels[$shift['status']]; ?> </span> </td> <td><?php echo $shift['start_stock']; ?> وحدة</td> <td><?php echo formatMoney($shift['start_cash']); ?></td> <td> <?php echo $shift['start_time'] ? formatDate($shift['start_time']) : '-'; ?> </td> <td> <?php echo $shift['end_time'] ? formatDate($shift['end_time']) : '-'; ?> </td> <td> <div class="btn-group" role="group"> <a href="view.php?id=<?php echo $shift['id']; ?>" class="btn btn-sm btn-info" title="عرض"> <i class="bi bi-eye"></i> </a> <?php if ($shift['status'] === 'pending_start' && hasPermission(['manager', 'accountant'])): ?> <a href="approve_start.php?id=<?php echo $shift['id']; ?>" class="btn btn-sm btn-success" title="الموافقة على البدء"> <i class="bi bi-check-lg"></i> </a> <?php endif; ?> <?php if ($shift['status'] === 'active' && $shift['representative_id'] == $userId && $userRole === 'representative'): ?> <a href="request_end.php?id=<?php echo $shift['id']; ?>" class="btn btn-sm btn-warning" title="طلب إغلاق الوردية"> <i class="bi bi-stop-circle"></i> </a> <?php endif; ?> <?php if ($shift['status'] === 'pending_end' && hasPermission(['manager', 'accountant'])): ?> <a href="approve_end.php?id=<?php echo $shift['id']; ?>" class="btn btn-sm btn-primary" title="الموافقة على الإغلاق"> <i class="bi bi-check-circle"></i> </a> <?php endif; ?> </div> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> </div> </div> </div> </div> </div> <?php include '../includes/footer.php'; ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.85 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285