| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use App\Enums\Currencies;
- use App\Enums\SaleStatuses;
- use App\Helpers\HtmlHelper;
- /**
- * @var Sale $sale
- */
- $core = Core::getInstance();
- $user = $core->getUser();
- ?>
- <section class="mb-4">
- <h3><?=htmlspecialchars($sale->getTitle())?></h3>
- <form class="mb-4" action="<?=htmlspecialchars($sale->getUrl())?>/submit" method="post">
- <div class="row">
- <div class="col-xl-6">
- <h4><?=htmlspecialchars(__("Main Details"))?></h4>
- <div class="mb-3">
- <label class="form-label" for="currency"><?=htmlspecialchars(__("Currency"))?></label>
- <select class="form-control" name="currency" id="currency">
- <?php
- HtmlHelper::renderOptions(Currencies::options(), $sale->currency);
- ?>
- </select>
- </div>
- <div class="mb-3">
- <label class="form-label" for="status">
- <?=htmlspecialchars(__("Status"))?>
- </label>
- <select class="form-control" name="status" id="status">
- <?php
- HtmlHelper::renderOptions(SaleStatuses::options(), $sale->status);
- ?>
- </select>
- </div>
- <div class="mb-3">
- <label for="tax-rate" class="form-label">
- <?=htmlspecialchars(__("Tax Rate (%)"))?>
- </label>
- <input class="form-control" type="number" name="tax_rate" id="tax-rate" value="<?=$sale->tax_rate?>" min="0" max="100.00" step="0.01" placeholder="Type tax rate" required />
- </div>
- </div>
- <div class="col-xl-6">
- <h4><?=htmlspecialchars(__("Additional Details"))?></h4>
- <dl>
- <dt><?=htmlspecialchars(__("Company"))?></dt>
- <dd><?=htmlspecialchars($sale->getCompany()->name)?></dd>
- <dt><?=htmlspecialchars(__("Location"))?></dt>
- <dd><?=htmlspecialchars($sale->getLocation()->getDisplayName())?></dd>
- <dt><?=htmlspecialchars(__("Created By"))?></dt>
- <dd><?=htmlspecialchars($sale->getUser()->getDisplayName())?></dd>
- <dt><?=htmlspecialchars(__("Created Date/Time"))?></dt>
- <dd><?=htmlspecialchars($sale->getDateTimeCreated()->format("d/m/Y H:i"))?></dd>
- </dl>
- </div>
- </div>
- <button type="submit" class="btn btn-primary">
- <i class="fa fa-fw fa-save"></i>
- <?=htmlspecialchars(__("Save Sale"))?>
- </button>
- </form>
- </section>
- <?php
- View::include("sale_items_section", compact("sale"));
- View::include("sale_invoices_section", compact("sale"));
- View::include("sale_notes_section", compact("sale"));
- ?>
- <section class="mb-4">
- <div class="row mb-3">
- <div class="col">
- <h3><?=htmlspecialchars(__("Tickets"))?></h3>
- </div>
- <div class="col-auto">
- <button class="btn btn-success" type="button" data-bs-toggle="modal" data-bs-target="#ticket-modal" data-location-id="<?=$sale->location_id?>" data-sale-number="<?=$sale->getNumber()?>">
- <i class="fa fa-fw fa-plus"></i>
- <?=htmlspecialchars(__("Add Ticket"))?>
- </button>
- </div>
- </div>
- <?php
- $tickets = $sale->getTickets();
- if(empty($tickets)) {
- HtmlHelper::renderInfoAlert(__("No tickets to display."));
- }
- else {
- ?>
- <table class="table table-bordered table-hover">
- <colgroup>
- <col style="width: 10%"/>
- <col style="width: 10%"/>
- <col style="width: 35%"/>
- <col style="width: 10%"/>
- <col style="width: 20%"/>
- <col style="width: 15%"/>
- <col style="width: 1%"/>
- </colgroup>
- <thead>
- <tr>
- <th><?=htmlspecialchars(__("ID"))?></th>
- <th><?=htmlspecialchars(__("Date"))?></th>
- <th><?=htmlspecialchars(__("Subject"))?></th>
- <th><?=htmlspecialchars(__("Status"))?></th>
- <th><?=htmlspecialchars(__("Assigned To"))?></th>
- <th><?=htmlspecialchars(__("Last Updated"))?></th>
- <th><?=htmlspecialchars(__("Actions"))?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($tickets as $ticket) {
- ?>
- <tr>
- <td class="text-end">
- <a href="<?=htmlspecialchars($ticket->getUrl())?>"><?=htmlspecialchars($ticket->id)?></a>
- </td>
- <td>
- <?=htmlspecialchars($user->formatDate($ticket->getDateTimeCreated()))?>
- </td>
- <td>
- <?=htmlspecialchars($ticket->subject)?>
- </td>
- <td>
- <?=htmlspecialchars($ticket->getDisplayStatus())?>
- </td>
- <td>
- <?=htmlspecialchars($ticket->getDisplayAssignedTo())?>
- </td>
- <td>
- <?=htmlspecialchars($user->formatDateTime($ticket->getDateTimeUpdated()))?>
- </td>
- <td class="p-1">
- <a class="btn btn-sm btn-primary" href="<?=htmlspecialchars($ticket->getUrl())?>"><?=htmlspecialchars(__("View"))?></a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- }
- ?>
- </section>
|