feat: 標準化全系統數值輸入欄位與擴充商品價格功能
1. UI 標準化: - 針對全系統數值輸入欄位統一加上 step='any' 以支援小數點。 - 表格形式 (Table) 的數值輸入欄位統一加上 text-right 靠右對齊。 - 修正 Components 與 Pages 中所有涉及金額與數量的輸入框。 2. 功能擴充與修正: - 擴充 Product 模型與相關 Dialog 以支援多種價格設定。 - 修正 Inventory/GoodsReceipt/Create.tsx 未使用的變數錯誤。 - 優化庫存相關頁面的 UI 一致性。 3. 其他: - 更新相關的 Type 定義與 Controller 邏輯。
This commit is contained in:
@@ -96,6 +96,10 @@ class ProductController extends Controller
|
||||
] : null,
|
||||
'conversionRate' => (float) $product->conversion_rate,
|
||||
'location' => $product->location,
|
||||
'cost_price' => (float) $product->cost_price,
|
||||
'price' => (float) $product->price,
|
||||
'member_price' => (float) $product->member_price,
|
||||
'wholesale_price' => (float) $product->wholesale_price,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -126,7 +130,12 @@ class ProductController extends Controller
|
||||
'large_unit_id' => 'nullable|exists:units,id',
|
||||
'conversion_rate' => 'required_with:large_unit_id|nullable|numeric|min:0.0001',
|
||||
'purchase_unit_id' => 'nullable|exists:units,id',
|
||||
'purchase_unit_id' => 'nullable|exists:units,id',
|
||||
'location' => 'nullable|string|max:255',
|
||||
'cost_price' => 'nullable|numeric|min:0',
|
||||
'price' => 'nullable|numeric|min:0',
|
||||
'member_price' => 'nullable|numeric|min:0',
|
||||
'wholesale_price' => 'nullable|numeric|min:0',
|
||||
], [
|
||||
'code.required' => '商品代號為必填',
|
||||
'code.max' => '商品代號最多 8 碼',
|
||||
@@ -142,6 +151,14 @@ class ProductController extends Controller
|
||||
'conversion_rate.required_with' => '填寫大單位時,換算率為必填',
|
||||
'conversion_rate.numeric' => '換算率必須為數字',
|
||||
'conversion_rate.min' => '換算率最小為 0.0001',
|
||||
'cost_price.numeric' => '成本價必須為數字',
|
||||
'cost_price.min' => '成本價不能小於 0',
|
||||
'price.numeric' => '售價必須為數字',
|
||||
'price.min' => '售價不能小於 0',
|
||||
'member_price.numeric' => '會員價必須為數字',
|
||||
'member_price.min' => '會員價不能小於 0',
|
||||
'wholesale_price.numeric' => '批發價必須為數字',
|
||||
'wholesale_price.min' => '批發價不能小於 0',
|
||||
]);
|
||||
|
||||
$product = Product::create($validated);
|
||||
@@ -165,7 +182,12 @@ class ProductController extends Controller
|
||||
'large_unit_id' => 'nullable|exists:units,id',
|
||||
'conversion_rate' => 'required_with:large_unit_id|nullable|numeric|min:0.0001',
|
||||
'purchase_unit_id' => 'nullable|exists:units,id',
|
||||
'purchase_unit_id' => 'nullable|exists:units,id',
|
||||
'location' => 'nullable|string|max:255',
|
||||
'cost_price' => 'nullable|numeric|min:0',
|
||||
'price' => 'nullable|numeric|min:0',
|
||||
'member_price' => 'nullable|numeric|min:0',
|
||||
'wholesale_price' => 'nullable|numeric|min:0',
|
||||
], [
|
||||
'code.required' => '商品代號為必填',
|
||||
'code.max' => '商品代號最多 8 碼',
|
||||
@@ -181,6 +203,14 @@ class ProductController extends Controller
|
||||
'conversion_rate.required_with' => '填寫大單位時,換算率為必填',
|
||||
'conversion_rate.numeric' => '換算率必須為數字',
|
||||
'conversion_rate.min' => '換算率最小為 0.0001',
|
||||
'cost_price.numeric' => '成本價必須為數字',
|
||||
'cost_price.min' => '成本價不能小於 0',
|
||||
'price.numeric' => '售價必須為數字',
|
||||
'price.min' => '售價不能小於 0',
|
||||
'member_price.numeric' => '會員價必須為數字',
|
||||
'member_price.min' => '會員價不能小於 0',
|
||||
'wholesale_price.numeric' => '批發價必須為數字',
|
||||
'wholesale_price.min' => '批發價不能小於 0',
|
||||
]);
|
||||
|
||||
$product->update($validated);
|
||||
|
||||
Reference in New Issue
Block a user