| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- @extends('layouts.app')
- @section('content')
- <div class="px-3">
- <div class="row mb-3">
- <div class="col-md-7 d-flex align-items-center">
- <h3 class="mb-0">
- {{ $item ? 'Позиция '.$item->article : 'Новая позиция общего каталога' }}
- </h3>
- </div>
- @if($item)
- <div class="col-md-5 d-flex flex-wrap align-items-center justify-content-end gap-2 action-toolbar">
- @if(hasPermission('common-catalog.image.upload'))
- <button type="button" class="btn btn-sm btn-outline-success"
- onclick="document.getElementById('common-catalog-image-input').click()">
- <i class="bi bi-image"></i> Загрузить фото
- </button>
- <form action="{{ route('common-catalog.image.upload', ['commonCatalogItem' => $item, 'nav' => $nav ?? null]) }}"
- method="POST" enctype="multipart/form-data" class="visually-hidden">
- @csrf
- <input id="common-catalog-image-input" type="file" name="image"
- accept=".jpg,.jpeg,.png,.webp" required onchange="this.form.submit()">
- </form>
- @endif
- <button type="button" class="btn btn-sm btn-outline-secondary" disabled
- title="Будет подключено после получения контракта API">
- <i class="bi bi-calculator"></i> Калькуляция
- </button>
- </div>
- @endif
- </div>
- @if($item?->imageFile)
- <div class="card mb-3">
- <div class="card-body d-flex align-items-start gap-3">
- <a href="{{ $item->imageFile->link }}" data-toggle="lightbox" data-gallery="common-catalog">
- <img src="{{ $item->imageFile->thumbnail_link }}" alt="{{ $item->article }}"
- class="img-thumbnail" style="max-width: 180px; max-height: 180px">
- </a>
- @if(hasPermission('common-catalog.image.delete'))
- <form action="{{ route('common-catalog.image.delete', ['commonCatalogItem' => $item, 'nav' => $nav ?? null]) }}"
- method="POST" onsubmit="return confirm('Удалить изображение?')">
- @csrf
- @method('DELETE')
- <button type="submit" class="btn btn-sm btn-outline-danger">Удалить фото</button>
- </form>
- @endif
- </div>
- </div>
- @endif
- <form action="{{ $item ? route('common-catalog.update', $item) : route('common-catalog.store') }}" method="POST">
- @csrf
- @if($item) @method('PUT') @endif
- <input type="hidden" name="nav" value="{{ $nav ?? '' }}">
- <div class="row">
- <div class="col-xl-6">
- @include('partials.input', ['name' => 'article', 'title' => 'Артикул', 'required' => true, 'value' => $item?->article])
- <div class="row mb-2">
- <label for="calculator_name" class="col-form-label small col-md-4 text-md-end">
- Наименование по калькулятору <sup>*</sup>
- </label>
- <div class="col-md-8">
- <textarea name="calculator_name" id="calculator_name" rows="4" required
- class="form-control form-control-sm @error('calculator_name') is-invalid @enderror">{{ old('calculator_name', $item?->calculator_name) }}</textarea>
- @error('calculator_name')
- <div class="invalid-feedback"><strong>{{ $message }}</strong></div>
- @enderror
- </div>
- </div>
- @include('partials.input', ['name' => 'kind', 'title' => 'Вид', 'value' => $item?->kind])
- @include('partials.input', ['name' => 'dimensions', 'title' => 'Габаритные размеры', 'value' => $item?->dimensions])
- @include('partials.input', ['name' => 'fall_height', 'title' => 'Высота падения', 'type' => 'number', 'min' => 0, 'step' => '0.001', 'value' => $item?->fall_height])
- @include('partials.input', ['name' => 'dimension_unit', 'title' => 'Единица измерения габаритов', 'value' => $item?->dimension_unit])
- @include('partials.input', ['name' => 'weight', 'title' => 'Вес, кг.', 'type' => 'number', 'min' => 0, 'step' => '0.001', 'value' => $item?->weight])
- @include('partials.input', ['name' => 'volume', 'title' => 'Объем, м3', 'type' => 'number', 'min' => 0, 'step' => '0.001', 'value' => $item?->volume])
- @include('partials.input', ['name' => 'places', 'title' => 'Места', 'type' => 'number', 'min' => 0, 'step' => 1, 'value' => $item?->places])
- @include('partials.input', ['name' => 'max_users', 'title' => 'Макс. кол-во пользователей', 'type' => 'number', 'min' => 0, 'step' => 1, 'value' => $item?->max_users])
- </div>
- <div class="col-xl-6">
- @include('partials.input', ['name' => 'age_group', 'title' => 'Возрастная группа', 'value' => $item?->age_group])
- @include('partials.input', ['name' => 'unit', 'title' => 'Ед.', 'value' => $item?->unit])
- @include('partials.input', ['name' => 'series', 'title' => 'Серия', 'value' => $item?->series])
- @include('partials.input', ['name' => 'trademark', 'title' => 'ТМ', 'value' => $item?->trademark])
- @foreach([
- 'additional_info' => 'Дополнительные сведения',
- 'composition' => 'Состав',
- 'note' => 'Примечание',
- ] as $field => $label)
- <div class="row mb-2">
- <label for="{{ $field }}" class="col-form-label small col-md-4 text-md-end">{{ $label }}</label>
- <div class="col-md-8">
- <textarea name="{{ $field }}" id="{{ $field }}" rows="4"
- class="form-control form-control-sm @error($field) is-invalid @enderror">{{ old($field, $item?->{$field}) }}</textarea>
- @error($field)
- <div class="invalid-feedback"><strong>{{ $message }}</strong></div>
- @enderror
- </div>
- </div>
- @endforeach
- </div>
- </div>
- <div class="d-flex flex-wrap gap-2 mt-3">
- @if(($item && hasPermission('common-catalog.update')) || (!$item && hasPermission('common-catalog.create')))
- <button type="submit" class="btn btn-sm btn-primary">Сохранить</button>
- @endif
- <a href="{{ $back_url ?? route('common-catalog.index') }}" class="btn btn-sm btn-outline-secondary">Назад</a>
- </div>
- </form>
- @if($item)
- <div class="card mt-4">
- <div class="card-header d-flex justify-content-between align-items-center">
- <strong>Документы</strong>
- @if(hasPermission('common-catalog.documents.upload'))
- <form action="{{ route('common-catalog.documents.upload', ['commonCatalogItem' => $item, 'nav' => $nav ?? null]) }}"
- method="POST" enctype="multipart/form-data" class="d-flex gap-2">
- @csrf
- <input type="file" name="document" class="form-control form-control-sm" required>
- <button type="submit" class="btn btn-sm btn-outline-primary">Загрузить</button>
- </form>
- @endif
- </div>
- <div class="card-body">
- @forelse($item->documents as $document)
- <div class="d-flex justify-content-between align-items-center border-bottom py-2">
- <a href="{{ $document->link }}" target="_blank" rel="noopener">{{ $document->original_name }}</a>
- @if(hasPermission('common-catalog.documents.delete'))
- <form action="{{ route('common-catalog.documents.delete', ['commonCatalogItem' => $item, 'file' => $document, 'nav' => $nav ?? null]) }}"
- method="POST" onsubmit="return confirm('Удалить документ?')">
- @csrf
- @method('DELETE')
- <button type="submit" class="btn btn-sm btn-outline-danger">Удалить</button>
- </form>
- @endif
- </div>
- @empty
- <span class="text-muted">Документы не загружены.</span>
- @endforelse
- </div>
- </div>
- <div class="card mt-4">
- <div class="card-header"><strong>Техническое описание</strong></div>
- <div class="card-body text-muted">
- Блок подготовлен к подключению данных и выгрузок из готового Laravel-модуля технических описаний.
- </div>
- </div>
- @if(hasPermission('common-catalog.delete'))
- <form action="{{ route('common-catalog.destroy', $item) }}" method="POST" class="mt-4"
- onsubmit="return confirm('Удалить позицию общего каталога?')">
- @csrf
- @method('DELETE')
- <button type="submit" class="btn btn-sm btn-danger">Удалить позицию</button>
- </form>
- @endif
- @endif
- </div>
- @endsection
|