@extends('layouts.app') @section('content') @php $commonCatalogReadableFields = $commonCatalogReadableFields ?? []; $commonCatalogWritableFields = $commonCatalogWritableFields ?? []; $canView = static fn (string $field): bool => (bool) ($commonCatalogReadableFields[$field] ?? false); $canUpdate = static fn (string $field): bool => (bool) ($commonCatalogWritableFields[$field] ?? false); $calculatorEnabledValue = old( 'calculator_enabled', $item === null || $item->calculator_enabled === null ? '' : (string) (int) $item->calculator_enabled, ); $priceFields = \App\Models\CommonCatalogItem::PRICE_FIELDS; $technicalTextFields = [ 'characteristics' => ['Характеристики', 4], 'technical_description' => ['Техническое описание', 6], 'technical_description_short' => ['Краткое техническое описание', 5], ]; @endphp

{{ $item ? 'Позиция '.($canView('article') ? $item->article : '') : 'Новая позиция общего каталога' }}

@if($item)
@if(hasPermission('common-catalog.image.upload'))
@csrf
@endif
@endif
@if($item?->imageFile && $canView('image'))
{{ $item->article }} @if(hasPermission('common-catalog.image.delete'))
@csrf @method('DELETE')
@endif
@endif
@csrf @if($item) @method('PUT') @endif
@if($canView('article')) @include('partials.input', ['name' => 'article', 'title' => 'Артикул', 'required' => true, 'value' => $item?->article, 'disabled' => !$canUpdate('article')]) @endif @if($canView('calculator_name'))
@error('calculator_name')
{{ $message }}
@enderror
@endif @if($canView('kind')) @include('partials.input', ['name' => 'kind', 'title' => 'Вид', 'value' => $item?->kind, 'disabled' => !$canUpdate('kind')]) @endif @if($canView('dimension_length')) @include('partials.input', ['name' => 'dimension_length', 'title' => 'Габариты: длина', 'value' => $item?->dimension_length, 'disabled' => !$canUpdate('dimension_length')]) @endif @if($canView('dimension_width')) @include('partials.input', ['name' => 'dimension_width', 'title' => 'Габариты: ширина', 'value' => $item?->dimension_width, 'disabled' => !$canUpdate('dimension_width')]) @endif @if($canView('dimension_height')) @include('partials.input', ['name' => 'dimension_height', 'title' => 'Габариты: высота', 'value' => $item?->dimension_height, 'disabled' => !$canUpdate('dimension_height')]) @endif @if($canView('site_length')) @include('partials.input', ['name' => 'site_length', 'title' => 'Размер участка: длина', 'value' => $item?->site_length, 'disabled' => !$canUpdate('site_length')]) @endif @if($canView('site_width')) @include('partials.input', ['name' => 'site_width', 'title' => 'Размер участка: ширина', 'value' => $item?->site_width, 'disabled' => !$canUpdate('site_width')]) @endif @if($canView('fall_height')) @include('partials.input', ['name' => 'fall_height', 'title' => 'Высота падения', 'type' => 'number', 'min' => 0, 'step' => '0.001', 'value' => $item?->fall_height, 'disabled' => !$canUpdate('fall_height')]) @endif @if($canView('additional_info'))
@error('additional_info')
{{ $message }}
@enderror
@endif
@if($canView('dimension_unit')) @include('partials.input', ['name' => 'dimension_unit', 'title' => 'Единица измерения габаритов', 'value' => $item?->dimension_unit, 'disabled' => !$canUpdate('dimension_unit')]) @endif @if($canView('weight')) @include('partials.input', ['name' => 'weight', 'title' => 'Вес, кг.', 'type' => 'number', 'min' => 0, 'step' => '0.001', 'value' => $item?->weight, 'disabled' => !$canUpdate('weight')]) @endif @if($canView('volume')) @include('partials.input', ['name' => 'volume', 'title' => 'Объем, м3', 'type' => 'number', 'min' => 0, 'step' => '0.001', 'value' => $item?->volume, 'disabled' => !$canUpdate('volume')]) @endif @if($canView('places')) @include('partials.input', ['name' => 'places', 'title' => 'Места', 'type' => 'number', 'min' => 0, 'step' => 1, 'value' => $item?->places, 'disabled' => !$canUpdate('places')]) @endif @if($canView('composition'))
@error('composition')
{{ $message }}
@enderror
@endif @if($canView('age_group')) @include('partials.input', ['name' => 'age_group', 'title' => 'Возрастная группа', 'value' => $item?->age_group, 'disabled' => !$canUpdate('age_group')]) @endif @if($canView('max_users')) @include('partials.input', ['name' => 'max_users', 'title' => 'Макс. кол-во пользователей', 'type' => 'number', 'min' => 0, 'step' => 1, 'value' => $item?->max_users, 'disabled' => !$canUpdate('max_users')]) @endif @if($canView('unit')) @include('partials.input', ['name' => 'unit', 'title' => 'Ед.', 'value' => $item?->unit, 'disabled' => !$canUpdate('unit')]) @endif @if($canView('series')) @include('partials.input', ['name' => 'series', 'title' => 'Серия', 'value' => $item?->series, 'disabled' => !$canUpdate('series')]) @endif @if($canView('trademark')) @include('partials.input', ['name' => 'trademark', 'title' => 'ТМ', 'value' => $item?->trademark, 'disabled' => !$canUpdate('trademark')]) @endif @if($canView('calculator_enabled'))
@error('calculator_enabled')
{{ $message }}
@enderror
@endif
@if(collect(array_keys($priceFields))->contains(fn (string $field): bool => $canView($field)))
Цены
@foreach($priceFields as $field => $label) @if($canView($field))
@include('partials.input', [ 'name' => $field, 'title' => $label, 'type' => 'number', 'min' => 0, 'step' => '0.01', 'value' => $item?->{$field}, 'disabled' => !$canUpdate($field), ])
@endif @endforeach
@endif @if(collect(\App\Models\CommonCatalogItem::TECHNICAL_DESCRIPTION_FIELDS)->contains(fn (string $field): bool => $canView($field)))
Техническое описание
@if($canView('print_name'))
@include('partials.input', [ 'name' => 'print_name', 'title' => 'Наименование для формы', 'value' => $item?->print_name, 'disabled' => !$canUpdate('print_name'), ])
@endif @if($canView('product_group'))
@include('partials.input', [ 'name' => 'product_group', 'title' => 'Группа', 'value' => $item?->product_group, 'disabled' => !$canUpdate('product_group'), ])
@endif
@foreach($technicalTextFields as $field => [$label, $rows]) @if($canView($field))
@error($field)
{{ $message }}
@enderror
@endif @endforeach @if($item)
@if($canViewTechnicalDescriptionPrice) Цена для DOCX: {{ $technicalDescriptionPriceLabel }}{{ $item->{$technicalDescriptionPriceField.'_txt'} }} @else Цена для DOCX скрыта вашими правами доступа. @endif
@endif
@endif
@if(($item && hasPermission('common-catalog.update')) || (!$item && hasPermission('common-catalog.create'))) @endif Назад
@if($item) @if($canViewTechnicalDescriptionPrice)
Экспорт технического описания
@csrf @include('partials.select', [ 'name' => 'description_mode', 'title' => 'Содержимое описания', 'options' => $technicalDescriptionModes, 'value' => \App\Services\TechnicalDescriptionService::MODE_CHARACTERISTICS_SHORT, ])
@endif
Документы @if(hasPermission('common-catalog.documents.upload'))
@csrf
@endif
@forelse($item->documents as $document)
{{ $document->original_name }} @if(hasPermission('common-catalog.documents.delete'))
@csrf @method('DELETE')
@endif
@empty Документы не загружены. @endforelse
@if(hasPermission('common-catalog.delete'))
@csrf @method('DELETE')
@endif @endif
@endsection