mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-24 04:14:57 +00:00
Refactoring product view
Creating a separate buttons file to edit or delete a product
This commit is contained in:
parent
842976c77f
commit
6236c0c9fe
22
resources/views/product/buttons.blade.php
Normal file
22
resources/views/product/buttons.blade.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<span class="d-inline-block text-truncat float-right">
|
||||||
|
<div class="btn-group btn-group-sm" role="group">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- EDIT BUTTON -->
|
||||||
|
@if ($product->user_id == \Auth::id())
|
||||||
|
<form action="/product/{{$product->id}}" method="POST">
|
||||||
|
@method('PATCH')
|
||||||
|
<button type="button" class="btn-sm btn-secondary mr-1">Edit</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
<!-- DELETE BUTTON -->
|
||||||
|
<form action="/product/{{$product->id}}" method="POST">
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="button" class="btn-sm btn-danger">Delete</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</span>
|
@ -19,7 +19,7 @@
|
|||||||
<div class="card mt-4">
|
<div class="card mt-4">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Product: <strong>{{$product['name']}}</strong>
|
Product: <strong>{{$product['name']}}</strong>
|
||||||
<span class="d-inline-block text-truncat float-right">Edit - Delete</span>
|
@include ('product.buttons')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@ -28,6 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<strong>Items:</strong>
|
||||||
<ul>
|
<ul>
|
||||||
@forelse ($product->items as $item)
|
@forelse ($product->items as $item)
|
||||||
<li><a href="/item/{{ $item->id }}">{{ $item->name }}</a></li>
|
<li><a href="/item/{{ $item->id }}">{{ $item->name }}</a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user