Кузовы
parent
384de527c6
commit
57eedf2cd4
|
|
@ -25,6 +25,7 @@ class PipiCarInstallCommands extends InstallCommand
|
|||
$this->packages = [
|
||||
'main', // Главная страница
|
||||
'auto_brands', // Бренд авто
|
||||
'auto_bodywork', // Кузов авто
|
||||
'auto_colors', // Цвета авто
|
||||
'auto_types', // Типы авто
|
||||
'auto_equipment', // Комплектация авто
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ class MobileApiController extends Controller
|
|||
$started_at = $request->query('started_at');
|
||||
$ended_at = $request->query('ended_at');
|
||||
$class = $request->query('class');
|
||||
$bodywork = $request->query('bodywork');
|
||||
|
||||
$marks = UniModel::model('pipi_brand_models')->get();
|
||||
$availableMarks = [];
|
||||
|
|
@ -195,6 +196,10 @@ class MobileApiController extends Controller
|
|||
$class_id = UniModel::model('pipi_auto_classes')->where('name', $class)->first()->id;
|
||||
$marks = $marks->where('class_id', $class_id);
|
||||
}
|
||||
if ($bodywork) {
|
||||
$bodywork_id = UniModel::model('pipi_auto_bodywork')->where('name', $bodywork)->first()->id;
|
||||
$marks = $marks->where('bodywork_id', $bodywork_id);
|
||||
}
|
||||
foreach ($marks as $mark) {
|
||||
if ($mark->name === 'Ввод остатков') {
|
||||
continue;
|
||||
|
|
@ -207,6 +212,8 @@ class MobileApiController extends Controller
|
|||
$brand = UniModel::model('pipi_auto_brands')->find($mark->brand_id);
|
||||
$tariffs = UniModel::model('pipi_auto_tariffs')->where('model_id', $mark->id)->get();
|
||||
$equipment = UniModel::model('pipi_auto_equipment')->where('id', $mark->equipment_id)->first();
|
||||
$class = UniModel::model('pipi_auto_classes')->find($mark->class_id);
|
||||
$bodywork = UniModel::model('pipi_auto_classes')->find($mark->bodywork_id);
|
||||
|
||||
$path = null;
|
||||
if ($mark?->photo_id) {
|
||||
|
|
@ -234,6 +241,8 @@ class MobileApiController extends Controller
|
|||
'hp' => $mark?->hp ?? '1.6',
|
||||
'engine_capacity' => $mark?->engine_capacity ?? '1591',
|
||||
'fuel_tank' => $mark?->fuel_tank ?? '50',
|
||||
'class' => $class->name ?? 'Эконом',
|
||||
'bodywork' => $class->name ?? 'Седан',
|
||||
'conditioner' => $mark?->conditioner,
|
||||
'photo' => $path,
|
||||
'tariffs' => $tariffs_new
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"admin": [
|
||||
"default",
|
||||
"add",
|
||||
"show",
|
||||
"edit",
|
||||
"delete"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"module": "pipicar",
|
||||
"name": "pipicar.auto_bodywork",
|
||||
"type": "crud",
|
||||
"title": "Классы автомобилей",
|
||||
"withHeader": false,
|
||||
"data": {
|
||||
"table": "pipi_auto_bodywork",
|
||||
"pk": "id",
|
||||
"limit": 25,
|
||||
"segment": true,
|
||||
"timestamp": false,
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "pk"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ui": {
|
||||
"grid": {
|
||||
"title": "Кузовы автомобилей",
|
||||
"component": "App.components.Grid",
|
||||
"cols": [
|
||||
{
|
||||
"name": "name",
|
||||
"caption": "Название кузова"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"head": [],
|
||||
"row": [
|
||||
"edit",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
"filter": {
|
||||
"template": "app.base.crud.filter",
|
||||
"rows": [
|
||||
{
|
||||
"cols": [
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "name",
|
||||
"label": "Название кузова"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"forms": {
|
||||
"add": {
|
||||
"title": "Добавление кузова",
|
||||
"template": "app.base.crud.form",
|
||||
"component": "App.components.Show",
|
||||
"form": {
|
||||
"submits": "struct:crud.form.edit.submits",
|
||||
"rows": [
|
||||
{
|
||||
"cols": [
|
||||
{
|
||||
"size": 12,
|
||||
"input": {
|
||||
"name": "name",
|
||||
"label": "Название кузова"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"edit": {
|
||||
"title": "Редактирование кузова",
|
||||
"template": "app.base.crud.form",
|
||||
"component": "App.components.Show",
|
||||
"form": {
|
||||
"rows": [
|
||||
{
|
||||
"cols": [
|
||||
{
|
||||
"size": 12,
|
||||
"input": {
|
||||
"name": "name",
|
||||
"label": "Название кузова"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"submits": "struct:crud.form.edit.submits"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": "struct:crud.actions"
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
use A7kz\Platform\Modules\Platform\Segment\Facades\Segment;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$segments = Segment::listActive();
|
||||
foreach ($segments as $segment) {
|
||||
Schema::connection($segment->connector)->create('pipi_auto_bodywork', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable()->comment('Наименование');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use A7kz\Platform\Models\UniModel;
|
||||
use A7kz\Platform\Modules\Platform\Core\Facades\Core;
|
||||
use A7kz\Platform\Modules\Platform\Segment\Facades\Segment;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use \A7kz\Platform\Commands\InstallScript;
|
||||
|
||||
return new class extends \A7kz\Platform\Commands\InstallScript {
|
||||
|
||||
public function install($module_name, $module_version)
|
||||
{
|
||||
}
|
||||
|
||||
public function update($module_name, $module_version): void
|
||||
{
|
||||
$this->upgrade();
|
||||
}
|
||||
|
||||
private function upgrade(): void
|
||||
{
|
||||
$segments = Segment::listActive();
|
||||
foreach ($segments as $segment) {
|
||||
if (!Schema::connection($segment->connector)->hasTable('pipi_auto_bodywork')) {
|
||||
Schema::connection($segment->connector)->create('pipi_auto_bodywork', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable()->comment('Наименование');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -67,6 +67,11 @@ return new class extends \A7kz\Platform\Commands\InstallScript {
|
|||
$table->unsignedBigInteger('photo_id')->nullable()->comment('Фото');
|
||||
});
|
||||
}
|
||||
if (!Schema::connection($segment->connector)->hasColumn('pipi_brand_models', 'bodywork_id')) {
|
||||
Schema::connection($segment->connector)->table('pipi_brand_models', function ($table) {
|
||||
$table->unsignedBigInteger('bodywork_id')->nullable()->comment('Кузов');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue