ifnex/04_Laravel/app/Enums/ShipmentStatus.php
Kazem Alghasi 02c29db696 feat(core): implement order approval flow, credit system, and import invoicing
Introduce a comprehensive set of commercial features including a multi-step
order approval workflow, customer credit management, and specialized
import service invoicing.

Key changes:
- Implement `pending_approval` and `approved` shipment statuses to allow
  staff verification before customer payment.
- Add a credit system to `User` model with `credit_limit` and `credit_used`
  to manage customer balances and debts.
- Develop a new `importInvoice` PDF generation service following the
  "Sheet ENG Invoice" specification for import services.
- Add Filament resources for managing Audit Logs, Commitment Forms,
  Customer Credits, and Shipment Checklists.
- Implement staff-specific APIs for order approval/rejection and
  customer financial status monitoring.
- Integrate Kavenegar SMS service for mobile verification and notifications.
- Add bulk tracking import functionality via CSV/Excel.
- Update WordPress bridge assets (CSS/JS) to support the new multi-step
  order form UI and updated redirection logic.
- Update deployment configurations and documentation to reflect new
  production domains and feature sets.
2026-09-03 06:04:20 +03:30

92 lines
2.6 KiB
PHP

<?php
namespace App\Enums;
enum ShipmentStatus: string
{
case PendingApproval = 'pending_approval';
case Approved = 'approved';
case PendingPayment = 'pending_payment';
case Cancelled = 'cancelled';
case Processed = 'processed';
case PickedUp = 'picked_up';
case InTransit = 'in_transit';
case OutForDelivery = 'out_for_delivery';
case Failed = 'failed';
case Delivered = 'delivered';
case Returned = 'returned';
case Archived = 'archived';
public function label(): string
{
return match ($this) {
self::PendingApproval => 'در انتظار تأیید',
self::Approved => 'تأیید شده - در انتظار پرداخت',
self::PendingPayment => 'در انتظار پرداخت',
self::Cancelled => 'لغو شده',
self::Processed => 'در حال پردازش',
self::PickedUp => 'تحویل به حمل‌کننده',
self::InTransit => 'در حال حمل',
self::OutForDelivery => 'آماده تحویل',
self::Failed => 'تحویل ناموفق',
self::Delivered => 'تحویل شده',
self::Returned => 'برگشتی',
self::Archived => 'آرشیو',
};
}
public function color(): string
{
return match ($this) {
self::PendingApproval => 'warning',
self::Approved => 'info',
self::PendingPayment => 'warning',
self::Cancelled => 'danger',
self::Processed => 'gray',
self::PickedUp => 'info',
self::InTransit => 'primary',
self::OutForDelivery => 'success',
self::Failed => 'danger',
self::Delivered => 'success',
self::Returned => 'warning',
self::Archived => 'gray',
};
}
public function isPaid(): bool
{
return !in_array($this, [
self::PendingApproval,
self::PendingPayment,
]);
}
public function canBeCancelledByCustomer(): bool
{
return in_array($this, [
self::PendingApproval,
self::PendingPayment,
]);
}
public function isApproved(): bool
{
return $this === self::Approved;
}
public function isPendingApproval(): bool
{
return $this === self::PendingApproval;
}
public function canBeApprovedByStaff(): bool
{
return $this === self::PendingApproval;
}
public function canBePaid(): bool
{
return $this === self::Approved;
}
}