fix: low stock alert only on out movements, fix date formatting in notifications

This commit is contained in:
ghassan committed 2026-05-19 13:25:29 +03:00
1 parent fddfb2aaff
commit 2d54c670de
3 files changed
+3 -3

No files matched your search

@@ -61,7 +61,7 @@ class StockMovementController extends Controller
$stockLevel->refresh();
$item = Item::find($request->item_id);
if ($item && $item->minimum_stock_level && $stockLevel->quantity <= $item->minimum_stock_level) {
if ($request->type === 'out' && $item && $item->minimum_stock_level && $stockLevel->quantity <= $item->minimum_stock_level) {
$storeManagers = \App\Models\User::role('Store Manager')->whereNotNull('whatsapp_number')->get();
\Illuminate\Support\Facades\Notification::send(
$storeManagers,