update os group fix select2
This commit is contained in:
@@ -79,6 +79,17 @@
|
|||||||
@vite(['resources/js/pages/template.js'])
|
@vite(['resources/js/pages/template.js'])
|
||||||
<!-- end common js -->
|
<!-- end common js -->
|
||||||
|
|
||||||
|
<!-- Global Select2 initialization -->
|
||||||
|
<script>
|
||||||
|
window.initSelect2 = function() {
|
||||||
|
$(".select2.single__select").select2({
|
||||||
|
allowClear: true,
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
@include('administrator.layout.partials.toast')
|
@include('administrator.layout.partials.toast')
|
||||||
|
|
||||||
@stack('custom-scripts')
|
@stack('custom-scripts')
|
||||||
|
|||||||
@@ -1,73 +1,96 @@
|
|||||||
@extends("admin.main")
|
@extends('administrator.layout.master')
|
||||||
@section("content")
|
@push('plugin-styles')
|
||||||
@if(auth()->guard('admins')->user()->can("add package module"))
|
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||||
<div class="card card-outline card-primary">
|
@endpush
|
||||||
<form action="{{ route('package.group.store') }}" method="post">
|
|
||||||
@csrf
|
@php
|
||||||
<div class="card-body">
|
use App\Enums\Status;
|
||||||
<div class="row">
|
@endphp
|
||||||
<div class="col">
|
|
||||||
{{--Name--}}
|
@section('breadcrumb')
|
||||||
<div class="row form-group align-items-center mb-0">
|
@php
|
||||||
<label for="name" class="col-md-3 text-right">Group Name</label>
|
$breadcrumbItems = [
|
||||||
<div class="col-md-9 p-1 bg-customer">
|
['label' => 'Modules'],
|
||||||
<input type="text" id="name" name="name" placeholder="" value="" class="form-control">
|
['label' => 'Package vCenter'],
|
||||||
|
['label' => 'OS Group'],
|
||||||
|
['label' => 'Add New', 'active' => true],
|
||||||
|
];
|
||||||
|
@endphp
|
||||||
|
<x-breabcrumb :items="$breadcrumbItems" />
|
||||||
|
@endsection
|
||||||
|
@section('content')
|
||||||
|
@if (auth()->guard('admins')->user()->can('add package module'))
|
||||||
|
<div class="card card-outline card-primary">
|
||||||
|
<form action="{{ route('package.group.store') }}" method="post">
|
||||||
|
@csrf
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{-- Name --}}
|
||||||
|
<div class="row form-group align-items-center mb-0">
|
||||||
|
<label for="name" class="col-md-3 text-right">Group Name</label>
|
||||||
|
<div class="col-md-9 bg-customer p-1">
|
||||||
|
<input type="text" id="name" name="name" placeholder="" value=""
|
||||||
|
class="form-control">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{-- Thumbnail --}}
|
||||||
{{--Thumbnail--}}
|
<div class="row form-group align-items-center mb-0">
|
||||||
<div class="row form-group align-items-center mb-0">
|
<label for="thumbnail" class="col-md-3 text-right">Thumbnail</label>
|
||||||
<label for="thumbnail" class="col-md-3 text-right">Thumbnail</label>
|
<div class="col-md-9 p-1">
|
||||||
<div class="col-md-9">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col-md-8 bg-customer">
|
||||||
<div class="col-md-8 bg-customer">
|
<input type="text" data-choise="upload-images" name="thumbnail"
|
||||||
<input type="text" data-choise="upload-images" name="thumbnail"
|
value="{{ old('thumbnail') }}" class="form-control" placeholder="Chọn File">
|
||||||
value="{{ old('thumbnail') }}" class="form-control" placeholder="Chọn File">
|
</div>
|
||||||
</div>
|
<div class="col-md-4">
|
||||||
<div class="col-md-4">
|
<button type="button" class="btn btn-outline-secondary btn-open-thumb">
|
||||||
<button type="button" class="btn btn-outline-secondary btn-open-thumb">
|
<i class="fas fa-folder-open"></i> Chọn hình ảnh
|
||||||
<i class="fas fa-folder-open"></i> Chọn hình ảnh
|
</button>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<x-module.v-center :model="null" />
|
<x-module.v-center :model="null" />
|
||||||
<x-module.datacenter :model="null" />
|
<x-module.datacenter :model="null" />
|
||||||
<x-module.host :model="null" />
|
<x-module.host :model="null" />
|
||||||
{{--Status--}}
|
{{-- Status --}}
|
||||||
<div class="row form-group align-items-center mb-0">
|
<div class="row form-group align-items-center mb-0">
|
||||||
<label for="status" class="col-md-3 text-right">Status</label>
|
<label for="status" class="col-md-3 text-right">Status</label>
|
||||||
<div class="col-md-9 bg-customer">
|
<div class="col-md-9 p-1 bg-customer">
|
||||||
<select class="custom-select" id="status" name="status">
|
<select class="custom-select select2" id="status" name="status">
|
||||||
<option value="1" @selected(old('status') === 1)>Active</option>
|
@foreach (Status::getOptions() as $value => $label)
|
||||||
<option value="0" @selected(old('status') === 0)>No Active</option>
|
<option value="{{ $value }}">
|
||||||
</select>
|
{{ $label }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="card-footer">
|
||||||
<div class="card-footer">
|
<a href="{{ route('package.group.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||||
<a href="{{ route('package.group.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
@else
|
||||||
@else
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Module Package
|
||||||
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Module Package
|
management department</h5>
|
||||||
management department</h5>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
@endif
|
|
||||||
@endsection
|
@endsection
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('.btn-open-thumb').click(function () {
|
$('.btn-open-thumb').click(function() {
|
||||||
CKFinder.popup({
|
CKFinder.popup({
|
||||||
chooseFiles: true,
|
chooseFiles: true,
|
||||||
onInit: function (finder) {
|
onInit: function(finder) {
|
||||||
finder.on('files:choose', function (evt) {
|
finder.on('files:choose', function(evt) {
|
||||||
let img = $('input[name="thumbnail"]');
|
let img = $('input[name="thumbnail"]');
|
||||||
if (img.length) {
|
if (img.length) {
|
||||||
img.val(evt.data.files.first().getUrl())
|
img.val(evt.data.files.first().getUrl())
|
||||||
@@ -76,6 +99,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
// Initialize Select2
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.select2').select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
width: '100%'
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
@push('plugin-scripts')
|
||||||
|
<script src="{{ asset('build/plugins/jquery/jquery.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('build/plugins/select2/select2.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('build/plugins/datatables.net/dataTables.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('build/plugins/datatables.net-bs5/dataTables.bootstrap5.min.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
|||||||
@@ -1,74 +1,97 @@
|
|||||||
@extends("admin.main")
|
@extends('administrator.layout.master')
|
||||||
@section("content")
|
@push('plugin-styles')
|
||||||
@if(auth()->guard('admins')->user()->can("add package module"))
|
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||||
<div class="card card-outline card-primary">
|
@endpush
|
||||||
<form action="{{ route('package.group.update',['id' => $group->id]) }}" method="post">
|
|
||||||
@csrf
|
@php
|
||||||
@method('put')
|
use App\Enums\Status;
|
||||||
<div class="card-body">
|
@endphp
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
@section('breadcrumb')
|
||||||
{{--Name--}}
|
@php
|
||||||
<div class="row form-group align-items-center mb-0">
|
$breadcrumbItems = [
|
||||||
<label for="name" class="col-md-3 text-right">Group Name</label>
|
['label' => 'Modules'],
|
||||||
<div class="col-md-9 p-1 bg-customer">
|
['label' => 'Package vCenter'],
|
||||||
<input type="text" id="name" name="name" placeholder="" value="{{$group->name}}" class="form-control">
|
['label' => 'OS Group', 'active' => true],
|
||||||
|
];
|
||||||
|
@endphp
|
||||||
|
<x-breabcrumb :items="$breadcrumbItems" />
|
||||||
|
@endsection
|
||||||
|
@section('content')
|
||||||
|
@if (auth()->guard('admins')->user()->can('add package module'))
|
||||||
|
<div class="card card-outline card-primary">
|
||||||
|
<form action="{{ route('package.group.update', ['id' => $group->id]) }}" method="post">
|
||||||
|
@csrf
|
||||||
|
@method('put')
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
{{-- Name --}}
|
||||||
|
<div class="row form-group align-items-center mb-0">
|
||||||
|
<label for="name" class="col-md-3 text-right">Group Name</label>
|
||||||
|
<div class="col-md-9 bg-customer p-1">
|
||||||
|
<input type="text" id="name" name="name" placeholder=""
|
||||||
|
value="{{ $group->name }}" class="form-control">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{-- Thumbnail --}}
|
||||||
{{--Thumbnail--}}
|
<div class="row form-group align-items-center mb-0">
|
||||||
<div class="row form-group align-items-center mb-0">
|
<label for="thumbnail" class="col-md-3 text-right">Thumbnail</label>
|
||||||
<label for="thumbnail" class="col-md-3 text-right">Thumbnail</label>
|
<div class="col-md-9 p-1">
|
||||||
<div class="col-md-9">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col-md-8 bg-customer">
|
||||||
<div class="col-md-8 bg-customer">
|
<input type="text" data-choise="upload-images" name="thumbnail"
|
||||||
<input type="text" data-choise="upload-images" name="thumbnail"
|
value="{{ $group->thumbnail ?? old('thumbnail') }}" class="form-control"
|
||||||
value="{{$group->thumbnail ?? old('thumbnail')}}" class="form-control" placeholder="Chọn File">
|
placeholder="Chọn File">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<button type="button" class="btn btn-outline-secondary btn-open-thumb">
|
<button type="button" class="btn btn-outline-secondary btn-open-thumb">
|
||||||
<i class="fas fa-folder-open"></i> Chọn hình ảnh
|
<i class="fas fa-folder-open"></i> Chọn hình ảnh
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<x-module.v-center :model="$group->host->datacenter" />
|
<x-module.v-center :model="$group->host->datacenter" />
|
||||||
<x-module.datacenter :model="$group->host" />
|
<x-module.datacenter :model="$group->host" />
|
||||||
<x-module.host :model="$group" />
|
<x-module.host :model="$group" />
|
||||||
{{--Status--}}
|
{{-- Status --}}
|
||||||
<div class="row form-group align-items-center mb-0">
|
<div class="row form-group align-items-center mb-0">
|
||||||
<label for="status" class="col-md-3 text-right">Status</label>
|
<label for="status" class="col-md-3 text-right">Status</label>
|
||||||
<div class="col-md-9 bg-customer">
|
<div class="col-md-9 bg-customer p-1">
|
||||||
<select class="custom-select" id="status" name="status">
|
<select class="form-control select2" id="status" name="status">
|
||||||
<option value="1" @selected($group->status === 1)>Active</option>
|
@foreach(Status::getOptions() as $value => $label)
|
||||||
<option value="0" @selected($group->status === 0)>No Active</option>
|
<option value="{{ $value }}" @selected($group->status === $value)>
|
||||||
</select>
|
{{ $label }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="card-footer">
|
||||||
<div class="card-footer">
|
<a href="{{ route('package.group.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||||
<a href="{{ route('package.group.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
@else
|
||||||
@else
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Module Package
|
||||||
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Module Package
|
management department</h5>
|
||||||
management department</h5>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
@endif
|
|
||||||
@endsection
|
@endsection
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('.btn-open-thumb').click(function () {
|
$('.btn-open-thumb').click(function() {
|
||||||
CKFinder.popup({
|
CKFinder.popup({
|
||||||
chooseFiles: true,
|
chooseFiles: true,
|
||||||
onInit: function (finder) {
|
onInit: function(finder) {
|
||||||
finder.on('files:choose', function (evt) {
|
finder.on('files:choose', function(evt) {
|
||||||
let img = $('input[name="thumbnail"]');
|
let img = $('input[name="thumbnail"]');
|
||||||
if (img.length) {
|
if (img.length) {
|
||||||
img.val(evt.data.files.first().getUrl())
|
img.val(evt.data.files.first().getUrl())
|
||||||
@@ -77,6 +100,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// Initialize Select2
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.select2').select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
width: '100%'
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@endpush
|
||||||
|
@push('plugin-scripts')
|
||||||
|
<script src="{{ asset('build/plugins/jquery/jquery.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('build/plugins/select2/select2.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('build/plugins/datatables.net/dataTables.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('build/plugins/datatables.net-bs5/dataTables.bootstrap5.min.js') }}"></script>
|
||||||
@endpush
|
@endpush
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
$breadcrumbItems = [
|
$breadcrumbItems = [
|
||||||
['label' => 'Modules'],
|
['label' => 'Modules'],
|
||||||
['label' => 'Package vCenter'],
|
['label' => 'Package vCenter'],
|
||||||
['label' => 'Datacenter', 'active' => true],
|
['label' => 'OS Group', 'active' => true],
|
||||||
];
|
];
|
||||||
@endphp
|
@endphp
|
||||||
<x-breabcrumb :items="$breadcrumbItems" />
|
<x-breabcrumb :items="$breadcrumbItems" />
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ $selectedHostId = old('module_host_id') ?? ($model?->module_host_id ?? ($model?-
|
|||||||
}
|
}
|
||||||
window.hostComponentInitialized = true;
|
window.hostComponentInitialized = true;
|
||||||
|
|
||||||
// Initialize Select2
|
// Initialize Select2 using global function
|
||||||
initSelect2();
|
if (typeof window.initSelect2 === 'function') {
|
||||||
|
window.initSelect2();
|
||||||
|
}
|
||||||
|
|
||||||
const $datacenter = $('.datacenter_id');
|
const $datacenter = $('.datacenter_id');
|
||||||
const $host = $('.host_id');
|
const $host = $('.host_id');
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ $selectedOsGroupId = old('os_group_id') ?? ($model?->os?->os_group_id ?? null);
|
|||||||
}
|
}
|
||||||
window.osComponentInitialized = true;
|
window.osComponentInitialized = true;
|
||||||
|
|
||||||
// Initialize Select2
|
// Initialize Select2 using global function
|
||||||
initSelect2();
|
if (typeof window.initSelect2 === 'function') {
|
||||||
|
window.initSelect2();
|
||||||
|
}
|
||||||
|
|
||||||
const $host = $('.host_id');
|
const $host = $('.host_id');
|
||||||
const $osGroup = $('.os_group_id');
|
const $osGroup = $('.os_group_id');
|
||||||
|
|||||||
@@ -21,7 +21,10 @@
|
|||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initSelect2();
|
// Initialize Select2 using global function
|
||||||
|
if (typeof window.initSelect2 === 'function') {
|
||||||
|
window.initSelect2();
|
||||||
|
}
|
||||||
const $vcenter = $('#vcenter_id');
|
const $vcenter = $('#vcenter_id');
|
||||||
const $datacenter = $('#datacenter_id');
|
const $datacenter = $('#datacenter_id');
|
||||||
const $host = $('#host_id');
|
const $host = $('#host_id');
|
||||||
|
|||||||
Reference in New Issue
Block a user