|
|
@@ -38,6 +38,7 @@ class DashboardService
|
|
|
$address = Address::where('source', 'client')
|
|
|
->where('source_id', $cliente->id)
|
|
|
->with(['city', 'state'])
|
|
|
+ ->select('id', 'source', 'source_id', 'address', 'number', 'district', 'nickname', 'address_type', 'city_id', 'state_id', 'is_primary')
|
|
|
->first();
|
|
|
|
|
|
$summaryInfos = [
|
|
|
@@ -48,7 +49,7 @@ class DashboardService
|
|
|
->count(),
|
|
|
];
|
|
|
|
|
|
- $nextSchedules = Schedule::with('address:district,address,complement,number,source_id,source,id,address_type')
|
|
|
+ $nextSchedules = Schedule::with('address:district,address,source_id,source,id,address_type')
|
|
|
->where('schedules.client_id', $cliente->id)
|
|
|
->whereIn('schedules.status', ['accepted', 'paid'])
|
|
|
->whereDate('schedules.date', '>=', now()->toDateString())
|
|
|
@@ -104,10 +105,6 @@ class DashboardService
|
|
|
'providers.id as provider_id',
|
|
|
'provider_user.name as provider_name',
|
|
|
'providers.average_rating',
|
|
|
- 'providers.daily_price_8h',
|
|
|
- 'providers.daily_price_6h',
|
|
|
- 'providers.daily_price_4h',
|
|
|
- 'providers.daily_price_2h',
|
|
|
'provider_address.district as provider_district',
|
|
|
)
|
|
|
->orderBy('client_favorite_providers.created_at', 'desc')
|
|
|
@@ -169,19 +166,12 @@ class DashboardService
|
|
|
'schedules.provider_id',
|
|
|
'provider_user.name as provider_name',
|
|
|
'schedules.date',
|
|
|
- DB::raw("TO_CHAR(schedules.date, 'DD \"de\" TMMonth \"de\" YYYY') as formatted_date"),
|
|
|
- 'schedules.start_time',
|
|
|
- 'schedules.end_time',
|
|
|
- 'schedules.period_type',
|
|
|
'schedules.address_id',
|
|
|
- 'schedules.status',
|
|
|
- 'schedules.total_amount',
|
|
|
- DB::raw("(SELECT district FROM addresses WHERE source = 'provider' AND source_id = schedules.provider_id and deleted_at is null ORDER BY is_primary DESC LIMIT 1) as provider_district"),
|
|
|
DB::raw("CASE
|
|
|
WHEN (now() - schedules.created_at) < INTERVAL '1 hour' THEN CONCAT(ROUND(EXTRACT(EPOCH FROM (now() - schedules.created_at)) / 60), 'min')
|
|
|
WHEN (now() - schedules.created_at) < INTERVAL '1 day' THEN CONCAT(ROUND(EXTRACT(EPOCH FROM (now() - schedules.created_at)) / 3600), 'h')
|
|
|
ELSE CONCAT(ROUND(EXTRACT(EPOCH FROM (now() - schedules.created_at)) / 86400), 'd')
|
|
|
- END as time_since_request"),
|
|
|
+ END as time_since_request")
|
|
|
)
|
|
|
->orderBy('schedules.date', 'asc')
|
|
|
->get();
|
|
|
@@ -464,7 +454,7 @@ class DashboardService
|
|
|
|
|
|
$opportunities = $customScheduleService->getAvailableOpportunities($provider->id);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
return [
|
|
|
'headerBar' => $headerBar,
|