@extends ('admin.layouts.default') @section ('main')

@php echo (isset($category)) ? __('labels.category.edit_category') : __('labels.category.create_category'); @endphp

@include('admin.partials.x-toolbar') @if (isset($category) && $owner->getRoleType() != 'super-admin' && !$owner->hasPermissionTo('create-'.$category->collection_type.'-categories'))
{{ __('messages.generic.can_no_longer_create_item', ['name' => $owner->name]) }}
@endif @php $action = (isset($category)) ? route('admin.'.$collection.'.categories.update', $query) : route('admin.'.$collection.'.categories.store', $query) @endphp
@csrf @if (isset($category)) @method('put') @endif @php $value = (isset($category)) ? old('name', $fields[0]->value) : old('name'); @endphp @php array_shift($fields); // Remove the very first field (ie: name) from the array. @endphp
@php $dataTab = null; @endphp @foreach ($fields as $key => $field) @if (isset($field->tab)) @php $active = ($field->tab == 'details') ? ' active' : ''; $dataTab = $field->tab; @endphp
@endif @if (isset($field->dataset)) @php $field->dataset->tab = $dataTab; @endphp @else @php $dataset = (object) ['tab' => $dataTab]; $field->dataset = $dataset; @endphp @endif @php $value = (isset($category) || str_starts_with($field->name, 'alias_extra_field_')) ? old($field->name, $field->value) : old($field->name); @endphp @if ($field->name == 'image')
@php $path = (isset($category) && $category->image) ? url('/').$category->image->getThumbnailUrl() : asset('/images/camera.png'); @endphp
@endif @if (!next($fields) || isset($fields[$key + 1]->tab))
@endif @endforeach
@if (isset($category)) @endif @if (isset($category))
@method('delete') @csrf
@method('delete') @csrf
@endif @endsection @push ('style') @endpush @push ('scripts') @endpush