Przeglądaj źródła

feat: :sparkles: feat (agendamentos) inclusao do bloco todayservices na dashboard do prestador

Foi criado um novo bloco na dashboard do prestador exibindo os servicos do dia atual, com as devidas informacoes

fase:dev | origin:escopo
Gustavo Zanatta 3 tygodni temu
rodzic
commit
0e0430709d

+ 1 - 0
app/Http/Resources/DashboardPrestadorResource.php

@@ -18,6 +18,7 @@ class DashboardPrestadorResource extends JsonResource
       'headerBar' => $this['headerBar'],
       'summaryInfos' => $this['summaryInfos'],
       'priceSuggested' => $this['priceSuggested'],
+      'todayServices' => $this['todayServices'],
       'solicitations' => $this['solicitations'],
       'nextSchedules' => $this['nextSchedules'],
       'opportunities' => $this['opportunities'],

+ 25 - 0
app/Services/DashboardService.php

@@ -231,6 +231,30 @@ class DashboardService
       ->orderBy('schedules.date', 'asc')
       ->get();
 
+    $todayServices = Schedule::with('address:district,address,number,source_id,source,id')
+      ->where('schedules.provider_id', $provider->id)
+      ->whereIn('schedules.status', ['accepted', 'paid', 'started'])
+      ->whereDate('schedules.date', now()->toDateString())
+      ->leftJoin('clients', 'clients.id', '=', 'schedules.client_id')
+      ->leftJoin('users as client_user', 'client_user.id', '=', 'clients.user_id')
+      ->leftJoin('custom_schedules', 'custom_schedules.schedule_id', '=', 'schedules.id')
+      ->select(
+        'schedules.id',
+        'client_user.name as client_name',
+        'schedules.date',
+        'schedules.start_time',
+        'schedules.end_time',
+        'schedules.total_amount',
+        'schedules.period_type',
+        'schedules.address_id',
+        'schedules.schedule_type',
+        'schedules.status',
+        'schedules.code_verified',
+        'custom_schedules.offers_meal',
+      )
+      ->orderBy('schedules.start_time', 'asc')
+      ->get();
+
     $nextSchedules = Schedule::with('address:district,address,number,source_id,source,id')
       ->where('schedules.provider_id', $provider->id)
       ->whereIn('schedules.status', ['accepted', 'paid'])
@@ -298,6 +322,7 @@ class DashboardService
       'summaryInfos' => $summaryInfos,
       'priceSuggested' => $priceSuggested,
       'solicitations' => $solicitations,
+      'todayServices' => $todayServices,
       'nextSchedules' => $nextSchedules,
       'opportunities' => $opportunities,
     ];