An unpaid order whose lines have no completed step can be reopened in the cart from the open orders list; saving replaces its lines with current prices and processes, moves the machine work list rows and keeps the pickup number. Keyboard browser tests cover changing and cancelling an order and moving production steps. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Sales\Application\DTOs;
|
|
|
|
use App\Modules\Sales\Domain\Enums\OrderStatus;
|
|
|
|
/**
|
|
* A quick sale order as listed. $orderedAt is "Y-m-d H:i" in the company's
|
|
* time zone; $saleId is the sale that paid it.
|
|
*/
|
|
final readonly class OrderSummary
|
|
{
|
|
/**
|
|
* @param list<OrderLineSummary> $lines
|
|
*/
|
|
public function __construct(
|
|
public int $id,
|
|
public int $pickupNumber,
|
|
public string $orderedOn,
|
|
public string $orderedAt,
|
|
public string $sellerName,
|
|
public ?int $customerId,
|
|
public ?string $customerName,
|
|
public OrderStatus $status,
|
|
public ?int $saleId,
|
|
public int $totalCents,
|
|
public array $lines,
|
|
public bool $canBeChanged = false,
|
|
) {}
|
|
|
|
public function isPaid(): bool
|
|
{
|
|
return $this->saleId !== null;
|
|
}
|
|
|
|
/**
|
|
* Whether making has not started on any line, so the order can still be
|
|
* cancelled without anything recorded.
|
|
*/
|
|
public function isOpen(): bool
|
|
{
|
|
return $this->status === OrderStatus::InProduction || $this->status === OrderStatus::Ready;
|
|
}
|
|
}
|