{!! Form::model($route, [
'url' => action([\Modules\Gbs\Http\Controllers\RouteController::class, 'update'], [$route->id]),
'method' => 'PUT',
'id' => 'edit_route_form',
]) !!}
@component('components.widget', ['class' => 'box-primary'])
{{-- بيانات المسار --}}
{!! Form::label('name', __('gbs::lang.route_name') . ':*') !!}
{!! Form::text('name', null, ['class' => 'form-control', 'required', 'placeholder' => __('gbs::lang.route_name')]) !!}
{!! Form::label('user_id', __('gbs::lang.users') . ':*') !!}
{!! Form::select('user_id', $users, $route->user_id, ['class' => 'form-control select2', 'required']) !!}
@php
$days = [
'sunday' => __('gbs::lang.sunday'),
'monday' => __('gbs::lang.monday'),
'tuesday' => __('gbs::lang.tuesday'),
'wednesday' => __('gbs::lang.wednesday'),
'thursday' => __('gbs::lang.thursday'),
'friday' => __('gbs::lang.friday'),
'saturday' => __('gbs::lang.saturday'),
];
$intervals = [7, 14, 21, 28];
$intervalLabels = [
7 => __('gbs::lang.every_week'),
14 => __('gbs::lang.every_2_weeks'),
21 => __('gbs::lang.every_3_weeks'),
28 => __('gbs::lang.every_4_weeks'),
];
@endphp
@foreach($days as $key => $dayName)
{{ $dayName }}
@php $counter = 0; @endphp
@foreach($intervals as $interval)
{!! Form::select(
"contacts[$key][$interval][]",
$clients,
$selectedContacts[$key][$interval] ?? [],
[
'class' => 'form-control select2-ajax',
'multiple',
'data-placeholder' => __('gbs::lang.select_clients'),
'id' => "contacts_{$key}_{$interval}"
]
) !!}
@php
$counter++;
if($counter % 2 == 0){
echo '
';
}
@endphp
@endforeach
@endforeach
@endcomponent
{!! Form::close() !!}
@endsection
@section('javascript')
@endsection