This commit is contained in:
pbao9
2026-02-03 16:10:49 +07:00
parent 6178a76eee
commit 0dbd9bfebe
12 changed files with 446 additions and 206 deletions
@@ -1,94 +1,94 @@
@extends("administrator.layout.master")
@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' => 'IP Address', 'url' => route('package.ipaddress.index')],
['label' => 'Add IP Address', 'active' => true],
];
@endphp
<x-admin-breadcrumb :items="$breadcrumbItems" />
@endsection
@section("content")
@if(auth()->guard('admins')->user()->can("manager package module"))
<div class="card card-outline card-primary">
<form action="{{ route('package.ipaddress.store') }}" method="post">
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-12">
@if(auth()->guard('admins')->user()->can("manager package module"))
<div class="card card-outline card-primary">
<form action="{{ route('package.ipaddress.store') }}" method="post">
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-12">
<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" />
<x-module.network :model="null" />
<x-module.network :model="null" />
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="netmask" class="col-md-3 text-right">Netmask</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="netmask" name="netmask" placeholder="" value="255.255.255.0"
class="form-control">
</div>
</div>
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="gateway" class="col-md-3 text-right">Gateway</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="gateway" name="gateway" placeholder="192.168.0.1" value=""
class="form-control">
</div>
</div>
{{--DNS--}}
<div class="row form-group align-items-center mb-0">
<label for="dns" class="col-md-3 text-right">DNS</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="dns" name="dns" placeholder="" value="8.8.8.8" class="form-control">
</div>
</div>
{{--Tuy chon--}}
<div class="row form-group align-items-center mb-0">
<label for="option_selected" class="col-md-3 text-right">Tuỳ chọn</label>
<div class="col-md-9 p-1 bg-customer">
<select class="custom-select" id="option_selected" name="option_selected">
<option value="0">Mặc định (From - To)</option>
<option value="1">Nhập ngẫu nhiên</option>
</select>
</div>
</div>
<div class="form-row" id="ip-pool">
<label for="" class="col-md-3 text-right"></label>
<div class="col-md-9 p-1">
{{--From IP--}}
<div class="form-group align-items-center mb-0">
<label class="d-block" for="from">From IP</label>
<div class="p-1 bg-customer">
<input type="text" class="form-control" id="from" name="from"
placeholder="192.168.1.1" value="">
</div>
</div>
{{--From IP--}}
<div class="form-group align-items-center mb-0">
<label class="mb-2" for="to">To IP</label>
<div class="p-1 bg-customer">
<input type="text" class="form-control" id="to" name="to"
placeholder="192.168.1.100" value="">
</div>
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="netmask" class="col-md-3 text-right">Netmask</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="netmask" name="netmask" placeholder="" value="255.255.255.0"
class="form-control">
</div>
</div>
</div>
<div class="row form-group align-items-center d-none mb-0" id="row-ip">
<label for="list-ip" class="col-md-3 text-right">List IP Address</label>
<div class="col-md-9 p-1 bg-customer">
<textarea class="form-control" name="list-ip" id="list-ip" rows="5"></textarea>
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="gateway" class="col-md-3 text-right">Gateway</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="gateway" name="gateway" placeholder="192.168.0.1" value=""
class="form-control">
</div>
</div>
{{--DNS--}}
<div class="row form-group align-items-center mb-0">
<label for="dns" class="col-md-3 text-right">DNS</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="dns" name="dns" placeholder="" value="8.8.8.8" class="form-control">
</div>
</div>
{{--Tuy chon--}}
<div class="row form-group align-items-center mb-0">
<label for="option_selected" class="col-md-3 text-right">Tuỳ chọn</label>
<div class="col-md-9 p-1 bg-customer">
<select class="custom-select select2" id="option_selected" name="option_selected">
<option value="0">Mặc định (From - To)</option>
<option value="1">Nhập ngẫu nhiên</option>
</select>
</div>
</div>
<div class="row form-group align-items-center d-none mb-0" id="row-ip">
<label for="list-ip" class="col-md-3 text-right">List IP Address</label>
<div class="col-md-9 p-1 bg-customer">
<textarea class="form-control" name="list-ip" id="list-ip" rows="5"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<a href="{{ route('package.ipaddress.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 Package
management department</h5>
</div>
@endif
<div class="card-footer">
<a href="{{ route('package.ipaddress.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 Package
management department</h5>
</div>
@endif
@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
<script src="{{ asset($datatable) }}"></script>
@endforeach
@endpush
@@ -0,0 +1,6 @@
<div class="d-flex gap-2">
<x-button-crm route="package.ipaddress.edit" :params="['id' => $id]" variant="primary" size="sm" class="p-1"
icon="edit">Edit</x-button-crm>
<x-button-crm type="button" variant="danger" size="sm" icon="trash-2" class="p-1"
onclick="showDeleteModal({{ $id }}, '{{ addslashes($ip) }}')">Delete</x-button-crm>
</div>
@@ -0,0 +1,63 @@
<!-- Delete Confirmation Modal -->
<div class="modal micromodal-slide" id="deleteModal" aria-hidden="true">
<div class="modal__overlay" tabindex="-1" data-micromodal-close>
<div class="modal__container modal--sm" role="dialog" aria-modal="true" aria-labelledby="deleteModalLabel">
<header class="modal__header bg-primary text-white">
<h6 class="modal__title" id="deleteModalLabel">
<i data-lucide="trash-2" class="w-15px h-15px me-2"></i>
Confirm Delete
</h6>
<button class="modal__close" aria-label="Close modal" data-micromodal-close>
<i data-lucide="x"></i>
</button>
</header>
<main class="modal__content">
<div class="text-center">
<i data-lucide="alert-triangle" class="text-warning mb-3" style="width: 48px; height: 48px;"></i>
<h6 class="mb-2">Are you sure?</h6>
<p class="text-muted small mb-1">Delete IP Address:</p>
<p class="fw-bold mb-2"><span id="deleteItemName"></span></p>
<p class="text-danger small mb-0">This action cannot be undone!</p>
</div>
</main>
<footer class="modal__footer">
<x-button-crm type="button" variant="secondary" size="sm" icon="x" data-micromodal-close>Cancel</x-button-crm>
<form id="deleteForm" method="POST" class="d-inline">
@csrf
@method('DELETE')
<x-button-crm type="submit" variant="danger" size="sm" icon="trash-2">Confirm Delete</x-button-crm>
</form>
</footer>
</div>
</div>
</div>
@push('custom-scripts')
<script>
document.addEventListener('DOMContentLoaded', function () {
function initializeModal() {
if (typeof ModalManager !== 'undefined') {
window.showDeleteModal = function (id, name) {
// Update modal content
const nameElement = document.getElementById('deleteItemName');
const formElement = document.getElementById('deleteForm');
if (nameElement && formElement) {
nameElement.textContent = name;
formElement.action = `/administrator/package/ipaddress/remove-ip-address/${id}`;
ModalManager.show('deleteModal');
} else {
console.error('Modal elements not found');
}
};
} else {
console.warn('ModalManager not available, retrying...');
setTimeout(initializeModal, 100);
}
}
setTimeout(initializeModal, 50);
});
</script>
@endpush
@@ -1,85 +1,106 @@
@extends("administrator.layout.master")
@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' => 'Host', 'url' => route('package.host.index')],
['label' => 'Edit Host', 'active' => true],
];
@endphp
<x-admin-breadcrumb :items="$breadcrumbItems" />
@endsection
@section("content")
@if(auth()->guard('admins')->user()->can("manager package module"))
<div class="card card-outline card-primary">
<form action="{{ route('package.ipaddress.update',['id' => $ipaddress->id]) }}" method="post">
@csrf
@method('put')
<div class="card-body">
<div class="row">
<div class="col-md-12">
@if(auth()->guard('admins')->user()->can("manager package module"))
<div class="card card-outline card-primary">
<form action="{{ route('package.ipaddress.update', ['id' => $ipaddress->id]) }}" method="post">
@csrf
@method('put')
<div class="card-body">
<div class="row">
<div class="col-md-12">
<x-module.v-center :model="$ipaddress->host->datacenter" />
<x-module.v-center :model="$ipaddress->host->datacenter" />
<x-module.datacenter :model="$ipaddress->host" />
<x-module.datacenter :model="$ipaddress->host" />
<x-module.host :model="$ipaddress" />
<x-module.host :model="$ipaddress" />
<x-module.network :model="$ipaddress" />
<x-module.network :model="$ipaddress" />
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="netmask" class="col-md-3 text-right">Netmask</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="netmask" name="netmask" placeholder="" value="{{$ipaddress->netmask ?? '255.255.255.0'}}"
class="form-control">
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="netmask" class="col-md-3 text-right">Netmask</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="netmask" name="netmask" placeholder="" value="{{$ipaddress->netmask ?? '255.255.255.0'}}"
class="form-control">
</div>
</div>
</div>
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="gateway" class="col-md-3 text-right">Gateway</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="gateway" name="gateway" placeholder="192.168.0.1" value="{{$ipaddress->gateway}}"
class="form-control">
{{--Netmask--}}
<div class="row form-group align-items-center mb-0">
<label for="gateway" class="col-md-3 text-right">Gateway</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="gateway" name="gateway" placeholder="192.168.0.1" value="{{$ipaddress->gateway}}"
class="form-control">
</div>
</div>
</div>
{{--DNS--}}
<div class="row form-group align-items-center mb-0">
<label for="dns" class="col-md-3 text-right">DNS</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="dns" name="dns" placeholder="" value="{{$ipaddress->dns ?? '8.8.8.8'}}" class="form-control">
{{--DNS--}}
<div class="row form-group align-items-center mb-0">
<label for="dns" class="col-md-3 text-right">DNS</label>
<div class="col-md-9 p-1 bg-customer">
<input type="text" id="dns" name="dns" placeholder="" value="{{$ipaddress->dns ?? '8.8.8.8'}}" class="form-control">
</div>
</div>
</div>
{{--Tuy chon--}}
<div class="row form-group align-items-center mb-0">
<label for="option_selected" class="col-md-3 text-right">Tuỳ chọn</label>
<div class="col-md-9 p-1 bg-customer">
<select class="custom-select" id="option_selected" name="option_selected">
<option value="0">Mặc định (From - To)</option>
<option value="1" selected>Nhập ngẫu nhiên</option>
</select>
{{--Tuy chon--}}
<div class="row form-group align-items-center mb-0">
<label for="option_selected" class="col-md-3 text-right">Tuỳ chọn</label>
<div class="col-md-9 p-1 bg-customer">
<select class="custom-select select2" id="option_selected" name="option_selected">
<option value="0">Mặc định (From - To)</option>
<option value="1" selected>Nhập ngẫu nhiên</option>
</select>
</div>
</div>
</div>
{{-- IP --}}
<div class="row form-group align-items-center mb-0">
<label for="ip" class="col-md-3 text-right">IP Address</label>
<div class="col-md-9 p-1 bg-customer">
<input class="form-control" name="ip" id="ip" value="{{$ipaddress->ip}}">
{{-- IP --}}
<div class="row form-group align-items-center mb-0">
<label for="ip" class="col-md-3 text-right">IP Address</label>
<div class="col-md-9 p-1 bg-customer">
<input class="form-control" name="ip" id="ip" value="{{$ipaddress->ip}}">
</div>
</div>
</div>
{{--Status--}}
<div class="row form-group align-items-center mb-0">
<label for="status" class="col-md-3 text-right">Status</label>
<div class="col-md-9 p-1 bg-customer">
<select class="custom-select" id="status" name="status">
<option value="0" @selected($ipaddress->status === 0)>Free</option>
<option value="1" @selected($ipaddress->status === 1)>Assigned</option>
</select>
{{--Status--}}
<div class="row form-group align-items-center mb-0">
<label for="status" class="col-md-3 text-right">Status</label>
<div class="col-md-9 p-1 bg-customer">
<select class="custom-select select2" id="status" name="status">
<option value="0" @selected($ipaddress->status === 0)>Free</option>
<option value="1" @selected($ipaddress->status === 1)>Assigned</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<a href="{{ route('package.ipaddress.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 Package
management department</h5>
</div>
@endif
<div class="card-footer">
<a href="{{ route('package.ipaddress.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 Package
management department</h5>
</div>
@endif
@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
<script src="{{ asset($datatable) }}"></script>
@endforeach
@endpush