major
parent
367cfb3753
commit
512de2e528
|
|
@ -7,11 +7,13 @@ class PageSubType {
|
|||
public const PUBLICATION_SMI = 'publication-smi';
|
||||
public const PUBLICATION_PHOTOS = 'publication-photos';
|
||||
public const PUBLICATION_VIDEO = 'publication-video';
|
||||
public const PUBLICATION_PORTFOLIO = 'publication-portfolio';
|
||||
|
||||
public const TITLES = [
|
||||
self::PUBLICATION_NEWS => 'Новость',
|
||||
self::PUBLICATION_SMI => 'СМИ о нас',
|
||||
self::PUBLICATION_PHOTOS => 'Фотогаллерея',
|
||||
self::PUBLICATION_VIDEO => 'Видеоархив',
|
||||
self::PUBLICATION_PORTFOLIO => 'Портфолио'
|
||||
];
|
||||
}
|
||||
|
|
@ -7,11 +7,13 @@ class PublicationType {
|
|||
public const SMI = 'smi';
|
||||
public const PHOTOS = 'photos';
|
||||
public const VIDEO = 'video';
|
||||
public const PORTFOLIO = 'portfolio';
|
||||
|
||||
public const TITLES = [
|
||||
self::NEWS => 'Новость',
|
||||
self::SMI => 'СМИ о нас',
|
||||
self::PHOTOS => 'Фотогаллерея',
|
||||
self::VIDEO => 'Видеоархив',
|
||||
self::PORTFOLIO => 'Портфолио',
|
||||
];
|
||||
}
|
||||
|
|
@ -8,5 +8,6 @@ class PublicationFormsServices {
|
|||
'publication-smi' => PublicationSmiForms::class,
|
||||
'publication-photos' => PublicationPhotosForms::class,
|
||||
'publication-video' => PublicationVideoForms::class,
|
||||
'publication-portfolio' => PublicationPortfolioForms::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ class PublicationNewsForms extends FormsService {
|
|||
|
||||
public function commonGroupFields(?Publication $model): array {
|
||||
$fields = [
|
||||
|
||||
[
|
||||
'name' => 'published_at',
|
||||
'title' => 'Дата публикации',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Forms\Publications;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\Objects\FieldType;
|
||||
use App\Models\Pages\Page;
|
||||
use App\Models\Publications\Publication;
|
||||
use App\Models\Publications\PublicationType;
|
||||
use App\Services\Forms\FormsService;
|
||||
use App\Transformers\Assets\AssetTransformer;
|
||||
use App\Transformers\Publications\PublicationTransformer;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PublicationPortfolioForms
|
||||
extends FormsService {
|
||||
public array $formTitles = ['create' => 'Создание новой публикации в портфолио', 'update' => 'Редактирование публикации в портфолио'];
|
||||
|
||||
public function form(?string $id = null, array $data = []): array {
|
||||
$model = Publication::byUuid($id)->first();
|
||||
$groups = [
|
||||
['name' => 'common', 'fields' => $this->commonGroupFields($model)]
|
||||
];
|
||||
return ['title' => $this->formTitle($model), 'data' => $groups];
|
||||
}
|
||||
|
||||
public function commonGroupFields(?Publication $model): array {
|
||||
|
||||
$params = $model->parsedParams ?? null;
|
||||
|
||||
$fields = [
|
||||
[
|
||||
'name' => 'name',
|
||||
'title' => 'Название компании',
|
||||
'type' => FieldType::STRING,
|
||||
'required' => true,
|
||||
'max_length' => 127,
|
||||
'value' => $model->name ?? null
|
||||
],
|
||||
[
|
||||
'name' => 'excerpt',
|
||||
'title' => 'Тип выполненных работ',
|
||||
'type' => FieldType::STRING,
|
||||
'required' => true,
|
||||
'value' => $model->excerpt ?? null
|
||||
],
|
||||
[
|
||||
'name' => 'description',
|
||||
'title' => 'Описание',
|
||||
'type' => FieldType::TEXT,
|
||||
'required' => true,
|
||||
'value' => $params->description ?? null
|
||||
],
|
||||
[
|
||||
'name' => 'poster_id',
|
||||
'title' => 'Превью',
|
||||
'type' => FieldType::IMAGE,
|
||||
'required' => true,
|
||||
'value' => ($model->poster ?? null) ? fractal($model->poster, new AssetTransformer()) : null
|
||||
],
|
||||
];
|
||||
return ['data' => $fields];
|
||||
}
|
||||
|
||||
|
||||
public function store(array $data): ?JsonResponse {
|
||||
$page = Page::byUuid($data['attach']['page_id'])->first();
|
||||
$pub = [];
|
||||
$pub['page_id'] = $page->id;
|
||||
$pub['author_id'] = Auth::user()->id;
|
||||
$pub['type'] = PublicationType::PORTFOLIO;
|
||||
$pub['name'] = $data['name'];
|
||||
$pub['slug'] = Str::slug(Str::transliterate($data['name']));
|
||||
$pub['excerpt'] = $data['excerpt'];
|
||||
$pub['published_at'] = now();
|
||||
if (empty($data['poster_id'])) {
|
||||
$pub['poster_id'] = null;
|
||||
} else {
|
||||
$asset = Asset::query()->where(['uuid' => $data['poster_id']])->first();
|
||||
$pub['poster_id'] = $asset->id;
|
||||
}
|
||||
$params = [];
|
||||
if (!empty($data['description'])) {
|
||||
$params['description'] = $data['description'];
|
||||
}
|
||||
if (count($params) > 0) {
|
||||
$pub['params'] = json_encode($params);
|
||||
}
|
||||
$model = Publication::create($pub, true);
|
||||
return fractal($model, new PublicationTransformer())->respond();
|
||||
}
|
||||
|
||||
public function update(string $id, array $data): ?JsonResponse {
|
||||
$model = Publication::byUuid($id)->firstOrFail();
|
||||
$pub = [];
|
||||
$pub['author_id'] = Auth::user()->id;
|
||||
$pub['slug'] = Str::slug(Str::transliterate($data['name']));
|
||||
$pub['excerpt'] = $data['excerpt'];
|
||||
if (!empty($data['name'])) {
|
||||
$pub['name'] = $data['name'];
|
||||
}
|
||||
if (empty($data['poster_id'])) {
|
||||
$pub['poster_id'] = null;
|
||||
} else {
|
||||
$asset = Asset::query()->where(['uuid' => $data['poster_id']])->first();
|
||||
$pub['poster_id'] = $asset->id;
|
||||
}
|
||||
$params = [];
|
||||
if (!empty($data['description'])) {
|
||||
$params['description'] = $data['description'];
|
||||
}
|
||||
if (count($params) > 0) {
|
||||
$pub['params'] = json_encode($params);
|
||||
}
|
||||
$model->update($pub);
|
||||
return fractal($model->fresh(), new PublicationTransformer())->respond();
|
||||
}
|
||||
}
|
||||
|
|
@ -93,19 +93,26 @@ class PublicationVideoForms
|
|||
}
|
||||
|
||||
public function formatUrl($url): string {
|
||||
$videoId = '';
|
||||
$videoIdYoutube = '';
|
||||
$videoIdRutube = '';
|
||||
$videoUrl = '';
|
||||
switch (true) {
|
||||
case str_contains($url, $mask = 'https://youtu.be/'):
|
||||
case str_contains($url, $mask = 'https://www.youtube.com/watch?v='):
|
||||
$videoId = str_replace($mask, '', $url);
|
||||
$videoIdYoutube = str_replace($mask, '', $url);
|
||||
break;
|
||||
case str_contains($url, $mask = 'https://rutube.ru/video/'):
|
||||
$videoIdRutube = str_replace($mask, '', $url);
|
||||
break;
|
||||
default:
|
||||
$videoUrl = $url;
|
||||
break;
|
||||
}
|
||||
if ($videoId != '') {
|
||||
$videoUrl = "https://www.youtube.com/embed/$videoId";
|
||||
if ($videoIdYoutube != '') {
|
||||
$videoUrl = "https://www.youtube.com/embed/$videoIdYoutube";
|
||||
}
|
||||
if ($videoIdRutube != '') {
|
||||
$videoUrl = "https://rutube.ru/play/embed/$videoIdRutube";
|
||||
}
|
||||
return $videoUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ class DictionariesTableSeeder extends Seeder {
|
|||
'title' => 'Перечни ПП',
|
||||
'items' => ['pp1521' => 'ПП №1521 от 26.12.2014 г.', 'pp985' => 'ПП № 985 от 04.07.2020 г.', 'pp815' => 'ПП № 815 от 28.05.2021 г.']
|
||||
],
|
||||
'images-types' => [
|
||||
'image-type' => [
|
||||
'title' => 'Тип изображения',
|
||||
'items' => ['full-width' => 'во всю ширину', 'tiles' => 'плиткой']
|
||||
'items' => ['full-width' => 'во всю ширину', 'tiles' => 'плиткой', 'carousel' => 'карусель']
|
||||
],
|
||||
'activities' => [
|
||||
'title' => 'Направления деятельности',
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ class FieldsTableSeeder extends Seeder {
|
|||
'multiple' => true,
|
||||
'required' => true
|
||||
],
|
||||
'images-type' => [
|
||||
'image-type' => [
|
||||
'title' => 'Тип изображения',
|
||||
'type' => FieldType::RELATION,
|
||||
'required' => true,
|
||||
'params' => [
|
||||
'related' => DictionaryItem::class, 'transformer' => DictionaryItemTransformer::class,
|
||||
'options' => ['show' => true, 'whereHas' => ['dictionary' => ['name' => 'images-types']]]
|
||||
'options' => ['show' => true, 'whereHas' => ['dictionary' => ['name' => 'image-type']]]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class ObjectTypeFieldsTableSeeder extends Seeder {
|
|||
|
||||
'page-section-images' => [
|
||||
'common' => [
|
||||
'fields' => ['images-required', 'images-type']
|
||||
'fields' => ['images-required', 'image-type']
|
||||
]
|
||||
],
|
||||
'page-section-documents' => [
|
||||
|
|
|
|||
|
|
@ -14,69 +14,56 @@ class PagesTableSeeder extends Seeder
|
|||
public array $pages = [
|
||||
'О центре' => [
|
||||
'children' => [
|
||||
'История' => [],
|
||||
'Руководство' => [],
|
||||
'Документы' => [
|
||||
'children' => [
|
||||
'Документы об учреждении' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Нормативные правовые акты' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Наблюдательный совет' => [],
|
||||
'Государственное задание' => [],
|
||||
'Закупки' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Бухгалтерская отчетность' => [],
|
||||
'Государственное задание' => [],
|
||||
'Нормативные правовые акты' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Антимонопольное законодательство' => [],
|
||||
'Специальная оценка условий труда' => []
|
||||
]
|
||||
],
|
||||
'Структура' => [],
|
||||
'Наблюдательный совет' => [
|
||||
'children' => [
|
||||
'Структура' => [],
|
||||
'Документы' => [],
|
||||
'Решения' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE]
|
||||
]
|
||||
],
|
||||
'Закупки' => [],
|
||||
'Противодействие коррупции' => [
|
||||
'children' => [
|
||||
'ФЗ, указы, постановления' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CATEGORIZED],
|
||||
'Ведомственные нормативные правовые акты' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Внутренние нормативные документы' => [],
|
||||
'Антикоррупционная экспертиза' => [],
|
||||
'Методические материалы' => [],
|
||||
'Формы документов для заполнения' => [],
|
||||
'Финансовые сведения' => [],
|
||||
'Aттестационная комиссия' => [],
|
||||
'Обратная связь' => [],
|
||||
'Остальные документы' => []
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'Деятельность' => [
|
||||
'children' => [
|
||||
'Нормирование и стандартизация' => [
|
||||
'children' => [
|
||||
'Реестр сводов правил' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RULESET],
|
||||
'Разработка сводов правил' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::DEVELOPMENTS],
|
||||
'Прикладные исследования' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RESEARCHES],
|
||||
'Реестр нормативно-технической документации' => [],
|
||||
'Методические материалы' => [],
|
||||
]
|
||||
],
|
||||
'Оценка пригодности' => [
|
||||
'children' => [
|
||||
'Реестр технических свидетельств' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::TECHNICAL_CERTIFICATES],
|
||||
'Заявка на оформление' => [],
|
||||
'Предварительная заявка' => [],
|
||||
'Консультационные услуги' => [],
|
||||
]
|
||||
],
|
||||
'Технический комитет 465 «Строительство»' => [
|
||||
'ТК 465 “Строительство”' => [
|
||||
'children' => [
|
||||
'Руководство' => [],
|
||||
'Секретариат' => [],
|
||||
'Структура' => ['type' => PageType::TK_STRUCTURE],
|
||||
'Состав' => [],
|
||||
'Документы' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CATEGORIZED],
|
||||
'АИС ТК 465 «Строительство»' => [],
|
||||
'АИС ТК 465 “Строительство”' => [],
|
||||
//'Структура' => ['type' => PageType::TK_STRUCTURE],
|
||||
]
|
||||
],
|
||||
'Реестр требований ФЗ-63' => [],
|
||||
'Нормирование и стандартизация' => [
|
||||
'children' => [
|
||||
'Реестр нормативно-технической документации' => [],
|
||||
'Разработка сводов правил' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::DEVELOPMENTS],
|
||||
'Прикладные исследования' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RESEARCHES],
|
||||
'Методические материалы' => [],
|
||||
//'Реестр сводов правил' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RULESET],
|
||||
]
|
||||
],
|
||||
'Международная деятельность' => [
|
||||
'children' => [
|
||||
'ISO' => [],
|
||||
'МТК 465 “Строительство”' => [],
|
||||
'Межправительственный совет' => [],
|
||||
'Базовая организация СНГ' => [],
|
||||
'Разработка ТР ЕАЭС' => [],
|
||||
]
|
||||
],
|
||||
'СТУ' => [
|
||||
|
|
@ -87,41 +74,41 @@ class PagesTableSeeder extends Seeder
|
|||
'Ответы на часто задаваемые вопросы' => [],
|
||||
]
|
||||
],
|
||||
'КСИ' => [
|
||||
'children' => [
|
||||
|
||||
]
|
||||
],
|
||||
'КСИ' => [],
|
||||
'Добровольная сертификация' => [
|
||||
'children' => [
|
||||
'О системе' => [],
|
||||
'Основополагающие документы' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CATEGORIZED],
|
||||
'Решения ЦОС' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Руководящие документы' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
'Реестр органов по сертификации' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFIERS],
|
||||
'Реестр испытательных лабораторий' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::LABORATORIES],
|
||||
'Реестр экспертов' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::EXPERTS],
|
||||
'Реестр сертификатов соответствия' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFICATES],
|
||||
'Реестры' => [],
|
||||
// 'Реестр органов по сертификации' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFIERS],
|
||||
// 'Реестр испытательных лабораторий' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::LABORATORIES],
|
||||
// 'Реестр экспертов' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::EXPERTS],
|
||||
// 'Реестр сертификатов соответствия' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFICATES],
|
||||
'Бланки документов' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
|
||||
]
|
||||
],
|
||||
'Международная деятельность' => [
|
||||
'children' => [
|
||||
'ISO' => [],
|
||||
'МТК 465 «Строительство»' => [],
|
||||
'Межправительственный совет' => [],
|
||||
'Базовая организация СНГ' => [],
|
||||
]
|
||||
],
|
||||
'Услуги' => [
|
||||
'children' => [
|
||||
'Технические свидетельства' => [
|
||||
'children' => [
|
||||
'Консалтинговые услуги ТС' => [],
|
||||
]
|
||||
],
|
||||
'Коммерческие услуги' => [
|
||||
'Консалтинг' => [
|
||||
'children' => [
|
||||
'Сопровождение экспертизы и утверждения СП и ГОСТ' => [],
|
||||
'Сопровождение разработки и утверждения СП и ГОСТ' => [],
|
||||
'Консалтинговые услуги по разработке СП и ГОСТ' => [],
|
||||
'Экспертиза СТО и ТУ' => [],
|
||||
'Редактирование и нормоконтроль' => [],
|
||||
'Экспертиза тех регулирования' => [],
|
||||
'Разработка нормативных документов' => [],
|
||||
'Нормативный консалтинг' => [],
|
||||
]
|
||||
],
|
||||
'Портфолио проектов' => [
|
||||
'type' => PageType::PUBLICATIONS,
|
||||
'sub_type' => PageSubType::PUBLICATION_PORTFOLIO
|
||||
],
|
||||
]
|
||||
],
|
||||
'Пресс-центр' => [
|
||||
|
|
@ -130,18 +117,22 @@ class PagesTableSeeder extends Seeder
|
|||
'type' => PageType::PUBLICATIONS,
|
||||
'sub_type' => PageSubType::PUBLICATION_NEWS
|
||||
],
|
||||
'СМИ о нас' => [
|
||||
'type' => PageType::PUBLICATIONS,
|
||||
'sub_type' => PageSubType::PUBLICATION_SMI
|
||||
],
|
||||
'Фотогалерея' => [
|
||||
'type' => PageType::PUBLICATIONS,
|
||||
'sub_type' => PageSubType::PUBLICATION_PHOTOS
|
||||
],
|
||||
'Видеоархив' => [
|
||||
'type' => PageType::PUBLICATIONS,
|
||||
'sub_type' => PageSubType::PUBLICATION_VIDEO
|
||||
'Медиа' => [
|
||||
// 'type' => PageType::PUBLICATIONS,
|
||||
// 'sub_type' => PageSubType::PUBLICATION_NEWS
|
||||
],
|
||||
// 'СМИ о нас' => [
|
||||
// 'type' => PageType::PUBLICATIONS,
|
||||
// 'sub_type' => PageSubType::PUBLICATION_SMI
|
||||
// ],
|
||||
// 'Фотогалерея' => [
|
||||
// 'type' => PageType::PUBLICATIONS,
|
||||
// 'sub_type' => PageSubType::PUBLICATION_PHOTOS
|
||||
// ],
|
||||
// 'Видеоархив' => [
|
||||
// 'type' => PageType::PUBLICATIONS,
|
||||
// 'sub_type' => PageSubType::PUBLICATION_VIDEO
|
||||
// ],
|
||||
'Контакты для СМИ' => [],
|
||||
]
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue