location_id_field.php 629 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @var int $location_id
  4. */
  5. use App\Customer;
  6. use App\Helpers\HtmlHelper;
  7. $customers = Customer::getAll();
  8. ?>
  9. <div class="mb-3">
  10. <label class="form-label" for="location-id"><?=htmlspecialchars(__("Location"))?></label>
  11. <select class="form-control" name="location_id" id="location-id">
  12. <option value=""><?=htmlspecialchars(__("Select Location"))?></option>
  13. <?php
  14. foreach($customers as $customer) {
  15. ?>
  16. <optgroup label="<?=htmlspecialchars($customer->name)?>">
  17. <?php
  18. HtmlHelper::renderOptions($customer->getLocations(), $location_id);
  19. ?>
  20. </optgroup>
  21. <?php
  22. }
  23. ?>
  24. </select>
  25. </div>