feat: phase 4 — orders with status workflow, idempotent complete_order RPC, delivery note PDF

This commit is contained in:
sean
2026-08-25 19:10:11 +07:00
parent 002fdce854
commit 029a4a21f8
15 changed files with 1749 additions and 4 deletions
+31
View File
@@ -33,4 +33,35 @@ class ProductService extends InsForgeTableService
return sprintf('BERAS-%03d', ((int) ($matches[1] ?? 0)) + 1);
}
/** @return array<string, string> id => "CODE — Nama" */
public function optionsForSelect(): array
{
return collect($this->client->listRecords($this->table(), [
'select' => 'id,code,name',
'is_active' => 'eq.true',
'order' => 'code.asc',
'limit' => 200,
]))
->mapWithKeys(fn (array $row): array => [$row['id'] => trim(($row['code'] ?? '').' — '.($row['name'] ?? ''), ' —')])
->all();
}
/** @return array<string, int> */
public function codeMap(): array
{
return collect($this->client->listRecords($this->table(), [
'select' => 'id,code',
'limit' => 200,
]))->mapWithKeys(fn (array $row): array => [$row['id'] => $row['code']])->all();
}
/** @return array<string, int> */
public function costMap(): array
{
return collect($this->client->listRecords($this->table(), [
'select' => 'id,cost_price',
'limit' => 200,
]))->mapWithKeys(fn (array $row): array => [$row['id'] => (int) ($row['cost_price'] ?? 0)])->all();
}
}