update sync vm

This commit is contained in:
pbao9
2026-02-05 21:57:57 +07:00
parent 3a01d07a74
commit eef04846a8
11 changed files with 436 additions and 76 deletions
@@ -0,0 +1,5 @@
<x-button-crm type="button" variant="primary" size="sm" route="package.vm.create" icon="plus-circle">Add
VM</x-button-crm>
@include("administrator.pages.block.Sync.All")
<x-button-crm type="button" variant="secondary" size="sm" route="package.vm.sync" icon="refresh-cw">Sync
VM</x-button-crm>
@@ -1,79 +1,39 @@
@php use App\Http\Helpers\Helper; @endphp
@extends('administrator.layout.master')
@push('plugin-styles')
@foreach (config('assets.datatable.css') as $datatable)
<link href="{{ asset($datatable) }}" rel="stylesheet" />
@endforeach
@endpush
@section('breadcrumb')
@php
$breadcrumbItems = [
['label' => 'Modules'],
['label' => 'Package vCenter'],
['label' => 'Virtual Machine', 'active' => true],
];
@endphp
<x-admin-breadcrumb :items="$breadcrumbItems" />
@endsection
@section('content')
@if(auth()->guard('admins')->user()->can("manager package module"))
<div class="card card-primary card-outline">
<div class="card-header">
@include("administrator.pages.block.Sync.Host")
@include("administrator.pages.block.Sync.VM")
</div>
<div class="card-body">
<table class="table table-invoice table-bordered">
<thead>
<tr>
<th class="text-center">
<label>
<input type="checkbox" name="check" class="check-all">
</label>
</th>
<th class="text-center">Host Name</th>
<th class="text-center">Datacenter Name</th>
<th class="text-center">vCenter Host</th>
<th class="text-center">Last Updated</th>
<th style="width: 40px"></th>
<th style="width: 40px"></th>
</tr>
</thead>
<tbody>
@if(count($hosts) > 0)
@foreach($hosts->all() as $item)
<tr>
<td class="text-center">
<label for=""></label><input type="checkbox" name="id[]" value="{{ $item->id }}"
id="">
</td>
<td class="text-center">
{{ $item->name }}
</td>
<td class="text-center">
@isset($item->datacenter->name)
{{$item->datacenter->name}}
@endisset
</td>
<td class="text-center">
@isset($item->datacenter->vCenter->host)
{{$item->datacenter->vCenter->host}}
@endisset
</td>
<td class="text-center">
@time($item->updated_at)
</td>
<td class="text-center">
<a class="btn btn-warning btn-sm"
href="{{ route('package.host.edit', ['id' => $item->id]) }}">
<i class="fas fa-search"></i>
</a>
</td>
<td>
@if(auth()->guard('admins')->user()->can("delete module vcenter"))
<form method="post" class="d-inline"
action="{{ route('package.host.destroy', ['id' => $item->id]) }}">
@method('delete')
@csrf
<button type="submit" data-toggle="tooltip" data-placement="top" title=""
class="btn btn-sm btn-danger" data-original-title="Xoá">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<x-datatable id="vmTable" ajax="{{ route('package.vm.datatable') }}" :columns="[
['key' => 'vm_id', 'label' => 'VM ID'],
['key' => 'name', 'label' => 'Name'],
['key' => 'power_state', 'label' => 'State'],
['key' => 'cpu', 'label' => 'CPU'],
['key' => 'ram_mb', 'label' => 'RAM (MB)'],
['key' => 'datacenter.name', 'label' => 'Datacenter'],
['key' => 'host.name', 'label' => 'Host'],
['key' => 'action', 'label' => 'Action', 'orderable' => false, 'searchable' => false],
]" />
</div>
<div class="card-footer">
{{ $hosts->withQueryString()->links() }}
</div>
</div>
@else
@@ -83,3 +43,8 @@
</div>
@endif
@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
<script src="{{ asset($datatable) }}"></script>
@endforeach
@endpush