]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Правки
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 7 Feb 2025 10:12:19 +0000 (13:12 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 7 Feb 2025 10:12:19 +0000 (13:12 +0300)
erp24/records/StoreCityList.php
erp24/views/store-city-list/index.php
erp24/web/uploads/region_temp.xlsx [new file with mode: 0644]

index 9c8c0bfd47f6d528dc044ffbef3cf54b423d26b0..226f645bb9174e4d1eb79eae49d03bb73f527374 100644 (file)
@@ -41,7 +41,10 @@ class StoreCityList extends \yii\db\ActiveRecord
             [['created_at', 'parent_id'], 'safe'],
             [['name', 'type'], 'string', 'max' => 255],
             [['type'], 'in', 'range' => [self::TYPE_REGION, self::TYPE_CITY, self::TYPE_DISTRICT]],
-            [['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => StoreCityList::class, 'targetAttribute' => ['parent_id' => 'id']],
+            [
+                ['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => StoreCityList::class,
+                'targetAttribute' => ['parent_id' => 'id']
+            ],
         ];
     }
 
@@ -51,10 +54,10 @@ class StoreCityList extends \yii\db\ActiveRecord
     public function attributeLabels()
     {
         return [
-            'id' => 'Ð\9fеÑ\80виÑ\87нÑ\8bй ÐºÐ»Ñ\8eÑ\87',
+            'id' => 'Ð\9aод Ñ\80егиона',
             'parent_id' => 'Идентификатор родителя',
-            'name' => 'Название (регион, город, район)',
-            'type' => 'Тип (region, city, district)',
+            'name' => 'Название',
+            'type' => 'Тип',
             'created_at' => 'Дата создания записи',
         ];
     }
index 6f9e529d71d8c1ba9e3bbf5ed86ca3fbe9cf4a27..17481d44106a460927052ad13ff5532680544f9a 100644 (file)
@@ -1,27 +1,43 @@
 <?php
 
+use kartik\grid\GridView;
 use yii_app\records\StoreCityList;
 use yii\helpers\Html;
 use yii\helpers\Url;
 use yii\grid\ActionColumn;
-use yii\grid\GridView;
+
 
 /** @var yii\web\View $this */
 /** @var yii_app\records\StoreCityListSearch $searchModel */
 /** @var yii\data\ActiveDataProvider $dataProvider */
 
-$this->title = 'Справочник адресов (регион, город, район)';
+$this->title = 'Справочник адресов';
 $this->params['breadcrumbs'][] = $this->title;
 ?>
 <div class="store-city-list-index p-4">
 
     <div class="row my-4">
-        <h1 class="upload-form col-8"><?= Html::encode($this->title) ?></h1>
+        <div class="col-8">
+            <h1 class="upload-form "><?= Html::encode($this->title) ?></h1>
+            <?= Html::a(
+                '📖 Документация',
+                Url::to([
+                        'https://wiki.yandex.ru/it-products/erp/opisanie-funkcionala/spravochnik-po-gorodam-i-rajjonam/'
+                ]),
+                ['class' => 'ms-3', 'target' => '_blank', 'title' => 'Открыть документацию']
+            ) ?>
+        </div>
 
         <div class="upload-form col-4">
             <p>
                 Загрузка из excel регионов в справочник
+                <?= Html::a(
+                    '📥 Скачать шаблон',
+                    Url::to(['/files/download?url=/uploads/region_temp.xlsx']),
+                    ['class' => 'ms-2', 'target' => '_blank', 'title' => 'Скачать шаблон для загрузки']
+                ) ?>
             </p>
+
             <?= Html::beginForm(['store-city-list/import'], 'post', ['enctype' => 'multipart/form-data', 'class' => 'row row-cols-lg-auto g-3 align-items-center']) ?>
 
             <div class="form-group">
@@ -51,17 +67,35 @@ $this->params['breadcrumbs'][] = $this->title;
         'columns' => [
             ['class' => 'yii\grid\SerialColumn'],
 
-            'id',
+            [
+                'attribute' => 'id',
+                'width' => '50px',
+                'headerOptions' => ['title' => 'Уникальный идентификатор записи'],
+            ],
             [
                 'attribute' => 'parent_id',
                 'value' => function ($model) {
-                    return $model->parent ? $model->parent->name : '';
+                    return $model->parent ? $model->parent->name : 'Российская Федерация';
                 },
-                'label' => 'Родитель',
+                'label' => 'Административный центр',
+                'width' => 'auto',
+                'headerOptions' => ['title' => 'Иерархический родитель элемента (для регионов - РФ, для городов - регион и тд)'],
+            ],
+            [
+                'attribute' => 'name',
+                'label' => 'Название',
+                'headerOptions' => ['title' => 'Название административного подразделения'],
+            ],
+            [
+                'attribute' => 'type',
+                'label' => 'Тип',
+                'headerOptions' => ['title' => 'Тип административного подразделения (регион, город, район) - для фильтрации ввести - region, city, district'],
+            ],
+            [
+                'attribute' => 'created_at',
+                'label' => 'Дата создания',
+                'headerOptions' => ['title' => 'Дата добавления записи в систему'],
             ],
-            'name',
-            'type',
-            'created_at',
             [
                 'class' => ActionColumn::class,
                 'urlCreator' => function ($action, StoreCityList $model, $key, $index, $column) {
diff --git a/erp24/web/uploads/region_temp.xlsx b/erp24/web/uploads/region_temp.xlsx
new file mode 100644 (file)
index 0000000..f7d048a
Binary files /dev/null and b/erp24/web/uploads/region_temp.xlsx differ