Implement toggle for read/write mode across entity pages and enhance Documents and Divers functionality

- Added a toggle for switching between read and write modes on the Articles, Documents, Journaux, Tiers, and Divers pages, allowing users to access both data retrieval and data submission endpoints.
- Updated the Documents page to cover all 9 documented endpoints, including 7 for reading and 2 for writing, with appropriate error handling.
- Created a new Divers page to handle three endpoints: getserialnumber, codes_list, and custom_geninv_updatestock (the latter being non-functional).
- Introduced new methods in LogisticsService for handling PDF generation and stock updates, with corresponding updates in the API documentation.
- Improved form field components for better visual spacing in input fields.
This commit is contained in:
2026-02-20 15:51:58 +01:00
parent 8637dcc7cb
commit 7df94b64fa
22 changed files with 1777 additions and 376 deletions

View File

@@ -168,6 +168,43 @@ it('logs failed requests to api_request_logs as valid JSON', function () {
->and($decoded)->toHaveKey('error');
});
it('sends correct parameters for Document_GetPDF', function () {
Http::fake([
'*' => Http::response(['data' => null, 'metadata' => ['rowcount' => 0, 'issuccess' => false], 'error' => 'Layout not found']),
]);
$service = app(LogisticsService::class);
$service->documentGetPdf('VEN', '2026/0001', 'DEFAULT');
Http::assertSent(function ($request) {
$body = $request->data();
return str_contains($request->url(), 'Document_GetPDF')
&& $body['JNL'] === 'VEN'
&& $body['NUMBER'] === '2026/0001'
&& $body['LAYOUT'] === 'DEFAULT';
});
});
it('sends correct parameters for custom_geninv_updatestock', function () {
Http::fake([
'*' => Http::response(['data' => null, 'metadata' => ['rowcount' => 0, 'issuccess' => false], 'error' => 'Unknown STKID']),
]);
$service = app(LogisticsService::class);
$params = ['ARTID' => 'ART001', 'STKID' => 'STK1', 'QTY' => '10', 'TOCHECK' => '5', 'TOCHECKDETAIL' => 'test', 'MODE' => '1'];
$service->customGeninvUpdatestock($params);
Http::assertSent(function ($request) {
$body = $request->data();
return str_contains($request->url(), 'custom_geninv_updatestock')
&& $body['ARTID'] === 'ART001'
&& $body['STKID'] === 'STK1'
&& $body['QTY'] === '10';
});
});
it('includes endpoint info in LogisticsApiException', function () {
Http::fake(fn () => throw new ConnectionException('Connection timed out'));