chore: update document approval workflow and bug fixes
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\DailyReports\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreDailyReportRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true; // Authorize in controller or via policies
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'project_id' => ['required', 'exists:projects,id'],
|
||||
'report_date' => ['required', 'date', 'after_or_equal:today'], // No backdating
|
||||
'report_number' => ['nullable', 'string', 'max:255'],
|
||||
'temperature' => ['nullable', 'string', 'max:255'],
|
||||
'precipitation' => ['nullable', 'string', 'max:255'],
|
||||
'wind' => ['nullable', 'string', 'max:255'],
|
||||
'weather' => ['nullable', 'string', 'max:255'],
|
||||
'start_time' => ['nullable', 'date_format:H:i'],
|
||||
'end_time' => ['nullable', 'date_format:H:i'],
|
||||
'remarks' => ['nullable', 'string'],
|
||||
|
||||
// Nested relations
|
||||
'labors' => ['nullable', 'array'],
|
||||
'labors.*.trade' => ['required_with:labors', 'string', 'max:255'],
|
||||
'labors.*.workers_count' => ['required_with:labors', 'integer', 'min:1'],
|
||||
'labors.*.hours' => ['nullable', 'numeric', 'min:0'],
|
||||
'labors.*.notes' => ['nullable', 'string'],
|
||||
|
||||
'equipment' => ['nullable', 'array'],
|
||||
'equipment.*.equipment_name' => ['required_with:equipment', 'string', 'max:255'],
|
||||
'equipment.*.hours_used' => ['nullable', 'numeric', 'min:0'],
|
||||
'equipment.*.status' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
'activities' => ['nullable', 'array'],
|
||||
'activities.*.task_name' => ['required_with:activities', 'string', 'max:255'],
|
||||
'activities.*.quantity_completed' => ['nullable', 'string', 'max:255'],
|
||||
'activities.*.percentage_completed' => ['nullable', 'numeric', 'min:0', 'max:100'],
|
||||
'activities.*.zone_area' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
'materials' => ['nullable', 'array'],
|
||||
'materials.*.material_name' => ['required_with:materials', 'string', 'max:255'],
|
||||
'materials.*.quantity_received' => ['nullable', 'string', 'max:255'],
|
||||
'materials.*.condition' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
'issues' => ['nullable', 'array'],
|
||||
'issues.*.issue_type' => ['required_with:issues', 'string', 'max:255'],
|
||||
'issues.*.description' => ['required_with:issues', 'string'],
|
||||
'issues.*.delay_impact' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
'attachments' => ['nullable', 'array'],
|
||||
'attachments.*' => ['file', 'max:10240'], // max 10MB per file
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user