From a1e88818aacc4110c70137751265684190a59ce7 Mon Sep 17 00:00:00 2001 From: Rustem Date: Tue, 25 Mar 2025 15:35:12 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B0=D0=BF=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/MobileApiController.php | 21 ++-- app/Http/Controllers/Sync1cApiController.php | 2 +- modules/auto/app.json | 4 +- modules/brand_models/app.json | 102 +++++++++++++++++++ modules/brand_models/script.php | 11 ++ 5 files changed, 130 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/MobileApiController.php b/app/Http/Controllers/MobileApiController.php index 4bbb737..cd97f0b 100644 --- a/app/Http/Controllers/MobileApiController.php +++ b/app/Http/Controllers/MobileApiController.php @@ -166,7 +166,10 @@ class MobileApiController extends Controller $started_at = Carbon::parse($started_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') ->whereBetween('date', [$started_at, $ended_at]) ->pluck('auto_id') @@ -211,12 +214,18 @@ class MobileApiController extends Controller } $availableMarks[$mark->name . '-' . $mark->year] = [ - 'id' => $mark->id, - 'brand' => $brand->name ?? null, - 'mark' => $mark->name, - 'year' => $mark->year, + 'id' => $mark->id, + 'brand' => $brand?->name, + 'mark' => $mark->name, + 'year' => $mark->year, '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 ]; } diff --git a/app/Http/Controllers/Sync1cApiController.php b/app/Http/Controllers/Sync1cApiController.php index d5b8870..03935d2 100644 --- a/app/Http/Controllers/Sync1cApiController.php +++ b/app/Http/Controllers/Sync1cApiController.php @@ -81,7 +81,7 @@ class Sync1cApiController extends Controller ->firstOrCreate(['name' => $value['ВладелецИмущества']])->id, 'is_trust_management' => (bool)$value['ВДоверенномУправлении'], 'owner_percentage' => $value['ПроцентВладельца'], - 'is_inactive' => (bool)$value['НеИспользовать'], + 'is_inactive' => $value['НеИспользовать'] == 'Да', 'is_predefined' => (bool)$value['Предопределенный'], 'predefined_data_name' => $value['ИмяПредопределенныхДанных'], 'inspection_kit' => $inspectionKit, diff --git a/modules/auto/app.json b/modules/auto/app.json index 056a46d..e853336 100644 --- a/modules/auto/app.json +++ b/modules/auto/app.json @@ -183,9 +183,7 @@ } ], "action": { - "head": [ - "add" - ], + "head": [], "row": [ "edit", "delete" diff --git a/modules/brand_models/app.json b/modules/brand_models/app.json index ec1959e..d0484f4 100644 --- a/modules/brand_models/app.json +++ b/modules/brand_models/app.json @@ -16,6 +16,24 @@ "name": { "type": "string" }, + "people": { + "type": "string" + }, + "actuator": { + "type": "string" + }, + "fuel_type": { + "type": "string" + }, + "hp": { + "type": "string" + }, + "engine_capacity": { + "type": "string" + }, + "fuel_tank": { + "type": "string" + }, "year": { "type": "string" }, @@ -289,6 +307,48 @@ "name": "equipment_id", "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", "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": "Объем топливного бака" + } } ] }, diff --git a/modules/brand_models/script.php b/modules/brand_models/script.php index 1cffc99..f8f0c88 100644 --- a/modules/brand_models/script.php +++ b/modules/brand_models/script.php @@ -38,6 +38,17 @@ return new class extends \A7kz\Platform\Commands\InstallScript { $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('Объем топливного бака'); + }); + } } } };