feat: phase 2 — master data (products, customers, drivers) via InsForge-backed Filament pages

This commit is contained in:
sean
2026-08-25 18:33:56 +07:00
parent aad2b5e256
commit 4298544381
12 changed files with 870 additions and 38 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Services;
use App\Services\InsForge\InsForgeTableService;
class CustomerService extends InsForgeTableService
{
protected function table(): string
{
return 'customers';
}
protected function searchableColumns(): array
{
return ['name', 'customer_code', 'phone'];
}
protected function sortableColumns(): array
{
return ['customer_code', 'name', 'created_at'];
}
public function nextCode(): string
{
$last = $this->client->listRecords($this->table(), [
'order' => 'customer_code.desc.nullslast',
'limit' => 1,
'select' => 'customer_code',
])[0]['customer_code'] ?? null;
preg_match('/(\d+)$/', (string) $last, $matches);
return sprintf('CUST-%04d', ((int) ($matches[1] ?? 0)) + 1);
}
}