master
Rustem 2025-05-24 15:29:07 +05:00
parent 54b4271312
commit fff0d79335
2 changed files with 6 additions and 3 deletions

View File

@ -127,7 +127,7 @@ class MobileApiController extends Controller
'started_at' => $data['started_at'], 'started_at' => $data['started_at'],
'ended_at' => $data['ended_at'], 'ended_at' => $data['ended_at'],
'user_id' => $data['user_id'], 'user_id' => $data['user_id'],
'phone' => $data['phone'], 'phone' => $data['phone'] ?? '' ,
'car_id' => $data['car_id'], 'car_id' => $data['car_id'],
'user_name' => $data['name'] ?? null, 'user_name' => $data['name'] ?? null,
'user_surname' => $data['surname'] ?? null, 'user_surname' => $data['surname'] ?? null,
@ -160,6 +160,8 @@ class MobileApiController extends Controller
$query = UniModel::model('pipi_applications')->where('user_id', $user->id); $query = UniModel::model('pipi_applications')->where('user_id', $user->id);
if (isset($status)) { if (isset($status)) {
$query->where('status', $status); $query->where('status', $status);
} else {
$query->where('status', '!=', ApplicationStatus::approved->value);
} }
$applications = $query->get(); $applications = $query->get();
foreach ($applications as $app) { foreach ($applications as $app) {
@ -169,6 +171,7 @@ class MobileApiController extends Controller
$photo = url('api/files/file/' . ltrim($photo?->path, '/')); $photo = url('api/files/file/' . ltrim($photo?->path, '/'));
$class_id = UniModel::model('pipi_auto_classes')->where('id', $model->class_id)->first(); $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(); $bodywork_id = UniModel::model('pipi_auto_bodywork')->where('id', $model->bodywork_id)->first();
$address = UniModel::model('pipi_address')->where('id', $model->address)->first();
$data[] = [ $data[] = [
'id' => $app->id, 'id' => $app->id,
'rent_day' => $app->rent_day, 'rent_day' => $app->rent_day,
@ -176,7 +179,7 @@ class MobileApiController extends Controller
'ended_at' => $app->ended_at, 'ended_at' => $app->ended_at,
'status' => ApplicationStatus::from($app->status)->getName(), 'status' => ApplicationStatus::from($app->status)->getName(),
'sum' => $app->sum ?? 0, 'sum' => $app->sum ?? 0,
'address_end' => $app->address_end ?? '', 'address_end' => $address->name ?? '',
'car' => [ 'car' => [
'name' => $model->name, 'name' => $model->name,
'year' => $model->year, 'year' => $model->year,

View File

@ -14,7 +14,7 @@ enum ApplicationStatus: string
{ {
return match ($this) { return match ($this) {
self::pending => 'В обработке', self::pending => 'В обработке',
self::approved => 'Утверждена', self::approved => 'Бронь',
self::rejected => 'Отклонена', self::rejected => 'Отклонена',
self::completed => 'Завершена', self::completed => 'Завершена',
}; };