]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-85 Реализовать обмен данных с 1С Бухгалтерия
authormarina <m.zozirova@gmail.com>
Mon, 26 Aug 2024 12:18:01 +0000 (15:18 +0300)
committermarina <m.zozirova@gmail.com>
Mon, 26 Aug 2024 12:18:01 +0000 (15:18 +0300)
erp24/controllers/ApiController.php
erp24/views/api/store-guid-buh.php

index ab8d0481109b7e96b64d8105ec1505081507484e..66b4c62d87082790d5c8064d1e8eedfb86917194 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace app\controllers;
 
+use yii\db\StaleObjectException;
 use yii_app\records\AdminGroup;
 use yii_app\records\StoreGuidBuh;
 use kartik\select2\Select2;
@@ -455,4 +456,21 @@ class ApiController extends Controller
             'model' => $model
         ]);
     }
+
+    /**
+     * @throws \Throwable
+     * @throws StaleObjectException
+     */
+    public function actionDeleteStoreGuidBuh($id)
+    {
+        try {
+            if ($model = StoreGuidBuh::findOne($id)) {
+                $model->delete();
+            }
+        }catch (\Exception $e) {
+            throw new \Exception($e);
+        }
+
+        $this->redirect(Yii::$app->request->referrer);
+    }
 }
\ No newline at end of file
index 56b6038bc5bc3b8a43525d0126ffe9cfa245b8b3..333c639b35e391992d165afbd8a14c9384161ca6 100644 (file)
@@ -1,8 +1,10 @@
 <?php
 
 use kartik\form\ActiveForm;
+use yii\grid\ActionColumn;
 use yii\grid\GridView;
 use yii\helpers\Html;
+use yii\helpers\Url;
 use yii_app\records\CityStore;
 
 /** @var yii\web\View $this */
@@ -77,6 +79,25 @@ $this->params['breadcrumbs'][] = $this->title;
                     return date('d-m-Y H:i:s', strtotime($model->updated_at));
                 }
             ],
+            [
+                'class' => 'yii\grid\ActionColumn',
+                'template' => '{delete}',
+                'buttons' => [
+                    'delete' => function ($url, $model, $key) {
+                        return Html::a(
+                            '<span class="glyphicon glyphicon-trash"></span>',
+                            Url::to(['delete-store-guid-buh', 'id' => $model->id]),
+                            [
+                                'title' => 'Удалить',
+                                'data' => [
+                                    'confirm' => 'Вы уверены, что хотите удалить этот элемент?',
+                                    'method' => 'post',
+                                ],
+                            ]
+                        );
+                    },
+                ],
+            ],
         ],
     ]); ?>