testlara/resources/views/document/index.blade.php

65 lines
2.3 KiB
PHP
Raw Normal View History

2023-10-27 19:59:05 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Documents</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-2">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Documents</h2>
</div>
<div class="pull-right mb-2">
<a class="btn btn-success" href="{{ route('products.index') }}"> Товары</a>
</div>
<div class="pull-right mb-2">
<a class="btn btn-success" href="{{ route('documents.create') }}"> Create Document</a>
</div>
</div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<table class="table table-bordered">
<thead>
<tr>
<th>Date</th>
<th>Type</th>
<th>Status</th>
<th>products</th>
</tr>
</thead>
<tbody>
@foreach ($documents as $document)
<tr>
<td>{{ $document->date }}</td>
<td>{{ $document->type == \App\Models\Document::TYPE_TO ? 'Поступление' : 'Расход' }}</td>
<td>{{ $document->status == 0 ? 'Not Applied' : 'Applied' }}</td>
<td>
@foreach($document->documentProducts as $documentProduct)
артикул - {{$documentProduct->product->article}}, было до: {{$documentProduct->past_quantity}}, количество: {{$documentProduct->quantity}}
@endforeach
</td>
<td>
@if($document->status == \App\Models\Document::STATUS_NOT_APPLIED)
<form action="/documents/apply/{{$document->id}}" method="POST">
@csrf
@method('POST')
<button type="submit" class="btn btn-danger">apply</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
{!! $documents->links() !!}
</div>
</body>
</html>