+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ @include('administrator.pages.product.categories.partials.category-tree', [
+ 'categories' => $categories,
+ 'selected' => old('parent_id', $category->parent_id),
+ 'name' => 'parent_id',
+ 'exclude' => $category->id,
+ ])
+ @error('parent_id')
+
{{ $message }}
+ @enderror
+
-
- Cancel
- Update Category
-
-
- @endsection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Cancel
+ Update
+ Category
+
+
+@endsection
@push('plugin-scripts')
@foreach (config('assets.datatable.js') as $datatable)
@endforeach
-
+@endpush
+
+@push('custom-scripts')
+ @include('administrator.pages.product.categories.partials.category-tree-scripts')
@endpush
diff --git a/resources/views/administrator/pages/product/categories/partials/category-option.blade.php b/resources/views/administrator/pages/product/categories/partials/category-option.blade.php
new file mode 100644
index 0000000..1fcce81
--- /dev/null
+++ b/resources/views/administrator/pages/product/categories/partials/category-option.blade.php
@@ -0,0 +1,12 @@
+
+@if($category->children->isNotEmpty())
+ @foreach($category->children as $child)
+ @include('administrator.pages.product.categories.partials.category-option', [
+ 'category' => $child,
+ 'depth' => $depth + 1,
+ 'selected' => $selected,
+ ])
+ @endforeach
+@endif
diff --git a/resources/views/administrator/pages/product/categories/partials/category-tree-item.blade.php b/resources/views/administrator/pages/product/categories/partials/category-tree-item.blade.php
new file mode 100644
index 0000000..1141548
--- /dev/null
+++ b/resources/views/administrator/pages/product/categories/partials/category-tree-item.blade.php
@@ -0,0 +1,32 @@
+@if(!$exclude || $category->id != $exclude)
+
+
+ @if($category->children->isNotEmpty())
+
+
+
+ @else
+
+ @endif
+
+ {{ $category->name }}
+ @if(!$category->is_active)
+ Inactive
+ @endif
+
+
+ @if($category->children->isNotEmpty())
+
+ @foreach($category->children as $child)
+ @include('administrator.pages.product.categories.partials.category-tree-item', [
+ 'category' => $child,
+ 'depth' => $depth + 1,
+ 'selected' => $selected,
+ 'exclude' => $exclude,
+ 'treeId' => $treeId,
+ ])
+ @endforeach
+
+ @endif
+@endif
diff --git a/resources/views/administrator/pages/product/categories/partials/category-tree-scripts.blade.php b/resources/views/administrator/pages/product/categories/partials/category-tree-scripts.blade.php
new file mode 100644
index 0000000..d99cebd
--- /dev/null
+++ b/resources/views/administrator/pages/product/categories/partials/category-tree-scripts.blade.php
@@ -0,0 +1,131 @@
+
+
diff --git a/resources/views/administrator/pages/product/categories/partials/category-tree.blade.php b/resources/views/administrator/pages/product/categories/partials/category-tree.blade.php
new file mode 100644
index 0000000..e604d43
--- /dev/null
+++ b/resources/views/administrator/pages/product/categories/partials/category-tree.blade.php
@@ -0,0 +1,45 @@
+@props(['categories', 'selected' => null, 'name' => 'parent_id', 'exclude' => null])
+
+@php $treeId = str_replace(['[', ']', '.'], '-', $name); @endphp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Root (No Parent)
+
+
+ @foreach($categories as $category)
+ @include('administrator.pages.product.categories.partials.category-tree-item', [
+ 'category' => $category,
+ 'depth' => 0,
+ 'selected' => $selected,
+ 'exclude' => $exclude,
+ 'treeId' => $treeId,
+ ])
+ @endforeach
+
+
+
diff --git a/resources/views/administrator/pages/product/create.blade.php b/resources/views/administrator/pages/product/create.blade.php
index b16bc51..2a47b4d 100644
--- a/resources/views/administrator/pages/product/create.blade.php
+++ b/resources/views/administrator/pages/product/create.blade.php
@@ -204,18 +204,20 @@
{{-- Product Type --}}
@@ -406,3 +408,7 @@
});
@endpush
+
+@push('custom-scripts')
+ @include('administrator.pages.product.categories.partials.category-tree-scripts')
+@endpush
diff --git a/resources/views/administrator/pages/product/edit.blade.php b/resources/views/administrator/pages/product/edit.blade.php
index 59686f4..af438a7 100644
--- a/resources/views/administrator/pages/product/edit.blade.php
+++ b/resources/views/administrator/pages/product/edit.blade.php
@@ -209,12 +209,14 @@ $breadcrumbItems = [
Thêm Group
-
+ @include('administrator.pages.product.categories.partials.category-tree', [
+ 'categories' => $group,
+ 'selected' => old('product_categories_id', $product->product_categories_id),
+ 'name' => 'product_categories_id',
+ ])
+ @error('product_categories_id')
+
{{ $message }}
+ @enderror
{{-- Operating System (for VPS) --}}
@@ -424,3 +426,7 @@ $breadcrumbItems = [
});
@endpush
+
+@push('custom-scripts')
+ @include('administrator.pages.product.categories.partials.category-tree-scripts')
+@endpush
\ No newline at end of file