1
0

customer.php 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. namespace App;
  3. /**
  4. * @var int $id
  5. */
  6. $customer = Customer::require($id);
  7. $core = Core::getInstance();
  8. $core->addBreadcrumb("/customers", __("Customers"));
  9. $core->addBreadcrumb($customer->getUrl(), $customer->name);
  10. $user = $core->getUser();
  11. $user->requireAdmin();
  12. $core->addScript("/js/new-sale-modal.js");
  13. $core->addScript("/js/ticket-modal.js");
  14. $core->addScript("/js/new-document-modal.js");
  15. $core->addScript("/js/map.js");
  16. $location_ids = array_column($customer->getLocations(), "id");
  17. $sales = Sale::query([
  18. "location_id" => $location_ids,
  19. "dts_deleted" => null
  20. ]);
  21. $tickets = Ticket::query([
  22. "location_id" => $location_ids,
  23. "dts_deleted" => null
  24. ]);
  25. View::include("header");
  26. View::include("customer", compact("customer", "sales", "tickets"));
  27. View::include("modals/new_sale", compact("customer"));
  28. View::include("modals/ticket", compact("customer"));
  29. View::include("modals/new_document", compact("customer"));
  30. View::include("footer");