registries gamma
parent
c4321fe7b1
commit
a7ff21f2f6
|
|
@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
||||||
use App\Models\Pages\Page;
|
use App\Models\Pages\Page;
|
||||||
use App\Models\Publications\Publication;
|
use App\Models\Publications\Publication;
|
||||||
use App\Transformers\Publications\PublicationTransformer;
|
use App\Transformers\Publications\PublicationTransformer;
|
||||||
|
use App\Transformers\Registries\RegistryTransformer;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
@ -32,8 +33,8 @@ class PublicationsController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(Request $request, $id): JsonResponse {
|
public function show(Request $request, $id): JsonResponse {
|
||||||
$model = $this->model->bySlug($id)->firstOrFail();
|
$model = $this->model->ByUuid($id)->firstOrFail();
|
||||||
return fractal($model, new PublicationTransformer())->respond();
|
return fractal($model, new RegistryTransformer())->respond();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\Registries;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Registries\Category;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
|
use App\Transformers\Registries\CategoryTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CategoriesController extends Controller {
|
||||||
|
protected Category $model;
|
||||||
|
|
||||||
|
public function __construct(Category $model) {
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request): JsonResponse {
|
||||||
|
$registry = Registry::byUuid($request->get('registry'))->first();
|
||||||
|
$parent = Category::byUuid($request->get('parent'))->first();
|
||||||
|
$query = $this->model->query()->where(['registry_id' => $registry->id ?? 0, 'parent_id' => $parent->id ?? 0]);
|
||||||
|
$paginator = $query->paginate(config('app.pagination_limit'));
|
||||||
|
return fractal($paginator, new CategoryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Request $request, $id): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($id)->firstOrFail();
|
||||||
|
return fractal($model, new CategoryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $uuid): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, $uuid): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($uuid)->firstOrFail();
|
||||||
|
$model->delete();
|
||||||
|
return response()->json(null, 204);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\Registries;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Registries\Category;
|
||||||
|
use App\Models\Registries\Entry;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
|
use App\Transformers\Registries\EntryTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EntriesController extends Controller {
|
||||||
|
protected Entry $model;
|
||||||
|
|
||||||
|
public function __construct(Entry $model) {
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request): JsonResponse {
|
||||||
|
$registry = Registry::byUuid($request->get('registry'))->first();
|
||||||
|
$category = Category::byUuid($request->get('category'))->first();
|
||||||
|
$query = $this->model->query()->where(['registry_id' => $registry->id ?? 0, 'category_id' => $category->id ?? 0]);
|
||||||
|
$paginator = $query->paginate(config('app.pagination_limit'));
|
||||||
|
return fractal($paginator, new EntryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Request $request, $id): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($id)->firstOrFail();
|
||||||
|
return fractal($model, new EntryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $uuid): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, $uuid): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($uuid)->firstOrFail();
|
||||||
|
$model->delete();
|
||||||
|
return response()->json(null, 204);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\Registries;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Objects\NirObject;
|
||||||
|
use App\Models\Registries\Entry;
|
||||||
|
use App\Transformers\Objects\ObjectTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class OperationsController extends Controller {
|
||||||
|
protected NirObject $model;
|
||||||
|
|
||||||
|
public function __construct(NirObject $model) {
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request): JsonResponse {
|
||||||
|
$query = ($entry = Entry::byUuid($request->get('entry'))->first()) ? $entry->operations() : $this->model->query();
|
||||||
|
$paginator = $query->paginate(config('app.pagination_limit'));
|
||||||
|
return fractal($paginator, new ObjectTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Request $request, $id): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($id)->firstOrFail();
|
||||||
|
return fractal($model, new ObjectTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $uuid): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, $uuid): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($uuid)->firstOrFail();
|
||||||
|
$model->delete();
|
||||||
|
return response()->json(null, 204);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\Registries;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Pages\Page;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
|
use App\Transformers\Publications\PublicationTransformer;
|
||||||
|
use App\Transformers\Registries\RegistryTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class RegistriesController extends Controller {
|
||||||
|
protected Registry $model;
|
||||||
|
|
||||||
|
public function __construct(Registry $model) {
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request): JsonResponse {
|
||||||
|
$query = $this->model->query();
|
||||||
|
if ($page = Page::byUuid($request->get('page'))->first()) $query->where(['page_id' => $page->id]);
|
||||||
|
$paginator = $query->paginate(config('app.pagination_limit'));
|
||||||
|
return fractal($paginator, new RegistryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Request $request, $id): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($id)->firstOrFail();
|
||||||
|
return fractal($model, new PublicationTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function store(Request $request): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $uuid): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, $uuid): JsonResponse {
|
||||||
|
$model = $this->model->byUuid($uuid)->firstOrFail();
|
||||||
|
$model->delete();
|
||||||
|
return response()->json(null, 204);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
|
@ -175,6 +176,16 @@ class Field extends Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function applyOrder(Builder $query, $dir) {
|
||||||
|
if ($table = FieldType::TABLES[$this->type] ?? null) {
|
||||||
|
$query->leftJoin("{$table} as {$this->name}", function(JoinClause $join) use($table) {
|
||||||
|
$join->on('objects.id', '=', "{$this->name}.object_id");
|
||||||
|
})->where(["{$this->name}.field_id" => $this->id])->orderBy("{$this->name}.value", $dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function fakeValue($objectId) {
|
public function fakeValue($objectId) {
|
||||||
$faker = new Generator();
|
$faker = new Generator();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Models\Objects;
|
namespace App\Models\Objects;
|
||||||
|
|
||||||
use App\Models\Catalog\Specification;
|
|
||||||
use App\Models\Objects\Values\BooleanValue;
|
use App\Models\Objects\Values\BooleanValue;
|
||||||
use App\Models\Objects\Values\DateValue;
|
use App\Models\Objects\Values\DateValue;
|
||||||
use App\Models\Objects\Values\DocumentValue;
|
use App\Models\Objects\Values\DocumentValue;
|
||||||
|
|
@ -12,7 +11,6 @@ use App\Models\Objects\Values\IntegerValue;
|
||||||
use App\Models\Objects\Values\RelationValue;
|
use App\Models\Objects\Values\RelationValue;
|
||||||
use App\Models\Objects\Values\StringValue;
|
use App\Models\Objects\Values\StringValue;
|
||||||
use App\Models\Objects\Values\TextValue;
|
use App\Models\Objects\Values\TextValue;
|
||||||
use App\Models\Polls\PollInvitation;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Support\UuidScopeTrait;
|
use App\Support\UuidScopeTrait;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
@ -103,6 +101,13 @@ class NirObject extends Model {
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeApplyOrders(Builder $query, $orders): Builder {
|
||||||
|
collect($orders)->each(function($dir, $prop) use($query) {
|
||||||
|
if ($field = Field::byUuidOrName($prop)->first()) $field->applyOrder($query, $dir);
|
||||||
|
});
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getValuesAttribute(): array {
|
public function getValuesAttribute(): array {
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Models\Objects\Values;
|
namespace App\Models\Objects\Values;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
class DateValue extends Value {
|
class DateValue extends Value {
|
||||||
protected $table = 'field_date_values';
|
protected $table = 'field_date_values';
|
||||||
|
|
@ -16,6 +16,7 @@ class DateValue extends Value {
|
||||||
return $this->value ? $this->value->toIso8601String() : null;
|
return $this->value ? $this->value->toIso8601String() : null;
|
||||||
}
|
}
|
||||||
public function set($value): bool {
|
public function set($value): bool {
|
||||||
|
$value = ($value instanceof Carbon) ? $value : ($value ? Carbon::create($value) : null);
|
||||||
return parent::set($value);
|
return parent::set($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Models\Pages;
|
namespace App\Models\Pages;
|
||||||
|
|
||||||
use App\Models\Publications\Publication;
|
use App\Models\Publications\Publication;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
use App\Support\HasObjectsTrait;
|
use App\Support\HasObjectsTrait;
|
||||||
use App\Support\RelationValuesTrait;
|
use App\Support\RelationValuesTrait;
|
||||||
use App\Support\UuidScopeTrait;
|
use App\Support\UuidScopeTrait;
|
||||||
|
|
@ -55,6 +56,10 @@ class Page extends Model {
|
||||||
return $this->hasMany(Publication::class);
|
return $this->hasMany(Publication::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function registries(): HasMany {
|
||||||
|
return $this->hasMany(Registry::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function scopeBySlug($query, $slug) {
|
public function scopeBySlug($query, $slug) {
|
||||||
$query->where(['slug' => $slug]);
|
$query->where(['slug' => $slug]);
|
||||||
|
|
@ -82,6 +87,10 @@ class Page extends Model {
|
||||||
return ['name' => $this->type, 'title' => PageType::TITLES[$this->type] ?? null];
|
return ['name' => $this->type, 'title' => PageType::TITLES[$this->type] ?? null];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRegistryAttribute(): Model {
|
||||||
|
return $this->registries()->firstOrCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function addSection($typeName, $ord = null): ?Model {
|
public function addSection($typeName, $ord = null): ?Model {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use App\Support\RelationValuesTrait;
|
||||||
use App\Support\UuidScopeTrait;
|
use App\Support\UuidScopeTrait;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Entry extends Model {
|
class Entry extends Model {
|
||||||
|
|
@ -49,8 +49,8 @@ class Entry extends Model {
|
||||||
return $this->belongsTo(Asset::class);
|
return $this->belongsTo(Asset::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function operations(): HasMany {
|
public function operations(): MorphToMany {
|
||||||
return $this->hasMany(Operation::class);
|
return $this->objects()->reorder()->applyOrders(['order-date' => 'desc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Registries;
|
|
||||||
|
|
||||||
use App\Models\Asset;
|
|
||||||
use App\Support\RelationValuesTrait;
|
|
||||||
use App\Support\UuidScopeTrait;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class Operation extends Model {
|
|
||||||
use UuidScopeTrait, SoftDeletes, RelationValuesTrait;
|
|
||||||
|
|
||||||
protected $table = 'registry_entry_operations';
|
|
||||||
|
|
||||||
protected $dates = [
|
|
||||||
'order_date',
|
|
||||||
'active_since',
|
|
||||||
'active_till',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'uuid',
|
|
||||||
'entry_id',
|
|
||||||
'order_id',
|
|
||||||
'type',
|
|
||||||
'developer',
|
|
||||||
'order_name',
|
|
||||||
'order_date',
|
|
||||||
'active_since',
|
|
||||||
'active_till'
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $hidden = [
|
|
||||||
'id'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
public function entry(): BelongsTo {
|
|
||||||
return $this->belongsTo(Entry::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function order(): BelongsTo {
|
|
||||||
return $this->belongsTo(Asset::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getParsedTypeAttribute(): array {
|
|
||||||
return ['name' => $this->type, 'title' => OperationType::TITLES[$this->type] ?? null];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Registries;
|
|
||||||
|
|
||||||
class OperationType {
|
|
||||||
public const DEVELOPMENT = 'development';
|
|
||||||
public const REWORK = 'rework';
|
|
||||||
public const MODIFICATION = 'modification';
|
|
||||||
|
|
||||||
public const TITLES = [
|
|
||||||
self::DEVELOPMENT => 'Разработка',
|
|
||||||
self::REWORK => 'Пересмотр',
|
|
||||||
self::MODIFICATION => 'Изменение'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -36,6 +36,10 @@ class Registry extends Model {
|
||||||
return $this->hasMany(Category::class);
|
return $this->hasMany(Category::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function rootCategories(): HasMany {
|
||||||
|
return $this->categories()->where(['parent_id' => 0]);
|
||||||
|
}
|
||||||
|
|
||||||
public function entries(): HasMany {
|
public function entries(): HasMany {
|
||||||
return $this->hasMany(Entry::class);
|
return $this->hasMany(Entry::class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ use App\Models\Objects\ObjectType;
|
||||||
use App\Models\Pages\Page;
|
use App\Models\Pages\Page;
|
||||||
use App\Models\Permission;
|
use App\Models\Permission;
|
||||||
use App\Models\Publications\Publication;
|
use App\Models\Publications\Publication;
|
||||||
|
use App\Models\Registries\Category;
|
||||||
|
use App\Models\Registries\Entry;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
use App\Models\Role;
|
use App\Models\Role;
|
||||||
use App\Models\SocialProvider;
|
use App\Models\SocialProvider;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
@ -58,6 +61,10 @@ class AppServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
'page' => Page::class,
|
'page' => Page::class,
|
||||||
'publication' => Publication::class,
|
'publication' => Publication::class,
|
||||||
|
|
||||||
|
'registry' => Registry::class,
|
||||||
|
'registry-category' => Category::class,
|
||||||
|
'registry-entry' => Entry::class
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace App\Services\Forms;
|
||||||
|
|
||||||
use App\Services\Forms\Pages\PageFormsServices;
|
use App\Services\Forms\Pages\PageFormsServices;
|
||||||
use App\Services\Forms\Publications\PublicationFormsServices;
|
use App\Services\Forms\Publications\PublicationFormsServices;
|
||||||
|
use App\Services\Forms\Registries\RegistryFormsServices;
|
||||||
use App\Services\Forms\Users\UserFormsServices;
|
use App\Services\Forms\Users\UserFormsServices;
|
||||||
|
|
||||||
class FormsService {
|
class FormsService {
|
||||||
|
|
@ -12,6 +13,7 @@ class FormsService {
|
||||||
public static array $services = [
|
public static array $services = [
|
||||||
PageFormsServices::class,
|
PageFormsServices::class,
|
||||||
PublicationFormsServices::class,
|
PublicationFormsServices::class,
|
||||||
|
RegistryFormsServices::class,
|
||||||
UserFormsServices::class
|
UserFormsServices::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Forms\Registries;
|
||||||
|
|
||||||
|
use App\Models\Objects\FieldType;
|
||||||
|
use App\Models\Registries\Category;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
|
use App\Services\Forms\FormsService;
|
||||||
|
use App\Transformers\Registries\CategoryTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class CategoryForms extends FormsService {
|
||||||
|
public array $formTitles = ['create' => 'Создание категории', 'update' => 'Редактирование категории'];
|
||||||
|
|
||||||
|
public function form(?string $id = null, array $data = []): array {
|
||||||
|
$model = Category::byUuid($id)->first();
|
||||||
|
$groups = [
|
||||||
|
['name' => 'common', 'fields' => $this->commonGroupFields($model)]
|
||||||
|
];
|
||||||
|
return ['title' => $this->formTitle($model), 'data' => $groups];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function commonGroupFields(?Category $model): array {
|
||||||
|
$fields = [
|
||||||
|
[
|
||||||
|
'name' => 'name',
|
||||||
|
'title' => 'Название категории',
|
||||||
|
'type' => FieldType::STRING,
|
||||||
|
'required' => true,
|
||||||
|
'value' => $model->name ?? null
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return ['data' => $fields];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function store(array $data): ?JsonResponse {
|
||||||
|
$registry = Registry::byUuid($data['registry'] ?? null)->firstOrFail();
|
||||||
|
$parent = Category::byUuid($data['parent'] ?? null)->first();
|
||||||
|
$data['parent_id'] = $parent->id ?? 0;
|
||||||
|
$model = $registry->categories()->create($data);
|
||||||
|
return fractal($model, new CategoryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(string $id, array $data): ?JsonResponse {
|
||||||
|
$model = Category::byUuid($id)->firstOrFail();
|
||||||
|
$model->update($data);
|
||||||
|
return fractal($model->fresh(), new CategoryTransformer())->respond();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Forms\Registries;
|
||||||
|
|
||||||
|
use App\Models\Asset;
|
||||||
|
use App\Models\Objects\FieldType;
|
||||||
|
use App\Models\Registries\Category;
|
||||||
|
use App\Models\Registries\Entry;
|
||||||
|
use App\Models\Registries\Registry;
|
||||||
|
use App\Services\Forms\FormsService;
|
||||||
|
use App\Transformers\Assets\AssetTransformer;
|
||||||
|
use App\Transformers\Registries\EntryTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class EntryForms extends FormsService {
|
||||||
|
public array $formTitles = ['create' => 'Создание записи', 'update' => 'Редактирование записи'];
|
||||||
|
|
||||||
|
public function form(?string $id = null, array $data = []): array {
|
||||||
|
$model = Entry::byUuid($id)->first();
|
||||||
|
$groups = [
|
||||||
|
['name' => 'common', 'fields' => $this->commonGroupFields($model)]
|
||||||
|
];
|
||||||
|
return ['title' => $this->formTitle($model), 'data' => $groups];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function commonGroupFields(?Entry $model): array {
|
||||||
|
$fields = [
|
||||||
|
[
|
||||||
|
'name' => 'number',
|
||||||
|
'title' => 'Номер записи',
|
||||||
|
'type' => FieldType::STRING,
|
||||||
|
'required' => true,
|
||||||
|
'value' => $model->number ?? null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'name',
|
||||||
|
'title' => 'Название',
|
||||||
|
'type' => FieldType::STRING,
|
||||||
|
'required' => true,
|
||||||
|
'value' => $model->name ?? null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'asset',
|
||||||
|
'title' => 'Документ',
|
||||||
|
'type' => FieldType::DOCUMENT,
|
||||||
|
'required' => true,
|
||||||
|
'value' => ($asset = $model->asset ?? null) ? fractal($asset, new AssetTransformer()) : null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'active_since',
|
||||||
|
'title' => 'Дата начала действия',
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'value' => ($v = $model->active_since ?? null) ? $v->toIso8601String() : null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'active_till',
|
||||||
|
'title' => 'Дата окончания действия',
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'value' => ($v = $model->active_till ?? null) ? $v->toIso8601String() : null
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return ['data' => $fields];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function store(array $data): ?JsonResponse {
|
||||||
|
$registry = Registry::byUuid($data['registry'] ?? null)->firstOrFail();
|
||||||
|
$category = Category::byUuid($data['category'] ?? null)->first();
|
||||||
|
$data['asset_id'] = ($asset = Asset::byUuid($data['asset'])->first()) ? $asset->id : null;
|
||||||
|
$data['category_id'] = $category->id ?? 0;
|
||||||
|
$model = $registry->entries()->create($data);
|
||||||
|
return fractal($model, new EntryTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(string $id, array $data): ?JsonResponse {
|
||||||
|
$model = Entry::byUuid($id)->firstOrFail();
|
||||||
|
$data['asset_id'] = ($asset = Asset::byUuid($data['asset'])->first()) ? $asset->id : null;
|
||||||
|
$model->update($data);
|
||||||
|
return fractal($model->fresh(), new EntryTransformer())->respond();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Forms\Registries;
|
||||||
|
|
||||||
|
use App\Models\Asset;
|
||||||
|
use App\Models\Dictionaries\Dictionary;
|
||||||
|
use App\Models\Objects\FieldType;
|
||||||
|
use App\Models\Objects\NirObject;
|
||||||
|
use App\Models\Objects\ObjectType;
|
||||||
|
use App\Models\Registries\Entry;
|
||||||
|
use App\Models\Registries\Operation;
|
||||||
|
use App\Models\Registries\OperationType;
|
||||||
|
use App\Services\Forms\FormsService;
|
||||||
|
use App\Transformers\Assets\AssetTransformer;
|
||||||
|
use App\Transformers\Dictionaries\DictionaryItemTransformer;
|
||||||
|
use App\Transformers\Objects\FieldTransformer;
|
||||||
|
use App\Transformers\Objects\ObjectPropertyTransformer;
|
||||||
|
use App\Transformers\Objects\ObjectTransformer;
|
||||||
|
use App\Transformers\Registries\OperationTransformer;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class OperationForms extends FormsService {
|
||||||
|
public array $formTitles = ['create' => 'Создание операции', 'update' => 'Редактирование операции'];
|
||||||
|
|
||||||
|
public function form(?string $id = null, array $data = []): array {
|
||||||
|
$model = NirObject::byUuid($id)->first();
|
||||||
|
$groups = [
|
||||||
|
['name' => 'common', 'fields' => $this->commonGroupFields($model)]
|
||||||
|
];
|
||||||
|
return ['title' => $this->formTitle($model), 'data' => $groups];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function commonGroupFields(?NirObject $model): array {
|
||||||
|
return $model ? fractal($model->groups->first()->fields, new ObjectPropertyTransformer($model))->toArray() :
|
||||||
|
fractal(ObjectType::byName('entry-operation')->first()->groups()->first()->fields, new FieldTransformer())->toArray();
|
||||||
|
|
||||||
|
/*
|
||||||
|
$fields = [
|
||||||
|
[
|
||||||
|
'name' => 'type',
|
||||||
|
'title' => 'Вид работы',
|
||||||
|
'type' => FieldType::RELATION,
|
||||||
|
'required' => true,
|
||||||
|
'appearance' => 'radio',
|
||||||
|
'options' => $this->getRelationItems(OperationType::TITLES),
|
||||||
|
'value' => $this->getRelationValue(OperationType::TITLES, $model->type ?? null)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'order_name',
|
||||||
|
'title' => 'Наименование приказа',
|
||||||
|
'type' => FieldType::STRING,
|
||||||
|
'required' => true,
|
||||||
|
'value' => $model->order_name ?? null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'order_date',
|
||||||
|
'title' => 'Дата приказа',
|
||||||
|
'required' => true,
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'value' => ($v = $model->order_date ?? null) ? $v->toIso8601String() : null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'order',
|
||||||
|
'title' => 'Документ приказа',
|
||||||
|
'type' => FieldType::DOCUMENT,
|
||||||
|
'required' => true,
|
||||||
|
'value' => ($order = $model->order ?? null) ? fractal($order, new AssetTransformer()) : null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'listing',
|
||||||
|
'title' => 'Вхождение в перечень ПП',
|
||||||
|
'type' => FieldType::RELATION,
|
||||||
|
'multiple' => true,
|
||||||
|
'appearance' => 'checkbox',
|
||||||
|
'options' => fractal(Dictionary::byName('listings')->first()->items, new DictionaryItemTransformer()),
|
||||||
|
'value' => null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'active_since',
|
||||||
|
'title' => 'Дата начала действия',
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'required' => true,
|
||||||
|
'value' => ($v = $model->active_since ?? null) ? $v->toIso8601String() : null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'active_till',
|
||||||
|
'title' => 'Дата окончания действия',
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'value' => ($v = $model->active_till ?? null) ? $v->toIso8601String() : null
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'developer',
|
||||||
|
'title' => 'Разработчик',
|
||||||
|
'type' => FieldType::STRING,
|
||||||
|
'required' => true,
|
||||||
|
'value' => $model->developer ?? null
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return ['data' => $fields];
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function store(array $data): ?JsonResponse {
|
||||||
|
$entry = Entry::byUuid($data['entry'] ?? null)->firstOrFail();
|
||||||
|
$model = $entry->createObject('entry-operation', null, 'operations');
|
||||||
|
$model->setValues($data);
|
||||||
|
return fractal($model, new ObjectTransformer())->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(string $id, array $data): ?JsonResponse {
|
||||||
|
$model = NirObject::byUuid($id)->firstOrFail();
|
||||||
|
$model->setValues($data);
|
||||||
|
return fractal($model->fresh(), new ObjectTransformer())->respond();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Forms\Registries;
|
||||||
|
|
||||||
|
class RegistryFormsServices {
|
||||||
|
public static array $services = [
|
||||||
|
'registryCategory' => CategoryForms::class,
|
||||||
|
'registryEntry' => EntryForms::class,
|
||||||
|
'entryOperation' => OperationForms::class
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -23,7 +23,7 @@ class ObjectTransformer extends TransformerAbstract {
|
||||||
return [
|
return [
|
||||||
'id' => $model->uuid,
|
'id' => $model->uuid,
|
||||||
'name' => $model->name,
|
'name' => $model->name,
|
||||||
'type_title' => $model->type->title,
|
'type_title' => $model->type->title ?? null,
|
||||||
'pivot' => ['group' => $model->pivot->group ?? null, 'ord' => $model->pivot->ord ?? null],
|
'pivot' => ['group' => $model->pivot->group ?? null, 'ord' => $model->pivot->ord ?? null],
|
||||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null,
|
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null,
|
||||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : null
|
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : null
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use App\Models\Pages\Page;
|
||||||
use App\Services\PermissionsService;
|
use App\Services\PermissionsService;
|
||||||
use App\Transformers\Objects\ObjectTransformer;
|
use App\Transformers\Objects\ObjectTransformer;
|
||||||
use App\Transformers\Publications\PublicationTransformer;
|
use App\Transformers\Publications\PublicationTransformer;
|
||||||
|
use App\Transformers\Registries\RegistryTransformer;
|
||||||
use League\Fractal\Resource\Collection;
|
use League\Fractal\Resource\Collection;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use League\Fractal\Resource\Primitive;
|
use League\Fractal\Resource\Primitive;
|
||||||
|
|
@ -17,7 +18,8 @@ class PageTransformer extends TransformerAbstract {
|
||||||
];
|
];
|
||||||
|
|
||||||
protected array $availableIncludes = [
|
protected array $availableIncludes = [
|
||||||
'children', 'parent', 'parents', 'sections', 'sidebars', 'publications', 'permissions'
|
'children', 'parent', 'parents', 'sections', 'sidebars', 'publications',
|
||||||
|
'registries', 'registry', 'permissions'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function transform(Page $model): array {
|
public function transform(Page $model): array {
|
||||||
|
|
@ -58,6 +60,14 @@ class PageTransformer extends TransformerAbstract {
|
||||||
return $this->collection($model->publications, new PublicationTransformer());
|
return $this->collection($model->publications, new PublicationTransformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeRegistries(Page $model): Collection {
|
||||||
|
return $this->collection($model->registries, new RegistryTransformer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function includeRegistry(Page $model): ?Item {
|
||||||
|
return $model->registry ? $this->item($model->registry, new RegistryTransformer()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public function includePermissions(Page $model): Primitive {
|
public function includePermissions(Page $model): Primitive {
|
||||||
return $this->primitive((new PermissionsService($model))->get());
|
return $this->primitive((new PermissionsService($model))->get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ namespace App\Transformers\Registries;
|
||||||
use App\Models\Registries\Entry;
|
use App\Models\Registries\Entry;
|
||||||
use App\Services\PermissionsService;
|
use App\Services\PermissionsService;
|
||||||
use App\Transformers\Assets\AssetTransformer;
|
use App\Transformers\Assets\AssetTransformer;
|
||||||
|
use App\Transformers\Objects\ObjectTransformer;
|
||||||
use League\Fractal\Resource\Collection;
|
use League\Fractal\Resource\Collection;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use League\Fractal\Resource\Primitive;
|
use League\Fractal\Resource\Primitive;
|
||||||
|
|
@ -44,7 +45,7 @@ class EntryTransformer extends TransformerAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeOperations(Entry $model): Collection {
|
public function includeOperations(Entry $model): Collection {
|
||||||
return $this->collection($model->operations, new OperationTransformer());
|
return $this->collection($model->operations, new ObjectTransformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includePermissions(Entry $model): Primitive {
|
public function includePermissions(Entry $model): Primitive {
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Transformers\Registries;
|
|
||||||
|
|
||||||
use App\Models\Registries\Entry;
|
|
||||||
use App\Models\Registries\Operation;
|
|
||||||
use App\Services\PermissionsService;
|
|
||||||
use App\Transformers\Assets\AssetTransformer;
|
|
||||||
use League\Fractal\Resource\Item;
|
|
||||||
use League\Fractal\Resource\Primitive;
|
|
||||||
use League\Fractal\TransformerAbstract;
|
|
||||||
|
|
||||||
class OperationTransformer extends TransformerAbstract {
|
|
||||||
protected array $defaultIncludes = [
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
protected array $availableIncludes = [
|
|
||||||
'entry', 'order'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function transform(Operation $model): array {
|
|
||||||
return [
|
|
||||||
'id' => $model->uuid,
|
|
||||||
'type' => $model->parsedType,
|
|
||||||
'name' => $model->name,
|
|
||||||
'developer' => $model->developer,
|
|
||||||
'order_name' => $model->order_name,
|
|
||||||
'order_date' => $model->order_date ? $model->order_date->toIso8601String() : null,
|
|
||||||
'active_since' => $model->active_since ? $model->active_since->toIso8601String() : null,
|
|
||||||
'active_till' => $model->active_till ? $model->active_till->toIso8601String() : null,
|
|
||||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null,
|
|
||||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : null
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function includeRegistry(Entry $model): ?Item {
|
|
||||||
return $model->registry ? $this->item($model->registry, new RegistryTransformer()) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function includeCategory(Entry $model): ?Item {
|
|
||||||
return $model->category ? $this->item($model->category, new CategoryTransformer()) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function includeAsset(Entry $model): ?Item {
|
|
||||||
return $model->asset ? $this->item($model->asset, new AssetTransformer()) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function includePermissions(Entry $model): Primitive {
|
|
||||||
return $this->primitive((new PermissionsService($model))->get());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -35,7 +35,7 @@ class RegistryTransformer extends TransformerAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeCategories(Registry $model): Collection {
|
public function includeCategories(Registry $model): Collection {
|
||||||
return $this->collection($model->categories, new CategoryTransformer());
|
return $this->collection($model->rootCategories, new CategoryTransformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeEntries(Registry $model): Collection {
|
public function includeEntries(Registry $model): Collection {
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class CreateRegistryEntryOperationsTable extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::create('registry_entry_operations', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->char('uuid', 36)->index()->unique();
|
|
||||||
$table->integer('entry_id')->index()->nullable();
|
|
||||||
$table->integer('order_id')->index()->nullable();
|
|
||||||
$table->string('type')->index()->nullable();
|
|
||||||
$table->string('developer')->index()->nullable();
|
|
||||||
$table->string('order_name')->index()->nullable();
|
|
||||||
$table->date('order_date')->index()->nullable();
|
|
||||||
$table->date('active_since')->index()->nullable();
|
|
||||||
$table->date('active_till')->index()->nullable();
|
|
||||||
$table->timestamps();
|
|
||||||
$table->softDeletes();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('registry_entry_operations');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -10,6 +10,14 @@ class DictionariesTableSeeder extends Seeder {
|
||||||
'list-types' => [
|
'list-types' => [
|
||||||
'title' => 'Виды списка',
|
'title' => 'Виды списка',
|
||||||
'items' => ['marked' => 'Маркированный', 'numeric' => 'Нумерованный']
|
'items' => ['marked' => 'Маркированный', 'numeric' => 'Нумерованный']
|
||||||
|
],
|
||||||
|
'operation-types' => [
|
||||||
|
'title' => 'Виды операций',
|
||||||
|
'items' => ['development' => 'Разработка', 'rework' => 'Пересмотр', 'modification' => 'Изменение']
|
||||||
|
],
|
||||||
|
'listings' => [
|
||||||
|
'title' => 'Перечни ПП',
|
||||||
|
'items' => ['pp1521' => 'ПП №1521 от 26.12.2014 г.', 'pp985' => 'ПП № 985 от 04.07.2020 г.', 'pp815' => 'ПП № 815 от 28.05.2021 г.']
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,56 @@ class FieldsTableSeeder extends Seeder {
|
||||||
'title' => 'Ссылка на видео',
|
'title' => 'Ссылка на видео',
|
||||||
'type' => FieldType::STRING,
|
'type' => FieldType::STRING,
|
||||||
'required' => true
|
'required' => true
|
||||||
|
],
|
||||||
|
|
||||||
|
// Registry entry operation fields
|
||||||
|
'operation-type' => [
|
||||||
|
'title' => 'Вид работы',
|
||||||
|
'type' => FieldType::RELATION,
|
||||||
|
'required' => true,
|
||||||
|
'params' => [
|
||||||
|
'appearance' => 'radio',
|
||||||
|
'related' => DictionaryItem::class, 'transformer' => DictionaryItemTransformer::class,
|
||||||
|
'options' => ['show' => true, 'whereHas' => ['dictionary' => ['name' => 'operation-types']]]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'order-name' => [
|
||||||
|
'title' => 'Наименование приказа',
|
||||||
|
'type' => FieldType::STRING,
|
||||||
|
'required' => true
|
||||||
|
],
|
||||||
|
'order-date' => [
|
||||||
|
'title' => 'Дата приказа',
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'required' => true
|
||||||
|
],
|
||||||
|
'order-document' => [
|
||||||
|
'title' => 'Документ приказа',
|
||||||
|
'type' => FieldType::DOCUMENT,
|
||||||
|
'required' => true
|
||||||
|
],
|
||||||
|
'listings' => [
|
||||||
|
'title' => 'Вхождение в перечень ПП',
|
||||||
|
'type' => FieldType::RELATION,
|
||||||
|
'multiple' => true,
|
||||||
|
'params' => [
|
||||||
|
'appearance' => 'checkbox',
|
||||||
|
'related' => DictionaryItem::class, 'transformer' => DictionaryItemTransformer::class,
|
||||||
|
'options' => ['show' => true, 'whereHas' => ['dictionary' => ['name' => 'listings']]]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'active-since' => [
|
||||||
|
'title' => 'Дата начала действия',
|
||||||
|
'type' => FieldType::DATE,
|
||||||
|
'required' => true
|
||||||
|
],
|
||||||
|
'active-till' => [
|
||||||
|
'title' => 'Дата окончания действия',
|
||||||
|
'type' => FieldType::DATE
|
||||||
|
],
|
||||||
|
'developer' => [
|
||||||
|
'title' => 'Разработчик',
|
||||||
|
'type' => FieldType::STRING
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,13 @@ class ObjectTypeFieldsTableSeeder extends Seeder {
|
||||||
'common' => [
|
'common' => [
|
||||||
'fields' => ['video-url']
|
'fields' => ['video-url']
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
|
||||||
|
'entry-operation' => [
|
||||||
|
'common' => [
|
||||||
|
'fields' => ['operation-type', 'order-name', 'order-date', 'order-document', 'listings', 'active-since', 'active-till', 'developer']
|
||||||
|
]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
public function run() {
|
public function run() {
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,8 @@ class ObjectTypesTableSeeder extends Seeder {
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'registry-entry' => [
|
'entry-operation' => [
|
||||||
'title' => 'Запись в реестре',
|
'title' => 'Действие с записью в реестре'
|
||||||
'children' => [
|
|
||||||
'registry-entry-document' => [
|
|
||||||
'title' => 'Документ'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,22 @@ Route::get('publications', 'Api\Publications\PublicationsController@index');
|
||||||
Route::get('publications/find', 'Api\Publications\PublicationsController@find');
|
Route::get('publications/find', 'Api\Publications\PublicationsController@find');
|
||||||
Route::get('publications/{id}', 'Api\Publications\PublicationsController@show');
|
Route::get('publications/{id}', 'Api\Publications\PublicationsController@show');
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'registries'], function() {
|
||||||
|
Route::get('/categories', 'Api\Registries\CategoriesController@index');
|
||||||
|
Route::get('/categories/{id}', 'Api\Registries\CategoriesController@show');
|
||||||
|
Route::get('/entries', 'Api\Registries\EntriesController@index');
|
||||||
|
Route::get('/entries/{id}', 'Api\Registries\EntriesController@show');
|
||||||
|
Route::get('/operations', 'Api\Registries\OperationsController@index');
|
||||||
|
Route::get('/operations/{id}', 'Api\Registries\OperationsController@show');
|
||||||
|
Route::get('/', 'Api\Registries\RegistriesController@index');
|
||||||
|
Route::get('/{id}', 'Api\Registries\RegistriesController@show');
|
||||||
|
Route::group(['middleware' => ['auth:api']], function() {
|
||||||
|
Route::delete('/categories/{id}', 'Api\Registries\CategoriesController@destroy');
|
||||||
|
Route::delete('/entries/{id}', 'Api\Registries\EntriesController@destroy');
|
||||||
|
Route::delete('/operations/{id}', 'Api\Registries\OperationsController@destroy');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Route::group(['middleware' => ['auth:api']], function() {
|
Route::group(['middleware' => ['auth:api']], function() {
|
||||||
Route::apiResource('users', 'Api\Users\UsersController');
|
Route::apiResource('users', 'Api\Users\UsersController');
|
||||||
Route::apiResource('roles', 'Api\Users\RolesController');
|
Route::apiResource('roles', 'Api\Users\RolesController');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue