diff --git a/app/Enums/Product/ProductBillingCycle.php b/app/Enums/Product/ProductBillingCycle.php new file mode 100644 index 0000000..02c6be9 --- /dev/null +++ b/app/Enums/Product/ProductBillingCycle.php @@ -0,0 +1,40 @@ + 'One Time', + self::MONTHLY => 'Monthly', + self::QUARTERLY => 'Quarterly', + self::SEMI_ANNUALLY => 'Semi Annually', + self::ANNUALLY => 'Annually', + self::BIENNIALLY => 'Biennially', + self::TRIENNIALLY => 'Triennially', + }; + } + + public function months(): int + { + return match ($this) { + self::ONE_TIME => 0, + self::MONTHLY => 1, + self::QUARTERLY => 3, + self::SEMI_ANNUALLY => 6, + self::ANNUALLY => 12, + self::BIENNIALLY => 24, + self::TRIENNIALLY => 36, + }; + } +} diff --git a/app/Http/Controllers/admin/package/IPMapping.php b/app/Http/Controllers/admin/package/IPMapping.php index f397d25..2524f3f 100644 --- a/app/Http/Controllers/admin/package/IPMapping.php +++ b/app/Http/Controllers/admin/package/IPMapping.php @@ -166,11 +166,12 @@ class IPMapping extends Controller ); return DataTables::eloquent($query) - ->addColumn( - 'action', - fn($d) => - 'Edit' - ) + ->addColumn('action', function ($d) { + return view('administrator.pages.package.ipaddress.datatable.action', [ + 'id' => $d->id, + 'ip' => $d->ip + ])->render(); + }) ->filterColumn('host.datacenter.v_center.host', function ($query, $keyword) { $query->whereHas('host.datacenter.vCenter', function ($q) use ($keyword) { $q->where('host', 'like', "%{$keyword}%"); diff --git a/database/migrations/2024_02_01_094827_module_ipadress.php b/database/migrations/2024_02_01_094827_module_ipadress.php index 3298994..a968b90 100644 --- a/database/migrations/2024_02_01_094827_module_ipadress.php +++ b/database/migrations/2024_02_01_094827_module_ipadress.php @@ -16,8 +16,7 @@ return new class extends Migration Schema::create('module_ip_address',function (Blueprint $table) { $table->id()->autoIncrement(); $table->string('vm_name',255)->nullable(); - $table->bigInteger('module_host_id')->default(0)->index(); - $table->bigInteger('module_network_id')->default(0)->index(); + $table->foreignId('module_network_id')->nullable()->constrained('module_network')->onDelete('set null')->index(); $table->string('ip',100)->nullable(); $table->string('gateway',100)->nullable(); $table->string('netmask',100)->nullable(); diff --git a/database/migrations/2026_01_27_151851_update_forigin_key_module_ip_table.php b/database/migrations/2026_01_27_151851_update_forigin_key_module_ip_table.php index 101f3b7..db716cd 100644 --- a/database/migrations/2026_01_27_151851_update_forigin_key_module_ip_table.php +++ b/database/migrations/2026_01_27_151851_update_forigin_key_module_ip_table.php @@ -12,10 +12,7 @@ return new class extends Migration public function up(): void { Schema::table('module_ip_address', function (Blueprint $table) { - $table->unsignedBigInteger('module_host_id')->nullable()->default(null)->change(); $table->unsignedBigInteger('module_network_id')->nullable()->default(null)->change(); - - $table->foreign('module_host_id')->references('id')->on('module_host')->onDelete('set null'); $table->foreign('module_network_id')->references('id')->on('module_network')->onDelete('set null'); }); } @@ -26,10 +23,7 @@ return new class extends Migration public function down(): void { Schema::table('module_ip_address', function (Blueprint $table) { - $table->dropForeign(['module_host_id']); $table->dropForeign(['module_network_id']); - - $table->bigInteger('module_host_id')->default(0)->nullable(false)->change(); $table->bigInteger('module_network_id')->default(0)->nullable(false)->change(); }); } diff --git a/database/migrations/2026_02_03_114500_create_os_product_table.php b/database/migrations/2026_02_03_114500_create_os_product_table.php new file mode 100644 index 0000000..15a8bc3 --- /dev/null +++ b/database/migrations/2026_02_03_114500_create_os_product_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('product_id')->constrained('products')->onDelete('cascade'); + $table->foreignId('os_id')->constrained('os')->onDelete('cascade'); + $table->timestamps(); + + $table->unique(['product_id', 'os_id']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('os_product'); + } +}; diff --git a/resources/sass/_variables.scss b/resources/sass/_variables.scss index ec712ff..f61661f 100644 --- a/resources/sass/_variables.scss +++ b/resources/sass/_variables.scss @@ -35,10 +35,10 @@ $cyan: #0dcaf0 !default; // $primary: #F16723 !default; $secondary: $gray-600 !default; -$success: #05a34a !default; +$success: #10B981 !default; $info: #66d1d1 !default; -$warning: #fbbc06 !default; -$danger: #ff3366 !default; +$warning: #F59E0B !default; +$danger: #dc3545 !default; $light: $gray-200 !default; $dark: $gray-900 !default; // diff --git a/resources/views/administrator/pages/package/ipaddress/add.blade.php b/resources/views/administrator/pages/package/ipaddress/add.blade.php index 0b59d53..cef4e02 100644 --- a/resources/views/administrator/pages/package/ipaddress/add.blade.php +++ b/resources/views/administrator/pages/package/ipaddress/add.blade.php @@ -1,94 +1,94 @@ -@extends("administrator.layout.master") +@extends('administrator.layout.master') +@push('plugin-styles') + @foreach (config('assets.datatable.css') as $datatable) + + @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 + +@endsection @section("content") -@if(auth()->guard('admins')->user()->can("manager package module")) -
-
- @csrf -
-
-
+ @if(auth()->guard('admins')->user()->can("manager package module")) +
+ + @csrf +
+
+
- + - + - + - + - {{--Netmask--}} -
- -
- -
-
- {{--Netmask--}} -
- -
- -
-
- {{--DNS--}} -
- -
- -
-
- {{--Tuy chon--}} -
- -
- -
-
-
- -
- {{--From IP--}} -
- -
- -
-
- {{--From IP--}} -
- -
- -
+ {{--Netmask--}} +
+ +
+
-
-
- -
- + {{--Netmask--}} +
+ +
+ +
+
+ {{--DNS--}} +
+ +
+ +
+
+ {{--Tuy chon--}} +
+ +
+ +
+
+
+ +
+ +
-
- - -
-@else -
-
Access Denied - You are not assigned to any Module Package - management department
-
-@endif + + +
+ @else +
+
Access Denied - You are not assigned to any Module Package + management department
+
+ @endif @endsection + @push('plugin-scripts') + @foreach (config('assets.datatable.js') as $datatable) + + @endforeach + @endpush \ No newline at end of file diff --git a/resources/views/administrator/pages/package/ipaddress/datatable/action.blade.php b/resources/views/administrator/pages/package/ipaddress/datatable/action.blade.php new file mode 100644 index 0000000..ecb8ad8 --- /dev/null +++ b/resources/views/administrator/pages/package/ipaddress/datatable/action.blade.php @@ -0,0 +1,6 @@ +
+ Edit + Delete +
diff --git a/resources/views/administrator/pages/package/ipaddress/datatable/modal.blade.php b/resources/views/administrator/pages/package/ipaddress/datatable/modal.blade.php new file mode 100644 index 0000000..d1946a6 --- /dev/null +++ b/resources/views/administrator/pages/package/ipaddress/datatable/modal.blade.php @@ -0,0 +1,63 @@ + + + +@push('custom-scripts') + +@endpush \ No newline at end of file diff --git a/resources/views/administrator/pages/package/ipaddress/edit.blade.php b/resources/views/administrator/pages/package/ipaddress/edit.blade.php index deb4da0..da8667b 100644 --- a/resources/views/administrator/pages/package/ipaddress/edit.blade.php +++ b/resources/views/administrator/pages/package/ipaddress/edit.blade.php @@ -1,85 +1,106 @@ -@extends("administrator.layout.master") +@extends('administrator.layout.master') +@push('plugin-styles') + @foreach (config('assets.datatable.css') as $datatable) + + @endforeach +@endpush +@section('breadcrumb') + @php + $breadcrumbItems = [ + ['label' => 'Modules'], + ['label' => 'Package vCenter'], + ['label' => 'Host', 'url' => route('package.host.index')], + ['label' => 'Edit Host', 'active' => true], + ]; + @endphp + +@endsection @section("content") -@if(auth()->guard('admins')->user()->can("manager package module")) -
-
- @csrf - @method('put') -
-
-
+ @if(auth()->guard('admins')->user()->can("manager package module")) +
+ + @csrf + @method('put') +
+
+
- + - + - + - + - {{--Netmask--}} -
- -
- + {{--Netmask--}} +
+ +
+ +
-
- {{--Netmask--}} -
- -
- + {{--Netmask--}} +
+ +
+ +
-
- {{--DNS--}} -
- -
- + {{--DNS--}} +
+ +
+ +
-
- {{--Tuy chon--}} -
- -
- + {{--Tuy chon--}} +
+ +
+ +
-
- {{-- IP --}} -
- -
- + {{-- IP --}} +
+ +
+ +
-
- {{--Status--}} -
- -
- + {{--Status--}} +
+ +
+ +
-
- - -
-@else -
-
Access Denied - You are not assigned to any Module Package - management department
-
-@endif + + +
+ @else +
+
Access Denied - You are not assigned to any Module Package + management department
+
+ @endif @endsection +@push('plugin-scripts') + @foreach (config('assets.datatable.js') as $datatable) + + @endforeach +@endpush \ No newline at end of file diff --git a/resources/views/components/button-c-r-m.blade.php b/resources/views/components/button-c-r-m.blade.php index 2c12882..0952723 100644 --- a/resources/views/components/button-c-r-m.blade.php +++ b/resources/views/components/button-c-r-m.blade.php @@ -1,41 +1,43 @@ @php -$tag = 'button'; -$href = null; + $tag = 'button'; + $href = null; -if ($route) { - $href = route($route, $params); - $tag = 'a'; -} elseif ($url) { - $href = $url; - $tag = 'a'; -} elseif ($attributes->has('href')) { - $href = $attributes->get('href'); - $tag = 'a'; -} + if ($route) { + $href = route($route, $params); + $tag = 'a'; + } elseif ($url) { + $href = $url; + $tag = 'a'; + } elseif ($attributes->has('href')) { + $href = $attributes->get('href'); + $tag = 'a'; + } -$baseClasses = 'd-inline-flex gap-2 align-items-center justify-content-center text-white border-0 shadow-md px-2 py-1 rounded-2'; + $baseClasses = 'd-inline-flex gap-2 align-items-center justify-content-center text-white border-0 shadow-md px-2 py-1 rounded-2'; -$variants = [ - 'primary' => 'bg-primary', - 'secondary' => 'bg-secondary', - 'outline' => 'bg-outline', - 'ghost' => 'bg-ghost', - 'link' => 'bg-link', - 'danger' => 'bg-danger', - 'destructive' => 'bg-destructive', -]; + $variants = [ + 'primary' => 'bg-primary', + 'secondary' => 'bg-secondary', + 'outline' => 'bg-outline', + 'ghost' => 'bg-ghost', + 'link' => 'bg-link', + 'danger' => 'bg-danger', + 'destructive' => 'bg-destructive', + 'success' => 'bg-success', + 'warning' => 'bg-warning', + ]; -$sizes = [ - 'default' => 'h-10', - 'sm' => 'h-6', - 'lg' => 'h-12', - 'icon' => 'h-10', -]; + $sizes = [ + 'default' => 'h-10', + 'sm' => 'h-6', + 'lg' => 'h-12', + 'icon' => 'h-10', + ]; -$variantClass = $variants[$variant] ?? $variants['primary']; -$sizeClass = $sizes[$size] ?? $sizes['default']; + $variantClass = $variants[$variant] ?? $variants['primary']; + $sizeClass = $sizes[$size] ?? $sizes['default']; -$classes = "{$baseClasses} {$variantClass} {$sizeClass}"; + $classes = "{$baseClasses} {$variantClass} {$sizeClass}"; @endphp @if($tag === 'a') diff --git a/resources/views/components/module/network.blade.php b/resources/views/components/module/network.blade.php index c3b630e..336fcc2 100644 --- a/resources/views/components/module/network.blade.php +++ b/resources/views/components/module/network.blade.php @@ -1,19 +1,102 @@
- @if($networks) @foreach($networks->all() as $item) - + @endforeach @endif -
-
\ No newline at end of file +
+@push('custom-scripts') + +@endpush \ No newline at end of file