refactor: Update front-end assets by removing Select2 integration from various forms and adjusting the build configuration.

This commit is contained in:
pbao9
2026-02-28 21:29:13 +07:00
parent 5c97768707
commit 6b18c3ff12
36 changed files with 79 additions and 493 deletions
@@ -1,16 +1,17 @@
@php
$selectedVcenterId = old('vcenter_id') ??
($model?->host?->datacenter?->vcenter_id ?? (
$model?->datacenter?->vcenter_id ??
($model?->ipaddress?->host?->datacenter?->vcenter?->id ??
$model?->vcenter_id ?? null)
));
$selectedVcenterId = old('vcenter_id') ??
($model instanceof \App\Models\vCenter ? $model->id : (
$model?->host?->datacenter?->vcenter_id ??
($model?->datacenter?->vcenter_id ??
($model?->ipaddress?->host?->datacenter?->vcenter?->id ?? null)
)
));
@endphp
<div class="row form-group align-items-center mb-0">
<label for="vcenter_id" class="col-md-3 text-right">Chọn vCenter</label>
<div class="col-md-9 p-1 bg-customer">
<select class="form-control select2 single__select vcenter_id" name="vcenter_id"
<select class="form-control vcenter_id" name="vcenter_id"
data-selected="{{ $selectedVcenterId }}">
<option value="">--- Chọn vCenter ---</option>
@if(isset($vcenters) && $vcenters->count())
@@ -31,10 +32,6 @@ $selectedVcenterId = old('vcenter_id') ??
}
window.vcenterComponentInitialized = true;
$('.select2').select2({
width: '100%'
});
const $vcenter = $('.vcenter_id');
const $datacenter = $('.datacenter_id');
const $host = $('.host_id');
@@ -63,6 +60,7 @@ $selectedVcenterId = old('vcenter_id') ??
if ($vcenter.val()) {
if ($datacenter.is('select')) $datacenter.prop('disabled', false);
$vcenter.trigger('change.vcenterComponent');
}
});
</script>