Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ListClientsRequest | |
100.00% |
18 / 18 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| authorize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| rules | |
100.00% |
17 / 17 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests; |
| 4 | |
| 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | |
| 7 | class ListClientsRequest extends FormRequest |
| 8 | { |
| 9 | public function authorize(): bool |
| 10 | { |
| 11 | return true; |
| 12 | } |
| 13 | |
| 14 | public function rules(): array |
| 15 | { |
| 16 | return [ |
| 17 | /** Free-text search across company name, CIF/fiscal ID, phone and email. */ |
| 18 | 'search' => 'nullable|string|max:255', |
| 19 | |
| 20 | /** Filter by client type (lead / existing). ID from `tbl_client_types`. Fetch options via `GET /api/client-types`. */ |
| 21 | 'client_type_id' => 'nullable|integer|exists:tbl_client_types,id', |
| 22 | |
| 23 | /** Filter by industry/segment. ID from `tbl_segments`. Fetch options via `GET /api/listSegments`. */ |
| 24 | 'segment_id' => 'nullable|integer|exists:tbl_segments,segment_id', |
| 25 | |
| 26 | /** Filter by strategy type (Venta nueva, Recuperacion, Upselling, Competitivo). ID from `tbl_strategy_types`. Fetch options via `GET /api/strategy-types`. */ |
| 27 | 'strategy_type_id' => 'nullable|integer|exists:tbl_strategy_types,id', |
| 28 | |
| 29 | /** Filter by geographic scope. */ |
| 30 | 'scope' => 'nullable|string|in:regional,national', |
| 31 | |
| 32 | /** Filter by annual maintenance contract. `all` = no filter (default), `yes` = has contract, `no` = no contract. */ |
| 33 | 'annual_maintenance' => 'nullable|string|in:all,yes,no', |
| 34 | |
| 35 | /** Filter by quarterly maintenance contract. `all` = no filter (default), `yes` = has contract, `no` = no contract. */ |
| 36 | 'quarterly_maintenance' => 'nullable|string|in:all,yes,no', |
| 37 | |
| 38 | /** Filter by fire suppression service. `all` = no filter (default), `yes` = has service, `no` = no service. */ |
| 39 | 'fire_suppression' => 'nullable|string|in:all,yes,no', |
| 40 | |
| 41 | /** Filter by fire detection service. `all` = no filter (default), `yes` = has service, `no` = no service. */ |
| 42 | 'fire_detection' => 'nullable|string|in:all,yes,no', |
| 43 | |
| 44 | /** Filter by water service. `all` = no filter (default), `yes` = has service, `no` = no service. */ |
| 45 | 'water' => 'nullable|string|in:all,yes,no', |
| 46 | |
| 47 | /** Filter by relationship status. `all` = no filter (default). */ |
| 48 | 'relationship_status' => 'nullable|string|in:all,client,non_client,ex_client', |
| 49 | |
| 50 | /** Filter by administrator. ID from `tbl_administrators`. Fetch options via `GET /api/administrators`. */ |
| 51 | 'administrator_id' => 'nullable|integer|exists:tbl_administrators,id', |
| 52 | |
| 53 | /** Filter by assigned commercial. User ID from `users` table. Fetch commercial users via `POST /api/getAllCommercials`. */ |
| 54 | 'commercial_id' => 'nullable|integer|exists:tbl_users,id', |
| 55 | |
| 56 | /** Number of results per page (1–100, default 25). */ |
| 57 | 'per_page' => 'nullable|integer|min:1|max:100', |
| 58 | |
| 59 | /** Page number (1-based). */ |
| 60 | 'page' => 'nullable|integer|min:1', |
| 61 | ]; |
| 62 | } |
| 63 | } |