{{-- MINI CRUD EDIT WHEN JSON IS TRANSLATABLE --}} @php // $data = isset($model->data) ? $model->getEmptyData() : $conceptData; @endphp @foreach ($data as $k => $input) @php $input = json_decode(json_encode($input), true); @endphp @switch(intval($input['inputType'])) @case(intval(App\Enums\InputType::video->value)) @case(intval(App\Enums\InputType::videoVimeo->value)) @case(intval(App\Enums\InputType::videoYoutube->value))
{{ $input['label'] }} *
@include('bo.partials.inputs.varchar', [ 'id' => Str::slug($input['label']), 'label' => $input['label'], 'hasWordCounter' => true, 'name' => 'data[' . $k . '][value]', 'value' => old("data.{$k}.value", $model->data[$k]['value'] ?? null), 'required' => isset($input['required']) ? !empty($input['required']) : true, 'model' => $model ?? null, 'helper' => match (intval($input['inputType'])) { intval(App\Enums\InputType::videoYoutube->value) => __('video id eg: keZURbOo4-M'), intval(App\Enums\InputType::videoVimeo->value) => __('video id eg: 74918975'), intval(App\Enums\InputType::video->value) => __('video id eg: keZURbOo4-M or 74918975'), }, ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.value", ])
@break @case(intval(App\Enums\InputType::url->value)) @case(intval(App\Enums\InputType::string->value))
{{ $input['label'] }} *
@include('bo.partials.inputs.varchar', [ 'id' => Str::slug($input['label']), 'label' => $input['label'], 'hasWordCounter' => true, 'name' => 'data[' . $k . '][value]', 'value' => old("data.{$k}.value", $model->data[$k]['value'] ?? null), 'required' => isset($input['required']) ? !empty($input['required']) : true, 'model' => $model ?? null, 'helper' => __('validation.between.string', [ 'attribute' => $input['label'], 'min' => 3, 'max' => 255, ]), ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.value", ])
@break @case(intval(App\Enums\InputType::number->value))
@if (!empty($input['tooltip'])) @endif
@include('modules.input-error', [ 'inputName' => "data.{$k}.value", 'helperId' => "NumberHelp{$k}", 'helper' => $input['helper'] ?? '', ])
@break @case(intval(App\Enums\InputType::text->value))
{{ $input['label'] }} *
@include('bo.partials.inputs.text-html', [ 'id' => Str::slug($input['label']), 'name' => "data[{$k}][value]", 'value' => old("data.{$k}.value", $model->data[$k]['value'] ?? null), 'model' => $model ?? null, 'helper' => __('crud.minicrud.text_warning') . __('validation.min.string', [ 'attribute' => $input['label'], 'min' => 3, ]), ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.value", ])
@break @case(intval(App\Enums\InputType::boolean->value))
{{ $input['label'] }} *
data[$k]['value'] ?? (null ?? false))) checked @endif>
@include('modules.input-error', [ 'inputName' => "data.{$k}.value", 'helperId' => Str::slug($input['label']) . 'Help', 'helper' => __('crud.minicrud.visibility_helper'), ])
@break @case(intval(App\Enums\InputType::image->value))
{{ $input['label'] }} *
{{-- PICTURE_ALT --}}
@include('bo.partials.inputs.varchar', [ 'id' => Str::slug($input['label']) . '-alt', 'label' => __('crud.minicrud.picture_alt_label'), 'hasWordCounter' => true, 'name' => 'data[' . $k . '][alt]', 'value' => old("data.{$k}.alt", $model->data[$k]['alt'] ?? null), 'required' => $model->data[$k]['required'], 'model' => $model ?? null, 'helper' => __('crud.minicrud.picture_alt_helper') . '. ' . __('validation.min.string', [ 'attribute' => __('crud.minicrud.picture_alt_label'), 'min' => 3, ]), ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.alt", ])
{{-- PICTURE_TITLE --}}
@include('bo.partials.inputs.varchar', [ 'id' => Str::slug($input['label']) . '-title', 'label' => __('crud.minicrud.picture_title_label'), 'hasWordCounter' => true, 'name' => 'data[' . $k . '][title]', 'value' => old("data.{$k}.title", $model->data[$k]['title'] ?? null), 'required' => $model->data[$k]['required'], 'model' => $model ?? null, 'helper' => __('crud.minicrud.picture_title_helper') . '. ' . __('validation.min.string', [ 'attribute' => __('crud.minicrud.picture_title_label'), 'min' => 3, ]), ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.title", ])
{{-- PICTURE --}}
@include('bo.partials.inputs.varchar-picture', [ 'id' => Str::slug($input['label']), 'name' => "data[{$k}][value]", 'width' => $input['dimensions']['width'], 'height' => $input['dimensions']['height'], 'model' => $model ?? null, 'value' => $model->data[$k]['value'], 'helper' => __('crud.minicrud.dimensions_must_be', [ 'width' => $input['dimensions']['width'], 'height' => $input['dimensions']['height'], ]), 'required' => $model->data[$k]['required'], 'preview' => true, ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.value", ])
@break @case(App\Enums\InputType::email->value)
@if (!empty($input['tooltip'])) @endif
@include('modules.input-error', [ 'inputName' => "data.{$k}.value", 'helperId' => "{$k}StringHelp", 'helper' => $input['helper'] ?? '', ])
@break @case(intval(App\Enums\InputType::imageArray->value)) @case(intval(App\Enums\InputType::labelArray->value)) @case(intval(App\Enums\InputType::selectEnum->value))
{{ $input['label'] }} *
@include('bo.partials.inputs.tinyint-enum', [ 'id' => Str::slug($input['label']), 'label' => __('crud.minicrud.associated_enum', ['enum' => $input['label']]), 'name' => "data[{$k}][value]", 'model' => $model ?? null, 'value' => old("data.{$k}.value", $model->data[$k]['value'] ?? null), 'required' => true, 'associatedModels' => $selectedEnum ?? [], 'helper' => __('crud.minicrud.enum_select', ['enum' => $input['label']]), ]) @include('modules.input-error', [ 'inputName' => "data.{$k}.value", ])
@break @default @php throw new Exception('Input type not handled'); @endphp @endswitch @endforeach @push('scripts') @endpush