master
parent
54b4271312
commit
fff0d79335
|
|
@ -127,7 +127,7 @@ class MobileApiController extends Controller
|
|||
'started_at' => $data['started_at'],
|
||||
'ended_at' => $data['ended_at'],
|
||||
'user_id' => $data['user_id'],
|
||||
'phone' => $data['phone'],
|
||||
'phone' => $data['phone'] ?? '' ,
|
||||
'car_id' => $data['car_id'],
|
||||
'user_name' => $data['name'] ?? null,
|
||||
'user_surname' => $data['surname'] ?? null,
|
||||
|
|
@ -160,6 +160,8 @@ class MobileApiController extends Controller
|
|||
$query = UniModel::model('pipi_applications')->where('user_id', $user->id);
|
||||
if (isset($status)) {
|
||||
$query->where('status', $status);
|
||||
} else {
|
||||
$query->where('status', '!=', ApplicationStatus::approved->value);
|
||||
}
|
||||
$applications = $query->get();
|
||||
foreach ($applications as $app) {
|
||||
|
|
@ -169,6 +171,7 @@ class MobileApiController extends Controller
|
|||
$photo = url('api/files/file/' . ltrim($photo?->path, '/'));
|
||||
$class_id = UniModel::model('pipi_auto_classes')->where('id', $model->class_id)->first();
|
||||
$bodywork_id = UniModel::model('pipi_auto_bodywork')->where('id', $model->bodywork_id)->first();
|
||||
$address = UniModel::model('pipi_address')->where('id', $model->address)->first();
|
||||
$data[] = [
|
||||
'id' => $app->id,
|
||||
'rent_day' => $app->rent_day,
|
||||
|
|
@ -176,7 +179,7 @@ class MobileApiController extends Controller
|
|||
'ended_at' => $app->ended_at,
|
||||
'status' => ApplicationStatus::from($app->status)->getName(),
|
||||
'sum' => $app->sum ?? 0,
|
||||
'address_end' => $app->address_end ?? '',
|
||||
'address_end' => $address->name ?? '',
|
||||
'car' => [
|
||||
'name' => $model->name,
|
||||
'year' => $model->year,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ enum ApplicationStatus: string
|
|||
{
|
||||
return match ($this) {
|
||||
self::pending => 'В обработке',
|
||||
self::approved => 'Утверждена',
|
||||
self::approved => 'Бронь',
|
||||
self::rejected => 'Отклонена',
|
||||
self::completed => 'Завершена',
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue