diff --git a/app/Http/Controllers/admin/package/OsVersion.php b/app/Http/Controllers/admin/package/OsVersion.php index fc29410..fb95fdc 100644 --- a/app/Http/Controllers/admin/package/OsVersion.php +++ b/app/Http/Controllers/admin/package/OsVersion.php @@ -14,6 +14,7 @@ use App\Http\Services\vCenter as ServiceVCenter; use App\Repositories\Os\OsRepositoryInterface; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Validator; use Yajra\DataTables\Facades\DataTables; diff --git a/app/Http/Controllers/rest/ModuleController.php b/app/Http/Controllers/rest/ModuleController.php index 0aa00a6..96c7d6e 100644 --- a/app/Http/Controllers/rest/ModuleController.php +++ b/app/Http/Controllers/rest/ModuleController.php @@ -241,9 +241,9 @@ class ModuleController extends Controller [ 'module_host_id' => $host_id ], + ['host'], // Include host relationship [], - [], - ['id', 'name'] + ['id', 'name', 'module_host_id'] // Add module_host_id to select ); if (count($groups) > 0) { return response()->json(['error' => false, 'data' => $groups]); diff --git a/resources/views/administrator/pages/package/version/edit.blade.php b/resources/views/administrator/pages/package/version/edit.blade.php index f039608..e354a66 100644 --- a/resources/views/administrator/pages/package/version/edit.blade.php +++ b/resources/views/administrator/pages/package/version/edit.blade.php @@ -3,6 +3,10 @@ @endpush +@php + use App\Enums\Status; +@endphp + @section('breadcrumb') @php $breadcrumbItems = [ @@ -35,7 +39,7 @@ - +
@@ -46,9 +50,12 @@
- + @foreach(Status::getOptions() as $value => $label) + + @endforeach
@@ -69,6 +76,22 @@ @endif @endsection +@push('scripts') + +@endpush @push('plugin-scripts') diff --git a/resources/views/components/module/os.blade.php b/resources/views/components/module/os.blade.php index d33a7c3..dbbb791 100644 --- a/resources/views/components/module/os.blade.php +++ b/resources/views/components/module/os.blade.php @@ -1,6 +1,11 @@ @php -// Fix: Get os_group_id from the relationship correctly -$selectedOsGroupId = old('os_group_id') ?? ($model?->os?->os_group_id ?? null); + +$selectedOsGroupId = old('os_group_id') ?? ($model?->os_group_id ?? null); + +$lists = collect(); +if ($model && $model->osGroup) { + $lists = collect([$model->osGroup]); +} @endphp @@ -12,7 +17,12 @@ $selectedOsGroupId = old('os_group_id') ?? ($model?->os?->os_group_id ?? null); @if ($selectedOsGroupId && $lists) @foreach ($lists->all() as $item) @if ($item->id == $selectedOsGroupId) - + @endif @endforeach @endif @@ -72,8 +82,9 @@ $selectedOsGroupId = old('os_group_id') ?? ($model?->os?->os_group_id ?? null); let options = ''; response.data.forEach(os => { const selected = preselect == os.id ? 'selected' : ''; + const hostInfo = os.host ? ` - ${os.host.name} (${os.host.host_id})` : ''; options += - ``; + ``; }); $osGroup.html(options).prop('disabled', false);