Просмотр исходного кода

ajustes finais layout e fluxo login

Gustavo Zanatta 3 дней назад
Родитель
Сommit
36a49e93d6

+ 1 - 1
app/Http/Controllers/AuthController.php

@@ -197,7 +197,7 @@ class AuthController extends Controller
 
         return $this->successResponse(
             payload: ['email' => $email, 'phone' => $phone, 'code' => $code],
-            message: __('auth.valid_code'),
+            // message: __('auth.valid_code'),
         );
     }
 

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

@@ -23,6 +23,7 @@ class DashboardClienteResource extends JsonResource
             'favoriteProviders'   => $this['favoriteProviders'],
             'providersClose'      => $this['providersClose'],
             'schedulesProposals'  => $this['schedulesProposals'],
+            'customSchedulesNoProposals' => $this['customSchedulesNoProposals'],
             'todaySchedules'      => $this['todaySchedules'],
             'notifications'       => $this['notifications'],
             'has_payment_methods' => $this['has_payment_methods'],

+ 10 - 0
app/Services/AuthService.php

@@ -287,6 +287,16 @@ class AuthService
         }
 
         if ($isLogin) {
+            $user->load('client');
+            $client = $user->client;
+            $hasAddress = $client && Address::where('source', 'client')
+                ->where('source_id', $client->id)
+                ->exists();
+
+            if (! $hasAddress) {
+                return ['error' => 'registration_incomplete'];
+            }
+
             return $this->loginWithEmail($user->email, $code);
         }
 

+ 9 - 0
app/Services/DashboardService.php

@@ -227,6 +227,7 @@ class DashboardService
 
                 'provider_media.path as provider_photo_path',
             )
+            ->orderBy('distance_km', 'asc')
             ->get();
 
         $providersClose->each(function ($item) {
@@ -337,6 +338,13 @@ class DashboardService
             ])
             ->get();
 
+        $custom_schedules_with_no_proposals = Schedule::where('client_id', $cliente->id)
+            ->where('schedule_type', 'custom')
+            ->where('status', 'pending')
+            ->whereDate('date', '>=', now()->toDateString())
+            ->doesntHave('proposals')
+            ->get();
+
         $schedulesProposals->each(function ($item) {
             $item->provider_photo = $item->provider_photo_path
                 ? Storage::temporaryUrl($item->provider_photo_path, now()->addMinutes(60))
@@ -428,6 +436,7 @@ class DashboardService
             'providersClose'      => $providersClose,
             'todaySchedules'      => $todaySchedules,
             'schedulesProposals'  => $schedulesProposals,
+            'customSchedulesNoProposals' => $custom_schedules_with_no_proposals,
             'notifications'       => $notifications,
             'has_payment_methods' => $hasPaymentMethods,
         ];