@extends('backoffice.dashboard') @section('content')

{{ $method === 'create' ? 'إنشاء مناظرة جديدة' : 'تعديل مناظرة' }}

@if($errors->any())
    @foreach($errors->all() as $err)
  • {{ $err }}
  • @endforeach
@endif
@csrf @if($method === 'edit') @method('PUT') @endif {{-- Basic concours meta --}}
{{-- Core columns --}} @php $coreCols = [ 'nom' => 'اللقب / الاسم العائلي', 'prenom' => 'الاسم الشخصي', 'cin' => 'رقم بطاقة التعريف', 'date_naissance' => 'تاريخ الولادة', 'tel' => 'الهاتف', 'email' => 'البريد الإلكتروني', 'adresse' => 'العنوان', 'gouvernorat' => 'الولاية', 'code_postale' => 'الرمز البريدي', ]; $enabledCore = old('core_fields', $concours->core_fields ?? []); $requiredCore = old('core_required', $concours->core_required ?? []); @endphp
@foreach($coreCols as $key => $label) {{ $label }} @if(in_array($key, (array)$enabledCore)) @endif @if(in_array($key, (array)$requiredCore)) @endif @endforeach
هذه حقول ثابتة تُعرض دائماً في نموذج الترشيح.
{{-- Attached fields --}} {{-- Attached fields --}} {{-- Attached fields --}}
@if($fields->isEmpty())
لا توجد حقول مرفقة بعد.
@else {{-- chunk into groups of 2 so there are exactly two cards per row --}} @foreach($fields->chunk(2) as $pair)
@foreach($pair as $field)
{{ $field->label }}
({{ $field->input_type }})
@endforeach {{-- if this chunk has only one item, keep an empty col to preserve layout --}} @if($pair->count() === 1)
@endif
{{-- render edit panels right after the row (each panel is full width) --}} @foreach($pair as $field)
is_visible ? 'checked' : '' }}>
is_required ? 'checked' : '' }}>
@php $editOptions = method_exists($field, 'options') ? $field->options() : []; $showWrapper = in_array($field->input_type, ['select','radio','checkbox']) || !empty($editOptions); @endphp
@if(!empty($editOptions)) @foreach($editOptions as $opt) @endforeach @else @endif
الخيار العمليات
@endforeach @endforeach @endif
يمكنك تعديل الحقول المرتبطة بهذه المسابقة أو حذفها أو اضافه حقول جديدة.
{{-- New fields widget --}}
إنشاء حقل جديد
{{-- restore old inputs (if any) --}} @if(old('new_fields')) @foreach(old('new_fields') as $i => $nf) @php $type = $nf['input_type'] ?? 'text'; $showOptions = in_array($type, ['select','radio','checkbox']); $is_visible = isset($nf['is_visible']) ? (int)$nf['is_visible'] === 1 : 1; $is_required = isset($nf['is_required']) ? (int)$nf['is_required'] === 1 : 0; // options may be string or array $optsArr = []; if (isset($nf['options'])) { if (is_array($nf['options'])) $optsArr = $nf['options']; else $optsArr = preg_split('/\r\n|\n|\r|,/', (string)$nf['options']); $optsArr = array_values(array_filter(array_map('trim', $optsArr))); } @endphp
{{-- dynamic options table --}}
@if(!empty($optsArr)) @foreach($optsArr as $opt) @endforeach @else @endif
الخيار العمليات
@endforeach @endif
العودة
@push('styles') @endpush @push('scripts') @endpush @stack('styles') @stack('scripts') @endsection