| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use App\Enums\DocumentTypes;
- /**
- * @var string $title
- * @var int $type
- * @var Document[] $documents
- * @var Pagination $pagination
- */
- $is_invoice = ($type === DocumentTypes::INVOICE);
- $is_goods_in = ($type === DocumentTypes::GOODS_IN);
- $is_aru = ($type === DocumentTypes::ADVANCE_REPLACEMENT_UNIT);
- ?>
- <div class="row mb-3">
- <div class="col">
- <h3><?=htmlspecialchars($title)?></h3>
- </div>
- <?php
- if($is_goods_in || $is_aru) {
- ?>
- <div class="col-auto">
- <a class="btn btn-success" data-bs-toggle="modal" data-bs-target="#new-document-modal" data-type="<?=$type?>">
- <i class="fa fa-fw fa-plus"></i>
- <?=htmlspecialchars(__("Add"))?>
- </a>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- if(empty($documents)) {
- ?>
- <div class="alert alert-info">
- <i class="fa fa-fw fa-info-circle"></i>
- <?=htmlspecialchars(__("No documents to display."))?>
- </div>
- <?php
- }
- else {
- ?>
- <table class="table table-bordered table-hover mb-3">
- <thead>
- <tr>
- <th><?=htmlspecialchars(__("Number"))?></th>
- <?php
- if($is_goods_in) {
- ?>
- <th><?=htmlspecialchars(__("Location / Supplier"))?></th>
- <?php
- }
- else {
- ?>
- <th><?=htmlspecialchars(__("Location"))?></th>
- <th><?=htmlspecialchars(__("Status"))?></th>
- <?php
- }
- ?>
- <th><?=htmlspecialchars(__("Items"))?></th>
- <th><?=htmlspecialchars(__("Actions"))?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($documents as $document) {
- $location = $document->getLocation();
- $supplier = $document->getSupplier();
- ?>
- <tr>
- <td class="text-end">
- <a href="<?=htmlspecialchars($document->getUrl())?>"><?=$document->number?></a>
- </td>
- <td>
- <?php
- if($location) {
- ?>
- <a href="<?=htmlspecialchars($location->getUrl())?>">
- <?=htmlspecialchars($location->getDisplayName())?>
- </a>
- <?php
- }
- if($supplier) {
- ?>
- <a href="<?=htmlspecialchars($supplier->getUrl())?>">
- <?=htmlspecialchars($supplier->name)?>
- </a>
- <?php
- }
- ?>
- </td>
- <?php
- if(!$is_goods_in) {
- if($is_invoice) {
- ?>
- <td>
- <?=htmlspecialchars($document->getDisplayInvoiceStatus())?>
- </td>
- <?php
- }
- else {
- ?>
- <td>
- <?=htmlspecialchars($document->getDisplayAruStatus())?>
- </td>
- <?php
- }
- }
- ?>
- <td>
- <ul class="list-unstyled mb-0">
- <?php
- foreach($document->getItems() as $item) {
- ?>
- <li>
- <?=htmlspecialchars($item->description)?> × <?=$item->quantity?>
- <?php
- if($item->serial_number) {
- ?>
- <span class="text-muted">
- (S/N: <?=htmlspecialchars($item->serial_number)?>)
- </span>
- <?php
- }
- ?>
- </li>
- <?php
- }
- ?>
- </ul>
- </td>
- <td class="p-1">
- <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($document->getUrl())?>">
- <?=htmlspecialchars(__("View"))?>
- </a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- $pagination->render();
- }
|