Commit de0b8968 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(sports): UX bugs from real-user testing

- Institution validation redirects back to /create instead of /index
- Add sport_type field to discipline create/edit forms (was in model but missing from views)
- Add schedule copy + time shift UI panels to daily schedule page
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent b6b61bdb
......@@ -187,7 +187,7 @@ class InstitutionController extends Controller
$type = trim((string) $request->post('institution_type', 'school'));
if ($code === '' || $nameAr === '') {
return $this->redirect('/sa/institutions')->withError('الكود والاسم مطلوبان');
return $this->redirect('/sa/institutions/create')->withError('الكود والاسم مطلوبان');
}
$validTypes = ['school', 'university', 'company', 'club', 'government', 'other'];
......
......@@ -28,7 +28,7 @@
<input type="text" name="name_ar" value="<?= e(old('name_ar')) ?>" class="form-input" required maxlength="200" placeholder="مثال: كرة القدم">
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;margin-top:15px;">
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;margin-top:15px;">
<div class="form-group">
<label class="form-label">الاسم بالإنجليزي</label>
<input type="text" name="name_en" value="<?= e(old('name_en')) ?>" class="form-input" maxlength="200" placeholder="e.g. Football" style="direction:ltr;text-align:left;">
......@@ -42,6 +42,13 @@
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label class="form-label">نوع الرياضة</label>
<select name="sport_type" class="form-select">
<option value="training" <?= old('sport_type') === 'training' ? 'selected' : '' ?>>تدريبي</option>
<option value="recreational" <?= old('sport_type') === 'recreational' ? 'selected' : '' ?>>ترفيهي</option>
</select>
</div>
<div class="form-group">
<label class="form-label">ترتيب العرض <span style="color:#DC2626;">*</span></label>
<input type="number" name="sort_order" value="<?= e(old('sort_order', '0')) ?>" class="form-input" required min="0" step="1" style="direction:ltr;text-align:left;">
......
......@@ -28,7 +28,7 @@
<input type="text" name="name_ar" value="<?= e(old('name_ar') ?: $discipline->name_ar) ?>" class="form-input" required maxlength="200">
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:20px;margin-top:15px;">
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:20px;margin-top:15px;">
<div class="form-group">
<label class="form-label">الاسم بالإنجليزي</label>
<input type="text" name="name_en" value="<?= e(old('name_en') ?: ($discipline->name_en ?? '')) ?>" class="form-input" maxlength="200" style="direction:ltr;text-align:left;">
......@@ -42,6 +42,14 @@
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label class="form-label">نوع الرياضة</label>
<?php $currentSportType = old('sport_type') ?: ($discipline->sport_type ?? 'training'); ?>
<select name="sport_type" class="form-select">
<option value="training" <?= $currentSportType === 'training' ? 'selected' : '' ?>>تدريبي</option>
<option value="recreational" <?= $currentSportType === 'recreational' ? 'selected' : '' ?>>ترفيهي</option>
</select>
</div>
<div class="form-group">
<label class="form-label">ترتيب العرض <span style="color:#DC2626;">*</span></label>
<input type="number" name="sort_order" value="<?= e(old('sort_order') ?: (string)($discipline->sort_order ?? 0)) ?>" class="form-input" required min="0" step="1" style="direction:ltr;text-align:left;">
......
......@@ -130,6 +130,71 @@ $dayOfWeek = (int) date('w', strtotime($date));
</div>
</div>
<?php if (can('sa.schedule.manage')): ?>
<!-- Copy Schedule Form -->
<div class="card" style="margin-top:20px;">
<div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;">
<i data-lucide="copy" 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="/sa/schedule/copy" style="display:flex;gap:12px;align-items:end;flex-wrap:wrap;">
<?= csrf_field() ?>
<div style="min-width:200px;">
<label class="form-label" style="font-size:12px;">من مجموعة</label>
<select name="source_group_id" class="form-select" required>
<option value="">-- المصدر --</option>
<?php foreach ($groups as $g): ?>
<option value="<?= (int) $g['id'] ?>"><?= e($g['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div style="min-width:200px;">
<label class="form-label" style="font-size:12px;">إلى مجموعة</label>
<select name="target_group_id" class="form-select" required>
<option value="">-- المستهدفة --</option>
<?php foreach ($groups as $g): ?>
<option value="<?= (int) $g['id'] ?>"><?= e($g['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<button type="submit" class="btn btn-outline" onclick="return confirm('سيتم نسخ جدول المجموعة المصدر إلى المستهدفة (وإلغاء الجدول القديم). متأكد؟');">
<i data-lucide="copy" style="width:14px;height:14px;vertical-align:middle;margin-left:4px;"></i> نسخ الجدول
</button>
</form>
</div>
</div>
<!-- Shift Time Form -->
<div class="card" style="margin-top:20px;">
<div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;">
<i data-lucide="clock" 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="/sa/schedule/shift-time" style="display:flex;gap:12px;align-items:end;flex-wrap:wrap;">
<?= csrf_field() ?>
<div style="min-width:200px;">
<label class="form-label" style="font-size:12px;">المجموعة</label>
<select name="group_id" class="form-select" required>
<option value="">-- اختر المجموعة --</option>
<?php foreach ($groups as $g): ?>
<option value="<?= (int) $g['id'] ?>"><?= e($g['name_ar']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div style="min-width:120px;">
<label class="form-label" style="font-size:12px;">دقائق (+ تقديم / - تأخير)</label>
<input type="number" name="minutes_delta" class="form-input" required placeholder="30" style="direction:ltr;text-align:left;">
</div>
<button type="submit" class="btn btn-outline" onclick="return confirm('سيتم تغيير مواعيد جميع حصص المجموعة. متأكد؟');">
<i data-lucide="clock" style="width:14px;height:14px;vertical-align:middle;margin-left:4px;"></i> تطبيق الإزاحة
</button>
</form>
</div>
</div>
<?php endif; ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (typeof lucide !== 'undefined') lucide.createIcons();
......
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