Commit 2097bc24 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(hr): add missing shifts form and assignments views

Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 0c9fc89b
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تعيينات الورديات<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<!-- نموذج التعيين -->
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;border-bottom:1px solid #E5E7EB;font-weight:600;">تعيين وردية لموظف</div>
<form method="POST" action="/hr/shifts/assign" style="padding:20px;display:flex;gap:12px;flex-wrap:wrap;align-items:end;">
<?= csrf_field() ?>
<div style="flex:1;min-width:200px;">
<label style="display:block;margin-bottom:4px;font-size:13px;color:#6B7280;">الموظف</label>
<select name="employee_id" class="form-control" required>
<option value="">— اختر موظف —</option>
<?php foreach ($employees as $emp): ?>
<option value="<?= (int) $emp['id'] ?>"><?= e($emp['full_name_ar']) ?> (<?= e($emp['employee_number']) ?>)</option>
<?php endforeach; ?>
</select>
</div>
<div style="min-width:160px;">
<label style="display:block;margin-bottom:4px;font-size:13px;color:#6B7280;">الوردية</label>
<select name="shift_id" class="form-control" required>
<option value="">— اختر وردية —</option>
<?php foreach ($shifts as $s): ?>
<option value="<?= (int) $s['id'] ?>"><?= e($s['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div style="min-width:140px;">
<label style="display:block;margin-bottom:4px;font-size:13px;color:#6B7280;">تاريخ البداية</label>
<input type="date" name="start_date" value="<?= date('Y-m-d') ?>" class="form-control">
</div>
<div style="min-width:140px;">
<label style="display:block;margin-bottom:4px;font-size:13px;color:#6B7280;">تاريخ النهاية</label>
<input type="date" name="end_date" value="" class="form-control">
<small style="color:#6B7280;font-size:11px;">اتركه فارغ لتعيين دائم</small>
</div>
<div style="min-width:140px;">
<label style="display:block;margin-bottom:4px;font-size:13px;color:#6B7280;">النمط</label>
<select name="rotation_pattern" class="form-control">
<option value="fixed">ثابت</option>
<option value="rotating">دوري</option>
</select>
</div>
<button type="submit" class="btn btn-primary">تعيين</button>
</form>
</div>
<!-- جدول التعيينات -->
<div class="card">
<div class="table-responsive">
<table class="data-table">
<thead>
<tr><th>الموظف</th><th>الرقم الوظيفي</th><th>الوردية</th><th>من</th><th>إلى</th><th>النمط</th></tr>
</thead>
<tbody>
<?php if (empty($assignments)): ?>
<tr><td colspan="6" style="text-align:center;padding:40px;color:#9CA3AF;">لا يوجد تعيينات</td></tr>
<?php else: ?>
<?php foreach ($assignments as $a): ?>
<tr>
<td><?= e($a['employee_name']) ?></td>
<td><code><?= e($a['employee_number']) ?></code></td>
<td><?= e($a['shift_name']) ?></td>
<td><?= e($a['start_date'] ?? '-') ?></td>
<td><?= e($a['end_date'] ?? 'دائم') ?></td>
<td><?= ($a['rotation_pattern'] ?? 'fixed') === 'rotating' ? 'دوري' : 'ثابت' ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?php $__template->endSection(); ?>
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?><?= $shift ? 'تعديل الوردية' : 'إضافة وردية' ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<?php
$isEdit = $shift !== null;
$action = $isEdit ? '/hr/shifts/' . $shift['id'] . '/update' : '/hr/shifts';
$v = fn(string $key, $default = '') => e(old($key) ?? ($shift[$key] ?? $default));
$checked = fn(string $key, $default = 0) => ((int)(old($key) ?? ($shift[$key] ?? $default))) ? 'checked' : '';
?>
<form method="POST" action="<?= $action ?>" style="max-width:700px;">
<?= csrf_field() ?>
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;border-bottom:1px solid #E5E7EB;font-weight:600;">بيانات الوردية</div>
<div style="padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:16px;">
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">اسم الوردية بالعربي <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= $v('name_ar') ?>" class="form-control" placeholder="الوردية الصباحية" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">اسم الوردية بالإنجليزي</label>
<input type="text" name="name_en" value="<?= $v('name_en') ?>" class="form-control" placeholder="Morning Shift" dir="ltr" style="text-align:left;">
</div>
</div>
</div>
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;border-bottom:1px solid #E5E7EB;font-weight:600;">مواعيد العمل</div>
<div style="padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:16px;">
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">وقت البداية <span style="color:#DC2626;">*</span></label>
<input type="time" name="start_time" value="<?= $v('start_time') ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">وقت النهاية <span style="color:#DC2626;">*</span></label>
<input type="time" name="end_time" value="<?= $v('end_time') ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">بداية الاستراحة</label>
<input type="time" name="break_start" value="<?= $v('break_start') ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">نهاية الاستراحة</label>
<input type="time" name="break_end" value="<?= $v('break_end') ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">مدة الاستراحة (دقيقة)</label>
<input type="number" name="break_duration_minutes" value="<?= $v('break_duration_minutes', '0') ?>" class="form-control" min="0">
</div>
</div>
</div>
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;border-bottom:1px solid #E5E7EB;font-weight:600;">الإعدادات</div>
<div style="padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:16px;">
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">فترة السماح للتأخير (دقيقة)</label>
<input type="number" name="grace_period_minutes" value="<?= $v('grace_period_minutes', '15') ?>" class="form-control" min="0">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">حد الانصراف المبكر (دقيقة)</label>
<input type="number" name="early_leave_threshold_minutes" value="<?= $v('early_leave_threshold_minutes', '15') ?>" class="form-control" min="0">
</div>
<div style="display:flex;align-items:center;gap:8px;padding-top:20px;">
<input type="hidden" name="is_night_shift" value="0">
<input type="checkbox" name="is_night_shift" value="1" id="is_night_shift" <?= $checked('is_night_shift', 0) ?> style="width:18px;height:18px;">
<label for="is_night_shift" style="font-size:13px;font-weight:500;cursor:pointer;">وردية ليلية</label>
</div>
</div>
</div>
<div style="display:flex;gap:12px;justify-content:flex-start;">
<button type="submit" class="btn btn-primary"><?= $isEdit ? 'حفظ التعديلات' : 'إضافة الوردية' ?></button>
<a href="/hr/shifts" class="btn btn-secondary">إلغاء</a>
</div>
</form>
<?php $__template->endSection(); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment