Link retail POS products to the CRM products API (restaurant stays local)
Deploy Ladill POS / deploy (push) Successful in 28s
Deploy Ladill POS / deploy (push) Successful in 28s
Products are now mode-aware:
- Retail: the catalog lives in Ladill CRM. The Products page proxies CRUD to the
CRM products API (CrmClient gains product/create/update/delete), and the
register reads CRM products live; a sold line is stored as a name/price
snapshot (product_id null, since CRM products aren't local rows). Resilient —
the register shows an empty catalog if CRM is unreachable. CRM import is hidden
in Settings (not needed when reading live).
- Restaurant: unchanged — the local pos_products catalog keeps its POS-only depth
(category, kitchen station, course, modifier groups).
ProductController routes take a raw {product} id (CRM id in retail, local id in
restaurant). Suite green (17), covering both modes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0d816daed3
commit
5d8e185223
@@ -26,6 +26,26 @@ class CrmClient
|
||||
return $this->get('products', $filters);
|
||||
}
|
||||
|
||||
public function product(int|string $id): array
|
||||
{
|
||||
return $this->get("products/{$id}");
|
||||
}
|
||||
|
||||
public function createProduct(array $data): array
|
||||
{
|
||||
return $this->send('post', 'products', $data);
|
||||
}
|
||||
|
||||
public function updateProduct(int|string $id, array $data): array
|
||||
{
|
||||
return $this->send('patch', "products/{$id}", $data);
|
||||
}
|
||||
|
||||
public function deleteProduct(int|string $id): array
|
||||
{
|
||||
return $this->send('delete', "products/{$id}", []);
|
||||
}
|
||||
|
||||
public function pushTimeline(array $data): array
|
||||
{
|
||||
return $this->post('timeline', $data);
|
||||
@@ -51,6 +71,11 @@ class CrmClient
|
||||
return $this->handle(fn () => $this->client()->post($path, [...$data, 'owner' => $this->owner]));
|
||||
}
|
||||
|
||||
private function send(string $method, string $path, array $data): array
|
||||
{
|
||||
return $this->handle(fn () => $this->client()->{$method}($path, [...$data, 'owner' => $this->owner]));
|
||||
}
|
||||
|
||||
private function handle(callable $request): array
|
||||
{
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user