master
parent
c18348a43d
commit
3eea63b147
|
|
@ -38,7 +38,8 @@ class PipiCarInstallCommands extends InstallCommand
|
|||
'auto', // авто
|
||||
'applications', //Заявки
|
||||
'pipi_users', // Добавление логики для пользователей
|
||||
'auto_calendar' // Добавление логики для пользователей
|
||||
'auto_calendar', // Добавление логики для пользователей
|
||||
'faq' // FAQ
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -474,4 +474,52 @@ class MobileApiController extends Controller
|
|||
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function getFAQCategory(): JsonResponse
|
||||
{
|
||||
$faqs = UniModel::model('pipi_faq')->distinct('category')->get();
|
||||
$data = [];
|
||||
foreach ($faqs as $faq) {
|
||||
$data[] = $faq->category;
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
$data = (object) [];
|
||||
}
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
public function getFAQSubCategory(Request $request): JsonResponse
|
||||
{
|
||||
$category = $request->query('category');
|
||||
|
||||
$query = UniModel::model('pipi_faq');
|
||||
if (isset($category)) {
|
||||
$query->where('category', $category);
|
||||
}
|
||||
$faqs = $query->distinct('subcategory')->get();
|
||||
$data = [];
|
||||
foreach ($faqs as $faq) {
|
||||
$data[] = $faq->subcategory;
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
$data = (object) [];
|
||||
}
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
public function getFAQText(Request $request): JsonResponse
|
||||
{
|
||||
$subcategory = $request->query('subcategory');
|
||||
|
||||
$query = UniModel::model('pipi_faq');
|
||||
if (isset($subcategory)) {
|
||||
$query->where('subcategory', $subcategory);
|
||||
}
|
||||
$text = $query->first()->text;
|
||||
|
||||
|
||||
return response()->json($text);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"admin": [
|
||||
"default",
|
||||
"add",
|
||||
"show",
|
||||
"edit",
|
||||
"delete"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
{
|
||||
"module": "pipicar",
|
||||
"name": "pipicar.faq",
|
||||
"type": "crud",
|
||||
"title": "FAQ",
|
||||
"withHeader": false,
|
||||
"data": {
|
||||
"table": "pipi_faq",
|
||||
"pk": "id",
|
||||
"limit": 25,
|
||||
"segment": true,
|
||||
"timestamp": false,
|
||||
"fields": {
|
||||
"id": {
|
||||
"type": "pk"
|
||||
},
|
||||
"text": {
|
||||
"type": "text"
|
||||
},
|
||||
"category": {
|
||||
"type": "string"
|
||||
},
|
||||
"subcategory": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ui": {
|
||||
"grid": {
|
||||
"title": "FAQ",
|
||||
"component": "App.components.Grid",
|
||||
"cols": [
|
||||
{
|
||||
"name": "category",
|
||||
"caption": "Категория"
|
||||
},
|
||||
{
|
||||
"name": "subcategory",
|
||||
"caption": "Подкатегория"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"head": [
|
||||
"add"
|
||||
],
|
||||
"row": [
|
||||
"edit",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
"filter": {
|
||||
"template": "app.base.crud.filter",
|
||||
"rows": [
|
||||
{
|
||||
"cols": [
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "category",
|
||||
"label": "Категория"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "subcategory",
|
||||
"label": "Подкатегория"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"forms": {
|
||||
"add": {
|
||||
"title": "FAQ",
|
||||
"template": "app.base.crud.form",
|
||||
"component": "App.components.Show",
|
||||
"form": {
|
||||
"submits": "struct:crud.form.edit.submits",
|
||||
"rows": [
|
||||
{
|
||||
"cols": [
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "category",
|
||||
"label": "Категория"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "subcategory",
|
||||
"label": "Подкатегория"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 12,
|
||||
"input": {
|
||||
"name": "text",
|
||||
"label": "Текст"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"edit": {
|
||||
"title": "Редактирование типа",
|
||||
"template": "app.base.crud.form",
|
||||
"component": "App.components.Show",
|
||||
"form": {
|
||||
"rows": [
|
||||
{
|
||||
"cols": [
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "category",
|
||||
"label": "Категория"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 6,
|
||||
"input": {
|
||||
"name": "subcategory",
|
||||
"label": "Подкатегория"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 12,
|
||||
"input": {
|
||||
"name": "text",
|
||||
"label": "Текст"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"submits": "struct:crud.form.edit.submits"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": "struct:crud.actions"
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?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_faq', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->longText('text')->nullable()->comment('Текст');
|
||||
$table->string('category')->nullable()->comment('Категория');
|
||||
$table->string('subcategory')->nullable()->comment('Подкатегория');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?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_faq')) {
|
||||
Schema::connection($segment->connector)->create('pipi_faq', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->longText('text')->nullable()->comment('Текст');
|
||||
$table->string('category')->nullable()->comment('Категория');
|
||||
$table->string('subcategory')->nullable()->comment('Подкатегория');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -26,6 +26,9 @@ Route::prefix('1c')->group(function () {
|
|||
|
||||
Route::prefix('mobile')->group(function () {
|
||||
Route::get('getMarks', [MobileApiController::class, 'getMarks']);
|
||||
Route::get('getFAQCategory', [MobileApiController::class, 'getFAQCategory']);
|
||||
Route::get('getFAQSubCategory', [MobileApiController::class, 'getFAQSubCategory']);
|
||||
Route::get('getFAQText', [MobileApiController::class, 'getFAQText']);
|
||||
Route::get('getAddress', [MobileApiController::class, 'getAddress']);
|
||||
Route::get('getAvailableMarksList', [MobileApiController::class, 'getAvailableMarksList']);
|
||||
Route::post('checkAvailableCar', [MobileApiController::class, 'checkAvailableCar']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue