Files
petriandClaude Sonnet 5.5 701f05780f Change a quick sale order before making starts
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]>
2026-11-29 09:11:36 +02:00

44 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Modules\Sales\Application\DTOs;
/**
* A line of a quick sale order with its production: the steps (machine ids,
* null for a step by hand), the step now being made ($currentStep, from 0;
* null when made or with no process) and its materials per piece.
*/
final readonly class OrderLineSummary
{
/**
* @param list<?int> $stepMachineIds
* @param list<array{stockItemId: int, quantityMilli: int}> $currentMaterials
*/
public function __construct(
public int $id,
public int $orderId,
public int $pickupNumber,
public ?string $customerName,
public string $orderedAt,
public string $productName,
public int $quantity,
public int $totalCents,
public array $stepMachineIds,
public ?int $currentStep,
public array $currentMaterials,
public bool $isMade,
public int $productId = 0,
) {}
public function hasProduction(): bool
{
return $this->stepMachineIds !== [];
}
public function currentMachineId(): ?int
{
return $this->currentStep === null ? null : $this->stepMachineIds[$this->currentStep];
}
}