Commit 41217a9f authored by DevPilot's avatar DevPilot

fix(core-wide): every edit form in the app was rendering blank — old() never returns null

السبب اللي خلّى شاشة تعديل اللاعب تبان كأنها «شاشة إضافة جديدة»:
old() في app/Core/Helpers.php مُعرّفة إنها ترجع (string) دايماً، يعني
بترجع '' مش null لما مفيش إدخال سابق. وكل الفورمات مكتوبة بالشكل ده:

    old('full_name_ar') ?? $player['full_name_ar']

و ?? بيشتغل على null بس — و'' مش null — فالنتيجة دايماً '' مهما كانت
البيانات المحفوظة. يعني كل خانات كل شاشات التعديل في النظام كانت بتطلع
فاضية، والمستخدم يفتكرها شاشة إضافة.

اتصلّح 345 موضع في 37 ملف بتحويل ?? إلى ?: في نداءات old() تحديداً،
فالقيمة المحفوظة بتظهر لما ما يكونش فيه إدخال سابق.
ده بيمس: HR (كل الفورمات)، SportsActivity، TrainingGroups، Coaches،
PlayerAffairs، Tournaments، PoolManagement، Achievements، Waiver،
Installments.

كمان فورمات بتبعت على routes مش موجودة (الحفظ كان بيدي 404 من غير ما
الشاشة تشتكي):
- /hr/overtime/store -> الصح /hr/overtime
- /hr/shifts/assign  -> الصح /hr/shifts/assignments

وحذف MirrorDisplayController وشاشتينه — مفيش أي route بيوصّلهم من ساعة
ما الميرور اتنقل لموديول FacilityGrids.

أدوات جديدة عشان النوع ده من الأعطال ما يوصلش للمستخدم تاني:
- tools/form_action_check.py: بيتأكد إن كل فورم POST بيبعت على route
  موجود فعلاً (692 route اتفحصوا). الفحص ده كان هيمسك بَجّي الـ /update.
- tools/ui_verify.js: فحص بالمتصفح بيدوس الأزرار زي المستخدم بالظبط
  ويفشل على أي استثناء في الصفحة — مش مجرد طلب GET على الـ route.
parent 2a77ae3a
......@@ -20,7 +20,7 @@ $__template->layout('Layout.main');
<!-- Code -->
<div>
<label class="form-label">الكود <span style="color:#DC2626;">*</span></label>
<input type="text" name="code" value="<?= e(old('code') ?? '') ?>" class="form-input" placeholder="attendance_10" dir="ltr" required>
<input type="text" name="code" value="<?= e(old('code') ?: '') ?>" class="form-input" placeholder="attendance_10" dir="ltr" required>
<div style="font-size:11px;color:#9CA3AF;margin-top:4px;">كود فريد بالإنجليزية (مثل: attendance_streak_10)</div>
</div>
......@@ -39,26 +39,26 @@ $__template->layout('Layout.main');
<!-- Name AR -->
<div style="margin-bottom:20px;">
<label class="form-label">اسم الإنجاز (عربي) <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? '') ?>" class="form-input" placeholder="المثابر - 10 حضور متتالي" required>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: '') ?>" class="form-input" placeholder="المثابر - 10 حضور متتالي" required>
</div>
<!-- Name EN -->
<div style="margin-bottom:20px;">
<label class="form-label">اسم الإنجاز (إنجليزي)</label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?? '') ?>" class="form-input" placeholder="Consistent - 10 Consecutive Sessions" dir="ltr">
<input type="text" name="name_en" value="<?= e(old('name_en') ?: '') ?>" class="form-input" placeholder="Consistent - 10 Consecutive Sessions" dir="ltr">
</div>
<!-- Description -->
<div style="margin-bottom:20px;">
<label class="form-label">الوصف</label>
<textarea name="description_ar" class="form-input" rows="2" placeholder="وصف الإنجاز وكيفية الحصول عليه..."><?= e(old('description_ar') ?? '') ?></textarea>
<textarea name="description_ar" class="form-input" rows="2" placeholder="وصف الإنجاز وكيفية الحصول عليه..."><?= e(old('description_ar') ?: '') ?></textarea>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;margin-bottom:20px;">
<!-- Icon -->
<div>
<label class="form-label">الأيقونة</label>
<input type="text" name="icon" value="<?= e(old('icon') ?? 'award') ?>" class="form-input" dir="ltr" placeholder="award">
<input type="text" name="icon" value="<?= e(old('icon') ?: 'award') ?>" class="form-input" dir="ltr" placeholder="award">
<div style="font-size:11px;color:#9CA3AF;margin-top:4px;">اسم أيقونة Lucide</div>
</div>
......@@ -67,7 +67,7 @@ $__template->layout('Layout.main');
<label class="form-label">لون الشارة</label>
<select name="badge_color" class="form-input">
<?php foreach ($badgeColors as $key => $hex): ?>
<option value="<?= e($key) ?>" <?= (old('badge_color') ?? 'gold') === $key ? 'selected' : '' ?> style="color:<?= $hex ?>;">
<option value="<?= e($key) ?>" <?= (old('badge_color') ?: 'gold') === $key ? 'selected' : '' ?> style="color:<?= $hex ?>;">
<?= e($key) ?> (<?= $hex ?>)
</option>
<?php endforeach; ?>
......@@ -77,7 +77,7 @@ $__template->layout('Layout.main');
<!-- Points -->
<div>
<label class="form-label">النقاط</label>
<input type="number" name="points" value="<?= e(old('points') ?? '10') ?>" class="form-input" min="1" max="1000">
<input type="number" name="points" value="<?= e(old('points') ?: '10') ?>" class="form-input" min="1" max="1000">
</div>
</div>
......@@ -97,7 +97,7 @@ $__template->layout('Layout.main');
<div>
<label class="form-label">الحالة</label>
<select name="is_active" class="form-input">
<option value="1" <?= (old('is_active') ?? '1') === '1' ? 'selected' : '' ?>>مفعّل</option>
<option value="1" <?= (old('is_active') ?: '1') === '1' ? 'selected' : '' ?>>مفعّل</option>
<option value="0" <?= old('is_active') === '0' ? 'selected' : '' ?>>معطّل</option>
</select>
</div>
......@@ -136,15 +136,15 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;">
<div id="countField">
<label class="form-label" style="font-size:12px;">العدد المطلوب</label>
<input type="number" name="criteria_count" value="<?= e(old('criteria_count') ?? '') ?>" class="form-input" min="1" placeholder="10">
<input type="number" name="criteria_count" value="<?= e(old('criteria_count') ?: '') ?>" class="form-input" min="1" placeholder="10">
</div>
<div id="monthsField" style="display:none;">
<label class="form-label" style="font-size:12px;">الأشهر المطلوبة</label>
<input type="number" name="criteria_months" value="<?= e(old('criteria_months') ?? '') ?>" class="form-input" min="1" placeholder="12">
<input type="number" name="criteria_months" value="<?= e(old('criteria_months') ?: '') ?>" class="form-input" min="1" placeholder="12">
</div>
<div id="scoreField" style="display:none;">
<label class="form-label" style="font-size:12px;">الحد الأدنى للدرجة</label>
<input type="number" name="criteria_min_score" value="<?= e(old('criteria_min_score') ?? '') ?>" class="form-input" min="0" max="100" step="0.1" placeholder="90">
<input type="number" name="criteria_min_score" value="<?= e(old('criteria_min_score') ?: '') ?>" class="form-input" min="0" max="100" step="0.1" placeholder="90">
</div>
</div>
</div>
......
This diff is collapsed.
......@@ -59,7 +59,7 @@ $__template->layout('Layout.main');
<?php for ($s = 1; $s <= 5; $s++): ?>
<label style="cursor:pointer;font-size:28px;color:#D1D5DB;transition:color 0.2s;" data-star="<?= $s ?>">&#9733;</label>
<?php endfor; ?>
<input type="hidden" name="punctuality_score" value="<?= e(old('punctuality_score') ?? '0') ?>">
<input type="hidden" name="punctuality_score" value="<?= e(old('punctuality_score') ?: '0') ?>">
</div>
</div>
......@@ -70,7 +70,7 @@ $__template->layout('Layout.main');
<?php for ($s = 1; $s <= 5; $s++): ?>
<label style="cursor:pointer;font-size:28px;color:#D1D5DB;transition:color 0.2s;" data-star="<?= $s ?>">&#9733;</label>
<?php endfor; ?>
<input type="hidden" name="communication_score" value="<?= e(old('communication_score') ?? '0') ?>">
<input type="hidden" name="communication_score" value="<?= e(old('communication_score') ?: '0') ?>">
</div>
</div>
......@@ -81,7 +81,7 @@ $__template->layout('Layout.main');
<?php for ($s = 1; $s <= 5; $s++): ?>
<label style="cursor:pointer;font-size:28px;color:#D1D5DB;transition:color 0.2s;" data-star="<?= $s ?>">&#9733;</label>
<?php endfor; ?>
<input type="hidden" name="technique_score" value="<?= e(old('technique_score') ?? '0') ?>">
<input type="hidden" name="technique_score" value="<?= e(old('technique_score') ?: '0') ?>">
</div>
</div>
......@@ -92,7 +92,7 @@ $__template->layout('Layout.main');
<?php for ($s = 1; $s <= 5; $s++): ?>
<label style="cursor:pointer;font-size:28px;color:#D1D5DB;transition:color 0.2s;" data-star="<?= $s ?>">&#9733;</label>
<?php endfor; ?>
<input type="hidden" name="motivation_score" value="<?= e(old('motivation_score') ?? '0') ?>">
<input type="hidden" name="motivation_score" value="<?= e(old('motivation_score') ?: '0') ?>">
</div>
</div>
</div>
......@@ -101,7 +101,7 @@ $__template->layout('Layout.main');
<!-- Feedback -->
<div style="margin-bottom:20px;">
<label class="form-label">ملاحظات وتعليقات</label>
<textarea name="feedback_ar" class="form-input" rows="3" placeholder="اكتب ملاحظاتك عن أداء المدرب..."><?= e(old('feedback_ar') ?? '') ?></textarea>
<textarea name="feedback_ar" class="form-input" rows="3" placeholder="اكتب ملاحظاتك عن أداء المدرب..."><?= e(old('feedback_ar') ?: '') ?></textarea>
</div>
<!-- Anonymous -->
......
<?php
declare(strict_types=1);
namespace App\Modules\FacilityDashboards\Controllers;
use App\Core\Controller;
use App\Core\Request;
use App\Core\Response;
use App\Core\App;
use App\Modules\FacilityDashboards\Services\MirrorDisplayService;
class MirrorDisplayController extends Controller
{
public function index(Request $request): Response
{
$this->authorize('facility.mirror');
$grids = MirrorDisplayService::getAllGrids();
$db = App::getInstance()->db();
$facilities = $db->select(
"SELECT id, name_ar FROM facilities WHERE is_active = 1 AND is_archived = 0 ORDER BY name_ar"
);
return $this->view('FacilityDashboards.Views.mirror_index', [
'grids' => $grids,
'facilities' => $facilities,
]);
}
public function createGrid(Request $request): Response
{
$this->authorize('facility.mirror');
$facilityId = (int) $request->post('facility_id', 0);
$nameAr = trim((string) $request->post('name_ar', ''));
$rows = max(1, min(10, (int) $request->post('rows_count', 4)));
$cols = max(1, min(12, (int) $request->post('cols_count', 6)));
if ($facilityId <= 0 || $nameAr === '') {
return $this->redirect('/mirror')->withError('يجب اختيار المرفق وإدخال الاسم');
}
$gridId = MirrorDisplayService::createGrid($facilityId, $nameAr, $rows, $cols);
return $this->redirect('/mirror/' . $gridId)->withSuccess('تم إنشاء المراية بنجاح');
}
public function show(Request $request, string $id): Response
{
$this->authorize('facility.mirror');
$grid = MirrorDisplayService::getGrid((int) $id);
if (!$grid) {
return $this->redirect('/mirror')->withError('المراية غير موجودة');
}
$db = App::getInstance()->db();
$coaches = $db->select(
"SELECT id, full_name_ar FROM coaches WHERE is_active = 1 AND is_archived = 0 ORDER BY full_name_ar"
);
$academies = $db->select(
"SELECT id, name_ar FROM academies WHERE is_active = 1 ORDER BY name_ar"
);
$players = $db->select(
"SELECT id, full_name_ar FROM players WHERE is_archived = 0 AND card_status = 'active' ORDER BY full_name_ar"
);
return $this->view('FacilityDashboards.Views.mirror', [
'grid' => $grid,
'coaches' => $coaches,
'academies' => $academies,
'players' => $players,
]);
}
public function updateBox(Request $request, string $gridId, string $boxId): Response
{
$this->authorize('facility.mirror');
$data = [];
if ($request->post('coach_id') !== null) {
$coachId = (int) $request->post('coach_id', 0);
$data['coach_id'] = $coachId > 0 ? $coachId : null;
}
if ($request->post('coach_name') !== null) {
$data['coach_name'] = trim((string) $request->post('coach_name', ''));
}
if ($request->post('academy_id') !== null) {
$academyId = (int) $request->post('academy_id', 0);
$data['academy_id'] = $academyId > 0 ? $academyId : null;
}
if ($request->post('age_group') !== null) {
$data['age_group'] = trim((string) $request->post('age_group', ''));
}
if ($request->post('gender') !== null) {
$data['gender'] = trim((string) $request->post('gender', ''));
}
if ($request->post('max_trainees') !== null) {
$data['max_trainees'] = max(1, min(10, (int) $request->post('max_trainees', 5)));
}
if ($request->post('label') !== null) {
$data['label'] = trim((string) $request->post('label', ''));
}
if (!empty($data)) {
MirrorDisplayService::updateBox((int) $boxId, $data);
}
return $this->redirect('/mirror/' . $gridId)->withSuccess('تم تحديث الخانة');
}
public function addTrainee(Request $request, string $gridId, string $boxId): Response
{
$this->authorize('facility.mirror');
$playerId = (int) $request->post('player_id', 0);
$traineeName = trim((string) $request->post('trainee_name', ''));
if ($playerId <= 0 && $traineeName === '') {
return $this->redirect('/mirror/' . $gridId)->withError('يجب اختيار لاعب أو كتابة اسم');
}
$success = MirrorDisplayService::addTrainee(
(int) $boxId,
$playerId > 0 ? $playerId : null,
$traineeName ?: null
);
if (!$success) {
return $this->redirect('/mirror/' . $gridId)->withError('الخانة ممتلئة — الحد الأقصى 5');
}
return $this->redirect('/mirror/' . $gridId)->withSuccess('تم إضافة المتدرب');
}
public function removeTrainee(Request $request, string $gridId, string $traineeId): Response
{
$this->authorize('facility.mirror');
MirrorDisplayService::removeTrainee((int) $traineeId);
return $this->redirect('/mirror/' . $gridId)->withSuccess('تم إزالة المتدرب');
}
public function moveTrainee(Request $request, string $gridId, string $traineeId): Response
{
$this->authorize('facility.mirror');
$toBoxId = (int) $request->post('to_box_id', 0);
if ($toBoxId <= 0) {
return $this->redirect('/mirror/' . $gridId)->withError('يجب اختيار الخانة المستهدفة');
}
$success = MirrorDisplayService::moveTrainee((int) $traineeId, $toBoxId);
if (!$success) {
return $this->redirect('/mirror/' . $gridId)->withError('الخانة المستهدفة ممتلئة');
}
return $this->redirect('/mirror/' . $gridId)->withSuccess('تم نقل المتدرب');
}
public function apiState(Request $request, string $id): Response
{
$this->authorize('facility.mirror');
$state = MirrorDisplayService::getGridState((int) $id);
return $this->json([
'boxes' => $state,
'timestamp' => date('Y-m-d H:i:s'),
]);
}
public function deleteGrid(Request $request, string $id): Response
{
$this->authorize('facility.mirror');
$db = App::getInstance()->db();
$db->update('mirror_grids', ['is_active' => 0], 'id = ?', [(int) $id]);
return $this->redirect('/mirror')->withSuccess('تم حذف المراية');
}
}
This diff is collapsed.
<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>المراية — إدارة الشبكات<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<!-- Create New Grid -->
<div class="card" style="margin-bottom:20px;">
<div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;">
<i data-lucide="plus-circle" style="width:18px;height:18px;color:#0D7377;"></i>
<h3 style="margin:0;color:#0D7377;font-size:15px;">إنشاء مراية جديدة</h3>
</div>
<div style="padding:20px;">
<form method="POST" action="/mirror/create" style="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;">
<?= csrf_field() ?>
<div class="form-group" style="margin:0;flex:1;min-width:200px;">
<label class="form-label">المرفق</label>
<select name="facility_id" class="form-select" required>
<option value="">-- اختر المرفق --</option>
<?php foreach ($facilities as $f): ?>
<option value="<?= (int) $f['id'] ?>"><?= e($f['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group" style="margin:0;flex:1;min-width:180px;">
<label class="form-label">اسم المراية</label>
<input type="text" name="name_ar" class="form-input" required placeholder="مثال: مراية حمام السباحة الأولمبي">
</div>
<div class="form-group" style="margin:0;width:100px;">
<label class="form-label">الصفوف</label>
<input type="number" name="rows_count" class="form-input" value="4" min="1" max="10" style="direction:ltr;text-align:center;">
</div>
<div class="form-group" style="margin:0;width:100px;">
<label class="form-label">الأعمدة</label>
<input type="number" name="cols_count" class="form-input" value="6" min="1" max="12" style="direction:ltr;text-align:center;">
</div>
<button type="submit" class="btn btn-primary" style="height:38px;">
<i data-lucide="grid-3x3" style="width:15px;height:15px;vertical-align:middle;margin-left:4px;"></i> إنشاء
</button>
</form>
</div>
</div>
<!-- Existing Grids -->
<?php if (!empty($grids)): ?>
<div style="display:grid;grid-template-columns:repeat(auto-fill, minmax(300px, 1fr));gap:20px;">
<?php foreach ($grids as $g): ?>
<div class="card" style="padding:20px;border-top:4px solid #0D7377;">
<div style="display:flex;justify-content:space-between;align-items:start;margin-bottom:12px;">
<div>
<h3 style="margin:0 0 4px;font-size:16px;color:#1A1A2E;"><?= e($g['name_ar']) ?></h3>
<div style="font-size:12px;color:#6B7280;"><?= e($g['facility_name'] ?? '') ?></div>
</div>
<div style="width:40px;height:40px;border-radius:10px;background:#0D737715;display:flex;align-items:center;justify-content:center;">
<i data-lucide="grid-3x3" style="width:20px;height:20px;color:#0D7377;"></i>
</div>
</div>
<div style="font-size:13px;color:#6B7280;margin-bottom:15px;">
<?= (int) $g['rows_count'] ?> صفوف × <?= (int) $g['cols_count'] ?> أعمدة
= <?= (int) $g['rows_count'] * (int) $g['cols_count'] ?> خانة
</div>
<div style="display:flex;gap:8px;">
<a href="/mirror/<?= (int) $g['id'] ?>" class="btn btn-primary" style="font-size:13px;flex:1;text-align:center;">
<i data-lucide="eye" style="width:14px;height:14px;vertical-align:middle;margin-left:4px;"></i> فتح المراية
</a>
<form method="POST" action="/mirror/<?= (int) $g['id'] ?>/delete" style="margin:0;" onsubmit="return confirm('هل أنت متأكد من حذف هذه المراية؟')">
<?= csrf_field() ?>
<button type="submit" class="btn btn-outline" style="font-size:13px;color:#DC2626;border-color:#DC2626;">
<i data-lucide="trash-2" style="width:14px;height:14px;vertical-align:middle;"></i>
</button>
</form>
</div>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="card" style="padding:40px;text-align:center;">
<i data-lucide="grid-3x3" style="width:48px;height:48px;color:#D1D5DB;margin-bottom:12px;"></i>
<p style="color:#6B7280;font-size:14px;">لا توجد مرايات بعد. أنشئ واحدة جديدة للبدء.</p>
</div>
<?php endif; ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (typeof lucide !== 'undefined') lucide.createIcons();
});
</script>
<?php $__template->endSection(); ?>
......@@ -9,12 +9,12 @@
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">اسم الجهاز <span style="color:#DC2626;">*</span></label>
<input type="text" name="device_name" value="<?= e(old('device_name') ?? ($isEdit ? $device['device_name'] : '')) ?>" class="form-control" required>
<input type="text" name="device_name" value="<?= e(old('device_name') ?: ($isEdit ? $device['device_name'] : '')) ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">نوع الجهاز <span style="color:#DC2626;">*</span></label>
<select name="device_type" class="form-control">
<?php $currentType = old('device_type') ?? ($isEdit ? $device['device_type'] : 'fingerprint'); ?>
<?php $currentType = old('device_type') ?: ($isEdit ? $device['device_type'] : 'fingerprint'); ?>
<option value="fingerprint" <?= $currentType === 'fingerprint' ? 'selected' : '' ?>>بصمة إصبع</option>
<option value="face" <?= $currentType === 'face' ? 'selected' : '' ?>>بصمة وجه</option>
<option value="card" <?= $currentType === 'card' ? 'selected' : '' ?>>كارت</option>
......@@ -22,25 +22,25 @@
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">عنوان IP</label>
<input type="text" name="ip_address" value="<?= e(old('ip_address') ?? ($isEdit ? $device['ip_address'] : '')) ?>" class="form-control" placeholder="192.168.1.100">
<input type="text" name="ip_address" value="<?= e(old('ip_address') ?: ($isEdit ? $device['ip_address'] : '')) ?>" class="form-control" placeholder="192.168.1.100">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">المنفذ (Port)</label>
<input type="number" name="port" value="<?= e(old('port') ?? ($isEdit ? $device['port'] : '')) ?>" class="form-control" min="1" max="65535" placeholder="4370">
<input type="number" name="port" value="<?= e(old('port') ?: ($isEdit ? $device['port'] : '')) ?>" class="form-control" min="1" max="65535" placeholder="4370">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الرقم التسلسلي</label>
<input type="text" name="serial_number" value="<?= e(old('serial_number') ?? ($isEdit ? $device['serial_number'] : '')) ?>" class="form-control">
<input type="text" name="serial_number" value="<?= e(old('serial_number') ?: ($isEdit ? $device['serial_number'] : '')) ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">وصف الموقع</label>
<input type="text" name="location_description" value="<?= e(old('location_description') ?? ($isEdit ? $device['location_description'] : '')) ?>" class="form-control" placeholder="البوابة الرئيسية">
<input type="text" name="location_description" value="<?= e(old('location_description') ?: ($isEdit ? $device['location_description'] : '')) ?>" class="form-control" placeholder="البوابة الرئيسية">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الفرع</label>
<select name="branch_id" class="form-control">
<option value="">-- بدون فرع --</option>
<?php $currentBranch = (int) (old('branch_id') ?? ($isEdit ? $device['branch_id'] : 0)); ?>
<?php $currentBranch = (int) (old('branch_id') ?: ($isEdit ? $device['branch_id'] : 0)); ?>
<?php foreach ($branches as $branch): ?>
<option value="<?= (int) $branch['id'] ?>" <?= $currentBranch === (int) $branch['id'] ? 'selected' : '' ?>><?= e($branch['name_ar']) ?></option>
<?php endforeach; ?>
......@@ -48,7 +48,7 @@
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">
<input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?? ($isEdit ? $device['is_active'] : 1)) ? 'checked' : '' ?>> فعال
<input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?: ($isEdit ? $device['is_active'] : 1)) ? 'checked' : '' ?>> فعال
</label>
</div>
</div>
......
......@@ -30,47 +30,47 @@
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">نوع العقد <span style="color:#DC2626;">*</span></label>
<select name="contract_type" class="form-control" required>
<option value="definite" <?= (old('contract_type') ?? ($isEdit ? $contract->contract_type : '')) === 'definite' ? 'selected' : '' ?>>محدد المدة</option>
<option value="indefinite" <?= (old('contract_type') ?? ($isEdit ? $contract->contract_type : '')) === 'indefinite' ? 'selected' : '' ?>>غير محدد المدة</option>
<option value="definite" <?= (old('contract_type') ?: ($isEdit ? $contract->contract_type : '')) === 'definite' ? 'selected' : '' ?>>محدد المدة</option>
<option value="indefinite" <?= (old('contract_type') ?: ($isEdit ? $contract->contract_type : '')) === 'indefinite' ? 'selected' : '' ?>>غير محدد المدة</option>
</select>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ البداية <span style="color:#DC2626;">*</span></label>
<input type="date" name="start_date" value="<?= e(old('start_date') ?? ($isEdit ? $contract->start_date : '')) ?>" class="form-control" required>
<input type="date" name="start_date" value="<?= e(old('start_date') ?: ($isEdit ? $contract->start_date : '')) ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ النهاية</label>
<input type="date" name="end_date" value="<?= e(old('end_date') ?? ($isEdit ? $contract->end_date : '')) ?>" class="form-control">
<input type="date" name="end_date" value="<?= e(old('end_date') ?: ($isEdit ? $contract->end_date : '')) ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">فترة الاختبار (أشهر)</label>
<input type="number" name="probation_months" value="<?= e(old('probation_months') ?? ($isEdit ? $contract->probation_months : '3')) ?>" class="form-control" min="0" max="3">
<input type="number" name="probation_months" value="<?= e(old('probation_months') ?: ($isEdit ? $contract->probation_months : '3')) ?>" class="form-control" min="0" max="3">
<small style="color:#6B7280;">الحد الأقصى 3 أشهر (مادة 33)</small>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">ساعات العمل اليومية</label>
<input type="text" name="working_hours_per_day" value="<?= e(old('working_hours_per_day') ?? ($isEdit ? $contract->working_hours_per_day : '8')) ?>" class="form-control">
<input type="text" name="working_hours_per_day" value="<?= e(old('working_hours_per_day') ?: ($isEdit ? $contract->working_hours_per_day : '8')) ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">فترة الإنذار (أشهر)</label>
<input type="number" name="notice_period_months" value="<?= e(old('notice_period_months') ?? ($isEdit ? $contract->notice_period_months : '2')) ?>" class="form-control" min="0">
<input type="number" name="notice_period_months" value="<?= e(old('notice_period_months') ?: ($isEdit ? $contract->notice_period_months : '2')) ?>" class="form-control" min="0">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الراتب الأساسي <span style="color:#DC2626;">*</span></label>
<input type="number" name="basic_salary" value="<?= e(old('basic_salary') ?? ($isEdit ? $contract->basic_salary : ($profile ? $profile->basic_salary : '0.00'))) ?>" class="form-control" step="0.01" min="0" required>
<input type="number" name="basic_salary" value="<?= e(old('basic_salary') ?: ($isEdit ? $contract->basic_salary : ($profile ? $profile->basic_salary : '0.00'))) ?>" class="form-control" step="0.01" min="0" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">إجمالي الحزمة <span style="color:#DC2626;">*</span></label>
<input type="number" name="total_package" value="<?= e(old('total_package') ?? ($isEdit ? $contract->total_package : ($profile ? $profile->basic_salary : '0.00'))) ?>" class="form-control" step="0.01" min="0" required>
<input type="number" name="total_package" value="<?= e(old('total_package') ?: ($isEdit ? $contract->total_package : ($profile ? $profile->basic_salary : '0.00'))) ?>" class="form-control" step="0.01" min="0" required>
<small style="color:#6B7280;">الراتب الأساسي + البدلات</small>
</div>
<div style="grid-column:1/-1;">
<label style="display:block;margin-bottom:4px;font-size:13px;">شروط العقد</label>
<textarea name="terms_ar" class="form-control" rows="4"><?= e(old('terms_ar') ?? ($isEdit ? json_decode($contract->terms_json ?? 'null', true) ?? '' : '')) ?></textarea>
<textarea name="terms_ar" class="form-control" rows="4"><?= e(old('terms_ar') ?: ($isEdit ? json_decode($contract->terms_json ?? 'null', true) ?? '' : '')) ?></textarea>
</div>
<div style="grid-column:1/-1;">
<label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات</label>
<textarea name="notes" class="form-control" rows="2"><?= e(old('notes') ?? ($isEdit ? $contract->notes : '')) ?></textarea>
<textarea name="notes" class="form-control" rows="2"><?= e(old('notes') ?: ($isEdit ? $contract->notes : '')) ?></textarea>
</div>
</div>
</div>
......
<?php $__template->layout('Layout.main'); ?>
<?php $isEdit = $department !== null; ?>
<?php $currentType = old('department_type') ?? ($isEdit ? ($department->department_type ?? 'qism') : 'qism'); ?>
<?php $currentType = old('department_type') ?: ($isEdit ? ($department->department_type ?? 'qism') : 'qism'); ?>
<?php $__template->section('title'); ?><?= $isEdit ? ($currentType === 'idara' ? 'تعديل الإدارة' : 'تعديل القسم') : 'إضافة إدارة / قسم' ?><?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
......@@ -37,15 +37,15 @@
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;" id="nameLabel"><?= $currentType === 'idara' ? 'اسم الإدارة بالعربي' : 'اسم القسم بالعربي' ?> <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? ($isEdit ? $department->name_ar : '')) ?>" class="form-control" required>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: ($isEdit ? $department->name_ar : '')) ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;" id="nameEnLabel"><?= $currentType === 'idara' ? 'اسم الإدارة بالإنجليزي' : 'اسم القسم بالإنجليزي' ?></label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?? ($isEdit ? $department->name_en : '')) ?>" class="form-control">
<input type="text" name="name_en" value="<?= e(old('name_en') ?: ($isEdit ? $department->name_en : '')) ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الكود <span style="color:#DC2626;">*</span></label>
<input type="text" name="department_code" value="<?= e(old('department_code') ?? ($isEdit ? $department->department_code : '')) ?>" class="form-control" required>
<input type="text" name="department_code" value="<?= e(old('department_code') ?: ($isEdit ? $department->department_code : '')) ?>" class="form-control" required>
</div>
<div id="parentField" style="<?= $currentType === 'idara' ? 'display:none;' : '' ?>">
<label style="display:block;margin-bottom:4px;font-size:13px;">الإدارة التابع لها <span style="color:#DC2626;">*</span></label>
......@@ -53,7 +53,7 @@
<option value="">-- اختر الإدارة --</option>
<?php foreach ($idaras as $d): ?>
<?php if ($isEdit && (int) $d['id'] === (int) $department->id) continue; ?>
<option value="<?= (int) $d['id'] ?>" <?= (old('parent_id') ?? ($isEdit ? $department->parent_id : '')) == $d['id'] ? 'selected' : '' ?>><?= e($d['name_ar']) ?></option>
<option value="<?= (int) $d['id'] ?>" <?= (old('parent_id') ?: ($isEdit ? $department->parent_id : '')) == $d['id'] ? 'selected' : '' ?>><?= e($d['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -62,7 +62,7 @@
<select name="manager_employee_id" class="form-control">
<option value="">-- بدون --</option>
<?php foreach ($employees as $emp): ?>
<option value="<?= (int) $emp['id'] ?>" <?= (old('manager_employee_id') ?? ($isEdit ? $department->manager_employee_id : '')) == $emp['id'] ? 'selected' : '' ?>><?= e($emp['first_name_ar'] . ' ' . $emp['last_name_ar']) ?></option>
<option value="<?= (int) $emp['id'] ?>" <?= (old('manager_employee_id') ?: ($isEdit ? $department->manager_employee_id : '')) == $emp['id'] ? 'selected' : '' ?>><?= e($emp['first_name_ar'] . ' ' . $emp['last_name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -71,19 +71,19 @@
<select name="branch_id" class="form-control">
<option value="">-- بدون --</option>
<?php foreach ($branches as $b): ?>
<option value="<?= (int) $b['id'] ?>" <?= (old('branch_id') ?? ($isEdit ? $department->branch_id : '')) == $b['id'] ? 'selected' : '' ?>><?= e($b['name_ar']) ?></option>
<option value="<?= (int) $b['id'] ?>" <?= (old('branch_id') ?: ($isEdit ? $department->branch_id : '')) == $b['id'] ? 'selected' : '' ?>><?= e($b['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">القوام المعتمد</label>
<input type="number" name="staffing_capacity" value="<?= e(old('staffing_capacity') ?? ($isEdit ? $department->staffing_capacity : '')) ?>" class="form-control" min="0" placeholder="0">
<input type="number" name="staffing_capacity" value="<?= e(old('staffing_capacity') ?: ($isEdit ? $department->staffing_capacity : '')) ?>" class="form-control" min="0" placeholder="0">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الحالة</label>
<select name="is_active" class="form-control">
<option value="1" <?= (old('is_active') ?? ($isEdit ? $department->is_active : 1)) == 1 ? 'selected' : '' ?>>نشط</option>
<option value="0" <?= (old('is_active') ?? ($isEdit ? $department->is_active : 1)) == 0 ? 'selected' : '' ?>>غير نشط</option>
<option value="1" <?= (old('is_active') ?: ($isEdit ? $department->is_active : 1)) == 1 ? 'selected' : '' ?>>نشط</option>
<option value="0" <?= (old('is_active') ?: ($isEdit ? $department->is_active : 1)) == 0 ? 'selected' : '' ?>>غير نشط</option>
</select>
</div>
</div>
......
......@@ -13,10 +13,10 @@
</select>
</div>
<?php endif; ?>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ الواقعة <span style="color:#DC2626;">*</span></label><input type="date" name="incident_date" value="<?= e(old('incident_date') ?? ($action->incident_date ?? date('Y-m-d'))) ?>" class="form-control" required></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">وصف الواقعة <span style="color:#DC2626;">*</span></label><textarea name="incident_description" class="form-control" rows="3" required><?= e(old('incident_description') ?? ($action->incident_description ?? '')) ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات التحقيق</label><textarea name="investigation_notes" class="form-control" rows="2"><?= e(old('investigation_notes') ?? ($action->investigation_notes ?? '')) ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">نتيجة التحقيق / الجزاء الموقع</label><textarea name="investigation_result" class="form-control" rows="2"><?= e(old('investigation_result') ?? ($action->investigation_result ?? '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ الواقعة <span style="color:#DC2626;">*</span></label><input type="date" name="incident_date" value="<?= e(old('incident_date') ?: ($action->incident_date ?? date('Y-m-d'))) ?>" class="form-control" required></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">وصف الواقعة <span style="color:#DC2626;">*</span></label><textarea name="incident_description" class="form-control" rows="3" required><?= e(old('incident_description') ?: ($action->incident_description ?? '')) ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات التحقيق</label><textarea name="investigation_notes" class="form-control" rows="2"><?= e(old('investigation_notes') ?: ($action->investigation_notes ?? '')) ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">نتيجة التحقيق / الجزاء الموقع</label><textarea name="investigation_result" class="form-control" rows="2"><?= e(old('investigation_result') ?: ($action->investigation_result ?? '')) ?></textarea></div>
</div>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
......
This diff is collapsed.
......@@ -18,8 +18,8 @@
<?php foreach ($tl as $k => $v): ?><option value="<?= $k ?>" <?= old('termination_type') === $k ? 'selected' : '' ?>><?= $v ?></option><?php endforeach; ?>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ إنهاء الخدمة <span style="color:#DC2626;">*</span></label><input type="date" name="effective_date" value="<?= e(old('effective_date') ?? date('Y-m-d')) ?>" class="form-control" required></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات</label><textarea name="notes" class="form-control" rows="3"><?= e(old('notes') ?? '') ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ إنهاء الخدمة <span style="color:#DC2626;">*</span></label><input type="date" name="effective_date" value="<?= e(old('effective_date') ?: date('Y-m-d')) ?>" class="form-control" required></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات</label><textarea name="notes" class="form-control" rows="3"><?= e(old('notes') ?: '') ?></textarea></div>
</div>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
......
......@@ -7,25 +7,25 @@
<?= csrf_field() ?>
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?? ($isEdit ? $holiday->name_ar : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?? ($isEdit ? $holiday->name_en : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">التاريخ <span style="color:#DC2626;">*</span></label><input type="date" name="date" value="<?= e(old('date') ?? ($isEdit ? $holiday->date : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">المدة (أيام)</label><input type="number" name="duration_days" value="<?= e(old('duration_days') ?? ($isEdit ? $holiday->duration_days : '1')) ?>" class="form-control" min="1"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?: ($isEdit ? $holiday->name_ar : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?: ($isEdit ? $holiday->name_en : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">التاريخ <span style="color:#DC2626;">*</span></label><input type="date" name="date" value="<?= e(old('date') ?: ($isEdit ? $holiday->date : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">المدة (أيام)</label><input type="number" name="duration_days" value="<?= e(old('duration_days') ?: ($isEdit ? $holiday->duration_days : '1')) ?>" class="form-control" min="1"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">النوع</label>
<select name="holiday_type" class="form-control">
<option value="national" <?= (old('holiday_type') ?? ($isEdit ? $holiday->holiday_type : '')) === 'national' ? 'selected' : '' ?>>وطنية</option>
<option value="religious" <?= (old('holiday_type') ?? ($isEdit ? $holiday->holiday_type : '')) === 'religious' ? 'selected' : '' ?>>دينية</option>
<option value="company" <?= (old('holiday_type') ?? ($isEdit ? $holiday->holiday_type : '')) === 'company' ? 'selected' : '' ?>>خاصة بالشركة</option>
<option value="national" <?= (old('holiday_type') ?: ($isEdit ? $holiday->holiday_type : '')) === 'national' ? 'selected' : '' ?>>وطنية</option>
<option value="religious" <?= (old('holiday_type') ?: ($isEdit ? $holiday->holiday_type : '')) === 'religious' ? 'selected' : '' ?>>دينية</option>
<option value="company" <?= (old('holiday_type') ?: ($isEdit ? $holiday->holiday_type : '')) === 'company' ? 'selected' : '' ?>>خاصة بالشركة</option>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الديانة (للعطل الدينية)</label>
<select name="religion" class="form-control"><option value="">-- الكل --</option>
<option value="muslim" <?= (old('religion') ?? ($isEdit ? $holiday->religion : '')) === 'muslim' ? 'selected' : '' ?>>مسلم</option>
<option value="christian" <?= (old('religion') ?? ($isEdit ? $holiday->religion : '')) === 'christian' ? 'selected' : '' ?>>مسيحي</option>
<option value="muslim" <?= (old('religion') ?: ($isEdit ? $holiday->religion : '')) === 'muslim' ? 'selected' : '' ?>>مسلم</option>
<option value="christian" <?= (old('religion') ?: ($isEdit ? $holiday->religion : '')) === 'christian' ? 'selected' : '' ?>>مسيحي</option>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_recurring" value="1" <?= (old('is_recurring') ?? ($isEdit ? $holiday->is_recurring : 0)) ? 'checked' : '' ?>> متكررة سنوياً</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?? ($isEdit ? $holiday->is_active : 1)) ? 'checked' : '' ?>> فعالة</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_recurring" value="1" <?= (old('is_recurring') ?: ($isEdit ? $holiday->is_recurring : 0)) ? 'checked' : '' ?>> متكررة سنوياً</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?: ($isEdit ? $holiday->is_active : 1)) ? 'checked' : '' ?>> فعالة</label></div>
</div>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
......
......@@ -13,36 +13,36 @@
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? ($isEdit ? $jobTitle->name_ar : '')) ?>" class="form-control" required>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: ($isEdit ? $jobTitle->name_ar : '')) ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?? ($isEdit ? $jobTitle->name_en : '')) ?>" class="form-control">
<input type="text" name="name_en" value="<?= e(old('name_en') ?: ($isEdit ? $jobTitle->name_en : '')) ?>" class="form-control">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الكود <span style="color:#DC2626;">*</span></label>
<input type="text" name="title_code" value="<?= e(old('title_code') ?? ($isEdit ? $jobTitle->title_code : '')) ?>" class="form-control" required>
<input type="text" name="title_code" value="<?= e(old('title_code') ?: ($isEdit ? $jobTitle->title_code : '')) ?>" class="form-control" required>
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الدرجة الوظيفية</label>
<input type="number" name="grade_level" value="<?= e(old('grade_level') ?? ($isEdit ? $jobTitle->grade_level : '')) ?>" class="form-control" min="0">
<input type="number" name="grade_level" value="<?= e(old('grade_level') ?: ($isEdit ? $jobTitle->grade_level : '')) ?>" class="form-control" min="0">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الحد الأدنى للراتب</label>
<input type="text" name="min_salary" value="<?= e(old('min_salary') ?? ($isEdit ? $jobTitle->min_salary : '')) ?>" class="form-control" placeholder="0.00">
<input type="text" name="min_salary" value="<?= e(old('min_salary') ?: ($isEdit ? $jobTitle->min_salary : '')) ?>" class="form-control" placeholder="0.00">
</div>
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;">الحد الأقصى للراتب</label>
<input type="text" name="max_salary" value="<?= e(old('max_salary') ?? ($isEdit ? $jobTitle->max_salary : '')) ?>" class="form-control" placeholder="0.00">
<input type="text" name="max_salary" value="<?= e(old('max_salary') ?: ($isEdit ? $jobTitle->max_salary : '')) ?>" class="form-control" placeholder="0.00">
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?? ($isEdit ? $jobTitle->is_active : 1)) ? 'checked' : '' ?>> فعال</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?: ($isEdit ? $jobTitle->is_active : 1)) ? 'checked' : '' ?>> فعال</label></div>
<div style="grid-column:1/-1;">
<label style="display:block;margin-bottom:4px;font-size:13px;">الوصف</label>
<textarea name="description_ar" class="form-control" rows="3"><?= e(old('description_ar') ?? ($isEdit ? $jobTitle->description_ar : '')) ?></textarea>
<textarea name="description_ar" class="form-control" rows="3"><?= e(old('description_ar') ?: ($isEdit ? $jobTitle->description_ar : '')) ?></textarea>
</div>
<div style="grid-column:1/-1;">
<label style="display:block;margin-bottom:4px;font-size:13px;">التوصيف الوظيفي</label>
<textarea name="job_description_ar" class="form-control" rows="5" placeholder="المهام والمسؤوليات والمتطلبات..."><?= e(old('job_description_ar') ?? ($isEdit ? $jobTitle->job_description_ar : '')) ?></textarea>
<textarea name="job_description_ar" class="form-control" rows="5" placeholder="المهام والمسؤوليات والمتطلبات..."><?= e(old('job_description_ar') ?: ($isEdit ? $jobTitle->job_description_ar : '')) ?></textarea>
</div>
</div>
</div>
......
......@@ -5,8 +5,8 @@
<?php
$isEdit = $leaveType !== null;
$action = $isEdit ? '/hr/leave-types/' . $leaveType['id'] . '/update' : '/hr/leave-types';
$v = fn(string $key, $default = '') => e(old($key) ?? ($leaveType[$key] ?? $default));
$checked = fn(string $key, $default = 0) => ((int)(old($key) ?? ($leaveType[$key] ?? $default))) ? 'checked' : '';
$v = fn(string $key, $default = '') => e(old($key) ?: ($leaveType[$key] ?? $default));
$checked = fn(string $key, $default = 0) => ((int)(old($key) ?: ($leaveType[$key] ?? $default))) ? 'checked' : '';
?>
<form method="POST" action="<?= $action ?>" style="max-width:900px;">
......@@ -34,7 +34,7 @@ $checked = fn(string $key, $default = 0) => ((int)(old($key) ?? ($leaveType[$key
<select name="category" class="form-control">
<option value="">— بدون تصنيف —</option>
<?php foreach ($categories as $k => $label): ?>
<option value="<?= e($k) ?>" <?= (old('category') ?? ($leaveType['category'] ?? '')) === $k ? 'selected' : '' ?>><?= e($label) ?></option>
<option value="<?= e($k) ?>" <?= (old('category') ?: ($leaveType['category'] ?? '')) === $k ? 'selected' : '' ?>><?= e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -45,9 +45,9 @@ $checked = fn(string $key, $default = 0) => ((int)(old($key) ?? ($leaveType[$key
<div>
<label style="display:block;margin-bottom:4px;font-size:13px;font-weight:500;">تقييد الجنس</label>
<select name="gender_restriction" class="form-control">
<option value="" <?= (old('gender_restriction') ?? ($leaveType['gender_restriction'] ?? '')) === '' ? 'selected' : '' ?>>بدون تقييد (الكل)</option>
<option value="male" <?= (old('gender_restriction') ?? ($leaveType['gender_restriction'] ?? '')) === 'male' ? 'selected' : '' ?>>ذكور فقط</option>
<option value="female" <?= (old('gender_restriction') ?? ($leaveType['gender_restriction'] ?? '')) === 'female' ? 'selected' : '' ?>>إناث فقط</option>
<option value="" <?= (old('gender_restriction') ?: ($leaveType['gender_restriction'] ?? '')) === '' ? 'selected' : '' ?>>بدون تقييد (الكل)</option>
<option value="male" <?= (old('gender_restriction') ?: ($leaveType['gender_restriction'] ?? '')) === 'male' ? 'selected' : '' ?>>ذكور فقط</option>
<option value="female" <?= (old('gender_restriction') ?: ($leaveType['gender_restriction'] ?? '')) === 'female' ? 'selected' : '' ?>>إناث فقط</option>
</select>
</div>
</div>
......
......@@ -16,10 +16,10 @@
<?php foreach ($leaveTypes as $lt): ?><option value="<?= (int) $lt['id'] ?>" <?= old('leave_type_id') == $lt['id'] ? 'selected' : '' ?>><?= e($lt['name_ar']) ?> (<?= (int) $lt['max_days_per_year'] ?> يوم)</option><?php endforeach; ?>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ البداية <span style="color:#DC2626;">*</span></label><input type="date" name="start_date" value="<?= e(old('start_date') ?? '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ النهاية <span style="color:#DC2626;">*</span></label><input type="date" name="end_date" value="<?= e(old('end_date') ?? '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ البداية <span style="color:#DC2626;">*</span></label><input type="date" name="start_date" value="<?= e(old('start_date') ?: '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ النهاية <span style="color:#DC2626;">*</span></label><input type="date" name="end_date" value="<?= e(old('end_date') ?: '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="half_day" value="1" <?= old('half_day') ? 'checked' : '' ?>> نصف يوم</label></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">السبب</label><textarea name="reason" class="form-control" rows="3"><?= e(old('reason') ?? '') ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">السبب</label><textarea name="reason" class="form-control" rows="3"><?= e(old('reason') ?: '') ?></textarea></div>
</div>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
......
......@@ -20,19 +20,19 @@
<option value="bank_loan" <?= old('loan_type') === 'bank_loan' ? 'selected' : '' ?>>قرض بنكي</option>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">المبلغ <span style="color:#DC2626;">*</span></label><input type="number" name="loan_amount" value="<?= e(old('loan_amount') ?? '') ?>" class="form-control" step="0.01" min="0.01" placeholder="0.00" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">عدد الأقساط <span style="color:#DC2626;">*</span></label><input type="number" name="number_of_installments" value="<?= e(old('number_of_installments') ?? '1') ?>" class="form-control" min="1" max="60" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ الطلب</label><input type="date" name="request_date" value="<?= e(old('request_date') ?? date('Y-m-d')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">بداية الخصم <span style="color:#DC2626;">*</span></label><input type="date" name="start_deduction_date" value="<?= e(old('start_deduction_date') ?? date('Y-m-01', strtotime('+1 month'))) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">المبلغ <span style="color:#DC2626;">*</span></label><input type="number" name="loan_amount" value="<?= e(old('loan_amount') ?: '') ?>" class="form-control" step="0.01" min="0.01" placeholder="0.00" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">عدد الأقساط <span style="color:#DC2626;">*</span></label><input type="number" name="number_of_installments" value="<?= e(old('number_of_installments') ?: '1') ?>" class="form-control" min="1" max="60" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ الطلب</label><input type="date" name="request_date" value="<?= e(old('request_date') ?: date('Y-m-d')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">بداية الخصم <span style="color:#DC2626;">*</span></label><input type="date" name="start_deduction_date" value="<?= e(old('start_deduction_date') ?: date('Y-m-01', strtotime('+1 month'))) ?>" class="form-control" required></div>
<div id="external_fields" style="grid-column:1/-1;display:none;">
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;padding-top:8px;border-top:1px dashed #E5E7EB;">
<div><label style="display:block;margin-bottom:4px;font-size:13px;">اسم الجهة</label><input type="text" name="external_entity_name" value="<?= e(old('external_entity_name') ?? '') ?>" class="form-control" placeholder="اسم البنك أو شركة التمويل"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">رقم المرجع</label><input type="text" name="external_reference" value="<?= e(old('external_reference') ?? '') ?>" class="form-control" placeholder="رقم العقد أو المرجع"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">المبلغ الشهري المستقطع من الراتب</label><input type="number" name="monthly_salary_impact" value="<?= e(old('monthly_salary_impact') ?? '') ?>" class="form-control" step="0.01" min="0" placeholder="0.00"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">اسم الجهة</label><input type="text" name="external_entity_name" value="<?= e(old('external_entity_name') ?: '') ?>" class="form-control" placeholder="اسم البنك أو شركة التمويل"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">رقم المرجع</label><input type="text" name="external_reference" value="<?= e(old('external_reference') ?: '') ?>" class="form-control" placeholder="رقم العقد أو المرجع"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">المبلغ الشهري المستقطع من الراتب</label><input type="number" name="monthly_salary_impact" value="<?= e(old('monthly_salary_impact') ?: '') ?>" class="form-control" step="0.01" min="0" placeholder="0.00"></div>
</div>
</div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">السبب</label><textarea name="reason" class="form-control" rows="2"><?= e(old('reason') ?? '') ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات</label><textarea name="notes" class="form-control" rows="2"><?= e(old('notes') ?? '') ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">السبب</label><textarea name="reason" class="form-control" rows="2"><?= e(old('reason') ?: '') ?></textarea></div>
<div style="grid-column:1/-1;"><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات</label><textarea name="notes" class="form-control" rows="2"><?= e(old('notes') ?: '') ?></textarea></div>
</div>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
......
......@@ -8,7 +8,7 @@
<?php $__template->section('content'); ?>
<div class="card" style="max-width:700px;padding:25px;">
<form method="POST" action="/hr/overtime/store">
<form method="POST" action="/hr/overtime">
<?= csrf_field() ?>
<div style="margin-bottom:15px;">
......@@ -33,23 +33,23 @@
<div style="margin-bottom:15px;">
<label class="form-label">التاريخ <span style="color:#DC2626;">*</span></label>
<input type="date" name="date" value="<?= e(old('date') ?? '') ?>" class="form-input" required>
<input type="date" name="date" value="<?= e(old('date') ?: '') ?>" class="form-input" required>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:15px;">
<div>
<label class="form-label">وقت البداية <span style="color:#DC2626;">*</span></label>
<input type="time" name="start_time" value="<?= e(old('start_time') ?? '') ?>" class="form-input" required>
<input type="time" name="start_time" value="<?= e(old('start_time') ?: '') ?>" class="form-input" required>
</div>
<div>
<label class="form-label">وقت النهاية <span style="color:#DC2626;">*</span></label>
<input type="time" name="end_time" value="<?= e(old('end_time') ?? '') ?>" class="form-input" required>
<input type="time" name="end_time" value="<?= e(old('end_time') ?: '') ?>" class="form-input" required>
</div>
</div>
<div style="margin-bottom:20px;">
<label class="form-label">السبب <span style="color:#DC2626;">*</span></label>
<textarea name="reason" class="form-control" rows="4" placeholder="اذكر سبب العمل الإضافي..." required><?= e(old('reason') ?? '') ?></textarea>
<textarea name="reason" class="form-control" rows="4" placeholder="اذكر سبب العمل الإضافي..." required><?= e(old('reason') ?: '') ?></textarea>
</div>
<div style="display:flex;gap:10px;">
......
......@@ -11,7 +11,7 @@
<form method="POST" action="/hr/performance/cycles" style="padding:16px;">
<?= csrf_field() ?>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-bottom:12px;">
<div><label style="display:block;margin-bottom:4px;font-size:13px;">اسم الدورة <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?? '') ?>" class="form-control" placeholder="مثال: تقييم الأداء 2026" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">اسم الدورة <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?: '') ?>" class="form-control" placeholder="مثال: تقييم الأداء 2026" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">النوع</label>
<select name="period_type" class="form-control">
<option value="annual" <?= old('period_type') === 'annual' ? 'selected' : '' ?>>سنوي</option>
......@@ -19,8 +19,8 @@
<option value="quarterly" <?= old('period_type') === 'quarterly' ? 'selected' : '' ?>>ربع سنوي</option>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ البداية <span style="color:#DC2626;">*</span></label><input type="date" name="start_date" value="<?= e(old('start_date') ?? '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ النهاية <span style="color:#DC2626;">*</span></label><input type="date" name="end_date" value="<?= e(old('end_date') ?? '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ البداية <span style="color:#DC2626;">*</span></label><input type="date" name="start_date" value="<?= e(old('start_date') ?: '') ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">تاريخ النهاية <span style="color:#DC2626;">*</span></label><input type="date" name="end_date" value="<?= e(old('end_date') ?: '') ?>" class="form-control" required></div>
</div>
<button type="submit" class="btn btn-primary">إنشاء الدورة</button>
<span style="font-size:12px;color:#6B7280;margin-right:8px;">* سيتم إنشاء تقييم تلقائي لكل موظف نشط</span>
......
......@@ -56,10 +56,10 @@ $existingScores = json_decode($review->scores_json ?? '{}', true);
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
<div><label style="display:block;margin-bottom:4px;font-size:13px;">نقاط القوة</label><textarea name="strengths" class="form-control" rows="3"><?= e(old('strengths') ?? ($review->strengths ?? '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">مجالات التحسين</label><textarea name="improvements" class="form-control" rows="3"><?= e(old('improvements') ?? ($review->improvements ?? '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الأهداف للفترة القادمة</label><textarea name="goals" class="form-control" rows="3"><?= e(old('goals') ?? (($review->goals_json ? json_decode($review->goals_json, true) : '') ?: '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات المقيّم</label><textarea name="notes" class="form-control" rows="3"><?= e(old('notes') ?? ($review->notes ?? '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">نقاط القوة</label><textarea name="strengths" class="form-control" rows="3"><?= e(old('strengths') ?: ($review->strengths ?? '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">مجالات التحسين</label><textarea name="improvements" class="form-control" rows="3"><?= e(old('improvements') ?: ($review->improvements ?? '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الأهداف للفترة القادمة</label><textarea name="goals" class="form-control" rows="3"><?= e(old('goals') ?: (($review->goals_json ? json_decode($review->goals_json, true) : '') ?: '')) ?></textarea></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ملاحظات المقيّم</label><textarea name="notes" class="form-control" rows="3"><?= e(old('notes') ?: ($review->notes ?? '')) ?></textarea></div>
</div>
</div>
......
......@@ -7,12 +7,12 @@
<?= csrf_field() ?>
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px;">
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?? ($isEdit ? $structure->name_ar : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?? ($isEdit ? $structure->name_en : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الكود <span style="color:#DC2626;">*</span></label><input type="text" name="code" value="<?= e(old('code') ?? ($isEdit ? $structure->code : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الوصف</label><input type="text" name="description" value="<?= e(old('description') ?? ($isEdit ? $structure->description : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_default" value="1" <?= (old('is_default') ?? ($isEdit ? $structure->is_default : 0)) ? 'checked' : '' ?>> هيكل افتراضي</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?? ($isEdit ? $structure->is_active : 1)) ? 'checked' : '' ?>> فعال</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?: ($isEdit ? $structure->name_ar : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?: ($isEdit ? $structure->name_en : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الكود <span style="color:#DC2626;">*</span></label><input type="text" name="code" value="<?= e(old('code') ?: ($isEdit ? $structure->code : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الوصف</label><input type="text" name="description" value="<?= e(old('description') ?: ($isEdit ? $structure->description : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_default" value="1" <?= (old('is_default') ?: ($isEdit ? $structure->is_default : 0)) ? 'checked' : '' ?>> هيكل افتراضي</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_active" value="1" <?= (old('is_active') ?: ($isEdit ? $structure->is_active : 1)) ? 'checked' : '' ?>> فعال</label></div>
</div>
</div>
<div style="display:flex;gap:10px;justify-content:flex-end;">
......
......@@ -15,21 +15,21 @@ $dayLabels = ['saturday'=>'السبت','sunday'=>'الأحد','monday'=>'الا
<div class="card" style="margin-bottom:20px;">
<div style="padding:16px;border-bottom:1px solid #E5E7EB;"><h3 style="margin:0;font-size:16px;">البيانات الأساسية</h3></div>
<div style="padding:16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;">
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?? ($isEdit ? $schedule->name_ar : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?? ($isEdit ? $schedule->name_en : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الكود <span style="color:#DC2626;">*</span></label><input type="text" name="code" value="<?= e(old('code') ?? ($isEdit ? $schedule->code : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالعربي <span style="color:#DC2626;">*</span></label><input type="text" name="name_ar" value="<?= e(old('name_ar') ?: ($isEdit ? $schedule->name_ar : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الاسم بالإنجليزي</label><input type="text" name="name_en" value="<?= e(old('name_en') ?: ($isEdit ? $schedule->name_en : '')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">الكود <span style="color:#DC2626;">*</span></label><input type="text" name="code" value="<?= e(old('code') ?: ($isEdit ? $schedule->code : '')) ?>" class="form-control" required></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">النوع</label>
<select name="schedule_type" class="form-control">
<option value="fixed" <?= (old('schedule_type') ?? ($isEdit ? $schedule->schedule_type : '')) === 'fixed' ? 'selected' : '' ?>>ثابت</option>
<option value="rotating" <?= (old('schedule_type') ?? ($isEdit ? $schedule->schedule_type : '')) === 'rotating' ? 'selected' : '' ?>>دوري</option>
<option value="flexible" <?= (old('schedule_type') ?? ($isEdit ? $schedule->schedule_type : '')) === 'flexible' ? 'selected' : '' ?>>مرن</option>
<option value="fixed" <?= (old('schedule_type') ?: ($isEdit ? $schedule->schedule_type : '')) === 'fixed' ? 'selected' : '' ?>>ثابت</option>
<option value="rotating" <?= (old('schedule_type') ?: ($isEdit ? $schedule->schedule_type : '')) === 'rotating' ? 'selected' : '' ?>>دوري</option>
<option value="flexible" <?= (old('schedule_type') ?: ($isEdit ? $schedule->schedule_type : '')) === 'flexible' ? 'selected' : '' ?>>مرن</option>
</select>
</div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">أيام العمل/أسبوع</label><input type="number" name="working_days_per_week" value="<?= e(old('working_days_per_week') ?? ($isEdit ? $schedule->working_days_per_week : '6')) ?>" class="form-control" min="1" max="7"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ساعات/يوم</label><input type="text" name="hours_per_day" value="<?= e(old('hours_per_day') ?? ($isEdit ? $schedule->hours_per_day : '8.00')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ساعات/أسبوع</label><input type="text" name="hours_per_week" value="<?= e(old('hours_per_week') ?? ($isEdit ? $schedule->hours_per_week : '48.00')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ساعات رمضان/يوم</label><input type="text" name="ramadan_hours_per_day" value="<?= e(old('ramadan_hours_per_day') ?? ($isEdit ? $schedule->ramadan_hours_per_day : '')) ?>" class="form-control" placeholder="7.00"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_night_shift" value="1" <?= (old('is_night_shift') ?? ($isEdit ? $schedule->is_night_shift : 0)) ? 'checked' : '' ?>> وردية ليلية</label></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">أيام العمل/أسبوع</label><input type="number" name="working_days_per_week" value="<?= e(old('working_days_per_week') ?: ($isEdit ? $schedule->working_days_per_week : '6')) ?>" class="form-control" min="1" max="7"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ساعات/يوم</label><input type="text" name="hours_per_day" value="<?= e(old('hours_per_day') ?: ($isEdit ? $schedule->hours_per_day : '8.00')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ساعات/أسبوع</label><input type="text" name="hours_per_week" value="<?= e(old('hours_per_week') ?: ($isEdit ? $schedule->hours_per_week : '48.00')) ?>" class="form-control"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;">ساعات رمضان/يوم</label><input type="text" name="ramadan_hours_per_day" value="<?= e(old('ramadan_hours_per_day') ?: ($isEdit ? $schedule->ramadan_hours_per_day : '')) ?>" class="form-control" placeholder="7.00"></div>
<div><label style="display:block;margin-bottom:4px;font-size:13px;"><input type="checkbox" name="is_night_shift" value="1" <?= (old('is_night_shift') ?: ($isEdit ? $schedule->is_night_shift : 0)) ? 'checked' : '' ?>> وردية ليلية</label></div>
</div>
</div>
<div class="card" style="margin-bottom:20px;">
......
......@@ -5,7 +5,7 @@
<!-- نموذج التعيين -->
<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;">
<form method="POST" action="/hr/shifts/assignments" 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>
......
......@@ -5,8 +5,8 @@
<?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' : '';
$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;">
......
......@@ -172,19 +172,19 @@ $coveragePct = $planTotal > 0 ? min(100, round($uploadedTotal / $planTotal * 10
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:15px;">
<div class="form-group">
<label class="form-label">رقم الشيك <span style="color:#DC2626;">*</span></label>
<input type="text" name="cheque_number" class="form-input" required maxlength="50" value="<?= e(old('cheque_number') ?? $nextNum) ?>" placeholder="مثال: <?= $nextNum ?>">
<input type="text" name="cheque_number" class="form-input" required maxlength="50" value="<?= e(old('cheque_number') ?: $nextNum) ?>" placeholder="مثال: <?= $nextNum ?>">
</div>
<div class="form-group">
<label class="form-label">البنك <span style="color:#DC2626;">*</span></label>
<input type="text" name="bank_name" class="form-input" required maxlength="200" value="<?= e(old('bank_name') ?? '') ?>" placeholder="البنك الأهلي المصري">
<input type="text" name="bank_name" class="form-input" required maxlength="200" value="<?= e(old('bank_name') ?: '') ?>" placeholder="البنك الأهلي المصري">
</div>
<div class="form-group">
<label class="form-label">تاريخ الشيك <span style="color:#DC2626;">*</span></label>
<input type="date" name="cheque_date" class="form-input" required value="<?= e(old('cheque_date') ?? '') ?>">
<input type="date" name="cheque_date" class="form-input" required value="<?= e(old('cheque_date') ?: '') ?>">
</div>
<div class="form-group">
<label class="form-label">مبلغ الشيك <span style="color:#DC2626;">*</span></label>
<input type="number" name="cheque_amount" class="form-input" required step="0.01" min="0.01" value="<?= e(old('cheque_amount') ?? number_format($monthlyPay, 2, '.', '')) ?>" style="direction:ltr;text-align:left;">
<input type="number" name="cheque_amount" class="form-input" required step="0.01" min="0.01" value="<?= e(old('cheque_amount') ?: number_format($monthlyPay, 2, '.', '')) ?>" style="direction:ltr;text-align:left;">
</div>
</div>
<div class="form-group" style="margin-bottom:15px;">
......@@ -194,7 +194,7 @@ $coveragePct = $planTotal > 0 ? min(100, round($uploadedTotal / $planTotal * 10
</div>
<div class="form-group" style="margin-bottom:15px;">
<label class="form-label">ملاحظات</label>
<input type="text" name="notes" class="form-input" maxlength="500" value="<?= e(old('notes') ?? '') ?>">
<input type="text" name="notes" class="form-input" maxlength="500" value="<?= e(old('notes') ?: '') ?>">
</div>
<button type="submit" class="btn btn-primary" style="width:100%;"><i data-lucide="upload" style="width:16px;height:16px;vertical-align:middle;margin-left:4px;"></i> رفع الشيك</button>
</form>
......
......@@ -95,18 +95,18 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">نقاط القوة</label>
<textarea name="strengths_ar" class="form-input" rows="3" placeholder="نقاط القوة لدى اللاعب..."><?= e(old('strengths_ar') ?? '') ?></textarea>
<textarea name="strengths_ar" class="form-input" rows="3" placeholder="نقاط القوة لدى اللاعب..."><?= e(old('strengths_ar') ?: '') ?></textarea>
</div>
<div>
<label class="form-label">نقاط الضعف</label>
<textarea name="weaknesses_ar" class="form-input" rows="3" placeholder="نقاط الضعف والتحسينات المطلوبة..."><?= e(old('weaknesses_ar') ?? '') ?></textarea>
<textarea name="weaknesses_ar" class="form-input" rows="3" placeholder="نقاط الضعف والتحسينات المطلوبة..."><?= e(old('weaknesses_ar') ?: '') ?></textarea>
</div>
</div>
<!-- Coach Notes -->
<div style="margin-bottom:20px;">
<label class="form-label">ملاحظات المدرب</label>
<textarea name="coach_notes" class="form-input" rows="3" placeholder="ملاحظات إضافية..."><?= e(old('coach_notes') ?? '') ?></textarea>
<textarea name="coach_notes" class="form-input" rows="3" placeholder="ملاحظات إضافية..."><?= e(old('coach_notes') ?: '') ?></textarea>
</div>
<!-- Parent Visible -->
......
......@@ -22,7 +22,7 @@ $__template->layout('Layout.main');
<select name="player_id" class="form-input" required>
<option value="">-- اختر اللاعب --</option>
<?php foreach ($players as $p): ?>
<option value="<?= (int) $p['id'] ?>" <?= (old('player_id') ?? $selectedPlayerId) == $p['id'] ? 'selected' : '' ?>><?= e($p['full_name_ar']) ?> (<?= e($p['registration_serial'] ?? '') ?>)</option>
<option value="<?= (int) $p['id'] ?>" <?= (old('player_id') ?: $selectedPlayerId) == $p['id'] ? 'selected' : '' ?>><?= e($p['full_name_ar']) ?> (<?= e($p['registration_serial'] ?? '') ?>)</option>
<?php endforeach; ?>
</select>
</div>
......@@ -31,7 +31,7 @@ $__template->layout('Layout.main');
<!-- Test Date -->
<div>
<label class="form-label">تاريخ الاختبار <span style="color:#DC2626;">*</span></label>
<input type="date" name="test_date" value="<?= e(old('test_date') ?? date('Y-m-d')) ?>" class="form-input" required>
<input type="date" name="test_date" value="<?= e(old('test_date') ?: date('Y-m-d')) ?>" class="form-input" required>
</div>
<!-- Test Type -->
......@@ -76,19 +76,19 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:12px;">
<div>
<label class="form-label" style="font-size:12px;">الوزن (كجم)</label>
<input type="number" name="weight_kg" value="<?= e(old('weight_kg') ?? '') ?>" class="form-input" step="0.1" min="10" max="200">
<input type="number" name="weight_kg" value="<?= e(old('weight_kg') ?: '') ?>" class="form-input" step="0.1" min="10" max="200">
</div>
<div>
<label class="form-label" style="font-size:12px;">الطول (سم)</label>
<input type="number" name="height_cm" value="<?= e(old('height_cm') ?? '') ?>" class="form-input" step="0.1" min="50" max="250">
<input type="number" name="height_cm" value="<?= e(old('height_cm') ?: '') ?>" class="form-input" step="0.1" min="50" max="250">
</div>
<div>
<label class="form-label" style="font-size:12px;">معدل نبض الراحة</label>
<input type="number" name="resting_heart_rate" value="<?= e(old('resting_heart_rate') ?? '') ?>" class="form-input" min="30" max="200">
<input type="number" name="resting_heart_rate" value="<?= e(old('resting_heart_rate') ?: '') ?>" class="form-input" min="30" max="200">
</div>
<div>
<label class="form-label" style="font-size:12px;">ضغط الدم</label>
<input type="text" name="blood_pressure" value="<?= e(old('blood_pressure') ?? '') ?>" class="form-input" placeholder="120/80" dir="ltr">
<input type="text" name="blood_pressure" value="<?= e(old('blood_pressure') ?: '') ?>" class="form-input" placeholder="120/80" dir="ltr">
</div>
</div>
</div>
......@@ -97,7 +97,7 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">الدرجة الكلية (0-100)</label>
<input type="number" name="overall_fitness_score" value="<?= e(old('overall_fitness_score') ?? '') ?>" class="form-input" min="0" max="100" step="0.1">
<input type="number" name="overall_fitness_score" value="<?= e(old('overall_fitness_score') ?: '') ?>" class="form-input" min="0" max="100" step="0.1">
</div>
<div>
<label class="form-label">لائق للنشاط</label>
......@@ -130,18 +130,18 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">اسم الفاحص</label>
<input type="text" name="tester_name" value="<?= e(old('tester_name') ?? '') ?>" class="form-input" placeholder="اسم الطبيب / المختص">
<input type="text" name="tester_name" value="<?= e(old('tester_name') ?: '') ?>" class="form-input" placeholder="اسم الطبيب / المختص">
</div>
<div>
<label class="form-label">موعد الاختبار القادم</label>
<input type="date" name="next_test_date" value="<?= e(old('next_test_date') ?? '') ?>" class="form-input">
<input type="date" name="next_test_date" value="<?= e(old('next_test_date') ?: '') ?>" class="form-input">
</div>
</div>
<!-- Recommendations -->
<div style="margin-bottom:20px;">
<label class="form-label">التوصيات</label>
<textarea name="recommendations_ar" class="form-input" rows="3" placeholder="توصيات وملاحظات..."><?= e(old('recommendations_ar') ?? '') ?></textarea>
<textarea name="recommendations_ar" class="form-input" rows="3" placeholder="توصيات وملاحظات..."><?= e(old('recommendations_ar') ?: '') ?></textarea>
</div>
<!-- Actions -->
......
......@@ -77,7 +77,7 @@ $__template->layout('Layout.main');
<!-- Occurred Date -->
<div>
<label class="form-label">تاريخ الإصابة <span style="color:#DC2626;">*</span></label>
<input type="date" name="occurred_date" value="<?= e(old('occurred_date') ?? date('Y-m-d')) ?>" class="form-input" required>
<input type="date" name="occurred_date" value="<?= e(old('occurred_date') ?: date('Y-m-d')) ?>" class="form-input" required>
</div>
</div>
......@@ -96,25 +96,25 @@ $__template->layout('Layout.main');
<!-- Estimated Recovery -->
<div>
<label class="form-label">فترة التعافي المتوقعة (أيام)</label>
<input type="number" name="estimated_recovery_days" value="<?= e(old('estimated_recovery_days') ?? '') ?>" class="form-input" min="1" max="365">
<input type="number" name="estimated_recovery_days" value="<?= e(old('estimated_recovery_days') ?: '') ?>" class="form-input" min="1" max="365">
</div>
</div>
<!-- Description -->
<div style="margin-bottom:20px;">
<label class="form-label">وصف الإصابة</label>
<textarea name="description_ar" class="form-input" rows="3" placeholder="وصف تفصيلي لما حدث..."><?= e(old('description_ar') ?? '') ?></textarea>
<textarea name="description_ar" class="form-input" rows="3" placeholder="وصف تفصيلي لما حدث..."><?= e(old('description_ar') ?: '') ?></textarea>
</div>
<!-- Diagnosis -->
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">التشخيص</label>
<textarea name="diagnosis_ar" class="form-input" rows="2" placeholder="التشخيص الطبي..."><?= e(old('diagnosis_ar') ?? '') ?></textarea>
<textarea name="diagnosis_ar" class="form-input" rows="2" placeholder="التشخيص الطبي..."><?= e(old('diagnosis_ar') ?: '') ?></textarea>
</div>
<div>
<label class="form-label">العلاج</label>
<textarea name="treatment_ar" class="form-input" rows="2" placeholder="خطة العلاج..."><?= e(old('treatment_ar') ?? '') ?></textarea>
<textarea name="treatment_ar" class="form-input" rows="2" placeholder="خطة العلاج..."><?= e(old('treatment_ar') ?: '') ?></textarea>
</div>
</div>
......@@ -122,20 +122,20 @@ $__template->layout('Layout.main');
<!-- Diagnosed By -->
<div>
<label class="form-label">تم التشخيص بواسطة</label>
<input type="text" name="diagnosed_by" value="<?= e(old('diagnosed_by') ?? '') ?>" class="form-input" placeholder="اسم الطبيب / المعالج">
<input type="text" name="diagnosed_by" value="<?= e(old('diagnosed_by') ?: '') ?>" class="form-input" placeholder="اسم الطبيب / المعالج">
</div>
<!-- Follow Up Date -->
<div>
<label class="form-label">تاريخ المتابعة</label>
<input type="date" name="follow_up_date" value="<?= e(old('follow_up_date') ?? '') ?>" class="form-input">
<input type="date" name="follow_up_date" value="<?= e(old('follow_up_date') ?: '') ?>" class="form-input">
</div>
</div>
<!-- Notes -->
<div style="margin-bottom:20px;">
<label class="form-label">ملاحظات</label>
<textarea name="notes" class="form-input" rows="2" placeholder="ملاحظات إضافية..."><?= e(old('notes') ?? '') ?></textarea>
<textarea name="notes" class="form-input" rows="2" placeholder="ملاحظات إضافية..."><?= e(old('notes') ?: '') ?></textarea>
</div>
<!-- Actions -->
......
......@@ -88,15 +88,15 @@ $preselectedEnd = $_GET['end'] ?? '';
</div>
<div class="form-group" style="margin-bottom:12px;">
<label class="form-label">اسم الحاجز <span style="color:#DC2626;">*</span></label>
<input type="text" name="booker_name" value="<?= e(old('booker_name') ?? '') ?>" class="form-input" required>
<input type="text" name="booker_name" value="<?= e(old('booker_name') ?: '') ?>" class="form-input" required>
</div>
<div class="form-group" style="margin-bottom:12px;">
<label class="form-label">عدد السبّاحين المتوقع</label>
<input type="number" name="expected_swimmers" value="<?= e(old('expected_swimmers') ?? '1') ?>" class="form-input" min="1" style="direction:ltr;text-align:left;">
<input type="number" name="expected_swimmers" value="<?= e(old('expected_swimmers') ?: '1') ?>" class="form-input" min="1" style="direction:ltr;text-align:left;">
</div>
<div class="form-group">
<label class="form-label">ملاحظات</label>
<textarea name="notes" class="form-input" rows="2"><?= e(old('notes') ?? '') ?></textarea>
<textarea name="notes" class="form-input" rows="2"><?= e(old('notes') ?: '') ?></textarea>
</div>
</div>
</div>
......
......@@ -29,11 +29,11 @@
</div>
<div class="form-group">
<label class="form-label">الاسم بالعربي <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? '') ?>" class="form-input" required placeholder="مثال: الحمام الأولمبي">
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: '') ?>" class="form-input" required placeholder="مثال: الحمام الأولمبي">
</div>
<div class="form-group">
<label class="form-label">الاسم بالإنجليزي</label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?? '') ?>" class="form-input" style="direction:ltr;text-align:left;" placeholder="Olympic Pool">
<input type="text" name="name_en" value="<?= e(old('name_en') ?: '') ?>" class="form-input" style="direction:ltr;text-align:left;" placeholder="Olympic Pool">
</div>
</div>
</div>
......@@ -49,33 +49,33 @@
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;">
<div class="form-group">
<label class="form-label">الطول (متر) <span style="color:#DC2626;">*</span></label>
<input type="number" name="length_meters" value="<?= e(old('length_meters') ?? '50') ?>" class="form-input" min="5" max="100" step="0.5" required style="direction:ltr;text-align:left;">
<input type="number" name="length_meters" value="<?= e(old('length_meters') ?: '50') ?>" class="form-input" min="5" max="100" step="0.5" required style="direction:ltr;text-align:left;">
</div>
<div class="form-group">
<label class="form-label">العرض (متر) <span style="color:#DC2626;">*</span></label>
<input type="number" name="width_meters" value="<?= e(old('width_meters') ?? '25') ?>" class="form-input" min="3" max="50" step="0.5" required style="direction:ltr;text-align:left;">
<input type="number" name="width_meters" value="<?= e(old('width_meters') ?: '25') ?>" class="form-input" min="3" max="50" step="0.5" required style="direction:ltr;text-align:left;">
</div>
<div class="form-group">
<label class="form-label">العمق الضحل (متر)</label>
<input type="number" name="depth_shallow" value="<?= e(old('depth_shallow') ?? '1.2') ?>" class="form-input" min="0.5" max="5" step="0.1" style="direction:ltr;text-align:left;">
<input type="number" name="depth_shallow" value="<?= e(old('depth_shallow') ?: '1.2') ?>" class="form-input" min="0.5" max="5" step="0.1" style="direction:ltr;text-align:left;">
</div>
<div class="form-group">
<label class="form-label">العمق العميق (متر)</label>
<input type="number" name="depth_deep" value="<?= e(old('depth_deep') ?? '2.0') ?>" class="form-input" min="0.5" max="10" step="0.1" style="direction:ltr;text-align:left;">
<input type="number" name="depth_deep" value="<?= e(old('depth_deep') ?: '2.0') ?>" class="form-input" min="0.5" max="10" step="0.1" style="direction:ltr;text-align:left;">
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;margin-top:15px;">
<div class="form-group">
<label class="form-label">عدد الحارات الطولية <span style="color:#DC2626;">*</span></label>
<input type="number" name="total_lanes_lengthwise" value="<?= e(old('total_lanes_lengthwise') ?? '6') ?>" class="form-input" min="1" max="12" required style="direction:ltr;text-align:left;" id="laneCount">
<input type="number" name="total_lanes_lengthwise" value="<?= e(old('total_lanes_lengthwise') ?: '6') ?>" class="form-input" min="1" max="12" required style="direction:ltr;text-align:left;" id="laneCount">
</div>
<div class="form-group">
<label class="form-label">الحد الأقصى الإجمالي</label>
<input type="number" name="max_total_swimmers" value="<?= e(old('max_total_swimmers') ?? '50') ?>" class="form-input" min="1" style="direction:ltr;text-align:left;">
<input type="number" name="max_total_swimmers" value="<?= e(old('max_total_swimmers') ?: '50') ?>" class="form-input" min="1" style="direction:ltr;text-align:left;">
</div>
<div class="form-group">
<label class="form-label">حد أقصى لكل حارة</label>
<input type="number" name="max_per_lane" value="<?= e(old('max_per_lane') ?? '8') ?>" class="form-input" min="1" style="direction:ltr;text-align:left;">
<input type="number" name="max_per_lane" value="<?= e(old('max_per_lane') ?: '8') ?>" class="form-input" min="1" style="direction:ltr;text-align:left;">
</div>
</div>
......
......@@ -19,39 +19,39 @@ $__template->layout('Layout.main');
<div style="padding:20px;display:grid;grid-template-columns:repeat(auto-fit, minmax(250px, 1fr));gap:15px;">
<div>
<label class="form-label">رقم العقد <span style="color:#DC2626;">*</span></label>
<input type="text" name="contract_number" value="<?= e(old('contract_number') ?? '') ?>" class="form-input" dir="ltr" required maxlength="50" placeholder="مثال: CTR-2026-001">
<input type="text" name="contract_number" value="<?= e(old('contract_number') ?: '') ?>" class="form-input" dir="ltr" required maxlength="50" placeholder="مثال: CTR-2026-001">
</div>
<div>
<label class="form-label">نوع العقد <span style="color:#DC2626;">*</span></label>
<select name="contract_type" class="form-select" required>
<option value="revenue_share" <?= (old('contract_type') ?? '') === 'revenue_share' ? 'selected' : '' ?>>نسبة إيرادات</option>
<option value="revenue_share" <?= (old('contract_type') ?: '') === 'revenue_share' ? 'selected' : '' ?>>نسبة إيرادات</option>
<option value="fixed_rent" <?= old('contract_type') === 'fixed_rent' ? 'selected' : '' ?>>إيجار ثابت</option>
<option value="hybrid" <?= old('contract_type') === 'hybrid' ? 'selected' : '' ?>>مختلط</option>
</select>
</div>
<div>
<label class="form-label">تاريخ البداية <span style="color:#DC2626;">*</span></label>
<input type="date" name="start_date" value="<?= e(old('start_date') ?? '') ?>" class="form-input" required>
<input type="date" name="start_date" value="<?= e(old('start_date') ?: '') ?>" class="form-input" required>
</div>
<div>
<label class="form-label">تاريخ النهاية <span style="color:#DC2626;">*</span></label>
<input type="date" name="end_date" value="<?= e(old('end_date') ?? '') ?>" class="form-input" required>
<input type="date" name="end_date" value="<?= e(old('end_date') ?: '') ?>" class="form-input" required>
</div>
<div>
<label class="form-label">نسبة النادي (%)</label>
<input type="number" name="club_commission_pct" value="<?= e(old('club_commission_pct') ?? '0') ?>" class="form-input" step="0.1" min="0" max="100">
<input type="number" name="club_commission_pct" value="<?= e(old('club_commission_pct') ?: '0') ?>" class="form-input" step="0.1" min="0" max="100">
</div>
<div>
<label class="form-label">نسبة الأكاديمية (%)</label>
<input type="number" name="academy_share_pct" value="<?= e(old('academy_share_pct') ?? '0') ?>" class="form-input" step="0.1" min="0" max="100">
<input type="number" name="academy_share_pct" value="<?= e(old('academy_share_pct') ?: '0') ?>" class="form-input" step="0.1" min="0" max="100">
</div>
<div>
<label class="form-label">الإيجار الشهري الثابت</label>
<input type="number" name="fixed_monthly_rent" value="<?= e(old('fixed_monthly_rent') ?? '0') ?>" class="form-input" step="0.01" min="0">
<input type="number" name="fixed_monthly_rent" value="<?= e(old('fixed_monthly_rent') ?: '0') ?>" class="form-input" step="0.01" min="0">
</div>
<div>
<label class="form-label">مبلغ التأمين</label>
<input type="number" name="deposit_amount" value="<?= e(old('deposit_amount') ?? '0') ?>" class="form-input" step="0.01" min="0">
<input type="number" name="deposit_amount" value="<?= e(old('deposit_amount') ?: '0') ?>" class="form-input" step="0.01" min="0">
</div>
<div>
<label class="form-label">ملف العقد (PDF) <span style="color:#DC2626;">*</span></label>
......@@ -59,7 +59,7 @@ $__template->layout('Layout.main');
</div>
<div style="grid-column:1 / -1;">
<label class="form-label">ملاحظات</label>
<textarea name="notes" class="form-input" rows="3" placeholder="ملاحظات على العقد..."><?= e(old('notes') ?? '') ?></textarea>
<textarea name="notes" class="form-input" rows="3" placeholder="ملاحظات على العقد..."><?= e(old('notes') ?: '') ?></textarea>
</div>
</div>
</div>
......
......@@ -19,15 +19,15 @@ $__template->layout('Layout.main');
<div style="padding:20px;display:grid;grid-template-columns:repeat(auto-fit, minmax(250px, 1fr));gap:15px;">
<div>
<label class="form-label">الكود <span style="color:#DC2626;">*</span></label>
<input type="text" name="code" value="<?= e(old('code') ?? '') ?>" class="form-input" dir="ltr" required maxlength="30" placeholder="مثال: ACAD_SWIM_01">
<input type="text" name="code" value="<?= e(old('code') ?: '') ?>" class="form-input" dir="ltr" required maxlength="30" placeholder="مثال: ACAD_SWIM_01">
</div>
<div>
<label class="form-label">الاسم بالعربي <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? '') ?>" class="form-input" required maxlength="300">
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: '') ?>" class="form-input" required maxlength="300">
</div>
<div>
<label class="form-label">الاسم بالإنجليزي</label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?? '') ?>" class="form-input" dir="ltr" maxlength="300">
<input type="text" name="name_en" value="<?= e(old('name_en') ?: '') ?>" class="form-input" dir="ltr" maxlength="300">
</div>
<div>
<label class="form-label">اللعبة / النشاط الرياضي <span style="color:#DC2626;">*</span></label>
......@@ -41,26 +41,26 @@ $__template->layout('Layout.main');
<div>
<label class="form-label">نوع الأكاديمية <span style="color:#DC2626;">*</span></label>
<select name="academy_type" class="form-select" required>
<option value="internal" <?= (old('academy_type') ?? '') === 'internal' ? 'selected' : '' ?>>داخلية</option>
<option value="internal" <?= (old('academy_type') ?: '') === 'internal' ? 'selected' : '' ?>>داخلية</option>
<option value="external" <?= old('academy_type') === 'external' ? 'selected' : '' ?>>خارجية</option>
<option value="partnership" <?= old('academy_type') === 'partnership' ? 'selected' : '' ?>>شراكة</option>
</select>
</div>
<div>
<label class="form-label">مسؤول التواصل</label>
<input type="text" name="contact_person" value="<?= e(old('contact_person') ?? '') ?>" class="form-input" maxlength="200">
<input type="text" name="contact_person" value="<?= e(old('contact_person') ?: '') ?>" class="form-input" maxlength="200">
</div>
<div>
<label class="form-label">هاتف التواصل</label>
<input type="text" name="contact_phone" value="<?= e(old('contact_phone') ?? '') ?>" class="form-input" dir="ltr" maxlength="30">
<input type="text" name="contact_phone" value="<?= e(old('contact_phone') ?: '') ?>" class="form-input" dir="ltr" maxlength="30">
</div>
<div>
<label class="form-label">البريد الإلكتروني</label>
<input type="email" name="contact_email" value="<?= e(old('contact_email') ?? '') ?>" class="form-input" dir="ltr" maxlength="200">
<input type="email" name="contact_email" value="<?= e(old('contact_email') ?: '') ?>" class="form-input" dir="ltr" maxlength="200">
</div>
<div style="grid-column:1 / -1;">
<label class="form-label">الوصف</label>
<textarea name="description_ar" class="form-input" rows="3" placeholder="وصف الأكاديمية..."><?= e(old('description_ar') ?? '') ?></textarea>
<textarea name="description_ar" class="form-input" rows="3" placeholder="وصف الأكاديمية..."><?= e(old('description_ar') ?: '') ?></textarea>
</div>
</div>
</div>
......
......@@ -19,48 +19,48 @@ $__template->layout('Layout.main');
<div style="padding:20px;display:grid;grid-template-columns:repeat(auto-fit, minmax(250px, 1fr));gap:15px;">
<div>
<label class="form-label">الكود <span style="color:#DC2626;">*</span></label>
<input type="text" name="code" value="<?= e(old('code') ?? $academy['code'] ?? '') ?>" class="form-input" dir="ltr" required maxlength="30">
<input type="text" name="code" value="<?= e(old('code') ?: $academy['code'] ?? '') ?>" class="form-input" dir="ltr" required maxlength="30">
</div>
<div>
<label class="form-label">الاسم بالعربي <span style="color:#DC2626;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? $academy['name_ar'] ?? '') ?>" class="form-input" required maxlength="300">
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: $academy['name_ar'] ?? '') ?>" class="form-input" required maxlength="300">
</div>
<div>
<label class="form-label">الاسم بالإنجليزي</label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?? $academy['name_en'] ?? '') ?>" class="form-input" dir="ltr" maxlength="300">
<input type="text" name="name_en" value="<?= e(old('name_en') ?: $academy['name_en'] ?? '') ?>" class="form-input" dir="ltr" maxlength="300">
</div>
<div>
<label class="form-label">اللعبة / النشاط الرياضي <span style="color:#DC2626;">*</span></label>
<select name="discipline_id" class="form-select" required>
<option value="">اختر...</option>
<?php foreach ($disciplines as $disc): ?>
<option value="<?= (int) $disc['id'] ?>" <?= (old('discipline_id') ?? $academy['discipline_id'] ?? '') == $disc['id'] ? 'selected' : '' ?>><?= e($disc['name_ar']) ?></option>
<option value="<?= (int) $disc['id'] ?>" <?= (old('discipline_id') ?: $academy['discipline_id'] ?? '') == $disc['id'] ? 'selected' : '' ?>><?= e($disc['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div>
<label class="form-label">نوع الأكاديمية <span style="color:#DC2626;">*</span></label>
<select name="academy_type" class="form-select" required>
<option value="internal" <?= (old('academy_type') ?? $academy['academy_type'] ?? '') === 'internal' ? 'selected' : '' ?>>داخلية</option>
<option value="external" <?= (old('academy_type') ?? $academy['academy_type'] ?? '') === 'external' ? 'selected' : '' ?>>خارجية</option>
<option value="partnership" <?= (old('academy_type') ?? $academy['academy_type'] ?? '') === 'partnership' ? 'selected' : '' ?>>شراكة</option>
<option value="internal" <?= (old('academy_type') ?: $academy['academy_type'] ?? '') === 'internal' ? 'selected' : '' ?>>داخلية</option>
<option value="external" <?= (old('academy_type') ?: $academy['academy_type'] ?? '') === 'external' ? 'selected' : '' ?>>خارجية</option>
<option value="partnership" <?= (old('academy_type') ?: $academy['academy_type'] ?? '') === 'partnership' ? 'selected' : '' ?>>شراكة</option>
</select>
</div>
<div>
<label class="form-label">مسؤول التواصل</label>
<input type="text" name="contact_person" value="<?= e(old('contact_person') ?? $academy['contact_person'] ?? '') ?>" class="form-input" maxlength="200">
<input type="text" name="contact_person" value="<?= e(old('contact_person') ?: $academy['contact_person'] ?? '') ?>" class="form-input" maxlength="200">
</div>
<div>
<label class="form-label">هاتف التواصل</label>
<input type="text" name="contact_phone" value="<?= e(old('contact_phone') ?? $academy['contact_phone'] ?? '') ?>" class="form-input" dir="ltr" maxlength="30">
<input type="text" name="contact_phone" value="<?= e(old('contact_phone') ?: $academy['contact_phone'] ?? '') ?>" class="form-input" dir="ltr" maxlength="30">
</div>
<div>
<label class="form-label">البريد الإلكتروني</label>
<input type="email" name="contact_email" value="<?= e(old('contact_email') ?? $academy['contact_email'] ?? '') ?>" class="form-input" dir="ltr" maxlength="200">
<input type="email" name="contact_email" value="<?= e(old('contact_email') ?: $academy['contact_email'] ?? '') ?>" class="form-input" dir="ltr" maxlength="200">
</div>
<div style="grid-column:1 / -1;">
<label class="form-label">الوصف</label>
<textarea name="description_ar" class="form-input" rows="3"><?= e(old('description_ar') ?? $academy['description_ar'] ?? '') ?></textarea>
<textarea name="description_ar" class="form-input" rows="3"><?= e(old('description_ar') ?: $academy['description_ar'] ?? '') ?></textarea>
</div>
</div>
</div>
......
......@@ -77,7 +77,7 @@
<label class="form-label">نوع المدرب <span style="color:#DC2626;">*</span></label>
<select name="coach_type" id="coachTypeSelect" class="form-select">
<?php foreach ($coachTypes as $key => $label): ?>
<option value="<?= e($key) ?>" <?= (old('coach_type') ?? 'independent') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<option value="<?= e($key) ?>" <?= (old('coach_type') ?: 'independent') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -128,7 +128,7 @@
</div>
<div class="form-group">
<label class="form-label">أقصى عدد مجموعات</label>
<input type="number" name="max_groups" value="<?= e(old('max_groups') ?? '10') ?>" class="form-input" min="1" step="1" style="direction:ltr;text-align:left;">
<input type="number" name="max_groups" value="<?= e(old('max_groups') ?: '10') ?>" class="form-input" min="1" step="1" style="direction:ltr;text-align:left;">
</div>
</div>
</div>
......
......@@ -28,26 +28,26 @@ $__template->layout('Layout.main');
</div>
<div id="member_id_field" style="display:none;">
<label class="form-label">رقم العضوية <span style="color:#DC2626;">*</span> <span style="font-weight:400;color:#6B7280;font-size:12px;">(يملأ البيانات تلقائياً)</span></label>
<input type="text" id="membershipNoInput" value="<?= e(old('membership_number') ?? '') ?>" class="form-input" placeholder="أدخل رقم العضوية" inputmode="numeric" dir="ltr" style="text-align:right;letter-spacing:1px;">
<input type="hidden" name="member_id" id="memberIdHidden" value="<?= e(old('member_id') ?? '') ?>">
<input type="text" id="membershipNoInput" value="<?= e(old('membership_number') ?: '') ?>" class="form-input" placeholder="أدخل رقم العضوية" inputmode="numeric" dir="ltr" style="text-align:right;letter-spacing:1px;">
<input type="hidden" name="member_id" id="memberIdHidden" value="<?= e(old('member_id') ?: '') ?>">
<div id="memberLookupStatus" style="display:none;margin-top:6px;padding:8px 12px;border-radius:6px;font-size:12px;"></div>
</div>
<div>
<label class="form-label">الاسم بالعربي <span style="color:#DC2626;">*</span></label>
<input type="text" name="full_name_ar" value="<?= e(old('full_name_ar') ?? '') ?>" class="form-input" required maxlength="300">
<input type="text" name="full_name_ar" value="<?= e(old('full_name_ar') ?: '') ?>" class="form-input" required maxlength="300">
</div>
<div>
<label class="form-label">الاسم بالإنجليزي</label>
<input type="text" name="full_name_en" value="<?= e(old('full_name_en') ?? '') ?>" class="form-input" dir="ltr" maxlength="300">
<input type="text" name="full_name_en" value="<?= e(old('full_name_en') ?: '') ?>" class="form-input" dir="ltr" maxlength="300">
</div>
<div>
<label class="form-label">الرقم القومي</label>
<input type="text" name="national_id" value="<?= e(old('national_id') ?? '') ?>" class="form-input" maxlength="14" dir="ltr" id="nidInput">
<input type="text" name="national_id" value="<?= e(old('national_id') ?: '') ?>" class="form-input" maxlength="14" dir="ltr" id="nidInput">
<small id="nidStatus" style="display:none;margin-top:4px;font-size:11px;"></small>
</div>
<div>
<label class="form-label">تاريخ الميلاد</label>
<input type="date" name="date_of_birth" value="<?= e(old('date_of_birth') ?? '') ?>" class="form-input" id="dobInput" readonly style="background:#F9FAFB;">
<input type="date" name="date_of_birth" value="<?= e(old('date_of_birth') ?: '') ?>" class="form-input" id="dobInput" readonly style="background:#F9FAFB;">
<input type="hidden" name="age_years" id="ageYears">
</div>
<div>
......@@ -56,15 +56,15 @@ $__template->layout('Layout.main');
<option value="male" <?= old('gender') === 'male' || old('gender') === '' ? 'selected' : '' ?>>ذكر</option>
<option value="female" <?= old('gender') === 'female' ? 'selected' : '' ?>>أنثى</option>
</select>
<input type="hidden" name="gender" id="genderHidden" value="<?= e(old('gender') ?? 'male') ?>">
<input type="hidden" name="gender" id="genderHidden" value="<?= e(old('gender') ?: 'male') ?>">
</div>
<div>
<label class="form-label">الهاتف</label>
<input type="text" name="phone" value="<?= e(old('phone') ?? '') ?>" class="form-input" dir="ltr" maxlength="30">
<input type="text" name="phone" value="<?= e(old('phone') ?: '') ?>" class="form-input" dir="ltr" maxlength="30">
</div>
<div>
<label class="form-label">البريد الإلكتروني</label>
<input type="email" name="email" value="<?= e(old('email') ?? '') ?>" class="form-input" dir="ltr" maxlength="200">
<input type="email" name="email" value="<?= e(old('email') ?: '') ?>" class="form-input" dir="ltr" maxlength="200">
</div>
</div>
</div>
......@@ -77,15 +77,15 @@ $__template->layout('Layout.main');
<div style="padding:20px;display:grid;grid-template-columns:repeat(auto-fit, minmax(250px, 1fr));gap:15px;">
<div>
<label class="form-label">اسم ولي الأمر</label>
<input type="text" name="guardian_name" value="<?= e(old('guardian_name') ?? '') ?>" class="form-input" maxlength="300">
<input type="text" name="guardian_name" value="<?= e(old('guardian_name') ?: '') ?>" class="form-input" maxlength="300">
</div>
<div>
<label class="form-label">هاتف ولي الأمر</label>
<input type="text" name="guardian_phone" value="<?= e(old('guardian_phone') ?? '') ?>" class="form-input" dir="ltr" maxlength="30">
<input type="text" name="guardian_phone" value="<?= e(old('guardian_phone') ?: '') ?>" class="form-input" dir="ltr" maxlength="30">
</div>
<div>
<label class="form-label">الرقم القومي لولي الأمر</label>
<input type="text" name="guardian_national_id" value="<?= e(old('guardian_national_id') ?? '') ?>" class="form-input" maxlength="14" dir="ltr">
<input type="text" name="guardian_national_id" value="<?= e(old('guardian_national_id') ?: '') ?>" class="form-input" maxlength="14" dir="ltr">
</div>
<div>
<label class="form-label">صلة القرابة</label>
......@@ -108,7 +108,7 @@ $__template->layout('Layout.main');
<h3 style="margin:0;font-size:16px;font-weight:600;">ملاحظات</h3>
</div>
<div style="padding:20px;">
<textarea name="notes" class="form-input" rows="4" placeholder="ملاحظات إضافية..."><?= e(old('notes') ?? '') ?></textarea>
<textarea name="notes" class="form-input" rows="4" placeholder="ملاحظات إضافية..."><?= e(old('notes') ?: '') ?></textarea>
</div>
</div>
......
......@@ -27,7 +27,7 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div style="grid-column:span 2;">
<label class="form-label">اسم البطولة <span style="color:red;">*</span></label>
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?? $t['name_ar'] ?? '') ?>" class="form-input" required placeholder="مثال: بطولة النادي لكرة القدم">
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: $t['name_ar'] ?? '') ?>" class="form-input" required placeholder="مثال: بطولة النادي لكرة القدم">
</div>
<div>
......@@ -35,7 +35,7 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<select name="discipline_id" class="form-input" required>
<option value="">اختر...</option>
<?php foreach ($disciplines as $d): ?>
<option value="<?= (int) $d['id'] ?>" <?= (old('discipline_id') ?? $t['discipline_id'] ?? '') == $d['id'] ? 'selected' : '' ?>><?= e($d['name_ar']) ?></option>
<option value="<?= (int) $d['id'] ?>" <?= (old('discipline_id') ?: $t['discipline_id'] ?? '') == $d['id'] ? 'selected' : '' ?>><?= e($d['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -45,7 +45,7 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<select name="tournament_type" class="form-input" required>
<option value="">اختر...</option>
<?php foreach ($types as $key => $label): ?>
<option value="<?= e($key) ?>" <?= (old('tournament_type') ?? $t['tournament_type'] ?? '') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<option value="<?= e($key) ?>" <?= (old('tournament_type') ?: $t['tournament_type'] ?? '') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -55,7 +55,7 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<select name="format" class="form-input" required>
<option value="">اختر...</option>
<?php foreach ($formats as $key => $label): ?>
<option value="<?= e($key) ?>" <?= (old('format') ?? $t['format'] ?? '') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<option value="<?= e($key) ?>" <?= (old('format') ?: $t['format'] ?? '') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -64,7 +64,7 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<label class="form-label">الجنس</label>
<select name="gender" class="form-input">
<?php foreach ($genders as $key => $label): ?>
<option value="<?= e($key) ?>" <?= (old('gender') ?? $t['gender'] ?? 'mixed') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<option value="<?= e($key) ?>" <?= (old('gender') ?: $t['gender'] ?? 'mixed') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
<?php endforeach; ?>
</select>
</div>
......@@ -75,19 +75,19 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">تاريخ البدء <span style="color:red;">*</span></label>
<input type="date" name="start_date" value="<?= e(old('start_date') ?? $t['start_date'] ?? '') ?>" class="form-input" required>
<input type="date" name="start_date" value="<?= e(old('start_date') ?: $t['start_date'] ?? '') ?>" class="form-input" required>
</div>
<div>
<label class="form-label">تاريخ الانتهاء</label>
<input type="date" name="end_date" value="<?= e(old('end_date') ?? $t['end_date'] ?? '') ?>" class="form-input">
<input type="date" name="end_date" value="<?= e(old('end_date') ?: $t['end_date'] ?? '') ?>" class="form-input">
</div>
<div>
<label class="form-label">بداية التسجيل</label>
<input type="date" name="registration_start" value="<?= e(old('registration_start') ?? $t['registration_start'] ?? '') ?>" class="form-input">
<input type="date" name="registration_start" value="<?= e(old('registration_start') ?: $t['registration_start'] ?? '') ?>" class="form-input">
</div>
<div>
<label class="form-label">نهاية التسجيل</label>
<input type="date" name="registration_end" value="<?= e(old('registration_end') ?? $t['registration_end'] ?? '') ?>" class="form-input">
<input type="date" name="registration_end" value="<?= e(old('registration_end') ?: $t['registration_end'] ?? '') ?>" class="form-input">
</div>
</div>
......@@ -96,15 +96,15 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">الفئة العمرية</label>
<input type="text" name="age_group" value="<?= e(old('age_group') ?? $t['age_group'] ?? '') ?>" class="form-input" placeholder="مثال: 12-16 أو under_18">
<input type="text" name="age_group" value="<?= e(old('age_group') ?: $t['age_group'] ?? '') ?>" class="form-input" placeholder="مثال: 12-16 أو under_18">
</div>
<div>
<label class="form-label">الحد الأقصى للمشاركين</label>
<input type="number" name="max_participants" value="<?= e(old('max_participants') ?? $t['max_participants'] ?? '') ?>" class="form-input" min="2">
<input type="number" name="max_participants" value="<?= e(old('max_participants') ?: $t['max_participants'] ?? '') ?>" class="form-input" min="2">
</div>
<div>
<label class="form-label">الحد الأدنى للمشاركين</label>
<input type="number" name="min_participants" value="<?= e(old('min_participants') ?? $t['min_participants'] ?? '2') ?>" class="form-input" min="2">
<input type="number" name="min_participants" value="<?= e(old('min_participants') ?: $t['min_participants'] ?? '2') ?>" class="form-input" min="2">
</div>
</div>
......@@ -116,13 +116,13 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<select name="facility_id" class="form-input">
<option value="">اختر...</option>
<?php foreach ($facilities as $f): ?>
<option value="<?= (int) $f['id'] ?>" <?= (old('facility_id') ?? $t['facility_id'] ?? '') == $f['id'] ? 'selected' : '' ?>><?= e($f['name_ar']) ?></option>
<option value="<?= (int) $f['id'] ?>" <?= (old('facility_id') ?: $t['facility_id'] ?? '') == $f['id'] ? 'selected' : '' ?>><?= e($f['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div>
<label class="form-label">رسوم الاشتراك (ج.م)</label>
<input type="number" name="entry_fee" value="<?= e(old('entry_fee') ?? $t['entry_fee'] ?? '0') ?>" class="form-input" min="0" step="0.01">
<input type="number" name="entry_fee" value="<?= e(old('entry_fee') ?: $t['entry_fee'] ?? '0') ?>" class="form-input" min="0" step="0.01">
</div>
</div>
......@@ -131,16 +131,16 @@ $genders = ['mixed' => 'مختلط', 'male' => 'ذكور', 'female' => 'إناث
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">وصف الجوائز</label>
<textarea name="prize_description_ar" class="form-input" rows="3" placeholder="مثال: كأس + ميداليات ذهبية للمراكز الثلاثة الأولى"><?= e(old('prize_description_ar') ?? $t['prize_description_ar'] ?? '') ?></textarea>
<textarea name="prize_description_ar" class="form-input" rows="3" placeholder="مثال: كأس + ميداليات ذهبية للمراكز الثلاثة الأولى"><?= e(old('prize_description_ar') ?: $t['prize_description_ar'] ?? '') ?></textarea>
</div>
<div>
<label class="form-label">القواعد واللوائح</label>
<textarea name="rules_ar" class="form-input" rows="3" placeholder="قواعد البطولة..."><?= e(old('rules_ar') ?? $t['rules_ar'] ?? '') ?></textarea>
<textarea name="rules_ar" class="form-input" rows="3" placeholder="قواعد البطولة..."><?= e(old('rules_ar') ?: $t['rules_ar'] ?? '') ?></textarea>
</div>
</div>
<div style="margin-bottom:20px;">
<label class="form-label">ملاحظات</label>
<textarea name="notes" class="form-input" rows="2"><?= e(old('notes') ?? $t['notes'] ?? '') ?></textarea>
<textarea name="notes" class="form-input" rows="2"><?= e(old('notes') ?: $t['notes'] ?? '') ?></textarea>
</div>
<!-- Submit -->
......
......@@ -30,12 +30,12 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr auto 1fr;gap:15px;align-items:end;margin-bottom:20px;">
<div>
<label class="form-label"><?= e($match['participant_a_name'] ?? 'مشارك أ') ?></label>
<input type="text" name="score_a" value="<?= e(old('score_a') ?? '') ?>" class="form-input" style="text-align:center;font-size:18px;font-weight:700;" placeholder="0">
<input type="text" name="score_a" value="<?= e(old('score_a') ?: '') ?>" class="form-input" style="text-align:center;font-size:18px;font-weight:700;" placeholder="0">
</div>
<div style="padding-bottom:10px;color:#9CA3AF;font-weight:600;"></div>
<div>
<label class="form-label"><?= e($match['participant_b_name'] ?? 'مشارك ب') ?></label>
<input type="text" name="score_b" value="<?= e(old('score_b') ?? '') ?>" class="form-input" style="text-align:center;font-size:18px;font-weight:700;" placeholder="0">
<input type="text" name="score_b" value="<?= e(old('score_b') ?: '') ?>" class="form-input" style="text-align:center;font-size:18px;font-weight:700;" placeholder="0">
</div>
</div>
......@@ -72,11 +72,11 @@ $__template->layout('Layout.main');
<div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-bottom:20px;">
<div>
<label class="form-label">الحكم</label>
<input type="text" name="referee_name" value="<?= e(old('referee_name') ?? '') ?>" class="form-input" placeholder="اسم الحكم...">
<input type="text" name="referee_name" value="<?= e(old('referee_name') ?: '') ?>" class="form-input" placeholder="اسم الحكم...">
</div>
<div>
<label class="form-label">ملاحظات</label>
<input type="text" name="match_notes" value="<?= e(old('match_notes') ?? '') ?>" class="form-input" placeholder="ملاحظات...">
<input type="text" name="match_notes" value="<?= e(old('match_notes') ?: '') ?>" class="form-input" placeholder="ملاحظات...">
</div>
</div>
......
This diff is collapsed.
This diff is collapsed.
......@@ -142,7 +142,7 @@
<div class="card" style="padding:20px;margin-bottom:15px;">
<div class="form-group">
<label class="form-label">رقم الاستمارة</label>
<input type="text" name="form_number" class="form-input" placeholder="أدخل رقم استمارة التنازل" value="<?= e(old('form_number') ?? '') ?>">
<input type="text" name="form_number" class="form-input" placeholder="أدخل رقم استمارة التنازل" value="<?= e(old('form_number') ?: '') ?>">
</div>
</div>
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
بيتأكد إن كل <form method="POST"> في أي شاشة بيبعت على route موجود فعلاً.
ليه: الفورم اللي بيبعت على مسار مش متسجّل بيدي 404 وقت الحفظ بس — الشاشة
بتفتح عادي، والـ route smoke بيعدّيها، والمستخدم هو اللي بيكتشفها لما يدوس
حفظ ويضيع شغله. حصل فعلاً في /sa/players/{id}/update و /hr/overtime/store.
python3 tools/form_action_check.py
"""
import glob
import os
import re
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# قيمة الـ action ممكن يكون جواها <?= ... ?> وفيها أقواس، فلازم regex يستحملها
ACTION = re.compile(r'action\s*=\s*"((?:[^"]|<\?(?:php|=).*?\?>)*)"', re.S)
PHPTAG = re.compile(r'<\?(?:php|=).*?\?>', re.S)
def load_post_routes():
routes = set()
for f in glob.glob(os.path.join(ROOT, 'app/Modules/*/Routes.php')):
src = open(f, encoding='utf-8').read()
for m in re.finditer(r"\[\s*'POST'\s*,\s*'([^']+)'", src):
routes.add(m.group(1))
return routes
def norm(path):
"""بيوحّد شكل الـ params عشان المقارنة: /x/{id:\\d+}/y -> /x/{}/y
الأرقام الصريحة بتتعامل كـ param برضه — /vouchers/types/0 بيطابق
/vouchers/types/{id:\\d+} فعلاً وقت التشغيل.
"""
path = re.sub(r'\{[^}]*\}', '{}', path)
path = re.sub(r'(?<=/)\d+(?=/|$)', '{}', path)
return path.rstrip('/')
def main():
post_routes = load_post_routes()
normalized = {norm(r) for r in post_routes}
problems = []
for f in glob.glob(os.path.join(ROOT, 'app/Modules/**/Views/**/*.php'), recursive=True):
src = open(f, encoding='utf-8').read()
for fm in re.finditer(r'<form\b(.*?)>', src, re.S):
tag = fm.group(1)
if not re.search(r'method\s*=\s*["\']post["\']', tag, re.I):
continue
am = ACTION.search(tag)
if not am:
continue
raw = am.group(1)
if raw.startswith('http') or not raw.startswith('/'):
continue
path = PHPTAG.sub('{}', raw).split('?')[0].rstrip('/')
# مسارات مبنية بالـ JS مش بنقدر نتحقق منها هنا
if "' +" in raw or '" +' in raw:
continue
if norm(path) not in normalized:
rel = os.path.relpath(f, ROOT)
line = src[:fm.start()].count('\n') + 1
problems.append((rel, line, path))
seen, uniq = set(), []
for p in problems:
if p in seen:
continue
seen.add(p)
uniq.append(p)
if not uniq:
print(f'فُحص {len(normalized)} POST route، كل الفورمات سليمة')
return 0
print(f'{len(uniq)} فورم بيبعت على route مش موجود:\n')
for rel, line, path in sorted(uniq):
print(f' {path}')
print(f' {rel}:{line}')
return 1
if __name__ == '__main__':
sys.exit(main())
// Verifies the reported bugs by DOING WHAT THE USER DOES: clicking buttons.
// Fails loudly on any PHP exception / "View not found" text on the page.
const { chromium } = require('playwright');
const BASE = 'https://clubmanagement.caprover.al-arcade.com';
const results = [];
function rec(name, ok, detail) {
results.push({ name, ok, detail: detail || '' });
console.log(`${ok ? ' PASS' : '✗ FAIL'} ${name}${detail ? '\n ' + detail : ''}`);
}
async function pageError(page) {
const body = await page.textContent('body').catch(() => '');
const m = body.match(/Exception:\s*(\w+)[\s\S]{0,200}?Message:\s*([^\n]+)/);
if (m) return `${m[1]}: ${m[2].trim().slice(0, 160)}`;
if (/View not found|Fatal error|Parse error|Uncaught/i.test(body)) {
return body.replace(/\s+/g, ' ').slice(0, 200);
}
return null;
}
(async () => {
const browser = await chromium.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'] });
const ctx = await browser.newContext({ viewport: { width: 1440, height: 950 } });
const page = await ctx.newPage();
await page.goto(`${BASE}/login`, { waitUntil: 'domcontentloaded', timeout: 30000 });
await page.fill('input[name=username], input[type=text]', 'admin');
await page.fill('input[name=password], input[type=password]', 'Alarcade123#');
await page.click('button[type=submit]');
await page.waitForLoadState('domcontentloaded', { timeout: 30000 });
console.log('login ->', page.url(), '\n');
// ── 1. Documentary credits: click the "عرض" button from the LIST ──────────
await page.goto(`${BASE}/accounting/documentary-credits`, { waitUntil: 'domcontentloaded' });
let err = await pageError(page);
if (err) { rec('LC list page', false, err); }
else {
const link = page.locator('tbody a[href*="/accounting/documentary-credits/"]').first();
const n = await link.count();
if (!n) rec('LC: view button exists on list', false, 'no per-row link found');
else {
await link.click();
await page.waitForLoadState('domcontentloaded', { timeout: 20000 });
err = await pageError(page);
rec('LC: click عرض -> show screen', !err, err || page.url());
if (!err) {
const hasStatusForm = await page.locator('form[action*="/status"] select[name=status]').count();
rec('LC: status update form usable', hasStatusForm > 0, hasStatusForm ? '' : 'no status form rendered');
}
}
}
// ── 2. Guarantees: same, click through from the list ─────────────────────
await page.goto(`${BASE}/accounting/guarantees`, { waitUntil: 'domcontentloaded' });
err = await pageError(page);
if (err) { rec('LG list page', false, err); }
else {
const link = page.locator('tbody a[href*="/accounting/guarantees/"]').first();
const n = await link.count();
if (!n) rec('LG: view button exists on list', false, 'no per-row link found');
else {
await link.click();
await page.waitForLoadState('domcontentloaded', { timeout: 20000 });
err = await pageError(page);
rec('LG: click عرض -> show screen', !err, err || page.url());
if (!err) {
const hasStatusForm = await page.locator('form[action*="/status"] select[name=status]').count();
rec('LG: status update form usable', hasStatusForm > 0, hasStatusForm ? '' : 'no status form rendered');
}
}
}
// ── 3. Debtors report: one row per debtor, expandable ────────────────────
await page.goto(`${BASE}/accounting/reports/accounts-receivable`, { waitUntil: 'domcontentloaded' });
err = await pageError(page);
if (err) rec('AR report renders', false, err);
else {
const memberRows = await page.locator('tr.ar-member-row').count();
const names = await page.locator('tr.ar-member-row td:nth-child(2)').allTextContents();
const uniq = new Set(names.map(s => s.trim()));
rec('AR: one row per debtor (no repeats)', uniq.size === names.length,
`${memberRows} debtor rows, ${uniq.size} unique names`);
// expand the first debtor and confirm details appear
if (memberRows > 0) {
const first = page.locator('tr.ar-member-row').first();
const mid = await first.getAttribute('data-member');
await first.click();
await page.waitForTimeout(300);
const vis = await page.locator(`tr.ar-detail-row[data-detail-for="${mid}"]`).isVisible();
rec('AR: clicking a debtor opens their claims', vis, vis ? '' : 'detail row did not open');
}
}
// ── 4. Gap tool -> "صلّح الربط" must open the EXISTING player, not a blank form
await page.goto(`${BASE}/accounting/gaps`, { waitUntil: 'domcontentloaded' });
err = await pageError(page);
if (err) rec('Gaps screen renders', false, err);
else {
const fixBtn = page.locator('a:has-text("صلّح الربط")').first();
if (!(await fixBtn.count())) {
rec('Gaps: صلّح الربط button', true, 'no broken links currently listed (nothing to fix)');
} else {
await fixBtn.click();
await page.waitForLoadState('domcontentloaded', { timeout: 20000 });
err = await pageError(page);
if (err) rec('Gaps: صلّح الربط -> player edit', false, err);
else {
const isEdit = /\/sa\/players\/\d+\/edit/.test(page.url());
const nameVal = await page.inputValue('input[name=full_name_ar]').catch(() => '');
rec('Gaps: opens EXISTING player (not blank form)', isEdit && nameVal.trim().length > 0,
`url=${page.url()} name="${nameVal}"`);
const action = await page.getAttribute('form', 'action');
rec('Gaps: edit form posts to a real route', !!action && !/\/update$/.test(action), `action=${action}`);
const hasSearch = await page.locator('#memberSearchInput, #memberPicked').count();
rec('Gaps: member field is a name search', hasSearch > 0, hasSearch ? '' : 'still a raw number box');
// actually type a name and confirm results come back
const searchBox = page.locator('#memberSearchInput');
if (await searchBox.count() && await searchBox.isVisible()) {
await searchBox.fill('محمد');
await page.waitForTimeout(1200);
const rows = await page.locator('#memberResults > div').count();
rec('Gaps: searching by name returns members', rows > 0, `${rows} result(s)`);
} else {
const changeBtn = page.locator('#memberClear');
if (await changeBtn.count()) {
await changeBtn.click();
await page.waitForTimeout(200);
await page.locator('#memberSearchInput').fill('محمد');
await page.waitForTimeout(1200);
const rows = await page.locator('#memberResults > div').count();
rec('Gaps: searching by name returns members', rows > 0, `${rows} result(s)`);
}
}
}
}
}
console.log('\n' + '='.repeat(60));
const failed = results.filter(r => !r.ok);
console.log(`${results.length - failed.length}/${results.length} passed`);
if (failed.length) {
console.log('\nFAILURES:');
failed.forEach(f => console.log(` - ${f.name}: ${f.detail}`));
}
await browser.close();
process.exit(failed.length ? 1 : 0);
})();
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