diff --git a/innopacks/common/src/Repositories/ProductRepo.php b/innopacks/common/src/Repositories/ProductRepo.php index fbc9ddd08..72dd0d7e2 100644 --- a/innopacks/common/src/Repositories/ProductRepo.php +++ b/innopacks/common/src/Repositories/ProductRepo.php @@ -941,6 +941,27 @@ public function getBundleItems(Product $product): Collection */ public static function getCategoryOptions(): array { - return CategoryRepo::formatCategoriesForCascader(Category::tree()); + // Get only active categories and build tree structure + $activeCategories = Category::where('active', true) + ->with(['translation', 'children.translation']) + ->orderBy('position') + ->get(); + + // Build tree structure manually since we need to filter by active status + $tree = collect(); + $itemsById = $activeCategories->keyBy('id'); + + foreach ($activeCategories as $category) { + if ($category->parent_id && isset($itemsById[$category->parent_id])) { + if (!isset($itemsById[$category->parent_id]->children)) { + $itemsById[$category->parent_id]->children = collect(); + } + $itemsById[$category->parent_id]->children->push($category); + } else { + $tree->push($category); + } + } + + return CategoryRepo::formatCategoriesForCascader($tree); } } diff --git a/innopacks/panel/resources/views/settings/_logistics_information.blade.php b/innopacks/panel/resources/views/settings/_logistics_information.blade.php index 5a960182d..8334693ae 100644 --- a/innopacks/panel/resources/views/settings/_logistics_information.blade.php +++ b/innopacks/panel/resources/views/settings/_logistics_information.blade.php @@ -1,81 +1,140 @@
-
-
-
-
- - - - - - - - - - - - - - - - - - - - -
{{ __('panel/setting.express_company') }}{{ __('panel/setting.express_code') }}
- - - - - -
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
{{ __('panel/setting.express_company') }}{{ __('panel/setting.express_code') }}
+ + + + + +
+
-
- + + + + try { + logisticsApp.use(ElementPlus); + logisticsApp.mount('#logistics-form'); + } catch (error) { + console.error('Error mounting logistics Vue app:', error); + } + }); +