| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- /**
- * @var Sale[] $sales
- * @var bool $show_batch_actions
- */
- $core = Core::getInstance();
- $user = $core->getUser();
- $show_batch_actions ??= false;
- ?>
- <form method="post">
- <?php
- $user->insertCsrfToken();
- ?>
- <table class="table table-bordered table-hover mb-3">
- <thead>
- <tr>
- <?php
- if($show_batch_actions) {
- ?>
- <th class="text-center">
- <input type="checkbox" id="sales-table-select-all" />
- </th>
- <?php
- }
- ?>
- <th><?=htmlspecialchars(__("Ref."))?></th>
- <th><?=htmlspecialchars(__("Date"))?></th>
- <th><?=htmlspecialchars(__("Location"))?></th>
- <th><?=htmlspecialchars(__("Status"))?></th>
- <th><?=htmlspecialchars(__("Items"))?></th>
- <th><?=htmlspecialchars(__("Value"))?></th>
- <th><?=htmlspecialchars(__("Predicted Sold Date"))?></th>
- <th><?=htmlspecialchars(__("Last Updated"))?></th>
- <th><?=htmlspecialchars(__("Actions"))?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($sales as $sale) {
- $location = $sale->getLocation();
- ?>
- <tr>
- <?php
- if($show_batch_actions) {
- ?>
- <td class="text-center">
- <input type="checkbox" name="sale_ids[]" value="<?=$sale->id?>" />
- </td>
- <?php
- }
- ?>
- <td class="text-end">
- <a href="<?=htmlspecialchars($sale->getUrl())?>"><?=htmlspecialchars($sale->getReference())?></a>
- </td>
- <td>
- <?=htmlspecialchars($user->formatDate($sale->getDateTimeCreated()))?>
- </td>
- <td>
- <a href="<?=htmlspecialchars($location->getUrl())?>">
- <?=htmlspecialchars($location->getDisplayName())?>
- </a>
- </td>
- <td>
- <?=htmlspecialchars($sale->getDisplayStatus())?>
- </td>
- <td>
- <?php
- foreach($sale->getItems() as $item) {
- ?>
- <?=htmlspecialchars($item->getProduct()->name)?> × <?=$item->quantity?><br />
- <?php
- }
- ?>
- </td>
- <td class="text-end">
- <?=htmlspecialchars($sale->getDisplayAmount())?>
- </td>
- <td>
- <?=htmlspecialchars($sale->getDisplayPredictedSoldDate())?>
- </td>
- <td>
- <?php
- $dt_updated = $sale->getDateTimeUpdated();
- if($dt_updated) {
- echo $dt_updated->diffForHumans();
- }
- ?>
- </td>
- <td class="p-1">
- <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($sale->getUrl())?>">
- <?=htmlspecialchars(__("View"))?>
- </a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- if($show_batch_actions) {
- ?>
- <div class="card mb-3">
- <div class="card-header">
- <?=htmlspecialchars(__("Batch Actions"))?>
- </div>
- <div class="card-body">
- <label class="sr-only" for="batch-action"><?=htmlspecialchars(__("Batch Action"))?></label>
- <div class="input-group">
- <select class="form-control" name="batch_action" id="batch-action" required>
- <option value=""><?=htmlspecialchars(__("Select Batch Action"))?></option>
- <option value="mark-new"><?=htmlspecialchars(__("Mark As New"))?></option>
- <option value="mark-confirmed"><?=htmlspecialchars(__("Mark As Confirmed"))?></option>
- <option value="mark-shipping"><?=htmlspecialchars(__("Mark As Shipping"))?></option>
- <option value="mark-completed"><?=htmlspecialchars(__("Mark As Completed"))?></option>
- </select>
- <button type="submit" class="btn btn-primary">
- <?=htmlspecialchars(__("Submit"))?>
- </button>
- </div>
- </div>
- </div>
- <?php
- }
- ?>
- </form>
|