From e0fe19d46c3a676ab35d8f2978cb0e7b4175db01 Mon Sep 17 00:00:00 2001 From: Aziz Date: Fri, 26 Sep 2025 17:53:16 +0800 Subject: [PATCH 1/2] Refactor getCategoryOptions to return only active categories in a tree structure --- .../common/src/Repositories/ProductRepo.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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); } } From 3c45e961fa1614d855ed61e8c0c839e538c1cda4 Mon Sep 17 00:00:00 2001 From: Aziz Date: Fri, 26 Sep 2025 17:56:42 +0800 Subject: [PATCH 2/2] Enhance logistics information handling with improved error management and input validation --- .../settings/_logistics_information.blade.php | 193 ++++++++++++------ 1 file changed, 126 insertions(+), 67 deletions(-) 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); + } + }); +