update
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<title>Thế Giới Số Admin | Service Management Portal</title>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
(function() {
|
||||
const theme = localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: dark)').matches ?
|
||||
'dark' : 'light');
|
||||
document.documentElement.setAttribute('data-bs-theme', theme);
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="page-wrapper">
|
||||
@include('administrator.layout.partials.header')
|
||||
<div class="page-content">
|
||||
<div class="card bg-white shadow-sm mb-4">
|
||||
<div class="card mb-4 bg-white shadow-sm">
|
||||
<div class="card-body p-3">
|
||||
@yield('breadcrumb')
|
||||
@yield('tab')
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
<!-- Global Select2 initialization -->
|
||||
<script>
|
||||
window.initSelect2 = function () {
|
||||
window.initSelect2 = function() {
|
||||
$(".select2.single__select").select2({
|
||||
allowClear: true,
|
||||
width: "100%",
|
||||
@@ -85,7 +85,7 @@
|
||||
};
|
||||
|
||||
// Global ModalManager initialization
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
if (typeof ModalManager !== 'undefined') {
|
||||
ModalManager.init();
|
||||
console.log('ModalManager initialized globally');
|
||||
@@ -100,6 +100,10 @@
|
||||
<x-modal-confirm-delete />
|
||||
|
||||
@stack('custom-scripts')
|
||||
<script type="text/javascript">
|
||||
var apiMedia = '{{ route('api.GetAllImage') }}';
|
||||
var apiUpload = '{{ route('media.upload') }}';
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
Copyright © {{ date('Y') }}
|
||||
<a href="https://tgs.com.vn" target="_blank">Thế Giới Số</a>.
|
||||
</p>
|
||||
</footer>
|
||||
</footer>
|
||||
|
||||
@@ -4,107 +4,82 @@
|
||||
<link href="{{ asset($datatable) }}" rel="stylesheet" />
|
||||
@endforeach
|
||||
@endpush
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Modules'],
|
||||
['label' => 'Package vCenter'],
|
||||
['label' => 'OS Group', 'url' => route('package.group.index')],
|
||||
['label' => 'Edit', 'active' => true]
|
||||
];
|
||||
@endphp
|
||||
<x-admin-breadcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
use App\Enums\Status;
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Modules'],
|
||||
['label' => 'Package vCenter'],
|
||||
['label' => 'OS Group', 'url' => route('package.group.index')],
|
||||
['label' => 'Add Os Group', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
|
||||
@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>
|
||||
{{-- Thumbnail --}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="thumbnail" class="col-md-3 text-right">Thumbnail</label>
|
||||
<div class="col-md-9 p-1">
|
||||
<div class="row">
|
||||
<div class="col-md-8 bg-customer">
|
||||
<input type="text" data-choise="upload-images" name="thumbnail"
|
||||
value="{{ old('thumbnail') }}" class="form-control" placeholder="Chọn File">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-outline-secondary btn-open-thumb">
|
||||
<i class="fas fa-folder-open"></i> Chọn hình ảnh
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<x-admin-breadcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
@php
|
||||
use App\Enums\Status;
|
||||
@endphp
|
||||
|
||||
<x-module.v-center :model="null" />
|
||||
<x-module.datacenter :model="null" />
|
||||
<x-module.host :model="null" />
|
||||
{{-- 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">
|
||||
@foreach (Status::getOptions() as $value => $label)
|
||||
<option value="{{ $value }}">
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@section('content')
|
||||
@if (auth()->guard('admins')->user()->can('add package module'))
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header">
|
||||
Create New OS Group
|
||||
</div>
|
||||
<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>
|
||||
|
||||
{{-- Thumbnail using component --}}
|
||||
<x-image-picker name="thumbnail" label="Thumbnail" />
|
||||
|
||||
<x-module.v-center :model="null" />
|
||||
<x-module.datacenter :model="null" />
|
||||
<x-module.host :model="null" />
|
||||
{{-- 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 bg-customer p-1">
|
||||
<select class="custom-select select2" id="status" name="status">
|
||||
@foreach (Status::getOptions() as $value => $label)
|
||||
<option value="{{ $value }}">
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<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>
|
||||
</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('scripts')
|
||||
<script type="text/javascript">
|
||||
$('.btn-open-thumb').click(function () {
|
||||
CKFinder.popup({
|
||||
chooseFiles: true,
|
||||
onInit: function (finder) {
|
||||
finder.on('files:choose', function (evt) {
|
||||
let img = $('input[name="thumbnail"]');
|
||||
if (img.length) {
|
||||
img.val(evt.data.files.first().getUrl())
|
||||
img.trigger('input')
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@push('plugin-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
<script src="{{ asset($datatable) }}"></script>
|
||||
@endforeach
|
||||
@endpush
|
||||
</div>
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="package.group.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Create
|
||||
Product</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</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
|
||||
<script src="{{ asset('lib/ckfinder/ckfinder.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
@section('content')
|
||||
@if (auth()->guard('admins')->user()->can('add package module'))
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header">
|
||||
Edit OS Group
|
||||
</div>
|
||||
<form action="{{ route('package.group.update', ['id' => $group->id]) }}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
@@ -36,24 +39,9 @@
|
||||
class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
{{-- Thumbnail --}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="thumbnail" class="col-md-3 text-right">Thumbnail</label>
|
||||
<div class="col-md-9 p-1">
|
||||
<div class="row">
|
||||
<div class="col-md-8 bg-customer">
|
||||
<input type="text" data-choise="upload-images" name="thumbnail"
|
||||
value="{{ $group->thumbnail ?? old('thumbnail') }}" class="form-control"
|
||||
placeholder="Chọn File">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-outline-secondary btn-open-thumb">
|
||||
<i class="fas fa-folder-open"></i> Chọn hình ảnh
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Thumbnail using component --}}
|
||||
<x-image-picker name="thumbnail" label="Thumbnail" :value="$group->thumbnail" />
|
||||
|
||||
<x-module.v-center :model="$group->host->datacenter" />
|
||||
<x-module.datacenter :model="$group->host" />
|
||||
@@ -74,10 +62,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<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>
|
||||
</div>
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="package.group.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="save">Update
|
||||
OS Group</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
@@ -87,27 +77,10 @@
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$('.btn-open-thumb').click(function () {
|
||||
CKFinder.popup({
|
||||
chooseFiles: true,
|
||||
onInit: function (finder) {
|
||||
finder.on('files:choose', function (evt) {
|
||||
let img = $('input[name="thumbnail"]');
|
||||
if (img.length) {
|
||||
img.val(evt.data.files.first().getUrl())
|
||||
img.trigger('input')
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@push('plugin-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
<script src="{{ asset($datatable) }}"></script>
|
||||
@endforeach
|
||||
<script src="{{ asset('lib/ckfinder/ckfinder.js') }}"></script>
|
||||
@endpush
|
||||
@@ -25,13 +25,16 @@
|
||||
<div class="card card-outline card-primary">
|
||||
<form action="{{ route('package.version.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mb-0">Add Version OS</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{{-- Group Name --}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="version" class="col-md-3 text-right">Version</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<div class="col-md-9 bg-customer p-1">
|
||||
<input type="text" id="version" name="version" placeholder="6.x,7.x, ..."
|
||||
value="{{ old('version') }}" class="form-control">
|
||||
</div>
|
||||
@@ -44,16 +47,16 @@
|
||||
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="version" class="col-md-3 text-right">Template</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<div class="col-md-9 bg-customer p-1">
|
||||
<input type="text" id="template_id" name="template_id" placeholder="vm-2005"
|
||||
value="{{ old('template_id') }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<div class="col-md-9 bg-customer p-1">
|
||||
<select class="custom-select select2 single__select" id="status" name="status">
|
||||
@foreach(Status::getOptions() as $value => $label)
|
||||
@foreach (Status::getOptions() as $value => $label)
|
||||
<option value="{{ $value }}" @selected(old('status') == $value)>
|
||||
{{ $label }}
|
||||
</option>
|
||||
@@ -64,10 +67,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('package.version.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||
</div>
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="package.version.index">Trở lại</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Tạo mới</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
@@ -85,4 +89,4 @@
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
<script src="{{ asset($datatable) }}"></script>
|
||||
@endforeach
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="d-flex gap-2">
|
||||
<x-button-crm route="package.version.edit" :params="['id' => $id]" variant="primary" size="sm" class="p-1"
|
||||
icon="edit">Edit</x-button-crm>
|
||||
icon="edit">Chỉnh sửa</x-button-crm>
|
||||
<x-button-crm type="button" variant="danger" size="sm" icon="trash-2" class="p-1"
|
||||
onclick="showDeleteModal({{ $id }}, '{{ addslashes($version) }}')">Delete</x-button-crm>
|
||||
onclick="showDeleteModal({{ $id }}, '{{ addslashes($version) }}')">Xoá</x-button-crm>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
@php
|
||||
$status = App\Enums\Status::tryFrom($row->status);
|
||||
@endphp
|
||||
|
||||
@if($status)
|
||||
<x-admin-badge :variant="$status->value">
|
||||
{{ $status->label() }}
|
||||
</x-admin-badge>
|
||||
@else
|
||||
<x-admin-badge variant="secondary">
|
||||
Unknown
|
||||
</x-admin-badge>
|
||||
@endif
|
||||
@@ -23,6 +23,9 @@
|
||||
@section('content')
|
||||
@if (auth()->guard('admins')->user()->can('add package module'))
|
||||
<div class="card card-outline card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mb-0">Edit Version</h3>
|
||||
</div>
|
||||
<form action="{{ route('package.version.update', ['id' => $version->id]) }}" method="post">
|
||||
@csrf
|
||||
@method('put')
|
||||
@@ -32,7 +35,7 @@
|
||||
{{-- Group Name --}}
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="version" class="col-md-3 text-right">Version</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<div class="col-md-9 bg-customer p-1">
|
||||
<input type="text" id="version" name="version" placeholder="6.x,7.x, ..."
|
||||
value="{{ $version->version ?? old('version') }}" class="form-control">
|
||||
</div>
|
||||
@@ -45,16 +48,16 @@
|
||||
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="version" class="col-md-3 text-right">Template</label>
|
||||
<div class="col-md-9 p-1 bg-customer">
|
||||
<div class="col-md-9 bg-customer p-1">
|
||||
<input type="text" id="template_id" name="template_id" placeholder="vm-2005"
|
||||
value="{{ $version->template_id ?? old('template_id') }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<div class="col-md-9 bg-customer p-1">
|
||||
<select class="custom-select select2" id="status" name="status">
|
||||
@foreach(Status::getOptions() as $value => $label)
|
||||
@foreach (Status::getOptions() as $value => $label)
|
||||
<option value="{{ $value }}" @selected($version->status == $value)>
|
||||
{{ $label }}
|
||||
</option>
|
||||
@@ -65,10 +68,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ route('package.version.index') }}" class="btn btn-outline-secondary">Trở về</a>
|
||||
<button type="submit" class="btn btn-outline-primary">Lưu dữ liệu</button>
|
||||
</div>
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="package.version.index">Trở lại</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Cập nhật</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
@@ -81,7 +85,7 @@
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
// Initialize Select2 using global function
|
||||
if (typeof window.initSelect2 === 'function') {
|
||||
window.initSelect2();
|
||||
@@ -100,4 +104,4 @@
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
<script src="{{ asset($datatable) }}"></script>
|
||||
@endforeach
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
@@ -81,8 +81,11 @@
|
||||
<div class="form-group mb-3">
|
||||
<label for="is_active">Status</label>
|
||||
<select name="is_active" id="is_active" class="form-control select2">
|
||||
<option value="1" {{ old('is_active', 1) == 1 ? 'selected' : '' }}>Active</option>
|
||||
<option value="0" {{ old('is_active') == 0 ? 'selected' : '' }}>Inactive</option>
|
||||
@foreach(\App\Enums\Status::cases() as $status)
|
||||
<option value="{{ $status->value }}" {{ old('is_active', \App\Enums\Status::ACTIVE->value) == $status->value ? 'selected' : '' }}>
|
||||
{{ $status->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@endpush
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
@php
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Product'],
|
||||
['label' => 'Product / Services', 'url' => route('products.index')],
|
||||
@@ -16,86 +16,94 @@
|
||||
@endphp
|
||||
<x-admin-breadcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
@section('tab')
|
||||
@php
|
||||
$tabs = [
|
||||
[
|
||||
'label' => 'Product',
|
||||
'route' => 'products.index',
|
||||
'icon' => 'server',
|
||||
],
|
||||
[
|
||||
'label' => 'Product Group',
|
||||
'route' => 'products.group.index',
|
||||
'icon' => 'server',
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
<x-admin-tab :items="$tabs" />
|
||||
@endsection
|
||||
@section('tab')
|
||||
@php
|
||||
$tabs = [
|
||||
[
|
||||
'label' => 'Product',
|
||||
'route' => 'products.index',
|
||||
'icon' => 'server',
|
||||
],
|
||||
[
|
||||
'label' => 'Product Group',
|
||||
'route' => 'products.group.index',
|
||||
'icon' => 'server',
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
<x-admin-tab :items="$tabs" />
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('products.group.update', ['id' => $category->id]) }}" method="post">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Basic Information</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group mb-3">
|
||||
<label for="name">Group Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name" value="{{ old('name', $category->name) }}"
|
||||
class="form-control" required placeholder="Enter category name">
|
||||
</div>
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('products.group.update', ['id' => $category->id]) }}" method="post">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<div class="form-group mb-3">
|
||||
<label for="name">Group Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name" value="{{ old('name', $category->name) }}" class="form-control" required placeholder="Enter category name">
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="slug">Slug</label>
|
||||
<input type="text" id="slug" name="slug" value="{{ old('slug', $category->slug) }}"
|
||||
class="form-control" placeholder="auto-generated-if-empty">
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="slug">Slug</label>
|
||||
<input type="text" id="slug" name="slug" value="{{ old('slug', $category->slug) }}" class="form-control" placeholder="auto-generated-if-empty">
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="parent_id">Parent Category</label>
|
||||
<select name="parent_id" id="parent_id" class="form-control select2">
|
||||
<option value="">-- Root --</option>
|
||||
@if(isset($categories))
|
||||
@foreach($categories as $cat)
|
||||
<option value="{{ $cat->id }}" {{ old('parent_id', $category->parent_id) == $cat->id ? 'selected' : '' }}>{{ $cat->name }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="parent_id">Parent Category</label>
|
||||
<select name="parent_id" id="parent_id" class="form-control select2">
|
||||
<option value="">-- Root --</option>
|
||||
@if(isset($categories))
|
||||
@foreach($categories as $cat)
|
||||
<option value="{{ $cat->id }}" {{ old('parent_id', $category->parent_id) == $cat->id ? 'selected' : '' }}>{{ $cat->name }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card card-secondary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Classification</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group mb-3">
|
||||
<label for="is_active">Status</label>
|
||||
<select name="is_active" id="is_active" class="form-control select2">
|
||||
@foreach(\App\Enums\Status::cases() as $status)
|
||||
<option value="{{ $status->value }}" {{ old('is_active', $category->is_active) == $status->value ? 'selected' : '' }}>
|
||||
{{ $status->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="sort_order">Sort Order</label>
|
||||
<input type="number" name="sort_order" id="sort_order" class="form-control" value="{{ old('sort_order', $category->sort_order) }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card card-secondary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Classification</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group mb-3">
|
||||
<label for="is_active">Status</label>
|
||||
<select name="is_active" id="is_active" class="form-control select2">
|
||||
<option value="1" {{ old('is_active', $category->is_active) == 1 ? 'selected' : '' }}>Active</option>
|
||||
<option value="0" {{ old('is_active', $category->is_active) == 0 ? 'selected' : '' }}>Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="sort_order">Sort Order</label>
|
||||
<input type="number" name="sort_order" id="sort_order" class="form-control" value="{{ old('sort_order', $category->sort_order) }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left" route="products.group.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="save">Update Category</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
@endsection
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left" route="products.group.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="save">Update Category</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@push('plugin-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
|
||||
@@ -33,246 +33,279 @@
|
||||
<x-admin-tab :items="$tabs" />
|
||||
@endsection
|
||||
@section('content')
|
||||
<form action="{{ route('products.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="row align-items-start">
|
||||
{{-- Left Column: Basic Info & Pricing --}}
|
||||
<div class="col-md-8">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Basic Information</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
{{-- Basic Information --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom pb-2 mb-3">Basic Information</h5>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="name">Product Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name"
|
||||
value="{{ old('name') }}" class="form-control" required placeholder="Enter product name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="slug">Slug</label>
|
||||
<input type="text" id="slug" name="slug"
|
||||
value="{{ old('slug') }}" class="form-control" placeholder="auto-generated-if-empty"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="short_description">Short Description</label>
|
||||
<textarea name="short_description" id="short_description" rows="2" class="form-control" placeholder="Brief summary">{{ old('short_description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="description">Full Description</label>
|
||||
<textarea name="description" id="description" rows="4" class="form-control" placeholder="Detailed description">{{ old('description') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Pricing & Billing --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom pb-2 mb-3">Pricing & Billing</h5>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="price">Regular Price</label>
|
||||
<div class="input-group">
|
||||
<input type="number" step="0.01" id="price" name="price"
|
||||
value="{{ old('price', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="price_sale">Sale Price</label>
|
||||
<div class="input-group">
|
||||
<input type="number" step="0.01" id="price_sale" name="price_sale"
|
||||
value="{{ old('price_sale') }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="setup_fee">Setup Fee</label>
|
||||
<div class="input-group">
|
||||
<input type="number" step="0.01" id="setup_fee" name="setup_fee"
|
||||
value="{{ old('setup_fee', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="currency">Currency</label>
|
||||
<select name="currency" id="currency" class="form-control select2">
|
||||
<option value="USD" {{ old('currency') == 'USD' ? 'selected' : '' }}>USD</option>
|
||||
<option value="VND" {{ old('currency') == 'VND' ? 'selected' : '' }}>VND</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="billing_cycle">Billing Cycle</label>
|
||||
<select name="billing_cycle" id="billing_cycle" class="form-control select2">
|
||||
<option value="monthly" {{ old('billing_cycle') == 'monthly' ? 'selected' : '' }}>Monthly</option>
|
||||
<option value="quarterly" {{ old('billing_cycle') == 'quarterly' ? 'selected' : '' }}>Quarterly</option>
|
||||
<option value="semi_annually" {{ old('billing_cycle') == 'semi_annually' ? 'selected' : '' }}>Semi-Annually</option>
|
||||
<option value="annually" {{ old('billing_cycle') == 'annually' ? 'selected' : '' }}>Annually</option>
|
||||
<option value="one_time" {{ old('billing_cycle') == 'one_time' ? 'selected' : '' }}>One Time</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="trial_days">Trial Days</label>
|
||||
<input type="number" id="trial_days" name="trial_days"
|
||||
value="{{ old('trial_days', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Hardware Specs (VPS/Dedicated) --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-info border-bottom pb-2 mb-3">Hardware Specifications</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="cpu">CPU</label>
|
||||
<input type="text" name="cpu" id="cpu" class="form-control"
|
||||
value="{{ old('cpu') }}" placeholder="e.g. 2 Core" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="ram">RAM</label>
|
||||
<input type="text" name="ram" id="ram" class="form-control"
|
||||
value="{{ old('ram') }}" placeholder="e.g. 4 GB" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="disk">Disk/Storage</label>
|
||||
<input type="text" name="disk" id="disk" class="form-control"
|
||||
value="{{ old('disk') }}" placeholder="e.g. 50 GB NVMe" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="bandwidth">Bandwidth</label>
|
||||
<input type="text" name="bandwidth" id="bandwidth" class="form-control"
|
||||
value="{{ old('bandwidth') }}" placeholder="e.g. Unlimited" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="gpu">GPU</label>
|
||||
<input type="text" name="gpu" id="gpu" class="form-control"
|
||||
value="{{ old('gpu') }}" placeholder="Optional">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('products.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="row align-items-start">
|
||||
{{-- Left Column: Basic Info & Pricing --}}
|
||||
<div class="col-md-8">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Basic Information</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
{{-- Right Column: Classification & Settings --}}
|
||||
<div class="col-md-4 sticky-top top-10 z-0">
|
||||
<div class="card card-secondary card-outline mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Classification</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{-- Product Category --}}
|
||||
<div class="form-group mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label for="product_categories_id">Category</label>
|
||||
<a href={{ route('products.group.index') }} class="text-primary text-decoration-underline">
|
||||
<i data-lucide="plus" class="w-12px h-12px"></i>
|
||||
Thêm Group
|
||||
</a>
|
||||
{{-- Basic Information --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom mb-3 pb-2">Basic Information</h5>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="name">Product Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name" value="{{ old('name') }}"
|
||||
class="form-control" required placeholder="Enter product name" />
|
||||
</div>
|
||||
<select class="form-control select2" name="product_categories_id" id="product_categories_id">
|
||||
@foreach($group as $item)
|
||||
<option value="{{ $item->id }}" {{ old('product_categories_id') == $item->id ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="short_description">Short Description</label>
|
||||
<textarea name="short_description" id="short_description" rows="2" class="form-control"
|
||||
placeholder="Brief summary">{{ old('short_description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="description">Full Description</label>
|
||||
<textarea name="description" id="description" rows="4" class="form-control" placeholder="Detailed description">{{ old('description') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Pricing & Billing --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom mb-3 pb-2">Pricing & Billing</h5>
|
||||
{{-- Global Settings --}}
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="currency">Currency</label>
|
||||
<select name="currency" id="currency" class="form-control select2">
|
||||
<option value="USD" {{ old('currency') == 'USD' ? 'selected' : '' }}>USD
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Product Type --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="product_type" class="mb-2">Product Type</label>
|
||||
<select class="form-control select2" name="product_type" id="product_type">
|
||||
@foreach($type as $item)
|
||||
<option value="{{ $item->name }}" {{ old('product_type') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
<option value="VND" {{ old('currency') == 'VND' ? 'selected' : '' }}>VND
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Status --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="status" class="mb-2">Status</label>
|
||||
<select class="form-control select2" name="status" id="status">
|
||||
<option value="{{ \App\Enums\Status::ACTIVE->value }}">Active</option>
|
||||
<option value="{{ \App\Enums\Status::DEACTIVE->value }}">Inactive</option>
|
||||
</select>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="setup_fee">Setup Fee</label>
|
||||
<input type="number" step="0.01" id="setup_fee" name="setup_fee"
|
||||
value="{{ old('setup_fee', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="trial_days">Trial Days</label>
|
||||
<input type="number" id="trial_days" name="trial_days"
|
||||
value="{{ old('trial_days', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Billing Cycles Table --}}
|
||||
<label class="fw-bold mb-2">Billing Cycles</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="width: 50px;">#</th>
|
||||
<th scope="col">Billing Cycle</th>
|
||||
<th scope="col">Price</th>
|
||||
<th scope="col">Sale Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (\App\Enums\Product\ProductBillingCycle::cases() as $cycle)
|
||||
<tr>
|
||||
<th scope="row" class="text-center align-middle">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch"
|
||||
id="cycle_{{ $cycle->value }}"
|
||||
name="pricing[{{ $cycle->value }}][enabled]" value="1">
|
||||
</div>
|
||||
</th>
|
||||
<td class="align-middle">
|
||||
{{ $cycle->label() }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="number" step="0.01" class="form-control"
|
||||
name="pricing[{{ $cycle->value }}][price]" placeholder="0.00">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="number" step="0.01" class="form-control"
|
||||
name="pricing[{{ $cycle->value }}][price_sale]"
|
||||
placeholder="0.00">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="sort_order" class="mb-2">Sort Order</label>
|
||||
<input type="number" name="sort_order" id="sort_order" class="form-control" value="{{ old('sort_order', 0) }}">
|
||||
{{-- Hardware Specs (VPS/Dedicated) --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-info border-bottom mb-3 pb-2">Hardware Specifications</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="cpu">CPU</label>
|
||||
<input type="text" name="cpu" id="cpu" class="form-control"
|
||||
value="{{ old('cpu') }}" placeholder="e.g. 2 Core" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="ram">RAM</label>
|
||||
<input type="text" name="ram" id="ram" class="form-control"
|
||||
value="{{ old('ram') }}" placeholder="e.g. 4 GB" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="disk">Disk/Storage</label>
|
||||
<input type="text" name="disk" id="disk" class="form-control"
|
||||
value="{{ old('disk') }}" placeholder="e.g. 50 GB NVMe" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="bandwidth">Bandwidth</label>
|
||||
<input type="text" name="bandwidth" id="bandwidth" class="form-control"
|
||||
value="{{ old('bandwidth') }}" placeholder="e.g. Unlimited" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="gpu">GPU</label>
|
||||
<input type="text" name="gpu" id="gpu" class="form-control"
|
||||
value="{{ old('gpu') }}" placeholder="Optional">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-secondary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Inventory & Limits</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="stock">Stock Quantity</label>
|
||||
<input type="number" name="stock" id="stock" class="form-control" placeholder="Unlimited if empty" value="{{ old('stock') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="is_unlimited" name="is_unlimited" value="1" {{ old('is_unlimited', true) ? 'checked' : '' }}>
|
||||
<label class="custom-control-label" for="is_unlimited">Unlimited Stock</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label for="published_at">Publish Date</label>
|
||||
<input type="date" name="published_at" id="published_at" class="form-control" value="{{ old('published_at') }}">
|
||||
</div>
|
||||
{{-- Right Column: Classification & Settings --}}
|
||||
<div class="col-md-4 sticky-top top-10 z-0">
|
||||
<div class="card card-secondary card-outline mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Classification</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{-- Product Category --}}
|
||||
<div class="form-group mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label for="product_categories_id">Group</label>
|
||||
<a href={{ route('products.group.index') }}
|
||||
class="text-primary text-decoration-underline">
|
||||
<i data-lucide="plus" class="w-12px h-12px"></i>
|
||||
Thêm Group
|
||||
</a>
|
||||
</div>
|
||||
<select class="form-control select2" name="product_categories_id" id="product_categories_id">
|
||||
<option value="">-- Select Group --</option>
|
||||
@foreach ($group as $item)
|
||||
<option value="{{ $item->id }}"
|
||||
{{ old('product_categories_id') == $item->id ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Operating System --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="os_ids" class="mb-2">Operating System</label>
|
||||
<select class="form-control select2" name="os_ids[]" id="os_ids" multiple data-placeholder="-- Select OS versions --">
|
||||
@foreach ($osVersions as $osVersion)
|
||||
<option value="{{ $osVersion->id }}" {{ in_array($osVersion->id, old('os_ids', [])) ? 'selected' : '' }}>
|
||||
{{ $osVersion->osGroup->name ?? 'Unknown' }} - {{ $osVersion->version }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="text-muted">Select multiple OS versions supported by this product</small>
|
||||
</div>
|
||||
|
||||
{{-- Product Type --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="product_type" class="mb-2">Product Type</label>
|
||||
<select class="form-control select2" name="product_type" id="product_type">
|
||||
<option value="">-- Select Type --</option>
|
||||
@foreach (\App\Enums\Product\ProductTypeEnums::cases() as $type)
|
||||
<option value="{{ $type->value }}"
|
||||
{{ old('product_type') == $type->value ? 'selected' : '' }}>
|
||||
{{ $type->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Status --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="is_active" class="mb-2">Status</label>
|
||||
<select class="form-control select2" name="is_active" id="is_active">
|
||||
@foreach (\App\Enums\Status::cases() as $status)
|
||||
<option value="{{ $status->value }}"
|
||||
{{ old('is_active', \App\Enums\Status::ACTIVE->value) == $status->value ? 'selected' : '' }}>
|
||||
{{ $status->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="sort_order" class="mb-2">Sort Order</label>
|
||||
<input type="number" name="sort_order" id="sort_order" class="form-control"
|
||||
value="{{ old('sort_order', 0) }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left" route="products.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Create Product</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
|
||||
<div class="card card-secondary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Inventory & Limits</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="stock">Stock Quantity</label>
|
||||
<input type="number" name="stock" id="stock" class="form-control"
|
||||
placeholder="Unlimited if empty" value="{{ old('stock') }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="is_unlimited"
|
||||
name="is_unlimited" value="1" {{ old('is_unlimited', true) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_unlimited">Unlimited Stock</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label for="published_at">Publish Date</label>
|
||||
<input type="date" name="published_at" id="published_at" class="form-control"
|
||||
value="{{ old('published_at') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="products.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Create
|
||||
Product</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
@endsection
|
||||
@push('plugin-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<x-button-crm type="button" variant="primary" size="sm" route="product.edit" :params="['product_id' => $row->id]" icon="pencil">Edit</x-button-crm>
|
||||
<x-button-crm type="button" variant="danger" size="sm" route="product.destroy" :params="['product_id' => $row->id]" icon="trash">Delete</x-button-crm>
|
||||
<x-button-crm type="button" variant="primary" size="sm" route="products.edit" :params="['id' => $row->id]" icon="pencil">Chỉnh sửa</x-button-crm>
|
||||
<x-button-crm type="button" variant="danger" size="sm" route="products.destroy" :params="['id' => $row->id]" icon="trash">Xóa</x-button-crm>
|
||||
@@ -0,0 +1,40 @@
|
||||
@php
|
||||
$hasSpecs = $row->cpu || $row->ram || $row->disk || $row->bandwidth || $row->gpu;
|
||||
@endphp
|
||||
|
||||
@if($hasSpecs)
|
||||
<div class="d-flex flex-column gap-1 small">
|
||||
@if($row->cpu)
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<i data-lucide="cpu" class="w-14px h-14px text-muted"></i>
|
||||
<span>{{ $row->cpu }} vCore</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($row->ram)
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<i data-lucide="memory-stick" class="w-14px h-14px text-muted"></i>
|
||||
<span>{{ $row->ram }} GB</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($row->disk)
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<i data-lucide="hard-drive" class="w-14px h-14px text-muted"></i>
|
||||
<span>{{ $row->disk }} GB</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($row->bandwidth)
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<i data-lucide="wifi" class="w-14px h-14px text-muted"></i>
|
||||
<span>{{ $row->bandwidth }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@if($row->gpu)
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<i data-lucide="monitor" class="w-14px h-14px text-muted"></i>
|
||||
<span>{{ $row->gpu }}</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<span class="text-muted">-</span>
|
||||
@endif
|
||||
@@ -0,0 +1,13 @@
|
||||
@php
|
||||
$status = App\Enums\Status::tryFrom($row->is_active);
|
||||
@endphp
|
||||
|
||||
@if($status)
|
||||
<x-admin-badge :variant="$status->value">
|
||||
{{ $status->label() }}
|
||||
</x-admin-badge>
|
||||
@else
|
||||
<x-admin-badge variant="secondary">
|
||||
Unknown
|
||||
</x-admin-badge>
|
||||
@endif
|
||||
@@ -10,243 +10,306 @@
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Product'],
|
||||
['label' => 'Product / Services', 'url' => route('products.index')],
|
||||
['label' => 'Add Product / Services', 'active' => true],
|
||||
['label' => 'Edit Product', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
<x-admin-breadcrumb :items="$breadcrumbItems" />
|
||||
@endsection
|
||||
@section('content')
|
||||
<form action="{{ route('products.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="row">
|
||||
{{-- Left Column: Basic Info & Pricing --}}
|
||||
<div class="col-md-8">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
|
||||
{{-- Basic Information --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom pb-2 mb-3">Basic Information</h5>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="name">Product Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name"
|
||||
value="{{ old('name') }}" class="form-control" required placeholder="Enter product name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="slug">Slug</label>
|
||||
<input type="text" id="slug" name="slug"
|
||||
value="{{ old('slug') }}" class="form-control" placeholder="auto-generated-if-empty"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="short_description">Short Description</label>
|
||||
<textarea name="short_description" id="short_description" rows="2" class="form-control" placeholder="Brief summary">{{ old('short_description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="description">Full Description</label>
|
||||
<textarea name="description" id="description" rows="4" class="form-control" placeholder="Detailed description">{{ old('description') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Pricing & Billing --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom pb-2 mb-3">Pricing & Billing</h5>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="price">Regular Price</label>
|
||||
<div class="input-group">
|
||||
<input type="number" step="0.01" id="price" name="price"
|
||||
value="{{ old('price', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="price_sale">Sale Price</label>
|
||||
<div class="input-group">
|
||||
<input type="number" step="0.01" id="price_sale" name="price_sale"
|
||||
value="{{ old('price_sale') }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="setup_fee">Setup Fee</label>
|
||||
<div class="input-group">
|
||||
<input type="number" step="0.01" id="setup_fee" name="setup_fee"
|
||||
value="{{ old('setup_fee', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="currency">Currency</label>
|
||||
<select name="currency" id="currency" class="form-control select2">
|
||||
<option value="USD" {{ old('currency') == 'USD' ? 'selected' : '' }}>USD</option>
|
||||
<option value="VND" {{ old('currency') == 'VND' ? 'selected' : '' }}>VND</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="billing_cycle">Billing Cycle</label>
|
||||
<select name="billing_cycle" id="billing_cycle" class="form-control select2">
|
||||
<option value="monthly" {{ old('billing_cycle') == 'monthly' ? 'selected' : '' }}>Monthly</option>
|
||||
<option value="quarterly" {{ old('billing_cycle') == 'quarterly' ? 'selected' : '' }}>Quarterly</option>
|
||||
<option value="semi_annually" {{ old('billing_cycle') == 'semi_annually' ? 'selected' : '' }}>Semi-Annually</option>
|
||||
<option value="annually" {{ old('billing_cycle') == 'annually' ? 'selected' : '' }}>Annually</option>
|
||||
<option value="one_time" {{ old('billing_cycle') == 'one_time' ? 'selected' : '' }}>One Time</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="trial_days">Trial Days</label>
|
||||
<input type="number" id="trial_days" name="trial_days"
|
||||
value="{{ old('trial_days', 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Hardware Specs (VPS/Dedicated) --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-info border-bottom pb-2 mb-3">Hardware Specifications</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="cpu">CPU</label>
|
||||
<input type="text" name="cpu" id="cpu" class="form-control"
|
||||
value="{{ old('cpu') }}" placeholder="e.g. 2 Core" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="ram">RAM</label>
|
||||
<input type="text" name="ram" id="ram" class="form-control"
|
||||
value="{{ old('ram') }}" placeholder="e.g. 4 GB" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="disk">Disk/Storage</label>
|
||||
<input type="text" name="disk" id="disk" class="form-control"
|
||||
value="{{ old('disk') }}" placeholder="e.g. 50 GB NVMe" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="bandwidth">Bandwidth</label>
|
||||
<input type="text" name="bandwidth" id="bandwidth" class="form-control"
|
||||
value="{{ old('bandwidth') }}" placeholder="e.g. Unlimited" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="gpu">GPU</label>
|
||||
<input type="text" name="gpu" id="gpu" class="form-control"
|
||||
value="{{ old('gpu') }}" placeholder="Optional">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('products.update', $product->id) }}" method="post">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="row align-items-start">
|
||||
{{-- Left Column: Basic Info & Pricing --}}
|
||||
<div class="col-md-8">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Edit Product</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
{{-- Right Column: Classification & Settings --}}
|
||||
<div class="col-md-4">
|
||||
<div class="card card-secondary card-outline mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Classification</h5>
|
||||
{{-- Basic Information --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom mb-3 pb-2">Basic Information</h5>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="name">Product Name <span class="text-danger">*</span></label>
|
||||
<input type="text" id="name" name="name"
|
||||
value="{{ old('name', $product->name) }}"
|
||||
class="form-control" required placeholder="Enter product name" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{-- Product Category --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="product_categories_id">Category</label>
|
||||
<select class="form-control select2" name="product_categories_id" id="product_categories_id">
|
||||
@foreach($group as $item)
|
||||
<option value="{{ $item->id }}" {{ old('product_categories_id') == $item->id ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Product Type --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="product_type">Product Type</label>
|
||||
<select class="form-control select2" name="product_type" id="product_type">
|
||||
@foreach($type as $item)
|
||||
<option value="{{ $item->name }}" {{ old('product_type') == $item->name ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="short_description">Short Description</label>
|
||||
<textarea name="short_description" id="short_description" rows="2" class="form-control"
|
||||
placeholder="Brief summary">{{ old('short_description', $product->short_description) }}</textarea>
|
||||
</div>
|
||||
|
||||
{{-- Status --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="status">Status</label>
|
||||
<select class="form-control select2" name="status" id="status">
|
||||
<option value="{{ \App\Enums\Status::ACTIVE->value }}">Active</option>
|
||||
<option value="{{ \App\Enums\Status::DEACTIVE->value }}">Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label for="description">Full Description</label>
|
||||
<textarea name="description" id="description" rows="4" class="form-control"
|
||||
placeholder="Detailed description">{{ old('description', $product->description) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="sort_order">Sort Order</label>
|
||||
<input type="number" name="sort_order" id="sort_order" class="form-control" value="{{ old('sort_order', 0) }}">
|
||||
{{-- Pricing & Billing --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-primary border-bottom mb-3 pb-2">Pricing & Billing</h5>
|
||||
{{-- Global Settings --}}
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="currency">Currency</label>
|
||||
<select name="currency" id="currency" class="form-control select2">
|
||||
<option value="USD"
|
||||
{{ old('currency', $product->currency ?? 'USD') == 'USD' ? 'selected' : '' }}>
|
||||
USD</option>
|
||||
<option value="VND"
|
||||
{{ old('currency', $product->currency ?? 'VND') == 'VND' ? 'selected' : '' }}>
|
||||
VND</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="setup_fee">Setup Fee</label>
|
||||
<input type="number" step="0.01" id="setup_fee" name="setup_fee"
|
||||
value="{{ old('setup_fee', $product->setup_fee ?? 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="trial_days">Trial Days</label>
|
||||
<input type="number" id="trial_days" name="trial_days"
|
||||
value="{{ old('trial_days', $product->trial_days ?? 0) }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Billing Cycles Table --}}
|
||||
<label class="fw-bold mb-2">Billing Cycles</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="width: 50px;">#</th>
|
||||
<th scope="col">Billing Cycle</th>
|
||||
<th scope="col">Price</th>
|
||||
<th scope="col">Sale Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (\App\Enums\Product\ProductBillingCycle::cases() as $cycle)
|
||||
@php
|
||||
$pricing = $product->pricings
|
||||
->where('billing_cycle', $cycle->value)
|
||||
->first();
|
||||
@endphp
|
||||
<tr>
|
||||
<th scope="row" class="text-center align-middle">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
id="cycle_{{ $cycle->value }}"
|
||||
name="pricing[{{ $cycle->value }}][enabled]" value="1"
|
||||
{{ old("pricing.{$cycle->value}.enabled", $pricing ? 1 : 0) ? 'checked' : '' }}>
|
||||
<label class="form-check-label"
|
||||
for="cycle_{{ $cycle->value }}"></label>
|
||||
</div>
|
||||
</th>
|
||||
<td class="align-middle">
|
||||
{{ $cycle->label() }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="number" step="0.01" class="form-control"
|
||||
name="pricing[{{ $cycle->value }}][price]" placeholder="0.00"
|
||||
value="{{ old("pricing.{$cycle->value}.price", $pricing->price ?? '') }}">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="number" step="0.01" class="form-control"
|
||||
name="pricing[{{ $cycle->value }}][price_sale]"
|
||||
placeholder="0.00"
|
||||
value="{{ old("pricing.{$cycle->value}.price_sale", $pricing->price_sale ?? '') }}">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{{-- Hardware Specs (VPS/Dedicated) --}}
|
||||
<div class="mb-4">
|
||||
<h5 class="text-info border-bottom mb-3 pb-2">Hardware Specifications</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="cpu">CPU</label>
|
||||
<input type="text" name="cpu" id="cpu" class="form-control"
|
||||
value="{{ old('cpu', $product->cpu) }}" placeholder="e.g. 2 Core" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="ram">RAM</label>
|
||||
<input type="text" name="ram" id="ram" class="form-control"
|
||||
value="{{ old('ram', $product->ram) }}" placeholder="e.g. 4 GB" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="disk">Disk/Storage</label>
|
||||
<input type="text" name="disk" id="disk" class="form-control"
|
||||
value="{{ old('disk', $product->disk) }}" placeholder="e.g. 50 GB NVMe" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="bandwidth">Bandwidth</label>
|
||||
<input type="text" name="bandwidth" id="bandwidth" class="form-control"
|
||||
value="{{ old('bandwidth', $product->bandwidth) }}" placeholder="e.g. Unlimited" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="gpu">GPU</label>
|
||||
<input type="text" name="gpu" id="gpu" class="form-control"
|
||||
value="{{ old('gpu', $product->gpu) }}" placeholder="Optional">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-secondary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Inventory & Limits</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="stock">Stock Quantity</label>
|
||||
<input type="number" name="stock" id="stock" class="form-control" placeholder="Unlimited if empty" value="{{ old('stock') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="is_unlimited" name="is_unlimited" value="1" {{ old('is_unlimited', true) ? 'checked' : '' }}>
|
||||
<label class="custom-control-label" for="is_unlimited">Unlimited Stock</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label for="published_at">Publish Date</label>
|
||||
<input type="date" name="published_at" id="published_at" class="form-control" value="{{ old('published_at') }}">
|
||||
</div>
|
||||
{{-- Right Column: Classification & Settings --}}
|
||||
<div class="col-md-4 sticky-top top-10 z-0">
|
||||
<div class="card card-secondary card-outline mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Classification</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{-- Product Category --}}
|
||||
<div class="form-group mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label for="product_categories_id">Group</label>
|
||||
<a href="{{ route('products.group.index') }}"
|
||||
class="text-primary text-decoration-underline">
|
||||
<i data-lucide="plus" class="w-12px h-12px"></i>
|
||||
Thêm Group
|
||||
</a>
|
||||
</div>
|
||||
<select class="form-control select2" name="product_categories_id" id="product_categories_id">
|
||||
<option value="">-- Select Group --</option>
|
||||
@foreach ($group as $item)
|
||||
<option value="{{ $item->id }}"
|
||||
{{ old('product_categories_id', $product->product_categories_id) == $item->id ? 'selected' : '' }}>
|
||||
{{ $item->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Operating System --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="os_ids" class="mb-2">Operating System</label>
|
||||
@php
|
||||
$selectedOsIds = old('os_ids', $product->osVersions->pluck('id')->toArray());
|
||||
@endphp
|
||||
<select class="form-control select2" name="os_ids[]" id="os_ids" multiple
|
||||
data-placeholder="-- Select OS versions --">
|
||||
@foreach ($osVersions as $osVersion)
|
||||
<option value="{{ $osVersion->id }}"
|
||||
{{ in_array($osVersion->id, $selectedOsIds) ? 'selected' : '' }}>
|
||||
{{ $osVersion->osGroup->name ?? 'Unknown' }} - {{ $osVersion->version }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="text-muted">Select multiple OS versions supported by this product</small>
|
||||
</div>
|
||||
|
||||
{{-- Product Type --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="product_type" class="mb-2">Product Type</label>
|
||||
<select class="form-control select2" name="product_type" id="product_type">
|
||||
<option value="">-- Select Type --</option>
|
||||
@foreach (\App\Enums\Product\ProductTypeEnums::cases() as $type)
|
||||
<option value="{{ $type->value }}"
|
||||
{{ old('product_type', $product->product_type) == $type->value ? 'selected' : '' }}>
|
||||
{{ $type->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Status --}}
|
||||
<div class="form-group mb-3">
|
||||
<label for="is_active" class="mb-2">Status</label>
|
||||
<select class="form-control select2" name="is_active" id="is_active">
|
||||
@foreach (\App\Enums\Status::cases() as $status)
|
||||
<option value="{{ $status->value }}"
|
||||
{{ old('is_active', $product->is_active ? 1 : 0) == $status->value ? 'selected' : '' }}>
|
||||
{{ $status->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="sort_order" class="mb-2">Sort Order</label>
|
||||
<input type="number" name="sort_order" id="sort_order" class="form-control"
|
||||
value="{{ old('sort_order', $product->sort_order ?? 0) }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left" route="products.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="plus-circle">Create Product</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
|
||||
<div class="card card-secondary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title m-0">Inventory & Limits</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="stock">Stock Quantity</label>
|
||||
<input type="number" name="stock" id="stock" class="form-control"
|
||||
placeholder="Unlimited if empty" value="{{ old('stock', $product->stock) }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="is_unlimited"
|
||||
name="is_unlimited" value="1"
|
||||
{{ old('is_unlimited', $product->is_unlimited) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_unlimited">Unlimited Stock</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label for="published_at">Publish Date</label>
|
||||
<input type="date" name="published_at" id="published_at" class="form-control"
|
||||
value="{{ old('published_at', $product->published_at?->format('Y-m-d')) }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-fixed-action-bar>
|
||||
<x-button-crm type="button" variant="secondary" size="sm" icon="arrow-left"
|
||||
route="products.index">Cancel</x-button-crm>
|
||||
<x-button-crm type="submit" variant="primary" size="sm" icon="save">Update
|
||||
Product</x-button-crm>
|
||||
</x-fixed-action-bar>
|
||||
</form>
|
||||
@endsection
|
||||
@push('plugin-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
$breadcrumbItems = [
|
||||
['label' => 'Product'],
|
||||
['label' => 'Product / Services'],
|
||||
['label' => 'Product List', 'active' => true]
|
||||
['label' => 'Product List', 'active' => true],
|
||||
];
|
||||
@endphp
|
||||
<x-admin-breadcrumb :items="$breadcrumbItems" />
|
||||
@@ -37,26 +37,28 @@
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header d-flex justify-content-end gap-2">
|
||||
@include('administrator.pages.block.product.btn')
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<x-datatable id="productTable" ajax="{{ route('products.datatable') }}" :columns="[
|
||||
['key' => 'name', 'label' => 'IP Host'],
|
||||
['key' => 'counter', 'label' => 'Domain Created'],
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<x-datatable id="productTable" ajax="{{ route('products.datatable') }}" :columns="[
|
||||
['key' => 'name', 'label' => 'Product Name'],
|
||||
['key' => 'category_name', 'label' => 'Category'],
|
||||
['key' => 'product_type_label', 'label' => 'Type'],
|
||||
['key' => 'specs', 'label' => 'Specifications'],
|
||||
['key' => 'status', 'label' => 'Status'],
|
||||
['key' => 'action', 'label' => 'Action'],
|
||||
]" />
|
||||
</div>
|
||||
|
||||
</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 Product
|
||||
management department</h5>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</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 Product
|
||||
management department</h5>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@push('plugin-scripts')
|
||||
@foreach (config('assets.datatable.js') as $datatable)
|
||||
<script src="{{ asset($datatable) }}"></script>
|
||||
@endforeach
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
$tag = 'a';
|
||||
}
|
||||
|
||||
$baseClasses = 'd-inline-flex gap-2 align-items-center justify-content-center text-white px-3 py-2 rounded-3 transition-all';
|
||||
$baseClasses = 'd-inline-flex gap-2 align-items-center justify-content-center text-white px-3 py-2 rounded-3 transition-all border-0';
|
||||
|
||||
$variants = [
|
||||
'primary' => 'bg-primary',
|
||||
@@ -35,17 +35,6 @@
|
||||
'info' => 'bg-info'
|
||||
];
|
||||
|
||||
// Darker border colors for the "3D" effect
|
||||
$borderColors = [
|
||||
'primary' => '#D9561C',
|
||||
'secondary' => '#565e64',
|
||||
'success' => '#146c43',
|
||||
'danger' => '#b02a37',
|
||||
'warning' => '#997404',
|
||||
'info' => '#004C73',
|
||||
'destructive' => '#b02a37',
|
||||
];
|
||||
|
||||
$sizes = [
|
||||
'default' => 'h-10',
|
||||
'sm' => 'h-6',
|
||||
@@ -55,30 +44,22 @@
|
||||
|
||||
$variantClass = $variants[$variant ?? 'primary'] ?? $variants['primary'];
|
||||
$sizeClass = $sizes[$size ?? 'md'] ?? $sizes['default'];
|
||||
$borderColor = $borderColors[$variant ?? 'primary'] ?? 'transparent';
|
||||
|
||||
// Check if variant is outline/ghost/link to avoid weird borders
|
||||
if (in_array($variant, ['outline', 'ghost', 'link'])) {
|
||||
$borderStyle = '';
|
||||
} else {
|
||||
$borderStyle = "border-bottom: 3px solid {$borderColor};";
|
||||
}
|
||||
|
||||
$classes = "{$baseClasses} {$variantClass} {$sizeClass}";
|
||||
@endphp
|
||||
|
||||
@if($tag === 'a')
|
||||
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes, 'style' => $borderStyle]) }}>
|
||||
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="mr-2" style="height: 15px; width: 15px"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</a>
|
||||
@else
|
||||
<button type="{{ $buttonType }}" {{ $attributes->merge(['class' => $classes, 'style' => $borderStyle]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="mr-2" style="height: 15px; width: 15px"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
<button type="{{ $buttonType }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="mr-2" style="height: 15px; width: 15px"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@endif
|
||||
@@ -0,0 +1,203 @@
|
||||
@props([
|
||||
'name' => 'thumbnail',
|
||||
'label' => 'Thumbnail',
|
||||
'value' => null,
|
||||
'placeholder' => 'Chọn File',
|
||||
'required' => false,
|
||||
'horizontal' => true,
|
||||
'labelClass' => 'col-md-3 text-right',
|
||||
'inputClass' => 'col-md-9',
|
||||
])
|
||||
|
||||
@php
|
||||
$uniqueId = 'image-picker-' . uniqid();
|
||||
$currentValue = old($name) ?? $value;
|
||||
@endphp
|
||||
|
||||
@if ($horizontal)
|
||||
<div class="row form-group align-items-center mb-0">
|
||||
<label for="{{ $name }}" class="{{ $labelClass }}">
|
||||
{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-danger">*</span>
|
||||
@endif
|
||||
</label>
|
||||
<div class="{{ $inputClass }} p-1">
|
||||
@else
|
||||
<div class="form-group mb-3">
|
||||
<label for="{{ $name }}" class="mb-2">
|
||||
{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-danger">*</span>
|
||||
@endif
|
||||
</label>
|
||||
<div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-md-8 bg-customer">
|
||||
<input type="text" id="{{ $uniqueId }}-input" name="{{ $name }}" value="{{ $currentValue }}"
|
||||
class="form-control image-picker-input" placeholder="{{ $placeholder }}"
|
||||
data-picker-id="{{ $uniqueId }}" @if ($required) required @endif>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-outline-secondary btn-open-image-picker"
|
||||
data-picker-id="{{ $uniqueId }}">
|
||||
<i data-lucide="folder-open" class="w-14px h-14px me-1"></i> Chọn hình ảnh
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Image Preview --}}
|
||||
<div class="mt-2" id="{{ $uniqueId }}-preview-wrapper" style="display: {{ $currentValue ? 'block' : 'none' }};">
|
||||
<div class="position-relative d-inline-block">
|
||||
<div id="{{ $uniqueId }}-preview-container"
|
||||
class="img-thumbnail bg-light d-flex align-items-center justify-content-center"
|
||||
style="max-width: 200px; max-height: 150px; min-width: 100px; min-height: 80px; cursor: pointer; overflow: hidden;"
|
||||
data-bs-toggle="modal" data-bs-target="#{{ $uniqueId }}-modal">
|
||||
@if ($currentValue)
|
||||
@if (str_ends_with(strtolower($currentValue), '.svg'))
|
||||
<object data="{{ $currentValue }}" type="image/svg+xml"
|
||||
style="max-width: 100%; max-height: 150px; width: auto; height: auto;">
|
||||
<img src="{{ $currentValue }}" alt="Preview" style="max-width: 100%; max-height: 150px;">
|
||||
</object>
|
||||
@else
|
||||
<img src="{{ $currentValue }}" alt="Preview"
|
||||
style="max-width: 100%; max-height: 150px; object-fit: contain;">
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-danger position-absolute btn-remove-image end-0 top-0"
|
||||
data-picker-id="{{ $uniqueId }}" style="transform: translate(50%, -50%);">
|
||||
<i data-lucide="x" class="w-12px h-12px"></i>
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted d-block mt-1">Click vào ảnh để xem phóng to</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Image Preview Modal --}}
|
||||
<div class="modal fade" id="{{ $uniqueId }}-modal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i data-lucide="image" class="w-18px h-18px me-2"></i>
|
||||
Preview Image
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body bg-light p-3 text-center">
|
||||
<div id="{{ $uniqueId }}-modal-container" class="d-flex align-items-center justify-content-center"
|
||||
style="min-height: 300px;">
|
||||
@if ($currentValue)
|
||||
@if (str_ends_with(strtolower($currentValue), '.svg'))
|
||||
<object data="{{ $currentValue }}" type="image/svg+xml"
|
||||
style="max-width: 100%; max-height: 70vh; width: auto; height: auto;">
|
||||
<img src="{{ $currentValue }}" alt="Full Preview"
|
||||
style="max-width: 100%; max-height: 70vh;">
|
||||
</object>
|
||||
@else
|
||||
<img src="{{ $currentValue }}" alt="Full Preview" class="img-fluid"
|
||||
style="max-height: 70vh;">
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@pushOnce('custom-scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Prevent multiple initializations
|
||||
if (window.imagePickerInitialized) return;
|
||||
window.imagePickerInitialized = true;
|
||||
|
||||
// Function to check if file is SVG
|
||||
function isSvg(url) {
|
||||
return url && url.toLowerCase().endsWith('.svg');
|
||||
}
|
||||
|
||||
// Function to update preview
|
||||
function updateImagePreview(pickerId, url) {
|
||||
const $wrapper = $(`#${pickerId}-preview-wrapper`);
|
||||
const $container = $(`#${pickerId}-preview-container`);
|
||||
const $modalContainer = $(`#${pickerId}-modal-container`);
|
||||
|
||||
if (url && url.trim() !== '') {
|
||||
if (isSvg(url)) {
|
||||
$container.html(`
|
||||
<object data="${url}" type="image/svg+xml"
|
||||
style="max-width: 100%; max-height: 150px; width: auto; height: auto;">
|
||||
<img src="${url}" alt="Preview" style="max-width: 100%; max-height: 150px;">
|
||||
</object>
|
||||
`);
|
||||
$modalContainer.html(`
|
||||
<object data="${url}" type="image/svg+xml"
|
||||
style="max-width: 100%; max-height: 70vh; width: auto; height: auto;">
|
||||
<img src="${url}" alt="Full Preview" style="max-width: 100%; max-height: 70vh;">
|
||||
</object>
|
||||
`);
|
||||
} else {
|
||||
$container.html(`
|
||||
<img src="${url}" alt="Preview" style="max-width: 100%; max-height: 150px; object-fit: contain;">
|
||||
`);
|
||||
$modalContainer.html(`
|
||||
<img src="${url}" alt="Full Preview" class="img-fluid" style="max-height: 70vh;">
|
||||
`);
|
||||
}
|
||||
$wrapper.slideDown(200);
|
||||
|
||||
// Reinitialize Lucide icons
|
||||
if (typeof lucide !== 'undefined') {
|
||||
lucide.createIcons();
|
||||
}
|
||||
} else {
|
||||
$wrapper.slideUp(200);
|
||||
}
|
||||
}
|
||||
|
||||
// Listen for input changes
|
||||
$(document).on('input change', '.image-picker-input', function() {
|
||||
const pickerId = $(this).data('picker-id');
|
||||
updateImagePreview(pickerId, $(this).val());
|
||||
});
|
||||
|
||||
// Remove image button
|
||||
$(document).on('click', '.btn-remove-image', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const pickerId = $(this).data('picker-id');
|
||||
const $input = $(`#${pickerId}-input`);
|
||||
$input.val('');
|
||||
$(`#${pickerId}-preview-wrapper`).slideUp(200);
|
||||
});
|
||||
|
||||
// Open CKFinder popup
|
||||
$(document).on('click', '.btn-open-image-picker', function() {
|
||||
const pickerId = $(this).data('picker-id');
|
||||
const $input = $(`#${pickerId}-input`);
|
||||
|
||||
if (typeof CKFinder !== 'undefined') {
|
||||
CKFinder.popup({
|
||||
connectorPath: '{{ route('ckfinder_connector') }}',
|
||||
chooseFiles: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
onInit: function(finder) {
|
||||
finder.on('files:choose', function(evt) {
|
||||
const fileUrl = evt.data.files.first().getUrl();
|
||||
$input.val(fileUrl).trigger('input');
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('CKFinder is not loaded');
|
||||
alert('CKFinder chưa được tải. Vui lòng thử lại.');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endPushOnce
|
||||
Reference in New Issue
Block a user