customer.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace App;
  3. /**
  4. * @var Customer $customer
  5. * @var Sale[] $sales
  6. * @var Ticket[] $tickets
  7. * @var Document[] $sales_orders
  8. */
  9. $locations = $customer->getLocations();
  10. ?>
  11. <div class="row mb-3 align-items-center">
  12. <div class="col">
  13. <h3 class="mb-0"><?=htmlspecialchars($customer->name)?></h3>
  14. </div>
  15. <div class="col-auto">
  16. <a class="btn btn-primary" href="<?=htmlspecialchars($customer->getUrl())?>/update">
  17. <i class="fa fa-fw fa-pencil"></i>
  18. <?=htmlspecialchars(__("Update"))?>
  19. </a>
  20. </div>
  21. </div>
  22. <div class="row mb-3 align-items-center">
  23. <div class="col">
  24. <h4 class="mb-0"><?=htmlspecialchars(__("Locations"))?></h4>
  25. </div>
  26. <div class="col-auto">
  27. <a class="btn btn-success" href="/locations/add?customer_id=<?=$customer->id?>">
  28. <i class="fa fa-fw fa-plus"></i>
  29. <?=htmlspecialchars(__("Add Location"))?>
  30. </a>
  31. </div>
  32. </div>
  33. <section class="mb-4">
  34. <?php
  35. if(empty($locations)) {
  36. ?>
  37. <div class="alert alert-info mb-3">
  38. <i class="fa fa-fw fa-info-circle"></i>
  39. <?=htmlspecialchars(__("No locations to display."))?>
  40. </div>
  41. <?php
  42. }
  43. else {
  44. ?>
  45. <div class="mb-3 rounded" id="map" style="height: 480px;" data-customer-id="<?=$customer->id?>">
  46. </div>
  47. <?php
  48. View::include("locations_table", compact("locations"));
  49. }
  50. ?>
  51. </section>
  52. <?php
  53. View::include("sale_invoices_section", ["sales_orders" => $customer->getActiveSalesOrders()]);
  54. ?>
  55. <section class="mb-4">
  56. <div class="row mb-3 align-items-center">
  57. <div class="col">
  58. <h4 class="mb-0"><?=htmlspecialchars(__("Leads"))?></h4>
  59. </div>
  60. <div class="col-auto">
  61. <button class="btn btn-success" type="button" data-bs-toggle="modal" data-bs-target="#new-sale-modal">
  62. <i class="fa fa-fw fa-plus"></i>
  63. <?=htmlspecialchars(__("Add Lead"))?>
  64. </button>
  65. </div>
  66. </div>
  67. <?php
  68. if(empty($sales)) {
  69. ?>
  70. <div class="alert alert-info mb-3">
  71. <i class="fa fa-fw fa-info-circle"></i>
  72. <?=htmlspecialchars(__("No leads to display."))?>
  73. </div>
  74. <?php
  75. }
  76. else {
  77. View::include("sales_table", compact("sales"));
  78. }
  79. ?>
  80. </section>
  81. <section class="mb-4">
  82. <div class="row mb-3 align-items-center">
  83. <div class="col">
  84. <h4 class="mb-0"><?=htmlspecialchars(__("Tickets"))?></h4>
  85. </div>
  86. <div class="col-auto">
  87. <button class="btn btn-success" type="button" data-bs-toggle="modal" data-bs-target="#ticket-modal">
  88. <i class="fa fa-fw fa-plus"></i>
  89. <?=htmlspecialchars(__("Add Ticket"))?>
  90. </button>
  91. </div>
  92. </div>
  93. <?php
  94. if(empty($tickets)) {
  95. ?>
  96. <div class="alert alert-info mb-3">
  97. <i class="fa fa-fw fa-info-circle"></i>
  98. <?=htmlspecialchars(__("No tickets to display."))?>
  99. </div>
  100. <?php
  101. }
  102. else {
  103. View::include("tickets_table", compact("tickets"));
  104. }
  105. ?>
  106. </section>