| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use App\Constraint\HasTextConstraint;
- $core = Core::getInstance();
- $core->addBreadcrumb("/locations", __("Locations"));
- $nvp = ["dts_deleted" => null];
- $request = Request::fromRequest();
- $customer_id = $request->int("customer_id");
- if($customer_id) {
- $nvp["customer_id"] = $customer_id;
- }
- $location_id = $request->int("location_id");
- if($location_id) {
- $nvp["id"] = $location_id;
- }
- $name = $request->string("name");
- if($name) {
- $nvp["name"] = new HasTextConstraint($name);
- }
- $count = Location::count($nvp);
- $pagination = new Pagination($count);
- $pagination->setTerms(__("%s location"), __("%s locations"));
- $locations = Location::query($nvp, [
- "sort" => "name",
- "offset" => $pagination->getOffset(),
- "limit" => $pagination->getPageSize()
- ]);
- $core->addScript("/js/map.js");
- View::include("header");
- View::include("locations", compact("locations", "pagination", "customer_id", "location_id", "name"));
- View::include("footer");
|