|
|
@@ -9,9 +9,19 @@ use App\Helpers\HtmlHelper;
|
|
|
|
|
|
$customers = isset($customer) ? [$customer] : Customer::getAll();
|
|
|
|
|
|
+$request = Request::fromRequest();
|
|
|
+
|
|
|
$core = Core::getInstance();
|
|
|
$settings = $core->getSettings();
|
|
|
$default_company_id = $settings->defaultCompanyId ?? null;
|
|
|
+$default_location_id = $request->int("add_location_id");
|
|
|
+
|
|
|
+$location_options = [];
|
|
|
+foreach($customers as $customer) {
|
|
|
+ foreach($customer->getLocations() as $location) {
|
|
|
+ $location_options[$location->id] = $location->getDisplayName();
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
?>
|
|
|
<div class="modal fade" role="dialog" tabindex="-1" data-backdrop="static" id="new-sale-modal">
|
|
|
@@ -37,15 +47,7 @@ $default_company_id = $settings->defaultCompanyId ?? null;
|
|
|
<label class="form-label" for="location-id"><?= htmlspecialchars(__("Location")) ?></label>
|
|
|
<select class="form-select" name="location_id" id="location-id">
|
|
|
<?php
|
|
|
- foreach($customers as $customer) {
|
|
|
- foreach($customer->getLocations() as $location) {
|
|
|
- ?>
|
|
|
- <option value="<?=$location->id?>">
|
|
|
- <?=htmlspecialchars($location->getDisplayName())?>
|
|
|
- </option>
|
|
|
- <?php
|
|
|
- }
|
|
|
- }
|
|
|
+ HtmlHelper::renderOptions($location_options, $default_location_id);
|
|
|
?>
|
|
|
</select>
|
|
|
</div>
|