diff --git a/modules/main/Components/Main.php b/modules/main/Components/Main.php index f006ec7..c8d1a8f 100644 --- a/modules/main/Components/Main.php +++ b/modules/main/Components/Main.php @@ -26,22 +26,27 @@ class Main extends Component $ended_at = Request::input('ended_at') ?? null; $bodywork_filters = Request::input('bodywork_filters') ?? null; -// $request = new \Illuminate\Http\Request([ -// 'started_at' => Carbon::now()->toDateString(), -// 'ended_at' => Carbon::now()->addDays(3)->toDateString(), -// ]); -// -// $response = (new \App\Http\Controllers\MobileApiController)->getAvailableMarksList($request); -// $this->params['cars'] = collect($response->getData(true)); + $request = new \Illuminate\Http\Request([ + 'started_at' => Carbon::now()->toDateString(), + 'ended_at' => Carbon::now()->addDays(3)->toDateString(), + ]); + + $response = (new \App\Http\Controllers\MobileApiController)->getAvailableMarksList($request); + $this->params['cars'] = collect($response->getData(true))->filter(function ($item) { + return !empty($item['tariffs']); + })->values(); // dd($class_filters, $started_at, $ended_at, $bodywork_filters); - $response = Http::get('https://cvm10.a7.kz/api/mobile/getAvailableMarksList', [ - 'started_at' => $started_at ?? Carbon::now()->toDateString(), - 'ended_at' => $ended_at ?? Carbon::now()->addDays(3)->toDateString(), - 'class' => $class_filters ?? null, - 'bodywork' => $bodywork_filters ?? null, - ]); - $this->params['cars'] = collect($response->json()); +// $response = Http::get('https://cvm10.a7.kz/api/mobile/getAvailableMarksList', [ +// 'started_at' => $started_at ?? Carbon::now()->toDateString(), +// 'ended_at' => $ended_at ?? Carbon::now()->addDays(3)->toDateString(), +// 'class' => $class_filters ?? null, +// 'bodywork' => $bodywork_filters ?? null, +// ]); +// +// $this->params['cars'] = collect($response->json())->filter(function ($item) { +// return !empty($item['tariffs']); +// })->values(); } } diff --git a/modules/main/views/main.blade.php b/modules/main/views/main.blade.php index a9e0ecb..494fd27 100644 --- a/modules/main/views/main.blade.php +++ b/modules/main/views/main.blade.php @@ -127,9 +127,28 @@
@@ -141,39 +160,50 @@