sale_invoices_section.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace App;
  3. /**
  4. * @var Sale $sale
  5. */
  6. use App\Helpers\HtmlHelper;
  7. ?>
  8. <section class="mb-4">
  9. <h3><?=htmlspecialchars(__("Invoices"))?></h3>
  10. <?php
  11. $invoices = $sale->getInvoices();
  12. if(empty($invoices)) {
  13. HtmlHelper::renderInfoAlert(__("No invoices to display."));
  14. }
  15. else {
  16. ?>
  17. <table class="table table-bordered table-hover">
  18. <colgroup>
  19. <col style="width: 1%"/>
  20. <col style="width: 15%"/>
  21. <col style="width: 55%"/>
  22. <col style="width: 10%"/>
  23. <col style="width: 10%"/>
  24. <col style="width: 10%"/>
  25. <col style="width: 1%"/>
  26. </colgroup>
  27. <thead>
  28. <tr>
  29. <th><?=htmlspecialchars(__("No."))?></th>
  30. <th><?=htmlspecialchars(__("Status"))?></th>
  31. <th><?=htmlspecialchars(__("Items"))?></th>
  32. <th><?=htmlspecialchars(__("Subtotal"))?></th>
  33. <th><?=htmlspecialchars(__("Tax"))?></th>
  34. <th><?=htmlspecialchars(__("Total"))?></th>
  35. <th><?=htmlspecialchars(__("Actions"))?></th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <?php
  40. foreach($invoices as $invoice) {
  41. ?>
  42. <tr>
  43. <td class="text-end">
  44. <a href="<?=htmlspecialchars($invoice->getUrl())?>"><?=$invoice->number?></a>
  45. </td>
  46. <td>
  47. <?=htmlspecialchars($invoice->getDisplayInvoiceStatus())?>
  48. </td>
  49. <td>
  50. <?php
  51. View::include("components/document_items_unstyled_list", ["items" => $invoice->getItems()]);
  52. ?>
  53. </td>
  54. <td class="text-end">
  55. <?=htmlspecialchars($invoice->getDisplaySubtotal())?>
  56. </td>
  57. <td class="text-end">
  58. <?=htmlspecialchars($invoice->getDisplayTax())?>
  59. </td>
  60. <td class="text-end">
  61. <?=htmlspecialchars($invoice->getDisplayTotal())?>
  62. </td>
  63. <td class="p-1">
  64. <a href="<?=htmlspecialchars($invoice->getUrl())?>" class="btn btn-sm btn-primary">
  65. <?=htmlspecialchars(__("View"))?>
  66. </a>
  67. </td>
  68. </tr>
  69. <?php
  70. }
  71. ?>
  72. </tbody>
  73. </table>
  74. <?php
  75. }
  76. ?>
  77. </section>