form.blade.php 9.2 KB
@csrf

@isset($good)
    @method('PUT')
@endisset

<label class="form__label" for="title">Заголовок товара
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('title')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="title" name="title" placeholder="Введите заголовок" required value="{{ old('title') ?? $good->title ?? '' }}"><br><br>

<label class="form__label" for="category_id">Категория
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>

<div class="form-group">
    @php
        $parent_id = old('category_id') ?? $good->category_id ?? 0;
    @endphp
    <select name="category_id" class="form-control" title="Категория">
        <option value="0">Без родителя</option>
        @include('admin.part.category_id', ['level' => -1, 'parent' => 0])
    </select>
</div>

<label class="form__label" for="price">Цена
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('price')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="price" name="price" placeholder="Введите цену" required value="{{ old('price') ?? $good->price ?? '' }}"><br><br>

<label class="form__label" for="price_old">Цена старая
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('price_old')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="price_old" name="price_old" placeholder="Введите цену" value="{{ old('price_old') ?? $good->price_old ?? '' }}"><br><br>

<label class="form__label" for="manufacturer">Производитель
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('manufacturer')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="manufacturer" name="manufacturer" placeholder="Введите производителя" required value="{{ old('manufacturer') ?? $good->manufacturer ?? '' }}"><br><br>

<label class="form__label" for="country">Страна
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('country')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="country" name="country" placeholder="Введите страну" required value="{{ old('country') ?? $good->country ?? '' }}"><br><br>

<label class="form__label" for="size">Размер-габарит
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('size')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="size" name="size" placeholder="Введите размер-габарит"  value="{{ old('size') ?? $good->size ?? '' }}"><br><br>

<label class="form__label" for="power">Мощность
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('power')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="power" name="power" placeholder="Введите мощность"  value="{{ old('power') ?? $good->power ?? '' }}"><br><br>

<label class="form__label" for="description">Описание товара
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('description')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<textarea class="form-input " id="description" name="description" placeholder="Введите описание"
          required>{{ old('description') ?? $good->description ?? '' }}</textarea><br><br>

<label class="form__label" for="feature">Характеристики
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('feature')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<textarea class="form-input " id="feature" name="feature" placeholder="Введите характеристики"
          required>{{ old('feature') ?? $good->feature ?? '' }}</textarea><br><br>

<label class="form__label" for="equipment">Комплектация
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('equipment')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<textarea class="form-input " id="equipment" name="equipment" placeholder="Введите комплектацию"
          required>{{ old('equipment') ?? $good->equipment ?? '' }}</textarea><br><br>

<div class="form-group">
    <label class="form__label" for="accessory_id">Аксессуары
        <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
    </label><br>
    @php
        $current_id = old('accessory_id') ?? $good->accessory_id ?? 0;
    @endphp
    <select name="accessory_id" class="form-control" title="Аксессуары">
        <option value="0">Без родителя</option>
        @include('admin.part.goods')
    </select>
</div>

<div class="form-group">
    <label class="form__label" for="tooling_id">Оснастка
        <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
    </label><br>
    @php
        $current_id = old('tooling_id') ?? $good->tooling_id ?? 0;
    @endphp
    <select name="tooling_id" class="form-control" title="Оснастка">
        <option value="0">Без родителя</option>
        @include('admin.part.goods')
    </select>
</div>

<label class="form__label" for="weight">Вес
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('weight')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="weight" name="weight" placeholder="Введите вес"  value="{{ old('weight') ?? $good->weight ?? '' }}"><br><br>

<label class="form__label" for="stock_count">Количество на складе
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('stock_count')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="stock_count" name="stock_count" placeholder="Введите кол-во"  value="{{ old('stock_count') ?? $good->stock_count ?? '' }}"><br><br>

<label class="form__label" for="type_good">Тип товара
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('type_good')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<input class="form-input " type="text" id="type_good" name="type_good" placeholder="Введите тип товара"  value="{{ old('type_good') ?? $good->type_good ?? '' }}"><br><br>

<label class="form__label" for="new">Новинка
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('new')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<select name="new" id="new" class="form-control">
    <option value="1"
            @isset($good)
            @if($good->new == '1')
            selected
        @endif
        @endisset
    >Есть</option>
    <option value="0"
            @isset($good)
            @if($good->new == '0')
            selected
        @endif
        @endisset
    >Нет</option>
</select><br>

<label class="form__label" for="demo">Демо-зал
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('demo')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<select name="demo" id="demo" class="form-control">
    <option value="1"
            @isset($good)
            @if($good->demo == '1')
            selected
        @endif
        @endisset
    >Есть</option>
    <option value="0"
            @isset($good)
            @if($good->demo == '0')
            selected
        @endif
        @endisset
    >Нет</option>
</select><br>

<label class="form__label" for="way">В пути
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
@error('way')
<div class="alert alert-danger">{{ $message }}</div>
@enderror
<select name="way" id="way" class="form-control">
    <option value="1"
            @isset($good)
            @if($good->way == '1')
            selected
        @endif
        @endisset
    >Есть</option>
    <option value="0"
            @isset($good)
            @if($good->way == '0')
            selected
        @endif
        @endisset
    >Нет</option>
</select><br>


<label class="form__label" for="image">Картинка
    <span class="auth-mail-error auth-mail-error--hidden">Ошибка</span>
</label><br>
<input type="file" class="form-input form-control-file " name="image" id="image" accept="image/png, image/jpeg">
@isset($category->image)
    <div class="form-group form-check">
        <img src="<?=asset(Storage::url($category->image))?>" width="100px"/>
    </div>
@endisset


<<div class="parts-content-form-bottom modal-auth-bottom">
    <button class="parts-content-form-bottom__button" type="submit">Сохранить</button>
</div>