This commit is contained in:
pbao9
2026-01-31 10:40:35 +07:00
parent 4b5e22c9d2
commit 27f365d8cf
7 changed files with 152 additions and 108 deletions
@@ -26,7 +26,7 @@
</div>
</div>
@push('scripts')
@push('custom-scripts')
<script>
$(document).ready(function () {
// Prevent multiple initializations using namespace
@@ -75,7 +75,7 @@
response.data.forEach(dc => {
const selected = preselect == dc.id ? 'selected' : '';
options +=
`<option value="${dc.id}" ${selected}>${dc.name}</option>`;
`<option value="${dc.id}" ${selected}>${dc.name} - ${dc.datacenter_id}</option>`;
});
$datacenter.html(options).prop('disabled', false);
@@ -108,14 +108,14 @@
$datacenter.off('change.datacenterComponent').on('change.datacenterComponent', function () {
const datacenterId = $(this).val();
// Reset and disable host
$host.html('<option value="">--- Chọn Host ---</option>').prop('disabled', true);
// Reset and disable host
$host.html('<option value="">--- Chọn Host ---</option>').prop('disabled', true);
// Enable host if datacenter is selected
if (datacenterId) {
$host.prop('disabled', false);
}
});
// Enable host if datacenter is selected
if (datacenterId) {
$host.prop('disabled', false);
}
});
// Initial load logic
const selectedDatacenterId = $datacenter.data('selected');
@@ -126,5 +126,5 @@
debounceLoadDatacenters($vcenter.val());
}
});
</script>
</script>
@endpush