Enhance Documents page functionality and update API documentation

- Added a new `$results` property to the Documents page to allow users to specify the maximum number of results returned by the `document_list` endpoint, defaulting to ~108.
- Updated the `searchDocuments` method to include the `results` parameter in API requests, ensuring it is sent as a string.
- Modified the documents.blade.php view to include an input field for the `results` parameter, with appropriate placeholder text and guidance.
- Improved the documentation for the `document_list` endpoint to clarify the behavior of the `results` parameter and its interaction with `thirdid`.
- Updated the `Document_GetPDF` section to reflect its functionality and correct usage of the `LAYOUT` parameter.
- Added a new test to verify that the `results` parameter is correctly sent to the API.
- Overall, enhanced the user experience and API interaction for document management.
This commit is contained in:
2026-02-23 11:24:57 +01:00
parent 0ab94fdb91
commit dfe20e79d7
10 changed files with 461 additions and 152 deletions

View File

@@ -53,6 +53,50 @@ it('searches documents via document_list', function () {
->assertSet('data', [['jnl' => 'VEN', 'number' => '1']]);
});
it('sends results parameter to document_list', function () {
Http::fake([
'*/document_list' => Http::response([
'data' => [['jnl' => 'VEN', 'number' => '1']],
'metadata' => ['rowcount' => 1, 'issuccess' => true],
'error' => null,
]),
]);
Livewire::test(Documents::class)
->set('select', 'jnl,number')
->set('results', '20')
->call('searchDocuments');
Http::assertSent(function ($request) {
$body = $request->data();
return str_contains($request->url(), 'document_list')
&& $body['results'] === '20';
});
});
it('omits results parameter when empty', function () {
Http::fake([
'*/document_list' => Http::response([
'data' => [['jnl' => 'VEN', 'number' => '1']],
'metadata' => ['rowcount' => 1, 'issuccess' => true],
'error' => null,
]),
]);
Livewire::test(Documents::class)
->set('select', 'jnl,number')
->set('results', '')
->call('searchDocuments');
Http::assertSent(function ($request) {
$body = $request->data();
return str_contains($request->url(), 'document_list')
&& ! array_key_exists('results', $body);
});
});
it('gets document detail', function () {
Http::fake([
'*/document_detail' => Http::response([