diff --git a/.bowerrc b/.bowerrc new file mode 100755 index 0000000..1669168 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory" : "vendor/bower" +} diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..c346f28 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# yii console command +/yii + +# phpstorm project files +.idea + +# netbeans project files +nbproject + +# zend studio for eclipse project files +.buildpath +.project +.settings + +# windows thumbnail cache +Thumbs.db + +# composer vendor dir +/vendor + +# composer itself is not needed +composer.phar + +# Mac DS_Store Files +.DS_Store + +# phpunit itself is not needed +phpunit.phar +# local phpunit config +/phpunit.xml + +# vagrant runtime +/.vagrant diff --git a/.htaccess b/.htaccess new file mode 100755 index 0000000..7537f47 --- /dev/null +++ b/.htaccess @@ -0,0 +1,165 @@ +AddDefaultCharset utf-8 +Header set Expires "Thu, 19 Nov 1981 08:52:00 GM" +Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0" +Header set Pragma "no-cache" + + + + Options +FollowSymlinks + + RewriteEngine On + + + + + + RewriteBase / + # deal with admin first + + + + + RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] + + RewriteCond %{REQUEST_URI} ^/(admin) + + + + RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] + + RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] + + RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L] + + RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L] + + RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L] + + + + + + RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/ + + RewriteCond %{REQUEST_URI} ^/(admin) + + RewriteRule ^.*$ backend/web/index.php [L] + + + RewriteCond %{REQUEST_URI} ^/(assets|css) + + RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L] + + RewriteRule ^css/(.*)$ frontend/web/css/$1 [L] + + RewriteRule ^js/(.*)$ frontend/web/js/$1 [L] + + RewriteRule ^images/(.*)$ frontend/web/images/$1 [L] + + RewriteRule ^libraries/(.*)$ frontend/web/libraries/$1 [L] + + RewriteRule ^img/(.*)$ frontend/web/img/$1 [L] + + RewriteRule ^files/(.*)$ frontend/web/files/$1 [L] + + RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L] + + RewriteRule robots.txt$ frontend/web/robots.txt [L] + + + RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|txt|js|images|fonts|img|files)/ + + RewriteCond %{REQUEST_URI} !index.php + + RewriteCond %{REQUEST_FILENAME} !-f [OR] + + RewriteCond %{REQUEST_FILENAME} !-d + + + RewriteCond %{HTTP_HOST} ^www\.(.*) + RewriteRule ^(.*)$ frontend/web/index.php + + + RewriteCond %{HTTP_HOST} ^([^www].*)$ + RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + + RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] + RewriteRule /$ /%1 [R,L] + + + + +# RewriteCond %{HTTP_HOST} ^([^www].*)$ +# RewriteRule ^(.*)$ http://www.%1/$1 [R=301] + + + +#для возможности загрузки файлов парсера + + php_value upload_max_filesize 20M + php_value post_max_size 30M + + + +# кеширование в браузере на стороне пользователя +# +#ExpiresActive On +#ExpiresDefault "access 7 days" +#ExpiresByType application/javascript "access plus 1 year" +#ExpiresByType text/javascript "access plus 1 year" +#ExpiresByType text/css "access plus 1 year" +#ExpiresByType text/html "access plus 7 day" +#ExpiresByType text/x-javascript "access 1 year" +#ExpiresByType image/gif "access plus 1 year" +#ExpiresByType image/jpeg "access plus 1 year" +#ExpiresByType image/png "access plus 1 year" +#ExpiresByType image/jpg "access plus 1 year" +#ExpiresByType image/x-icon "access 1 year" +#ExpiresByType application/x-shockwave-flash "access 1 year" +# +# +# +#AddOutputFilterByType DEFLATE text/plain +#AddOutputFilterByType DEFLATE text/html +#AddOutputFilterByType DEFLATE text/xml +#AddOutputFilterByType DEFLATE text/css +#AddOutputFilterByType DEFLATE application/xml +#AddOutputFilterByType DEFLATE application/xhtml+xml +#AddOutputFilterByType DEFLATE application/rss+xml +#AddOutputFilterByType DEFLATE application/javascript +#AddOutputFilterByType DEFLATE application/x-javascript +#BrowserMatch ^Mozilla/4 gzip-only-text/html +#BrowserMatch ^Mozilla/4\.0[678] no-gzip +#BrowserMatch \bMSIE !no-gzip !gzip-only-text/html +#Header append Vary User-Agent +#RewriteEngine On +#AddEncoding gzip .gz +#RewriteCond %{HTTP:Accept-encoding} gzip +#RewriteCond %{REQUEST_FILENAME}.gz -f +#RewriteRule ^(.*)$ $1.gz [QSA,L] +# +# Cache-Control +# +## 30 дней +# +#Header set Cache-Control "max-age=2592000, public" +# +## 30 дней +# +#Header set Cache-Control "max-age=2592000, public" +# +## 2 дня +# +#Header set Cache-Control "max-age=172800, public, must-revalidate" +# +## 1 день +# +#Header set Cache-Control "max-age=172800, private, must-revalidate" +# +# + +#Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE + +BrowserMatch "MSIE" force-no-vary +BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary + \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100755 index 0000000..e98f03d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,32 @@ +The Yii framework is free software. It is released under the terms of +the following BSD License. + +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Yii Software LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100755 index 0000000..45e56ad --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +Yii 2 Advanced Project Template +=============================== + +Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for +developing complex Web applications with multiple tiers. + +The template includes three tiers: front end, back end, and console, each of which +is a separate Yii application. + +The template is designed to work in a team development environment. It supports +deploying the application in different environments. + +Documentation is at [docs/guide/README.md](docs/guide/README.md). + +[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-advanced/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-advanced) +[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-advanced/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-advanced) +[![Build Status](https://travis-ci.org/yiisoft/yii2-app-advanced.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-advanced) + +DIRECTORY STRUCTURE +------------------- + +``` +common + config/ contains shared configurations + mail/ contains view files for e-mails + models/ contains model classes used in both backend and frontend +console + config/ contains console configurations + controllers/ contains console controllers (commands) + migrations/ contains database migrations + models/ contains console-specific model classes + runtime/ contains files generated during runtime +backend + assets/ contains application assets such as JavaScript and CSS + config/ contains backend configurations + controllers/ contains Web controller classes + models/ contains backend-specific model classes + runtime/ contains files generated during runtime + views/ contains view files for the Web application + web/ contains the entry script and Web resources +frontend + assets/ contains application assets such as JavaScript and CSS + config/ contains frontend configurations + controllers/ contains Web controller classes + models/ contains frontend-specific model classes + runtime/ contains files generated during runtime + views/ contains view files for the Web application + web/ contains the entry script and Web resources + widgets/ contains frontend widgets +vendor/ contains dependent 3rd-party packages +environments/ contains environment-based overrides +tests contains various tests for the advanced application + codeception/ contains tests developed with Codeception PHP Testing Framework +``` diff --git a/Vagrantfile b/Vagrantfile new file mode 100755 index 0000000..689a92c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,72 @@ +require 'yaml' +require 'fileutils' + +domains = { + frontend: 'y2aa-frontend.dev', + backend: 'y2aa-backend.dev' +} + +config = { + local: './vagrant/config/vagrant-local.yml', + example: './vagrant/config/vagrant-local.example.yml' +} + +# copy config from example if local config not exists +FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local]) +# read config +options = YAML.load_file config[:local] + +# check github token +if options['github_token'].nil? || options['github_token'].to_s.length != 40 + puts "You must place REAL GitHub token into configuration:\n/yii2-app-advancded/vagrant/config/vagrant-local.yml" + exit +end + +# vagrant configurate +Vagrant.configure(2) do |config| + # select the box + config.vm.box = 'ubuntu/trusty64' + + # should we ask about box updates? + config.vm.box_check_update = options['box_check_update'] + + config.vm.provider 'virtualbox' do |vb| + # machine cpus count + vb.cpus = options['cpus'] + # machine memory size + vb.memory = options['memory'] + # machine name (for VirtualBox UI) + vb.name = options['machine_name'] + end + + # machine name (for vagrant console) + config.vm.define options['machine_name'] + + # machine name (for guest machine console) + config.vm.hostname = options['machine_name'] + + # network settings + config.vm.network 'private_network', ip: options['ip'] + + # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine) + config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant' + + # disable folder '/vagrant' (guest machine) + config.vm.synced_folder '.', '/vagrant', disabled: true + + # hosts settings (host machine) + config.vm.provision :hostmanager + config.hostmanager.enabled = true + config.hostmanager.manage_host = true + config.hostmanager.ignore_private_ip = false + config.hostmanager.include_offline = true + config.hostmanager.aliases = domains.values + + # provisioners + config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']] + config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false + config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always' + + # post-install message (vagrant console) + config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}" +end diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php new file mode 100755 index 0000000..940c0af --- /dev/null +++ b/backend/assets/AppAsset.php @@ -0,0 +1,23 @@ + 'app-backend', + 'basePath' => dirname(__DIR__), + 'controllerNamespace' => 'backend\controllers', + 'bootstrap' => ['log'], + 'modules' => [], + 'components' => [ + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + /* + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'rules' => [ + ], + ], + */ + ], + 'params' => $params, +]; diff --git a/backend/config/params.php b/backend/config/params.php new file mode 100755 index 0000000..7f754b9 --- /dev/null +++ b/backend/config/params.php @@ -0,0 +1,4 @@ + 'admin@example.com', +]; diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php new file mode 100755 index 0000000..01d9ad8 --- /dev/null +++ b/backend/controllers/SiteController.php @@ -0,0 +1,83 @@ + [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => ['login', 'error'], + 'allow' => true, + ], + [ + 'actions' => ['logout', 'index'], + 'allow' => true, + 'roles' => ['@'], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => ['post'], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + public function actionIndex() + { + return $this->render('index'); + } + + public function actionLogin() + { + if (!Yii::$app->user->isGuest) { + return $this->goHome(); + } + + $model = new LoginForm(); + if ($model->load(Yii::$app->request->post()) && $model->login()) { + return $this->goBack(); + } else { + return $this->render('login', [ + 'model' => $model, + ]); + } + } + + public function actionLogout() + { + Yii::$app->user->logout(); + + return $this->goHome(); + } +} diff --git a/backend/models/.gitkeep b/backend/models/.gitkeep new file mode 100755 index 0000000..72e8ffc --- /dev/null +++ b/backend/models/.gitkeep @@ -0,0 +1 @@ +* diff --git a/backend/runtime/.gitignore b/backend/runtime/.gitignore new file mode 100755 index 0000000..c96a04f --- /dev/null +++ b/backend/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php new file mode 100755 index 0000000..62d5992 --- /dev/null +++ b/backend/views/layouts/main.php @@ -0,0 +1,79 @@ + +beginPage() ?> + + + + + + + <?= Html::encode($this->title) ?> + head() ?> + + +beginBody() ?> + +
+ 'My Company', + 'brandUrl' => Yii::$app->homeUrl, + 'options' => [ + 'class' => 'navbar-inverse navbar-fixed-top', + ], + ]); + $menuItems = [ + ['label' => 'Home', 'url' => ['/site/index']], + ]; + if (Yii::$app->user->isGuest) { + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; + } else { + $menuItems[] = '
  • ' + . Html::beginForm(['/site/logout'], 'post') + . Html::submitButton( + 'Logout (' . Yii::$app->user->identity->username . ')', + ['class' => 'btn btn-link'] + ) + . Html::endForm() + . '
  • '; + } + echo Nav::widget([ + 'options' => ['class' => 'navbar-nav navbar-right'], + 'items' => $menuItems, + ]); + NavBar::end(); + ?> + +
    + isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], + ]) ?> + + +
    +
    + + + +endBody() ?> + + +endPage() ?> diff --git a/backend/views/site/error.php b/backend/views/site/error.php new file mode 100755 index 0000000..0ba2574 --- /dev/null +++ b/backend/views/site/error.php @@ -0,0 +1,27 @@ +title = $name; +?> +
    + +

    title) ?>

    + +
    + +
    + +

    + The above error occurred while the Web server was processing your request. +

    +

    + Please contact us if you think this is a server error. Thank you. +

    + +
    diff --git a/backend/views/site/index.php b/backend/views/site/index.php new file mode 100755 index 0000000..f780610 --- /dev/null +++ b/backend/views/site/index.php @@ -0,0 +1,53 @@ +title = 'My Yii Application'; +?> +
    + +
    +

    Congratulations!

    + +

    You have successfully created your Yii-powered application.

    + +

    Get started with Yii

    +
    + +
    + +
    +
    +

    Heading

    + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

    + +

    Yii Documentation »

    +
    +
    +

    Heading

    + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

    + +

    Yii Forum »

    +
    +
    +

    Heading

    + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

    + +

    Yii Extensions »

    +
    +
    + +
    +
    diff --git a/backend/views/site/login.php b/backend/views/site/login.php new file mode 100755 index 0000000..20f3f78 --- /dev/null +++ b/backend/views/site/login.php @@ -0,0 +1,35 @@ +title = 'Login'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    +

    title) ?>

    + +

    Please fill out the following fields to login:

    + +
    +
    + 'login-form']); ?> + + field($model, 'username')->textInput(['autofocus' => true]) ?> + + field($model, 'password')->passwordInput() ?> + + field($model, 'rememberMe')->checkbox() ?> + +
    + 'btn btn-primary', 'name' => 'login-button']) ?> +
    + + +
    +
    +
    diff --git a/backend/web/.gitignore b/backend/web/.gitignore new file mode 100755 index 0000000..25c74e6 --- /dev/null +++ b/backend/web/.gitignore @@ -0,0 +1,2 @@ +/index.php +/index-test.php diff --git a/backend/web/assets/.gitignore b/backend/web/assets/.gitignore new file mode 100755 index 0000000..d6b7ef3 --- /dev/null +++ b/backend/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/backend/web/css/site.css b/backend/web/css/site.css new file mode 100755 index 0000000..49ee8fb --- /dev/null +++ b/backend/web/css/site.css @@ -0,0 +1,111 @@ +html, +body { + height: 100%; +} + +.wrap { + min-height: 100%; + height: auto; + margin: 0 auto -60px; + padding: 0 0 60px; +} + +.wrap > .container { + padding: 70px 15px 20px; +} + +.footer { + height: 60px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + padding-top: 20px; +} + +.jumbotron { + text-align: center; + background-color: transparent; +} + +.jumbotron .btn { + font-size: 21px; + padding: 14px 24px; +} + +.not-set { + color: #c55; + font-style: italic; +} + +/* add sorting icons to gridview sort links */ +a.asc:after, a.desc:after { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + padding-left: 5px; +} + +a.asc:after { + content: /*"\e113"*/ "\e151"; +} + +a.desc:after { + content: /*"\e114"*/ "\e152"; +} + +.sort-numerical a.asc:after { + content: "\e153"; +} + +.sort-numerical a.desc:after { + content: "\e154"; +} + +.sort-ordinal a.asc:after { + content: "\e155"; +} + +.sort-ordinal a.desc:after { + content: "\e156"; +} + +.grid-view td { + white-space: nowrap; +} + +.grid-view .filters input, +.grid-view .filters select { + min-width: 50px; +} + +.hint-block { + display: block; + margin-top: 5px; + color: #999; +} + +.error-summary { + color: #a94442; + background: #fdf7f7; + border-left: 3px solid #eed3d7; + padding: 10px 20px; + margin: 0 0 15px 0; +} + +/* align the logout "link" (button in form) of the navbar */ +.nav > li > form { + padding: 8px; +} + +@media(max-width:768px) { + .nav li > form { + padding: 3px; + } +} + +.nav > li > form > button:hover { + text-decoration: none; +} diff --git a/backend/web/favicon.ico b/backend/web/favicon.ico new file mode 100755 index 0000000..580ed73 Binary files /dev/null and b/backend/web/favicon.ico differ diff --git a/backend/web/robots.txt b/backend/web/robots.txt new file mode 100755 index 0000000..1f53798 --- /dev/null +++ b/backend/web/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/common/config/.gitignore b/common/config/.gitignore new file mode 100755 index 0000000..97c0f01 --- /dev/null +++ b/common/config/.gitignore @@ -0,0 +1,2 @@ +main-local.php +params-local.php diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php new file mode 100755 index 0000000..93d0185 --- /dev/null +++ b/common/config/bootstrap.php @@ -0,0 +1,5 @@ + 'Europe/Kiev', + 'language' => 'ru-RU', + 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', + 'components' => [ + 'i18n' => [ + 'translations' => [ + 'frontend' => [ + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => '@frontend/messages', + 'sourceLanguage' => 'en-US', + 'fileMap' => [ + 'app' => 'app.php' + ], + ], + ], + ], + 'cache' => [ + 'class' => 'yii\caching\FileCache', + ], + ], +]; diff --git a/common/config/params.php b/common/config/params.php new file mode 100755 index 0000000..4ec9ba6 --- /dev/null +++ b/common/config/params.php @@ -0,0 +1,6 @@ + 'admin@example.com', + 'supportEmail' => 'support@example.com', + 'user.passwordResetTokenExpire' => 3600, +]; diff --git a/common/mail/layouts/html.php b/common/mail/layouts/html.php new file mode 100755 index 0000000..bddbc61 --- /dev/null +++ b/common/mail/layouts/html.php @@ -0,0 +1,22 @@ + +beginPage() ?> + + + + + <?= Html::encode($this->title) ?> + head() ?> + + + beginBody() ?> + + endBody() ?> + + +endPage() ?> diff --git a/common/mail/layouts/text.php b/common/mail/layouts/text.php new file mode 100755 index 0000000..7087cea --- /dev/null +++ b/common/mail/layouts/text.php @@ -0,0 +1,12 @@ + +beginPage() ?> +beginBody() ?> + +endBody() ?> +endPage() ?> diff --git a/common/mail/passwordResetToken-html.php b/common/mail/passwordResetToken-html.php new file mode 100755 index 0000000..f3daf49 --- /dev/null +++ b/common/mail/passwordResetToken-html.php @@ -0,0 +1,15 @@ +urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); +?> +
    +

    Hello username) ?>,

    + +

    Follow the link below to reset your password:

    + +

    +
    diff --git a/common/mail/passwordResetToken-text.php b/common/mail/passwordResetToken-text.php new file mode 100755 index 0000000..244c0cb --- /dev/null +++ b/common/mail/passwordResetToken-text.php @@ -0,0 +1,12 @@ +urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); +?> +Hello username ?>, + +Follow the link below to reset your password: + + diff --git a/common/models/FlowIntensity.php b/common/models/FlowIntensity.php new file mode 100644 index 0000000..41092ea --- /dev/null +++ b/common/models/FlowIntensity.php @@ -0,0 +1,225 @@ + TimestampBehavior::className(), + 'createdAtAttribute' => 'date_add', + 'updatedAtAttribute' => false, + ], + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'road_id', + 'region_id', + 'road_direction_id', + 'settlement_id', + 'intensity_total', + 'intensity_increase', + 'intensity_moto', + 'intensity_moto_sidecar', + 'intensity_car', + 'intensity_truck_two', + 'intensity_truck_two_six', + 'intensity_truck_six_eight', + 'intensity_truck_eight_fourteen', + 'intensity_truck_fourteen', + 'intensity_lorry_twelve', + 'intensity_lorry_twelve_twenty', + 'intensity_lorry_twenty_thirty', + 'intensity_lorry_thirty', + 'intensity_tractor_under_ten', + 'intensity_tractor_over_ten', + 'intensity_bus', + 'intensity_bus_coupled', + ], + 'integer', + ], + [ + [ + 'location', + 'begin', + 'end', + ], + 'number', + ], + [ + [ 'region_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Region::className(), + 'targetAttribute' => [ 'region_id' => 'region_id' ], + ], + [ + [ 'road_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Road::className(), + 'targetAttribute' => [ 'road_id' => 'road_id' ], + ], + [ + [ 'road_direction_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => RoadDirection::className(), + 'targetAttribute' => [ 'road_direction_id' => 'road_direction_id' ], + ], + [ + [ 'settlement_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Settlement::className(), + 'targetAttribute' => [ 'settlement_id' => 'settlement_id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'flow_intensity_id' => 'Індекс', + 'road_id' => 'Автомобільна дорога', + 'region_id' => 'Область', + 'location' => 'Місцезнаходження, км+', + 'begin' => 'Місцезнаходження ділянки з однорідною інтенсивністю руху, км+, початок', + 'end' => 'Місцезнаходження ділянки з однорідною інтенсивністю руху, км+, кінець', + 'road_direction_id' => 'Напрямок смуги руху', + 'settlement_id' => 'Найближчий населений пункт', + 'intensity_total' => 'Інтенсивність руху, авт/добу, всього', + 'intensity_increase' => 'Інтенсивність руху, авт/добу, приріст', + 'intensity_moto' => 'Інтенсивність руху, авт/добу, мотоцикл без коляски та мопед', + 'intensity_moto_sidecar' => 'Інтенсивність руху, авт/добу, мотоцикл з коляскою', + 'intensity_car' => 'Інтенсивність руху, авт/добу, легковий автомобіль', + 'intensity_truck_two' => 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: до 2 т.', + 'intensity_truck_two_six' => 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 2 т. до 6 т.', + 'intensity_truck_six_eight' => 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 6 т. до 8 т.', + 'intensity_truck_eight_fourteen' => 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 8 т. до 14 т.', + 'intensity_truck_fourteen' => 'Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: понад 14 т.', + 'intensity_lorry_twelve' => 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: до 12 т.', + 'intensity_lorry_twelve_twenty' => 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: від 12 т. до 20 т.', + 'intensity_lorry_twenty_thirty' => 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: від 20 т. до 30 т.', + 'intensity_lorry_thirty' => 'Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: понад 30 т.', + 'intensity_tractor_under_ten' => 'Інтенсивність руху, авт/добу, колісний трактор з причепами до 10 т.', + 'intensity_tractor_over_ten' => 'Інтенсивність руху, авт/добу, колісний трактор з причепами понад 10 т.', + 'intensity_bus' => 'Інтенсивність руху, авт/добу, автобус, тролейбус', + 'intensity_bus_coupled' => 'Інтенсивність руху, авт/добу, автобус зчеплений (здвоєний)', + 'date_add' => 'Дата визначення', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRegion() + { + return $this->hasOne(Region::className(), [ 'region_id' => 'region_id' ]) + ->inverseOf('flowIntensities'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoad() + { + return $this->hasOne(Road::className(), [ 'road_id' => 'road_id' ]) + ->inverseOf('flowIntensities'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadDirection() + { + return $this->hasOne(RoadDirection::className(), [ 'road_direction_id' => 'road_direction_id' ]) + ->inverseOf('flowIntensities'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlement() + { + return $this->hasOne(Settlement::className(), [ 'settlement_id' => 'settlement_id' ]) + ->inverseOf('flowIntensities'); + } + + public function getLocationString() + { + return floor($this->location) . '+' . ( str_pad(round(( $this->location - floor($this->location) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + + public function getBeginString() + { + return floor($this->begin) . '+' . ( str_pad(round(( $this->begin - floor($this->begin) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + + public function getEndString() + { + return floor($this->end) . '+' . ( str_pad(round(( $this->end - floor($this->end) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + } diff --git a/common/models/FlowIntensitySearch.php b/common/models/FlowIntensitySearch.php new file mode 100644 index 0000000..1e9ff29 --- /dev/null +++ b/common/models/FlowIntensitySearch.php @@ -0,0 +1,93 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'flow_intensity_id' => $this->flow_intensity_id, + 'road_id' => $this->road_id, + 'region_id' => $this->region_id, + 'location' => $this->location, + 'begin' => $this->begin, + 'end' => $this->end, + 'road_direction_id' => $this->road_direction_id, + 'settlement_id' => $this->settlement_id, + 'intensity_total' => $this->intensity_total, + 'intensity_increase' => $this->intensity_increase, + 'intensity_moto' => $this->intensity_moto, + 'intensity_moto_sidecar' => $this->intensity_moto_sidecar, + 'intensity_car' => $this->intensity_car, + 'intensity_truck_two' => $this->intensity_truck_two, + 'intensity_truck_two_six' => $this->intensity_truck_two_six, + 'intensity_truck_six_eight' => $this->intensity_truck_six_eight, + 'intensity_truck_eight_fourteen' => $this->intensity_truck_eight_fourteen, + 'intensity_truck_fourteen' => $this->intensity_truck_fourteen, + 'intensity_lorry_twelve' => $this->intensity_lorry_twelve, + 'intensity_lorry_twelve_twenty' => $this->intensity_lorry_twelve_twenty, + 'intensity_lorry_twenty_thirty' => $this->intensity_lorry_twenty_thirty, + 'intensity_lorry_thirty' => $this->intensity_lorry_thirty, + 'intensity_tractor_under_ten' => $this->intensity_tractor_under_ten, + 'intensity_tractor_over_ten' => $this->intensity_tractor_over_ten, + 'intensity_bus' => $this->intensity_bus, + 'intensity_bus_coupled' => $this->intensity_bus_coupled, + 'date_add' => $this->date_add, + ]); + + return $dataProvider; + } +} diff --git a/common/models/GoogleRoad.php b/common/models/GoogleRoad.php new file mode 100644 index 0000000..5f3de92 --- /dev/null +++ b/common/models/GoogleRoad.php @@ -0,0 +1,33 @@ +path = $path; + } + + public function execute() + { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "https://roads.googleapis.com/v1/snapToRoads?path=".$this->path."&interpolate=true&key=AIzaSyCaeB8Lppsl-JqjsGWVHxxMQ3WqU8vGlOQ"); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($ch); + curl_close($ch); + return $result; + } + } \ No newline at end of file diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php new file mode 100755 index 0000000..afc1c23 --- /dev/null +++ b/common/models/LoginForm.php @@ -0,0 +1,78 @@ +hasErrors()) { + $user = $this->getUser(); + if (!$user || !$user->validatePassword($this->password)) { + $this->addError($attribute, 'Incorrect username or password.'); + } + } + } + + /** + * Logs in a user using the provided username and password. + * + * @return boolean whether the user is logged in successfully + */ + public function login() + { + if ($this->validate()) { + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); + } else { + return false; + } + } + + /** + * Finds user by [[username]] + * + * @return User|null + */ + protected function getUser() + { + if ($this->_user === null) { + $this->_user = User::findByUsername($this->username); + } + + return $this->_user; + } +} diff --git a/common/models/Organization.php b/common/models/Organization.php new file mode 100644 index 0000000..da9bd48 --- /dev/null +++ b/common/models/Organization.php @@ -0,0 +1,57 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'organization_id' => 'Organization ID', + 'name' => 'Name', + 'date_add' => 'Date Add', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadServices() + { + return $this->hasMany(RoadService::className(), ['organization_id' => 'organization_id'])->inverseOf('organization'); + } +} diff --git a/common/models/Point.php b/common/models/Point.php new file mode 100644 index 0000000..92f6737 --- /dev/null +++ b/common/models/Point.php @@ -0,0 +1,64 @@ + true, 'targetClass' => RoadPassport::className(), 'targetAttribute' => ['road_passport_id' => 'road_passport_id']], + [['km'], 'number', 'min' => $this->roadPassport->begin, 'max' => $this->roadPassport->end], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'point_id' => 'Point ID', + 'road_passport_id' => 'Road Passport ID', + 'lat' => 'Lat', + 'lng' => 'Lng', + 'km' => 'Km', + 'num' => 'Num', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadPassport() + { + return $this->hasOne(RoadPassport::className(), ['road_passport_id' => 'road_passport_id'])->inverseOf('points'); + } +} diff --git a/common/models/Region.php b/common/models/Region.php new file mode 100644 index 0000000..09c57d2 --- /dev/null +++ b/common/models/Region.php @@ -0,0 +1,82 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'region_id' => 'Region ID', + 'name' => 'Name', + 'index' => 'Index', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadPassports() + { + return $this->hasMany(RoadPassport::className(), ['region_id' => 'region_id'])->inverseOf('region'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadServices() + { + return $this->hasMany(RoadService::className(), [ 'region_id' => 'region_id' ]) + ->inverseOf('region'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlementAddressLinks() + { + return $this->hasOne(SettlementAddressLink::className(), ['region' => 'region_id'])->inverseOf('region'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getFlowIntensities() + { + return $this->hasOne(FlowIntensity::className(), [ 'region_id' => 'region_id' ]) + ->inverseOf('region'); + } +} diff --git a/common/models/Road.php b/common/models/Road.php new file mode 100644 index 0000000..9e4aae0 --- /dev/null +++ b/common/models/Road.php @@ -0,0 +1,109 @@ + 0], + [['name'], 'string', 'max' => 255], + [['road_type_id', 'index'], 'unique', 'skipOnError' => true, 'targetAttribute' => ['road_type_id', 'index'], 'message' => 'The combination of Road Type ID and Index has already been taken.'], + [['road_category_id'], 'exist', 'skipOnError' => true, 'targetClass' => RoadCategory::className(), 'targetAttribute' => ['road_category_id' => 'road_category_id']], + [['road_type_id'], 'exist', 'skipOnError' => true, 'targetClass' => RoadType::className(), 'targetAttribute' => ['road_type_id' => 'road_type_id']], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'road_id' => 'Road ID', + 'name' => 'Назва дороги', + 'road_type_id' => 'Тип дороги', + 'road_category_id' => 'Категорія дороги', + 'index' => 'Індекс дороги', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadCategory() + { + return $this->hasOne(RoadCategory::className(), ['road_category_id' => 'road_category_id'])->inverseOf('roads'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadType() + { + return $this->hasOne(RoadType::className(), ['road_type_id' => 'road_type_id'])->inverseOf('roads'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadPassports() + { + return $this->hasMany(RoadPassport::className(), ['road_id' => 'road_id'])->inverseOf('road'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadServices() + { + return $this->hasMany(RoadService::className(), [ 'road_id' => 'road_id' ]) + ->inverseOf('road'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlementAddressLinks() + { + return $this->hasOne(SettlementAddressLink::className(), ['road_id' => 'road_id'])->inverseOf('road'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getFlowIntensities() + { + return $this->hasOne(FlowIntensity::className(), [ 'road_id' => 'road_id' ]) + ->inverseOf('road'); + } +} diff --git a/common/models/RoadCategory.php b/common/models/RoadCategory.php new file mode 100644 index 0000000..207fe77 --- /dev/null +++ b/common/models/RoadCategory.php @@ -0,0 +1,53 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'road_category_id' => 'Road Category ID', + 'value' => 'Категорія дороги', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoads() + { + return $this->hasMany(Road::className(), ['road_category_id' => 'road_category_id'])->inverseOf('roadCategory'); + } +} diff --git a/common/models/RoadDirection.php b/common/models/RoadDirection.php new file mode 100644 index 0000000..7c741fe --- /dev/null +++ b/common/models/RoadDirection.php @@ -0,0 +1,63 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'road_direction_id' => 'Road Direction ID', + 'direction_name' => 'Direction Name', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadServices() + { + return $this->hasMany(RoadService::className(), ['road_direction_id' => 'road_direction_id'])->inverseOf('roadDirection'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getFlowIntensities() + { + return $this->hasOne(FlowIntensity::className(), [ 'road_direction_id' => 'road_direction_id' ]) + ->inverseOf('roadDirection'); + } +} diff --git a/common/models/RoadPassport.php b/common/models/RoadPassport.php new file mode 100644 index 0000000..98cdd02 --- /dev/null +++ b/common/models/RoadPassport.php @@ -0,0 +1,81 @@ + true, 'targetClass' => Region::className(), 'targetAttribute' => ['region_id' => 'region_id']], + [['road_id'], 'exist', 'skipOnError' => true, 'targetClass' => Road::className(), 'targetAttribute' => ['road_id' => 'road_id']], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'road_passport_id' => 'Road Passport ID', + 'road_id' => 'Дорога', + 'region_id' => 'Область', + 'begin' => 'Початок (км+)', + 'end' => 'Кінець (км+)', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getPoints() + { + return $this->hasMany(Point::className(), ['road_passport_id' => 'road_passport_id'])->inverseOf('roadPassport'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRegion() + { + return $this->hasOne(Region::className(), ['region_id' => 'region_id'])->inverseOf('roadPassports'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoad() + { + return $this->hasOne(Road::className(), ['road_id' => 'road_id'])->inverseOf('roadPassports'); + } +} diff --git a/common/models/RoadService.php b/common/models/RoadService.php new file mode 100644 index 0000000..196e324 --- /dev/null +++ b/common/models/RoadService.php @@ -0,0 +1,173 @@ + 1991, + 'max' => date('Y'), + ], + [ + [ 'organization_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Organization::className(), + 'targetAttribute' => [ 'organization_id' => 'organization_id' ], + ], + [ + [ 'region_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Region::className(), + 'targetAttribute' => [ 'region_id' => 'region_id' ], + ], + [ + [ 'road_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Road::className(), + 'targetAttribute' => [ 'road_id' => 'road_id' ], + ], + [ + [ 'road_direction_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => RoadDirection::className(), + 'targetAttribute' => [ 'road_direction_id' => 'road_direction_id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'road_service_id' => 'Індекс', + 'road_id' => 'Автомобільна дорога', + 'region_id' => 'Область', + 'begin' => 'Місцезнаходження, км+ початок', + 'end' => 'Місцезнаходження, км+ кінець', + 'road_direction_id' => 'Напрямок смуги руху', + 'organization_id' => 'Назва організації чи підприємства, що обслуговує ділянку дороги', + 'year_begin' => 'Рік початку обслуговування', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOrganization() + { + return $this->hasOne(Organization::className(), [ 'organization_id' => 'organization_id' ]) + ->inverseOf('roadServices'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRegion() + { + return $this->hasOne(Region::className(), [ 'region_id' => 'region_id' ]) + ->inverseOf('roadServices'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoad() + { + return $this->hasOne(Road::className(), [ 'road_id' => 'road_id' ]) + ->inverseOf('roadServices'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoadDirection() + { + return $this->hasOne(RoadDirection::className(), [ 'road_direction_id' => 'road_direction_id' ]) + ->inverseOf('roadServices'); + } + + public function getTitle() + { + $title = ''; + $title .= $this->road->name; + $title .= ' км ' . $this->getBeginString() . ' - км ' . $this->getEndString(); + return $title; + } + + public function getBeginString() + { + return floor($this->begin) . '+' . ( str_pad(( ( $this->begin - floor($this->begin) ) * 1000 ), 3, '0', STR_PAD_LEFT) ); + } + + public function getEndString() + { + return floor($this->end) . '+' . ( str_pad(( ( $this->end - floor($this->end) ) * 1000 ), 3, '0', STR_PAD_LEFT) ); + } + } diff --git a/common/models/RoadServiceSearch.php b/common/models/RoadServiceSearch.php new file mode 100644 index 0000000..26acb76 --- /dev/null +++ b/common/models/RoadServiceSearch.php @@ -0,0 +1,74 @@ +joinWith(['road', 'region', 'organization', 'roadDirection']); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'road_service_id' => $this->road_service_id, + 'road_id' => $this->road_id, + 'region_id' => $this->region_id, + 'begin' => $this->begin, + 'end' => $this->end, + 'road_direction_id' => $this->road_direction_id, + 'organization_id' => $this->organization_id, + 'year_begin' => $this->year_begin, + ]); + + return $dataProvider; + } +} diff --git a/common/models/RoadType.php b/common/models/RoadType.php new file mode 100644 index 0000000..b54a219 --- /dev/null +++ b/common/models/RoadType.php @@ -0,0 +1,53 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'road_type_id' => 'Road Type ID', + 'value' => 'Тип дороги', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoads() + { + return $this->hasMany(Road::className(), ['road_type_id' => 'road_type_id'])->inverseOf('roadType'); + } +} diff --git a/common/models/Settlement.php b/common/models/Settlement.php new file mode 100644 index 0000000..aa6982d --- /dev/null +++ b/common/models/Settlement.php @@ -0,0 +1,65 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'settlement_id' => 'Settlement ID', + 'name' => 'Name', + 'sign' => 'Sign', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlementAddressLinks() + { + return $this->hasMany(SettlementAddressLink::className(), ['settlement_id' => 'settlement_id'])->inverseOf('settlement'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getFlowIntensities() + { + return $this->hasOne(FlowIntensity::className(), [ 'settlement_id' => 'settlement_id' ]) + ->inverseOf('settlement'); + } +} diff --git a/common/models/SettlementAddressLink.php b/common/models/SettlementAddressLink.php new file mode 100644 index 0000000..62f55c0 --- /dev/null +++ b/common/models/SettlementAddressLink.php @@ -0,0 +1,165 @@ + 0, + ], + [ + [ 'region_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Region::className(), + 'targetAttribute' => [ 'region_id' => 'region_id' ], + ], + [ + [ 'road_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Road::className(), + 'targetAttribute' => [ 'road_id' => 'road_id' ], + ], + [ + [ 'settlement_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Settlement::className(), + 'targetAttribute' => [ 'settlement_id' => 'settlement_id' ], + ], + [ + [ 'settlement_location_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => SettlementLocation::className(), + 'targetAttribute' => [ 'settlement_location_id' => 'settlement_location_id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'settlement_address_link_id' => 'Індекс', + 'road_id' => 'Автомобільна дорога', + 'region_id' => 'Область', + 'begin' => 'Місцезнаходження, км+ початок', + 'end' => 'Місцезнаходження, км+ кінець', + 'settlement_location_id' => 'Місце', + 'settlement_id' => 'Назва населенного пункту', + 'distance' => 'Відстань від проїзної частини до забудови, м', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRegion() + { + return $this->hasOne(Region::className(), [ 'region_id' => 'region_id' ]) + ->inverseOf('settlementAddressLinks'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoad() + { + return $this->hasOne(Road::className(), [ 'road_id' => 'road_id' ]) + ->inverseOf('settlementAddressLinks'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlement() + { + return $this->hasOne(Settlement::className(), [ 'settlement_id' => 'settlement_id' ]) + ->inverseOf('settlementAddressLinks'); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlementLocation() + { + return $this->hasOne(SettlementLocation::className(), [ 'settlement_location_id' => 'settlement_location_id' ]) + ->inverseOf('settlementAddressLinks'); + } + + public function getBeginString() + { + return floor($this->begin) . '+' . ( str_pad(round(( $this->begin - floor($this->begin) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + + public function getEndString() + { + return floor($this->end) . '+' . ( str_pad(round(( $this->end - floor($this->end) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + } diff --git a/common/models/SettlementAddressLinkSearch.php b/common/models/SettlementAddressLinkSearch.php new file mode 100644 index 0000000..3ee5f5c --- /dev/null +++ b/common/models/SettlementAddressLinkSearch.php @@ -0,0 +1,74 @@ +joinWith(['road', 'region', 'settlement', 'settlementLocation']); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'settlement_address_link_id' => $this->settlement_address_link_id, + 'road_id' => $this->road_id, + 'region_id' => $this->region_id, + 'begin' => $this->begin, + 'end' => $this->end, + 'settlement_location_id' => $this->settlement_location_id, + 'settlement_id' => $this->settlement_id, + 'distance' => $this->distance, + ]); + + return $dataProvider; + } +} diff --git a/common/models/SettlementLocation.php b/common/models/SettlementLocation.php new file mode 100644 index 0000000..91f9e32 --- /dev/null +++ b/common/models/SettlementLocation.php @@ -0,0 +1,54 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'settlement_location_id' => 'Settlement Location ID', + 'value' => 'Value', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSettlementAddressLinks() + { + return $this->hasMany(SettlementAddressLink::className(), ['settlement_location_id' => 'settlement_location_id'])->inverseOf('settlementLocation'); + } +} diff --git a/common/models/User.php b/common/models/User.php new file mode 100755 index 0000000..1c47566 --- /dev/null +++ b/common/models/User.php @@ -0,0 +1,189 @@ + self::STATUS_ACTIVE], + ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], + ]; + } + + /** + * @inheritdoc + */ + public static function findIdentity($id) + { + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); + } + + /** + * @inheritdoc + */ + public static function findIdentityByAccessToken($token, $type = null) + { + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); + } + + /** + * Finds user by username + * + * @param string $username + * @return static|null + */ + public static function findByUsername($username) + { + return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); + } + + /** + * Finds user by password reset token + * + * @param string $token password reset token + * @return static|null + */ + public static function findByPasswordResetToken($token) + { + if (!static::isPasswordResetTokenValid($token)) { + return null; + } + + return static::findOne([ + 'password_reset_token' => $token, + 'status' => self::STATUS_ACTIVE, + ]); + } + + /** + * Finds out if password reset token is valid + * + * @param string $token password reset token + * @return boolean + */ + public static function isPasswordResetTokenValid($token) + { + if (empty($token)) { + return false; + } + + $timestamp = (int) substr($token, strrpos($token, '_') + 1); + $expire = Yii::$app->params['user.passwordResetTokenExpire']; + return $timestamp + $expire >= time(); + } + + /** + * @inheritdoc + */ + public function getId() + { + return $this->getPrimaryKey(); + } + + /** + * @inheritdoc + */ + public function getAuthKey() + { + return $this->auth_key; + } + + /** + * @inheritdoc + */ + public function validateAuthKey($authKey) + { + return $this->getAuthKey() === $authKey; + } + + /** + * Validates password + * + * @param string $password password to validate + * @return boolean if password provided is valid for current user + */ + public function validatePassword($password) + { + return Yii::$app->security->validatePassword($password, $this->password_hash); + } + + /** + * Generates password hash from password and sets it to the model + * + * @param string $password + */ + public function setPassword($password) + { + $this->password_hash = Yii::$app->security->generatePasswordHash($password); + } + + /** + * Generates "remember me" authentication key + */ + public function generateAuthKey() + { + $this->auth_key = Yii::$app->security->generateRandomString(); + } + + /** + * Generates new password reset token + */ + public function generatePasswordResetToken() + { + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); + } + + /** + * Removes password reset token + */ + public function removePasswordResetToken() + { + $this->password_reset_token = null; + } +} diff --git a/common/widgets/Alert.php b/common/widgets/Alert.php new file mode 100755 index 0000000..420d083 --- /dev/null +++ b/common/widgets/Alert.php @@ -0,0 +1,79 @@ +session->setFlash('error', 'This is the message'); + * \Yii::$app->session->setFlash('success', 'This is the message'); + * \Yii::$app->session->setFlash('info', 'This is the message'); + * ``` + * + * Multiple messages could be set as follows: + * + * ```php + * \Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); + * ``` + * + * @author Kartik Visweswaran + * @author Alexander Makarov + */ +class Alert extends \yii\bootstrap\Widget +{ + /** + * @var array the alert types configuration for the flash messages. + * This array is setup as $key => $value, where: + * - $key is the name of the session flash variable + * - $value is the bootstrap alert type (i.e. danger, success, info, warning) + */ + public $alertTypes = [ + 'error' => 'alert-danger', + 'danger' => 'alert-danger', + 'success' => 'alert-success', + 'info' => 'alert-info', + 'warning' => 'alert-warning' + ]; + /** + * @var array the options for rendering the close button tag. + */ + public $closeButton = []; + + + public function init() + { + parent::init(); + + $session = \Yii::$app->session; + $flashes = $session->getAllFlashes(); + $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; + + foreach ($flashes as $type => $data) { + if (isset($this->alertTypes[$type])) { + $data = (array) $data; + foreach ($data as $i => $message) { + /* initialize css class for each alert box */ + $this->options['class'] = $this->alertTypes[$type] . $appendCss; + + /* assign unique id to each alert box */ + $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; + + echo \yii\bootstrap\Alert::widget([ + 'body' => $message, + 'closeButton' => $this->closeButton, + 'options' => $this->options, + ]); + } + + $session->removeFlash($type); + } + } + } +} diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..9ca5f9c --- /dev/null +++ b/composer.json @@ -0,0 +1,40 @@ +{ + "name": "yiisoft/yii2-app-advanced", + "description": "Yii 2 Advanced Project Template", + "keywords": ["yii2", "framework", "advanced", "project template"], + "homepage": "http://www.yiiframework.com/", + "type": "project", + "license": "BSD-3-Clause", + "support": { + "issues": "https://github.com/yiisoft/yii2/issues?state=open", + "forum": "http://www.yiiframework.com/forum/", + "wiki": "http://www.yiiframework.com/wiki/", + "irc": "irc://irc.freenode.net/yii", + "source": "https://github.com/yiisoft/yii2" + }, + "minimum-stability": "stable", + "require": { + "php": ">=5.4.0", + "yiisoft/yii2": ">=2.0.6", + "yiisoft/yii2-bootstrap": "*", + "yiisoft/yii2-swiftmailer": "*" + }, + "require-dev": { + "yiisoft/yii2-codeception": "*", + "yiisoft/yii2-debug": "*", + "yiisoft/yii2-gii": "*", + "yiisoft/yii2-faker": "*" + }, + "config": { + "process-timeout": 1800 + }, + "extra": { + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "scripts": { + "post-install-cmd": "php init --env=Development --overwrite=n" + } +} diff --git a/composer.lock b/composer.lock new file mode 100755 index 0000000..8c2d9e7 --- /dev/null +++ b/composer.lock @@ -0,0 +1,913 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "914f9194a4d021de88b285b03e683984", + "content-hash": "e1929a97e872bdbaacc8530468eccb67", + "packages": [ + { + "name": "bower-asset/bootstrap", + "version": "v3.3.5", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "16b48259a62f576e52c903c476bd42b90ab22482" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", + "reference": "16b48259a62f576e52c903c476bd42b90ab22482", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.9.1" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "less/bootstrap.less", + "dist/js/bootstrap.js" + ], + "bower-asset-ignore": [ + "/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests", + "test-infra" + ] + }, + "license": [ + "MIT" + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "keywords": [ + "css", + "framework", + "front-end", + "js", + "less", + "mobile-first", + "responsive", + "web" + ] + }, + { + "name": "bower-asset/jquery", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/jquery/jquery-dist.git", + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/c0185ab7c75aab88762c5aae780b9d83b80eda72", + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/jquery.js", + "bower-asset-ignore": [ + "package.json" + ] + }, + "license": [ + "MIT" + ], + "keywords": [ + "browser", + "javascript", + "jquery", + "library" + ] + }, + { + "name": "bower-asset/jquery.inputmask", + "version": "3.2.7", + "source": { + "type": "git", + "url": "https://github.com/RobinHerbots/jquery.inputmask.git", + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/5a72c563b502b8e05958a524cdfffafe9987be38", + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/inputmask/inputmask.js" + ], + "bower-asset-ignore": [ + "**/*", + "!dist/*", + "!dist/inputmask/*", + "!dist/min/*", + "!dist/min/inputmask/*", + "!extra/bindings/*", + "!extra/dependencyLibs/*", + "!extra/phone-codes/*" + ] + }, + "license": [ + "http://opensource.org/licenses/mit-license.php" + ], + "description": "jquery.inputmask is a jquery plugin which create an input mask.", + "keywords": [ + "form", + "input", + "inputmask", + "jquery", + "mask", + "plugins" + ] + }, + { + "name": "bower-asset/punycode", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "punycode.js", + "bower-asset-ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] + } + }, + { + "name": "bower-asset/yii2-pjax", + "version": "v2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/jquery-pjax.git", + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/60728da6ade5879e807a49ce59ef9a72039b8978", + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.8" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "./jquery.pjax.js", + "bower-asset-ignore": [ + ".travis.yml", + "Gemfile", + "Gemfile.lock", + "CONTRIBUTING.md", + "vendor/", + "script/", + "test/" + ] + }, + "license": [ + "MIT" + ] + }, + { + "name": "cebe/markdown", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/cebe/markdown.git", + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/markdown/zipball/54a2c49de31cc44e864ebf0500a35ef21d0010b2", + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2", + "shasum": "" + }, + "require": { + "lib-pcre": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "cebe/indent": "*", + "facebook/xhprof": "*@dev", + "phpunit/phpunit": "4.1.*" + }, + "bin": [ + "bin/markdown" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\markdown\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Creator" + } + ], + "description": "A super fast, highly extensible markdown parser for PHP", + "homepage": "https://github.com/cebe/markdown#readme", + "keywords": [ + "extensible", + "fast", + "gfm", + "markdown", + "markdown-extra" + ], + "time": "2015-03-06 05:28:07" + }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.7.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40", + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2015-08-05 01:03:42" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.2", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "d8db871a54619458a805229a057ea2af33c753e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/d8db871a54619458a805229a057ea2af33c753e8", + "reference": "d8db871a54619458a805229a057ea2af33c753e8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1,<0.9.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.4-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.org", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2016-05-01 08:45:47" + }, + { + "name": "yiisoft/yii2", + "version": "2.0.8", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-framework.git", + "reference": "53992b136b993e32ca7b6f399cf42b143f8685a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/53992b136b993e32ca7b6f399cf42b143f8685a6", + "reference": "53992b136b993e32ca7b6f399cf42b143f8685a6", + "shasum": "" + }, + "require": { + "bower-asset/jquery": "2.2.*@stable | 2.1.*@stable | 1.11.*@stable", + "bower-asset/jquery.inputmask": "~3.2.2", + "bower-asset/punycode": "1.3.*", + "bower-asset/yii2-pjax": "~2.0.1", + "cebe/markdown": "~1.0.0 | ~1.1.0", + "ext-ctype": "*", + "ext-mbstring": "*", + "ezyang/htmlpurifier": "~4.6", + "lib-pcre": "*", + "php": ">=5.4.0", + "yiisoft/yii2-composer": "~2.0.4" + }, + "bin": [ + "yii" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/", + "role": "Founder and project lead" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/", + "role": "Core framework development" + }, + { + "name": "Maurizio Domba", + "homepage": "http://mdomba.info/", + "role": "Core framework development" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Core framework development" + }, + { + "name": "Timur Ruziev", + "email": "resurtm@gmail.com", + "homepage": "http://resurtm.com/", + "role": "Core framework development" + }, + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com", + "role": "Core framework development" + }, + { + "name": "Dmitry Naumenko", + "email": "d.naumenko.a@gmail.com", + "role": "Core framework development" + } + ], + "description": "Yii PHP Framework Version 2", + "homepage": "http://www.yiiframework.com/", + "keywords": [ + "framework", + "yii2" + ], + "time": "2016-04-28 14:50:20" + }, + { + "name": "yiisoft/yii2-bootstrap", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-bootstrap.git", + "reference": "3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5", + "reference": "3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", + "yiisoft/yii2": ">=2.0.6" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\bootstrap\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Twitter Bootstrap extension for the Yii framework", + "keywords": [ + "bootstrap", + "yii2" + ], + "time": "2016-03-17 03:29:28" + }, + { + "name": "yiisoft/yii2-composer", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-composer.git", + "reference": "7452fd908a5023b8bb5ea1b123a174ca080de464" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/7452fd908a5023b8bb5ea1b123a174ca080de464", + "reference": "7452fd908a5023b8bb5ea1b123a174ca080de464", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "yii\\composer\\Plugin", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\composer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The composer plugin for Yii extension installer", + "keywords": [ + "composer", + "extension installer", + "yii2" + ], + "time": "2016-02-06 00:49:24" + }, + { + "name": "yiisoft/yii2-swiftmailer", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-swiftmailer.git", + "reference": "e2c6315caff30a9271a7afad4d684627721dc69a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/e2c6315caff30a9271a7afad4d684627721dc69a", + "reference": "e2c6315caff30a9271a7afad4d684627721dc69a", + "shasum": "" + }, + "require": { + "swiftmailer/swiftmailer": "~5.0", + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\swiftmailer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + } + ], + "description": "The SwiftMailer integration for the Yii framework", + "keywords": [ + "email", + "mail", + "mailer", + "swift", + "swiftmailer", + "yii2" + ], + "time": "2016-03-17 03:58:49" + } + ], + "packages-dev": [ + { + "name": "bower-asset/typeahead.js", + "version": "v0.11.1", + "source": { + "type": "git", + "url": "https://github.com/twitter/typeahead.js.git", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/588440f66559714280628a4f9799f0c4eb880a4a", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "require-dev": { + "bower-asset/jasmine-ajax": "~1.3.1", + "bower-asset/jasmine-jquery": "~1.5.2", + "bower-asset/jquery": "~1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/typeahead.bundle.js" + } + }, + { + "name": "fzaninotto/faker", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123", + "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "extra": { + "branch-alias": [] + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2016-04-29 12:21:54" + }, + { + "name": "phpspec/php-diff", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2016-04-07 12:29:16" + }, + { + "name": "yiisoft/yii2-codeception", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-codeception.git", + "reference": "c916a36d09fc128b05a374e7922bc56854334d56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/c916a36d09fc128b05a374e7922bc56854334d56", + "reference": "c916a36d09fc128b05a374e7922bc56854334d56", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\codeception\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "The Codeception integration for the Yii framework", + "keywords": [ + "codeception", + "yii2" + ], + "time": "2016-03-17 03:41:26" + }, + { + "name": "yiisoft/yii2-debug", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-debug.git", + "reference": "55ed2e853ed8050a34415f63a4da84f88a56f895" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/55ed2e853ed8050a34415f63a4da84f88a56f895", + "reference": "55ed2e853ed8050a34415f63a4da84f88a56f895", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\debug\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The debugger extension for the Yii framework", + "keywords": [ + "debug", + "debugger", + "yii2" + ], + "time": "2016-03-17 03:50:19" + }, + { + "name": "yiisoft/yii2-faker", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-faker.git", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "*", + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\faker\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "Fixture generator. The Faker integration for the Yii framework.", + "keywords": [ + "Fixture", + "faker", + "yii2" + ], + "time": "2015-03-01 06:22:44" + }, + { + "name": "yiisoft/yii2-gii", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-gii.git", + "reference": "1bd6df6804ca077ec022587905a0d43eb286f507" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/1bd6df6804ca077ec022587905a0d43eb286f507", + "reference": "1bd6df6804ca077ec022587905a0d43eb286f507", + "shasum": "" + }, + "require": { + "bower-asset/typeahead.js": "0.10.* | ~0.11.0", + "phpspec/php-diff": ">=1.0.2", + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "~2.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\gii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Gii extension for the Yii framework", + "keywords": [ + "code generator", + "gii", + "yii2" + ], + "time": "2016-03-18 14:09:46" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.0" + }, + "platform-dev": [] +} diff --git a/console/config/.gitignore b/console/config/.gitignore new file mode 100755 index 0000000..20da318 --- /dev/null +++ b/console/config/.gitignore @@ -0,0 +1,2 @@ +main-local.php +params-local.php \ No newline at end of file diff --git a/console/config/bootstrap.php b/console/config/bootstrap.php new file mode 100755 index 0000000..b3d9bbc --- /dev/null +++ b/console/config/bootstrap.php @@ -0,0 +1 @@ + 'app-console', + 'basePath' => dirname(__DIR__), + 'bootstrap' => ['log'], + 'controllerNamespace' => 'console\controllers', + 'components' => [ + 'log' => [ + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + ], + 'params' => $params, +]; diff --git a/console/config/params.php b/console/config/params.php new file mode 100755 index 0000000..7f754b9 --- /dev/null +++ b/console/config/params.php @@ -0,0 +1,4 @@ + 'admin@example.com', +]; diff --git a/console/controllers/.gitkeep b/console/controllers/.gitkeep new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/console/controllers/.gitkeep diff --git a/console/migrations/_m160609_074818_tables.php b/console/migrations/_m160609_074818_tables.php new file mode 100755 index 0000000..2285b43 --- /dev/null +++ b/console/migrations/_m160609_074818_tables.php @@ -0,0 +1,3028 @@ +createTable('road_surface', [ + 'road_surface_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin_section' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end_section' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'lane_count_left' => $this->integer()->comment('Кількість смуг руху ліворуч'), + 'lane_count_right' => $this->integer()->comment('Кількість смуг руху праворуч'), + 'road_surface_construction' => $this->string()->comment('Конструкція дорожнього одягу (окрема облікова картка; табл. 5.10)'), + 'elastisity_module' => $this->decimal()->comment('Фактичний модуль пружності (згідно з [9]; з двома цифрами після коми)'), + ]); + $this->addCommentOnTable('road_surface', 'Дані про дорожній одяг'); + + // Table 5.10 + $this->createTable('structural_layers', [ + 'structural_layers_id' => $this->primaryKey()->comment('згідно з [4]'), + 'layer_number' => $this->integer()->comment('Номер шару'), + 'material_code' => $this->integer()->comment('Код матеріалу (згідно з [4])'), + 'layer_width' => $this->decimal()->comment('Товщина шару (в сантиметрах)'), + 'strength_coef' => $this->decimal()->comment('Коефіцієнт впливу міцності складових шару К МЦ (згідно з [17]; з двома цифрами після коми)'), + 'viscosity_coef' => $this->decimal()->comment('Коефіцієнт впливу в\'яжучого К В (згідно з [17]; з двома цифрами після коми)'), + 'technology_coef' => $this->decimal()->comment('Коефіцієнт впливу якості технології К Т (згідно з [17]; з двома цифрами після коми)'), + 'conditions_coef' => $this->decimal()->comment('Коефіцієнт впливу умов служби К С (згідно з [17]; з двома цифрами після коми)'), + 'land_soil' => $this->string()->comment('Ґрунт земляного полотна (згідно з [4])'), + 'elastisity_module' => $this->decimal()->comment('Модуль пружності (згідно з [9]; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('structural_layers', 'Дані про конструктивні шари дорожнього одягу'); + + // Table 5.11 + $this->createTable('road_surface_strenght', [ + 'road_surface_strenght_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin_section' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end_section' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'lane_count_left' => $this->integer()->comment('Кількість смуг руху ліворуч'), + 'lane_count_right' => $this->integer()->comment('Кількість смуг руху праворуч'), + 'elastisity_module' => $this->decimal()->comment('Фактичний модуль пружності (згідно з [9]; з двома цифрами після коми)'), + 'elastisity_module_calc' => $this->decimal()->comment('Розрахунковий модуль пружності (згідно з [9]; з двома цифрами після коми)'), + 'safety_margin_coef' => $this->decimal()->comment('Коефіцієнт запасу міцності (згідно з [9]; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('road_surface_strenght', 'Дані про міцність дорожнього одягу'); + + // Table 5.12 + $this->createTable('road_surface_flatness', [ + 'road_surface_flatness_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin_section' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end_section' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'lane_count_left' => $this->integer()->comment('Кількість смуг руху ліворуч'), + 'lane_count_right' => $this->integer()->comment('Кількість смуг руху праворуч'), + 'forward_lanes_iri' => $this->decimal()->comment('Показник IRI смуг прямого напрямку руху (згідно з [9]; з двома цифрами після коми)'), + 'back_lanes_iri' => $this->decimal()->comment('Показник IRI смуг зворотного напрямку руху (згідно з [9]; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('road_surface_flatness', 'Дані про рівність покриття'); + + // Table 5.13 + $this->createTable('road_surface_clutch', [ + 'road_surface_clutch_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin_section' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end_section' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'lane_count_left' => $this->integer()->comment('Кількість смуг руху ліворуч'), + 'lane_count_right' => $this->integer()->comment('Кількість смуг руху праворуч'), + 'forward_lanes_hollow' => $this->decimal()->comment('Середня величина заглиблень шорсткості (h свр )смуг прямого напрямку руху (згідно з [18]; з двома цифрами після коми)'), + 'forward_lanes_density' => $this->decimal()->comment('Середня щільність виступів шорсткості (і n ) смуг прямого напрямку руху (згідно з [18]; з двома цифрами після коми)'), + 'forward_lanes_ledge' => $this->decimal()->comment('Середній радіус виступів шорсткості (R свр ) смуг прямого напрямку руху (згідно з [18]; з двома цифрами після коми)'), + 'back_lanes_hollow' => $this->decimal()->comment('Середня величина заглиблень шорсткості (h свр )смуг зворотнього напрямку руху (згідно з [18]; з двома цифрами після коми)'), + 'back_lanes_density' => $this->decimal()->comment('Середня щільність виступів шорсткості (і n ) смуг зворотнього напрямку руху (згідно з [18]; з двома цифрами після коми)'), + 'back_lanes_ledge' => $this->decimal()->comment('Середній радіус виступів шорсткості (R свр ) смуг зворотнього напрямку руху (згідно з [18]; з двома цифрами після коми)'), + 'clutch_coef' => $this->decimal()->comment('Фактичне значення коефіцієнта зчеплення (згідно з [18]; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('road_surface_clutch', 'Дані про зчіпні якості'); + + // Table 5.14 + $this->createTable('road_surface_damage', [ + 'road_surface_damage_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin_section' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end_section' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'lane_count_left' => $this->integer()->comment('Кількість смуг руху ліворуч'), + 'lane_count_right' => $this->integer()->comment('Кількість смуг руху праворуч'), + 'back_lane_number' => $this->integer()->comment('Номер смуги зворотного напрямку руху'), + 'forward_lane_number' => $this->integer()->comment('Номер смуги прмямого напрямку руху'), + 'state_indicator' => $this->integer()->comment('Показник стану (табл. Б.2 СОУ 42.1-37641918-122)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('road_surface_damage', 'Дані про пошкодження дорожнього одягу'); + + // Table 5.15 + $this->createTable('roadbed_size', [ + 'roadbed_size_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'cross_profile_position' => $this->string()->comment('Положення поперечного профілю (псевдогеодані)'), + 'road_category_id' => $this->integer()->comment('Категорія дороги (згідно з [4])'), + 'mound_left' => $this->decimal()->comment('Насип (виїмка) ліворуч (у метрах; з двома цифрами після коми)'), + 'mound_right' => $this->decimal()->comment('Насип (виїмка) праворуч (у метрах; з двома цифрами після коми)'), + 'mound_avarage_size' => $this->decimal()->comment('Середня величина насипу (виїмки) (у метрах; з двома цифрами після коми)'), + 'berm_third_width_left' => $this->decimal()->comment('Ширина 3-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_third_height_left' => $this->decimal()->comment('Висота 3-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_third_slope_left' => $this->decimal()->comment('Закладання укосу 3-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_second_width_left' => $this->decimal()->comment('Ширина 2-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_second_height_left' => $this->decimal()->comment('Висота 2-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_second_slope_left' => $this->decimal()->comment('Закладання укосу 2-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_first_width_left' => $this->decimal()->comment('Ширина 1-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_first_height_left' => $this->decimal()->comment('Висота 1-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'berm_first_slope_left' => $this->decimal()->comment('Закладання укосу 1-ї берми ліворуч (у метрах; з двома цифрами після коми)'), + 'ditch_top_width_left' => $this->decimal()->comment('Ширина по верху кювету (кювету-резерву) ліворуч (у метрах; з двома цифрами після коми)'), + 'ditch_bottom_width_left' => $this->decimal()->comment('Ширина по низу кювету (кювету-резерву) ліворуч (у метрах; з двома цифрами після коми)'), + 'ditch_depth_left' => $this->decimal()->comment('Глибина кювету (кювету-резерву) ліворуч (у метрах; з двома цифрами після коми)'), + 'roadside_width_left' => $this->decimal()->comment('Ширина узбіччя ліворуч (у метрах; з двома цифрами після коми)'), + 'roadside_width_right' => $this->decimal()->comment('Ширина узбіччя праворуч (у метрах; з двома цифрами після коми)'), + 'ditch_top_width_right' => $this->decimal()->comment('Ширина по верху кювету (кювету-резерву) праворуч (у метрах; з двома цифрами після коми)'), + 'ditch_bottom_width_right' => $this->decimal()->comment('Ширина по низу кювету (кювету-резерву) праворуч (у метрах; з двома цифрами після коми)'), + 'ditch_depth_right' => $this->decimal()->comment('Глибина кювету (кювету-резерву) праворуч (у метрах; з двома цифрами після коми)'), + 'berm_third_width_right' => $this->decimal()->comment('Ширина 3-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_third_height_right' => $this->decimal()->comment('Висота 3-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_third_slope_right' => $this->decimal()->comment('Закладання укосу 3-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_second_width_right' => $this->decimal()->comment('Ширина 2-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_second_height_right' => $this->decimal()->comment('Висота 2-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_second_slope_right' => $this->decimal()->comment('Закладання укосу 2-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_first_width_right' => $this->decimal()->comment('Ширина 1-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_first_height_right' => $this->decimal()->comment('Висота 1-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'berm_first_slope_right' => $this->decimal()->comment('Закладання укосу 1-ї берми праворуч (у метрах; з двома цифрами після коми)'), + 'road_surface_width' => $this->decimal()->comment('Ширина земляного полотна поверху (у метрах; з двома цифрами після коми)'), + 'road_surface_capacity' => $this->decimal()->comment('Об\'єм земляного полотна (у кубічних метрах; з двома цифрами після коми)'), + 'land_soil' => $this->string()->comment('Ґрунт земляного полотна (згідно з [4])'), + ]); + $this->addCommentOnTable('roadbed_size', 'Дані про геометричні розміри земляного полотна'); + + // Table 5.16 + $this->createTable('rally', [ + 'rally_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'position_according_road' => $this->text()->comment('Розташування відносно дороги (текст)'), + 'direction' => $this->text()->comment('Напрямок (текст)'), + 'fortified_length' => $this->decimal()->comment('Довжина укріплення (у метрах; з двома цифрами після коми)'), + 'layer_material_top_id' => $this->integer()->comment('Матеріал верхнього шару покриття (згідно табл. 8.1 ДБН В.2.3-4)'), + 'surface_area' => $this->decimal()->comment('Площа покриття (у квадратних метрах; з двома цифрами після коми)'), + 'road_surface_capacity' => $this->decimal()->comment('Об\'єм земляного полотна (у кубічних метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'rally_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.17)'), + ]); + $this->addCommentOnTable('rally', 'Облікова відомість з\'їздів та виїздів'); + + // Table 5.17 + $this->createTable('rally_card', [ + 'rally_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'position_according_road' => $this->text()->comment('Розташування відносно дороги (текст)'), + 'direction' => $this->text()->comment('Напрямок (текст)'), + 'junction_angle' => $this->decimal()->comment('Кут примикання (в градусах; з двома цифрами після коми)'), + 'junction_rally_radius' => $this->decimal()->comment('Радіус спряження з\'їзду (у метрах; з двома цифрами після коми)'), + 'junction_exit_radius' => $this->decimal()->comment('Радіус спряження виїзду (у метрах; з двома цифрами після коми)'), + 'fortified_length' => $this->decimal()->comment('Довжина укріплення (у метрах; з двома цифрами після коми)'), + 'layer_material_top_id' => $this->integer()->comment('Матеріал верхнього шару покриття (згідно табл. 8.1 ДБН В.2.3-4)'), + 'mound_rally_begin' => $this->decimal()->comment('Насип (виїмка) на початку з\'їзду або виїзду (у метрах; з двома цифрами після коми)'), + 'mound_rally_end' => $this->decimal()->comment('Насип (виїмка) в кінці з\'їзду або виїзду (у метрах; з двома цифрами після коми)'), + 'surface_area' => $this->decimal()->comment('Площа покриття (у квадратних метрах; з двома цифрами після коми)'), + 'road_surface_capacity' => $this->decimal()->comment('Об\'єм земляного полотна (у кубічних метрах; з двома цифрами після коми)'), + 'vector_direction_x1' => $this->decimal()->comment('Координата х 1 вектору напрямку з’їзду або виїзду (з двома цифрами після коми)'), + 'vector_direction_x2' => $this->decimal()->comment('Координата х 2 вектору напрямку з’їзду або виїзду (з двома цифрами після коми)'), + 'vector_direction_y1' => $this->decimal()->comment('Координата y 1 вектору напрямку з’їзду або виїзду (з двома цифрами після коми)'), + 'vector_direction_y2' => $this->decimal()->comment('Координата y 2 вектору напрямку з’їзду або виїзду (з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'state_indicator' => $this->integer()->comment('Показник стану (табл. Б.2 СОУ 42.1-37641918-122)'), + 'fortified_coords' => $this->string()->comment('Координати укріплення та/або покриття (геодані)'), + 'road_surface_top_coords' => $this->string()->comment('Координати верху земляного полотна (геодані)'), + 'road_surface_bottom_coords' => $this->string()->comment('Координати низу земляного полотна (геодані)'), + ]); + $this->addCommentOnTable('rally_card', 'Дані про з\'їзд або виїзд'); + + // Table 5.18 + $this->createTable('tunnel', [ + 'tunnel_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'center_position' => $this->string()->comment('Положення середини тунелю (псевдогеодані)'), + 'construction_length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'cross_scheme' => $this->decimal()->comment('Поперечна схема (у метрах; з двома цифрами після коми)'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'height' => $this->decimal()->comment('Габарит по висоті (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Габарит по ширині (у метрах; з двома цифрами після коми)'), + 'sideway_width_left' => $this->decimal()->comment('Ширина тротуару ліворуч (у метрах; з двома цифрами після коми)'), + 'sideway_width_right' => $this->decimal()->comment('Ширина тротуару праворуч (у метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'tunnel_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.19)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('rally', 'Облікова відомість з\'їздів та виїздів'); + + // Table 5.19 + $this->createTable('tunnel_card', [ + 'tunnel_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'center_position' => $this->string()->comment('Положення середини споруди (псевдогеодані)'), + 'movement_direction' => $this->integer()->comment('Напрямок руху, що забезпечує споруда (згідно з [4])'), + 'nearest_settlement_name' => $this->text()->comment('Назва найближчого населеного пункту'), + 'nearest_settlement_distance' => $this->decimal()->comment('Відстань до найближчого населеного пункту (в кілометрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Технічний стан (згідно з [4])'), + 'lane_count_forward' => $this->integer()->comment('Кількість смуг руху в прямому напрямку руху'), + 'lane_count_back' => $this->integer()->comment('Кількість смуг руху праворуч в зворотному напрямку руху'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'sideway_width_forward_left' => $this->decimal()->comment('Ширина тротуару ліворуч від прямого напрямку руху (у метрах; з двома цифрами після коми)'), + 'sideway_width_forward_right' => $this->decimal()->comment('Ширина тротуару праворуч від прямого напрямку руху (у метрах; з двома цифрами після коми)'), + 'bearing_structures_long_scheme' => $this->text()->comment('Поздовжня схема несучих конструкцій по ходу кілометражу'), + 'slope_long_scheme' => $this->text()->comment('Поздовжня схема похилів'), + 'drainage_tray_internal_type' => $this->integer()->comment('Тип лотків внутрішнього водовідведення (згідно з [4])'), + 'drainage_tray_internal_length' => $this->decimal()->comment('Загальна довжина лотків внутрішнього водовідведення (у метрах; з двома цифрами після коми)'), + 'drainage_tunnel_internal_type' => $this->integer()->comment('Тип дренажних штолень внутрішнього водовідведення (згідно з [4])'), + 'drainage_tunnel_internal_length' => $this->decimal()->comment('Загальна довжина дренажних штолень внутрішнього водовідведення (у метрах; з двома цифрами після коми)'), + 'drainage_other_internal_construction' => $this->integer()->comment('Наявність інших внутрішніх водовідвідних споруд (згідно з [4])'), + 'drainage_tray_outer_type' => $this->integer()->comment('Тип лотків поверхневого водовідведення (згідно з [4])'), + 'drainage_tray_outer_length' => $this->decimal()->comment('Загальна довжина лотків поверхневого водовідведення (у метрах; з двома цифрами після коми)'), + 'drainage_tunnel_outer_type' => $this->integer()->comment('Тип нагірних канав поверхневого водовідведення (згідно з [4])'), + 'drainage_tunnel_outer_length' => $this->decimal()->comment('Загальна довжина нагірних канав поверхневого водовідведення (у метрах; з двома цифрами після коми)'), + 'drainage_other_outer_construction' => $this->integer()->comment('Наявність інших поверхневих водовідвідних споруд (згідно з [4])'), + 'fence_height' => $this->decimal()->comment('Висота огородження (у метрах; з двома цифрами після коми)'), + 'sidewalk_type_left' => $this->integer()->comment('Тип тротуару ліворуч (згідно з [4])'), + 'barrier_material_type_left' => $this->integer()->comment('Матеріал перил тротуару ліворуч (згідно з [4])'), + 'barrier_height_left' => $this->integer()->comment('Висота перил тротуару ліворуч (у метрах; з двома цифрами після коми)'), + 'sidewalk_type_right' => $this->integer()->comment('Тип тротуару праворуч (згідно з [4])'), + 'barrier_material_type_right' => $this->integer()->comment('Матеріал перил тротуару праворуч (згідно з [4])'), + 'barrier_height_right' => $this->integer()->comment('Висота перил тротуару праворуч (у метрах; з двома цифрами після коми)'), + 'roadway_material_id' => $this->integer()->comment('Матеріал покриття проїзної частини (згідно табл. 8.1 ДБН В.2.3-4)'), + 'ventilation_type_id' => $this->integer()->comment('Тип вентиляції (згідно з [4])'), + 'light_type_id' => $this->integer()->comment('Тип освітлення (згідно з [4])'), + 'antiseismic_type_id' => $this->integer()->comment('Типи антисейсмічних пристроїв (згідно з [4])'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації, яка перепускається спорудою (згідно з [4])'), + 'security_connection_availability' => $this->integer()->comment('Наявність охорони та зв\'язку (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'tunnel_portal_card_id' => $this->integer()->comment('Оголовки (окрема облікова картка; табл. 5.20)'), + 'tunnel_body_card_id' => $this->integer()->comment('Тіло тунелю (окрема облікова картка; табл. 5.21)'), + 'sewage_card_id' => $this->integer()->comment('Очисні споруди (окрема облікова картка; табл. 5.22)'), + 'technical_doc_id' => $this->integer()->comment('Технічна документація (окрема облікова картка; табл. 5.23)'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'tunnel_outline_coords' => $this->string()->comment('Координати контуру тунелю в межах проїзної частини (по окремим напрямкам руху) (геодані)'), + ]); + $this->addCommentOnTable('tunnel_card', 'Дані про тунель'); + + // Table 5.20 + $this->createTable('tunnel_portal_card', [ + 'tunnel_portal_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'purpose' => $this->text()->comment('Призначення порталу'), + 'tunnel_portal_type_id' => $this->integer()->comment('Тип порталу (згідно з [4])'), + 'thick' => $this->decimal()->comment('Товщина (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'frame_material_id' => $this->integer()->comment('Матеріал оправи порталу (згідно з [4])'), + 'frame_capacity' => $this->decimal()->comment('Об\'єм оправи порталу (у кубічних метрах; з двома цифрами після коми)'), + 'another_first_type_material_id' => $this->integer()->comment('Матеріал інших елементів порталу 1-го типу (згідно з [4])'), + 'another_first_type_capacity' => $this->decimal()->comment('Об\'єм інших елементів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'another_second_type_material_id' => $this->integer()->comment('Матеріал інших елементів порталу 2-го типу (згідно з [4])'), + 'another_second_type_capacity' => $this->decimal()->comment('Об\'єм інших елементів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'another_third_type_material_id' => $this->integer()->comment('Матеріал інших елементів порталу 3-го типу (згідно з [4])'), + 'another_third_type_capacity' => $this->decimal()->comment('Об\'єм інших елементів 3-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'foundation_depth' => $this->decimal()->comment('Глибина залягання фундаменту (у метрах; з двома цифрами після коми)'), + 'foundation_first_type_material_id' => $this->integer()->comment('Матеріал фундаменту 1-го типу (згідно з [4])'), + 'foundation_second_type_material_id' => $this->integer()->comment('Матеріал фундаменту 2-го типу (згідно з [4])'), + 'foundation_third_type_material_id' => $this->integer()->comment('Матеріал фундаменту 3-го типу (згідно з [4])'), + 'basement_material_id' => $this->integer()->comment('Матеріал основи (згідно з [4])'), + 'foundation_basement_capacity' => $this->decimal()->comment('Загальний об\'єм фундаменту та основи (у кубічних метрах; з двома цифрами після коми)'), + 'fortified_slope_material_id' => $this->integer()->comment('Матеріал укріплення укосів (згідно з [4])'), + ]); + $this->addCommentOnTable('tunnel_portal_card', 'Дані про портал тунелю'); + + // Table 5.21 + $this->createTable('tunnel_body_card', [ + 'tunnel_body_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'body_type_id' => $this->integer()->comment('Тип форми тіла (згідно з [4])'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'typical_project_id' => $this->integer()->comment('Типовий проект (згідно з [4])'), + 'body_material_id' => $this->integer()->comment('Матеріал тіла тунелю (згідно з [4])'), + 'carrier_type_id' => $this->integer()->comment('Тип елементів носіїв (згідно з [4])'), + 'arch_rings_reverse_count' => $this->integer()->comment('Кількість кілець із зворотнім склепінням'), + 'rings_another_count' => $this->integer()->comment('Кількість кілець без зворотних склепінь та розпірних плит'), + 'precast_plates_rings_count' => $this->integer()->comment('Кількість кілець із розпірними плитами'), + 'body_material_capacity' => $this->decimal()->comment('Об\'єм матеріалу тіла (у кубічних метрах; з двома цифрами після коми)'), + 'foundation_material_id' => $this->integer()->comment('Матеріал фундаменту (згідно з [4])'), + 'basement_material_id' => $this->integer()->comment('Матеріал основи (згідно з [4])'), + 'foundation_basement_capacity' => $this->decimal()->comment('Загальний об\'єм фундаменту та основи (у кубічних метрах; з двома цифрами після коми)'), + ]); + $this->addCommentOnTable('tunnel_body_card', 'Дані про тіло тунелю'); + + // Table 5.22 + $this->createTable('sewage_card', [ + 'sewage_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'location' => $this->text()->comment('Місце розташування'), + 'drainage_scheme_outer' => $this->integer()->comment('Схема організації поверхневого водовідведення (згідно з [4])'), + 'sewage_construction_type_id' => $this->integer()->comment('Тип очисної споруди (згідно з [4])'), + 'capacity_project' => $this->decimal()->comment('Проектна пропускна здатність (у кубічних метрах за секунду; з двома цифрами після коми)'), + 'capacity_fact' => $this->decimal()->comment('Фактична пропускна здатність (у кубічних метрах за секунду; з двома цифрами після коми)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'technical_doc_id' => $this->integer()->comment('Назва технічної документації (згідно з [4])'), + 'technical_doc_location' => $this->text()->comment('Місце зберігання технічної документації'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + ]); + $this->addCommentOnTable('sewage_card', 'Дані про очисну споруду'); + + // Table 5.23 + $this->createTable('technical_doc', [ + 'technical_doc_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'name' => $this->text()->comment('Назва документу'), + 'date_add' => $this->integer()->comment('Дата документу (згідно з [4])'), + 'performer' => $this->text()->comment('Виконавець'), + 'location' => $this->text()->comment('Місце зберігання документу'), + ]); + $this->addCommentOnTable('technical_doc', 'Дані про технічну документацію'); + + // Table 5.24 + $this->createTable('bridge', [ + 'bridge_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'center_position' => $this->string()->comment('Положення середини споруди (псевдогеодані)'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'obstacle_type_id' => $this->integer()->comment('Вид перешкоди (згідно з [4])'), + 'long_scheme' => $this->text()->comment('Поздовжня схема'), + 'cross_scheme' => $this->text()->comment('Поперечна схема'), + 'construction_length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'material_id' => $this->integer()->comment('Матеріал споруди (згідно з [4])'), + 'height' => $this->decimal()->comment('Габарит по висоті (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Габарит по ширині (у метрах; з двома цифрами після коми)'), + 'sideway_width_left' => $this->decimal()->comment('Ширина тротуару ліворуч (у метрах; з двома цифрами після коми)'), + 'sideway_width_right' => $this->decimal()->comment('Ширина тротуару праворуч (у метрах; з двома цифрами після коми)'), + 'load' => $this->decimal()->comment('Вантажопідйомність (згідно з ДБН В.2.3-22)'), + 'load_additional' => $this->text()->comment('Додаткове навантаження'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'bridge_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.25)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('rally', 'Облікова відомість мостів'); + + // Table 5.25 + $this->createTable('bridge_card', [ + 'bridge_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'center_position' => $this->string()->comment('Положення середини споруди (псевдогеодані)'), + 'movement_direction' => $this->integer()->comment('Напрямок руху, що забезпечує споруда (згідно з [4])'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'year_reconstruction' => $this->text()->comment('Рік реконструкції'), + 'nearest_settlement_name' => $this->text()->comment('Назва найближчого населеного пункту'), + 'nearest_settlement_distance' => $this->decimal()->comment('Відстань до найближчого населеного пункту (в кілометрах; з двома цифрами після коми)'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'load' => $this->decimal()->comment('Вантажопідйомність (згідно з ДБН В.2.3-22)'), + 'load_additional' => $this->text()->comment('Додаткове навантаження'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'obstacle_type_id' => $this->integer()->comment('Вид перешкоди (згідно з [4])'), + 'obstacle_name' => $this->text()->comment('Власна назва перешкоди'), + 'watercourse_rmv_width' => $this->decimal()->comment('Ширина водотоку по дзеркалу РМВ (у метрах; з двома цифрами після коми)'), + 'flow_rmv_speed' => $this->decimal()->comment('Швидкість течії при РМВ (у метрах на секунду; з двома цифрами після коми)'), + 'watercourse_rvv_width' => $this->decimal()->comment('Ширина водотоку по дзеркалу РВВ (у метрах; з двома цифрами після коми)'), + 'flow_km_direction' => $this->integer()->comment('Напрямок течії по ходу кілометражу (згідно з [4])'), + 'road_category_id' => $this->integer()->comment('Категорія автомобільної дороги (згідно з [4])'), + 'rail_track_count' => $this->integer()->comment('Кількість колій залізниці'), + 'obstacle_top_width' => $this->decimal()->comment('Ширина земляного полотна перешкоди по верху (у метрах; з двома цифрами після коми)'), + 'cross_angle' => $this->decimal()->comment('Кут перетину (в градусах; з двома цифрами після коми)'), + 'overall_dimension' => $this->decimal()->comment('Габарит (у метрах; з двома цифрами після коми)'), + 'lane_count_forward' => $this->integer()->comment('Кількість смуг руху в прямому напрямку руху'), + 'lane_count_back' => $this->integer()->comment('Кількість смуг руху праворуч в зворотному напрямку руху'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'sideway_width_forward_left' => $this->decimal()->comment('Ширина тротуару ліворуч від прямого напрямку руху (у метрах; з двома цифрами після коми)'), + 'sideway_width_forward_right' => $this->decimal()->comment('Ширина тротуару праворуч від прямого напрямку руху (у метрах; з двома цифрами після коми)'), + 'bridge_under_height' => $this->decimal()->comment('Висота підмостового габариту (у метрах; з двома цифрами після коми)'), + 'bridge_under_width' => $this->decimal()->comment('Ширина підмостового габариту (у метрах; з двома цифрами після коми)'), + 'bridge_hole' => $this->decimal()->comment('Отвір моста (у метрах; з двома цифрами після коми)'), + 'span_long_scheme' => $this->text()->comment('Поздовжня схема прогонових будов по ходу кілометражу'), + 'slope_long_scheme' => $this->text()->comment('Поздовжня схема похилів'), + 'fence_construction_right_id' => $this->integer()->comment('Конструкція огородження праворуч (згідно з [4])'), + 'fence_height_right' => $this->decimal()->comment('Висота огородження праворуч (у метрах; з двома цифрами після коми)'), + 'fence_construction_left_id' => $this->integer()->comment('Конструкція огородження ліворуч (згідно з [4])'), + 'fence_height_left' => $this->decimal()->comment('Висота огородження ліворуч (у метрах; з двома цифрами після коми)'), + 'sidewalk_type_left' => $this->integer()->comment('Тип тротуару ліворуч (згідно з [4])'), + 'barrier_material_type_left' => $this->integer()->comment('Матеріал перил тротуару ліворуч (згідно з [4])'), + 'barrier_height_left' => $this->integer()->comment('Висота перил тротуару ліворуч (у метрах; з двома цифрами після коми)'), + 'sidewalk_type_right' => $this->integer()->comment('Тип тротуару праворуч (згідно з [4])'), + 'barrier_material_type_right' => $this->integer()->comment('Матеріал перил тротуару праворуч (згідно з [4])'), + 'barrier_height_right' => $this->integer()->comment('Висота перил тротуару праворуч (у метрах; з двома цифрами після коми)'), + 'roadway_material_id' => $this->integer()->comment('Матеріал верхнього шару покриття проїзної частини (згідно табл. 8.1 ДБН В.2.3-4)'), + 'antiseismic_type_id' => $this->integer()->comment('Типи антисейсмічних пристроїв (згідно з [4])'), + 'deformation_joint_type_id' => $this->integer()->comment('Типи деформаційних швів (згідно з [4])'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації, яка перепускається спорудою (згідно з [4])'), + 'drainage_type_id' => $this->integer()->comment('Тип водовідведення (згідно з [4])'), + 'drainage_tray_length' => $this->decimal()->comment('Загальна довжина лотків зливової каналізації (у метрах; з двома цифрами після коми)'), + 'regulatory_structure_left' => $this->integer()->comment('Регуляційні споруди лівобережні (згідно з [4])'), + 'regulatory_structure_right' => $this->integer()->comment('Регуляційні споруди правобережні (згідно з [4])'), + 'security_connection_availability' => $this->integer()->comment('Наявність охорони та зв\'язку (згідно з [4])'), + 'light_availability' => $this->integer()->comment('Наявність освітлення (згідно з [4])'), + 'inventory_device_availability' => $this->integer()->comment('Наявність інвентарних пристроїв для огляду та ремонту (згідно з [4])'), + 'stair_availability_begin_left' => $this->integer()->comment('Наявність сходів на початку споруди ліворуч (згідно з [4])'), + 'stair_availability_begin_right' => $this->integer()->comment('Наявність сходів на початку споруди праворуч (згідно з [4])'), + 'stair_availability_end_left' => $this->integer()->comment('Наявність сходів в кінці споруди ліворуч (згідно з [4])'), + 'stair_availability_end_right' => $this->integer()->comment('Наявність сходів в кінці споруди праворуч (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'purlin_card_id' => $this->integer()->comment('Прогони (окрема облікова картка; табл. 5.26)'), + 'pillar_card_id' => $this->integer()->comment('Опори (окрема облікова картка; табл. 5.27)'), + 'sewage_card_id' => $this->integer()->comment('Очисні споруди (окрема облікова картка; табл. 5.22)'), + 'technical_doc_id' => $this->integer()->comment('Технічна документація (окрема облікова картка; табл. 5.23)'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'bridge_outline_coords' => $this->string()->comment('Координати контуру споруди в межах проїзної частини (по окремим напрямкам руху) (геодані)'), + ]); + $this->addCommentOnTable('bridge_card', 'Дані про міст'); + + // Table 5.26 + $this->createTable('purlin_card', [ + 'purlin_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'purlin_number' => $this->integer()->comment('Номер прогону'), + 'static_scheme' => $this->text()->comment('Статична схема'), + 'span_count' => $this->integer()->comment('Кількість прогонових будов в прогоні'), + 'span_same_numbers' => $this->text()->comment('Номери однакових прогонових будов в прогоні (ліворуч направо)'), + 'span_construction_type_id' => $this->integer()->comment('Тип конструкції прогонової будови (згідно з [4])'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'span_length' => $this->decimal()->comment('Повна довжина прогонової будови (у метрах; з двома цифрами після коми)'), + 'year_build' => $this->text()->comment('Рік виготовлення'), + 'load' => $this->integer()->comment('Проектне навантаження (згідно з [4])'), + 'typical_project_id' => $this->integer()->comment('Типовий проект (згідно з [4])'), + 'bearing_moving_type_id' => $this->integer()->comment('Типи рухомих опорних частин (згідно з [4])'), + 'bearing_not_moving_type_id' => $this->integer()->comment('Типи нерухомих опорних частин (згідно з [4])'), + 'cross_scheme' => $this->text()->comment('Поперечна схема'), + 'cross_joint_type_id' => $this->integer()->comment('Спосіб поперечного об\'єднання (згідно з [4])'), + 'girder_main_count' => $this->integer()->comment('Кількість головних балок'), + 'girder_main_center_height' => $this->decimal()->comment('Висота головної балки в центрі прогону (у метрах; з двома цифрами після коми)'), + 'girder_main_pillar_height' => $this->decimal()->comment('Висота головної балки на опорі (у метрах; з двома цифрами після коми)'), + 'girder_cross_count' => $this->integer()->comment('Кількість поперечних балок (діафрагм) в прогоні'), + 'girder_long_count' => $this->integer()->comment('Кількість поздовжніх балок у панелі'), + 'roadway_plate_thick' => $this->decimal()->comment('Товщина плити проїзної частини (в міліметрах; з двома цифрами після коми)'), + 'road_surface_thick' => $this->decimal()->comment('Товщина одягу проїзної частини (в міліметрах; з двома цифрами після коми)'), + 'load_additional' => $this->text()->comment('Додаткове навантаження'), + 'note' => $this->text()->comment('Примітки'), + ]); + $this->addCommentOnTable('purlin_card', 'Дані про прогін'); + + // Table 5.27 + $this->createTable('pillar_card', [ + 'pillar_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'pillar_same_numbers' => $this->text()->comment('Номери однакових опор (ціле число або їх сукупність)'), + 'pillar_construction_type_id' => $this->integer()->comment('Тип конструкції опори (згідно з [4])'), + 'total_height' => $this->decimal()->comment('Загальна висота опори (у метрах; з двома цифрами після коми)'), + 'massive_height' => $this->decimal()->comment('Висота масивної частини опори (у метрах; з двома цифрами після коми)'), + 'massive_width' => $this->decimal()->comment('Ширина масивної частини опори (у метрах; з двома цифрами після коми)'), + 'stud_count' => $this->integer()->comment('Кількість стояків'), + 'stud_cut' => $this->decimal()->comment('Переріз стояка (у метрах; з двома цифрами після коми)'), + 'bar_cut' => $this->decimal()->comment('Переріз ригеля (у метрах; з двома цифрами після коми)'), + 'bar_length' => $this->decimal()->comment('Переріз ригеля (у метрах; з двома цифрами після коми)'), + 'pile_count' => $this->integer()->comment('Кількість паль'), + 'pile_cut' => $this->decimal()->comment('Переріз паль (у метрах; з двома цифрами після коми)'), + 'material_id' => $this->integer()->comment('Матеріал опори (згідно з [4])'), + 'foundation_type__id' => $this->integer()->comment('Тип фундаменту (згідно з [4])'), + 'foundation_depth' => $this->decimal()->comment('Глибина закладання фундаменту (у метрах; з двома цифрами після коми)'), + 'fortified_conus_material_id' => $this->integer()->comment('Матеріал укріплення конусу (згідно з [4])'), + 'icebreaker_type_id' => $this->integer()->comment('Тип льодорізу (згідно з [4])'), + 'icebreaker_material_id' => $this->integer()->comment('Матеріал льодорізу (згідно з [4])'), + ]); + $this->addCommentOnTable('pillar_card', 'Дані про опору'); + + // Table 5.28 + $this->createTable('underground_crossing', [ + 'underground_crossing_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина підземної частини споруди (у метрах; з двома цифрами після коми)'), + 'cross_scheme' => $this->text()->comment('Поперечна схема'), + 'material_id' => $this->integer()->comment('Матеріал споруди (згідно з [4])'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'underground_crossing_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.29)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('underground_crossing', 'Облікова відомість підземних пішохідних переходів'); + + // Table 5.29 + $this->createTable('underground_crossing_card', [ + 'underground_crossing_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'nearest_settlement_name' => $this->text()->comment('Назва найближчого населеного пункту'), + 'nearest_settlement_distance' => $this->decimal()->comment('Відстань до найближчого населеного пункту (в кілометрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Технічний стан (згідно з [4])'), + 'length' => $this->decimal()->comment('Довжина підземної частини споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'slope_long_scheme' => $this->text()->comment('Поздовжня схема похилів'), + 'mound_height' => $this->decimal()->comment('Висота насипу над переходом (у метрах; з двома цифрами після коми)'), + 'stair_total_length' => $this->decimal()->comment('Загальна довжина сходів на вході та виході з підземного переходу (у метрах; з двома цифрами після коми)'), + 'drainage_tray_internal_type' => $this->integer()->comment('Тип лотків внутрішнього водовідведення (згідно з [4])'), + 'drainage_tray_internal_length' => $this->decimal()->comment('Загальна довжина лотків внутрішнього водовідведення (у метрах; з двома цифрами після коми)'), + 'drainage_tunnel_type' => $this->integer()->comment('Тип дренажних штолень (згідно з [4])'), + 'drainage_tunnel_length' => $this->decimal()->comment('Загальна довжина дренажних штолень (у метрах; з двома цифрами після коми)'), + 'drainage_other_internal_construction' => $this->integer()->comment('Наявність інших внутрішніх водовідвідних споруд (згідно з [4])'), + 'surface_material_id' => $this->integer()->comment('Матеріал покриття (згідно з [4])'), + 'ventilation_type_id' => $this->integer()->comment('Тип вентиляції (згідно з [4])'), + 'light_type_id' => $this->integer()->comment('Тип освітлення (згідно з [4])'), + 'antiseismic_type_id' => $this->integer()->comment('Типи антисейсмічних пристроїв (згідно з [4])'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації, яка перепускається спорудою (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'underground_crossing_portal_card_id' => $this->integer()->comment('Портали (окрема облікова картка; табл. 5.30)'), + 'underground_crossing_body_card_id' => $this->integer()->comment('Тіло тунелю (окрема облікова картка; табл. 5.31)'), + 'underground_crossing_add_on_card_id' => $this->integer()->comment('Надбудова (окрема облікова картка; табл. 5.32)'), + 'technical_doc_id' => $this->integer()->comment('Технічна документація (окрема облікова картка; табл. 5.23)'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'underground_crossing_outline_coords' => $this->string()->comment('Координати контуру споруди в межах зони пішохідного руху (геодані)'), + ]); + $this->addCommentOnTable('underground_crossing_card', 'Дані про підземний пішохідний перехід'); + + // Table 5.30 + $this->createTable('underground_crossing_portal_card', [ + 'underground_crossing_portal_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'header_location' => $this->text()->comment('Розташування оголовку'), + 'underground_crossing_portal_type_id' => $this->integer()->comment('Тип порталу (згідно з [4])'), + 'thick' => $this->decimal()->comment('Товщина (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'frame_material_id' => $this->integer()->comment('Матеріал оправи порталу (згідно з [4])'), + 'frame_capacity' => $this->decimal()->comment('Об\'єм оправи порталу (у кубічних метрах; з двома цифрами після коми)'), + 'another_first_type_material_id' => $this->integer()->comment('Матеріал інших елементів порталу 1-го типу (згідно з [4])'), + 'another_first_type_capacity' => $this->decimal()->comment('Об\'єм інших елементів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'another_second_type_material_id' => $this->integer()->comment('Матеріал інших елементів порталу 2-го типу (згідно з [4])'), + 'another_second_type_capacity' => $this->decimal()->comment('Об\'єм інших елементів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'another_third_type_material_id' => $this->integer()->comment('Матеріал інших елементів порталу 3-го типу (згідно з [4])'), + 'another_third_type_capacity' => $this->decimal()->comment('Об\'єм інших елементів 3-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'basement_material_id' => $this->integer()->comment('Матеріал основи (згідно з [4])'), + 'foundation_basement_capacity' => $this->decimal()->comment('Загальний об\'єм фундаменту та основи (у кубічних метрах; з двома цифрами після коми)'), + 'fortified_slope_material_id' => $this->integer()->comment('Матеріал укріплення укосів (згідно з [4])'), + ]); + $this->addCommentOnTable('underground_crossing_portal_card', 'Дані про портал підземного пішохідного переходу'); + + // Table 5.31 + $this->createTable('underground_crossing_body_card', [ + 'underground_crossing_body_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'body_type_id' => $this->integer()->comment('Тип форми тіла (згідно з [4])'), + 'thick' => $this->decimal()->comment('Товщина (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'typical_project_id' => $this->integer()->comment('Типовий проект (згідно з [4])'), + 'body_material_id' => $this->integer()->comment('Матеріал стінової будови (згідно з [4])'), + 'body_material_capacity' => $this->decimal()->comment('Об\'єм матеріалу стінової будови (у кубічних метрах; з двома цифрами після коми)'), + 'overlap_type_id' => $this->integer()->comment('Тип конструкцій перекриття (згідно з [4])'), + 'overlap_material_id' => $this->integer()->comment('Матеріал конструкцій перекриття (згідно з [4])'), + 'overlap_material_capacity' => $this->decimal()->comment('Об\'єм матеріалу конструкцій перекриття (у кубічних метрах; з двома цифрами після коми)'), + 'foundation_material_id' => $this->integer()->comment('Матеріал фундаменту (згідно з [4])'), + 'basement_material_id' => $this->integer()->comment('Матеріал основи (згідно з [4])'), + 'foundation_basement_capacity' => $this->decimal()->comment('Загальний об\'єм фундаменту та основи (у кубічних метрах; з двома цифрами після коми)'), + ]); + $this->addCommentOnTable('underground_crossing_body_card', 'Дані про тіло підземного пішохідного переходу'); + + // Table 5.32 + $this->createTable('underground_crossing_add_on_card', [ + 'underground_crossing_add_on_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'location' => $this->text()->comment('Розташування надбудови'), + 'thick' => $this->decimal()->comment('Товщина (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина (у метрах; з двома цифрами після коми)'), + 'wall_material_id' => $this->integer()->comment('Матеріал стін (згідно з [4])'), + 'roof_material_id' => $this->integer()->comment('Матеріал даху (згідно з [4])'), + 'wall_material_capacity' => $this->decimal()->comment('Об\'єм матеріалу стін (у кубічних метрах; з двома цифрами після коми)'), + 'roof_material_capacity' => $this->decimal()->comment('Об\'єм матеріалу даху (у кубічних метрах; з двома цифрами після коми)'), + 'first_add_on_coords' => $this->string()->comment('Координати 1-ї надбудови (геодані)'), + 'second_add_on_coords' => $this->string()->comment('Координати 2-ї надбудови (геодані)'), + ]); + $this->addCommentOnTable('underground_crossing_add_on_card', 'Дані про надбудови підземного пішохідного переходу'); + + // Table 5.33 + $this->createTable('overground_crossing', [ + 'overground_crossing_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'long_scheme' => $this->text()->comment('Поздовжня схема'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'add_on_availability' => $this->integer()->comment('Наявність надбудов (згідно з [4])'), + 'lift_availability' => $this->integer()->comment('Наявність пандусів, механічних підйомників на вході та виході із споруди (згідно з [4])'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'overground_crossing_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.34)'), + 'stair_total_length' => $this->decimal()->comment('Загальна довжина сходів на підході до споруди (у метрах; з двома цифрами після коми)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('overground_crossing', 'Облікова відомість надземних пішохідних переходів'); + + // Table 5.34 + $this->createTable('overground_crossing_card', [ + 'overground_crossing_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'year_reconstruction' => $this->text()->comment('Рік реконструкції'), + 'nearest_settlement_name' => $this->text()->comment('Назва найближчого населеного пункту'), + 'nearest_settlement_distance' => $this->decimal()->comment('Відстань до найближчого населеного пункту (в кілометрах; з двома цифрами після коми)'), + 'load_project' => $this->decimal()->comment('Проектне навантаження (в кілометрах; з двома цифрами після коми)'), + 'load_fact' => $this->decimal()->comment('Фактичне навантаження (в кілометрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Технічний стан (згідно з [4])'), + 'roadway_width' => $this->decimal()->comment('Ширина автомобільної дороги по верху земляного полотна (у метрах; з двома цифрами після коми)'), + 'cross_angle' => $this->decimal()->comment('Кут перетину (в градусах; з двома цифрами після коми)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'bridge_under_height' => $this->decimal()->comment('Висота підмостового габариту (у метрах; з двома цифрами після коми)'), + 'bridge_under_width' => $this->decimal()->comment('Ширина підмостового габариту (у метрах; з двома цифрами після коми)'), + 'bridge_hole' => $this->decimal()->comment('Отвір моста (у метрах; з двома цифрами після коми)'), + 'bearing_structures_long_scheme' => $this->text()->comment('Поздовжня схема несучих конструкцій ліворуч направо по ходу прямого напрямку руху'), + 'slope_long_scheme' => $this->text()->comment('Поздовжня схема похилів'), + 'barrier_material_type_id' => $this->integer()->comment('Матеріал перил (згідно з [4])'), + 'barrier_height' => $this->integer()->comment('Висота перил (у метрах; з двома цифрами після коми)'), + 'surface_material_id' => $this->integer()->comment('Покриття пішохідної частини'), + 'antiseismic_type_id' => $this->integer()->comment('Типи антисейсмічних пристроїв (згідно з [4])'), + 'deformation_joint_type_id' => $this->integer()->comment('Типи деформаційних швів (згідно з [4])'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації, яка перепускається спорудою (згідно з [4])'), + 'drainage_type_id' => $this->integer()->comment('Тип водовідведення (згідно з [4])'), + 'drainage_tray_length' => $this->decimal()->comment('Загальна довжина лотків зливової каналізації (у метрах; з двома цифрами після коми)'), + 'drainage_collector_length' => $this->decimal()->comment('Загальна довжина колекторів зливової каналізації (у метрах; з двома цифрами після коми)'), + 'approach_left' => $this->integer()->comment('Споруди підходів ліворуч (згідно з [4])'), + 'approach_right' => $this->integer()->comment('Споруди підходів праворуч (згідно з [4])'), + 'add_on_availability' => $this->integer()->comment('Надбудова (згідно з [4])'), + 'light_availability' => $this->integer()->comment('Наявність штучного освітлення (згідно з [4])'), + 'inventory_device_availability' => $this->integer()->comment('Наявність інвентарних пристроїв для огляду та ремонту (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'purlin_card_id' => $this->integer()->comment('Прогони (окрема облікова картка; табл. 5.26)'), + 'pillar_card_id' => $this->integer()->comment('Опори (окрема облікова картка; табл. 5.27)'), + 'approach_card_id' => $this->integer()->comment('Підходи (окрема облікова картка; табл. 5.35)'), + 'sewage_card_id' => $this->integer()->comment('Очисні споруди (окрема облікова картка; табл. 5.22)'), + 'technical_doc_id' => $this->integer()->comment('Технічна документація (окрема облікова картка; табл. 5.23)'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'overground_crossing_outline_coords' => $this->string()->comment('Координати контуру споруди в межах пішохідної зони (геодані)'), + ]); + $this->addCommentOnTable('overground_crossing_card', 'Дані про надземний пішохідний перехід'); + + // Table 5.35 + $this->createTable('overground_crossing_approach_card', [ + 'overground_crossing_approach_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'location' => $this->text()->comment('Розташування споруди'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'another_first_type_material_id' => $this->integer()->comment('Матеріал споруди 1-го типу (згідно з [4])'), + 'another_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'another_second_type_material_id' => $this->integer()->comment('Матеріал споруди 2-го типу (згідно з [4])'), + 'another_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'another_third_type_material_id' => $this->integer()->comment('Матеріал споруди 3-го типу (згідно з [4])'), + 'another_third_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 3-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'related_lift_construction_left_type_id' => $this->integer()->comment('Тип супутніх підйомних споруд ліворуч (згідно з [4])'), + 'related_lift_construction_right_type_id' => $this->integer()->comment('Тип супутніх підйомних споруд праворуч (згідно з [4])'), + 'construction_coords_left' => $this->string()->comment('Координати споруди ліворуч (геодані)'), + 'construction_coords_right' => $this->string()->comment('Координати споруди праворуч (геодані)'), + ]); + $this->addCommentOnTable('overground_crossing_approach_card', 'Дані про підходи до надземного пішохідного переходу'); + + // Table 5.36 + $this->createTable('sel_protection', [ + 'sel_protection_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення предмета захисту (псевдогеодані)'), + 'road_distance' => $this->decimal()->comment('Відстань від дороги (у метрах; з двома цифрами після коми)'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'sel_protection_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.37)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('sel_protection', 'Облікова відомість селезахисних споруд'); + + // Table 5.37 + $this->createTable('sel_protection_card', [ + 'sel_protection_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'location' => $this->text()->comment('Розташування споруди'), + 'position' => $this->string()->comment('Положення предмета захисту (псевдогеодані)'), + 'protection_object_id' => $this->integer()->comment('Предмет захисту (згідно з [4])'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'road_distance' => $this->decimal()->comment('Відстань від дороги (у метрах; з двома цифрами після коми)'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'year_reconstruction' => $this->text()->comment('Рік реконструкції'), + 'nearest_settlement_name' => $this->text()->comment('Назва найближчого населеного пункту'), + 'nearest_settlement_distance' => $this->decimal()->comment('Відстань до найближчого населеного пункту (в кілометрах; з двома цифрами після коми)'), + 'load_project' => $this->decimal()->comment('Проектне навантаження (в тоннах; з двома цифрами після коми)'), + 'load_fact' => $this->decimal()->comment('Фактичне навантаження (в тоннах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'thalweg_type_id' => $this->integer()->comment('Тип тальвегу (згідно з [4])'), + 'watercourse_rmv_width' => $this->decimal()->comment('Ширина водотоку по дзеркалу РМВ (у метрах; з двома цифрами після коми)'), + 'flow_rmv_speed' => $this->decimal()->comment('Швидкість течії при РМВ (у метрах на секунду; з двома цифрами після коми)'), + 'watercourse_rvv_width' => $this->decimal()->comment('Ширина водотоку по дзеркалу РВВ (у метрах; з двома цифрами після коми)'), + 'cross_angle' => $this->decimal()->comment('Кут перетину (в градусах; з двома цифрами після коми)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'material_id' => $this->integer()->comment('Матеріал споруди (згідно з [4])'), + 'capacity' => $this->decimal()->comment('Об\'єм споруди (у кубічних метрах; з двома цифрами після коми)'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації, яка перепускається спорудою (згідно з [4])'), + 'drainage_type_id' => $this->integer()->comment('Тип водовідведення (згідно з [4])'), + 'drainage_length' => $this->decimal()->comment('Загальна довжина водовідвідних елементів (у метрах; з двома цифрами після коми)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'drainage_pipe_card_id' => $this->integer()->comment('Картка водовідвідної труби (окрема облікова картка; табл. 5.39)'), + 'drainage_card_id' => $this->integer()->comment('Картка дренажної системи (окрема облікова картка; табл. 5.52)'), + 'technical_doc_id' => $this->integer()->comment('Технічна документація (окрема облікова картка; табл. 5.23)'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'sel_protection_outline_coords' => $this->string()->comment('Координати контуру споруди (геодані)'), + ]); + $this->addCommentOnTable('sel_protection_card', 'Дані про селезахисну споруду'); + + // Table 5.38 + $this->createTable('drainage_pipe', [ + 'drainage_pipe_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення предмета захисту (псевдогеодані)'), + 'obstacle_type_id' => $this->integer()->comment('Вид перешкоди (згідно з [4])'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'culvert_elements_entrance_count' => $this->integer()->comment('Кількість ВПЕ на вході'), + 'culvert_elements_exit_count' => $this->integer()->comment('Кількість ВПЕ на виході'), + 'header_entrance_count' => $this->integer()->comment('Кількість оголовків на вході'), + 'header_exit_count' => $this->integer()->comment('Кількість оголовків на виході'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'drainage_pipe_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.39)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('drainage_pipe', 'Облікова відомість труб водопропускних'); + + // Table 5.39 + $this->createTable('drainage_pipe_card', [ + 'drainage_pipe_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення споруди (псевдогеодані)'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'year_reconstruction' => $this->text()->comment('Рік реконструкції'), + 'obstacle_type_id' => $this->integer()->comment('Вид перешкоди (згідно з [4])'), + 'flow_km_direction' => $this->integer()->comment('Напрямок течії по ходу кілометражу (згідно з [4])'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації, яка перепускається спорудою (згідно з [4])'), + 'road_surface_up_height' => $this->decimal()->comment('Висота земляного полотна над трубою (у метрах; з двома цифрами після коми)'), + 'culvert_elements_entrance_count' => $this->integer()->comment('Кількість ВПЕ на вході'), + 'culvert_elements_exit_count' => $this->integer()->comment('Кількість ВПЕ на виході'), + 'header_entrance_count' => $this->integer()->comment('Кількість оголовків на вході'), + 'header_exit_count' => $this->integer()->comment('Кількість оголовків на виході'), + 'culvert_elements_area' => $this->decimal()->comment('Сумарна площа всіх ВПЕ (у квадратних метрах; з двома цифрами після коми)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'culvert_element_card_id' => $this->integer()->comment('Картка ВПЕ (окрема облікова картка; табл. 5.40)'), + 'header_card_id' => $this->integer()->comment('Картка оголовка (окрема облікова картка; табл. 5.41)'), + 'technical_doc_id' => $this->integer()->comment('Технічна документація (окрема облікова картка; табл. 5.23)'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'culvert_elements_one_coords' => $this->string()->comment('Координати вісі ВПЕ No 1 (геодані)'), + 'culvert_elements_two_coords' => $this->string()->comment('Координати вісі ВПЕ No 2 (геодані)'), + 'culvert_elements_three_coords' => $this->string()->comment('Координати вісі ВПЕ No 3 (геодані)'), + 'culvert_elements_four_coords' => $this->string()->comment('Координати вісі ВПЕ No 4 (геодані)'), + 'culvert_elements_five_coords' => $this->string()->comment('Координати вісі ВПЕ No 5 (геодані)'), + ]); + $this->addCommentOnTable('drainage_pipe_card', 'Дані про трубу водопропускну'); + + // Table 5.40 + $this->createTable('culvert_element_card', [ + 'culvert_element_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'culvert_element_number' => $this->integer()->comment('Номер ВПЕ'), + 'section_long_scheme' => $this->text()->comment('Поздовжня схема перерізів'), + 'section_type_id' => $this->integer()->comment('Тип перерізу (згідно з [4])'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'height' => $this->decimal()->comment('Висота отвору (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина отвору (у метрах; з двома цифрами після коми)'), + 'culvert_element_work_id' => $this->integer()->comment('Характер роботи ВПЕ (згідно з [4])'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'fortified_additional_bottom' => $this->integer()->comment('Додаткове укріплення дна (згідно з [4])'), + 'capacity' => $this->decimal()->comment('Об\'єм тіла ВПЕ (у кубічних метрах; з двома цифрами після коми)'), + 'foundation_thick' => $this->decimal()->comment('Товщина фундаменту (у метрах; з двома цифрами після коми)'), + 'foundation_material_id' => $this->integer()->comment('Матеріал фундаменту (згідно з [4])'), + 'basement_material_id' => $this->integer()->comment('Матеріал основи (згідно з [4])'), + 'foundation_basement_capacity' => $this->decimal()->comment('Загальний об\'єм фундаменту та основи (у кубічних метрах; з двома цифрами після коми)'), + 'waterproof_type_id' => $this->integer()->comment('Тип гідроізоляції (згідно з [4])'), + ]); + $this->addCommentOnTable('culvert_element_card', 'Дані про ВПЕ'); + + // Table 5.41 + $this->createTable('header_card', [ + 'header_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'purpose' => $this->text()->comment('Призначення оголовка'), + 'culvert_elements_junction_numbers' => $this->text()->comment('Номери ВПЕ, поєднаних оголовком'), + 'header_type_id' => $this->integer()->comment('Тип оголовка (згідно з [4])'), + 'header_first_type_material_id' => $this->integer()->comment('Матеріал портальної стінки порталу 1-го типу (згідно з [4])'), + 'header_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'header_second_type_material_id' => $this->integer()->comment('Матеріал портальної стінки порталу 2-го типу (згідно з [4])'), + 'header_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'wing_material_id' => $this->integer()->comment('Матеріал відкрилків (згідно з [4])'), + 'wing_capacity' => $this->integer()->comment('Об\'єм тіла відкрилків (у кубічних метрах; з двома цифрами після коми)'), + 'foundation_thick' => $this->decimal()->comment('Товщина фундаменту (у метрах; з двома цифрами після коми)'), + 'foundation_material_id' => $this->integer()->comment('Матеріал фундаменту (згідно з [4])'), + 'basement_type_id' => $this->integer()->comment('Тип основи (згідно з [4])'), + 'foundation_basement_capacity' => $this->decimal()->comment('Загальний об\'єм фундаменту та основи (у кубічних метрах; з двома цифрами після коми)'), + 'fortified_channel_material_id' => $this->integer()->comment('Матеріал укріплення русла (згідно з [4])'), + 'regulatory_type_id' => $this->integer()->comment('Тип регуляційних елементів (згідно з [4])'), + 'fortified_mound_header_material_id' => $this->integer()->comment('Матеріал укріплення насипу біля оголовка (згідно з [4])'), + ]); + $this->addCommentOnTable('header_card', 'Дані про оголовок'); + + // Table 5.42 + $this->createTable('bus_station', [ + 'bus_station_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення споруди (псевдогеодані)'), + 'pavilion_availability' => $this->integer()->comment('Наявність автопавільйона (згідно з [4])'), + 'pocket_availability' => $this->integer()->comment('Наявність заїзної кишені (згідно з [4])'), + 'landing_surface_availability' => $this->integer()->comment('Наявність посадкового майданчика з удосконаленим покриттям (згідно з [4])'), + 'toilet_availability' => $this->integer()->comment('Наявність туалета (згідно з [4])'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'bus_station_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.43)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('bus_station', 'Облікова відомість автобусних зупинок та автопавільйонів'); + + // Table 5.43 + $this->createTable('bus_station_card', [ + 'bus_station_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'name' => $this->text()->comment('Власна назва'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'year_reconstruction' => $this->text()->comment('Рік реконструкції'), + 'pavilion_availability' => $this->integer()->comment('Наявність автопавільйона (згідно з [4])'), + 'pocket_availability' => $this->integer()->comment('Наявність заїзної кишені (згідно з [4])'), + 'landing_surface_availability' => $this->integer()->comment('Наявність посадкового майданчика з удосконаленим покриттям (згідно з [4])'), + 'landing_surface_material_id' => $this->integer()->comment('Покриття посадочного майданчика (згідно з [4])'), + 'toilet_availability' => $this->integer()->comment('Наявність туалета (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'pavilion_card_id' => $this->integer()->comment('Автопавільйон (згідно з [4])'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'construction_center_coords' => $this->string()->comment('Координати центру споруди (геодані)'), + ]); + $this->addCommentOnTable('bus_station_card', 'Дані про автобусну зупинку'); + + // Table 5.44 + $this->createTable('pavilion_card', [ + 'pavilion_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'roof_first_type_material_id' => $this->integer()->comment('Матеріал даху 1-го типу (згідно з [4])'), + 'roof_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'roof_second_type_material_id' => $this->integer()->comment('Матеріал даху 2-го типу (згідно з [4])'), + 'roof_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'wall_first_type_material_id' => $this->integer()->comment('Матеріал стін 1-го типу (згідно з [4])'), + 'wall_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'wall_second_type_material_id' => $this->integer()->comment('Матеріал стін 2-го типу (згідно з [4])'), + 'wall_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'pavilion_outline_coords' => $this->string()->comment('Координати контуру павільйону (геодані)'), + ]); + $this->addCommentOnTable('pavilion_card', 'Дані про автопавільйон'); + + // Table 5.45 + $this->createTable('retaining_wall', [ + 'retaining_wall_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення середини споруди (псевдогеодані)'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'retaining_wall_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.46)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('retaining_wall', 'Облікова відомість підпірних стінок'); + + // Table 5.46 + $this->createTable('retaining_wall_card', [ + 'retaining_wall_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Положення початку споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Положення кінця споруди (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'purpose' => $this->integer()->comment('Призначення споруди (згідно з [4])'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'year_reconstruction' => $this->text()->comment('Рік реконструкції'), + 'material_id' => $this->integer()->comment('Матеріал споруди (згідно з [4])'), + 'drainage_wall_availability' => $this->integer()->comment('Наявність застінного дренажу (згідно з [4])'), + 'material_capacity' => $this->decimal()->comment('Об\'єм матеріалів в споруді (у кубічних метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'construction_coords' => $this->string()->comment('Координати вісі споруди (геодані)'), + ]); + $this->addCommentOnTable('retaining_wall_card', 'Дані про підпірну стінку'); + + // Table 5.47 + $this->createTable('stabilisation_field', [ + 'stabilisation_field_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'purpose' => $this->text()->comment('Призначення споруди'), + 'area' => $this->decimal()->comment('Площа (у квадратних метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'stabilisation_field_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.48)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'monitor_result' => $this->text()->comment('Результати моніторингу'), + 'date_monitor' => $this->integer()->comment('Дата моніторингу (згідно з [4])'), + ]); + $this->addCommentOnTable('stabilisation_field', 'Облікова відомість стабілізаційних полів'); + + // Table 5.48 + $this->createTable('stabilisation_field_card', [ + 'stabilisation_field_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'area' => $this->decimal()->comment('Площа споруди (у квадратних метрах; з двома цифрами після коми)'), + 'pile_type_id' => $this->integer()->comment('Тип паль (згідно з [4])'), + 'pile_cut' => $this->decimal()->comment('Переріз паль (у метрах; з двома цифрами після коми)'), + 'pile_length' => $this->decimal()->comment('Довжина паль (у метрах; з двома цифрами після коми)'), + 'pile_count' => $this->integer()->comment('Кількість паль'), + 'year_build' => $this->text()->comment('Рік побудови'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'monitor_result' => $this->text()->comment('Результати моніторингу'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'construction_outline_coords' => $this->string()->comment('Координати контуру споруди (геодані)'), + ]); + $this->addCommentOnTable('stabilisation_field_card', 'Дані про стабілізаційне поле'); + + // Table 5.49 + $this->createTable('tray', [ + 'tray_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->integer()->comment('Призначення (згідно з [4])'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'tray_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.50)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('tray', 'Облікова відомість лотків'); + + // Table 5.50 + $this->createTable('tray_card', [ + 'tray_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Положення початку споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Положення кінця споруди (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'body_material_id' => $this->integer()->comment('Матеріал тіла споруди (згідно з [4])'), + 'body_material_capacity' => $this->decimal()->comment('Об\'єм матеріалів тіла споруди (у кубічних метрах; з двома цифрами після коми)'), + 'basement_material_id' => $this->integer()->comment('Матеріал основи споруди (згідно з [4])'), + 'basement_material_capacity' => $this->decimal()->comment('Об\'єм матеріалів основи споруди (у кубічних метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'construction_coords' => $this->string()->comment('Координати вісі споруди (геодані)'), + ]); + $this->addCommentOnTable('tray_card', 'Дані про лоток, перепад, швидкотік'); + + // Table 5.51 + $this->createTable('drainage', [ + 'drainage_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'drainage_construction_type_id' => $this->integer()->comment('Тип конструкції дренажу (згідно з [4])'), + 'drainage_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.52)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('drainage', 'Облікова відомість дренажних споруд'); + + // Table 5.52 + $this->createTable('drainage_card', [ + 'drainage_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Положення початку споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Положення кінця споруди (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'drainage_construction_type_id' => $this->integer()->comment('Тип конструкції дренажу (згідно з [4])'), + 'manhole_count' => $this->integer()->comment('Кількість оглядових колодязів'), + 'manhole_first_type_material_id' => $this->integer()->comment('Матеріал оглядових колодязів 1-го типу (згідно з [4])'), + 'manhole_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів оглядових колодязів 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'manhole_second_type_material_id' => $this->integer()->comment('Матеріал оглядових колодязів 2-го типу (згідно з [4])'), + 'manhole_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів оглядових колодязів 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'drainage_pipe_first_type_material_id' => $this->integer()->comment('Матеріал дренажних труб 1-го типу (згідно з [4])'), + 'drainage_pipe_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів дренажних труб 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'drainage_pipe_second_type_material_id' => $this->integer()->comment('Матеріал дренажних труб 2-го типу (згідно з [4])'), + 'drainage_pipe_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів дренажних труб 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'drainage_pipe_third_type_material_id' => $this->integer()->comment('Матеріал дренажних труб 3-го типу (згідно з [4])'), + 'drainage_pipe_third_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів дренажних труб 3-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'drainage_pipe_fourth_type_material_id' => $this->integer()->comment('Матеріал дренажних труб 4-го типу (згідно з [4])'), + 'drainage_pipe_fourth_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів дренажних труб 4-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'exhaust_construction_first_type_material_id' => $this->integer()->comment('Матеріал випускної споруди 1-го типу (згідно з [4])'), + 'exhaust_construction_first_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів випускної споруди 1-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'exhaust_construction_second_type_material_id' => $this->integer()->comment('Матеріал випускної споруди 2-го типу (згідно з [4])'), + 'exhaust_construction_second_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів випускної споруди 2-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'exhaust_construction_third_type_material_id' => $this->integer()->comment('Матеріал випускної споруди 3-го типу (згідно з [4])'), + 'exhaust_construction_third_type_capacity' => $this->decimal()->comment('Об\'єм матеріалів випускної споруди 3-го типу (у кубічних метрах; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'draft' => $this->string()->comment('Креслення (pdf [3])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'construction_up_coords' => $this->string()->comment('Координати вісі споруди по верху (геодані)'), + 'construction_down_coords' => $this->string()->comment('Координати вісі споруди по низу (геодані)'), + ]); + $this->addCommentOnTable('drainage_card', 'Дані про дренажну споруду'); + + // Table 5.53 + $this->createTable('site', [ + 'site_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення середини споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення майданчика'), + 'surface_type_id' => $this->integer()->comment('Тип покриття (згідно з [4])'), + 'area' => $this->decimal()->comment('Площа покриття стоянки (у квадратних метрах; з двома цифрами після коми)'), + 'site_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.54)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('site', 'Облікова відомість майданчиків'); + + // Table 5.54 + $this->createTable('site_card', [ + 'site_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення майданчика'), + 'surface_type_id' => $this->integer()->comment('Тип покриття (згідно з [4])'), + 'area' => $this->decimal()->comment('Площа покриття (у квадратних метрах; з двома цифрами після коми)'), + 'improvement_card_id' => $this->integer()->comment('Елементи благоустрою (окрема облікова картка; табл. 5.55)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'construction_outline_coords' => $this->string()->comment('Координати контуру споруди (геодані)'), + 'construction_center_coords' => $this->string()->comment('Координати вісі споруди по верху (геодані)'), + ]); + $this->addCommentOnTable('site_card', 'Дані про майданчик'); + + // Table 5.55 + $this->createTable('improvement_card', [ + 'improvement_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'improvement_miss' => $this->integer()->comment('Благоустрій відсутній (згідно з [4])'), + 'water_drink' => $this->integer()->comment('Вода питна (згідно з [4])'), + 'water_technical' => $this->integer()->comment('Вода технічна (згідно з [4])'), + 'trestle' => $this->integer()->comment('Естакада (згідно з [4])'), + 'terminal_informational' => $this->integer()->comment('Інформаційний термінал (згідно з [4])'), + 'architecture_form_small' => $this->integer()->comment('Малі архітектурні форми (згідно з [4])'), + 'light' => $this->integer()->comment('Освітлення (згідно з [4])'), + 'security' => $this->integer()->comment('Охорона (згідно з [4])'), + ]); + $this->addCommentOnTable('improvement_card', 'Дані про елемент благоустрою'); + + // Table 5.56 + $this->createTable('sidewalk', [ + 'sidewalk_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'settlement_name' => $this->text()->comment('Назва населеного пункту'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'surface_type_id' => $this->integer()->comment('Тип покриття (згідно з [4])'), + 'area' => $this->decimal()->comment('Площа покриття (у квадратних метрах; з двома цифрами після коми)'), + 'sidewalk_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.57)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('sidewalk', 'Облікова відомість тротуарів та велодоріжок'); + + // Table 5.57 + $this->createTable('sidewalk_card', [ + 'sidewalk_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'length' => $this->decimal()->comment('Довжина споруди (у метрах; з двома цифрами після коми)'), + 'width' => $this->decimal()->comment('Ширина споруди (у метрах; з двома цифрами після коми)'), + 'constrution_type_id' => $this->integer()->comment('Тип споруди (згідно з [4])'), + 'road_surface_id' => $this->integer()->comment('Дорожній одяг (окрема облікова картка; табл. 5.9)'), + 'area' => $this->decimal()->comment('Площа покриття (у квадратних метрах; з двома цифрами після коми)'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'construction_outline_coords' => $this->string()->comment('Координати контуру споруди (геодані)'), + ]); + $this->addCommentOnTable('sidewalk_card', 'Дані про тротуар, велодоріжку'); + + // Table 5.58 + $this->createTable('fence', [ + 'fence_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'fence_type_id' => $this->integer()->comment('Тип огородження (згідно з [4])'), + 'fence_construction_type_id' => $this->integer()->comment('Тип конструкції огородження (згідно з [4])'), + 'fence_construction_id' => $this->integer()->comment('Конструкція огородження (згідно з [4])'), + 'material_id' => $this->integer()->comment('Матеріал огородження (згідно з [4])'), + 'stud_material_id' => $this->integer()->comment('Матеріал стояків (згідно з [4])'), + 'fence_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.59)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('fence', 'Облікова відомість огороджень'); + + // Table 5.59 + $this->createTable('fence_card', [ + 'fence_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'fence_type_id' => $this->integer()->comment('Тип огородження (згідно з ДСТУ 2735)'), + 'fence_construction_id' => $this->integer()->comment('Конструкція огородження (згідно з [4])'), + 'material_id' => $this->integer()->comment('Матеріал елементів огородження (згідно з [4])'), + 'stud_material_id' => $this->integer()->comment('Матеріал стояків (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'construction_coords' => $this->string()->comment('Координати вісі споруди (геодані)'), + ]); + $this->addCommentOnTable('fence_card', 'Дані про окрему ділянку огородження'); + + // Table 5.60 + $this->createTable('direct_device', [ + 'direct_device_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок сукупності пристроїв (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець сукупності пристроїв (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'direct_device_type_id' => $this->integer()->comment('Тип напрямного пристрою (згідно з [4])'), + 'device_count' => $this->integer()->comment('Кількість елементів в групі'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'direct_device_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.61)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('direct_device', 'Облікова відомість напрямних пристроїв'); + + // Table 5.61 + $this->createTable('direct_device_card', [ + 'direct_device_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок сукупності пристроїв (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець сукупності пристроїв (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'direct_device_type_id' => $this->integer()->comment('Тип напрямного пристрою (згідно з [4])'), + 'device_count' => $this->integer()->comment('Кількість елементів в групі'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'reflective_element_availability' => $this->integer()->comment('Наявність світлоповертаючих елементів (згідно з [4])'), + 'artificial_light_availability' => $this->integer()->comment('Наявність штучної підствітки (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'construction_coords' => $this->string()->comment('Координати елементів сукупності (геодані)'), + ]); + $this->addCommentOnTable('direct_device_card', 'Дані про напрямний пристрій або їх сукупність'); + + // Table 5.62 + $this->createTable('noise_dazzle_protection', [ + 'noise_dazzle_protection_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'purpose' => $this->text()->comment('Призначення'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'noise_dazzle_protection_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.63 - 5.64)'), + 'state' => $this->integer()->comment('Стан споруди (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('noise_dazzle_protection', 'Облікова шумозахисних та протизасліплювальних споруд'); + + // Table 5.63 + $this->createTable('dazzle_protection_card', [ + 'dazzle_protection_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення споруди'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'construction_coords' => $this->string()->comment('Координати вісі споруди (геодані)'), + ]); + $this->addCommentOnTable('dazzle_protection_card', 'Дані про протизасліплювальну споруду'); + + // Table 5.64 + $this->createTable('noise_protection_card', [ + 'noise_protection_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок споруди (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець споруди (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення споруди'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'height' => $this->decimal()->comment('Висота споруди (у метрах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'break_counter_screen_availability' => $this->integer()->comment('Наявність розривів та контр-екранів (згідно з [4])'), + 'drainage_availability' => $this->integer()->comment('Наявність водовідведення (згідно з [4])'), + 'vibration_absorbing_availability' => $this->integer()->comment('Наявність пружних вібропоглинаючих прокладок між секціями (згідно з [4])'), + 'sound_reflect_cassette_material_id' => $this->integer()->comment('Матеріал звуковідбивних касет (згідно з [4])'), + 'sound_absorbing_cassette_material_id' => $this->integer()->comment('Матеріал звукопоглинальних касет (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'acoustic_project_effectivity' => $this->text()->comment('Проектна акустична ефективність'), + 'acoustic_effectivity_indicator' => $this->text()->comment('Показник акустичної ефективності споруди'), + 'exploitation_instruction_availability' => $this->integer()->comment('Наявніть інструкції з експлуатації (згідно з [4])'), + 'project_doc_location' => $this->text()->comment('Місце зберігання проектної документації'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'act_work_performed' => $this->text()->comment('Акт виконаних робіт (pdf [3])'), + 'repair_certificate' => $this->string()->comment('Довідка про виконання ремонтних робіт (pdf [3])'), + 'construction_coords' => $this->string()->comment('Координати вісі споруди (геодані)'), + ]); + $this->addCommentOnTable('noise_protection_card', 'Дані про шумозахисну споруду'); + + // Table 5.65 + $this->createTable('road_sign', [ + 'road_sign_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'size_typical' => $this->integer()->comment('Типорозмір (згідно з 3.17 ДСТУ 4100)'), + 'number' => $this->integer()->comment('Типорозмір (згідно з 3.2 ДСТУ 4100)'), + 'text' => $this->text()->comment('Текст'), + 'location' => $this->text()->comment('Розташування'), + 'purpose_direction' => $this->text()->comment('Призначення для напрямку руху'), + 'fasten_type_id' => $this->integer()->comment('Тип кріплення знаку (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'defects' => $this->text()->comment('Дефекти'), + 'road_sign_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.66)'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('road_sign', 'Облікова відомість знаків дорожніх'); + + // Table 5.66 + $this->createTable('road_sign_card', [ + 'road_sign_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'size_typical' => $this->integer()->comment('Типорозмір (згідно з 3.17 ДСТУ 4100)'), + 'number' => $this->integer()->comment('Типорозмір (згідно з 3.2 ДСТУ 4100)'), + 'text' => $this->text()->comment('Текст'), + 'location' => $this->text()->comment('Розташування'), + 'purpose_direction' => $this->text()->comment('Призначення для напрямку руху'), + 'fasten_type_id' => $this->integer()->comment('Тип кріплення знаку (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'defects' => $this->text()->comment('Дефекти'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('road_sign_card', 'Дані про знак дорожній'); + + // Table 5.67 + $this->createTable('road_mark', [ + 'road_mark_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'area' => $this->decimal()->comment('Площа покриття (у квадратних метрах; з двома цифрами після коми)'), + 'group' => $this->integer()->comment('Група розмітки (згідно з 4.1 ДСТУ 2587)'), + 'number' => $this->integer()->comment('Номер розмітки (згідно з 4.1 ДСТУ 2587)'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'reflective_element_availability' => $this->integer()->comment('Наявність світлоповертальних елементів (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість споруди (у тисячах гривень; з двома цифрами після коми)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти (згідно з [4])'), + 'road_mark_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.68)'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('road_mark', 'Облікова відомість розміток дорожніх'); + + // Table 5.68 + $this->createTable('road_mark_card', [ + 'road_mark_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'area' => $this->decimal()->comment('Площа (у квадратних метрах; з двома цифрами після коми)'), + 'group' => $this->integer()->comment('Група розмітки (згідно з 4.1 ДСТУ 2587)'), + 'number' => $this->integer()->comment('Номер розмітки (згідно з 4.1 ДСТУ 2587)'), + 'material_id' => $this->integer()->comment('Матеріал (згідно з [4])'), + 'reflective_element_availability' => $this->integer()->comment('Наявність світлоповертальних елементів (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + ]); + $this->addCommentOnTable('road_mark_card', 'Дані про розмітку дорожню'); + + // Table 5.69 + $this->createTable('planting', [ + 'planting_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення'), + 'tree_lane_count' => $this->integer()->comment('Кількість рядів дерев'), + 'lane_width_average' => $this->decimal()->comment('Середня ширина смуги (у метрах; з двома цифрами після коми)'), + 'area' => $this->decimal()->comment('Площа (у квадратних метрах; з двома цифрами після коми)'), + 'year_build' => $this->text()->comment('Рік висадження'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->text()->comment('Дефекти'), + 'planting_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.70)'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('planting', 'Облікова відомість штучних насаджень'); + + // Table 5.70 + $this->createTable('planting_card', [ + 'planting_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'purpose' => $this->text()->comment('Призначення'), + 'road_distance' => $this->decimal()->comment('Відстань від крайки проїзної частини дороги до найближчого краю стовбура дерева першого ряду насаджень (у метрах; з двома цифрами після коми)'), + 'tree_assortment' => $this->text()->comment('Асортимент порід дерев і кущів'), + 'tree_row_count' => $this->integer()->comment('Кількість рядів дерев'), + 'lane_width_average' => $this->decimal()->comment('Середня ширина смуги озеленення (у метрах; з двома цифрами після коми)'), + 'tree_top_height' => $this->decimal()->comment('Найвища висота дерева (у метрах; з двома цифрами після коми)'), + 'tree_crown_width' => $this->decimal()->comment('Ширина крони дерева (у метрах; з двома цифрами після коми)'), + 'tree_crown_density' => $this->text()->comment('Щільність (ажурність) крони дерев'), + 'tree_crown_height' => $this->decimal()->comment('Висота крони дерев (у метрах; з двома цифрами після коми)'), + 'tree_lane_distance' => $this->decimal()->comment('Відстань міждеревами в ряду (у метрах; з двома цифрами після коми)'), + 'area' => $this->decimal()->comment('Площа (у квадратних метрах; з двома цифрами після коми)'), + 'year_build' => $this->text()->comment('Рік висадження'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти (згідно з [4])'), + 'photo' => $this->string()->comment('Фотографії (tiff [3])'), + 'video' => $this->string()->comment('Відео файли (mkv [3])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + ]); + $this->addCommentOnTable('planting_card', 'Дані про штучні насадження'); + + // Table 5.71 + $this->createTable('data_collector', [ + 'data_collector_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти (згідно з [4])'), + 'data_collector_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.72)'), + 'link' => $this->text()->comment('Посилання на інтернет-ресурси'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('data_collector', 'Облікова відомість автоматичних електронних засобів збору даних'); + + // Table 5.72 + $this->createTable('data_collector_card', [ + 'data_collector_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'data_collector_type_id' => $this->integer()->comment('Тип автоматичного електронного засобу збору даних (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'year_build' => $this->text()->comment('Рік будівництва'), + ]); + $this->addCommentOnTable('data_collector_card', 'Дані про автоматичний електронний засіб збору даних'); + + // Table 5.73 + $this->createTable('communication', [ + 'communication_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації (згідно з [4])'), + 'tool_construction'=> $this->integer()->comment('Засоби прокладання (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'communication_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.74)'), + ]); + $this->addCommentOnTable('communication', 'Облікова відомість власних комунікацій'); + + // Table 5.74 + $this->createTable('communication_card', [ + 'communication_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації (згідно з [4])'), + 'tool_construction'=> $this->integer()->comment('Засоби прокладання (згідно з [4])'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'balance_cost' => $this->decimal()->comment('Балансова вартість (у тисячах гривень; з двома цифрами після коми)'), + 'defects' => $this->integer()->comment('Дефекти споруди (згідно з [4])'), + 'project_organization' => $this->text()->comment('Проектна організація'), + 'project_year' => $this->text()->comment('Рік випуску проекту'), + 'build_organization' => $this->text()->comment('Будівельна організація'), + 'year_build' => $this->text()->comment('Рік будівництва'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('communication_card', 'Дані про власну комунікацію'); + + // Table 5.75 + $this->createTable('snow_protection', [ + 'snow_protection_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки потенційного занесення снігом (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки потенційного занесення снігом (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'snow_protection_type_id' => $this->integer()->comment('Тип снігозахисних засобів (згідно з [4])'), + 'count' => $this->integer()->comment('Потрібна кількість снігозахисних засобів'), + ]); + $this->addCommentOnTable('snow_protection', 'Дані про тимчасові снігозахисні засоби'); + + // Table 5.76 + $this->createTable('topography_climate', [ + 'topography_climate_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'condition' => $this->string()->comment('Топографічні та кліматичні умови (pdf [3])'), + 'road_climate_zone' => $this->integer()->comment('Дорожньо-кліматична зона (згідно з Додатком Г ДБН В.2.3-4)'), + 'climate_region' => $this->integer()->comment('Дорожньо-кліматична зона (згідно з Додатком Д ДБН В.2.3-4)'), + ]); + $this->addCommentOnTable('topography_climate', 'Дані про топографічні та кліматичні умови'); + + // Table 5.77 + $this->createTable('road_complex', [ + 'road_complex_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'length' => $this->decimal()->comment('Довжина (у метрах; з двома цифрами після коми)'), + 'location' => $this->text()->comment('Розташування'), + 'nature_factor' => $this->integer()->comment('Природні фактори, що зумовлюють складність утримання (згідно з [4])'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('road_complex', 'Дані про ділянки дороги підвищеної складності утримання'); + + // Table 5.78 + $this->createTable('rail_cross', [ + 'rail_cross_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Місце перетину з залізницею (псевдогеодані)'), + 'level' => $this->integer()->comment('Рівень перетину з залізницею (згідно з [4])'), + 'rail_name' => $this->text()->comment('Назва залізниці'), + 'rail_track_count' => $this->integer()->comment('Кількість колій'), + 'rail_electricity_availability' => $this->integer()->comment('Наявність електрифікації залізниці (згідно з [4])'), + 'security_availability' => $this->integer()->comment('Наявність охорони (згідно з [4])'), + 'surface_type_id' => $this->integer()->comment('Тип покриття на переїзді (згідно з [4])'), + 'barrier_availability' => $this->integer()->comment('Наявність шлагбауму (згідно з [4])'), + 'stop_device_availability' => $this->integer()->comment('Наявність пристроїв примусової зупинки проїзду (згідно з [4])'), + 'traffic_light_availability' => $this->integer()->comment('Наявність світлофору (згідно з [4])'), + 'light_availability' => $this->integer()->comment('Наявність освітлення (згідно з [4])'), + 'train_visibility_left' => $this->decimal()->comment('Відстань видимості потягу ліворуч (у метрах; з двома цифрами після коми)'), + 'train_visibility_right' => $this->decimal()->comment('Відстань видимості потягу праворуч (у метрах; з двома цифрами після коми)'), + 'cross_angle' => $this->decimal()->comment('Кут перетину (в градусах; з двома цифрами після коми)'), + 'state' => $this->integer()->comment('Стан (згідно з [4])'), + 'defects' => $this->integer()->comment('Дефекти (згідно з [4])'), + 'rail_direction' => $this->text()->comment('Напрямок руху залізниці'), + 'rail_direction_vector_coords' => $this->string()->comment('Координати вектору напрямку руху (геодані)'), + 'track_first_coords' => $this->string()->comment('Координати 1-ї колії (геодані)'), + 'track_second_coords' => $this->string()->comment('Координати 2-ї колії (геодані)'), + 'track_third_coords' => $this->string()->comment('Координати 3-ї колії (геодані)'), + 'track_fourth_coords' => $this->string()->comment('Координати 4-ї колії (геодані)'), + 'rail_overpass_coords' => $this->string()->comment('Координати залізничного шляхопроводу (геодані)'), + ]); + $this->addCommentOnTable('rail_cross', 'Дані про ділянки перетину із залізничними коліями'); + + // Table 5.79 + $this->createTable('important_object', [ + 'important_object_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'position' => $this->string()->comment('Положення (псевдогеодані)'), + 'location' => $this->text()->comment('Розташування'), + 'important_object_type_id' => $this->integer()->comment('Тип об’єкту (згідно з [4])'), + 'information' => $this->text()->comment('Інформація про об\'єкт'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('important_object', 'Дані про важливі об’єкти дорожньої інфраструктури'); + + // Table 5.80 + $this->createTable('communication_third', [ + 'communication_third_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації (згідно з [4])'), + 'tool_construction'=> $this->integer()->comment('Засоби прокладання (згідно з [4])'), + 'communication_third_card_id' => $this->integer()->comment('Картка споруди (окрема облікова картка; табл. 5.81)'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('communication_third', 'Облікова відомість комунікацій третіх осіб'); + + // Table 5.81 + $this->createTable('communication_third_card', [ + 'communication_third_card_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'begin' => $this->string()->comment('Початок (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець (псевдогеодані)'), + 'communication_type_id' => $this->integer()->comment('Тип комунікації (згідно з [4])'), + 'tool_construction'=> $this->integer()->comment('Засоби прокладання (згідно з [4])'), + 'owner' => $this->text()->comment('Власник комунікації'), + 'coords' => $this->string()->comment('Координати (геодані)'), + ]); + $this->addCommentOnTable('communication_third_card', 'Дані про комунікації третіх осіб'); + + // Table 5.82 + $this->createTable('flow', [ + 'flow_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки дороги зі сталим транспортним потоком (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки дороги зі сталим транспортним потоком (псевдогеодані)'), + 'position' => $this->string()->comment('Положення пункту обліку (псевдогеодані)'), + 'car_intensity' => $this->integer()->comment('Інтенсивність руху легкових автомобілів, в т.ч. з причепами фургонів (ціле число; в автомобілях на добу)'), + 'truck_two_axle_intensity' => $this->integer()->comment('Інтенсивність руху вантажних 2-вісних автомобілів (ціле число; в автомобілях на добу)'), + 'truck_three_axle_intensity' => $this->integer()->comment('Інтенсивність руху вантажних 3-вісних автомобілів (ціле число; в автомобілях на добу)'), + 'truck_four_axle_intensity' => $this->integer()->comment('Інтенсивність руху вантажних 4-вісних автомобілів (ціле число; в автомобілях на добу)'), + 'lorry_trailer_two_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з причепами з колісними формулами 2+1, 2+2 та 2+3 (ціле число; в автомобілях на добу)'), + 'lorry_trailer_three_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з причепами з колісними формулами 3+2 та 3+3 (ціле число; в автомобілях на добу)'), + 'lorry_semitrailer_two_one_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з напівпричепами з колісною формулою 2+1 (ціле число; в автомобілях на добу)'), + 'lorry_semitrailer_two_two_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з напівпричепами з колісною формулою 2+2 (ціле число; в автомобілях на добу)'), + 'lorry_semitrailer_two_three_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з напівпричепами з колісною формулою 2+3 (ціле число; в автомобілях на добу)'), + 'lorry_semitrailer_three_one_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з напівпричепами з колісними формулами 3+1 та 3+2 (ціле число; в автомобілях на добу)'), + 'lorry_semitrailer_three_three_intensity' => $this->integer()->comment('Інтенсивність руху автопоїздів з напівпричепами з колісною формулою 3+3 (ціле число; в автомобілях на добу)'), + 'bus_intensity' => $this->integer()->comment('Інтенсивність руху автобусів (ціле число; в автомобілях на добу)'), + 'trailer_intensity' => $this->integer()->comment('Інтенсивність руху автотрейлерів низькорамних з кількістю осей 7 та більше (ціле число; в автомобілях на добу)'), + 'total_intensity' => $this->integer()->comment('Загальна інтенсивність руху (ціле число; в автомобілях на добу)'), + 'capacity' => $this->integer()->comment('Пропускна здатність (ціле число; в автомобілях на добу)'), + 'stock_coef' => $this->decimal()->comment('Коефіцієнт запасу (з двома цифрами після коми)'), + 'coords' => $this->string()->comment('Координати ділянки із сталим транспортним потоком (геодані)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('flow', 'Дані про транспортні потоки'); + + // Table 5.83 + $this->createTable('speed_limit', [ + 'speed_limit_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки дороги з однаковими умовами руху (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки дороги з однаковими умовами руху (псевдогеодані)'), + 'road_category_id' => $this->integer()->comment('Категорія дороги (згідно з [4])'), + 'forward_speed' => $this->decimal()->comment('Середня швидкість руху транспортного потоку в прямому напрямку (в кілометрах за годину; з двома цифрами після коми)'), + 'back_speed' => $this->decimal()->comment('Середня швидкість руху транспортного потоку в зворотному напрямку (в кілометрах за годину; з двома цифрами після коми)'), + 'forward_coords' => $this->string()->comment('Координати ділянки з однаковими умовами руху в прямому напрямку (геодані)'), + 'back_coords' => $this->string()->comment('Координати ділянки з однаковими умовами руху в зворотному напрямку (геодані)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (згідно з [4])'), + ]); + $this->addCommentOnTable('speed_limit', 'Дані про швидкісні режими руху'); + + // Table 5.84 + $this->createTable('visibility_danger', [ + 'visibility_danger_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки дороги з однаковими умовами руху (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки дороги з однаковими умовами руху (псевдогеодані)'), + 'road_category_id' => $this->integer()->comment('Категорія дороги (згідно з [4])'), + 'visibility_oncoming_standard' => $this->decimal()->comment('Нормативна відстань видимості зустрічного транспортного засобу (у метрах; згідно з 4.6 ДБН В.2.3-4)'), + 'forward_vivibility' => $this->integer()->comment('Фактична просторова видимість зустрічного транспорту в прямому напрямку руху (у метрах)'), + 'back_vivibility' => $this->integer()->comment('Фактична просторова видимість зустрічного транспорту в зворотному напрямку руху (у метрах)'), + 'safe_speed' => $this->decimal()->comment('Величина безпечної швидкості руху (в кілометрах за годину; з двома цифрами після коми)'), + 'conclusion' => $this->text()->comment('Висновок'), + ]); + $this->addCommentOnTable('visibility_danger', 'Дані про ділянки з незабезпеченою просторовою видимістю'); + + // Table 5.85 + $this->createTable('road_accident', [ + 'road_accident_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [4])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [5])'), + 'coords' => $this->string()->comment('Координати місця ДТП (геодані)'), + ]); + $this->addCommentOnTable('road_accident', 'Журнал ДТП'); + + // СОУ 42.1-37641918-063_2016 + // Table А.1 + $this->createTable('road_maintenance_finance_plan', [ + 'road_maintenance_finance_plan_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [3])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [3])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'finance_value' => $this->decimal()->comment('Величина нормативного фінансування (в тисячах гривень; з двома цифрами після коми)'), + 'inflation_coef' => $this->decimal()->comment('Коефіцієнт інфляції (з двома цифрами після коми)'), + 'coords' => $this->string()->comment('Координати (згідно 6.2.2.17 СОУ 42.1-37641918-122)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (табл. Б.104)'), + ]); + $this->addCommentOnTable('road_maintenance_finance_plan', 'Планове фінансування утримання доріг'); + + // Table А.2 + $this->createTable('road_maintenance_finance_fact', [ + 'road_maintenance_finance_fact_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [3])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [3])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'finance_value' => $this->decimal()->comment('Величина нормативного фінансування (в тисячах гривень; з двома цифрами після коми)'), + 'coords' => $this->string()->comment('Координати (згідно 6.2.2.17 СОУ 42.1-37641918-122)'), + 'date_actual' => $this->integer()->comment('Дата актуалізації (табл. Б.104)'), + ]); + $this->addCommentOnTable('road_maintenance_finance_fact', 'Фактичне фінансування утримання доріг'); + + // Table А.3 + $this->createTable('road_maintenance_state', [ + 'road_maintenance_state_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [3])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [3])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'coords' => $this->string()->comment('Координати (згідно 6.2.2.17 СОУ 42.1-37641918-122)'), + 'defect_description' => $this->text()->comment('Опис виявленого недоліку'), + 'date_add' => $this->integer()->comment('Дата створення запису (табл. Б.104)'), + 'user_add_id' => $this->integer()->comment('ЕПІН автора повідомлення про факт недоліку'), + 'photo' => $this->string()->comment('Фотографії (tiff [2])'), + 'video' => $this->string()->comment('Відео файли (avi [2])'), + 'date_remove' => $this->integer()->comment('Дата та час ліквідації виявленого недоліку (табл. Б.104)'), + 'user_remove_id' => $this->integer()->comment('ЕПІН автора повідомлення про факт ліквідації недоліку'), + ]); + $this->addCommentOnTable('road_maintenance_state', 'Протокол стану утримання'); + + // Table А.4 + $this->createTable('critical_situation', [ + 'critical_situation_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [3])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [3])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'coords' => $this->string()->comment('Координати (згідно 6.2.2.17 СОУ 42.1-37641918-122)'), + 'critical_situation_type' => $this->text()->comment('Тип критичної ситуації'), + 'critical_situation_description' => $this->text()->comment('Опис виявленої критичної ситуації'), + 'date_add' => $this->integer()->comment('Дата створення запису (табл. Б.104)'), + 'user_add_id' => $this->integer()->comment('ЕПІН автора повідомлення про факт недоліку'), + 'date_remove' => $this->integer()->comment('Дата та час ліквідації виявленого недоліку (табл. Б.104)'), + 'user_remove_id' => $this->integer()->comment('ЕПІН автора повідомлення про факт ліквідації недоліку'), + ]); + $this->addCommentOnTable('critical_situation', 'Протокол критичної ситуації'); + + // Table А.5 + $this->createTable('repair_work', [ + 'repair_work_id' => $this->primaryKey()->comment('Індекс титулу (згідно з [3])'), + 'road_name' => $this->string()->comment('Назва автомобільної дороги або під\'їзду (обходу, транспортної розв\'язки) в складі титулу (згідно з [3])'), + 'cross_section_number' => $this->integer()->comment('Номер з\'їзду транспортної розв\'язки'), + 'begin' => $this->string()->comment('Початок ділянки (псевдогеодані)'), + 'end' => $this->string()->comment('Кінець ділянки (псевдогеодані)'), + 'coords' => $this->string()->comment('Координати (згідно 6.2.2.17 СОУ 42.1-37641918-122)'), + 'repair_work_type' => $this->text()->comment('Тип ремонтних робіт'), + 'date_begin' => $this->integer()->comment('Дата початку ремонтних робіт (табл. Б.104)'), + 'date_end' => $this->integer()->comment('Дата закінчення ремонтних робіт (табл. Б.104)'), + 'project_material' => $this->string()->comment('Проектні матеріали (tiff [2])'), + 'acceptance_act' => $this->string()->comment('Акт приймання робіт (введення в експлуатацію тощо) (tiff [2])'), + ]); + $this->addCommentOnTable('repair_work', 'Протокол ремонтних робіт'); + + // Table Б.1 + $this->createTable('horizontal_curve_direction', [ + 'horizontal_curve_direction_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('horizontal_curve_direction', 'Напрямок горизонтальної кривої'); + $this->batchInsert('horizontal_curve_direction', [ 'value' ], [ + [ 'праворуч' ], + [ 'ліворуч' ], + ]); + + // Table Б.2 + $this->createTable('movement_direction', [ + 'movement_direction_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('movement_direction', 'Напрямок руху по дорозі'); + $this->batchInsert('movement_direction', [ 'value' ], [ + [ 'в обох' ], + [ 'прямий' ], + [ 'зворотний' ], + ]); + + // Table Б.3 + $this->createTable('position_according_road', [ + 'position_according_road_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('position_according_road', 'Розташування відносно дороги'); + $this->batchInsert('position_according_road', [ 'value' ], [ + [ 'праворуч' ], + [ 'ліворуч' ], + ]); + + // Table Б.4 + $this->createTable('availability', [ + 'availability_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('availability', 'Наявність/відсутність будь-чого'); + $this->batchInsert('availability', [ 'value' ], [ + [ 'так' ], + [ 'ні' ], + ]); + + // Table Б.5 + $this->createTable('road_type', [ + 'road_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('road_type', 'Індекс автомобільної дороги (стаття 8, Закон України "Про автомобільні дороги")'); + $this->batchInsert('road_type', [ 'value' ], [ + [ 'М (міжнародна)' ], + [ 'Н (національна)' ], + [ 'Р (регіональна)' ], + [ 'Т (територіальна)' ], + [ 'О (обласна)' ], + [ 'С (районна)' ], + ]); + + // Table Б.6 + $this->createTable('road_category', [ + 'road_category_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('road_category', 'Категорія автомобільної дороги (ДБН В.2.3-4, табл. 4.1)'); + $this->batchInsert('road_category', [ 'value' ], [ + [ 'І-а' ], + [ 'І-б' ], + [ 'ІІ' ], + [ 'ІІІ' ], + [ 'IV' ], + [ 'V' ], + ]); + + // Table Б.7 + $this->createTable('state_production', [ + 'state_production_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('state_production', 'Стан виробничого об’єкту, машини або механізму'); + $this->batchInsert('state_production', [ 'value' ], [ + [ 'непрацездатний (під списання)' ], + [ 'непрацездатний (ведуться ремонтні роботи)' ], + [ 'непрацездатний (законсервований)' ], + [ 'працездатний, в стані очікування' ], + [ 'працездатний (ведеться виробництво)' ], + ]); + + // Table Б.8 + $this->createTable('bitumen_storage_type', [ + 'bitumen_storage_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('bitumen_storage_type', 'Тип бітумосховища ([4, розділ 8])'); + $this->batchInsert('bitumen_storage_type', [ 'value' ], [ + [ 'бітумосховище тимчасового типу' ], + [ 'бітумосховище стаціонарного типу' ], + [ 'підземне бітумосховище' ], + [ 'напівпідземне бітумосховище' ], + [ 'наземне бітумосховище' ], + [ 'бітумосховище з місцевим нагріванням' ], + [ 'бітумосховище із загальним нагріванням' ], + ]); + + // Table Б.9 + $this->createTable('state', [ + 'state_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('state', 'Стан об’єкту'); + $this->batchInsert('state', [ 'value' ], [ + [ 'працездатний' ], + [ 'непрацездатний' ], + ]); + + // Table Б.10 + $this->createTable('storage_type', [ + 'storage_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('storage_type', 'Тип складу'); + $this->batchInsert('storage_type', [ 'value' ], [ + [ 'відкритий' ], + [ 'закритий' ], + ]); + + // Table Б.11 + $this->createTable('vehicle_type', [ + 'vehicle_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + 'note' => $this->text()->comment('Примітки'), + ]); + $this->addCommentOnTable('vehicle_type', 'Тип машини (механізму)'); + $this->batchInsert('vehicle_type', [ 'value', 'note' ], [ + [ 'автобус', '[5]' ], + [ 'автогудронатор', '' ], + [ 'асфальтоукладач', '' ], + [ 'бульдозер', '' ], + [ 'вантажний автомобіль', '[5]' ], + [ 'грейдер', '' ], + [ 'грейдер-елеватор', '' ], + [ 'екскаватор на гусеничному ходу', '' ], + [ 'екскаватор на колісному ходу', '' ], + [ 'кран підйомний на гусеничному ходу', '' ], + [ 'кран підйомний на колісному ходу', '' ], + [ 'навантажувач', '' ], + [ 'машина дорожня комбінована', '' ], + [ 'машина піскорозкидальна', '' ], + [ 'машина снігоочисна роторна', '' ], + [ 'причіп', '[5]' ], + [ 'скрепер', '' ], + [ 'трактор на гусеничному ходу', '' ], + [ 'трактор на колісному ходу', '' ], + [ 'фреза дорожня', '' ], + ]); + + // Table Б.12 + $this->createTable('obstacle_up', [ + 'obstacle_up_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + 'note' => $this->text()->comment('Примітки'), + ]); + $this->addCommentOnTable('obstacle_up', 'Назва перешкоди обмеження габариту по висоті'); + $this->batchInsert('obstacle_up', [ 'value', 'note' ], [ + [ 'портал тунелю', '[6]' ], + [ 'міст', '[ДБН В.2.3-22]' ], + [ 'надземний пішохідний перехід', '[7]' ], + [ 'підвісна канатна дорога', '[8]' ], + [ 'проїзна арка', '' ], + [ 'дорожній знак на тросі-розтяжці', '[9]' ], + [ 'портал-ферма', '[10]' ], + [ 'трубопровід', '[11]' ], + [ 'лінія зв\'язку повітряна', '[12]' ], + [ 'ЛЕП повітряна 0,4 кВ', '[12]' ], + [ 'ЛЕП повітряна 10 кВ', '[12]' ], + [ 'ЛЕП повітряна 25 кВ', '[12]' ], + [ 'ЛЕП повітряна 35 кВ', '[12]' ], + [ 'ЛЕП повітряна 110 кВ', '[12]' ], + [ 'ЛЕП повітряна 150 кВ', '[12]' ], + [ 'ЛЕП повітряна 330 кВ', '[12]' ], + ]); + + // Table Б.13 + $this->createTable('land_soil', [ + 'land_soil_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('land_soil', 'Ґрунт земляного полотна (6.2 ДБН В.2.3-4)'); + $this->batchInsert('land_soil', [ 'value' ], [ + [ 'глина' ], + [ 'глина жирна' ], + [ 'глина піщаниста' ], + [ 'глина пилувата' ], + [ 'глина напівжирна' ], + [ 'глинистий сланець' ], + [ 'гравій' ], + [ 'ґрунт галечниковий' ], + [ 'ґрунт галечниковий із суглинистим заповнювачем' ], + [ 'ґрунт гравійний із суглинистим заповнювачем' ], + [ 'ґрунт з жорствою' ], + [ 'ґрунт щебенистий із суглинистим заповнювачем' ], + [ 'каштанові землі вологі' ], + [ 'каштанові землі змішані' ], + [ 'лес вологий' ], + [ 'лес затверділий' ], + [ 'лес злежаний' ], + [ 'лес рихлий' ], + [ 'мергель' ], + [ 'пісок крупний' ], + [ 'пісок дрібний' ], + [ 'пісок пилуватий' ], + [ 'сланець глинистий' ], + [ 'солончак' ], + [ 'суглинок' ], + [ 'суглинок важкий' ], + [ 'суглинок важкий з галькою' ], + [ 'суглинок легкий' ], + [ 'суглинок легкий пилуватий' ], + [ 'суглинок супіщаний' ], + [ 'суглинок щебенистий' ], + [ 'супісок' ], + [ 'супісок важкий пилуватий' ], + [ 'супісок легкий крупний' ], + [ 'супісок пилуватий' ], + [ 'торф' ], + [ 'піщаник' ], + [ 'піщаник вивітрілий' ], + [ 'вапняк' ], + [ 'вапняк вивітрілий' ], + [ 'жорства' ], + ]); + + // Table Б.14 + $this->createTable('state_common', [ + 'state_common_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('state_common', 'Стан простого об’єкту'); + $this->batchInsert('state_common', [ 'value' ], [ + [ 'добрий' ], + [ 'задовільний' ], + [ 'незадовільний' ], + [ 'непрацездатний' ], + [ 'аварійний' ], + ]); + + // Table Б.15 + $this->createTable('ventilation_type', [ + 'ventilation_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('ventilation_type', 'Тип вентиляції тунелів та підземних пішохідних переходів'); + $this->batchInsert('ventilation_type', [ 'value' ], [ + [ 'примусова' ], + [ 'природня' ], + ]); + + // Table Б.16 + $this->createTable('light_type', [ + 'light_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('light_type', 'Тип освітлення тунелів та підземних пішохідних переходів'); + $this->batchInsert('light_type', [ 'value' ], [ + [ 'штучне' ], + [ 'природне' ], + ]); + + // Table Б.17 + $this->createTable('antiseismic_type', [ + 'antiseismic_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('antiseismic_type', 'Тип антисейсмічних пристроїв (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('antiseismic_type', [ 'value' ], [ + [ 'відсутній' ], + [ 'комбінації повздовжніх і поперечних обмежувачів' ], + [ 'комбіноване використання спеціальних опорних частин з обмежувачами переміщень' ], + [ 'обмежувачі повздовжніх переміщень прогонових будов' ], + [ 'обмежувачі поперечних переміщень прогонових будов на опорах' ], + [ 'спеціальні антисейсмічні опорні частини' ], + ]); + + // Table Б.18 + $this->createTable('communication_type', [ + 'communication_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('communication_type', 'Тип комунікації, що перепускаються штучною спорудою'); + $this->batchInsert('communication_type', [ 'value' ], [ + [ 'відсутня' ], + [ 'водогін' ], + [ 'кабель електричний' ], + [ 'кабель зв’язку' ], + ]); + + // Table Б.19 + $this->createTable('header_purpose', [ + 'header_purpose_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('header_purpose', 'Призначення оголовка (портала)'); + $this->batchInsert('header_purpose', [ 'value' ], [ + [ 'вхідний' ], + [ 'вихідний' ], + ]); + + // Table Б.20 + $this->createTable('header_type', [ + 'header_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('header_type', 'Тип оголовка (портала) (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('header_type', [ 'value' ], [ + [ 'портальний' ], + [ 'розтрубний' ], + [ 'комірцевий' ], + [ 'коридорний прямий' ], + [ 'коридорний з сходовими клітинами' ], + ]); + + // Table Б.21 + $this->createTable('body_material', [ + 'body_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('body_material', 'Матеріали тіла штучних споруд (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('body_material', [ 'value' ], [ + [ 'бетон' ], + [ 'бетон і бутобетон' ], + [ 'бетон і залізобетон' ], + [ 'бетон і кам`яна кладка' ], + [ 'бутобетон' ], + [ 'бутобетон, бетон,залізобетон' ], + [ 'гофрований метал' ], + [ 'деревина' ], + [ 'залізобетон' ], + [ 'кам`яна (цегляна) кладка і залізобетон' ], + [ 'кам`яна кладка' ], + [ 'метал' ], + [ 'металеві тюбінги' ], + [ 'попередньонапружений залізобетон' ], + [ 'сталезалізобетон' ], + [ 'цегляна кладка' ], + ]); + + // Table Б.22 + $this->createTable('foundation_material', [ + 'foundation_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('foundation_material', 'Матеріали тіла штучних споруд (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('foundation_material', [ 'value' ], [ + [ 'бетон' ], + [ 'бетон і бутобетон' ], + [ 'бетон і залізобетон' ], + [ 'бетон і кам`яна кладка' ], + [ 'бутобетон' ], + [ 'бутобетон, бетон,залізобетон' ], + [ 'гофрований метал' ], + [ 'деревина' ], + [ 'залізобетон' ], + [ 'кам`яна (цегляна) кладка і залізобетон' ], + [ 'кам`яна кладка' ], + [ 'метал' ], + [ 'попередньонапружений залізобетон' ], + [ 'сталезалізобетон' ], + [ 'цегляна кладка' ], + ]); + + // Table Б.23 + $this->createTable('basement_material', [ + 'basement_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('basement_material', 'Матеріали основи під фундамент (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('basement_material', [ 'value' ], [ + [ 'піщано-гравійна суміш' ], + [ 'пісок' ], + [ 'щебінь' ], + ]); + + // Table Б.24 + $this->createTable('fortified_slope_material', [ + 'fortified_slope_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('fortified_slope_material', 'Матеріали укріплення укосів земляного полотна на штучних спорудах (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('fortified_slope_material', [ 'value' ], [ + [ 'без укріплення' ], + [ 'бетон' ], + [ 'бетонна обрешітка із засипкою щебенем' ], + [ 'бутобетон' ], + [ 'габіони' ], + [ 'залізобетонна решітка, монолітний бетон' ], + [ 'залізобетонні плити' ], + [ 'збірні бетонні блоки' ], + [ 'кам`яний накид' ], + [ 'матрац Рено' ], + [ 'монолітний бетон' ], + [ 'підпірна стінка' ], + [ 'посів трав' ], + ]); + + // Table Б.25 + $this->createTable('body_type', [ + 'body_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('body_type', 'Типи форми тіла штучних споруд (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('body_type', [ 'value' ], [ + [ 'арочна' ], + [ 'закритий лоток овоідального типу' ], + [ 'закритий лоток трапецевидного типу' ], + [ 'кругла' ], + [ 'овальна' ], + [ 'прямокутна' ], + [ 'склепінчаста' ], + ]); + + // Table Б.26 + $this->createTable('span_scheme', [ + 'span_scheme_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('span_scheme', 'Статичні схеми прогонових будов (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('span_scheme', [ 'value' ], [ + [ 'арочна' ], + [ 'балочна консольна з підвісками' ], + [ 'балочна нерозрізна' ], + [ 'балочна однопрогонова з подвійною консольною балкою' ], + [ 'балочна розрізна' ], + [ 'балочно-консольна' ], + [ 'вантова' ], + [ 'висяча' ], + [ 'комбінована' ], + [ 'консольно-підвісна' ], + [ 'рамна' ], + [ 'рамно-консольна' ], + ]); + + // Table Б.27 + $this->createTable('span_type', [ + 'span_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('span_type', 'Типи конструкцій прогонових будов (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('span_type', [ 'value' ], [ + [ 'арочна зовнішньо безрозпірна з проїздом по низу двотаврового перерізу' ], + [ 'арочна зовнішньо безрозпірна з проїздом посередині двотаврогого перерізу' ], + [ 'арочна зовнішньо безрозпірна з проїздом посередині коробчатого перерізу' ], + [ 'арочна зовнішньо безрозпірна з проїздом посередині прямокутного перерізу' ], + [ 'арочна зовнішньо розпірна з проїздом посередині коробчатого перерізу' ], + [ 'арочна зовнішньо розпірна з проїздом по верху двутаврового перерізу' ], + [ 'арочна зовнішньо розпірна з проїздом по верху прямокутного перерізу' ], + [ 'арочна зовнішньо розпірна з проїздом по верху у вигляді спарених двотаврів' ], + [ 'арочна зовнішньо розпірна з проїздом посередині прямокутного перерізу' ], + [ 'арочна комбінована консольна' ], + [ 'арочна комбінована нерозрізна' ], + [ 'арочна комбінована посилена балкою жорсткості' ], + [ 'арочна комбінована посилена ланцюгом' ], + [ 'арочна система із затяжкою в комбінації з консольними балками' ], + [ 'арочна трьохшарнірна' ], + [ 'висяча вантова ферма гнучка променева система' ], + [ 'висяча вантова ферма гнучка система Жискляра' ], + [ 'висяча вантова ферма гнучка система Рабіновича' ], + [ 'висяча вантова ферма гнучка система Росновського' ], + [ 'висяча вантова ферма жорстка з паралельними поясами' ], + [ 'висяча вантова ферма жорстка з серповидним обрисом' ], + [ 'висяча вантова ферма комбінована з наскрізною балкою жорсткості з паралельними поясами' ], + [ 'висяча вантова ферма комбінована з наскрізною балкою жорсткості змінної висоти' ], + [ 'висяча вантова ферма комбінована з суцільної балкою жорсткості коробчастого перерізу з приопорним потовщенням' ], + [ 'висяча вантова ферма комбінована з суцільної балкою жорсткості коробчатого перерізу з паралельними поясами' ], + [ 'висяча вантова ферма комбінована з суцільної балкою жорсткості таврового перерізу з паралельними поясами' ], + [ 'висяча гнучка кабельна' ], + [ 'висяча гнучка комбінована з поздовжньою балкою в рівні проїзної частини' ], + [ 'висяча гнучка комбінована з поздовжньою фермою в рівні проїзної частини (перилами)' ], + [ 'висяча гнучка ланцюгова' ], + [ 'дерев\'яна двохпідкосна' ], + [ 'дерев\'яна з двохярусними прогонами' ], + [ 'дерев\'яна з одноярусними прогонами з проїздом на баласті' ], + [ 'дерев\'яна з одноярусними прогонами з проїздом по поперечинах' ], + [ 'дерев\'яна однопідкосна' ], + [ 'дерев\'яна пакетна з гнучкими шпонками' ], + [ 'дерев\'яна пакетна на дубових шпонках' ], + [ 'дерев\'яна ферма Гау-Журавського' ], + [ 'дерев\'яна ферма дощата' ], + [ 'дерев\'яна ферма хрестова' ], + [ 'жорстка рамна' ], + [ 'збірна ребриста бездіафрагмова з таврових балок з каркасною арматури, випуск 56доп' ], + [ 'збірна ребриста з пучкової арматури випуск 122-62' ], + [ 'збірна ребриста з Т-подібних балок з каркасною арматурою вип.56' ], + [ 'збірна ребриста струнобетонна ВТП-15' ], + [ 'збірна ребриста струнобетонна ВТП-16' ], + [ 'збірна ребриста струнобетонна типовий проект 149-62 Союздорпроект' ], + [ 'коробчаста багатоконтурна з вигнутою формою зовнішніх стінок' ], + [ 'коробчаста багатоконтурна з опуклою формою нижньої плити' ], + [ 'коробчаста багатоконтурна з похилими гранями' ], + [ 'коробчаста з криволінійними стінками' ], + [ 'коробчаста одно-контурна з вигнутою формою зовнішніх стінок' ], + [ 'коробчаста одно-контурна з опуклою формою нижньої плити' ], + [ 'коробчаста одно-контурна з похилими гранями' ], + [ 'одностоякова рама' ], + [ 'плитна з поздовжніми пустотами круглої форми' ], + [ 'плитна з поздовжніми пустотами прямокутної форми' ], + [ 'плитна з поздовжніми пустотами циліндричної форми' ], + [ 'плитна з поперечними пустотами' ], + [ 'плитна збірна двохпустотна з напруженою арматурою, сб. ВТП-21' ], + [ 'плитна збірна з прогонових плит, ВТП-16' ], + [ 'плитна збірна струнобетонна з плит суцільного перерізу' ], + [ 'плитна змінної висоти в поздовжньому перерізі' ], + [ 'плитна змінної висоти в поперечному перерізі' ], + [ 'плитна змінної висоти в поперечному та поздовжньому перерізах' ], + [ 'плитна суцільного перерізу' ], + [ 'плитна типова збірна Белгіпродор випуск 5-04-145' ], + [ 'плитно-ребриста з діафрагмами з ребрами таврового перерізу' ], + [ 'плитно-ребриста конструкція' ], + [ 'рама V-образного типу з окремими нахиленими стоянами' ], + [ 'рама V-образного типу на кінцях сполучені шарніром' ], + [ 'рама з двома шарнірними нахиленими стоянами' ], + [ 'рама з нахиленими стоянами' ], + [ 'рама з шарнірними одиночними нахиленими стоянами' ], + [ 'рами з жорстким закріпленням' ], + [ 'рами з шарнірним закріпленням' ], + [ 'ребриста бездіафрагмова з ребрами V-подібного перерізу' ], + [ 'ребриста бездіафрагмова з ребрами двотаврового перерізу' ], + [ 'ребриста бездіафрагмова з ребрами П-подібного перерізу' ], + [ 'ребриста бездіафрагмова з ребрами таврового перерізу' ], + [ 'ребриста бездіафрагмова криволінійного обрису (змінної висоти в приопорних зонах)' ], + [ 'ребриста з діафрагмами з ребрами двотаврового перерізу з ломаним обрисом поясів' ], + [ 'ребриста з діафрагмами з ребрами двотаврого перерізу з паралельними поясами' ], + [ 'ребриста з діафрагмами з ребрами П-подібного перерізу' ], + [ 'ребриста з діафрагмами з ребрами таврового перерізу' ], + [ 'ребриста з діафрагмами з ребрами таврового перерізу з криволійним обрисом поясів' ], + [ 'ребриста з діафрагмами криволінійного обрису (змінної висоти в приопорних зонах)' ], + [ 'ребриста із збірних уніфікованих попередньо-напружених балок' ], + [ 'склепіння несиметричне' ], + [ 'склепіння симетричне' ], + [ 'Т-подібна рамна з омоноліченими кінцями консоль між собою' ], + [ 'Т-подібна рамна шарнірно сполучена у середині прогонів' ], + [ 'ферма з проїздом по низу з полігональними поясами з трикутними решітками із шпренгелями' ], + [ 'ферма з проїздом по верху з паралельними поясами багаторешітчата' ], + [ 'ферма з проїздом по верху з паралельними поясами двохрешітчата' ], + [ 'ферма з проїздом по верху з паралельними поясами з трикутними решітками' ], + [ 'ферма з проїздом по верху з полігональними поясами з трикутними решітками' ], + [ 'ферма з проїздом по низу з паралельними поясами з трикутними решітками із шпренгелями' ], + [ 'ферма з проїздом по низу з полігональними поясами двохрешітчата' ], + [ 'ферма арочна з горизонтальним верхнім поясом з проїздом по верху' ], + [ 'ферма з проїздом по верху арочна з паралельними поясами із розкосою решіткою' ], + [ 'ферма з проїздом по верху арочна з паралельними поясами із трикутною решіткою' ], + [ 'ферма з проїздом по верху арочна серповидного обрису' ], + [ 'ферма з проїздом по верху з паралельними поясами багаторозкісна' ], + [ 'ферма з проїздом по верху з паралельними поясами з напіврозкісними решітками' ], + [ 'ферма з проїздом по верху з паралельними поясами з розкісними решітками' ], + [ 'ферма з проїздом по верху з паралельними поясами з ромбоподібними решітками' ], + [ 'ферма з проїздом по верху з паралельними поясами з трикутними решітками із шпренгелями' ], + [ 'ферма з проїздом по верху з паралельними поясами з хрестовими решітками' ], + [ 'ферма з проїздом по верху з паралельними поясами системи Скугорева' ], + [ 'ферма з проїздом по верху з полігональними поясами двохрешітчата' ], + [ 'ферма з проїздом по верху з полігональними поясами з напіврозкісними решітками' ], + [ 'ферма з проїздом по верху з полігональними поясами з розкісними решітками' ], + [ 'ферма з проїздом по верху з полігональними поясами з трикутними решітками із шпренгелями' ], + [ 'ферма з проїздом по верху з полігональними поясами з хрестовими решітками' ], + [ 'ферма з проїздом по низу арочна зі збільшеною висотою у опор' ], + [ 'ферма з проїздом по низу арочна зі збільшеною висотою у чвертях прольоту' ], + [ 'ферма з проїздом по низу арочна портальна з розкосою решіткою' ], + [ 'ферма з проїздом по низу арочна портальна з трикутною решіткою' ], + [ 'ферма з проїздом по низу з паралельними поясами багаторозкісна' ], + [ 'ферма з проїздом по низу з паралельними поясами двохрешітчата' ], + [ 'ферма з проїздом по низу з паралельними поясами з багаторешітчата' ], + [ 'ферма з проїздом по низу з паралельними поясами з напіврозкісними решітками' ], + [ 'ферма з проїздом по низу з паралельними поясами з розкісними решітками' ], + [ 'ферма з проїздом по низу з паралельними поясами з трикутними решітками' ], + [ 'ферма з проїздом по низу з паралельними поясами з хрестовими решітками' ], + [ 'ферма з проїздом по низу з полігональними поясами багаторозкісна' ], + [ 'ферма з проїздом по низу з полігональними поясами з напіврозкісними решітками' ], + [ 'ферма з проїздом по низу з полігональними поясами з розкісними решітками' ], + [ 'ферма з проїздом по низу з полігональними поясами з трикутними решітками' ], + [ 'ферма з проїздом по низу з полігональними поясами з хрестовими решітками' ], + [ 'ферма з проїздом по низу серповидного обрису з суцільною стінкою' ], + [ 'ферма з проїздом посередині серповидного обрису' ], + [ 'ферма з паралельними поясами з ромбоподібними решітками з проїздом по низу' ], + ]); + + // Table Б.28 + $this->createTable('load_project', [ + 'load_project_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('load_project', 'Проектне навантаження (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('load_project', [ 'value' ], [ + [ 'А11, НК80' ], + [ 'А14, НК80' ], + [ 'А15, НК100' ], + [ 'А15, НК80' ], + [ 'Н8, НГ30' ], + [ 'Н8, НГ60' ], + [ 'Н10, НГ60' ], + [ 'H13, НГ30' ], + [ 'Н13, НГ60' ], + [ 'Н18, НК80' ], + [ 'Н30, НК80' ], + [ 'С10' ], + [ 'С14' ], + [ 'від пішоходів 400 кг/м 2' ], + [ 'від потоку води' ], + ]); + + // Table Б.29 + $this->createTable('bearing_moving_type', [ + 'bearing_moving_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('bearing_moving_type', 'Типи рухомих опорних частин (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('bearing_moving_type', [ 'value' ], [ + [ 'валкова' ], + [ 'комбінована' ], + [ 'листова з металу' ], + [ 'плоска' ], + [ 'поліуретанова' ], + [ 'гумова' ], + [ 'руберойдова' ], + [ 'тангенціальна' ], + [ 'гумово-металева' ], + [ 'секторна' ], + ]); + + // Table Б.30 + $this->createTable('bearing_not_moving_type', [ + 'bearing_not_moving_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('bearing_not_moving_type', 'Типи нерухомих опорних частин (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('bearing_not_moving_type', [ 'value' ], [ + [ 'комбінована' ], + [ 'листова з металу' ], + [ 'плоска' ], + [ 'поліуретанова' ], + [ 'гумова' ], + [ 'руберойдова' ], + [ 'тангенціальна' ], + [ 'гумово-металева' ], + ]); + + // Table Б.31 + $this->createTable('cross_joint_type', [ + 'cross_joint_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('cross_joint_type', 'Спосіб поперечного об\'єднання прогонових будов (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('cross_joint_type', [ 'value' ], [ + [ 'шпонковий' ], + ]); + + // Table Б.32 + $this->createTable('pillar_type', [ + 'pillar_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('pillar_type', 'Типи конструкцій опор (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('pillar_type', [ 'value' ], [ + [ 'А-подібний пілон' ], + [ 'Н-подібний пілон' ], + [ 'берегова обсипна стійкова дворядна' ], + [ 'берегова аркова масивна опора' ], + [ 'берегова лежнева кутового профілю на гравійній подушці' ], + [ 'берегова лежнева кутового профілю на щебеневій подушці' ], + [ 'берегова лежнева плоска на гравійній подушці' ], + [ 'берегова лежнева плоска на піщаній подушці' ], + [ 'берегова лежнева плоска на щебеневій подушці' ], + [ 'берегова лежнева кутового профілю на піщаній подушці' ], + [ 'берегова масивна з боковими відкрилками' ], + [ 'берегова масивна з оберненими стінками' ], + [ 'берегова масивна ребриста' ], + [ 'берегова масивна обсипна з боковими відкрилками' ], + [ 'берегова масивна обсипна з прорізом' ], + [ 'берегова масивна обсипна монолітна' ], + [ 'берегова масивна обсипна монолітна полегшена' ], + [ 'берегова масивна обсипна монолітна полегшена з боковими відкрилками' ], + [ 'берегова масивна обсипна пальова-стовпчаста' ], + [ 'берегова масивна обсипна стовпчаста' ], + [ 'берегова масивна обсипна стоякова' ], + [ 'берегова масивна опора-стінка' ], + [ 'берегова масивна стовпчаста обсипна козлового типу' ], + [ 'берегова масивна тонка стінка' ], + [ 'берегова обсипна арочна опора' ], + [ 'берегова обсипна арочна опора коробчастого типу' ], + [ 'берегова обсипна пальова дворядна' ], + [ 'берегова обсипна пальова козлового типу' ], + [ 'берегова обсипна пальова однорядна' ], + [ 'берегова опора з боковим прорізом' ], + [ 'берегова опора коробчастого типу' ], + [ 'берегова пальова двохрядна' ], + [ 'берегова пальова двохрядна із забірною стінкою' ], + [ 'берегова пальова однорядна із забірною стінкою' ], + [ 'берегова полегшена опора-стінка (сист. Cловінського)' ], + [ 'берегова стовпчаста V- подібна' ], + [ 'дерев\'яна M-подібна' ], + [ 'дерев\'яна баштова' ], + [ 'дерев\'яна з похилими палями' ], + [ 'дерев\'яна з укосинами' ], + [ 'дерев\'яна із двох напівбиків' ], + [ 'дерев\'яна із двох напівбиків з похилими стояками' ], + [ 'дерев\'яна із двох напівбиків з укосинами' ], + [ 'дерев\'яна лежнева на гравійній подушці' ], + [ 'дерев\'яна лежнева на піщаній подушці' ], + [ 'дерев\'яна лежнева на щебеневій подушці' ], + [ 'дерев\'яна пальова' ], + [ 'дерев\'яна рамно-лежнева' ], + [ 'дерев\'яна рамнопальова' ], + [ 'дерев\'яна ряжева' ], + [ 'дерев\'яний рамно-пальовий бик' ], + [ 'опора рамно-нерозрізної системи' ], + [ 'проміжна одностовпчаста прямокутного перерізу' ], + [ 'проміжна пальова стійкова однорядна' ], + [ 'проміжна "масивний бик"' ], + [ 'проміжна двостійкова' ], + [ 'проміжна двостійкова з рамною надбудовою' ], + [ 'проміжна двостійкова із паль-оболонок' ], + [ 'проміжна двостовпчаста' ], + [ 'проміжна двостовпчаста телескопічна' ], + [ 'проміжна з пальових-стовпів' ], + [ 'проміжна масивна "двохярусний бик"' ], + [ 'проміжна масивна арочна' ], + [ 'проміжна масивна двостовпчаста' ], + [ 'проміжна масивна із вертикальних паль-оболонок' ], + [ 'проміжна масивна із похилих паль-оболонок' ], + [ 'проміжна масивна несиметрична арочна опора' ], + [ 'проміжна масивна опора-стінка' ], + [ 'проміжна масивна полегшена опора' ], + [ 'проміжна масивна полегшений бик з консолями' ], + [ 'проміжна масивна стоякова козлова' ], + [ 'проміжна масивна телескопічна' ], + [ 'проміжна монолітна рамна з вертикальними стійками' ], + [ 'проміжна монолітна рамна з похилими стійками' ], + [ 'проміжна одностовпчаста' ], + [ 'проміжна опора консольно-підвісної системи' ], + [ 'проміжна опора, що хитається' ], + [ 'проміжна опора-стінка' ], + [ 'проміжна пальова двохрядна' ], + [ 'проміжна пальова двохрядна з насадками' ], + [ 'проміжна пальова двохрядна із захисною обробкою' ], + [ 'проміжна пальова однорядна' ], + [ 'проміжна пальова однорядна з насадками' ], + [ 'проміжна пальова однорядна із захисною обробкою' ], + [ 'проміжна пальова однорядна об\'єднана монолітним бетоном із захисними з/б плитами' ], + [ 'проміжна пальова стійкова двохрядна' ], + [ 'проміжна пальова стійкова однорядна' ], + [ 'проміжна полегшена арочна опора' ], + [ 'проміжна стійкова металева зі стійками двотаврового перерізу' ], + [ 'проміжна стійкова металева зі стійками коробчастого перерізу' ], + [ 'проміжна стовпчаста' ], + [ 'проміжна стовпчаста V-подібна' ], + [ 'проміжна стовпчаста на опускних колодязях' ], + [ 'проміжна стовпчаста телескопічна' ], + [ 'проміжна трьохстовпчата з двохконсольним ригелем' ], + [ 'проміжна чотирьохстоякова рамна опора' ], + ]); + + // Table Б.33 + $this->createTable('pillar_body_material', [ + 'pillar_body_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('pillar_body_material', 'Матеріали тіла опор (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('pillar_body_material', [ 'value' ], [ + [ 'збірний залізобетон' ], + [ 'монолітний залізобетон' ], + [ 'металева оболонка з заповненням монолітним бетоном' ], + [ 'бутобетон' ], + [ 'кам\'яна кладка' ], + [ 'деревина (кругляк)' ], + [ 'деревина (клеєна)' ], + [ 'різнорідний' ], + ]); + + // Table Б.34 + $this->createTable('pillar_foundation_type', [ + 'pillar_foundation_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('pillar_foundation_type', 'Типи фундаментів опор (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('pillar_foundation_type', [ 'value' ], [ + [ 'мілкого закладання на природній основі' ], + [ 'мілкого закладання на штучній основі' ], + [ 'масивний глибокого закладання на природній основі' ], + [ 'масивний глибокого закладання на штучній основі' ], + [ 'стовпчастий вертикальний з повним заповненням' ], + [ 'стовпчастий вертикальний з заповненням у вигляді потовщення стін/низький' ], + [ 'стовпчастий вертикальний з заповненням у вигляді бетонних пробок' ], + [ 'стовпчастий вертикальний з заповненням у вигляді діафрагм' ], + [ 'стовпчастий вертикальний з ґрунтовим ядром' ], + [ 'стовпчастий похилий з повним заповненням' ], + [ 'стовпчастий похилий з заповненням у вигляді потовщення стін' ], + [ 'стовпчастий похилий з заповненням у вигляді бетонних пробок' ], + [ 'стовпчастий похилий з заповненням у вигляді діафрагм' ], + [ 'стовпчастий похилий з ґрунтовим ядром' ], + [ 'пальовий з низьким ростверком однорядний на забивних палях' ], + [ 'пальовий однорядний з низьким ростверком на пустотілих палях' ], + [ 'пальовий однорядний з низьким ростверком на гвинтових палях суцільного перерізу' ], + [ 'пальовий однорядний з низьким ростверком на гвинтових палях прямокутного перерізу' ], + [ 'пальовий однорядний з низьким ростверком на гвинтових палях круглого перерізу' ], + [ 'пальовий однорядний з низьким ростверком на дрібно гвинтових палях' ], + [ 'пальовий однорядний з низьким ростверком на палях змішаного типу' ], + [ 'пальовий однорядний з низьким ростверком на набивних палях з рифленою поверхнею' ], + [ 'пальовий однорядний з низьким ростверком на набивних палях з п`ятою розширення нижнього кінця палі' ], + [ 'пальовий однорядний з низьким ростверком на палях виделково-кореневої форми' ], + [ 'пальовий однорядний з низьким ростверком на палях багато виделкової кореневої форми' ], + [ 'пальовий однорядний з низьким ростверком на палях фігурної форми з розширенням в середній частині' ], + [ 'пальовий однорядний з низьким ростверком на палях фігурної форми з розширенням в різних місцях по висоті палі' ], + [ 'пальовий однорядний з низьким ростверком на бурових палях-стовпах' ], + [ 'пальовий однорядний з низьким ростверком на буро набивних суцільного перерізу' ], + [ 'пальовий однорядний з низьким ростверком на бурових палях' ], + [ 'пальовий однорядний з низьким ростверком на буро набивних суцільного перерізу з розширеннями' ], + [ 'пальовий однорядний з низьким ростверком на буро опускних палях з камуфлетною п`ятою' ], + [ 'пальовий однорядний з низьким ростверком на буро набивних порожнистих круглих палях' ], + [ 'пальовий однорядний з низьким ростверком на буро набивних камуфлетних палях' ], + [ 'пальовий однорядний з низьким ростверком на буро набивних з ущільненим вибоєм' ], + [ 'пальовий однорядний з низьким ростверком на буро ін’єкційних палях' ], + [ 'вертикальний опускний колодязь' ], + [ 'похилий опускний колодязь' ], + [ 'східчастий опускний колодязь' ], + [ 'кесон' ], + [ 'пальовий багаторядний з низьким ростверком на пустотілих палях' ], + [ 'пальовий багаторядний з низьким ростверком на гвинтових палях суцільного перерізу' ], + [ 'пальовий однорядний з високим ростверком на гвинтових палях суцільного перерізу' ], + [ 'пальовий багаторядний з високим ростверком на гвинтових палях суцільного перерізу' ], + [ 'пальовий з високим ростверком однорядний на забивних палях' ], + [ 'пальовий з низьким ростверком багаторядний на забивних палях' ], + [ 'пальовий з високим ростверком багаторядний на забивних палях' ], + [ 'пальовий багаторядний з низьким ростверком на гвинтових палях круглого перерізу' ], + [ 'пальовий однорядний з високим ростверком на гвинтових палях круглого перерізу' ], + [ 'пальовий багаторядний з високим ростверком на гвинтових палях круглого перерізу' ], + [ 'пальовий багаторядний з низьким ростверком на гвинтових палях прямокутного перерізу' ], + [ 'пальовий однорядний з високим ростверком на гвинтових палях прямокутного перерізу' ], + [ 'пальовий багаторядний з високим ростверком на гвинтових палях прямокутного перерізу' ], + [ 'пальовий багаторядний з низьким ростверком на дрібно гвинтових палях' ], + [ 'пальовий однорядний з високим ростверком на дрібно гвинтових палях' ], + [ 'пальовий багаторядний з високим ростверком на дрібно гвинтових палях' ], + [ 'пальовий багаторядний з низьким ростверком на палях змішаного типу' ], + [ 'пальовий однорядний з високим ростверком на палях змішаного типу' ], + [ 'пальовий багаторядний з високим ростверком на палях змішаного типу' ], + [ 'пальовий однорядний' ], + [ 'пальовий багаторядний' ], + ]); + + // Table Б.35 + $this->createTable('icebreaker_type', [ + 'icebreaker_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('icebreaker_type', 'Тип льодорізів (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('icebreaker_type', [ 'value' ], [ + [ 'аванпостний' ], + [ 'передопорний' ], + ]); + + // Table Б.36 + $this->createTable('icebreaker_material', [ + 'icebreaker_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('icebreaker_material', 'Матеріал льодорізів (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('icebreaker_material', [ 'value' ], [ + [ 'збірний залізобетон' ], + [ 'монолітний залізобетон' ], + [ 'сталебетон' ], + [ 'кам\'яна кладка' ], + [ 'метал' ], + [ 'дерево (кругляк)' ], + [ 'дерево (клеєне)' ], + [ 'різнорідний' ], + ]); + + // Table Б.37 + $this->createTable('wall_material', [ + 'wall_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('wall_material', 'Матеріал стін будівлі (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('wall_material', [ 'value' ], [ + [ 'збірний залізобетон' ], + [ 'монолітний залізобетон' ], + [ 'цегляна кладка' ], + [ 'кам\'яна кладка' ], + [ 'дерево кругле' ], + [ 'дерев\'яний каркас з обшивкою' ], + [ 'метал – зварена арматура' ], + [ 'метал профільований' ], + [ 'метал – зварена рама з заскленням' ], + ]); + + // Table Б.38 + $this->createTable('roof_material', [ + 'roof_material_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('roof_material', 'Матеріал даху будівлі (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('roof_material', [ 'value' ], [ + [ 'збірний залізобетон' ], + [ 'дерев\'яний каркас з обшивкою' ], + [ 'дерев\'яний каркас з обшивкою та черепицею' ], + [ 'дерев\'яний каркас з обшивкою та металевою черепицею' ], + [ 'дерев\'яний каркас з обшивкою та гофрованим шифером' ], + [ 'дерев\'яний каркас з обшивкою та гофрованою пластмасою' ], + [ 'металевий каркас з заскленням' ], + [ 'комірчата пластмаса (марлон)' ], + ]); + + // Table Б.39 + $this->createTable('drainage_type', [ + 'drainage_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('drainage_type', 'Типи водовідведення'); + $this->batchInsert('drainage_type', [ 'value' ], [ + [ 'за рахунок поперечних та повздовжніх похилі проїзжої частини' ], + [ 'з використанням водовідвідних трубок' ], + [ 'з використанням зливової каналізації відкритого типу' ], + [ 'з використанням зливової каналізації закритого типу' ], + ]); + + // Table Б.40 + $this->createTable('span_project', [ + 'span_project_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('span_project', 'Типові проекти прогонових будов (ДБН В.2.3-22, [13, 14, 26, 28])'); + $this->batchInsert('span_project', [ 'value' ], [ + [ 'індивідуальний' ], + [ '3.503.1-102' ], + [ '3.503.1-75' ], + [ '3.503-29' ], + [ '932-1-КЖИ' ], + [ 'ВБК 32-95' ], + [ 'Вип. 137 "Союздорпроект"' ], + [ 'Випуск 3.503-23' ], + [ 'Випуск 122-63' ], + [ 'Випуск 149-62' ], + [ 'Випуск 167' ], + [ 'Випуск 29' ], + [ 'Випуск 3.0503-12' ], + [ 'Випуск 3.503.1-53' ], + [ 'Випуск 3.503.1-58' ], + [ 'Випуск 3.503.1-79' ], + [ 'Випуск 3.503.1-93' ], + [ 'Випуск 3.503-2' ], + [ 'Випуск 384 сер.3.0503.12' ], + [ 'Випуск 384/43' ], + [ 'Випуск 384/45' ], + [ 'Випуск 384/46' ], + [ 'Випуск 56' ], + [ 'Випуск 56-доповнення' ], + [ 'Випуск 70' ], + [ 'Випуск No332/1' ], + [ 'Випуск No338/1' ], + [ 'Випуск ІІ' ], + [ 'Випуск-31' ], + [ 'Відповідно до СПД' ], + [ 'ВСК 31-87' ], + [ 'ВТП 17 „Укрдіпродор”' ], + [ 'ВТП 21-77' ], + [ 'ВТП 21-79' ], + [ 'ВТП 21-83' ], + [ 'ВТП 21-86' ], + [ 'ВТП-15' ], + [ 'ВТП-16' ], + [ 'ВТП-21' ], + [ 'ВТП-26' ], + [ 'ВТП-27/4М-85' ], + [ 'Індивідуальний проект 1895 р.' ], + [ 'Серія 3.503.1-61' ], + [ 'Серія 3.503.1-81 випуск 5-5, 6-1' ], + [ 'Серія 3.503.9-43/89' ], + [ 'Серія 3.503-12' ], + [ 'Серія 3.503-1-60.2' ], + [ 'Серія 3.503-1-64.2' ], + [ 'Серія 5-04-145' ], + [ 'Союздорпроект "Випуск 122-62"' ], + [ 'Союздорпроект "Випуск 143-144"' ], + [ 'Союздорпроект "Випуск 791/6"' ], + [ 'ТП 3.501-86' ], + [ 'ТП 3.503-72.2' ], + [ 'ТП 5-04-14' ], + ]); + + // Table Б.41 + $this->createTable('overground_crossing_approach_type', [ + 'overground_crossing_approach_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('overground_crossing_approach_type', 'Типи споруд підходів до надземних пішохідних переходів'); + $this->batchInsert('overground_crossing_approach_type', [ 'value' ], [ + [ 'сходи' ], + [ 'ліфт' ], + [ 'пандус' ], + ]); + + // Table Б.42 + $this->createTable('sel_protection_type', [ + 'sel_protection_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('sel_protection_type', 'Типи селезахисних споруд'); + $this->batchInsert('sel_protection_type', [ 'value' ], [ + [ 'накопичувальна дамба' ], + [ 'струмененаправляюча дамба' ], + [ 'фільтр-сепаратор' ], + ]); + + // Table Б.43 + $this->createTable('culvert_obstacle_type', [ + 'culvert_obstacle_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('culvert_obstacle_type', 'Види перешкод, які потребують водопропускних споруд'); + $this->batchInsert('culvert_obstacle_type', [ 'value' ], [ + [ 'суходіл' ], + [ 'струмок' ], + [ 'канал' ], + [ 'болото' ], + [ 'ставок' ], + [ 'скотопрогін' ], + [ 'з\'їзд вліво' ], + [ 'з\'їзд вправо' ], + ]); + + // Table Б.44 + $this->createTable('flow_direction', [ + 'flow_direction_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('flow_direction', 'Напрямки течії, по відношенню до основної дороги'); + $this->batchInsert('flow_direction', [ 'value' ], [ + [ 'справа-наліво' ], + [ 'зліва-направо' ], + ]); + + // Table Б.45 + $this->createTable('culvert_element_work', [ + 'culvert_element_work_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('culvert_element_work', 'Характер роботи водопропускного елементу'); + $this->batchInsert('culvert_element_work', [ 'value' ], [ + [ 'напірний' ], + [ 'напівнапірний' ], + ]); + + // Table Б.46 + $this->createTable('fortified_additional', [ + 'fortified_additional_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('fortified_additional', 'Додаткові укріплення дна труб та оголовків'); + $this->batchInsert('fortified_additional', [ 'value' ], [ + [ 'цементообетонні плити омонолічені' ], + [ 'цементообетонні плити не омонолічені' ], + [ 'залізобетонні плити омонолічені' ], + [ 'залізобетонні плити не омонолічені' ], + [ 'кам\'яна кладка' ], + [ 'монолітний цементобетон' ], + [ 'асфальтобетон' ], + [ 'накид каміння' ], + ]); + + // Table Б.47 + $this->createTable('waterproof_type', [ + 'waterproof_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('waterproof_type', 'Тип гідроізоляції'); + $this->batchInsert('waterproof_type', [ 'value' ], [ + [ 'оклеювальна' ], + [ 'обмазувальна' ], + ]); + + // Table Б.48 + $this->createTable('regulatory_type', [ + 'regulatory_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('regulatory_type', 'Типи регуляційних елементів та гасників'); + $this->batchInsert('regulatory_type', [ 'value' ], [ + [ 'відсутні' ], + [ 'водобійна яма' ], + [ 'водобійний колодязь' ], + [ 'водобійна стінка' ], + [ 'лоток' ], + [ 'перепади' ], + [ 'швидкотік' ], + ]); + + // Table Б.49 + $this->createTable('retaining_wall_type', [ + 'retaining_wall_type_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('retaining_wall_type', 'Типи підпірних стінок (ДБН В.2.3-4)'); + $this->batchInsert('retaining_wall_type', [ 'value' ], [ + [ 'верхова' ], + [ 'низова' ], + ]); + + // Table Б.50 + $this->createTable('retaining_wall_purpose', [ + 'retaining_wall_purpose_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('retaining_wall_purpose', 'Призначення підпірних стінок (ДБН В.2.3-4)'); + $this->batchInsert('retaining_wall_purpose', [ 'value' ], [ + [ 'одягаюча' ], + [ 'несуча' ], + ]); + + } + + public function down() + { + $this->dropTable('road_surface'); + $this->dropTable('structural_layers'); + $this->dropTable('road_surface_strenght'); + $this->dropTable('road_surface_flatness'); + $this->dropTable('road_surface_clutch'); + $this->dropTable('road_surface_damage'); + $this->dropTable('roadbed_size'); + $this->dropTable('rally'); + $this->dropTable('rally_card'); + $this->dropTable('tunnel'); + $this->dropTable('tunnel_card'); + $this->dropTable('tunnel_portal_card'); + $this->dropTable('tunnel_body_card'); + $this->dropTable('sewage_card'); + $this->dropTable('technical_doc'); + $this->dropTable('bridge'); + $this->dropTable('bridge_card'); + $this->dropTable('purlin_card'); + $this->dropTable('pillar_card'); + $this->dropTable('underground_crossing'); + $this->dropTable('underground_crossing_card'); + $this->dropTable('underground_crossing_portal_card'); + $this->dropTable('underground_crossing_body_card'); + $this->dropTable('underground_crossing_add_on_card'); + $this->dropTable('overground_crossing'); + $this->dropTable('overground_crossing_card'); + $this->dropTable('overground_crossing_approach_card'); + $this->dropTable('sel_protection'); + $this->dropTable('sel_protection_card'); + $this->dropTable('drainage_pipe'); + $this->dropTable('drainage_pipe_card'); + $this->dropTable('culvert_element_card'); + $this->dropTable('header_card'); + $this->dropTable('bus_station'); + $this->dropTable('bus_station_card'); + $this->dropTable('pavilion_card'); + $this->dropTable('retaining_wall'); + $this->dropTable('retaining_wall_card'); + $this->dropTable('stabilisation_field'); + $this->dropTable('stabilisation_field_card'); + $this->dropTable('tray'); + $this->dropTable('tray_card'); + $this->dropTable('drainage'); + $this->dropTable('drainage_card'); + $this->dropTable('site'); + $this->dropTable('site_card'); + $this->dropTable('improvement_card'); + $this->dropTable('sidewalk'); + $this->dropTable('sidewalk_card'); + $this->dropTable('fence'); + $this->dropTable('fence_card'); + $this->dropTable('direct_device'); + $this->dropTable('direct_device_card'); + $this->dropTable('noise_dazzle_protection'); + $this->dropTable('dazzle_protection_card'); + $this->dropTable('noise_protection_card'); + $this->dropTable('road_sign'); + $this->dropTable('road_sign_card'); + $this->dropTable('road_mark'); + $this->dropTable('road_mark_card'); + $this->dropTable('planting'); + $this->dropTable('planting_card'); + $this->dropTable('data_collector'); + $this->dropTable('data_collector_card'); + $this->dropTable('communication'); + $this->dropTable('communication_card'); + $this->dropTable('snow_protection'); + $this->dropTable('topography_climate'); + $this->dropTable('road_complex'); + $this->dropTable('rail_cross'); + $this->dropTable('important_object'); + $this->dropTable('communication_third'); + $this->dropTable('communication_third_card'); + $this->dropTable('flow'); + $this->dropTable('speed_limit'); + $this->dropTable('visibility_danger'); + $this->dropTable('road_accident'); + } +} diff --git a/console/migrations/m130524_201442_init.php b/console/migrations/m130524_201442_init.php new file mode 100755 index 0000000..6b649f4 --- /dev/null +++ b/console/migrations/m130524_201442_init.php @@ -0,0 +1,33 @@ +db->driverName === 'mysql') { + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; + } + + $this->createTable('{{%user}}', [ + 'id' => $this->primaryKey(), + 'username' => $this->string()->notNull()->unique(), + 'auth_key' => $this->string(32)->notNull(), + 'password_hash' => $this->string()->notNull(), + 'password_reset_token' => $this->string()->unique(), + 'email' => $this->string()->notNull()->unique(), + + 'status' => $this->smallInteger()->notNull()->defaultValue(10), + 'created_at' => $this->integer()->notNull(), + 'updated_at' => $this->integer()->notNull(), + ], $tableOptions); + } + + public function down() + { + $this->dropTable('{{%user}}'); + } +} diff --git a/console/migrations/m160711_150500_flow_intensity.php b/console/migrations/m160711_150500_flow_intensity.php new file mode 100644 index 0000000..4e531cb --- /dev/null +++ b/console/migrations/m160711_150500_flow_intensity.php @@ -0,0 +1,81 @@ +createTable('flow_intensity', [ + 'flow_intensity_id' => $this->primaryKey() + ->comment('Індекс'), + 'road_id' => $this->integer() + ->comment('Автомобільна дорога'), + 'region_id' => $this->integer() + ->comment('Область'), + 'location' => $this->float() + ->comment('Місцезнаходження, км+'), + 'begin' => $this->float() + ->comment('Місцезнаходження ділянки з однорідною інтенсивністю руху, км+, початок'), + 'end' => $this->float() + ->comment('Місцезнаходження ділянки з однорідною інтенсивністю руху, км+, кінець'), + 'road_direction_id' => $this->integer() + ->comment('Напрямок смуги руху'), + 'settlement_id' => $this->integer() + ->comment('Найближчий населений пункт'), + 'intensity_total' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, всього'), + 'intensity_increase' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, приріст'), + 'intensity_moto' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, мотоцикл без коляски та мопед'), + 'intensity_moto_sidecar' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, мотоцикл з коляскою'), + 'intensity_car' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, легковий автомобіль'), + 'intensity_truck_two' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: до 2 т.'), + 'intensity_truck_two_six' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 2 т. до 6 т.'), + 'intensity_truck_six_eight' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 6 т. до 8 т.'), + 'intensity_truck_eight_fourteen' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: від 8 т. до 14 т.'), + 'intensity_truck_fourteen' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, вантажний автомобіль вантажопідйомністю: понад 14 т.'), + 'intensity_lorry_twelve' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: до 12 т.'), + 'intensity_lorry_twelve_twenty' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: від 12 т. до 20 т.'), + 'intensity_lorry_twenty_thirty' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: від 20 т. до 30 т.'), + 'intensity_lorry_thirty' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, автопоїзд вантажопідйомністю: понад 30 т.'), + 'intensity_tractor_under_ten' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, колісний трактор з причепами до 10 т.'), + 'intensity_tractor_over_ten' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, колісний трактор з причепами понад 10 т.'), + 'intensity_bus' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, автобус, тролейбус'), + 'intensity_bus_coupled' => $this->integer() + ->comment('Інтенсивність руху, авт/добу, автобус зчеплений (здвоєний)'), + 'date_add' => $this->integer() + ->comment('Дата визначення'), + ]); + $this->addCommentOnTable('flow_intensity', 'Відомість інтенсивності руху та склад транспортного потоку'); + $this->addForeignKey('flow_intensity_road', 'flow_intensity', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('flow_intensity_region', 'flow_intensity', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('flow_intensity_road_direction', 'flow_intensity', 'road_direction_id', 'road_direction', 'road_direction_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('flow_intensity_settlement', 'flow_intensity', 'settlement_id', 'settlement', 'settlement_id', 'CASCADE', 'CASCADE'); + } + + public function down() + { + $this->dropForeignKey('flow_intensity_road', 'flow_intensity'); + $this->dropForeignKey('flow_intensity_region', 'flow_intensity'); + $this->dropForeignKey('flow_intensity_road_direction', 'flow_intensity'); + $this->dropForeignKey('flow_intensity_settlement', 'flow_intensity'); + $this->dropTable('flow_intensity'); + } + } diff --git a/console/models/.gitkeep b/console/models/.gitkeep new file mode 100755 index 0000000..72e8ffc --- /dev/null +++ b/console/models/.gitkeep @@ -0,0 +1 @@ +* diff --git a/console/runtime/.gitignore b/console/runtime/.gitignore new file mode 100755 index 0000000..c96a04f --- /dev/null +++ b/console/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/environments/dev/backend/config/main-local.php b/environments/dev/backend/config/main-local.php new file mode 100755 index 0000000..d9a8ceb --- /dev/null +++ b/environments/dev/backend/config/main-local.php @@ -0,0 +1,25 @@ + [ + 'request' => [ + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation + 'cookieValidationKey' => '', + ], + ], +]; + +if (!YII_ENV_TEST) { + // configuration adjustments for 'dev' environment + $config['bootstrap'][] = 'debug'; + $config['modules']['debug'] = [ + 'class' => 'yii\debug\Module', + ]; + + $config['bootstrap'][] = 'gii'; + $config['modules']['gii'] = [ + 'class' => 'yii\gii\Module', + ]; +} + +return $config; diff --git a/environments/dev/backend/config/params-local.php b/environments/dev/backend/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/dev/backend/config/params-local.php @@ -0,0 +1,3 @@ +run(); diff --git a/environments/dev/backend/web/index.php b/environments/dev/backend/web/index.php new file mode 100755 index 0000000..6038167 --- /dev/null +++ b/environments/dev/backend/web/index.php @@ -0,0 +1,18 @@ +run(); diff --git a/environments/dev/common/config/main-local.php b/environments/dev/common/config/main-local.php new file mode 100755 index 0000000..43db30e --- /dev/null +++ b/environments/dev/common/config/main-local.php @@ -0,0 +1,20 @@ + [ + 'db' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + ], + 'mailer' => [ + 'class' => 'yii\swiftmailer\Mailer', + 'viewPath' => '@common/mail', + // send all mails to a file by default. You have to set + // 'useFileTransport' to false and configure a transport + // for the mailer to send real emails. + 'useFileTransport' => true, + ], + ], +]; diff --git a/environments/dev/common/config/params-local.php b/environments/dev/common/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/dev/common/config/params-local.php @@ -0,0 +1,3 @@ + ['gii'], + 'modules' => [ + 'gii' => 'yii\gii\Module', + ], +]; diff --git a/environments/dev/console/config/params-local.php b/environments/dev/console/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/dev/console/config/params-local.php @@ -0,0 +1,3 @@ + [ + 'request' => [ + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation + 'cookieValidationKey' => '', + ], + ], +]; + +if (!YII_ENV_TEST) { + // configuration adjustments for 'dev' environment + $config['bootstrap'][] = 'debug'; + $config['modules']['debug'] = [ + 'class' => 'yii\debug\Module', + ]; + $config['bootstrap'][] = 'gii'; + $config['modules']['gii'] = [ + 'class' => 'yii\gii\Module', + ]; +} + +return $config; diff --git a/environments/dev/frontend/config/params-local.php b/environments/dev/frontend/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/dev/frontend/config/params-local.php @@ -0,0 +1,3 @@ +run(); diff --git a/environments/dev/frontend/web/index.php b/environments/dev/frontend/web/index.php new file mode 100755 index 0000000..6038167 --- /dev/null +++ b/environments/dev/frontend/web/index.php @@ -0,0 +1,18 @@ +run(); diff --git a/environments/dev/tests/codeception/config/config-local.php b/environments/dev/tests/codeception/config/config-local.php new file mode 100755 index 0000000..c2a6a04 --- /dev/null +++ b/environments/dev/tests/codeception/config/config-local.php @@ -0,0 +1,11 @@ + [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_tests', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + ], + ], +]; diff --git a/environments/dev/yii b/environments/dev/yii new file mode 100755 index 0000000..6f0c6d2 --- /dev/null +++ b/environments/dev/yii @@ -0,0 +1,28 @@ +#!/usr/bin/env php +run(); +exit($exitCode); diff --git a/environments/index.php b/environments/index.php new file mode 100755 index 0000000..19c989d --- /dev/null +++ b/environments/index.php @@ -0,0 +1,65 @@ + [ + * 'path' => 'directory storing the local files', + * 'skipFiles' => [ + * // list of files that should only copied once and skipped if they already exist + * ], + * 'setWritable' => [ + * // list of directories that should be set writable + * ], + * 'setExecutable' => [ + * // list of files that should be set executable + * ], + * 'setCookieValidationKey' => [ + * // list of config files that need to be inserted with automatically generated cookie validation keys + * ], + * 'createSymlink' => [ + * // list of symlinks to be created. Keys are symlinks, and values are the targets. + * ], + * ], + * ]; + * ``` + */ +return [ + 'Development' => [ + 'path' => 'dev', + 'setWritable' => [ + 'backend/runtime', + 'backend/web/assets', + 'frontend/runtime', + 'frontend/web/assets', + ], + 'setExecutable' => [ + 'yii', + 'tests/codeception/bin/yii', + ], + 'setCookieValidationKey' => [ + 'backend/config/main-local.php', + 'frontend/config/main-local.php', + ], + ], + 'Production' => [ + 'path' => 'prod', + 'setWritable' => [ + 'backend/runtime', + 'backend/web/assets', + 'frontend/runtime', + 'frontend/web/assets', + ], + 'setExecutable' => [ + 'yii', + ], + 'setCookieValidationKey' => [ + 'backend/config/main-local.php', + 'frontend/config/main-local.php', + ], + ], +]; diff --git a/environments/prod/backend/config/main-local.php b/environments/prod/backend/config/main-local.php new file mode 100755 index 0000000..af46ba3 --- /dev/null +++ b/environments/prod/backend/config/main-local.php @@ -0,0 +1,9 @@ + [ + 'request' => [ + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation + 'cookieValidationKey' => '', + ], + ], +]; diff --git a/environments/prod/backend/config/params-local.php b/environments/prod/backend/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/prod/backend/config/params-local.php @@ -0,0 +1,3 @@ +run(); diff --git a/environments/prod/common/config/main-local.php b/environments/prod/common/config/main-local.php new file mode 100755 index 0000000..84c4d9f --- /dev/null +++ b/environments/prod/common/config/main-local.php @@ -0,0 +1,16 @@ + [ + 'db' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + ], + 'mailer' => [ + 'class' => 'yii\swiftmailer\Mailer', + 'viewPath' => '@common/mail', + ], + ], +]; diff --git a/environments/prod/common/config/params-local.php b/environments/prod/common/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/prod/common/config/params-local.php @@ -0,0 +1,3 @@ + [ + 'request' => [ + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation + 'cookieValidationKey' => '', + ], + ], +]; diff --git a/environments/prod/frontend/config/params-local.php b/environments/prod/frontend/config/params-local.php new file mode 100755 index 0000000..d0b9c34 --- /dev/null +++ b/environments/prod/frontend/config/params-local.php @@ -0,0 +1,3 @@ +run(); diff --git a/environments/prod/tests/codeception/config/config-local.php b/environments/prod/tests/codeception/config/config-local.php new file mode 100755 index 0000000..c2a6a04 --- /dev/null +++ b/environments/prod/tests/codeception/config/config-local.php @@ -0,0 +1,11 @@ + [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_tests', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8', + ], + ], +]; diff --git a/environments/prod/yii b/environments/prod/yii new file mode 100755 index 0000000..1fe0342 --- /dev/null +++ b/environments/prod/yii @@ -0,0 +1,28 @@ +#!/usr/bin/env php +run(); +exit($exitCode); diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php new file mode 100755 index 0000000..8b5f017 --- /dev/null +++ b/frontend/assets/AppAsset.php @@ -0,0 +1,23 @@ + 'app-frontend', + 'basePath' => dirname(__DIR__), + 'bootstrap' => ['log'], + 'controllerNamespace' => 'frontend\controllers', + 'components' => [ + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => ['error', 'warning'], + ], + ], + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'rules' => [ + ], + ], + ], + 'params' => $params, +]; diff --git a/frontend/config/params.php b/frontend/config/params.php new file mode 100755 index 0000000..7f754b9 --- /dev/null +++ b/frontend/config/params.php @@ -0,0 +1,4 @@ + 'admin@example.com', +]; diff --git a/frontend/controllers/FlowIntensityController.php b/frontend/controllers/FlowIntensityController.php new file mode 100644 index 0000000..f8549ba --- /dev/null +++ b/frontend/controllers/FlowIntensityController.php @@ -0,0 +1,218 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all FlowIntensity models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new FlowIntensitySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single FlowIntensity model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new FlowIntensity model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new FlowIntensity(); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->asArray() + ->indexBy('road_id') + ->column(); + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->asArray() + ->indexBy('region_id') + ->column(); + $road_directions = RoadDirection::find() + ->select([ + 'direction_name', + 'road_direction_id', + ]) + ->asArray() + ->indexBy('road_direction_id') + ->column(); + $settlements = Settlement::find() + ->select([ + 'name', + 'settlement_id', + ]) + ->asArray() + ->indexBy('settlement_id') + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->flow_intensity_id, + ]); + } else { + return $this->render('create', [ + 'model' => $model, + 'roads' => $roads, + 'regions' => $regions, + 'road_directions' => $road_directions, + 'settlements' => $settlements, + ]); + } + } + + /** + * Updates an existing FlowIntensity model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->asArray() + ->indexBy('road_id') + ->column(); + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->asArray() + ->indexBy('region_id') + ->column(); + $road_directions = RoadDirection::find() + ->select([ + 'direction_name', + 'road_direction_id', + ]) + ->asArray() + ->indexBy('road_direction_id') + ->column(); + $settlements = Settlement::find() + ->select([ + 'name', + 'settlement_id', + ]) + ->asArray() + ->indexBy('settlement_id') + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->flow_intensity_id, + ]); + } else { + return $this->render('update', [ + 'model' => $model, + 'roads' => $roads, + 'regions' => $regions, + 'road_directions' => $road_directions, + 'settlements' => $settlements, + ]); + } + } + + /** + * Deletes an existing FlowIntensity model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the FlowIntensity model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return FlowIntensity the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = FlowIntensity::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/frontend/controllers/MapController.php b/frontend/controllers/MapController.php new file mode 100755 index 0000000..cef4813 --- /dev/null +++ b/frontend/controllers/MapController.php @@ -0,0 +1,30 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + /** + * @return mixed + */ + public function actionIndex() + { + $passports = RoadPassport::find()->with('road')->with('road.roadType')->all(); + return $this->render('index', ['passports' => $passports]); + } + + } diff --git a/frontend/controllers/PointController.php b/frontend/controllers/PointController.php new file mode 100755 index 0000000..8789d56 --- /dev/null +++ b/frontend/controllers/PointController.php @@ -0,0 +1,172 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + /** + * @return mixed + */ + public function actionGet($id) + { + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + $id = (int) $id; + $road_passport = RoadPassport::findOne($id); + if(empty( $road_passport )) { + $response->setStatusCode(404); + return $response->statusText; + } + $query = Point::find() + ->where([ 'road_passport_id' => (int) $id ]) + ->orderBy('num') + ->indexBy('num'); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'key' => 'num', + 'pagination' => [ + 'pageSize' => false, + ], + ]); + return [ + 'result' => [ + 'html' => $this->renderAjax('list', [ + 'dataProvider' => $dataProvider, + 'passport_id' => $id, + 'road_passport' => $road_passport, + ]), + 'points' => $dataProvider->getModels(), + 'passport' => $road_passport, + ], + ]; + } + + public function actionAdd($road_passport_id, $lat, $lng, $num, $km) + { + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + $get = $request->get(); + $road_passport = RoadPassport::findOne($road_passport_id); + if(empty( $road_passport )) { + $response->setStatusCode(404); + return $response->statusText; + } + $point = new Point([ + 'road_passport_id' => $road_passport_id, + 'lat' => $lat, + 'lng' => $lng, + 'num' => $num, + 'km' => $km, + ]); + return [ + 'result' => [ + 'html' => $this->renderAjax('row', [ + 'point' => $point, + 'passport_id' => $road_passport_id, + ]), + ], + ]; + } + + public function actionSave() + { + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + $post = $request->post(); + if(!empty( $post )) { + if(!empty( $post[ 'RoadPassport' ][ 'road_passport_id' ] )) { + $road_passport = RoadPassport::findOne($post[ 'RoadPassport' ][ 'road_passport_id' ]); + if(empty( $road_passport )) { + $response->setStatusCode(404); + return $response->statusText; + } else { + $points = [ ]; + for($i = 1; $i <= count($post[ 'Point' ]); $i++) { + $points[ $i ] = new Point([ 'road_passport_id' => $road_passport->road_passport_id ]); + } + if(Point::loadMultiple($points, $post) && Point::validateMultiple($points)) { + Point::deleteAll([ 'road_passport_id' => $road_passport->road_passport_id ]); + foreach($points as $point) { + $point->save(false); + } + return [ + 'result' => [ + 'message' => 'Дані успішно збережені', + ], + ]; + } else { + $response->setStatusCode(400); + return 'Помилка даних, дані не збережено.'; + } + } + } + } + $response->setStatusCode(404); + return $response->statusText; + } + + public function actionSnap(string $path, int $road_passport_id = 2) + { + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + $road_passport = RoadPassport::findOne($road_passport_id); + if(empty( $road_passport )) { + $response->setStatusCode(404); + return $response->statusText; + } + $google_road = new GoogleRoad($path); + $result = json_decode($google_road->execute()); + $points = [ ]; + if($result->snappedPoints) { + foreach($result->snappedPoints as $index => $value) { + $points[ $index + 1 ] = new Point([ + 'road_passport_id' => $road_passport_id, + 'lat' => $value->location->latitude, + 'lng' => $value->location->longitude, + 'num' => ( $index + 1 ), + 'km' => $index ? NULL : $road_passport->begin, + ]); + } + } + $dataProvider = new ArrayDataProvider([ + 'allModels' => $points, + 'key' => 'num', + 'pagination' => false, + ]); + return [ + 'result' => [ + 'html' => $this->renderAjax('list', [ + 'dataProvider' => $dataProvider, + 'passport_id' => $road_passport_id, + 'road_passport' => $road_passport, + ]), + 'points' => $dataProvider->getModels(), + 'passport' => $road_passport, + ], + ]; + } + + } diff --git a/frontend/controllers/RoadController.php b/frontend/controllers/RoadController.php new file mode 100755 index 0000000..cb8b7b4 --- /dev/null +++ b/frontend/controllers/RoadController.php @@ -0,0 +1,225 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'post' ], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + /** + * @return mixed + */ + public function actionCreate() + { + $road = new Road(); + $post = \Yii::$app->request->post(); + if($road->load($post) && $road->save()) { + return $this->redirect([ 'index' ]); + } else { + $road_types = RoadType::find() + ->select('value') + ->indexBy('road_type_id') + ->asArray() + ->column(); + $road_categories = RoadCategory::find() + ->select('value') + ->indexBy('road_category_id') + ->asArray() + ->column(); + return $this->render('create', [ + 'road' => $road, + 'road_types' => $road_types, + 'road_categories' => $road_categories, + ]); + } + } + + /** + * @param int $id + * + * @return mixed + * @throws NotFoundHttpException + */ + public function actionDelete(int $id) + { + $road = Road::findOne($id); + if(empty( $road )) { + throw new NotFoundHttpException('Road not found'); + } + $road->delete(); + return $this->redirect([ 'index' ]); + } + + /** + * @return mixed + */ + public function actionIndex() + { + $query = Road::find() + ->with('roadCategory', 'roadType'); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSize' => 20, + ], + ]); + return $this->render('index', [ 'dataProvider' => $dataProvider ]); + } + + /** + * @param int $id + * + * @return mixed + * @throws NotFoundHttpException + */ + public function actionUpdate(int $id) + { + $road = Road::findOne($id); + if(empty( $road )) { + throw new NotFoundHttpException('Road not found'); + } + $post = \Yii::$app->request->post(); + if($road->load($post) && $road->save()) { + return $this->redirect([ 'index' ]); + } else { + $road_types = RoadType::find() + ->select('value') + ->indexBy('road_type_id') + ->asArray() + ->column(); + $road_categories = RoadCategory::find() + ->select('value') + ->indexBy('road_category_id') + ->asArray() + ->column(); + return $this->render('update', [ + 'road' => $road, + 'road_types' => $road_types, + 'road_categories' => $road_categories, + ]); + } + } + + public function actionView(int $id) + { + $road = Road::findOne($id); + if(empty( $road )) { + throw new NotFoundHttpException('Road not found'); + } + $settlement_regions = [ ]; + $region_ids = [ ]; + $region_ids = SettlementAddressLink::find() + ->distinct() + ->select('region_id') + ->where([ 'road_id' => $id ]) + ->column(); + if(!empty( $region_ids )) { + $settlement_regions = Region::find() + ->where([ 'region_id' => $region_ids ]) + ->all(); + } + $flow_intensity_regions = [ ]; + $region_ids = [ ]; + $region_ids = FlowIntensity::find() + ->distinct() + ->select('region_id') + ->where([ 'road_id' => $id ]) + ->column(); + if(!empty( $region_ids )) { + $flow_intensity_regions = Region::find() + ->where([ 'region_id' => $region_ids ]) + ->all(); + } + return $this->render('view', [ + 'road' => $road, + 'settlement_regions' => $settlement_regions, + 'flow_intensity_regions' => $flow_intensity_regions, + ]); + } + + public function actionSettlement(int $id, int $region_id) + { + $road = Road::findOne($id); + if(empty( $road )) { + throw new NotFoundHttpException('Road not found'); + } + $region = Region::findOne($region_id); + if(empty( $region )) { + throw new NotFoundHttpException('Region not found'); + } + $dataProvider = new ActiveDataProvider([ + 'query' => SettlementAddressLink::find() + ->where([ + 'road_id' => $id, + 'region_id' => $region_id, + ]), + 'pagination' => false, + ]); + return $this->render('settlement', [ + 'road' => $road, + 'region' => $region, + 'dataProvider' => $dataProvider, + ]); + } + + public function actionFlowIntensity(int $id, int $region_id) + { + $road = Road::findOne($id); + if(empty( $road )) { + throw new NotFoundHttpException('Road not found'); + } + $region = Region::findOne($region_id); + if(empty( $region )) { + throw new NotFoundHttpException('Region not found'); + } + $dataProvider = new ActiveDataProvider([ + 'query' => FlowIntensity::find() + ->where([ + 'road_id' => $id, + 'region_id' => $region_id, + ]), + 'pagination' => false, + ]); + return $this->render('flow-intensity', [ + 'road' => $road, + 'region' => $region, + 'dataProvider' => $dataProvider, + ]); + } + } diff --git a/frontend/controllers/RoadPassportController.php b/frontend/controllers/RoadPassportController.php new file mode 100755 index 0000000..b0df050 --- /dev/null +++ b/frontend/controllers/RoadPassportController.php @@ -0,0 +1,135 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'post' ], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + /** + * @return mixed + */ + public function actionCreate() + { + $roadpassport = new RoadPassport(); + $post = \Yii::$app->request->post(); + if($roadpassport->load($post) && $roadpassport->save()) { + return $this->redirect([ 'index' ]); + } else { + $roads = Road::find() + ->select('name') + ->indexBy('road_id') + ->asArray() + ->column(); + $regions = Region::find() + ->select('name') + ->indexBy('region_id') + ->asArray() + ->column(); + return $this->render('create', [ + 'roadpassport' => $roadpassport, + 'roads' => $roads, + 'regions' => $regions, + ]); + } + } + + /** + * @param int $id + * + * @return mixed + * @throws NotFoundHttpException + */ + public function actionDelete(int $id) + { + $roadpassport = RoadPassport::findOne($id); + if(empty( $roadpassport )) { + throw new NotFoundHttpException('Road passport not found'); + } + $roadpassport->delete(); + return $this->redirect([ 'index' ]); + } + + /** + * @return mixed + */ + public function actionIndex() + { + $query = RoadPassport::find() + ->with('road', 'region'); + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSize' => 20, + ], + ]); + return $this->render('index', [ 'dataProvider' => $dataProvider ]); + } + + /** + * @param int $id + * + * @return mixed + * @throws NotFoundHttpException + */ + public function actionUpdate(int $id) + { + $roadpassport = RoadPassport::findOne($id); + if(empty( $roadpassport )) { + throw new NotFoundHttpException('Road passport not found'); + } + $post = \Yii::$app->request->post(); + if($roadpassport->load($post) && $roadpassport->save()) { + return $this->redirect([ 'index' ]); + } else { + $roads = Road::find() + ->select('name') + ->indexBy('road_id') + ->asArray() + ->column(); + $regions = Region::find() + ->select('name') + ->indexBy('region_id') + ->asArray() + ->column(); + return $this->render('create', [ + 'roadpassport' => $roadpassport, + 'roads' => $roads, + 'regions' => $regions, + ]); + } + } + } diff --git a/frontend/controllers/RoadServiceController.php b/frontend/controllers/RoadServiceController.php new file mode 100644 index 0000000..1cc91e9 --- /dev/null +++ b/frontend/controllers/RoadServiceController.php @@ -0,0 +1,218 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all RoadService models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new RoadServiceSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single RoadService model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new RoadService model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new RoadService(); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->indexBy('road_id') + ->asArray() + ->column(); + $organizations = Organization::find() + ->select([ + 'name', + 'organization_id', + ]) + ->indexBy('organization_id') + ->asArray() + ->column(); + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->indexBy('region_id') + ->asArray() + ->column(); + $directions = RoadDirection::find() + ->select([ + 'direction_name', + 'road_direction_id', + ]) + ->indexBy('road_direction_id') + ->asArray() + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->road_service_id, + ]); + } else { + return $this->render('create', [ + 'model' => $model, + 'roads' => $roads, + 'organizations' => $organizations, + 'regions' => $regions, + 'directions' => $directions, + ]); + } + } + + /** + * Updates an existing RoadService model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->indexBy('road_id') + ->asArray() + ->column(); + $organizations = Organization::find() + ->select([ + 'name', + 'organization_id', + ]) + ->indexBy('organization_id') + ->asArray() + ->column(); + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->indexBy('region_id') + ->asArray() + ->column(); + $directions = RoadDirection::find() + ->select([ + 'direction_name', + 'road_direction_id', + ]) + ->indexBy('road_direction_id') + ->asArray() + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->road_service_id, + ]); + } else { + return $this->render('update', [ + 'model' => $model, + 'roads' => $roads, + 'organizations' => $organizations, + 'regions' => $regions, + 'directions' => $directions, + ]); + } + } + + /** + * Deletes an existing RoadService model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the RoadService model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return RoadService the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = RoadService::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/frontend/controllers/SettlementAddressLinkController.php b/frontend/controllers/SettlementAddressLinkController.php new file mode 100644 index 0000000..8635599 --- /dev/null +++ b/frontend/controllers/SettlementAddressLinkController.php @@ -0,0 +1,224 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all SettlementAddressLink models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new SettlementAddressLinkSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single SettlementAddressLink model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new SettlementAddressLink model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new SettlementAddressLink(); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->asArray() + ->indexBy('road_id') + ->column(); + + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->asArray() + ->indexBy('region_id') + ->column(); + + $settlement_locations = SettlementLocation::find() + ->select([ + 'value', + 'settlement_location_id', + ]) + ->asArray() + ->indexBy('settlement_location_id') + ->column(); + + $settlements = Settlement::find() + ->select([ + 'sign', + 'settlement_id', + ]) + ->asArray() + ->indexBy('settlement_id') + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->settlement_address_link_id, + ]); + } else { + return $this->render('create', [ + 'model' => $model, + 'roads' => $roads, + 'regions' => $regions, + 'settlement_locations' => $settlement_locations, + 'settlements' => $settlements, + ]); + } + } + + /** + * Updates an existing SettlementAddressLink model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->asArray() + ->indexBy('road_id') + ->column(); + + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->asArray() + ->indexBy('region_id') + ->column(); + + $settlement_locations = SettlementLocation::find() + ->select([ + 'value', + 'settlement_location_id', + ]) + ->asArray() + ->indexBy('settlement_location_id') + ->column(); + + $settlements = Settlement::find() + ->select([ + 'sign', + 'settlement_id', + ]) + ->asArray() + ->indexBy('settlement_id') + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->settlement_address_link_id, + ]); + } else { + return $this->render('update', [ + 'model' => $model, + 'roads' => $roads, + 'regions' => $regions, + 'settlement_locations' => $settlement_locations, + 'settlements' => $settlements, + ]); + } + } + + /** + * Deletes an existing SettlementAddressLink model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the SettlementAddressLink model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return SettlementAddressLink the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = SettlementAddressLink::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php new file mode 100755 index 0000000..67b5aa0 --- /dev/null +++ b/frontend/controllers/SiteController.php @@ -0,0 +1,213 @@ + [ + 'class' => AccessControl::className(), + 'only' => ['logout', 'signup'], + 'rules' => [ + [ + 'actions' => ['signup'], + 'allow' => true, + 'roles' => ['?'], + ], + [ + 'actions' => ['logout'], + 'allow' => true, + 'roles' => ['@'], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => ['post'], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; + } + + /** + * Displays homepage. + * + * @return mixed + */ + public function actionIndex() + { + return $this->render('index'); + } + + /** + * Logs in a user. + * + * @return mixed + */ + public function actionLogin() + { + if (!Yii::$app->user->isGuest) { + return $this->goHome(); + } + + $model = new LoginForm(); + if ($model->load(Yii::$app->request->post()) && $model->login()) { + return $this->goBack(); + } else { + return $this->render('login', [ + 'model' => $model, + ]); + } + } + + /** + * Logs out the current user. + * + * @return mixed + */ + public function actionLogout() + { + Yii::$app->user->logout(); + + return $this->goHome(); + } + + /** + * Displays contact page. + * + * @return mixed + */ + public function actionContact() + { + $model = new ContactForm(); + if ($model->load(Yii::$app->request->post()) && $model->validate()) { + if ($model->sendEmail(Yii::$app->params['adminEmail'])) { + Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); + } else { + Yii::$app->session->setFlash('error', 'There was an error sending email.'); + } + + return $this->refresh(); + } else { + return $this->render('contact', [ + 'model' => $model, + ]); + } + } + + /** + * Displays about page. + * + * @return mixed + */ + public function actionAbout() + { + return $this->render('about'); + } + + /** + * Signs user up. + * + * @return mixed + */ + public function actionSignup() + { + $model = new SignupForm(); + if ($model->load(Yii::$app->request->post())) { + if ($user = $model->signup()) { + if (Yii::$app->getUser()->login($user)) { + return $this->goHome(); + } + } + } + + return $this->render('signup', [ + 'model' => $model, + ]); + } + + /** + * Requests password reset. + * + * @return mixed + */ + public function actionRequestPasswordReset() + { + $model = new PasswordResetRequestForm(); + if ($model->load(Yii::$app->request->post()) && $model->validate()) { + if ($model->sendEmail()) { + Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); + + return $this->goHome(); + } else { + Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); + } + } + + return $this->render('requestPasswordResetToken', [ + 'model' => $model, + ]); + } + + /** + * Resets password. + * + * @param string $token + * @return mixed + * @throws BadRequestHttpException + */ + public function actionResetPassword($token) + { + try { + $model = new ResetPasswordForm($token); + } catch (InvalidParamException $e) { + throw new BadRequestHttpException($e->getMessage()); + } + + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { + Yii::$app->session->setFlash('success', 'New password was saved.'); + + return $this->goHome(); + } + + return $this->render('resetPassword', [ + 'model' => $model, + ]); + } +} diff --git a/frontend/controllers/StatementController.php b/frontend/controllers/StatementController.php new file mode 100755 index 0000000..44be692 --- /dev/null +++ b/frontend/controllers/StatementController.php @@ -0,0 +1,37 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + ]; + } + + /** + * @return mixed + */ + public function actionIndex() + { + $passports_query = RoadPassport::find()->with('road')->with('road.roadType'); + $dataProvider = new ActiveDataProvider([ + 'query' => $passports_query, + 'pagination' => [ + 'pageSize' => 20, + ], + ]); + return $this->render('index', ['dataProvider' => $dataProvider]); + } + + } diff --git a/frontend/models/ContactForm.php b/frontend/models/ContactForm.php new file mode 100755 index 0000000..a716a53 --- /dev/null +++ b/frontend/models/ContactForm.php @@ -0,0 +1,60 @@ + 'Verification Code', + ]; + } + + /** + * Sends an email to the specified email address using the information collected by this model. + * + * @param string $email the target email address + * @return boolean whether the email was sent + */ + public function sendEmail($email) + { + return Yii::$app->mailer->compose() + ->setTo($email) + ->setFrom([$this->email => $this->name]) + ->setSubject($this->subject) + ->setTextBody($this->body) + ->send(); + } +} diff --git a/frontend/models/PasswordResetRequestForm.php b/frontend/models/PasswordResetRequestForm.php new file mode 100755 index 0000000..9dedad8 --- /dev/null +++ b/frontend/models/PasswordResetRequestForm.php @@ -0,0 +1,69 @@ + 'trim'], + ['email', 'required'], + ['email', 'email'], + ['email', 'exist', + 'targetClass' => '\common\models\User', + 'filter' => ['status' => User::STATUS_ACTIVE], + 'message' => 'There is no user with such email.' + ], + ]; + } + + /** + * Sends an email with a link, for resetting the password. + * + * @return boolean whether the email was send + */ + public function sendEmail() + { + /* @var $user User */ + $user = User::findOne([ + 'status' => User::STATUS_ACTIVE, + 'email' => $this->email, + ]); + + if (!$user) { + return false; + } + + if (!User::isPasswordResetTokenValid($user->password_reset_token)) { + $user->generatePasswordResetToken(); + } + + if (!$user->save()) { + return false; + } + + return Yii::$app + ->mailer + ->compose( + ['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], + ['user' => $user] + ) + ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot']) + ->setTo($this->email) + ->setSubject('Password reset for ' . Yii::$app->name) + ->send(); + } +} diff --git a/frontend/models/ResetPasswordForm.php b/frontend/models/ResetPasswordForm.php new file mode 100755 index 0000000..72b7f02 --- /dev/null +++ b/frontend/models/ResetPasswordForm.php @@ -0,0 +1,64 @@ +_user = User::findByPasswordResetToken($token); + if (!$this->_user) { + throw new InvalidParamException('Wrong password reset token.'); + } + parent::__construct($config); + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + ['password', 'required'], + ['password', 'string', 'min' => 6], + ]; + } + + /** + * Resets password. + * + * @return boolean if password was reset. + */ + public function resetPassword() + { + $user = $this->_user; + $user->setPassword($this->password); + $user->removePasswordResetToken(); + + return $user->save(false); + } +} diff --git a/frontend/models/SignupForm.php b/frontend/models/SignupForm.php new file mode 100755 index 0000000..f15f3a8 --- /dev/null +++ b/frontend/models/SignupForm.php @@ -0,0 +1,58 @@ + 'trim'], + ['username', 'required'], + ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], + ['username', 'string', 'min' => 2, 'max' => 255], + + ['email', 'filter', 'filter' => 'trim'], + ['email', 'required'], + ['email', 'email'], + ['email', 'string', 'max' => 255], + ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'], + + ['password', 'required'], + ['password', 'string', 'min' => 6], + ]; + } + + /** + * Signs user up. + * + * @return User|null the saved model or null if saving fails + */ + public function signup() + { + if (!$this->validate()) { + return null; + } + + $user = new User(); + $user->username = $this->username; + $user->email = $this->email; + $user->setPassword($this->password); + $user->generateAuthKey(); + + return $user->save() ? $user : null; + } +} diff --git a/frontend/runtime/.gitignore b/frontend/runtime/.gitignore new file mode 100755 index 0000000..c96a04f --- /dev/null +++ b/frontend/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/frontend/views/flow-intensity/_form.php b/frontend/views/flow-intensity/_form.php new file mode 100644 index 0000000..ba6f22e --- /dev/null +++ b/frontend/views/flow-intensity/_form.php @@ -0,0 +1,102 @@ + + +
    + + + + field($model, 'road_id') + ->dropDownList($roads) ?> + + field($model, 'region_id') + ->dropDownList($regions) ?> + + field($model, 'location') + ->textInput() ?> + + field($model, 'begin') + ->textInput() ?> + + field($model, 'end') + ->textInput() ?> + + field($model, 'road_direction_id') + ->dropDownList($road_directions) ?> + + field($model, 'settlement_id') + ->dropDownList($settlements) ?> + + field($model, 'intensity_total') + ->textInput() ?> + + field($model, 'intensity_increase') + ->textInput() ?> + + field($model, 'intensity_moto') + ->textInput() ?> + + field($model, 'intensity_moto_sidecar') + ->textInput() ?> + + field($model, 'intensity_car') + ->textInput() ?> + + field($model, 'intensity_truck_two') + ->textInput() ?> + + field($model, 'intensity_truck_two_six') + ->textInput() ?> + + field($model, 'intensity_truck_six_eight') + ->textInput() ?> + + field($model, 'intensity_truck_eight_fourteen') + ->textInput() ?> + + field($model, 'intensity_truck_fourteen') + ->textInput() ?> + + field($model, 'intensity_lorry_twelve') + ->textInput() ?> + + field($model, 'intensity_lorry_twelve_twenty') + ->textInput() ?> + + field($model, 'intensity_lorry_twenty_thirty') + ->textInput() ?> + + field($model, 'intensity_lorry_thirty') + ->textInput() ?> + + field($model, 'intensity_tractor_under_ten') + ->textInput() ?> + + field($model, 'intensity_tractor_over_ten') + ->textInput() ?> + + field($model, 'intensity_bus') + ->textInput() ?> + + field($model, 'intensity_bus_coupled') + ->textInput() ?> + +
    + isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> +
    + + + +
    diff --git a/frontend/views/flow-intensity/_search.php b/frontend/views/flow-intensity/_search.php new file mode 100644 index 0000000..96ca83d --- /dev/null +++ b/frontend/views/flow-intensity/_search.php @@ -0,0 +1,79 @@ + + + diff --git a/frontend/views/flow-intensity/create.php b/frontend/views/flow-intensity/create.php new file mode 100644 index 0000000..5fa99a1 --- /dev/null +++ b/frontend/views/flow-intensity/create.php @@ -0,0 +1,30 @@ +title = 'Створити відомість інтенсивності руху та склад транспортного потоку'; +$this->params['breadcrumbs'][] = ['label' => 'Інтенсивність руху та склад транспортного потоку', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
    + +

    title) ?>

    + + render('_form', [ + 'model' => $model, + 'roads' => $roads, + 'regions' => $regions, + 'road_directions' => $road_directions, + 'settlements' => $settlements, + ]) ?> + +
    diff --git a/frontend/views/flow-intensity/index.php b/frontend/views/flow-intensity/index.php new file mode 100644 index 0000000..b7bbe6a --- /dev/null +++ b/frontend/views/flow-intensity/index.php @@ -0,0 +1,85 @@ +title = 'Інтенсивність руху та склад транспортного потоку'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    + +

    title) ?>

    + render('_search', ['model' => $searchModel]); ?> + +

    + 'btn btn-success']) ?> +

    + $dataProvider, + 'filterModel' => null, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + [ + 'attribute' => 'road_id', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->road->name; + } + ], + [ + 'attribute' => 'region_id', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->region->name; + } + ], + [ + 'attribute' => 'location', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->getLocationString(); + } + ], + [ + 'attribute' => 'road_direction_id', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->roadDirection->direction_name; + } + ], + [ + 'attribute' => 'settlement_id', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->settlement->sign; + } + ], + [ + 'attribute' => 'date_add', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return date('d.m.Y', $model->date_add); + } + ], + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +
    diff --git a/frontend/views/flow-intensity/update.php b/frontend/views/flow-intensity/update.php new file mode 100644 index 0000000..7e35f02 --- /dev/null +++ b/frontend/views/flow-intensity/update.php @@ -0,0 +1,40 @@ +title = 'Update Flow Intensity: ' . $model->flow_intensity_id; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Flow Intensities', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->flow_intensity_id, + 'url' => [ + 'view', + 'id' => $model->flow_intensity_id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Update'; +?> +
    + +

    title) ?>

    + + render('_form', [ + 'model' => $model, + 'roads' => $roads, + 'regions' => $regions, + 'road_directions' => $road_directions, + 'settlements' => $settlements, + ]) ?> + +
    diff --git a/frontend/views/flow-intensity/view.php b/frontend/views/flow-intensity/view.php new file mode 100644 index 0000000..2fa308c --- /dev/null +++ b/frontend/views/flow-intensity/view.php @@ -0,0 +1,61 @@ +title = $model->flow_intensity_id; +$this->params['breadcrumbs'][] = ['label' => 'Flow Intensities', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
    + +

    title) ?>

    + +

    + $model->flow_intensity_id], ['class' => 'btn btn-primary']) ?> + $model->flow_intensity_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

    + + $model, + 'attributes' => [ + 'flow_intensity_id', + 'road_id', + 'region_id', + 'location', + 'begin', + 'end', + 'road_direction_id', + 'settlement_id', + 'intensity_total', + 'intensity_increase', + 'intensity_moto', + 'intensity_moto_sidecar', + 'intensity_car', + 'intensity_truck_two', + 'intensity_truck_two_six', + 'intensity_truck_six_eight', + 'intensity_truck_eight_fourteen', + 'intensity_truck_fourteen', + 'intensity_lorry_twelve', + 'intensity_lorry_twelve_twenty', + 'intensity_lorry_twenty_thirty', + 'intensity_lorry_thirty', + 'intensity_tractor_under_ten', + 'intensity_tractor_over_ten', + 'intensity_bus', + 'intensity_bus_coupled', + 'date_add', + ], + ]) ?> + +
    diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php new file mode 100755 index 0000000..c86aa9b --- /dev/null +++ b/frontend/views/layouts/main.php @@ -0,0 +1,82 @@ + +beginPage() ?> + + + + + + + <?= Html::encode($this->title) ?> + head() ?> + + +beginBody() ?> + +
    + 'My Company', + 'brandUrl' => Yii::$app->homeUrl, + 'options' => [ + 'class' => 'navbar-inverse navbar-fixed-top', + ], + ]); + $menuItems = [ + ['label' => 'Home', 'url' => ['/site/index']], + ['label' => 'About', 'url' => ['/site/about']], + ['label' => 'Contact', 'url' => ['/site/contact']], + ]; + if (Yii::$app->user->isGuest) { + $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; + } else { + $menuItems[] = '
  • ' + . Html::beginForm(['/site/logout'], 'post') + . Html::submitButton( + 'Logout (' . Yii::$app->user->identity->username . ')', + ['class' => 'btn btn-link'] + ) + . Html::endForm() + . '
  • '; + } + echo Nav::widget([ + 'options' => ['class' => 'navbar-nav navbar-right'], + 'items' => $menuItems, + ]); + NavBar::end(); + ?> + +
    + isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], + ]) ?> + + +
    +
    + +
    +
    +

    © My Company

    + +

    +
    +
    + +endBody() ?> + + +endPage() ?> diff --git a/frontend/views/map/index.php b/frontend/views/map/index.php new file mode 100755 index 0000000..3ed7b5e --- /dev/null +++ b/frontend/views/map/index.php @@ -0,0 +1,87 @@ +title = 'My Yii Application'; + $points_url = Url::to([ 'point/get' ]); + $template_url = Url::to([ 'point/add' ]); + $save_url = Url::to([ 'point/save' ]); + $snap_url = Url::to([ 'point/snap' ]); + $this->registerJs('var snap_url = "' . $snap_url . '"; var points_url = "' . $points_url . '"; var template_url = "' . $template_url . '"; var save_url = "' . $save_url . '";', $this::POS_HEAD); + MapAsset::register($this); +?> +
    +
    + +
    +
    +
      +
    • +
      + +
      + +
      +
      + road->roadType->value . '-' . str_pad($passport->road->index, 2, '0', STR_PAD_LEFT) . ': ' . floor($passport->begin) . '+' . str_pad(( ( $passport->begin - floor($passport->begin) ) * 100 ), 3, '0', STR_PAD_LEFT) . ' - ' . floor($passport->end) . '+' . str_pad(( ( $passport->end - floor($passport->end) ) * 1000 ), 3, '0', STR_PAD_LEFT); + ?> +
      + + +
      + +
      +
      +
    • +
    • +
      +
      Panel heading 2
      +
      Panel body 2
      + +
      +
    • +
    • +
      +
      Panel heading 3
      +
      Panel body 3
      + +
      +
    • +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    +
    +
    +
    +
    +
    diff --git a/frontend/views/point/_point.php b/frontend/views/point/_point.php new file mode 100644 index 0000000..d3a858c --- /dev/null +++ b/frontend/views/point/_point.php @@ -0,0 +1,43 @@ + +
    +
    + num, ['class' => 'point_num_value']); + echo Html::activeHiddenInput($model, '['.$model->num.']num'); + ?> +
    +
    + num.']km', ['class' => 'form-control km']); + ?> +
    +
    + num.']lat', ['class' => 'form-control latlng']); + ?> +
    +
    + num.']lng', ['class' => 'form-control latlng']); + ?> +
    +
    + +
    +
    +
    +
    + + +
    diff --git a/frontend/views/point/list.php b/frontend/views/point/list.php new file mode 100644 index 0000000..651aa5c --- /dev/null +++ b/frontend/views/point/list.php @@ -0,0 +1,48 @@ + +
    +
    #
    +
    Км траси
    +
    Довгота (lat)
    +
    Широта (lng)
    +
    +
    + 'passport_form', + ]); + echo Html::activeHiddenInput($road_passport, 'road_passport_id'); + echo ListView::widget([ + 'id' => 'passport_control', + 'options' => [ + 'data' => [ + 'passport_id' => $passport_id, + ], + ], + 'itemOptions' => [ + 'class' => 'passport_point_item', + ], + 'dataProvider' => $dataProvider, + 'itemView' => '_point', + 'layout' => '{items}', + 'showOnEmpty' => true, + ]); + echo Html::submitButton('Сохранить', [ + 'class' => 'btn btn-success pull-right passport_submit', + ]); + $form->end(); + ?> +
    diff --git a/frontend/views/point/row.php b/frontend/views/point/row.php new file mode 100644 index 0000000..58e2c87 --- /dev/null +++ b/frontend/views/point/row.php @@ -0,0 +1,14 @@ + +
    + render('_point', [ 'model' => $point ]); + ?> +
    diff --git a/frontend/views/road-passport/create.php b/frontend/views/road-passport/create.php new file mode 100755 index 0000000..d92ae3b --- /dev/null +++ b/frontend/views/road-passport/create.php @@ -0,0 +1,28 @@ +title = 'My Yii Application'; +?> +
    +
    + 'road-form' ]); + echo $form->field($roadpassport, 'road_id')->dropDownList($roads); + echo $form->field($roadpassport, 'region_id')->dropDownList($regions); + echo $form->field($roadpassport, 'begin')->textInput(); + echo $form->field($roadpassport, 'end')->textInput(); + echo Html::submitButton('Добавить', ['class' => 'btn btn-success']); + $form->end(); + ?> +
    +
    +
    diff --git a/frontend/views/road-passport/index.php b/frontend/views/road-passport/index.php new file mode 100755 index 0000000..5c2e38b --- /dev/null +++ b/frontend/views/road-passport/index.php @@ -0,0 +1,34 @@ +title = 'My Yii Application'; +?> +
    +
    + 'btn btn-success pull-right']); + echo GridView::widget([ + 'dataProvider' => $dataProvider, + 'columns' => [ + 'road_passport_id', + 'road.name', + 'region.name', + 'begin', + 'end', + [ + 'class' => 'yii\grid\ActionColumn', + ], + ], + ]); + echo Html::a('Добавить', ['create'], ['class' => 'btn btn-success pull-right']); + ?> +
    +
    +
    diff --git a/frontend/views/road-passport/update.php b/frontend/views/road-passport/update.php new file mode 100755 index 0000000..df08e20 --- /dev/null +++ b/frontend/views/road-passport/update.php @@ -0,0 +1,28 @@ +title = 'My Yii Application'; +?> +
    +
    + 'road-form' ]); + echo $form->field($road, 'name')->textInput(); + echo $form->field($road, 'road_type_id')->dropDownList($road_types); + echo $form->field($road, 'road_category_id')->dropDownList($road_categories); + echo $form->field($road, 'index')->textInput(); + echo Html::submitButton('Обновить', ['class' => 'btn btn-success']); + $form->end(); + ?> +
    +
    +
    diff --git a/frontend/views/road-service/_form.php b/frontend/views/road-service/_form.php new file mode 100644 index 0000000..8866503 --- /dev/null +++ b/frontend/views/road-service/_form.php @@ -0,0 +1,48 @@ + + +
    + + + + field($model, 'road_id') + ->dropDownList($roads) ?> + + field($model, 'region_id') + ->dropDownList($regions) ?> + + field($model, 'begin') + ->textInput() ?> + + field($model, 'end') + ->textInput() ?> + + field($model, 'road_direction_id') + ->dropDownList($directions) ?> + + field($model, 'organization_id') + ->dropDownList($organizations) ?> + + field($model, 'year_begin') + ->textInput() ?> + +
    + isNewRecord ? 'Додати' : 'Оновити', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> +
    + + + +
    diff --git a/frontend/views/road-service/_search.php b/frontend/views/road-service/_search.php new file mode 100644 index 0000000..a865193 --- /dev/null +++ b/frontend/views/road-service/_search.php @@ -0,0 +1,41 @@ + + + diff --git a/frontend/views/road-service/create.php b/frontend/views/road-service/create.php new file mode 100644 index 0000000..e88d6c7 --- /dev/null +++ b/frontend/views/road-service/create.php @@ -0,0 +1,30 @@ +title = 'Додати відомість обслуговування автомобільної дороги'; +$this->params['breadcrumbs'][] = ['label' => 'Обслуговування автодоріг', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
    + +

    title) ?>

    + + render('_form', [ + 'model' => $model, + 'roads' => $roads, + 'organizations' => $organizations, + 'regions' => $regions, + 'directions' => $directions, + ]) ?> + +
    diff --git a/frontend/views/road-service/index.php b/frontend/views/road-service/index.php new file mode 100644 index 0000000..4b6c642 --- /dev/null +++ b/frontend/views/road-service/index.php @@ -0,0 +1,80 @@ +title = 'Обслуговування автодоріг'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    + +

    title) ?>

    + render('_search', ['model' => $searchModel]); ?> + +

    + 'btn btn-success']) ?> +

    + $dataProvider, + 'filterModel' => null, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + [ + 'attribute' => 'road_id', + 'value' => function($model) { + return $model->road->name; + } + ], + [ + 'attribute' => 'region_id', + 'value' => function($model) { + return $model->region->name; + } + ], + [ + 'attribute' => 'begin', + 'value' => function($model) { + /** + * @var RoadService $model + */ + return $model->getBeginString(); + } + ], + [ + 'attribute' => 'end', + 'value' => function($model) { + /** + * @var RoadService $model + */ + return $model->getEndString(); + } + ], + [ + 'attribute' => 'road_direction_id', + 'value' => function($model) { + /** + * @var RoadService $model + */ + return $model->roadDirection->direction_name; + } + ], + [ + 'attribute' => 'organization_id', + 'value' => function($model) { + /** + * @var RoadService $model + */ + return $model->organization->name; + } + ], + 'year_begin', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +
    diff --git a/frontend/views/road-service/update.php b/frontend/views/road-service/update.php new file mode 100644 index 0000000..4647aec --- /dev/null +++ b/frontend/views/road-service/update.php @@ -0,0 +1,40 @@ +title = 'Оновити відомість обслуговування автомобільної дороги: ' . $model->road_service_id; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Обслуговування автодоріг', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->road_service_id, + 'url' => [ + 'view', + 'id' => $model->road_service_id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Оновити'; +?> +
    + +

    title) ?>

    + + render('_form', [ + 'model' => $model, + 'roads' => $roads, + 'organizations' => $organizations, + 'regions' => $regions, + 'directions' => $directions, + ]) ?> + +
    diff --git a/frontend/views/road-service/view.php b/frontend/views/road-service/view.php new file mode 100644 index 0000000..171d0c3 --- /dev/null +++ b/frontend/views/road-service/view.php @@ -0,0 +1,99 @@ +title = $model->getTitle(); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Обслуговування автодоріг', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
    + +

    title) ?>

    + +

    + $model->road_service_id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->road_service_id, + ], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

    + +
    +
    + Міністерство інфраструктури України
    + ДЕРЖАВНЕ АГЕНСТВО
    + АВТОМОБІЛЬНИХ ДОГІР УКРАЇНИ +
    +
    + Служба автомобільних доріг у region->name; ?> області +
    +
    +
    +

    Відомість

    +

    обслуговування автодоріг

    +

    на автомобільній дорозі

    +

    + title; ?> +

    +

    + road->roadType->definition; ?> + значення станом на + р. +

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Місцезнаходження, км+getAttributeLabel('road_direction_id'); ?>getAttributeLabel('organization_id'); ?>getAttributeLabel('year_begin'); ?>
    Початоккінець
    12345
    getBeginString(); ?>getEndString(); ?>roadDirection->direction_name; ?>organization->name; ?>year_begin; ?>
    +
    +
    +
    + Склав р. +
    +
    + Начальник р. +
    +
    +
    + +
    diff --git a/frontend/views/road/create.php b/frontend/views/road/create.php new file mode 100755 index 0000000..75868b6 --- /dev/null +++ b/frontend/views/road/create.php @@ -0,0 +1,28 @@ +title = 'My Yii Application'; +?> +
    +
    + 'road-form' ]); + echo $form->field($road, 'name')->textInput(); + echo $form->field($road, 'road_type_id')->dropDownList($road_types); + echo $form->field($road, 'road_category_id')->dropDownList($road_categories); + echo $form->field($road, 'index')->textInput(); + echo Html::submitButton('Добавить', ['class' => 'btn btn-success']); + $form->end(); + ?> +
    +
    +
    diff --git a/frontend/views/road/flow-intensity.php b/frontend/views/road/flow-intensity.php new file mode 100755 index 0000000..c35c335 --- /dev/null +++ b/frontend/views/road/flow-intensity.php @@ -0,0 +1,128 @@ +title = $road->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Дороги', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $this->title, + 'url' => [ + 'view', + 'id' => $road->road_id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Відомість інтенсивності руху та склад транспортного потоку - ' . ucfirst($region->name). ' область'; +?> +
    +
    + Міністрество транспорту України
    + Державна служба автомобільних доріг
    + України +
    +
    + Служба автомобільних доріг у name; ?> області +
    +
    +
    +

    Відомість

    +

    інтенсивності руху та склад транспортного потоку

    +

    на автомобільній дорозі

    +

    name; ?>

    +

    roadType->definition;?> значення станом на р.

    +
    +
    + $dataProvider, + 'layout' => "{items}", + 'columns' => [ + [ + 'attribute' => 'location', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->getLocationString(); + } + ], + [ + 'attribute' => 'begin', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->getBeginString(); + } + ], + [ + 'attribute' => 'end', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->getEndString(); + } + ], + [ + 'attribute' => 'road_direction_id', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->roadDirection->direction_name; + } + ], + [ + 'attribute' => 'settlement_id', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return $model->settlement->sign; + } + ], + 'intensity_total', + 'intensity_increase', + 'intensity_moto', + 'intensity_moto_sidecar', + 'intensity_car', + 'intensity_truck_two', + 'intensity_truck_two_six', + 'intensity_truck_six_eight', + 'intensity_truck_eight_fourteen', + 'intensity_truck_fourteen', + 'intensity_lorry_twelve', + 'intensity_lorry_twelve_twenty', + 'intensity_lorry_twenty_thirty', + 'intensity_lorry_thirty', + 'intensity_tractor_under_ten', + 'intensity_tractor_over_ten', + 'intensity_bus', + 'intensity_bus_coupled', + [ + 'attribute' => 'date_add', + 'value' => function($model) { + /** + * @var FlowIntensity $model + */ + return date('d.m.Y', $model->date_add); + } + ], + ], + ]); + ?> +
    +
    diff --git a/frontend/views/road/index.php b/frontend/views/road/index.php new file mode 100755 index 0000000..0b79167 --- /dev/null +++ b/frontend/views/road/index.php @@ -0,0 +1,34 @@ +title = 'My Yii Application'; +?> +
    +
    + 'btn btn-success pull-right']); + echo GridView::widget([ + 'dataProvider' => $dataProvider, + 'columns' => [ + 'road_id', + 'name', + 'roadCategory.value', + 'roadType.value', + 'index', + [ + 'class' => 'yii\grid\ActionColumn', + ], + ], + ]); + echo Html::a('Добавить', ['create'], ['class' => 'btn btn-success pull-right']); + ?> +
    +
    +
    diff --git a/frontend/views/road/settlement.php b/frontend/views/road/settlement.php new file mode 100755 index 0000000..7f31c16 --- /dev/null +++ b/frontend/views/road/settlement.php @@ -0,0 +1,95 @@ +title = $road->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Дороги', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $this->title, + 'url' => [ + 'view', + 'id' => $road->road_id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Відомість адресної прив\'язки населених пунктів - ' . ucfirst($region->name). ' область'; +?> +
    +
    + Міністрество транспорту України
    + Державна служба автомобільних доріг
    + України +
    +
    + Служба автомобільних доріг у name; ?> області +
    +
    +
    +

    Відомість

    +

    адресної прив'язки населених пунктів

    +

    на автомобільній дорозі

    +

    name; ?>

    +

    roadType->definition;?> значення станом на р.

    +
    +
    + $dataProvider, + 'layout' => "{items}", + 'columns' => [ + [ + 'attribute' => 'begin', + 'value' => function($model) { + /** + * @var SettlementAddressLink $model + */ + return $model->getBeginString(); + } + ], + [ + 'attribute' => 'end', + 'value' => function($model) { + /** + * @var SettlementAddressLink $model + */ + return $model->getEndString(); + } + ], + [ + 'attribute' => 'settlement_location_id', + 'value' => function($model) { + /** + * @var SettlementAddressLink $model + */ + return $model->settlementLocation->value; + } + ], + [ + 'attribute' => 'settlement_id', + 'value' => function($model) { + /** + * @var SettlementAddressLink $model + */ + return $model->settlement->sign; + } + ], + 'distance', + ] + ]) + ?> +
    +
    diff --git a/frontend/views/road/update.php b/frontend/views/road/update.php new file mode 100755 index 0000000..75868b6 --- /dev/null +++ b/frontend/views/road/update.php @@ -0,0 +1,28 @@ +title = 'My Yii Application'; +?> +
    +
    + 'road-form' ]); + echo $form->field($road, 'name')->textInput(); + echo $form->field($road, 'road_type_id')->dropDownList($road_types); + echo $form->field($road, 'road_category_id')->dropDownList($road_categories); + echo $form->field($road, 'index')->textInput(); + echo Html::submitButton('Добавить', ['class' => 'btn btn-success']); + $form->end(); + ?> +
    +
    +
    diff --git a/frontend/views/road/view.php b/frontend/views/road/view.php new file mode 100755 index 0000000..6de75d4 --- /dev/null +++ b/frontend/views/road/view.php @@ -0,0 +1,96 @@ +title = $road->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Дороги', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
    +
    + $road, + 'attributes' => [ + 'name', + [ + 'label' => 'Тип дороги', + 'value' => $road->roadType->value . ' (' . $road->roadType->definition . ')', + ], + [ + 'label' => 'Позначення', + 'value' => $road->roadType->value . '-' . str_pad($road->index, 2, '0', STR_PAD_LEFT), + ], + ], + ]); + ?> +
    +
    +

    Відомості:

    +
    + +
    + +
    + name . ' область', [ + 'settlement', + 'id' => $road->road_id, + 'region_id' => $region->region_id, + ]); + } + ?> +
    + +
    +
    +
    + +
    + +
    + name . ' область', [ + 'flow-intensity', + 'id' => $road->road_id, + 'region_id' => $region->region_id, + ]); + } + ?> +
    + +
    +
    +
    +
    +
    diff --git a/frontend/views/settlement-address-link/_form.php b/frontend/views/settlement-address-link/_form.php new file mode 100644 index 0000000..c1acd21 --- /dev/null +++ b/frontend/views/settlement-address-link/_form.php @@ -0,0 +1,48 @@ + + + diff --git a/frontend/views/settlement-address-link/_search.php b/frontend/views/settlement-address-link/_search.php new file mode 100644 index 0000000..f1f9245 --- /dev/null +++ b/frontend/views/settlement-address-link/_search.php @@ -0,0 +1,41 @@ + + + diff --git a/frontend/views/settlement-address-link/create.php b/frontend/views/settlement-address-link/create.php new file mode 100644 index 0000000..683e183 --- /dev/null +++ b/frontend/views/settlement-address-link/create.php @@ -0,0 +1,33 @@ +title = 'Створити адресну прив\'язку доріг'; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Адресна прив\'язка доріг', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> + diff --git a/frontend/views/settlement-address-link/index.php b/frontend/views/settlement-address-link/index.php new file mode 100644 index 0000000..b04561f --- /dev/null +++ b/frontend/views/settlement-address-link/index.php @@ -0,0 +1,69 @@ +title = 'Адресна прив\'язка доріг'; +$this->params['breadcrumbs'][] = $this->title; +?> + diff --git a/frontend/views/settlement-address-link/update.php b/frontend/views/settlement-address-link/update.php new file mode 100644 index 0000000..a788b40 --- /dev/null +++ b/frontend/views/settlement-address-link/update.php @@ -0,0 +1,40 @@ +title = 'Update Settlement Address Link: ' . $model->settlement_address_link_id; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Settlement Address Links', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->settlement_address_link_id, + 'url' => [ + 'view', + 'id' => $model->settlement_address_link_id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Update'; +?> + diff --git a/frontend/views/settlement-address-link/view.php b/frontend/views/settlement-address-link/view.php new file mode 100644 index 0000000..7d1d5e5 --- /dev/null +++ b/frontend/views/settlement-address-link/view.php @@ -0,0 +1,42 @@ +title = $model->settlement_address_link_id; +$this->params['breadcrumbs'][] = ['label' => 'Settlement Address Links', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> + diff --git a/frontend/views/site/about.php b/frontend/views/site/about.php new file mode 100755 index 0000000..8eb0764 --- /dev/null +++ b/frontend/views/site/about.php @@ -0,0 +1,16 @@ +title = 'About'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    +

    title) ?>

    + +

    This is the About page. You may modify the following file to customize its content:

    + + +
    diff --git a/frontend/views/site/contact.php b/frontend/views/site/contact.php new file mode 100755 index 0000000..dcad18f --- /dev/null +++ b/frontend/views/site/contact.php @@ -0,0 +1,45 @@ +title = 'Contact'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    +

    title) ?>

    + +

    + If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. +

    + +
    +
    + 'contact-form']); ?> + + field($model, 'name')->textInput(['autofocus' => true]) ?> + + field($model, 'email') ?> + + field($model, 'subject') ?> + + field($model, 'body')->textArea(['rows' => 6]) ?> + + field($model, 'verifyCode')->widget(Captcha::className(), [ + 'template' => '
    {image}
    {input}
    ', + ]) ?> + +
    + 'btn btn-primary', 'name' => 'contact-button']) ?> +
    + + +
    +
    + +
    diff --git a/frontend/views/site/error.php b/frontend/views/site/error.php new file mode 100755 index 0000000..0ba2574 --- /dev/null +++ b/frontend/views/site/error.php @@ -0,0 +1,27 @@ +title = $name; +?> +
    + +

    title) ?>

    + +
    + +
    + +

    + The above error occurred while the Web server was processing your request. +

    +

    + Please contact us if you think this is a server error. Thank you. +

    + +
    diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php new file mode 100755 index 0000000..2bbbc80 --- /dev/null +++ b/frontend/views/site/index.php @@ -0,0 +1,64 @@ +title = 'My Yii Application'; + $this->registerJsFile('/js/test.js'); +?> +
    + +
    +

    Congratulations!

    + +

    You have successfully created your Yii-powered application.

    + +

    + Get started with Yii +

    +
    + +
    + +
    +
    +

    Heading

    + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

    + +

    + Yii Documentation » +

    +
    +
    +

    Heading

    + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

    + +

    + Yii Forum » +

    +
    +
    +

    Heading

    + +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

    + +

    + Yii Extensions » +

    +
    +
    + +
    +
    diff --git a/frontend/views/site/login.php b/frontend/views/site/login.php new file mode 100755 index 0000000..56ea98e --- /dev/null +++ b/frontend/views/site/login.php @@ -0,0 +1,39 @@ +title = 'Login'; +$this->params['breadcrumbs'][] = $this->title; +?> + diff --git a/frontend/views/site/requestPasswordResetToken.php b/frontend/views/site/requestPasswordResetToken.php new file mode 100755 index 0000000..9f6822e --- /dev/null +++ b/frontend/views/site/requestPasswordResetToken.php @@ -0,0 +1,31 @@ +title = 'Request password reset'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    +

    title) ?>

    + +

    Please fill out your email. A link to reset password will be sent there.

    + +
    +
    + 'request-password-reset-form']); ?> + + field($model, 'email')->textInput(['autofocus' => true]) ?> + +
    + 'btn btn-primary']) ?> +
    + + +
    +
    +
    diff --git a/frontend/views/site/resetPassword.php b/frontend/views/site/resetPassword.php new file mode 100755 index 0000000..36ef452 --- /dev/null +++ b/frontend/views/site/resetPassword.php @@ -0,0 +1,31 @@ +title = 'Reset password'; +$this->params['breadcrumbs'][] = $this->title; +?> +
    +

    title) ?>

    + +

    Please choose your new password:

    + +
    +
    + 'reset-password-form']); ?> + + field($model, 'password')->passwordInput(['autofocus' => true]) ?> + +
    + 'btn btn-primary']) ?> +
    + + +
    +
    +
    diff --git a/frontend/views/site/signup.php b/frontend/views/site/signup.php new file mode 100755 index 0000000..de9dad6 --- /dev/null +++ b/frontend/views/site/signup.php @@ -0,0 +1,35 @@ +title = 'Signup'; +$this->params['breadcrumbs'][] = $this->title; +?> + diff --git a/frontend/views/statement/index.php b/frontend/views/statement/index.php new file mode 100755 index 0000000..8121902 --- /dev/null +++ b/frontend/views/statement/index.php @@ -0,0 +1,105 @@ +registerJs("var points_url = '".$points_url."';", $this::POS_HEAD); + $this->title = 'My Yii Application'; + StatementAsset::register($this); +?> +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +

    + Відомість +

    +

    + автомобільних доріг станом на + +

    + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'road.index', + 'value' => function($model, $key, $index, $column) { + /** + * @var RoadPassport $model + */ + $value = ''; + $value .= $model->road->roadType->value; + $value .= '-'; + $value .= str_pad($model->road->index, 2, '0', STR_PAD_LEFT); + return $value; + }, + 'label' => 'Державний індекс та номер', + ], + [ + 'attribute' => 'road.name', + ], + [ + 'attribute' => 'road.roadType.definition', + 'label' => 'Народно-господарське значення', + ], + [ + 'attribute' => 'begin', + 'value' => function($model, $key, $index, $column) { + /** + * @var RoadPassport $model + */ + $value = floor($model->begin) . '+'; + $value .= str_pad(( $model->begin - floor($model->begin) ) * 1000, 3, '0', STR_PAD_LEFT); + return $value; + }, + ], + [ + 'attribute' => 'end', + 'value' => function($model, $key, $index, $column) { + /** + * @var RoadPassport $model + */ + $value = floor($model->end) . '+'; + $value .= str_pad(( $model->end - floor($model->end) ) * 1000, 3, '0', STR_PAD_LEFT); + return $value; + }, + ], + [ + 'class' => 'yii\grid\Column', + 'header' => 'Траса', + 'content' => function($model, $key, $index, $column) { + return Html::tag('span', '', [ + 'class' => 'glyphicon glyphicon-road show-route', + 'data' => [ + 'key' => $key, + ], + ]); + }, + ], + ], + ]) + ?> +
    +
    +
    +
    diff --git a/frontend/web/.gitignore b/frontend/web/.gitignore new file mode 100755 index 0000000..25c74e6 --- /dev/null +++ b/frontend/web/.gitignore @@ -0,0 +1,2 @@ +/index.php +/index-test.php diff --git a/frontend/web/assets/.gitignore b/frontend/web/assets/.gitignore new file mode 100755 index 0000000..d6b7ef3 --- /dev/null +++ b/frontend/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/frontend/web/css/site.css b/frontend/web/css/site.css new file mode 100755 index 0000000..718f8bb --- /dev/null +++ b/frontend/web/css/site.css @@ -0,0 +1,137 @@ +html, +body { + height: 100%; +} + +.wrap { + min-height: 100%; + height: auto; + margin: 0 auto -60px; + padding: 0 0 60px; +} + +.wrap > .container { + padding: 70px 15px 20px; +} + +.footer { + height: 60px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + padding-top: 20px; +} + +.jumbotron { + text-align: center; + background-color: transparent; +} + +.jumbotron .btn { + font-size: 21px; + padding: 14px 24px; +} + +.not-set { + color: #c55; + font-style: italic; +} + +/* add sorting icons to gridview sort links */ +a.asc:after, a.desc:after { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + padding-left: 5px; +} + +a.asc:after { + content: "\e151"; +} + +a.desc:after { + content: "\e152"; +} + +.sort-numerical a.asc:after { + content: "\e153"; +} + +.sort-numerical a.desc:after { + content: "\e154"; +} + +.sort-ordinal a.asc:after { + content: "\e155"; +} + +.sort-ordinal a.desc:after { + content: "\e156"; +} + +.grid-view td { + white-space: nowrap; +} + +.grid-view .filters input, +.grid-view .filters select { + min-width: 50px; +} + +.hint-block { + display: block; + margin-top: 5px; + color: #999; +} + +.error-summary { + color: #a94442; + background: #fdf7f7; + border-left: 3px solid #eed3d7; + padding: 10px 20px; + margin: 0 0 15px 0; +} + +/* align the logout "link" (button in form) of the navbar */ +.nav > li > form { + padding: 8px; +} + +@media(max-width:768px) { + .nav li > form { + padding: 3px; + } +} + +.nav > li > form > button:hover { + text-decoration: none; +} +.top_control { + height: 50px; +} +#map { + width: 100%; + height: 500px; +} +.controls { + position: absolute; + z-index: 999; + width: 20%; + min-width: 150px; +} +.passport_submit { + min-width: 100px; + min-height: 30px; + background-position: 50%; + background-size: cover; +} +.passport_submit.loading { + font-size: 0; + background-image: url('/images/preloader.gif'); +} +.statement-table th { + text-align: center; +} \ No newline at end of file diff --git a/frontend/web/favicon.ico b/frontend/web/favicon.ico new file mode 100755 index 0000000..580ed73 Binary files /dev/null and b/frontend/web/favicon.ico differ diff --git a/frontend/web/images/earth-preloader.gif b/frontend/web/images/earth-preloader.gif new file mode 100644 index 0000000..865efb6 Binary files /dev/null and b/frontend/web/images/earth-preloader.gif differ diff --git a/frontend/web/images/preloader.gif b/frontend/web/images/preloader.gif new file mode 100644 index 0000000..21b4b71 Binary files /dev/null and b/frontend/web/images/preloader.gif differ diff --git a/frontend/web/js/handlers.js b/frontend/web/js/handlers.js new file mode 100644 index 0000000..495c4f9 --- /dev/null +++ b/frontend/web/js/handlers.js @@ -0,0 +1,133 @@ +// road_passports wrapper +var road_passports = []; +if(points_url !== undefined) +{ + $(document).on( + 'click', '.road_passport_list_item .edit_path', function() + { + var id = $(this).data('passport-id'); + $.get( + points_url, {id : id}, function(data) + { + $('#control').empty().append(data.result.html); + road_passports[id] = new google.maps.MVCArray(); + if(data.result.passport) { + road_passports[id].model = createPassportModel(); + fillPassportModel(id, data.result.passport); + } + road_passports[id].setAt(0, undefined); + map.addListener('click', addLatLng); + clearMarkers(); + $.each( + data.result.points, function(index, value) + { + road_passports[id].setAt(index, value); + var marker = new google.maps.Marker( + { + position : { + lat : parseFloat(value.lat), + lng : parseFloat(value.lng) + }, + title : '#' + parseInt(value.num), + map : map, + draggable : true, + label : parseInt(value.num).toString(10) + } + ); + markers.push(marker); + marker.addListener('dragend', dragend); + } + ); + repaint(); + fitBounds(); + } + ); + } + ); +} +$(document).on( + 'change', '#passport_form input.latlng', function(e) + { + e.preventDefault(); + var container = $(this).parents('.passport_point_item').first(); + var key = $(container).data('key'); + var lat = parseFloat($('#point-' + key + '-lat').val()); + var lng = parseFloat($('#point-' + key + '-lng').val()); + markers.getAt(key - 1).setPosition( + { + lat : lat, + lng : lng + } + ); + repaint(); + updateRow(key, {lat: lat, lng: lng}); + } +); +$(document).on( + 'change', '#passport_form input.km', function(e) + { + e.preventDefault(); + var container = $(this).parents('.passport_point_item').first(); + var key = $(container).data('key'); + updateRow(key, {km: $(this).val()}); + } +); +$(document).on( + 'submit', '#passport_form', function(e) + { + e.preventDefault(); + var submit = $(this).find('.passport_submit'); + $(submit).addClass('loading'); + $.post( + save_url, $(this).serialize(), function(data) { + $(submit).popover({ + content: data.result.message, + placement: 'top' + }); + } + ).fail(function(data) { + $(submit).popover({ + content: data.responseText, + placement: 'top' + }); + }).always(function(data) { + $(submit).removeClass('loading').popover('show'); + $('body, html').on('click', function() { + $(submit).popover('destroy'); + }); + }); + } +); + +$(document).on('click', '#passport_control .passport_point_remove', function() { + var container = $(this).parents('.passport_point_item').first(); + var wrapper = $(container).parents('#passport_control'); + var index = $(container).data('key'); + var passport_id = $(wrapper).data('passport_id'); + deleteRow(passport_id, index); +}); + +$(document).on('click', '#passport_control .passport_point_add', function() { + var container = $(this).parents('.passport_point_item').first(); + var index = $(container).data('key'); + map.lastIndex = index; + google.maps.event.clearListeners(map, 'click'); + map.addListener('click', addAt); + showNotifier('Натисніть на карті, щоб додати точку'); + showMap(); +}); +$(document).on('click', '#passport_control .control', function() { + $(this).parents('.point_control.collapse').collapse('hide'); +}); +$(document).on('keyup keypress', '#passport_form input', function(e) { + var keyCode = e.keyCode || e.which; + if(keyCode == 13) { + e.preventDefault(); + $(this).trigger('change'); + } +}); +$(document).on('click', '#snap_me', function() { + if(markers.length) { + runSnapToRoad(); + } +}); \ No newline at end of file diff --git a/frontend/web/js/map.js b/frontend/web/js/map.js new file mode 100644 index 0000000..471f99f --- /dev/null +++ b/frontend/web/js/map.js @@ -0,0 +1,594 @@ +// Current map variable Map +var map; +// Current path variable Polyline +var poly; +// Current markers variable MVCArray +var markers; +var notifier; + +// Map initialize +function initMap() +{ + map = new google.maps.Map( + document.getElementById('map'), { + zoom : 15, + center : { + lat : 50.403757, + lng : 30.641328 + } + } + ); + createNotifier(map); + poly = new google.maps.Polyline( + { + strokeColor : '#000000', + strokeOpacity : 1.0, + strokeWeight : 3 + } + ); + poly.setMap(map); + markers = new google.maps.MVCArray(); +} + +/** + * Map click handler + * + * @param event google.maps.LatLng + */ +function addLatLng(event) +{ + var path = poly.getPath(); + path.push(event.latLng); + var marker = new google.maps.Marker( + { + position : event.latLng, + title : '#' + path.getLength(), + map : map, + draggable : true, + label : path.getLength().toString(10) + } + ); + markers.push(marker); + var passport_id = $('#passport_control').data('passport_id'); + addMarkerToPassport(passport_id, road_passports[passport_id].getLength(), event.latLng); + marker.addListener('dragend', dragend); +} + +function addAt(event) +{ + var index = parseInt(map.lastIndex); + var passport_id = $('#passport_control').data('passport_id'); + reCalc(index - 1, 1); + addMarkerToPassport(passport_id, index, event.latLng); + reCalcucaleDistance(passport_id, index + 1); + createMarkers(passport_id); + google.maps.event.clearListeners(map, 'click'); + map.addListener('click', addLatLng); + hideNotifier(true); +} + +/** + * Fill road passport and table with new element + * + * @param passport_id integer Road passport ID + * @param index integer Poisition in path + * @param latLng LatLng object + */ +function addMarkerToPassport(passport_id, index, latLng) +{ + var object = createPassportObject(); + object.lat = latLng.lat(); + object.lng = latLng.lng(); + object.num = index; + object.road_passport_id = passport_id; + if(index <= 1 && road_passports[passport_id].model.begin) + { + object.km = road_passports[passport_id].model.begin; + } else + { + var prev = road_passports[passport_id].getAt(index - 1); + object.km = (calculateDistance( + new google.maps.LatLng( + { + lat : parseFloat(prev.lat), + lng : parseFloat(prev.lng) + } + ), latLng + ) + parseFloat(prev.km)).toFixed(3); + } + road_passports[passport_id].insertAt(index, object); + addRow(passport_id, index, latLng, object.km); +} + +/** + * Dragend event handler: repaint curve and update row + * + * @param event google.maps.LatLng + */ +function dragend(event) +{ + var index = parseInt(this.label); + repaint(event); + updateRow( + index, { + lat : event.latLng.lat(), + lng : event.latLng.lng() + } + ); + +} + +/** + * Add row to ( the end of ) the table + * + * @param passport_id integer Road passport ID + * @param index integer New row num + * @param latLng LatLng object of new point + */ +function addRow(passport_id, index, latLng, km) +{ + $.get( + template_url, { + road_passport_id : passport_id, + lat : latLng.lat(), + lng : latLng.lng(), + num : index, + km : km + }, function(data) + { + if(!data.error) + { + var container = $('#passport_control'); + var target = $(container).find('.passport_point_item[data-key=' + (index + 1) + ']'); + if(target.length > 0) + { + $(target).before(data.result.html); + } else + { + $(container).append(data.result.html); + } + } else + { + + } + } + ); +} + +/** + * Repaint path from current markers + * + * @param event + */ +function repaint(event) +{ + var path = new google.maps.MVCArray(); + markers.forEach( + function(element, index) + { + path.push(element.getPosition()); + } + ); + poly.setPath(path); +} + +/** + * Clear all current markers + */ +function clearMarkers() +{ + markers.forEach( + function(element, index) + { + element.setMap(null); + } + ); + markers = new google.maps.MVCArray(); +} + +/** + * Create empty object for road passport point + * + * @returns {{km: null, lat: null, lng: null, num: null, point_id: null, road_passport_id: null}} + */ +function createPassportObject() +{ + return { + km : null, + lat : null, + lng : null, + num : null, + point_id : null, + road_passport_id : null + }; +} + +/** + * Create empty object for road passport model + */ +function createPassportModel() +{ + return { + begin : null, + end : null, + region_id : null, + road_id : null, + road_passport_id : null, + }; +} + +/** + * Replace all rows starting with @start param on @indent rows + * + * @param start + * @param indent + */ +function reCalc(start, indent) +{ + var container = $('#passport_control'); + var passport_id = parseInt($(container).data('passport_id')); + if(start > 0) + { + elements = $(container).find('[data-key=' + start + '] ~ [data-key]'); + } else + { + elements = $(container).find('[data-key]'); + } + var old_name; + var new_name; + var old_id; + var new_id; + $.each( + elements, function(index, value) + { + var old_index = $(value).data('key'); + var new_index = old_index + indent; + $(value).attr('data-key', new_index); + $(value).data('key', new_index); + $(value).find('.point_num_value').text(new_index); + $.each( + $(value).find('input'), function(i, v) + { + old_name = $(v).attr('name'); + new_name = old_name.replace(/Point\[\d+\]/, 'Point[' + new_index + ']'); + $(v).attr('name', new_name); + old_id = $(v).attr('id'); + new_id = old_id.replace(/point-\d+/, 'point-' + new_index); + $(v).attr('id', new_id); + } + ); + $(value).find('input[name="Point[' + new_index + '][num]"]').val(new_index); + $(value).find('input[name="Point[' + new_index + '][km]"]').val(NaN); + $(value).find('.point-menu>a').attr('href', '#pointControl' + new_index); + $(value).find('.point-menu>a').attr('aria-controls', 'pointControl' + new_index); + $(value).find('.point_control').attr('id', 'pointControl' + new_index); + } + ); +} + +/** + * Update @index's row with new @data + * Supported data: + * * lat + * * lng + * + * @param index integer + * @param data object + */ +function updateRow(index, data) +{ + index = parseInt(index); + var container = $('#passport_control'); + var passport_id = parseInt($(container).data('passport_id')); + var element = $(container).find('[data-key=' + index + ']'); + if(data.lat) + { + $(element).find('#point-' + index + '-lat').val(data.lat); + road_passports[passport_id].getAt(index).lat = data.lat; + } + if(data.lng) + { + $(element).find('#point-' + index + '-lng').val(data.lng); + road_passports[passport_id].getAt(index).lng = data.lng; + } + if(index <= 1) + { + var km; + km = road_passports[passport_id].model.begin; + road_passports[passport_id].getAt(index).km = km; + $('#point-' + index + '-km').val(km); + reCalcucaleDistance(passport_id, index + 1); + } else + { + if(data.km) + { + $(element).find('#point-' + index + '-km').val(data.km); + road_passports[passport_id].getAt(index).km = data.km; + reCalcucaleDistance(passport_id, index + 1); + } else + { + reCalcucaleDistance(passport_id, index); + } + } +} + +/** + * Calculate distance between tow LatLng points + * + * @param LatLngA LatLng + * @param LatLngB LatLng + * @returns integer + */ +function calculateDistance(LatLngA, LatLngB) +{ + return parseFloat((google.maps.geometry.spherical.computeDistanceBetween(LatLngA, LatLngB) / 1000).toFixed(3)); +} + +/** + * Fill current markers variable with markers for @passport_id + * + * @param passport_id int Road passport ID + */ +function createMarkers(passport_id) +{ + clearMarkers(); + road_passports[passport_id].forEach( + function(element, index) + { + if(element !== undefined) + { + var marker = new google.maps.Marker( + { + position : { + lat : parseFloat(element.lat), + lng : parseFloat(element.lng) + }, + title : '#' + parseInt(index), + map : map, + draggable : true, + label : parseInt(index).toString(10) + } + ); + markers.push(marker); + marker.addListener('dragend', dragend); + repaint(); + } + } + ); +} + +function deleteRow(passport_id, index) +{ + index = parseInt(index); + var container = $('#passport_control'); + var element = $(container).find('.passport_point_item[data-key=' + index + ']'); + reCalc(index, -1); + $(element).remove(); + road_passports[passport_id].removeAt(index); + updateRow(index, {}); + reCalcucaleDistance(passport_id, index + 1); + createMarkers(passport_id); + repaint(); +} + +function showMap() +{ + var body = $('html, body'); + var coords = getMapCoords(); + body.stop().animate({scrollTop : (coords.top - 50)}, 2000, 'swing'); +} + +function getMapCoords() +{ + var container = map.getDiv(); + return $(container).offset(); +} + +function createNotifier(map) +{ + var container = document.createElement('div'); + container.id = 'map_notifier'; + container.style.display = 'none'; + + var wrapper = document.createElement('div'); + wrapper.style.backgroundColor = '#fff'; + wrapper.style.border = '2px solid #fff'; + wrapper.style.borderRadius = '3px'; + wrapper.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)'; + wrapper.style.cursor = 'pointer'; + wrapper.style.marginBottom = '22px'; + wrapper.style.textAlign = 'center'; + container.appendChild(wrapper); + + // Set CSS for the control interior. + var text = document.createElement('div'); + text.style.color = 'rgb(25,25,25)'; + text.style.fontFamily = 'Roboto,Arial,sans-serif'; + text.style.fontSize = '16px'; + text.style.lineHeight = '38px'; + text.style.paddingLeft = '5px'; + text.style.paddingRight = '5px'; + text.className = 'map_notifier_text'; + wrapper.appendChild(text); + container.index = 1; + map.controls[google.maps.ControlPosition.TOP_CENTER].push(container); +} + +function showNotifier(message) +{ + var container = $('#map_notifier'); + if(message) + { + setNotifier(message); + } + $(container).show(); +} + +function hideNotifier(clear) +{ + var container = $('#map_notifier'); + $(container).hide(); + if(clear) + { + setNotifier(''); + } +} + +function setNotifier(message) +{ + var container = $('#map_notifier'); + var text = $(container).find('.map_notifier_text'); + $(text).text(message); +} + +function fillPassportModel(passport_id, data) +{ + passport_id = parseInt(passport_id); + if(!road_passports[passport_id]) + { + return false; + } + if(data.begin) + { + road_passports[passport_id].model.begin = parseFloat(data.begin); + } + if(data.end) + { + road_passports[passport_id].model.end = parseFloat(data.end); + } + if(data.region_id) + { + road_passports[passport_id].model.region_id = parseFloat(data.region_id); + } + if(data.road_id) + { + road_passports[passport_id].model.road_id = parseFloat(data.road_id); + } + if(data.road_passport_id) + { + road_passports[passport_id].model.road_passport_id = parseFloat(data.road_passport_id); + } + return true; +} + +function reCalcucaleDistance(passport_id, start) +{ + start = parseInt(start); + var passport = road_passports[passport_id]; + var prev; + var next; + for(var i = start; i < passport.getLength(); i++) + { + prev = passport.getAt(i - 1); + next = passport.getAt(i); + next.km = (calculateDistance( + new google.maps.LatLng( + { + lat : parseFloat(prev.lat), + lng : parseFloat(prev.lng) + } + ), new google.maps.LatLng( + { + lat : parseFloat(next.lat), + lng : parseFloat(next.lng) + } + ) + ) + parseFloat(prev.km)).toFixed(3); + road_passports[passport_id].setAt(i, next); + $('#point-' + i + '-km').val(next.km); + } +} + +function fitBounds() +{ + var bounds = new google.maps.LatLngBounds(); + for(var i = 0; i < markers.getLength(); i++) + { + bounds.extend(markers.getAt(i).getPosition()); + } + map.fitBounds(bounds); +} +// var placeIdArray = []; +// var polylines = []; +// var snappedCoordinates = []; +function runSnapToRoad() +{ + var id = $('#passport_control').data('passport_id'); + id = parseInt(id); + if(!markers.length) + { + return false; + } + var pathValues = []; + for(var i = 0; i < markers.length; i++) + { + pathValues.push(markers.getAt(i).getPosition().toUrlValue()); + } + $.get( + '/frontend/web/point/snap', { + path : pathValues.join('|'), + road_passport_id : id + }, function(data) + { + $('#control').empty().append(data.result.html); + road_passports[id] = new google.maps.MVCArray(); + if(data.result.passport) { + road_passports[id].model = createPassportModel(); + fillPassportModel(id, data.result.passport); + } + road_passports[id].setAt(0, undefined); + clearMarkers(); + $.each( + data.result.points, function(index, value) + { + road_passports[id].setAt(index, value); + var marker = new google.maps.Marker( + { + position : { + lat : parseFloat(value.lat), + lng : parseFloat(value.lng) + }, + title : '#' + parseInt(value.num), + map : map, + draggable : true, + label : parseInt(value.num).toString(10) + } + ); + markers.push(marker); + marker.addListener('dragend', dragend); + } + ); + repaint(); + fitBounds(); + reCalcucaleDistance(id, 2); + } + ); + // $.get('https://roads.googleapis.com/v1/snapToRoads', { + // interpolate: true, + // key: apiKey, + // path: pathValues.join('|') + // }, function(data) { + // processSnapToRoadResponse(data); + // drawSnappedPolyline(); + // }); +} +// function processSnapToRoadResponse(data) { +// snappedCoordinates = []; +// placeIdArray = []; +// for (var i = 0; i < data.snappedPoints.length; i++) { +// var latlng = new google.maps.LatLng( +// data.snappedPoints[i].location.latitude, +// data.snappedPoints[i].location.longitude); +// snappedCoordinates.push(latlng); +// placeIdArray.push(data.snappedPoints[i].placeId); +// } +// } +// function drawSnappedPolyline() { +// var snappedPolyline = new google.maps.Polyline({ +// path: snappedCoordinates, +// strokeColor: 'black', +// strokeWeight: 3 +// }); +// snappedPolyline.setMap(map); +// polylines.push(snappedPolyline); +// } diff --git a/frontend/web/js/road.js b/frontend/web/js/road.js new file mode 100644 index 0000000..80c316e --- /dev/null +++ b/frontend/web/js/road.js @@ -0,0 +1,164 @@ +var apiKey = 'AIzaSyCaeB8Lppsl-JqjsGWVHxxMQ3WqU8vGlOQ'; + +var map; +var drawingManager; +var placeIdArray = []; +var polylines = []; +var snappedCoordinates = []; + +function initialize() { + var mapOptions = { + zoom: 17, + center: {lat: -33.8667, lng: 151.1955} + }; + map = new google.maps.Map(document.getElementById('map'), mapOptions); + + // Enables the polyline drawing control. Click on the map to start drawing a + // polyline. Each click will add a new vertice. Double-click to stop drawing. + drawingManager = new google.maps.drawing.DrawingManager({ + drawingMode: google.maps.drawing.OverlayType.POLYLINE, + drawingControl: true, + drawingControlOptions: { + position: google.maps.ControlPosition.TOP_CENTER, + drawingModes: [ + google.maps.drawing.OverlayType.POLYLINE + ] + }, + polylineOptions: { + strokeColor: '#696969', + strokeWeight: 2 + } + }); + drawingManager.setMap(map); + + // Snap-to-road when the polyline is completed. + drawingManager.addListener('polylinecomplete', function(poly) { + var path = poly.getPath(); + polylines.push(poly); + placeIdArray = []; + runSnapToRoad(path); + }); + + // Clear button. Click to remove all polylines. + $('#clear').click(function(ev) { + for (var i = 0; i < polylines.length; ++i) { + polylines[i].setMap(null); + } + polylines = []; + ev.preventDefault(); + return false; + }); +} + +// Snap a user-created polyline to roads and draw the snapped path +function runSnapToRoad(path) { + var pathValues = []; + for (var i = 0; i < path.getLength(); i++) { + pathValues.push(path.getAt(i).toUrlValue()); + } + + $.get('https://roads.googleapis.com/v1/snapToRoads', { + interpolate: true, + key: apiKey, + path: pathValues.join('|') + }, function(data) { + processSnapToRoadResponse(data); + drawSnappedPolyline(); + getAndDrawSpeedLimits(); + }); +} + +// Store snapped polyline returned by the snap-to-road method. +function processSnapToRoadResponse(data) { + snappedCoordinates = []; + placeIdArray = []; + for (var i = 0; i < data.snappedPoints.length; i++) { + var latlng = new google.maps.LatLng( + data.snappedPoints[i].location.latitude, + data.snappedPoints[i].location.longitude); + snappedCoordinates.push(latlng); + placeIdArray.push(data.snappedPoints[i].placeId); + } +} + +// Draws the snapped polyline (after processing snap-to-road response). +function drawSnappedPolyline() { + var snappedPolyline = new google.maps.Polyline({ + path: snappedCoordinates, + strokeColor: 'black', + strokeWeight: 3 + }); + + snappedPolyline.setMap(map); + polylines.push(snappedPolyline); +} + +// Gets speed limits (for 100 segments at a time) and draws a polyline +// color-coded by speed limit. Must be called after processing snap-to-road +// response. +function getAndDrawSpeedLimits() { + for (var i = 0; i <= placeIdArray.length / 100; i++) { + // Ensure that no query exceeds the max 100 placeID limit. + var start = i * 100; + var end = Math.min((i + 1) * 100 - 1, placeIdArray.length); + + drawSpeedLimits(start, end); + } +} + +// Gets speed limits for a 100-segment path and draws a polyline color-coded by +// speed limit. Must be called after processing snap-to-road response. +function drawSpeedLimits(start, end) { + var placeIdQuery = ''; + for (var i = start; i < end; i++) { + placeIdQuery += '&placeId=' + placeIdArray[i]; + } + + $.get('https://roads.googleapis.com/v1/speedLimits', + 'key=' + apiKey + placeIdQuery, + function(speedData) { + processSpeedLimitResponse(speedData, start); + } + ); +} + +// Draw a polyline segment (up to 100 road segments) color-coded by speed limit. +function processSpeedLimitResponse(speedData, start) { + var end = start + speedData.speedLimits.length; + for (var i = 0; i < speedData.speedLimits.length - 1; i++) { + var speedLimit = speedData.speedLimits[i].speedLimit; + var color = getColorForSpeed(speedLimit); + + // Take two points for a single-segment polyline. + var coords = snappedCoordinates.slice(start + i, start + i + 2); + + var snappedPolyline = new google.maps.Polyline({ + path: coords, + strokeColor: color, + strokeWeight: 6 + }); + snappedPolyline.setMap(map); + polylines.push(snappedPolyline); + } +} + +function getColorForSpeed(speed_kph) { + if (speed_kph <= 40) { + return 'purple'; + } + if (speed_kph <= 50) { + return 'blue'; + } + if (speed_kph <= 60) { + return 'green'; + } + if (speed_kph <= 80) { + return 'yellow'; + } + if (speed_kph <= 100) { + return 'orange'; + } + return 'red'; +} + +$(window).load(initialize); \ No newline at end of file diff --git a/frontend/web/js/statement.js b/frontend/web/js/statement.js new file mode 100644 index 0000000..eb24fad --- /dev/null +++ b/frontend/web/js/statement.js @@ -0,0 +1,62 @@ +var road_passports = []; +$(document).on('click', '#control .show-route', function() { + var id = $(this).data('key'); + if(id in road_passports) { + clearMarkers(); + road_passports[id].forEach(function(element, index) { + if(element == undefined) { + return false; + } + var marker = new google.maps.Marker( + { + position : { + lat : parseFloat(element.lat), + lng : parseFloat(element.lng) + }, + title : '#' + parseInt(element.num), + map : null, + draggable : false, + label : parseInt(element.num).toString(10) + } + ); + markers.push(marker); + }); + repaint(); + fitBounds(); + showMap(); + } else { + $.get(points_url, { + id: id + }, function(data) { + road_passports[id] = new google.maps.MVCArray(); + if(data.result.passport) { + road_passports[id].model = createPassportModel(); + fillPassportModel(id, data.result.passport); + } + road_passports[id].setAt(0, undefined); + clearMarkers(); + $.each( + data.result.points, function(index, value) + { + road_passports[id].setAt(index, value); + var marker = new google.maps.Marker( + { + position : { + lat : parseFloat(value.lat), + lng : parseFloat(value.lng) + }, + title : '#' + parseInt(value.num), + map : null, + draggable : false, + label : parseInt(value.num).toString(10) + } + ); + markers.push(marker); + } + ); + repaint(); + fitBounds(); + showMap(); + }); + } +}); \ No newline at end of file diff --git a/frontend/web/js/test.js b/frontend/web/js/test.js new file mode 100644 index 0000000..6a65ab8 --- /dev/null +++ b/frontend/web/js/test.js @@ -0,0 +1,4 @@ +"use strict"; +exports.__esModule = true; +exports["default"] = $; +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/frontend/web/js/test.js.map b/frontend/web/js/test.js.map new file mode 100644 index 0000000..1cedbae --- /dev/null +++ b/frontend/web/js/test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":";AACA;qBAAe,CAAC,CAAC"} \ No newline at end of file diff --git a/frontend/web/js/test.ts b/frontend/web/js/test.ts new file mode 100644 index 0000000..b6971fc --- /dev/null +++ b/frontend/web/js/test.ts @@ -0,0 +1,2 @@ +declare let $: JQuery; +export default $; \ No newline at end of file diff --git a/frontend/web/robots.txt b/frontend/web/robots.txt new file mode 100755 index 0000000..6f27bb6 --- /dev/null +++ b/frontend/web/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: \ No newline at end of file diff --git a/init b/init new file mode 100755 index 0000000..50d51eb --- /dev/null +++ b/init @@ -0,0 +1,217 @@ +#!/usr/bin/env php + + * + * @link http://www.yiiframework.com/ + * @copyright Copyright (c) 2008 Yii Software LLC + * @license http://www.yiiframework.com/license/ + */ + +if (!extension_loaded('openssl')) { + die('The OpenSSL PHP extension is required by Yii2.'); +} + +$params = getParams(); +$root = str_replace('\\', '/', __DIR__); +$envs = require("$root/environments/index.php"); +$envNames = array_keys($envs); + +echo "Yii Application Initialization Tool v1.0\n\n"; + +$envName = null; +if (empty($params['env']) || $params['env'] === '1') { + echo "Which environment do you want the application to be initialized in?\n\n"; + foreach ($envNames as $i => $name) { + echo " [$i] $name\n"; + } + echo "\n Your choice [0-" . (count($envs) - 1) . ', or "q" to quit] '; + $answer = trim(fgets(STDIN)); + + if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) { + echo "\n Quit initialization.\n"; + exit(0); + } + + if (isset($envNames[$answer])) { + $envName = $envNames[$answer]; + } +} else { + $envName = $params['env']; +} + +if (!in_array($envName, $envNames)) { + $envsList = implode(', ', $envNames); + echo "\n $envName is not a valid environment. Try one of the following: $envsList. \n"; + exit(2); +} + +$env = $envs[$envName]; + +if (empty($params['env'])) { + echo "\n Initialize the application under '{$envNames[$answer]}' environment? [yes|no] "; + $answer = trim(fgets(STDIN)); + if (strncasecmp($answer, 'y', 1)) { + echo "\n Quit initialization.\n"; + exit(0); + } +} + +echo "\n Start initialization ...\n\n"; +$files = getFileList("$root/environments/{$env['path']}"); +if (isset($env['skipFiles'])) { + $skipFiles = $env['skipFiles']; + array_walk($skipFiles, function(&$value) use($env, $root) { $value = "$root/$value"; }); + $files = array_diff($files, array_intersect_key($env['skipFiles'], array_filter($skipFiles, 'file_exists'))); +} +$all = false; +foreach ($files as $file) { + if (!copyFile($root, "environments/{$env['path']}/$file", $file, $all, $params)) { + break; + } +} + +$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable', 'createSymlink']; +foreach ($callbacks as $callback) { + if (!empty($env[$callback])) { + $callback($root, $env[$callback]); + } +} + +echo "\n ... initialization completed.\n\n"; + +function getFileList($root, $basePath = '') +{ + $files = []; + $handle = opendir($root); + while (($path = readdir($handle)) !== false) { + if ($path === '.git' || $path === '.svn' || $path === '.' || $path === '..') { + continue; + } + $fullPath = "$root/$path"; + $relativePath = $basePath === '' ? $path : "$basePath/$path"; + if (is_dir($fullPath)) { + $files = array_merge($files, getFileList($fullPath, $relativePath)); + } else { + $files[] = $relativePath; + } + } + closedir($handle); + return $files; +} + +function copyFile($root, $source, $target, &$all, $params) +{ + if (!is_file($root . '/' . $source)) { + echo " skip $target ($source not exist)\n"; + return true; + } + if (is_file($root . '/' . $target)) { + if (file_get_contents($root . '/' . $source) === file_get_contents($root . '/' . $target)) { + echo " unchanged $target\n"; + return true; + } + if ($all) { + echo " overwrite $target\n"; + } else { + echo " exist $target\n"; + echo " ...overwrite? [Yes|No|All|Quit] "; + + + $answer = !empty($params['overwrite']) ? $params['overwrite'] : trim(fgets(STDIN)); + if (!strncasecmp($answer, 'q', 1)) { + return false; + } else { + if (!strncasecmp($answer, 'y', 1)) { + echo " overwrite $target\n"; + } else { + if (!strncasecmp($answer, 'a', 1)) { + echo " overwrite $target\n"; + $all = true; + } else { + echo " skip $target\n"; + return true; + } + } + } + } + file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source)); + return true; + } + echo " generate $target\n"; + @mkdir(dirname($root . '/' . $target), 0777, true); + file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source)); + return true; +} + +function getParams() +{ + $rawParams = []; + if (isset($_SERVER['argv'])) { + $rawParams = $_SERVER['argv']; + array_shift($rawParams); + } + + $params = []; + foreach ($rawParams as $param) { + if (preg_match('/^--(\w+)(=(.*))?$/', $param, $matches)) { + $name = $matches[1]; + $params[$name] = isset($matches[3]) ? $matches[3] : true; + } else { + $params[] = $param; + } + } + return $params; +} + +function setWritable($root, $paths) +{ + foreach ($paths as $writable) { + if (is_dir("$root/$writable")) { + echo " chmod 0777 $writable\n"; + @chmod("$root/$writable", 0777); + } else { + echo "\n Error. Directory $writable does not exist. \n"; + } + } +} + +function setExecutable($root, $paths) +{ + foreach ($paths as $executable) { + echo " chmod 0755 $executable\n"; + @chmod("$root/$executable", 0755); + } +} + +function setCookieValidationKey($root, $paths) +{ + foreach ($paths as $file) { + echo " generate cookie validation key in $file\n"; + $file = $root . '/' . $file; + $length = 32; + $bytes = openssl_random_pseudo_bytes($length); + $key = strtr(substr(base64_encode($bytes), 0, $length), '+/=', '_-.'); + $content = preg_replace('/(("|\')cookieValidationKey("|\')\s*=>\s*)(""|\'\')/', "\\1'$key'", file_get_contents($file)); + file_put_contents($file, $content); + } +} + +function createSymlink($root, $links) { + foreach ($links as $link => $target) { + echo " symlink " . $root . "/" . $target . " " . $root . "/" . $link . "\n"; + //first removing folders to avoid errors if the folder already exists + @rmdir($root . "/" . $link); + //next removing existing symlink in order to update the target + if (is_link($root . "/" . $link)) { + @unlink($root . "/" . $link); + } + @symlink($root . "/" . $target, $root . "/" . $link); + } +} diff --git a/init.bat b/init.bat new file mode 100755 index 0000000..e50c242 --- /dev/null +++ b/init.bat @@ -0,0 +1,20 @@ +@echo off + +rem ------------------------------------------------------------- +rem Yii command line init script for Windows. +rem +rem @author Qiang Xue +rem @link http://www.yiiframework.com/ +rem @copyright Copyright (c) 2008 Yii Software LLC +rem @license http://www.yiiframework.com/license/ +rem ------------------------------------------------------------- + +@setlocal + +set YII_PATH=%~dp0 + +if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe + +"%PHP_COMMAND%" "%YII_PATH%init" %* + +@endlocal diff --git a/requirements.php b/requirements.php new file mode 100755 index 0000000..fd84f47 --- /dev/null +++ b/requirements.php @@ -0,0 +1,132 @@ +Error'; + echo '

    The path to yii framework seems to be incorrect.

    '; + echo '

    You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . '.

    '; + echo '

    Please refer to the README on how to install Yii.

    '; +} + +require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); +$requirementsChecker = new YiiRequirementChecker(); + +$gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; +$gdOK = $imagickOK = false; + +if (extension_loaded('imagick')) { + $imagick = new Imagick(); + $imagickFormats = $imagick->queryFormats('PNG'); + if (in_array('PNG', $imagickFormats)) { + $imagickOK = true; + } else { + $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.'; + } +} + +if (extension_loaded('gd')) { + $gdInfo = gd_info(); + if (!empty($gdInfo['FreeType Support'])) { + $gdOK = true; + } else { + $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.'; + } +} + +/** + * Adjust requirements according to your application specifics. + */ +$requirements = array( + // Database : + array( + 'name' => 'PDO extension', + 'mandatory' => true, + 'condition' => extension_loaded('pdo'), + 'by' => 'All DB-related classes', + ), + array( + 'name' => 'PDO SQLite extension', + 'mandatory' => false, + 'condition' => extension_loaded('pdo_sqlite'), + 'by' => 'All DB-related classes', + 'memo' => 'Required for SQLite database.', + ), + array( + 'name' => 'PDO MySQL extension', + 'mandatory' => false, + 'condition' => extension_loaded('pdo_mysql'), + 'by' => 'All DB-related classes', + 'memo' => 'Required for MySQL database.', + ), + array( + 'name' => 'PDO PostgreSQL extension', + 'mandatory' => false, + 'condition' => extension_loaded('pdo_pgsql'), + 'by' => 'All DB-related classes', + 'memo' => 'Required for PostgreSQL database.', + ), + // Cache : + array( + 'name' => 'Memcache extension', + 'mandatory' => false, + 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), + 'by' => 'MemCache', + 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached to true.' : '' + ), + array( + 'name' => 'APC extension', + 'mandatory' => false, + 'condition' => extension_loaded('apc'), + 'by' => 'ApcCache', + ), + // CAPTCHA: + array( + 'name' => 'GD PHP extension with FreeType support', + 'mandatory' => false, + 'condition' => $gdOK, + 'by' => 'Captcha', + 'memo' => $gdMemo, + ), + array( + 'name' => 'ImageMagick PHP extension with PNG support', + 'mandatory' => false, + 'condition' => $imagickOK, + 'by' => 'Captcha', + 'memo' => $imagickMemo, + ), + // PHP ini : + 'phpExposePhp' => array( + 'name' => 'Expose PHP', + 'mandatory' => false, + 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"), + 'by' => 'Security reasons', + 'memo' => '"expose_php" should be disabled at php.ini', + ), + 'phpAllowUrlInclude' => array( + 'name' => 'PHP allow url include', + 'mandatory' => false, + 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"), + 'by' => 'Security reasons', + 'memo' => '"allow_url_include" should be disabled at php.ini', + ), + 'phpSmtp' => array( + 'name' => 'PHP mail SMTP', + 'mandatory' => false, + 'condition' => strlen(ini_get('SMTP')) > 0, + 'by' => 'Email sending', + 'memo' => 'PHP mail SMTP server required', + ), +); +$requirementsChecker->checkYii()->check($requirements)->render(); diff --git a/test.html b/test.html new file mode 100644 index 0000000..566549b --- /dev/null +++ b/test.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/tests/README.md b/tests/README.md new file mode 100755 index 0000000..112090f --- /dev/null +++ b/tests/README.md @@ -0,0 +1,59 @@ +This directory contains various tests for the advanced applications. + +Tests in `codeception` directory are developed with [Codeception PHP Testing Framework](http://codeception.com/). + +After creating and setting up the advanced application, follow these steps to prepare for the tests: + +1. Install Codeception if it's not yet installed: + + ``` + composer global require "codeception/codeception=2.1.*" "codeception/specify=*" "codeception/verify=*" + ``` + + If you've never used Composer for global packages run `composer global status`. It should output: + + ``` + Changed current directory to + ``` + + Then add `/vendor/bin` to you `PATH` environment variable. Now you're able to use `codecept` from command + line globally. + +2. Install faker extension by running the following from template root directory where `composer.json` is: + + ``` + composer require --dev yiisoft/yii2-faker:* + ``` + +3. Create a database for tests, adjust the `components['db']` configuration in `tests/codeception/config/config-local.php`, + then update it by applying migrations: + + ``` + codeception/bin/yii migrate + ``` + +4. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in + webserver. In the root directory where `common`, `frontend` etc. are execute the following: + + ``` + php -S localhost:8080 + ``` + +5. Now you can run the tests with the following commands, assuming you are in the `tests/codeception` directory: + + ``` + # frontend tests + cd frontend + codecept build + codecept run + + # backend tests + + cd backend + codecept build + codecept run + + # etc. + ``` + + If you already have run `codecept build` for each application, you can skip that step and run all tests by a single `codecept run`. diff --git a/tests/codeception.yml b/tests/codeception.yml new file mode 100755 index 0000000..1a793ed --- /dev/null +++ b/tests/codeception.yml @@ -0,0 +1,11 @@ +include: + - codeception/common + - codeception/console + - codeception/backend + - codeception/frontend + +paths: + log: codeception/_output + +settings: + colors: true diff --git a/tests/codeception/_output/.gitignore b/tests/codeception/_output/.gitignore new file mode 100755 index 0000000..d6b7ef3 --- /dev/null +++ b/tests/codeception/_output/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/tests/codeception/backend/.gitignore b/tests/codeception/backend/.gitignore new file mode 100755 index 0000000..985dbb4 --- /dev/null +++ b/tests/codeception/backend/.gitignore @@ -0,0 +1,4 @@ +# these files are auto generated by codeception build +/unit/UnitTester.php +/functional/FunctionalTester.php +/acceptance/AcceptanceTester.php diff --git a/tests/codeception/backend/_bootstrap.php b/tests/codeception/backend/_bootstrap.php new file mode 100755 index 0000000..a28a3d2 --- /dev/null +++ b/tests/codeception/backend/_bootstrap.php @@ -0,0 +1,23 @@ +wantTo('ensure login page works'); + +$loginPage = LoginPage::openBy($I); + +$I->amGoingTo('submit login form with no data'); +$loginPage->login('', ''); +if (method_exists($I, 'wait')) { + $I->wait(3); // only for selenium +} +$I->expectTo('see validations errors'); +$I->see('Username cannot be blank.', '.help-block'); +$I->see('Password cannot be blank.', '.help-block'); + +$I->amGoingTo('try to login with wrong credentials'); +$I->expectTo('see validations errors'); +$loginPage->login('admin', 'wrong'); +if (method_exists($I, 'wait')) { + $I->wait(3); // only for selenium +} +$I->expectTo('see validations errors'); +$I->see('Incorrect username or password.', '.help-block'); + +$I->amGoingTo('try to login with correct credentials'); +$loginPage->login('erau', 'password_0'); +if (method_exists($I, 'wait')) { + $I->wait(3); // only for selenium +} +$I->expectTo('see that user is logged'); +$I->see('Logout (erau)', 'form button[type=submit]'); +$I->dontSeeLink('Login'); +$I->dontSeeLink('Signup'); +/** Uncomment if using WebDriver + * $I->click('Logout (erau)'); + * $I->dontSeeLink('Logout (erau)'); + * $I->seeLink('Login'); + */ diff --git a/tests/codeception/backend/acceptance/_bootstrap.php b/tests/codeception/backend/acceptance/_bootstrap.php new file mode 100755 index 0000000..411855e --- /dev/null +++ b/tests/codeception/backend/acceptance/_bootstrap.php @@ -0,0 +1,2 @@ +wantTo('ensure login page works'); + +$loginPage = LoginPage::openBy($I); + +$I->amGoingTo('submit login form with no data'); +$loginPage->login('', ''); +$I->expectTo('see validations errors'); +$I->see('Username cannot be blank.', '.help-block'); +$I->see('Password cannot be blank.', '.help-block'); + +$I->amGoingTo('try to login with wrong credentials'); +$I->expectTo('see validations errors'); +$loginPage->login('admin', 'wrong'); +$I->expectTo('see validations errors'); +$I->see('Incorrect username or password.', '.help-block'); + +$I->amGoingTo('try to login with correct credentials'); +$loginPage->login('erau', 'password_0'); +$I->expectTo('see that user is logged'); +$I->see('Logout (erau)', 'form button[type=submit]'); +$I->dontSeeLink('Login'); +$I->dontSeeLink('Signup'); diff --git a/tests/codeception/backend/functional/_bootstrap.php b/tests/codeception/backend/functional/_bootstrap.php new file mode 100755 index 0000000..94f3fbd --- /dev/null +++ b/tests/codeception/backend/functional/_bootstrap.php @@ -0,0 +1,2 @@ +run(); +exit($exitCode); diff --git a/tests/codeception/bin/yii.bat b/tests/codeception/bin/yii.bat new file mode 100755 index 0000000..d516b3a --- /dev/null +++ b/tests/codeception/bin/yii.bat @@ -0,0 +1,20 @@ +@echo off + +rem ------------------------------------------------------------- +rem Yii command line bootstrap script for Windows. +rem +rem @author Qiang Xue +rem @link http://www.yiiframework.com/ +rem @copyright Copyright (c) 2008 Yii Software LLC +rem @license http://www.yiiframework.com/license/ +rem ------------------------------------------------------------- + +@setlocal + +set YII_PATH=%~dp0 + +if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe + +"%PHP_COMMAND%" "%YII_PATH%yii" %* + +@endlocal diff --git a/tests/codeception/common/.gitignore b/tests/codeception/common/.gitignore new file mode 100755 index 0000000..985dbb4 --- /dev/null +++ b/tests/codeception/common/.gitignore @@ -0,0 +1,4 @@ +# these files are auto generated by codeception build +/unit/UnitTester.php +/functional/FunctionalTester.php +/acceptance/AcceptanceTester.php diff --git a/tests/codeception/common/_bootstrap.php b/tests/codeception/common/_bootstrap.php new file mode 100755 index 0000000..cea3ee5 --- /dev/null +++ b/tests/codeception/common/_bootstrap.php @@ -0,0 +1,15 @@ +actor->fillField('input[name="LoginForm[username]"]', $username); + $this->actor->fillField('input[name="LoginForm[password]"]', $password); + $this->actor->click('login-button'); + } +} diff --git a/tests/codeception/common/_support/FixtureHelper.php b/tests/codeception/common/_support/FixtureHelper.php new file mode 100755 index 0000000..63739ef --- /dev/null +++ b/tests/codeception/common/_support/FixtureHelper.php @@ -0,0 +1,73 @@ +loadFixtures(); + } + + /** + * Method is called after all suite tests run + */ + public function _afterSuite() + { + $this->unloadFixtures(); + } + + /** + * @inheritdoc + */ + public function globalFixtures() + { + return [ + InitDbFixture::className(), + ]; + } + + /** + * @inheritdoc + */ + public function fixtures() + { + return [ + 'user' => [ + 'class' => UserFixture::className(), + 'dataFile' => '@tests/codeception/common/fixtures/data/init_login.php', + ], + ]; + } +} diff --git a/tests/codeception/common/codeception.yml b/tests/codeception/common/codeception.yml new file mode 100755 index 0000000..e8a3407 --- /dev/null +++ b/tests/codeception/common/codeception.yml @@ -0,0 +1,13 @@ +namespace: tests\codeception\common +actor: Tester +paths: + tests: . + log: _output + data: _data + helpers: _support +settings: + bootstrap: _bootstrap.php + suite_class: \PHPUnit_Framework_TestSuite + colors: true + memory_limit: 1024M + log: true diff --git a/tests/codeception/common/fixtures/UserFixture.php b/tests/codeception/common/fixtures/UserFixture.php new file mode 100755 index 0000000..7153c8c --- /dev/null +++ b/tests/codeception/common/fixtures/UserFixture.php @@ -0,0 +1,13 @@ + 'erau', + 'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI', + // password_0 + 'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne', + 'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490', + 'created_at' => '1392559490', + 'updated_at' => '1392559490', + 'email' => 'sfriesen@jenkins.info', + ], +]; diff --git a/tests/codeception/common/templates/fixtures/user.php b/tests/codeception/common/templates/fixtures/user.php new file mode 100755 index 0000000..d3f83b5 --- /dev/null +++ b/tests/codeception/common/templates/fixtures/user.php @@ -0,0 +1,17 @@ +getSecurity(); + +return [ + 'username' => $faker->userName, + 'email' => $faker->email, + 'auth_key' => $security->generateRandomString(), + 'password_hash' => $security->generatePasswordHash('password_' . $index), + 'password_reset_token' => $security->generateRandomString() . '_' . time(), + 'created_at' => time(), + 'updated_at' => time(), +]; diff --git a/tests/codeception/common/unit.suite.yml b/tests/codeception/common/unit.suite.yml new file mode 100755 index 0000000..a0582a5 --- /dev/null +++ b/tests/codeception/common/unit.suite.yml @@ -0,0 +1,6 @@ +# Codeception Test Suite Configuration + +# suite for unit (internal) tests. +# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. + +class_name: UnitTester diff --git a/tests/codeception/common/unit/DbTestCase.php b/tests/codeception/common/unit/DbTestCase.php new file mode 100755 index 0000000..2159a69 --- /dev/null +++ b/tests/codeception/common/unit/DbTestCase.php @@ -0,0 +1,11 @@ + 'bayer.hudson', + 'auth_key' => 'HP187Mvq7Mmm3CTU80dLkGmni_FUH_lR', + //password_0 + 'password_hash' => '$2y$13$EjaPFBnZOQsHdGuHI.xvhuDp1fHpo8hKRSk6yshqa9c5EG8s3C3lO', + 'password_reset_token' => 'ExzkCOaYc1L8IOBs4wdTGGbgNiG3Wz1I_1402312317', + 'created_at' => '1402312317', + 'updated_at' => '1402312317', + 'email' => 'nicole.paucek@schultz.info', + ], +]; diff --git a/tests/codeception/common/unit/models/LoginFormTest.php b/tests/codeception/common/unit/models/LoginFormTest.php new file mode 100755 index 0000000..54c8209 --- /dev/null +++ b/tests/codeception/common/unit/models/LoginFormTest.php @@ -0,0 +1,93 @@ + [ + 'user' => [ + 'class' => 'yii\web\User', + 'identityClass' => 'common\models\User', + ], + ], + ]); + } + + protected function tearDown() + { + Yii::$app->user->logout(); + parent::tearDown(); + } + + public function testLoginNoUser() + { + $model = new LoginForm([ + 'username' => 'not_existing_username', + 'password' => 'not_existing_password', + ]); + + $this->specify('user should not be able to login, when there is no identity', function () use ($model) { + expect('model should not login user', $model->login())->false(); + expect('user should not be logged in', Yii::$app->user->isGuest)->true(); + }); + } + + public function testLoginWrongPassword() + { + $model = new LoginForm([ + 'username' => 'bayer.hudson', + 'password' => 'wrong_password', + ]); + + $this->specify('user should not be able to login with wrong password', function () use ($model) { + expect('model should not login user', $model->login())->false(); + expect('error message should be set', $model->errors)->hasKey('password'); + expect('user should not be logged in', Yii::$app->user->isGuest)->true(); + }); + } + + public function testLoginCorrect() + { + + $model = new LoginForm([ + 'username' => 'bayer.hudson', + 'password' => 'password_0', + ]); + + $this->specify('user should be able to login with correct credentials', function () use ($model) { + expect('model should login user', $model->login())->true(); + expect('error message should not be set', $model->errors)->hasntKey('password'); + expect('user should be logged in', Yii::$app->user->isGuest)->false(); + }); + } + + /** + * @inheritdoc + */ + public function fixtures() + { + return [ + 'user' => [ + 'class' => UserFixture::className(), + 'dataFile' => '@tests/codeception/common/unit/fixtures/data/models/user.php' + ], + ]; + } +} diff --git a/tests/codeception/config/.gitignore b/tests/codeception/config/.gitignore new file mode 100755 index 0000000..059a02c --- /dev/null +++ b/tests/codeception/config/.gitignore @@ -0,0 +1 @@ +config-local.php diff --git a/tests/codeception/config/acceptance.php b/tests/codeception/config/acceptance.php new file mode 100755 index 0000000..9318da5 --- /dev/null +++ b/tests/codeception/config/acceptance.php @@ -0,0 +1,7 @@ + 'app-common', + 'basePath' => dirname(__DIR__), + ] +); diff --git a/tests/codeception/config/config.php b/tests/codeception/config/config.php new file mode 100755 index 0000000..b478679 --- /dev/null +++ b/tests/codeception/config/config.php @@ -0,0 +1,26 @@ + 'en-US', + 'controllerMap' => [ + 'fixture' => [ + 'class' => 'yii\faker\FixtureController', + 'fixtureDataPath' => '@tests/codeception/common/fixtures/data', + 'templatePath' => '@tests/codeception/common/templates/fixtures', + 'namespace' => 'tests\codeception\common\fixtures', + ], + ], + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_tests', + ], + 'mailer' => [ + 'useFileTransport' => true, + ], + 'urlManager' => [ + 'showScriptName' => true, + ], + ], +]; diff --git a/tests/codeception/config/console/unit.php b/tests/codeception/config/console/unit.php new file mode 100755 index 0000000..3c24df0 --- /dev/null +++ b/tests/codeception/config/console/unit.php @@ -0,0 +1,15 @@ + [ + 'request' => [ + // it's not recommended to run functional tests with CSRF validation enabled + 'enableCsrfValidation' => false, + // but if you absolutely need it set cookie domain to localhost + /* + 'csrfCookie' => [ + 'domain' => 'localhost', + ], + */ + ], + ], +]; \ No newline at end of file diff --git a/tests/codeception/config/unit.php b/tests/codeception/config/unit.php new file mode 100755 index 0000000..6bd08d3 --- /dev/null +++ b/tests/codeception/config/unit.php @@ -0,0 +1,7 @@ + $value) { + $inputType = $field === 'body' ? 'textarea' : 'input'; + $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); + } + $this->actor->click('contact-button'); + } +} diff --git a/tests/codeception/frontend/_pages/SignupPage.php b/tests/codeception/frontend/_pages/SignupPage.php new file mode 100755 index 0000000..0e1cefa --- /dev/null +++ b/tests/codeception/frontend/_pages/SignupPage.php @@ -0,0 +1,27 @@ + $value) { + $inputType = $field === 'body' ? 'textarea' : 'input'; + $this->actor->fillField($inputType . '[name="SignupForm[' . $field . ']"]', $value); + } + $this->actor->click('signup-button'); + } +} diff --git a/tests/codeception/frontend/acceptance.suite.yml b/tests/codeception/frontend/acceptance.suite.yml new file mode 100755 index 0000000..1828a04 --- /dev/null +++ b/tests/codeception/frontend/acceptance.suite.yml @@ -0,0 +1,28 @@ +# Codeception Test Suite Configuration + +# suite for acceptance tests. +# perform tests in browser using the Selenium-like tools. +# powered by Mink (http://mink.behat.org). +# (tip: that's what your customer will see). +# (tip: test your ajax and javascript by one of Mink drivers). + +# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. + +class_name: AcceptanceTester +modules: + enabled: + - PhpBrowser + - tests\codeception\common\_support\FixtureHelper +# you can use WebDriver instead of PhpBrowser to test javascript and ajax. +# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium +# "restart" option is used by the WebDriver to start each time per test-file new session and cookies, +# it is useful if you want to login in your app in each test. +# - WebDriver + config: + PhpBrowser: +# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO + url: http://localhost:8080 +# WebDriver: +# url: http://localhost:8080 +# browser: firefox +# restart: true diff --git a/tests/codeception/frontend/acceptance/AboutCept.php b/tests/codeception/frontend/acceptance/AboutCept.php new file mode 100755 index 0000000..50bf9ba --- /dev/null +++ b/tests/codeception/frontend/acceptance/AboutCept.php @@ -0,0 +1,10 @@ +wantTo('ensure that about works'); +AboutPage::openBy($I); +$I->see('About', 'h1'); diff --git a/tests/codeception/frontend/acceptance/ContactCept.php b/tests/codeception/frontend/acceptance/ContactCept.php new file mode 100755 index 0000000..5e989a5 --- /dev/null +++ b/tests/codeception/frontend/acceptance/ContactCept.php @@ -0,0 +1,56 @@ +wantTo('ensure that contact works'); + +$contactPage = ContactPage::openBy($I); + +$I->see('Contact', 'h1'); + +$I->amGoingTo('submit contact form with no data'); +$contactPage->submit([]); +if (method_exists($I, 'wait')) { + $I->wait(3); // only for selenium +} +$I->expectTo('see validations errors'); +$I->see('Contact', 'h1'); +$I->see('Name cannot be blank', '.help-block'); +$I->see('Email cannot be blank', '.help-block'); +$I->see('Subject cannot be blank', '.help-block'); +$I->see('Body cannot be blank', '.help-block'); +$I->see('The verification code is incorrect', '.help-block'); + +$I->amGoingTo('submit contact form with not correct email'); +$contactPage->submit([ + 'name' => 'tester', + 'email' => 'tester.email', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', +]); +if (method_exists($I, 'wait')) { + $I->wait(3); // only for selenium +} +$I->expectTo('see that email address is wrong'); +$I->dontSee('Name cannot be blank', '.help-block'); +$I->see('Email is not a valid email address.', '.help-block'); +$I->dontSee('Subject cannot be blank', '.help-block'); +$I->dontSee('Body cannot be blank', '.help-block'); +$I->dontSee('The verification code is incorrect', '.help-block'); + +$I->amGoingTo('submit contact form with correct data'); +$contactPage->submit([ + 'name' => 'tester', + 'email' => 'tester@example.com', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', +]); +if (method_exists($I, 'wait')) { + $I->wait(3); // only for selenium +} +$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/codeception/frontend/acceptance/HomeCept.php b/tests/codeception/frontend/acceptance/HomeCept.php new file mode 100755 index 0000000..9566a2e --- /dev/null +++ b/tests/codeception/frontend/acceptance/HomeCept.php @@ -0,0 +1,12 @@ +wantTo('ensure that home page works'); +$I->amOnPage(Yii::$app->homeUrl); +$I->see('My Company'); +$I->seeLink('About'); +$I->click('About'); +$I->see('This is the About page.'); diff --git a/tests/codeception/frontend/acceptance/LoginCept.php b/tests/codeception/frontend/acceptance/LoginCept.php new file mode 100755 index 0000000..7c433af --- /dev/null +++ b/tests/codeception/frontend/acceptance/LoginCept.php @@ -0,0 +1,34 @@ +wantTo('ensure login page works'); + +$loginPage = LoginPage::openBy($I); + +$I->amGoingTo('submit login form with no data'); +$loginPage->login('', ''); +$I->expectTo('see validations errors'); +$I->see('Username cannot be blank.', '.help-block'); +$I->see('Password cannot be blank.', '.help-block'); + +$I->amGoingTo('try to login with wrong credentials'); +$I->expectTo('see validations errors'); +$loginPage->login('admin', 'wrong'); +$I->expectTo('see validations errors'); +$I->see('Incorrect username or password.', '.help-block'); + +$I->amGoingTo('try to login with correct credentials'); +$loginPage->login('erau', 'password_0'); +$I->expectTo('see that user is logged'); +$I->see('Logout (erau)', 'form button[type=submit]'); +$I->dontSeeLink('Login'); +$I->dontSeeLink('Signup'); +/** Uncomment if using WebDriver + * $I->click('Logout (erau)'); + * $I->dontSeeLink('Logout (erau)'); + * $I->seeLink('Login'); + */ diff --git a/tests/codeception/frontend/acceptance/SignupCest.php b/tests/codeception/frontend/acceptance/SignupCest.php new file mode 100755 index 0000000..e8431e5 --- /dev/null +++ b/tests/codeception/frontend/acceptance/SignupCest.php @@ -0,0 +1,82 @@ + 'tester.email@example.com', + 'username' => 'tester', + ]); + } + + /** + * This method is called when test fails. + * @param \Codeception\Event\FailEvent $event + */ + public function _fail($event) + { + } + + /** + * @param \codeception_frontend\AcceptanceTester $I + * @param \Codeception\Scenario $scenario + */ + public function testUserSignup($I, $scenario) + { + $I->wantTo('ensure that signup works'); + + $signupPage = SignupPage::openBy($I); + $I->see('Signup', 'h1'); + $I->see('Please fill out the following fields to signup:'); + + $I->amGoingTo('submit signup form with no data'); + + $signupPage->submit([]); + + $I->expectTo('see validation errors'); + $I->see('Username cannot be blank.', '.help-block'); + $I->see('Email cannot be blank.', '.help-block'); + $I->see('Password cannot be blank.', '.help-block'); + + $I->amGoingTo('submit signup form with not correct email'); + $signupPage->submit([ + 'username' => 'tester', + 'email' => 'tester.email', + 'password' => 'tester_password', + ]); + + $I->expectTo('see that email address is wrong'); + $I->dontSee('Username cannot be blank.', '.help-block'); + $I->dontSee('Password cannot be blank.', '.help-block'); + $I->see('Email is not a valid email address.', '.help-block'); + + $I->amGoingTo('submit signup form with correct email'); + $signupPage->submit([ + 'username' => 'tester', + 'email' => 'tester.email@example.com', + 'password' => 'tester_password', + ]); + + $I->expectTo('see that user logged in'); + $I->see('Logout (tester)', 'form button[type=submit]'); + } +} diff --git a/tests/codeception/frontend/acceptance/_bootstrap.php b/tests/codeception/frontend/acceptance/_bootstrap.php new file mode 100755 index 0000000..b0a40ef --- /dev/null +++ b/tests/codeception/frontend/acceptance/_bootstrap.php @@ -0,0 +1,2 @@ +wantTo('ensure that about works'); +AboutPage::openBy($I); +$I->see('About', 'h1'); diff --git a/tests/codeception/frontend/functional/ContactCept.php b/tests/codeception/frontend/functional/ContactCept.php new file mode 100755 index 0000000..a93d7e4 --- /dev/null +++ b/tests/codeception/frontend/functional/ContactCept.php @@ -0,0 +1,47 @@ +wantTo('ensure that contact works'); + +$contactPage = ContactPage::openBy($I); + +$I->see('Contact', 'h1'); + +$I->amGoingTo('submit contact form with no data'); +$contactPage->submit([]); +$I->expectTo('see validations errors'); +$I->see('Contact', 'h1'); +$I->see('Name cannot be blank', '.help-block'); +$I->see('Email cannot be blank', '.help-block'); +$I->see('Subject cannot be blank', '.help-block'); +$I->see('Body cannot be blank', '.help-block'); +$I->see('The verification code is incorrect', '.help-block'); + +$I->amGoingTo('submit contact form with not correct email'); +$contactPage->submit([ + 'name' => 'tester', + 'email' => 'tester.email', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', +]); +$I->expectTo('see that email address is wrong'); +$I->dontSee('Name cannot be blank', '.help-block'); +$I->see('Email is not a valid email address.', '.help-block'); +$I->dontSee('Subject cannot be blank', '.help-block'); +$I->dontSee('Body cannot be blank', '.help-block'); +$I->dontSee('The verification code is incorrect', '.help-block'); + +$I->amGoingTo('submit contact form with correct data'); +$contactPage->submit([ + 'name' => 'tester', + 'email' => 'tester@example.com', + 'subject' => 'test subject', + 'body' => 'test content', + 'verifyCode' => 'testme', +]); +$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/codeception/frontend/functional/HomeCept.php b/tests/codeception/frontend/functional/HomeCept.php new file mode 100755 index 0000000..f340061 --- /dev/null +++ b/tests/codeception/frontend/functional/HomeCept.php @@ -0,0 +1,12 @@ +wantTo('ensure that home page works'); +$I->amOnPage(Yii::$app->homeUrl); +$I->see('My Company'); +$I->seeLink('About'); +$I->click('About'); +$I->see('This is the About page.'); diff --git a/tests/codeception/frontend/functional/LoginCept.php b/tests/codeception/frontend/functional/LoginCept.php new file mode 100755 index 0000000..e1d2f9b --- /dev/null +++ b/tests/codeception/frontend/functional/LoginCept.php @@ -0,0 +1,29 @@ +wantTo('ensure login page works'); + +$loginPage = LoginPage::openBy($I); + +$I->amGoingTo('submit login form with no data'); +$loginPage->login('', ''); +$I->expectTo('see validations errors'); +$I->see('Username cannot be blank.', '.help-block'); +$I->see('Password cannot be blank.', '.help-block'); + +$I->amGoingTo('try to login with wrong credentials'); +$I->expectTo('see validations errors'); +$loginPage->login('admin', 'wrong'); +$I->expectTo('see validations errors'); +$I->see('Incorrect username or password.', '.help-block'); + +$I->amGoingTo('try to login with correct credentials'); +$loginPage->login('erau', 'password_0'); +$I->expectTo('see that user is logged'); +$I->see('Logout (erau)', 'form button[type=submit]'); +$I->dontSeeLink('Login'); +$I->dontSeeLink('Signup'); diff --git a/tests/codeception/frontend/functional/SignupCest.php b/tests/codeception/frontend/functional/SignupCest.php new file mode 100755 index 0000000..16410de --- /dev/null +++ b/tests/codeception/frontend/functional/SignupCest.php @@ -0,0 +1,88 @@ +loadFixtures(); + } + + /** + * This method is called when test fails. + * @param \codeception_frontend\FunctionalTester $I + */ + public function _failed($I) + { + + } + + /** + * + * @param \codeception_frontend\FunctionalTester $I + * @param \Codeception\Scenario $scenario + */ + public function testUserSignup($I, $scenario) + { + $I->wantTo('ensure that signup works'); + + $signupPage = SignupPage::openBy($I); + $I->see('Signup', 'h1'); + $I->see('Please fill out the following fields to signup:'); + + $I->amGoingTo('submit signup form with no data'); + + $signupPage->submit([]); + + $I->expectTo('see validation errors'); + $I->see('Username cannot be blank.', '.help-block'); + $I->see('Email cannot be blank.', '.help-block'); + $I->see('Password cannot be blank.', '.help-block'); + + $I->amGoingTo('submit signup form with not correct email'); + $signupPage->submit([ + 'username' => 'tester', + 'email' => 'tester.email', + 'password' => 'tester_password', + ]); + + $I->expectTo('see that email address is wrong'); + $I->dontSee('Username cannot be blank.', '.help-block'); + $I->dontSee('Password cannot be blank.', '.help-block'); + $I->see('Email is not a valid email address.', '.help-block'); + + $I->amGoingTo('submit signup form with correct email'); + $signupPage->submit([ + 'username' => 'tester', + 'email' => 'tester.email@example.com', + 'password' => 'tester_password', + ]); + + $I->expectTo('see that user is created'); + $I->seeRecord('common\models\User', [ + 'username' => 'tester', + 'email' => 'tester.email@example.com', + ]); + + $I->expectTo('see that user logged in'); + $I->see('Logout (tester)', 'form button[type=submit]'); + } +} diff --git a/tests/codeception/frontend/functional/_bootstrap.php b/tests/codeception/frontend/functional/_bootstrap.php new file mode 100755 index 0000000..1abc491 --- /dev/null +++ b/tests/codeception/frontend/functional/_bootstrap.php @@ -0,0 +1,3 @@ + 'okirlin', + 'auth_key' => 'iwTNae9t34OmnK6l4vT4IeaTk-YWI2Rv', + 'password_hash' => '$2y$13$CXT0Rkle1EMJ/c1l5bylL.EylfmQ39O5JlHJVFpNn618OUS1HwaIi', + 'password_reset_token' => 't5GU9NwpuGYSfb7FEZMAxqtuz2PkEvv_' . time(), + 'created_at' => '1391885313', + 'updated_at' => '1391885313', + 'email' => 'brady.renner@rutherford.com', + ], + [ + 'username' => 'troy.becker', + 'auth_key' => 'EdKfXrx88weFMV0vIxuTMWKgfK2tS3Lp', + 'password_hash' => '$2y$13$g5nv41Px7VBqhS3hVsVN2.MKfgT3jFdkXEsMC4rQJLfaMa7VaJqL2', + 'password_reset_token' => '4BSNyiZNAuxjs5Mty990c47sVrgllIi_' . time(), + 'created_at' => '1391885313', + 'updated_at' => '1391885313', + 'email' => 'nicolas.dianna@hotmail.com', + 'status' => '0', + ], +]; diff --git a/tests/codeception/frontend/unit/models/ContactFormTest.php b/tests/codeception/frontend/unit/models/ContactFormTest.php new file mode 100755 index 0000000..9aaf595 --- /dev/null +++ b/tests/codeception/frontend/unit/models/ContactFormTest.php @@ -0,0 +1,59 @@ +mailer->fileTransportCallback = function ($mailer, $message) { + return 'testing_message.eml'; + }; + } + + protected function tearDown() + { + unlink($this->getMessageFile()); + parent::tearDown(); + } + + public function testContact() + { + $model = new ContactForm(); + + $model->attributes = [ + 'name' => 'Tester', + 'email' => 'tester@example.com', + 'subject' => 'very important letter subject', + 'body' => 'body of current message', + ]; + + $model->sendEmail('admin@example.com'); + + $this->specify('email should be send', function () { + expect('email file should exist', file_exists($this->getMessageFile()))->true(); + }); + + $this->specify('message should contain correct data', function () use ($model) { + $emailMessage = file_get_contents($this->getMessageFile()); + + expect('email should contain user name', $emailMessage)->contains($model->name); + expect('email should contain sender email', $emailMessage)->contains($model->email); + expect('email should contain subject', $emailMessage)->contains($model->subject); + expect('email should contain body', $emailMessage)->contains($model->body); + }); + } + + private function getMessageFile() + { + return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml'; + } +} diff --git a/tests/codeception/frontend/unit/models/PasswordResetRequestFormTest.php b/tests/codeception/frontend/unit/models/PasswordResetRequestFormTest.php new file mode 100755 index 0000000..ced8cce --- /dev/null +++ b/tests/codeception/frontend/unit/models/PasswordResetRequestFormTest.php @@ -0,0 +1,87 @@ +mailer->fileTransportCallback = function ($mailer, $message) { + return 'testing_message.eml'; + }; + } + + protected function tearDown() + { + @unlink($this->getMessageFile()); + + parent::tearDown(); + } + + public function testSendEmailWrongUser() + { + $this->specify('no user with such email, message should not be sent', function () { + + $model = new PasswordResetRequestForm(); + $model->email = 'not-existing-email@example.com'; + + expect('email not sent', $model->sendEmail())->false(); + + }); + + $this->specify('user is not active, message should not be sent', function () { + + $model = new PasswordResetRequestForm(); + $model->email = $this->user[1]['email']; + + expect('email not sent', $model->sendEmail())->false(); + + }); + } + + public function testSendEmailCorrectUser() + { + $model = new PasswordResetRequestForm(); + $model->email = $this->user[0]['email']; + $user = User::findOne(['password_reset_token' => $this->user[0]['password_reset_token']]); + + expect('email sent', $model->sendEmail())->true(); + expect('user has valid token', $user->password_reset_token)->notNull(); + + $this->specify('message has correct format', function () use ($model) { + + expect('message file exists', file_exists($this->getMessageFile()))->true(); + + $message = file_get_contents($this->getMessageFile()); + expect('message "from" is correct', $message)->contains(Yii::$app->params['supportEmail']); + expect('message "to" is correct', $message)->contains($model->email); + + }); + } + + public function fixtures() + { + return [ + 'user' => [ + 'class' => UserFixture::className(), + 'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php' + ], + ]; + } + + private function getMessageFile() + { + return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml'; + } +} diff --git a/tests/codeception/frontend/unit/models/ResetPasswordFormTest.php b/tests/codeception/frontend/unit/models/ResetPasswordFormTest.php new file mode 100755 index 0000000..a4dd021 --- /dev/null +++ b/tests/codeception/frontend/unit/models/ResetPasswordFormTest.php @@ -0,0 +1,43 @@ +user[0]['password_reset_token']); + expect('password should be resetted', $form->resetPassword())->true(); + } + + public function fixtures() + { + return [ + 'user' => [ + 'class' => UserFixture::className(), + 'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php' + ], + ]; + } +} diff --git a/tests/codeception/frontend/unit/models/SignupFormTest.php b/tests/codeception/frontend/unit/models/SignupFormTest.php new file mode 100755 index 0000000..4d08e8c --- /dev/null +++ b/tests/codeception/frontend/unit/models/SignupFormTest.php @@ -0,0 +1,52 @@ + 'some_username', + 'email' => 'some_email@example.com', + 'password' => 'some_password', + ]); + + $user = $model->signup(); + + $this->assertInstanceOf('common\models\User', $user, 'user should be valid'); + + expect('username should be correct', $user->username)->equals('some_username'); + expect('email should be correct', $user->email)->equals('some_email@example.com'); + expect('password should be correct', $user->validatePassword('some_password'))->true(); + } + + public function testNotCorrectSignup() + { + $model = new SignupForm([ + 'username' => 'troy.becker', + 'email' => 'nicolas.dianna@hotmail.com', + 'password' => 'some_password', + ]); + + expect('username and email are in use, user should not be created', $model->signup())->null(); + } + + public function fixtures() + { + return [ + 'user' => [ + 'class' => UserFixture::className(), + 'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php', + ], + ]; + } +} diff --git a/vagrant/config/.gitignore b/vagrant/config/.gitignore new file mode 100755 index 0000000..0685a56 --- /dev/null +++ b/vagrant/config/.gitignore @@ -0,0 +1,2 @@ +# local configuration +vagrant-local.yml \ No newline at end of file diff --git a/vagrant/config/vagrant-local.example.yml b/vagrant/config/vagrant-local.example.yml new file mode 100755 index 0000000..32dd3ab --- /dev/null +++ b/vagrant/config/vagrant-local.example.yml @@ -0,0 +1,22 @@ +# Your personal GitHub token +github_token: +# Read more: https://github.com/blog/1509-personal-api-tokens +# You can generate it here: https://github.com/settings/tokens + +# Guest OS timezone +timezone: Europe/London + +# Are we need check box updates for every 'vagrant up'? +box_check_update: false + +# Virtual machine name +machine_name: y2aa + +# Virtual machine IP +ip: 192.168.83.137 + +# Virtual machine CPU cores number +cpus: 1 + +# Virtual machine RAM +memory: 512 diff --git a/vagrant/nginx/app.conf b/vagrant/nginx/app.conf new file mode 100755 index 0000000..f8c029d --- /dev/null +++ b/vagrant/nginx/app.conf @@ -0,0 +1,75 @@ +server { + charset utf-8; + client_max_body_size 128M; + + listen 80; ## listen for ipv4 + #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 + + server_name y2aa-frontend.dev; + root /app/frontend/web/; + index index.php; + + access_log /app/vagrant/nginx/log/frontend-access.log; + error_log /app/vagrant/nginx/log/frontend-error.log; + + location / { + # Redirect everything that isn't a real file to index.php + try_files $uri $uri/ /index.php?$args; + } + + # uncomment to avoid processing of calls to non-existing static files by Yii + #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { + # try_files $uri =404; + #} + #error_page 404 /404.html; + + location ~ \.php$ { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; + #fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/var/run/php5-fpm.sock; + try_files $uri =404; + } + + location ~ /\.(ht|svn|git) { + deny all; + } +} + +server { + charset utf-8; + client_max_body_size 128M; + + listen 80; ## listen for ipv4 + #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 + + server_name y2aa-backend.dev; + root /app/backend/web/; + index index.php; + + access_log /app/vagrant/nginx/log/backend-access.log; + error_log /app/vagrant/nginx/log/backend-error.log; + + location / { + # Redirect everything that isn't a real file to index.php + try_files $uri $uri/ /index.php?$args; + } + + # uncomment to avoid processing of calls to non-existing static files by Yii + #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { + # try_files $uri =404; + #} + #error_page 404 /404.html; + + location ~ \.php$ { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; + #fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/var/run/php5-fpm.sock; + try_files $uri =404; + } + + location ~ /\.(ht|svn|git) { + deny all; + } +} \ No newline at end of file diff --git a/vagrant/nginx/log/.gitignore b/vagrant/nginx/log/.gitignore new file mode 100755 index 0000000..c15cedd --- /dev/null +++ b/vagrant/nginx/log/.gitignore @@ -0,0 +1,5 @@ +# nginx logs +backend-access.log +backend-error.log +frontend-access.log +frontend-error.log \ No newline at end of file diff --git a/vagrant/provision/always-as-root.sh b/vagrant/provision/always-as-root.sh new file mode 100755 index 0000000..f2465e7 --- /dev/null +++ b/vagrant/provision/always-as-root.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +#== Bash helpers == + +function info { + echo " " + echo "--> $1" + echo " " +} + +#== Provision script == + +info "Provision-script user: `whoami`" + +info "Restart web-stack" +service php5-fpm restart +service nginx restart +service mysql restart \ No newline at end of file diff --git a/vagrant/provision/once-as-root.sh b/vagrant/provision/once-as-root.sh new file mode 100755 index 0000000..b3e8d0d --- /dev/null +++ b/vagrant/provision/once-as-root.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +#== Import script args == + +timezone=$(echo "$1") + +#== Bash helpers == + +function info { + echo " " + echo "--> $1" + echo " " +} + +#== Provision script == + +info "Provision-script user: `whoami`" + +info "Allocate swap for MySQL 5.6" +fallocate -l 2048M /swapfile +chmod 600 /swapfile +mkswap /swapfile +swapon /swapfile +echo '/swapfile none swap defaults 0 0' >> /etc/fstab + +info "Configure locales" +update-locale LC_ALL="C" +dpkg-reconfigure locales + +info "Configure timezone" +echo ${timezone} | tee /etc/timezone +dpkg-reconfigure --frontend noninteractive tzdata + +info "Prepare root password for MySQL" +debconf-set-selections <<< "mysql-server-5.6 mysql-server/root_password password \"''\"" +debconf-set-selections <<< "mysql-server-5.6 mysql-server/root_password_again password \"''\"" +echo "Done!" + +info "Update OS software" +apt-get update +apt-get upgrade -y + +info "Install additional software" +apt-get install -y git php5-curl php5-cli php5-intl php5-mysqlnd php5-gd php5-fpm nginx mysql-server-5.6 + +info "Configure MySQL" +sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf +echo "Done!" + +info "Configure PHP-FPM" +sed -i 's/user = www-data/user = vagrant/g' /etc/php5/fpm/pool.d/www.conf +sed -i 's/group = www-data/group = vagrant/g' /etc/php5/fpm/pool.d/www.conf +sed -i 's/owner = www-data/owner = vagrant/g' /etc/php5/fpm/pool.d/www.conf +echo "Done!" + +info "Configure NGINX" +sed -i 's/user www-data/user vagrant/g' /etc/nginx/nginx.conf +echo "Done!" + +info "Enabling site configuration" +ln -s /app/vagrant/nginx/app.conf /etc/nginx/sites-enabled/app.conf +echo "Done!" + +info "Initailize databases for MySQL" +mysql -uroot <<< "CREATE DATABASE yii2advanced" +mysql -uroot <<< "CREATE DATABASE yii2_advanced_tests" +echo "Done!" + +info "Install composer" +curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ No newline at end of file diff --git a/vagrant/provision/once-as-vagrant.sh b/vagrant/provision/once-as-vagrant.sh new file mode 100755 index 0000000..acd554e --- /dev/null +++ b/vagrant/provision/once-as-vagrant.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +#== Import script args == + +github_token=$(echo "$1") + +#== Bash helpers == + +function info { + echo " " + echo "--> $1" + echo " " +} + +#== Provision script == + +info "Provision-script user: `whoami`" + +info "Configure composer" +composer config --global github-oauth.github.com ${github_token} +echo "Done!" + +info "Install plugins for composer" +composer global require "fxp/composer-asset-plugin:~1.1.1" --no-progress + +info "Install codeception" +composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*" --no-progress +echo 'export PATH=/home/vagrant/.config/composer/vendor/bin:$PATH' | tee -a /home/vagrant/.profile + +info "Install project dependencies" +cd /app +composer --no-progress --prefer-dist install + +info "Init project" +./init --env=Development --overwrite=y + +info "Apply migrations" +./yii migrate <<< "yes" + +info "Create bash-alias 'app' for vagrant user" +echo 'alias app="cd /app"' | tee /home/vagrant/.bash_aliases + +info "Enabling colorized prompt for guest console" +sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/" /home/vagrant/.bashrc \ No newline at end of file diff --git a/yii.bat b/yii.bat new file mode 100755 index 0000000..d516b3a --- /dev/null +++ b/yii.bat @@ -0,0 +1,20 @@ +@echo off + +rem ------------------------------------------------------------- +rem Yii command line bootstrap script for Windows. +rem +rem @author Qiang Xue +rem @link http://www.yiiframework.com/ +rem @copyright Copyright (c) 2008 Yii Software LLC +rem @license http://www.yiiframework.com/license/ +rem ------------------------------------------------------------- + +@setlocal + +set YII_PATH=%~dp0 + +if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe + +"%PHP_COMMAND%" "%YII_PATH%yii" %* + +@endlocal -- libgit2 0.21.4