2021-12-08 18:25:48 +01:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
@section('title', "Sklep")
|
|
|
|
@section('main')
|
|
|
|
@if($new)
|
|
|
|
@php($post_url = route("product.store"))
|
|
|
|
@else
|
|
|
|
@php($post_url = route("product.update", $product))
|
|
|
|
@endif
|
|
|
|
<form action="{{ $post_url }}" method="post" enctype="multipart/form-data">
|
|
|
|
<input type="text" name="name" value="{{ $product->name }}">
|
|
|
|
<textarea name="description">{{ $product->description }}</textarea>
|
|
|
|
<input type="number" name="price" value="{{ $product->price }}">
|
|
|
|
<input type="file" name="image">
|
2021-12-09 12:13:11 +01:00
|
|
|
|
|
|
|
@foreach($categories as $category)
|
|
|
|
<input type="checkbox" id="category_{{$loop->index}}" name="category[{{$loop->index}}]" value="{{$category->uuid}}" @if($category->products()->find($product)) checked @endif>
|
|
|
|
<label for="category_{{$loop->index}}">{{$category->name}}</label>
|
|
|
|
@endforeach
|
|
|
|
|
2021-12-08 18:25:48 +01:00
|
|
|
<button type="submit">Zatwierdź</button>
|
|
|
|
|
|
|
|
@if(!$new)
|
|
|
|
@method("PATCH")
|
|
|
|
@endif
|
|
|
|
@csrf
|
|
|
|
</form>
|
|
|
|
@foreach($product->images as $vis)
|
|
|
|
<form action="{{ route("image.destroy", $vis) }}" method="post">
|
|
|
|
<img src="{{ $vis->URL() }}"/>
|
|
|
|
<button type="submit">Usuń</button>
|
|
|
|
@method("DELETE")
|
|
|
|
@csrf
|
|
|
|
</form>
|
|
|
|
@endforeach()
|
|
|
|
@endsection()
|