Доработка апи

pull/6/head
Rustem 2025-03-25 15:35:12 +05:00
parent d9c725bd90
commit a1e88818aa
5 changed files with 130 additions and 10 deletions

View File

@ -166,7 +166,10 @@ class MobileApiController extends Controller
$started_at = Carbon::parse($started_at)->format('Y-m-d'); $started_at = Carbon::parse($started_at)->format('Y-m-d');
$ended_at = Carbon::parse($ended_at)->format('Y-m-d'); $ended_at = Carbon::parse($ended_at)->format('Y-m-d');
$cars = UniModel::model('pipi_auto')->where('model_id', $modelId)->get(); $cars = UniModel::model('pipi_auto')
->where('is_inactive', '=', false)
->where('model_id', $modelId)
->get();
$busyCars = UniModel::model('pipi_auto_calendar') $busyCars = UniModel::model('pipi_auto_calendar')
->whereBetween('date', [$started_at, $ended_at]) ->whereBetween('date', [$started_at, $ended_at])
->pluck('auto_id') ->pluck('auto_id')
@ -212,11 +215,17 @@ class MobileApiController extends Controller
$availableMarks[$mark->name . '-' . $mark->year] = [ $availableMarks[$mark->name . '-' . $mark->year] = [
'id' => $mark->id, 'id' => $mark->id,
'brand' => $brand->name ?? null, 'brand' => $brand?->name,
'mark' => $mark->name, 'mark' => $mark->name,
'year' => $mark->year, 'year' => $mark->year,
'configuration' => $equipment?->name, 'configuration' => $equipment?->name,
'tariffs' => $tariffs_new, 'people' => $mark?->people,
'actuator' => $mark?->actuator,
'fuel_type' => $mark?->fuel_type,
'hp' => $mark?->hp,
'engine_capacity' => $mark?->engine_capacity,
'fuel_tank' => $mark?->fuel_tank,
'tariffs' => $tariffs_new
]; ];
} }

View File

@ -81,7 +81,7 @@ class Sync1cApiController extends Controller
->firstOrCreate(['name' => $value['ВладелецИмущества']])->id, ->firstOrCreate(['name' => $value['ВладелецИмущества']])->id,
'is_trust_management' => (bool)$value['ВДоверенномУправлении'], 'is_trust_management' => (bool)$value['ВДоверенномУправлении'],
'owner_percentage' => $value['ПроцентВладельца'], 'owner_percentage' => $value['ПроцентВладельца'],
'is_inactive' => (bool)$value['НеИспользовать'], 'is_inactive' => $value['НеИспользовать'] == 'Да',
'is_predefined' => (bool)$value['Предопределенный'], 'is_predefined' => (bool)$value['Предопределенный'],
'predefined_data_name' => $value['ИмяПредопределенныхДанных'], 'predefined_data_name' => $value['ИмяПредопределенныхДанных'],
'inspection_kit' => $inspectionKit, 'inspection_kit' => $inspectionKit,

View File

@ -183,9 +183,7 @@
} }
], ],
"action": { "action": {
"head": [ "head": [],
"add"
],
"row": [ "row": [
"edit", "edit",
"delete" "delete"

View File

@ -16,6 +16,24 @@
"name": { "name": {
"type": "string" "type": "string"
}, },
"people": {
"type": "string"
},
"actuator": {
"type": "string"
},
"fuel_type": {
"type": "string"
},
"hp": {
"type": "string"
},
"engine_capacity": {
"type": "string"
},
"fuel_tank": {
"type": "string"
},
"year": { "year": {
"type": "string" "type": "string"
}, },
@ -289,6 +307,48 @@
"name": "equipment_id", "name": "equipment_id",
"label": "Комплектация" "label": "Комплектация"
} }
},
{
"size": 2,
"input": {
"name": "people",
"label": "Количество мест"
}
},
{
"size": 2,
"input": {
"name": "actuator",
"label": "Привод"
}
},
{
"size": 2,
"input": {
"name": "fuel_type",
"label": "Тип топлива"
}
},
{
"size": 2,
"input": {
"name": "hp",
"label": "Лошадиные силы"
}
},
{
"size": 2,
"input": {
"name": "engine_capacity",
"label": "Объем двигателя"
}
},
{
"size": 2,
"input": {
"name": "fuel_tank",
"label": "Объем топливного бака"
}
} }
] ]
} }
@ -329,6 +389,48 @@
"name": "equipment_id", "name": "equipment_id",
"label": "Комплектация" "label": "Комплектация"
} }
},
{
"size": 2,
"input": {
"name": "people",
"label": "Количество мест"
}
},
{
"size": 2,
"input": {
"name": "actuator",
"label": "Привод"
}
},
{
"size": 2,
"input": {
"name": "fuel_type",
"label": "Тип топлива"
}
},
{
"size": 2,
"input": {
"name": "hp",
"label": "Лошадиные силы"
}
},
{
"size": 2,
"input": {
"name": "engine_capacity",
"label": "Объем двигателя"
}
},
{
"size": 2,
"input": {
"name": "fuel_tank",
"label": "Объем топливного бака"
}
} }
] ]
}, },

View File

@ -38,6 +38,17 @@ return new class extends \A7kz\Platform\Commands\InstallScript {
$table->foreign('brand_id')->references('id')->on('pipi_auto_brands'); $table->foreign('brand_id')->references('id')->on('pipi_auto_brands');
}); });
} }
if (!Schema::connection($segment->connector)->hasColumn('pipi_brand_models', 'people')) {
Schema::connection($segment->connector)->table('pipi_brand_models', function ($table) {
$table->string('people')->nullable()->comment('Количество мест');
$table->string('actuator')->nullable()->comment('Привод');
$table->string('fuel_type')->nullable()->comment('Тип топлива');
$table->string('hp')->nullable()->comment('Лошадиные силы');
$table->string('engine_capacity')->nullable()->comment('Объем двигателя');
$table->string('fuel_tank')->nullable()->comment('Объем топливного бака');
});
}
} }
} }
}; };