update
This commit is contained in:
@@ -14,21 +14,74 @@ use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class Host extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
public HostRepositoryInterface $hostRepository,
|
||||
public DatacenterRepositoryInterface $datacenterRepository
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$hosts = $this->hostRepository->filter([
|
||||
'page' => $request->get('page') ?? 1
|
||||
], ['datacenter.vCenter']);
|
||||
$title = 'List all Host';
|
||||
return view("admin.package.host.index", compact('hosts', 'title'));
|
||||
return view("admin.package.host.index", compact('title'));
|
||||
}
|
||||
|
||||
public function datatable(Request $request)
|
||||
{
|
||||
$query = $this->hostRepository->filter(
|
||||
$request->all(),
|
||||
['datacenter.vCenter'],
|
||||
[],
|
||||
['*'],
|
||||
true
|
||||
);
|
||||
|
||||
return DataTables::eloquent($query)
|
||||
->editColumn('updated_at', function ($d) {
|
||||
return $d->updated_at ? $d->updated_at->format('d/m/Y') : '';
|
||||
})
|
||||
->addColumn('action', function ($d) {
|
||||
$editUrl = route('package.host.edit', ['id' => $d->id]);
|
||||
$deleteBtn = '';
|
||||
|
||||
if (auth()->guard('admins')->user()->can("delete module vcenter")) {
|
||||
$deleteUrl = route('package.host.destroy', ['id' => $d->id]);
|
||||
$csrf = csrf_field();
|
||||
$method = method_field('delete');
|
||||
$deleteBtn = <<<HTML
|
||||
<form method="post" action="$deleteUrl" class="d-inline">
|
||||
$method
|
||||
$csrf
|
||||
<button type="submit" class="btn btn-danger btn-sm" data-toggle="tooltip" title="Delete">
|
||||
<i data-lucide="trash-2" class="icon-sm"></i>
|
||||
</button>
|
||||
</form>
|
||||
HTML;
|
||||
}
|
||||
|
||||
return <<<HTML
|
||||
<a href="$editUrl" class="btn btn-warning btn-sm me-1" data-toggle="tooltip" title="Edit">
|
||||
<i data-lucide="edit" class="icon-sm"></i>
|
||||
</a>
|
||||
$deleteBtn
|
||||
HTML;
|
||||
})
|
||||
->filterColumn('datacenter.name', function ($query, $keyword) {
|
||||
$query->whereHas('datacenter', function ($q) use ($keyword) {
|
||||
$q->where('name', 'like', "%{$keyword}%");
|
||||
});
|
||||
})
|
||||
->filterColumn('datacenter.v_center.host', function ($query, $keyword) {
|
||||
$query->whereHas('datacenter.vCenter', function ($q) use ($keyword) {
|
||||
$q->where('host', 'like', "%{$keyword}%");
|
||||
});
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
public function sync(SyncHost $syncHost)
|
||||
{
|
||||
@@ -45,7 +98,7 @@ class Host extends Controller
|
||||
{
|
||||
$request->validated();
|
||||
$datacenter = $this->datacenterRepository->find($request->get('module_datacenter_id'));
|
||||
if (! $datacenter) {
|
||||
if (!$datacenter) {
|
||||
return back()->withErrors('Invalid Request');
|
||||
}
|
||||
$isCreated = $this->hostRepository->findBy('host_id', $request->get('host_id'));
|
||||
@@ -65,19 +118,19 @@ class Host extends Controller
|
||||
public function edit(int $id = 0)
|
||||
{
|
||||
$host = $this->hostRepository->findWithRelationships($id, ['datacenter']);
|
||||
if (! $host) {
|
||||
if (!$host) {
|
||||
return back()->withErrors('Invalid Request');
|
||||
}
|
||||
$title = "View Host Information";
|
||||
|
||||
return view('admin.package.host.edit', compact('host', 'title'));
|
||||
return view('admin.package.host.edit', compact('host', 'title'));
|
||||
}
|
||||
public function update(int $id = 0, HostRequest $request)
|
||||
{
|
||||
|
||||
$request->validated();
|
||||
$host = $this->hostRepository->find($id);
|
||||
if (! $host) {
|
||||
if (!$host) {
|
||||
return redirect()->route('package.host.index')->withErrors('Invalid Request');
|
||||
}
|
||||
if ($request->get('host_id') !== $host->host_id) {
|
||||
@@ -100,7 +153,7 @@ class Host extends Controller
|
||||
{
|
||||
$host = $this->hostRepository->find($id);
|
||||
|
||||
if (! $host) {
|
||||
if (!$host) {
|
||||
return back()->withErrors('Invalid request.');
|
||||
}
|
||||
|
||||
|
||||
@@ -16,18 +16,23 @@ class HostCachedRepository extends BaseCachedRepository implements HostRepositor
|
||||
{
|
||||
return $this->hostRepository->getModel();
|
||||
}
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
||||
{
|
||||
public function filter(
|
||||
array $data = [],
|
||||
array $relationships = [],
|
||||
array $withCount = [],
|
||||
array $select = ['*'],
|
||||
bool $returnQuery = false
|
||||
) {
|
||||
if ($returnQuery || isset($data['page']) || isset($data['paginate'])) {
|
||||
return $this->hostRepository->filter($data, $relationships, $withCount, $select, $returnQuery);
|
||||
}
|
||||
|
||||
$cacheKey = $this->getCacheKey(md5(json_encode([
|
||||
'filterItem' => [
|
||||
'data' => $data,
|
||||
'relationships' => $relationships,
|
||||
'select' => $select,
|
||||
'withCount' => $withCount
|
||||
]
|
||||
'filter' => compact('data', 'relationships', 'withCount', 'select')
|
||||
])));
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($data, $relationships, $select, $withCount) {
|
||||
return $this->hostRepository->filter($data, $relationships, $withCount, $select);
|
||||
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($data, $relationships, $select, $withCount, $returnQuery) {
|
||||
return $this->hostRepository->filter($data, $relationships, $withCount, $select, $returnQuery);
|
||||
});
|
||||
}
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [],array $withCount = [], array $withSum = [])
|
||||
|
||||
@@ -12,23 +12,32 @@ class HostRepository extends BaseRepository implements HostRepositoryInterface
|
||||
return ModuleHost::class;
|
||||
}
|
||||
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
||||
{
|
||||
$model = $this->model->with($relationships)->select($select);
|
||||
public function filter(
|
||||
array $data = [],
|
||||
array $relationships = [],
|
||||
array $withCount = [],
|
||||
array $select = ['*'],
|
||||
bool $returnQuery = false
|
||||
) {
|
||||
$query = $this->model->with($relationships)->select($select);
|
||||
|
||||
if (isset($data['module_datacenter_id']) && $data['module_datacenter_id']) {
|
||||
$model = $model->where("module_datacenter_id", $data['module_datacenter_id']);
|
||||
$query = $query->where("module_datacenter_id", $data['module_datacenter_id']);
|
||||
}
|
||||
|
||||
if (count($withCount) > 0) {
|
||||
$model = $model->withCount($withCount);
|
||||
$query = $query->withCount($withCount);
|
||||
}
|
||||
|
||||
if (isset($data['page'])) {
|
||||
return $model->paginate(15);
|
||||
if ($returnQuery) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
if (isset($data['page']) || isset($data['paginate'])) {
|
||||
return $query->paginate($data['per_page'] ?? 15);
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [], array $withCount = [], array $withSum = [])
|
||||
|
||||
@@ -4,7 +4,13 @@ namespace App\Repositories\Module\Host;
|
||||
use App\Repositories\BaseRepositoryInterface;
|
||||
|
||||
interface HostRepositoryInterface extends BaseRepositoryInterface{
|
||||
public function filter(array $data = [],array $relationships = [],array $withCount = [],array $select = ['*']);
|
||||
public function filter(
|
||||
array $data = [],
|
||||
array $relationships = [],
|
||||
array $withCount = [],
|
||||
array $select = ['*'],
|
||||
bool $returnQuery = false
|
||||
);
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [],array $withCount = [], array $withSum = []);
|
||||
public function findBy(string $key = '',string|int|null $value = '' );
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ return new class extends Migration {
|
||||
$table->id()->autoIncrement();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->string('datacenter_id', 255)->nullable();
|
||||
$table->bigInteger('vcenter_id')->default(0)->index();
|
||||
$table->foreignId('vcenter_id')->constrained('module_vcenter')->cascadeOnDelete()->nullable()->index();
|
||||
$table->integer('status')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ return new class extends Migration
|
||||
$table->string('name',100)->nullable();
|
||||
$table->string('host_id',255)->nullable();
|
||||
$table->string('template',255)->nullable();
|
||||
$table->bigInteger('module_datacenter_id')->default(0)->index();
|
||||
$table->foreignId('module_datacenter_id')->constrained('module_datacenter')->cascadeOnDelete()->nullable()->index();
|
||||
$table->string('console',255)->nullable();
|
||||
$table->string('iso_path',255)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
@@ -11,10 +11,10 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('product_vm_templates', function (Blueprint $table) {
|
||||
$table->foreignId('product_id')->constrained('products')->cascadeOnDelete();
|
||||
$table->foreignId('vm_template_id')->constrained('vm_templates')->cascadeOnDelete();
|
||||
});
|
||||
// Schema::create('product_vm_templates', function (Blueprint $table) {
|
||||
// $table->foreignId('product_id')->constrained('products')->cascadeOnDelete();
|
||||
// $table->foreignId('vm_template_id')->constrained('vm_templates')->cascadeOnDelete();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('module_host', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('module_datacenter_id')->nullable()->change();
|
||||
|
||||
$table->foreign('module_datacenter_id')
|
||||
->references('id')
|
||||
->on('module_datacenter')
|
||||
->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('module_host', function (Blueprint $table) {
|
||||
// Drop the foreign key first
|
||||
$table->dropForeign(['module_datacenter_id']);
|
||||
|
||||
// Revert column type (assuming it was bigInteger with default 0 based on previous context)
|
||||
$table->bigInteger('module_datacenter_id')->default(0)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('module_datacenter', function (Blueprint $table) {
|
||||
//
|
||||
$table->unsignedBigInteger('vcenter_id')->nullable()->change();
|
||||
|
||||
$table->foreign('vcenter_id')
|
||||
->references('id')
|
||||
->on('module_vcenter')
|
||||
->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('module_datacenter', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,51 +1,76 @@
|
||||
@extends("admin.main")
|
||||
@section("content")
|
||||
@if(auth()->guard('admins')->user()->can("add module vcenter"))
|
||||
<div class="card card-outline card-primary">
|
||||
<form action="{{ route('package.host.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="card-body">
|
||||
<x-module.v-center :model="null" />
|
||||
<x-module.datacenter :model="null" />
|
||||
{{--Name--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="name" class="col-md-3 text-right">Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="name" name="name" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Host ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="host_id" class="col-md-3 text-right">Host ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="host_id" name="host_id" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Template ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="template" class="col-md-3 text-right">Template ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="template" name="template" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Console ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="console" class="col-md-3 text-right">Console Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="console" name="console" placeholder="consolenode129.tgs.com.vn" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('package.host.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
<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 vCenter
|
||||
management department</h5>
|
||||
</div>
|
||||
@endif
|
||||
@extends('administrator.layout.master')
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Modules'],
|
||||
['label' => 'Package Host'],
|
||||
['label' => 'Host', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
<x-breabcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
@push('plugin-styles')
|
||||
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
@section("content")
|
||||
@if(auth()->guard('admins')->user()->can("add module vcenter"))
|
||||
<div class="card card-outline card-primary">
|
||||
<form action="{{ route('package.host.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="card-body">
|
||||
<x-module.v-center :model="null" />
|
||||
<x-module.datacenter :model="null" />
|
||||
{{--Name--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="name" class="col-md-3 text-right">Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="name" name="name" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Host ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="host_id" class="col-md-3 text-right">Host ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="host_id" name="host_id" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Template ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="template" class="col-md-3 text-right">Template ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="template" name="template" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Console ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="console" class="col-md-3 text-right">Console Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="console" name="console" placeholder="consolenode129.tgs.com.vn" value=""
|
||||
class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('package.host.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
<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 vCenter
|
||||
management department</h5>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@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
|
||||
|
||||
@push('plugin-styles')
|
||||
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
@@ -1,53 +1,82 @@
|
||||
@extends("admin.main")
|
||||
@section("content")
|
||||
@if(auth()->guard('admins')->user()->can("add module vcenter"))
|
||||
<div class="card card-outline card-primary">
|
||||
<form action="{{ route('package.host.update',['id' => $host->id]) }}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="card-body">
|
||||
<x-module.v-center :model="$host->datacenter" />
|
||||
<x-module.datacenter :model="$host" />
|
||||
|
||||
{{--Name--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="name" class="col-md-3 text-right">Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="name" name="name" placeholder="" value="{{ $host->name}}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Host ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="host_id" class="col-md-3 text-right">Host ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="host_id" name="host_id" placeholder="" value="{{ $host->host_id}}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Template ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="template" class="col-md-3 text-right">Template ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="template" name="template" placeholder="" value="{{ $host->template}}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Console ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="console" class="col-md-3 text-right">Console Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="console" name="console" placeholder="consolenode129.tgs.com.vn" value="{{ $host->console}}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('package.host.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
<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 vCenter
|
||||
management department</h5>
|
||||
</div>
|
||||
@endif
|
||||
@extends('administrator.layout.master')
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Modules'],
|
||||
['label' => 'Package Host'],
|
||||
['label' => 'Host', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
<x-breabcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
@push('plugin-styles')
|
||||
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
@section("content")
|
||||
@if(auth()->guard('admins')->user()->can("add module vcenter"))
|
||||
<div class="card card-outline card-primary">
|
||||
<form action="{{ route('package.host.update', ['id' => $host->id]) }}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="card-body">
|
||||
<x-module.v-center :model="$host->datacenter" />
|
||||
<x-module.datacenter :model="$host" />
|
||||
|
||||
{{--Name--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="name" class="col-md-3 text-right">Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="name" name="name" placeholder="" value="{{ $host->name}}"
|
||||
class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Host ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="host_id" class="col-md-3 text-right">Host ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="host_id" name="host_id" placeholder="" value="{{ $host->host_id}}"
|
||||
class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Template ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="template" class="col-md-3 text-right">Template ID</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="template" name="template" placeholder="" value="{{ $host->template}}"
|
||||
class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{--Console ID--}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="console" class="col-md-3 text-right">Console Name</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<input type="text" id="console" name="console" placeholder="consolenode129.tgs.com.vn"
|
||||
value="{{ $host->console}}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('package.host.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
<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 vCenter
|
||||
management department</h5>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@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
|
||||
|
||||
@push('plugin-styles')
|
||||
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
@@ -1,79 +1,30 @@
|
||||
@php use App\Http\Helpers\Helper; @endphp
|
||||
@extends('admin.main')
|
||||
@extends('administrator.layout.master')
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Modules'],
|
||||
['label' => 'Package Host'],
|
||||
['label' => 'Host', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
<x-breabcrumb :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("admin.block.Sync.Host")
|
||||
</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>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
{{ $hosts->withQueryString()->links() }}
|
||||
<div class="card-body p-5">
|
||||
<x-datatable id="hostTable" ajax="{{ route('package.host.datatable') }}" :columns="[
|
||||
['key' => 'name', 'label' => 'Name'],
|
||||
['key' => 'datacenter.name', 'label' => 'Datacenter Name'],
|
||||
['key' => 'datacenter.v_center.host', 'label' => 'vCenter Host'],
|
||||
['key' => 'updated_at', 'label' => 'Last Updated'],
|
||||
['key' => 'action', 'label' => 'Action']
|
||||
]" />
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
@@ -83,3 +34,14 @@
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@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
|
||||
|
||||
@push('plugin-styles')
|
||||
<link href="{{ asset('build/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
@@ -74,6 +74,9 @@ $dtColumns = collect($columns)->map(function ($c) {
|
||||
minimumResultsForSearch: Infinity,
|
||||
width: '60px'
|
||||
});
|
||||
if (window.lucide) {
|
||||
lucide.createIcons();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ Route::prefix('administrator')->group(function () {
|
||||
Route::get('edit/{id}', 'edit')->name('edit');
|
||||
Route::put('edit/{id}', 'update')->name('update');
|
||||
Route::delete('remove/{id}', 'destroy')->name('destroy');
|
||||
Route::get('datatable', 'datatable')->name('datatable');
|
||||
});
|
||||
// Network
|
||||
Route::group([
|
||||
|
||||
@@ -19,7 +19,3 @@ use Yajra\DataTables\DataTables;
|
||||
include __DIR__ . '/admin.php';
|
||||
include __DIR__ . '/customer.php';
|
||||
|
||||
|
||||
Route::get('/users/datatable-test', function () {
|
||||
return DataTables::of(Customer::query())->make(true);
|
||||
})->name('admin.users.datatable');
|
||||
|
||||
Reference in New Issue
Block a user