customer.php 910 B

1234567891011121314151617181920212223242526272829303132333435363738
  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/map.js");
  15. $location_ids = array_column($customer->getLocations(), "id");
  16. $sales = Sale::query([
  17. "location_id" => $location_ids,
  18. "dts_deleted" => null
  19. ]);
  20. $tickets = Ticket::query([
  21. "location_id" => $location_ids,
  22. "dts_deleted" => null
  23. ]);
  24. View::include("header");
  25. View::include("customer", compact("customer", "sales", "tickets"));
  26. View::include("modals/new_sale", compact("customer"));
  27. View::include("modals/ticket", compact("customer"));
  28. View::include("footer");