1c api + 4 app

pull/3/head
Rustem 2025-01-02 15:01:31 +05:00
parent 94d703dca6
commit b0f2bcfb58
6 changed files with 268 additions and 1866 deletions

View File

@ -0,0 +1,175 @@
<?php
namespace App\Http\Controllers;
use A7kz\Platform\Models\UniModel;
use A7kz\Platform\Modules\Platform\Segment\Facades\Segment;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class ApiController extends Controller
{
public function syncData(Request $request, $modelName, $validationRules, $extraProcessing = null)
{
try {
DB::beginTransaction();
$validatedData = $request->validate($validationRules);
$segments = Segment::listActive();
foreach ($segments as $segment) {
foreach ($validatedData as $value) {
UniModel::model($modelName, $segment->connector)->updateOrCreate(
['code' => $value['Код']],
array_merge($this->mapAttributes($value), $extraProcessing ? $extraProcessing($value, $segment) : [])
);
}
}
if (isset($extraProcessing)) {
foreach ($validatedData as $value) {
$this->processParentRelation($modelName, $value);
}
}
DB::commit();
return response()->json(['message' => ucfirst($modelName) . ' data synchronized successfully'], 200);
} catch (Exception $e) {
DB::rollBack();
Log::error('Error syncing ' . $modelName . ' data: ' . $e->getMessage());
return response()->json(['error' => 'Failed to synchronize ' . $modelName . ' data'], 500);
}
}
private function mapAttributes($data)
{
return [
'is_group' => (bool)($data['ЭтоГруппа'] ?? false),
'name' => $data['Наименование'] ?? null,
'comments' => $data['Комментарий'] ?? null,
'iin' => $data['ИдентификационныйКодЛичности'] ?? null,
'kbe' => $data['КБЕ'] ?? null,
'okpo_code' => $data['КодПоОКПО'] ?? null,
'main_contact' => $data['ОсновноеКонтактноеЛицо'] ?? null,
'bank_account' => $data['ОсновнойБанковскийСчет'] ?? null,
'address' => $data['Адрес'] ?? null,
'phone' => $data['Телефон'] ?? null,
'mail' => $data['Почта'] ?? null,
'id_number' => $data['УдНомер'] ?? null,
'id_date' => $data['УдДата'] ?? null,
'issued' => $data['УдВыдан'] ?? null,
'contract_id' => $data['ОсновнойДоговор'] ?? null,
'deleted_at' => $data['ПометкаУдаления'] ? now() : null,
];
}
private function processParentRelation($modelName, $data)
{
$model = UniModel::model($modelName)->where('name', $data['Наименование'])->first();
if ($model && !empty($data['Родитель'])) {
$parent = UniModel::model($modelName)->where('name', $data['Родитель'])->first();
if ($parent) {
$model->parent_id = $parent->id;
$model->save();
}
}
}
public function syncAutoData(Request $request)
{
$validationRules = [
'*.Код' => 'required|string',
'*.Наименование' => 'required|string',
'*.Тип' => 'required|string',
'*.Класс' => 'required|string',
'*.Марка' => 'required|string',
'*.Модель' => 'required|string',
'*.Цвет' => 'required|string',
'*.СерийныйНомер' => 'nullable|string',
'*.ГосНомер' => 'nullable|string',
'*.ГодПроизводства' => 'nullable|integer',
'*.НомерТехПаспорта' => 'nullable|string',
'*.ДатаТехпаспорта' => 'nullable|date',
'*.ОценочнаяСтоимость' => 'nullable|numeric',
'*.ВладелецИмущества' => 'required|string',
'*.ВДоверенномУправлении' => 'required|boolean',
'*.ПроцентВладельца' => 'nullable|numeric',
'*.НеИспользовать' => 'required|boolean',
'*.Предопределенный' => 'required|boolean',
'*.ИмяПредопределенныхДанных' => 'nullable|string',
'*.ПометкаУдаления' => 'required|boolean',
];
$extraProcessing = function ($value, $segment) {
return [
'type_id' => UniModel::model('pipi_auto_types', $segment->connector)
->firstOrCreate(['name' => $value['Тип']])->id,
'class_id' => UniModel::model('pipi_auto_classes', $segment->connector)
->firstOrCreate(['name' => $value['Класс']])->id,
'brand_id' => UniModel::model('pipi_auto_brands', $segment->connector)
->firstOrCreate(['name' => $value['Марка']])->id,
'model_id' => UniModel::model('pipi_brand_models', $segment->connector)
->firstOrCreate([
'name' => $value['Модель'],
'brand_id' => UniModel::model('pipi_auto_brands', $segment->connector)
->firstOrCreate(['name' => $value['Марка']])->id,
])->id,
'color_id' => UniModel::model('pipi_auto_colors', $segment->connector)
->firstOrCreate(['name' => $value['Цвет']])->id,
'owner_id' => UniModel::model('pipi_owners', $segment->connector)
->firstOrCreate(['name' => $value['ВладелецИмущества']])->id,
];
};
return $this->syncData($request, 'pipi_auto', $validationRules, $extraProcessing);
}
public function syncOwners(Request $request)
{
$validationRules = [
'*.Код' => 'required|string',
'*.Наименование' => 'required|string',
'*.Комментарий' => 'nullable|string',
'*.ИдентификационныйКодЛичности' => 'nullable|string',
'*.КБЕ' => 'nullable|string',
'*.КодПоОКПО' => 'nullable|string',
'*.ОсновноеКонтактноеЛицо' => 'nullable|string',
'*.ОсновнойБанковскийСчет' => 'nullable|string',
'*.Адрес' => 'nullable|string',
'*.Телефон' => 'nullable|string',
'*.Почта' => 'nullable|string',
'*.УдНомер' => 'nullable|string',
'*.УдДата' => 'nullable|date',
'*.УдВыдан' => 'nullable|string',
'*.ОсновнойДоговор' => 'nullable|string',
'*.ЭтоГруппа' => 'required|boolean',
'*.ПометкаУдаления' => 'required|boolean',
'*.Родитель' => 'nullable|string',
];
return $this->syncData($request, 'pipi_owners', $validationRules);
}
public function syncOwnerContracts(Request $request)
{
$validationRules = [
'*.Код' => 'required|string',
'*.Наименование' => 'required|string',
'*.Комментарий' => 'nullable|string',
'*.Организация' => 'nullable|string',
'*.НомерДоговора' => 'required|string',
'*.ДатаДоговора' => 'nullable|date',
'*.ДатаНачалаДействияДоговора' => 'nullable|date',
'*.ДатаОкончанияДействияДоговора' => 'nullable|date',
'*.УсловияОплаты' => 'nullable|string',
'*.ЭтоГруппа' => 'required|boolean',
'*.ПометкаУдаления' => 'required|boolean',
'*.Родитель' => 'nullable|string',
];
return $this->syncData($request, 'pipi_owner_contracts', $validationRules);
}
}

View File

@ -1,258 +1,52 @@
{ {
"module": "pipicar", "module": "pipicar",
"name": "pipicar.auto", "name": "pipicar.auto_brands",
"type": "crud", "type": "crud",
"title": "Автомобили", "title": "Бренды Автомобилей",
"data": { "data": {
"table": "auto", "table": "pipi_auto_brands",
"pk": "id", "pk": "id",
"limit": 25, "limit": 25,
"sort_order": "asc",
"sort_field": "code",
"segment": true, "segment": true,
"timestamp": false, "timestamp": false,
"fields": { "fields": {
"id": { "id": {
"type": "pk" "type": "pk"
}, },
"code": { "name": {
"type": "string", "type": "string"
"validation": "required"
},
"name_ru": {
"type": "text"
},
"name_kz": {
"type": "text"
},
"account_type": {
"type": "foreign",
"table": "ref_base_group",
"foreign": "id",
"display": [
"data_name_{lk}"
],
"where": "data_type = 'T01'"
},
"article_source": {
"type": "string",
"validation": "nullable"
},
"element_source": {
"type": "string",
"validation": "nullable"
},
"mo_num": {
"type": "int",
"validation": "nullable|integer"
},
"used_by_documents": {
"type": "bool",
"validation": "nullable"
},
"used_by_system": {
"type": "bool",
"validation": "nullable"
},
"type_of_organization": {
"type": "foreign",
"table": "ref_property_types",
"foreign": "id",
"display": [
"value",
"name"
],
"validation": "nullable|int",
"label": "Тип собственности"
},
"accounts_plan_part": {
"type": "foreign",
"table": "ref_accounts_plan_part",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "nullable|string",
"label": "Раздел плана счетов"
},
"accounts_plan_particle": {
"type": "foreign",
"table": "ref_accounts_plan_particle",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "required|string",
"label": "Подраздел плана счетов"
},
"started_at": {
"type": "date",
"validation": "required|date"
},
"ended_at": {
"type": "date",
"validation": "nullable|date"
},
"whitespace": {
"type": "virtual"
} }
} }
}, },
"ui": { "ui": {
"grid": { "grid": {
"title": "План счетов", "title": "Бренды Автомобилей",
"template": "app.base.crud.grid", "template": "app.base.crud.grid",
"cols": [ "cols": [
{ {
"name": "code", "name": "name",
"caption": "Счёт" "caption": "Название бренда"
},
{
"name": "name_kz",
"caption": "Наименование на казахском"
},
{
"name": "name_ru",
"caption": "Наименование на русском"
},
{
"name": "account_type",
"caption": "Тип счёта"
},
{
"name": "used_by_documents",
"caption": "Исп. в первич. док-тах"
},
{
"name": "used_by_system",
"caption": "Исп. системой"
},
{
"name": "accounts_plan_particle",
"caption": "Подраздел плана счетов"
},
{
"name": "type_of_organization",
"caption": "Тип плана счетов"
},
{
"name": "started_at",
"caption": "Дата начала действия"
},
{
"name": "ended_at",
"caption": "Дата окончания действия"
},
{
"name": "id",
"caption": "ИД"
} }
], ],
"action": { "action": {
"head": [ "head": [
"add" "add"
],
"row": [
"edit",
"delete"
] ]
}, },
"filter": { "filter": {
"template": "app.base.crud.filter", "template": "app.base.crud.filter",
"rows": [ "rows": [
{
"cols": [
{
"size": 1,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 3,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 1,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 1,
"input": {
"name": "id",
"label": "ИД"
}
},
{
"size": 3,
"input": {
"name": "used_by_documents",
"label": "Исп. только в первич. документах"
}
},
{
"size": 3,
"input": {
"name": "used_by_system",
"label": "Исп. только системой"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 6, "size": 6,
"input": { "input": {
"name": "name_kz", "name": "name",
"label": "Наименование на казахском" "label": "Название бренда"
}
},
{
"size": 6,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "type_of_organization",
"label": "Тип плана счетов"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
} }
} }
] ]
@ -262,137 +56,18 @@
}, },
"forms": { "forms": {
"add": { "add": {
"title": "Добавление записи в справочник \"План счетов\"", "title": "Добавление бренда",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [ "submits": "struct:crud.form.edit.submits",
"Js.Refs.AccountsPlan"
],
"submits": "struct:accounting.form.edit.submits",
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название бренда"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
@ -401,142 +76,23 @@
} }
}, },
"edit": { "edit": {
"title": "Редактирование записи в справочнике \"План счетов\"", "title": "Редактирование бренда",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [
"Js.Refs.AccountsPlan"
],
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название бренда"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
} }
], ],
"submits": "struct:accounting.form.edit.submits" "submits": "struct:crud.form.edit.submits"
} }
} }
} }

View File

@ -1,258 +1,52 @@
{ {
"module": "pipicar", "module": "pipicar",
"name": "pipicar.auto", "name": "pipicar.auto_classes",
"type": "crud", "type": "crud",
"title": "Автомобили", "title": "Классы автомобилей",
"data": { "data": {
"table": "auto", "table": "pipi_auto_classes",
"pk": "id", "pk": "id",
"limit": 25, "limit": 25,
"sort_order": "asc",
"sort_field": "code",
"segment": true, "segment": true,
"timestamp": false, "timestamp": false,
"fields": { "fields": {
"id": { "id": {
"type": "pk" "type": "pk"
}, },
"code": { "name": {
"type": "string", "type": "string"
"validation": "required"
},
"name_ru": {
"type": "text"
},
"name_kz": {
"type": "text"
},
"account_type": {
"type": "foreign",
"table": "ref_base_group",
"foreign": "id",
"display": [
"data_name_{lk}"
],
"where": "data_type = 'T01'"
},
"article_source": {
"type": "string",
"validation": "nullable"
},
"element_source": {
"type": "string",
"validation": "nullable"
},
"mo_num": {
"type": "int",
"validation": "nullable|integer"
},
"used_by_documents": {
"type": "bool",
"validation": "nullable"
},
"used_by_system": {
"type": "bool",
"validation": "nullable"
},
"type_of_organization": {
"type": "foreign",
"table": "ref_property_types",
"foreign": "id",
"display": [
"value",
"name"
],
"validation": "nullable|int",
"label": "Тип собственности"
},
"accounts_plan_part": {
"type": "foreign",
"table": "ref_accounts_plan_part",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "nullable|string",
"label": "Раздел плана счетов"
},
"accounts_plan_particle": {
"type": "foreign",
"table": "ref_accounts_plan_particle",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "required|string",
"label": "Подраздел плана счетов"
},
"started_at": {
"type": "date",
"validation": "required|date"
},
"ended_at": {
"type": "date",
"validation": "nullable|date"
},
"whitespace": {
"type": "virtual"
} }
} }
}, },
"ui": { "ui": {
"grid": { "grid": {
"title": "План счетов", "title": "Классы автомобилей",
"template": "app.base.crud.grid", "template": "app.base.crud.grid",
"cols": [ "cols": [
{ {
"name": "code", "name": "name",
"caption": "Счёт" "caption": "Название класса"
},
{
"name": "name_kz",
"caption": "Наименование на казахском"
},
{
"name": "name_ru",
"caption": "Наименование на русском"
},
{
"name": "account_type",
"caption": "Тип счёта"
},
{
"name": "used_by_documents",
"caption": "Исп. в первич. док-тах"
},
{
"name": "used_by_system",
"caption": "Исп. системой"
},
{
"name": "accounts_plan_particle",
"caption": "Подраздел плана счетов"
},
{
"name": "type_of_organization",
"caption": "Тип плана счетов"
},
{
"name": "started_at",
"caption": "Дата начала действия"
},
{
"name": "ended_at",
"caption": "Дата окончания действия"
},
{
"name": "id",
"caption": "ИД"
} }
], ],
"action": { "action": {
"head": [ "head": [
"add" "add"
],
"row": [
"edit",
"delete"
] ]
}, },
"filter": { "filter": {
"template": "app.base.crud.filter", "template": "app.base.crud.filter",
"rows": [ "rows": [
{
"cols": [
{
"size": 1,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 3,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 1,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 1,
"input": {
"name": "id",
"label": "ИД"
}
},
{
"size": 3,
"input": {
"name": "used_by_documents",
"label": "Исп. только в первич. документах"
}
},
{
"size": 3,
"input": {
"name": "used_by_system",
"label": "Исп. только системой"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 6, "size": 6,
"input": { "input": {
"name": "name_kz", "name": "name",
"label": "Наименование на казахском" "label": "Название класса"
}
},
{
"size": 6,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "type_of_organization",
"label": "Тип плана счетов"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
} }
} }
] ]
@ -262,137 +56,18 @@
}, },
"forms": { "forms": {
"add": { "add": {
"title": "Добавление записи в справочник \"План счетов\"", "title": "Добавление класса",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [ "submits": "struct:crud.form.edit.submits",
"Js.Refs.AccountsPlan"
],
"submits": "struct:accounting.form.edit.submits",
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название класса"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
@ -401,142 +76,23 @@
} }
}, },
"edit": { "edit": {
"title": "Редактирование записи в справочнике \"План счетов\"", "title": "Редактирование класса",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [
"Js.Refs.AccountsPlan"
],
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название класса"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
} }
], ],
"submits": "struct:accounting.form.edit.submits" "submits": "struct:crud.form.edit.submits"
} }
} }
} }

View File

@ -1,258 +1,52 @@
{ {
"module": "pipicar", "module": "pipicar",
"name": "pipicar.auto", "name": "pipicar.auto_colors",
"type": "crud", "type": "crud",
"title": "Автомобили", "title": "Цвета Автомобилей",
"data": { "data": {
"table": "auto", "table": "pipi_auto_colors",
"pk": "id", "pk": "id",
"limit": 25, "limit": 25,
"sort_order": "asc",
"sort_field": "code",
"segment": true, "segment": true,
"timestamp": false, "timestamp": false,
"fields": { "fields": {
"id": { "id": {
"type": "pk" "type": "pk"
}, },
"code": { "name": {
"type": "string", "type": "string"
"validation": "required"
},
"name_ru": {
"type": "text"
},
"name_kz": {
"type": "text"
},
"account_type": {
"type": "foreign",
"table": "ref_base_group",
"foreign": "id",
"display": [
"data_name_{lk}"
],
"where": "data_type = 'T01'"
},
"article_source": {
"type": "string",
"validation": "nullable"
},
"element_source": {
"type": "string",
"validation": "nullable"
},
"mo_num": {
"type": "int",
"validation": "nullable|integer"
},
"used_by_documents": {
"type": "bool",
"validation": "nullable"
},
"used_by_system": {
"type": "bool",
"validation": "nullable"
},
"type_of_organization": {
"type": "foreign",
"table": "ref_property_types",
"foreign": "id",
"display": [
"value",
"name"
],
"validation": "nullable|int",
"label": "Тип собственности"
},
"accounts_plan_part": {
"type": "foreign",
"table": "ref_accounts_plan_part",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "nullable|string",
"label": "Раздел плана счетов"
},
"accounts_plan_particle": {
"type": "foreign",
"table": "ref_accounts_plan_particle",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "required|string",
"label": "Подраздел плана счетов"
},
"started_at": {
"type": "date",
"validation": "required|date"
},
"ended_at": {
"type": "date",
"validation": "nullable|date"
},
"whitespace": {
"type": "virtual"
} }
} }
}, },
"ui": { "ui": {
"grid": { "grid": {
"title": "План счетов", "title": "Цвета Автомобилей",
"template": "app.base.crud.grid", "template": "app.base.crud.grid",
"cols": [ "cols": [
{ {
"name": "code", "name": "name",
"caption": "Счёт" "caption": "Название цвета"
},
{
"name": "name_kz",
"caption": "Наименование на казахском"
},
{
"name": "name_ru",
"caption": "Наименование на русском"
},
{
"name": "account_type",
"caption": "Тип счёта"
},
{
"name": "used_by_documents",
"caption": "Исп. в первич. док-тах"
},
{
"name": "used_by_system",
"caption": "Исп. системой"
},
{
"name": "accounts_plan_particle",
"caption": "Подраздел плана счетов"
},
{
"name": "type_of_organization",
"caption": "Тип плана счетов"
},
{
"name": "started_at",
"caption": "Дата начала действия"
},
{
"name": "ended_at",
"caption": "Дата окончания действия"
},
{
"name": "id",
"caption": "ИД"
} }
], ],
"action": { "action": {
"head": [ "head": [
"add" "add"
],
"row": [
"edit",
"delete"
] ]
}, },
"filter": { "filter": {
"template": "app.base.crud.filter", "template": "app.base.crud.filter",
"rows": [ "rows": [
{
"cols": [
{
"size": 1,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 3,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 1,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 1,
"input": {
"name": "id",
"label": "ИД"
}
},
{
"size": 3,
"input": {
"name": "used_by_documents",
"label": "Исп. только в первич. документах"
}
},
{
"size": 3,
"input": {
"name": "used_by_system",
"label": "Исп. только системой"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 6, "size": 6,
"input": { "input": {
"name": "name_kz", "name": "name",
"label": "Наименование на казахском" "label": "Название цвета"
}
},
{
"size": 6,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "type_of_organization",
"label": "Тип плана счетов"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
} }
} }
] ]
@ -262,137 +56,18 @@
}, },
"forms": { "forms": {
"add": { "add": {
"title": "Добавление записи в справочник \"План счетов\"", "title": "Добавление цвета",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [ "submits": "struct:crud.form.edit.submits",
"Js.Refs.AccountsPlan"
],
"submits": "struct:accounting.form.edit.submits",
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
@ -401,142 +76,23 @@
} }
}, },
"edit": { "edit": {
"title": "Редактирование записи в справочнике \"План счетов\"", "title": "Редактирование цвета",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [
"Js.Refs.AccountsPlan"
],
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
} }
], ],
"submits": "struct:accounting.form.edit.submits" "submits": "struct:crud.form.edit.submits"
} }
} }
} }

View File

@ -1,258 +1,52 @@
{ {
"module": "pipicar", "module": "pipicar",
"name": "pipicar.auto", "name": "pipicar.auto_types",
"type": "crud", "type": "crud",
"title": "Автомобили", "title": "Типы Автомобилей",
"data": { "data": {
"table": "auto", "table": "pipi_auto_types",
"pk": "id", "pk": "id",
"limit": 25, "limit": 25,
"sort_order": "asc",
"sort_field": "code",
"segment": true, "segment": true,
"timestamp": false, "timestamp": false,
"fields": { "fields": {
"id": { "id": {
"type": "pk" "type": "pk"
}, },
"code": { "name": {
"type": "string", "type": "string"
"validation": "required"
},
"name_ru": {
"type": "text"
},
"name_kz": {
"type": "text"
},
"account_type": {
"type": "foreign",
"table": "ref_base_group",
"foreign": "id",
"display": [
"data_name_{lk}"
],
"where": "data_type = 'T01'"
},
"article_source": {
"type": "string",
"validation": "nullable"
},
"element_source": {
"type": "string",
"validation": "nullable"
},
"mo_num": {
"type": "int",
"validation": "nullable|integer"
},
"used_by_documents": {
"type": "bool",
"validation": "nullable"
},
"used_by_system": {
"type": "bool",
"validation": "nullable"
},
"type_of_organization": {
"type": "foreign",
"table": "ref_property_types",
"foreign": "id",
"display": [
"value",
"name"
],
"validation": "nullable|int",
"label": "Тип собственности"
},
"accounts_plan_part": {
"type": "foreign",
"table": "ref_accounts_plan_part",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "nullable|string",
"label": "Раздел плана счетов"
},
"accounts_plan_particle": {
"type": "foreign",
"table": "ref_accounts_plan_particle",
"foreign": "id",
"display": [
"code",
"name_{lk}"
],
"validation": "required|string",
"label": "Подраздел плана счетов"
},
"started_at": {
"type": "date",
"validation": "required|date"
},
"ended_at": {
"type": "date",
"validation": "nullable|date"
},
"whitespace": {
"type": "virtual"
} }
} }
}, },
"ui": { "ui": {
"grid": { "grid": {
"title": "План счетов", "title": "Типы Автомобилей",
"template": "app.base.crud.grid", "template": "app.base.crud.grid",
"cols": [ "cols": [
{ {
"name": "code", "name": "name",
"caption": "Счёт" "caption": "Название типа"
},
{
"name": "name_kz",
"caption": "Наименование на казахском"
},
{
"name": "name_ru",
"caption": "Наименование на русском"
},
{
"name": "account_type",
"caption": "Тип счёта"
},
{
"name": "used_by_documents",
"caption": "Исп. в первич. док-тах"
},
{
"name": "used_by_system",
"caption": "Исп. системой"
},
{
"name": "accounts_plan_particle",
"caption": "Подраздел плана счетов"
},
{
"name": "type_of_organization",
"caption": "Тип плана счетов"
},
{
"name": "started_at",
"caption": "Дата начала действия"
},
{
"name": "ended_at",
"caption": "Дата окончания действия"
},
{
"name": "id",
"caption": "ИД"
} }
], ],
"action": { "action": {
"head": [ "head": [
"add" "add"
],
"row": [
"edit",
"delete"
] ]
}, },
"filter": { "filter": {
"template": "app.base.crud.filter", "template": "app.base.crud.filter",
"rows": [ "rows": [
{
"cols": [
{
"size": 1,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 3,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 1,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 1,
"input": {
"name": "id",
"label": "ИД"
}
},
{
"size": 3,
"input": {
"name": "used_by_documents",
"label": "Исп. только в первич. документах"
}
},
{
"size": 3,
"input": {
"name": "used_by_system",
"label": "Исп. только системой"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 6, "size": 6,
"input": { "input": {
"name": "name_kz", "name": "name",
"label": "Наименование на казахском" "label": "Название типа"
}
},
{
"size": 6,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов"
}
},
{
"size": 4,
"input": {
"name": "type_of_organization",
"label": "Тип плана счетов"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
} }
} }
] ]
@ -262,137 +56,18 @@
}, },
"forms": { "forms": {
"add": { "add": {
"title": "Добавление записи в справочник \"План счетов\"", "title": "Добавление типа",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [ "submits": "struct:crud.form.edit.submits",
"Js.Refs.AccountsPlan"
],
"submits": "struct:accounting.form.edit.submits",
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название типа"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
@ -401,142 +76,23 @@
} }
}, },
"edit": { "edit": {
"title": "Редактирование записи в справочнике \"План счетов\"", "title": "Редактирование типа",
"template": "app.base.crud.form", "template": "app.base.crud.form",
"form": { "form": {
"inject_component": [
"Js.Refs.AccountsPlan"
],
"rows": [ "rows": [
{
"cols": [
{
"size": 2,
"input": {
"name": "code",
"label": "Cчёт"
}
},
{
"size": 2,
"input": {
"name": "mo_num",
"label": "МО №"
}
},
{
"size": 4,
"input": {
"name": "started_at",
"label": "Дата начала действия"
}
},
{
"size": 4,
"input": {
"name": "ended_at",
"label": "Дата окончания действия"
}
}
]
},
{ {
"cols": [ "cols": [
{ {
"size": 12, "size": 12,
"input": { "input": {
"name": "type_of_organization", "name": "name",
"label": "Тип плана счетов", "label": "Название типа"
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_part",
"label": "Раздел плана счетов",
"readonly": true
}
},
{
"size": 12,
"input": {
"name": "accounts_plan_particle",
"label": "Подраздел плана счетов",
"js_event": {
"onchange": "accountPlanParticleChange"
}
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "name_kz",
"label": "Наименование на казахском"
}
},
{
"size": 12,
"input": {
"name": "name_ru",
"label": "Наименование на русском"
}
}
]
},
{
"cols": [
{
"size": 4,
"input": {
"name": "account_type",
"label": "Тип счёта"
}
},
{
"size": 12,
"input": {
"name": "article_source",
"label": "Источник статьи"
}
},
{
"size": 12,
"input": {
"name": "element_source",
"label": "Источник элемента"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_documents",
"label": "Используется только в первичных документах"
}
}
]
},
{
"cols": [
{
"size": 12,
"input": {
"name": "used_by_system",
"label": "Используется только системой"
} }
} }
] ]
} }
], ],
"submits": "struct:accounting.form.edit.submits" "submits": "struct:crud.form.edit.submits"
} }
} }
} }

View File

@ -13,7 +13,10 @@ use Illuminate\Support\Facades\Route;
| be assigned to the "api" middleware group. Make something great! | be assigned to the "api" middleware group. Make something great!
| |
*/ */
use App\Http\Controllers\ApiController;
Route::middleware('auth:sanctum')->get('/user', function (Request $request) { Route::prefix('1c')->group(function () {
return $request->user(); Route::post('syncAutoData', [ApiController::class, 'syncAutoData']);
Route::post('syncOwners', [ApiController::class, 'syncOwners']);
Route::post('syncOwnerContracts', [ApiController::class, 'syncOwnerContracts']);
}); });