]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Выгрузка отчета в excel
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 11 Aug 2025 08:47:29 +0000 (11:47 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 11 Aug 2025 08:47:29 +0000 (11:47 +0300)
erp24/views/marketplace/priority.php
erp24/views/marketplace/report.php

index 6cd6d61461182029d12141c045263b0170c70f26..4ca5c0d29610568b6b4fd5d7e3029fdfcf9e757e 100644 (file)
@@ -14,11 +14,15 @@ th {
 }
 th span {
     /*border-radius: 50%;
-    border: 1px solid black;*/
-    min-width: 30px; font-size: 0.6rem;
+    border: 1px solid black;
+    min-width: 30px; */
+    
+    
+    font-size: 0.6rem;
     position: relative;
 }
 th>span.dt-column-order {
+
     position: absolute;
     right: 0px !important; 
     top: 0;
@@ -26,11 +30,11 @@ th>span.dt-column-order {
     width: 12px;
 }
 th>span>span{    
-    /* min-width: 30px; */
+
     font-size: 0.6rem;
     position: absolute;
     top: -1px;
-    right: -22px;
+    right: -5px;
 }
 ');
 ?>
index 6db472f35f4dd9e2a8abb0028fb60f33f3a2303d..8220f042872e5616eac2abe70a2d72dcb8912aa4 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 
+use kartik\grid\GridView;
 use kartik\select2\Select2;
 use yii\bootstrap\ActiveForm;
-use yii\grid\GridView;
+use kartik\export\ExportMenu;
 use yii\helpers\ArrayHelper;
 use yii\helpers\Html;
 use yii_app\records\CityStore;
@@ -73,29 +74,55 @@ $this->params['breadcrumbs'][] = $this->title;
         <?php ActiveForm::end() ?>
     </div>
 
-    <?= GridView::widget([
+    <?php
+    $columns = [
+        ['class' => 'yii\grid\SerialColumn'],
+        'name',
+        'articule',
+        'id',
+        [
+            'attribute' => 'is_valid',
+            'label' => 'Активен ли букет на МП?',
+            'value' => function ($model) {
+                return $model['is_valid'] ? 'Да' : 'Нет';
+            }
+        ],
+        [
+            'attribute' => 'reason',
+            'label' => 'Причина не активности',
+            'format' => 'raw',
+            'value' => function ($model) {
+                return nl2br(htmlspecialchars($model['reason'] ?? ''));
+            },
+        ],
+    ];
+    $exportMenu = ExportMenu::widget([
+        'container' => ['class' => 'btn-group mr-2 mt-2 mb-2'],
         'dataProvider' => $dataProvider,
-        'columns' => [
-            ['class' => 'yii\grid\SerialColumn'],
-            'name',
-            'articule',
-            'id',
-            [
-                'attribute' => 'is_valid',
-                'label' => 'Активен ли букет на МП?',
-                'value' => function ($model) {
-                    return $model['is_valid'] ? 'Да' : 'Нет';
-                }
-            ],
-            [
-                'attribute' => 'reason',
-                'label' => 'Причина не активности',
-                'format' => 'raw',
-                'value' => function ($model) {
-                    return nl2br(htmlspecialchars($model['reason'] ?? ''));
-                },
+        'columns' => $columns,
+        'exportConfig' => [
+            ExportMenu::FORMAT_EXCEL => [
+                'label' => 'Excel',
+                'options' => ['title' => 'Сохранить в Excel'],
             ],
+            ExportMenu::FORMAT_TEXT => false,
+            ExportMenu::FORMAT_HTML => false,
+            ExportMenu::FORMAT_CSV => false,
+            ExportMenu::FORMAT_PDF => false,
+
         ],
+        'filename' => 'export_' . date('Y-m-d'),
+        'showColumnSelector' => false,
+        'showConfirmAlert' => false,
+        'target' => ExportMenu::TARGET_SELF,
+        'dropdownOptions' => [
+            'label' => 'Экспорт данных',
+    ],
+    ]);
+    echo $exportMenu;?>
+    <?= GridView::widget([
+        'dataProvider' => $dataProvider,
+        'columns' => $columns
     ]); ?>
 
 </div>
\ No newline at end of file