fix: low stock alert only on out movements, fix date formatting in notifications
This commit is contained in:
parent
fddfb2aaff
commit
2d54c670de
@ -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,
|
||||
|
||||
@ -23,7 +23,7 @@ class ProductionOrderCompletedNotification extends Notification implements Shoul
|
||||
public function toUltraMessage(mixed $notifiable): UltraMessageMessage
|
||||
{
|
||||
return UltraMessageMessage::text(
|
||||
"✅ *Production Complete*\n\nProduction Order *#{$this->order->order_number}* has been completed.\n\nProduct: {$this->order->product->item_name}\nQuantity: {$this->order->quantity_to_produce}\nCompleted: " . now()->format('d M Y')
|
||||
"✅ *Production Complete*\n\nProduction Order *#{$this->order->order_number}* has been completed.\n\nProduct: {$this->order->product->item_name}\nQuantity: {$this->order->quantity_to_produce}\nCompleted: {$this->order->completion_date->format('d M Y')}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class GoodsReceiptConfirmedNotification extends Notification implements ShouldQu
|
||||
public function toUltraMessage(mixed $notifiable): UltraMessageMessage
|
||||
{
|
||||
return UltraMessageMessage::text(
|
||||
"GRN *#{$this->grn->grn_number}* has been confirmed and goods received.\n\nPO Reference: {$this->grn->purchaseOrder->po_number}\nDate: {$this->grn->received_date}"
|
||||
"GRN *#{$this->grn->grn_number}* has been confirmed and goods received.\n\nPO Reference: {$this->grn->purchaseOrder->po_number}\nDate: {$this->grn->received_date->format('d M Y')}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user