location_id_field.php 556 B

123456789101112131415161718192021222324252627282930
  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. <?php
  13. foreach($customers as $customer) {
  14. ?>
  15. <optgroup label="<?=htmlspecialchars($customer->name)?>">
  16. <?php
  17. HtmlHelper::renderOptions($customer->getLocations(), $location_id);
  18. ?>
  19. </optgroup>
  20. <?php
  21. }
  22. ?>
  23. </select>
  24. </div>