]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-417
authormarina <m.zozirova@gmail.com>
Thu, 22 May 2025 09:19:06 +0000 (12:19 +0300)
committermarina <m.zozirova@gmail.com>
Thu, 22 May 2025 09:19:06 +0000 (12:19 +0300)
erp24/controllers/WriteOffsErpController.php
erp24/views/bouquet/index.php
erp24/views/write_offs_erp/_form.php
erp24/views/write_offs_erp/index.php
erp24/views/write_offs_erp/update.php
erp24/views/write_offs_erp/view.php

index 566a16bd90288ec2fd62f3468ac1dc6b2d07f93a..bcdf521faec277c2706ecacc1c5522ef620d6f21 100644 (file)
@@ -177,7 +177,7 @@ class WriteOffsErpController extends Controller
         $listCauseDict = WriteOffsProductsErp::getCauseList();
         $model->listCauseDict = $listCauseDict;
 
-        $start = strtotime($model->getSendAt());
+        $start = strtotime($model->getSendAt() ?? '');
         $startCheck = time() - 300;
 
         if ($start > $startCheck) {
index a2a14bf5a30df98689340fce67f5fe7531ee26bf..acaf97ac16f2970c5c86e6f19eed5b4a5c203f95 100644 (file)
@@ -108,7 +108,7 @@ $this->title = 'Содержание матрицы';
                         $previewImageUrls = array_slice($allImageUrls, 0, 3);
                         $previewImageUrls += array_fill(0, 3 - count($previewImageUrls), null);
 
-                        $imageGalleryId = 'gallery-images-' . $model->id;
+                        $imageGaxxlleryId = 'gallery-images-' . $model->id;
                         $videoGalleryId = 'gallery-video-' . $model->id;
 
                         $hiddenLinks = "";
index 41afe87d81587cee52b7d7e1747af0ba76625787..0d60d758001254f19bfce7a6cab9bf63236e5948 100644 (file)
@@ -34,6 +34,20 @@ $this->registerJsFile('/js/validate/validateForm.js', ['position' => \yii\web\Vi
 $this->registerJsFile('/js/heic2any.min.js', ['position' => \yii\web\View::POS_END]);
 $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View::POS_END]);
 
+$this->registerJs(<<<JS
+document.addEventListener('DOMContentLoaded', function() {
+    const form = document.getElementById('my-upload-form');
+    const fileInput = form.querySelector('input[type="file"][name="image_name"]');
+
+    form.addEventListener('submit', function(e) {
+        if (!fileInput.files || fileInput.files.length === 0) {
+            alert('Пожалуйста, загрузите хотя бы один файл!');
+            e.preventDefault();
+        }
+    });
+});
+JS);
+
 ?>
 <style>
     .multiple-input-list .multiple-input-list__btn.js-input-plus {
@@ -145,84 +159,6 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
                 'title' => 'Причина списания',
                 'items' => $listCauseDict,
             ],
-            [
-                'name'  => 'images_row',
-                'type'  => BaseColumn::TYPE_STATIC,
-                'value' => function($data) {
-//                    $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp);
-                    if (!empty($data['id'])) {
-                        $query = WriteOffsProductsErp::find()
-                            ->andWhere([
-                                'write_offs_products_erp.id' => $data['id'],
-                                'write_offs_products_erp.active_product' => 1,
-                            ]);
-
-
-                        $query->joinWith(['imagesWriteOffsErp']);
-
-                        $action = $query->createCommand()->getRawSql();
-
-                        $modelWriteOffsProductsErp = $query->All();
-                        $productImagesList = [];
-                        $forWidget = false;
-                        foreach ($modelWriteOffsProductsErp as $item) {
-                            $productImagesList = WriteOffsErp::getImagesList($item->imagesWriteOffsErp, $forWidget);
-                        }
-                        if (!empty($productImagesList)) {
-//                            $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
-                            if ($forWidget) {
-                                $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
-                            } else {
-                                $dataTable = implode('', $productImagesList);
-                            }
-                        }
-                    }
-                    $test = 33;
-                    return $dataTable ?? '';
-                },
-                'headerOptions' => [
-//                    'style' => 'width: 70px;',
-                ]
-            ],
-            [
-                'name'  => 'images_row',
-                'type'  => BaseColumn::TYPE_STATIC,
-                'value' => function($data) {
-//                    $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp);
-                    if (!empty($data['id'])) {
-                        $query = WriteOffsProductsErp::find()
-                            ->andWhere([
-                                'write_offs_products_erp.id' => $data['id'],
-                                'write_offs_products_erp.active_product' => 1,
-                            ]);
-
-
-                        $query->joinWith(['imagesWriteOffsErp']);
-
-                        $action = $query->createCommand()->getRawSql();
-
-                        $modelWriteOffsProductsErp = $query->All();
-                        $productImagesList = [];
-                        $forWidget = false;
-                        foreach ($modelWriteOffsProductsErp as $item) {
-                            $productImagesList = WriteOffsErp::getImagesList($item->imagesWriteOffsErp, $forWidget);
-                        }
-                        if (!empty($productImagesList)) {
-//                            $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
-                            if ($forWidget) {
-                                $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
-                            } else {
-                                $dataTable = implode('', $productImagesList);
-                            }
-                        }
-                    }
-                    $test = 33;
-                    return $dataTable ?? '';
-                },
-                'headerOptions' => [
-//                    'style' => 'width: 70px;',
-                ]
-            ],
             [
                 'name'  => 'add_image',
                 'type'  => $checkBoxType,
@@ -242,7 +178,8 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
                         'accept' => 'image/*',
                         'name'  => 'image_name',
                         'capture' => '',
-                        'class' => 'file'
+                        'class' => 'file',
+                        'required' => true,
                     ],
                     'pluginOptions' => [
 //                        'previewFileType' => ['jpg','png'],
@@ -274,37 +211,75 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
                     'class' => 'custom_css_class_file_input'
                 ]
             ],
+            [
+                'name'  => 'images_row',
+                'type'  => BaseColumn::TYPE_STATIC,
+                'value' => function($data) {
+//                    $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp);
+                    if (!empty($data['id'])) {
+                        $query = WriteOffsProductsErp::find()
+                            ->andWhere([
+                                'write_offs_products_erp.id' => $data['id'],
+                                'write_offs_products_erp.active_product' => 1,
+                            ]);
+
+
+                        $query->joinWith(['imagesWriteOffsErp']);
+
+                        $action = $query->createCommand()->getRawSql();
+
+                        $modelWriteOffsProductsErp = $query->All();
+                        $productImagesList = [];
+                        $forWidget = false;
+                        foreach ($modelWriteOffsProductsErp as $item) {
+                            $productImagesList = WriteOffsErp::getImagesList($item->imagesWriteOffsErp, $forWidget);
+                        }
+                        if (!empty($productImagesList)) {
+//                            $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
+                            if ($forWidget) {
+                                $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
+                            } else {
+                                $dataTable = implode('', $productImagesList);
+                            }
+                        }
+                    }
+                    $test = 33;
+                    return $dataTable ?? '';
+                },
+                'headerOptions' => [
+//                    'style' => 'width: 70px;',
+                ]
+            ],
             [
                 'name'  => 'videoFiles',
-                'title' => 'Видео: mp4, webm, ogg, mov',
+                'title' => 'Видео: mp4, mov, avi',
                 'type'  => FileInput::className(),
                 'options' => [
                     'options' => [
-                        'multiple' => true,
+                        'multiple' => false,
                         'accept' => 'video/*',
                         'name'  => 'video_name',
-                        'capture' => '',
                         'class' => 'file'
                     ],
                     'pluginOptions' => [
-                        'showPreview' => false, // отключено, т.к. видео превью не поддерживаются по умолчанию
-                        'showCaption' => true,
-                        'showRemove' => true,
-                        'showUpload' => false,
-                        'overwriteInitial' => true,
+                        'showPreview' => false,          // без превью
+                        'showCaption' => true,           // показать название файла
+                        'showRemove' => true,            // кнопка удаления
+                        'showUpload' => false,           // не показывать кнопку загрузки
                         'browseIcon' => '+',
                         'cancelIcon' => 'x',
                         'removeIcon' => '-',
                         'buttonLabelClass' => 'hidden',
                         'fileActionSettings' => ['showUpload' => false],
-                        'maxFileCount' => 10,
-                        'allowedFileExtensions' => ['mp4', 'webm', 'ogg', 'mov'],
-                        'multiple' => true
+                        'maxFileSize' => 51200,
+                        'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
+                        'maxFileCount' => 1
                     ],
                     'model' => $multipleUploadForm,
                 ],
                 'columnOptions' => [
-                    'class' => 'custom_css_class_file_input'
+                    'class' => 'custom_css_class_file_input',
+                    'style' => 'min-width: 240px;'
                 ]
             ],
 
@@ -341,4 +316,6 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
     }
     ?>
 
+
+
 </div>
index bc01668dcc81b347e6b31236cb752396ac6e3dfb..83853dd2bb7c2887a94649ece9390efc3ecaf92b 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 //use dosamigos\datepicker\DatePicker;
+use BaconQrCode\Writer;
 use yii_app\records\CityStore;
 use yii_app\records\WriteOffsErp;
 use yii\helpers\Html;
@@ -94,8 +95,20 @@ if (!$isShowSum) {
 
     <p>
         <?php
+        require_once Yii::getAlias('@app/inc/phpqrcode/qrlib.php');
+
         if ($isCanCreateWriteOff) {
+            $url = Url::to(['create'], true);
+
+            // Генерируем QR-код в память (без файла)
+            ob_start();
+            QRcode::png($url, null, QR_ECLEVEL_L, 4);
+            $imageString = ob_get_clean();
+
+            $imgSrc = 'data:image/png;base64,' . base64_encode($imageString);
+
             echo Html::a('Создать документ списания в ERP', ['create'], ['class' => 'btn btn-success']);
+            echo "<br><br><img src=\"$imgSrc\" alt=\"QR Code\">";
         }
         ?>
     </p>
index 3f732b24ecc75bffa274cbf864bda7cd929ce99d..453cee68db9e1db14d423256893494d3ff2c320b 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use yii\helpers\Html;
+use yii\helpers\Url;
 
 /** @var yii\web\View $this */
 /** @var yii_app\records\WriteOffsErp $model */
@@ -19,6 +20,23 @@ $this->params['breadcrumbs'][] = 'Update';
 
     <h1><?= Html::encode($this->title) ?></h1>
 
+    <p>
+        <?php
+        if ($model->status != \yii_app\records\WriteOffsErp::STATUS_SEND) {
+            require_once Yii::getAlias('@app/inc/phpqrcode/qrlib.php');
+
+            $url = Url::to(['update', 'id' => $model->id], true);
+
+            ob_start();
+            QRcode::png($url, null, QR_ECLEVEL_L, 4);
+            $imageString = ob_get_clean();
+
+            $imgSrc = 'data:image/png;base64,' . base64_encode($imageString);
+            echo "<br><br><img src=\"$imgSrc\" alt=\"QR Code\">";
+        }
+        ?>
+    </p>
+
 
     <?php
     if (!empty($errors)) {
index 7eb50f616b2204cf134074c299e31605ca687b65..91c665e61977aeb163353e43ea591fe894704597 100644 (file)
@@ -2,6 +2,8 @@
 
 use yii\helpers\ArrayHelper;
 use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\web\View;
 use yii\widgets\DetailView;
 use yii_app\helpers\File;
 use yii_app\records\WriteOffsErp;
@@ -20,161 +22,203 @@ $this->params['breadcrumbs'][] = ['label' => 'Write Offs Erps', 'url' => ['index
 $this->params['breadcrumbs'][] = $this->title;
 \yii\web\YiiAsset::register($this);
 
+
+$this->registerCssFile('@web/css/fancybox.css');
+$this->registerJsFile('@web/js/fancybox.umd.js', ['position' => View::POS_END]);
+
 $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::POS_HEAD]);
-?>
-<style>
-    .tumb img{
-        width: 100px;
+
+$this->registerJs(<<<JS
+document.addEventListener('DOMContentLoaded', function() {
+    if (typeof Fancybox !== 'undefined') {
+        Fancybox.bind('[data-fancybox="gallery"]', {
+            Toolbar: true,
+            closeButton: "top",
+            dragToClose: true,
+            animated: true
+        });
     }
-</style>
+});
+JS, \yii\web\View::POS_READY);
 
-<div class="write-offs-erp-view">
+?>
+    <style>
+        .tumb img {
+            width: 100px;
+        }
+    </style>
 
-    <h1><?= Html::encode($this->title) ?></h1>
+    <div class="write-offs-erp-view">
 
-    <h3><?php echo 'Номер ' . $model->number . ' от '. $model->date;?></h3>
-    <h4><b><?php echo $documentStatus;?></b></h4>
+        <h1><?= Html::encode($this->title) ?></h1>
 
-    <div style="overflow-x: scroll;">
-    <?php
+        <h3><?php echo 'Номер ' . $model->number . ' от ' . $model->date; ?></h3>
+        <h4><b><?php echo $documentStatus; ?></b></h4>
+
+        <div style="overflow-x: scroll;">
+            <?php
 
-    echo DetailView::widget([
-        'model' => $model,
-        'attributes' => [
+            echo DetailView::widget([
+                'model' => $model,
+                'attributes' => [
 //            'id',
-            'guid',
-            'date',
-            'number',
-            [
-                'attribute' => 'created_admin_id',
-                'value' => function ($model) {
-                    return $model->createdAdmin ? $model->createdAdmin->name : '';
-                }
-            ],
-            [
-                'attribute' => 'confirm_admin_id',
-                'value' => function ($model) {
-                    return $model->confirmAdmin ? $model->confirmAdmin->name : '';
-                }
-            ],
+                    'guid',
+                    'date',
+                    'number',
+                    [
+                        'attribute' => 'created_admin_id',
+                        'value' => function ($model) {
+                            return $model->createdAdmin ? $model->createdAdmin->name : '';
+                        }
+                    ],
+                    [
+                        'attribute' => 'confirm_admin_id',
+                        'value' => function ($model) {
+                            return $model->confirmAdmin ? $model->confirmAdmin->name : '';
+                        }
+                    ],
 //            'updated_admin_id',
 //            'store_id',
-            [
-                'attribute' => 'cityStoreName',
-                'label' => 'Магазин',
-                'value'=>function ($data) {
+                    [
+                        'attribute' => 'cityStoreName',
+                        'label' => 'Магазин',
+                        'value' => function ($data) {
 //                    $cityStore = \yii\helpers\ArrayHelper::getValue($data->getRelatedRecords(),'cityStore');
 //                    return $cityStore ? $cityStore->name_full : $data->store_id;
 //                    $cityStore = \yii\helpers\ArrayHelper::getValue($data->getRelatedRecords(),'cityStore');
-                    return $data->cityStoreList ? $data->cityStoreList->name_full : $data->store_id;
-                }
-            ],
+                            return $data->cityStoreList ? $data->cityStoreList->name_full : $data->store_id;
+                        }
+                    ],
 //            'store_guid',
 //            'based_on:ntext',
-            'write_offs_type',
-            'quantity',
-            'summ',
-            'comment:ntext',
-            'error_text:ntext',
-            [
-                'attribute' => 'status',
-                'filter' => WriteOffsErp::getStatusDict(),
-                'value' => function ($data) {
-                    return \yii\helpers\ArrayHelper::getValue(WriteOffsErp::getStatusDict(), $data->status);
-                }
-            ],
-            [
-                'attribute' => 'number_1c',
-                'value' => function ($data) {
-                    return $data->number_1c ?? '';
-                }
-            ],
+                    'write_offs_type',
+                    'quantity',
+                    'summ',
+                    'comment:ntext',
+                    'error_text:ntext',
+                    [
+                        'attribute' => 'status',
+                        'filter' => WriteOffsErp::getStatusDict(),
+                        'value' => function ($data) {
+                            return \yii\helpers\ArrayHelper::getValue(WriteOffsErp::getStatusDict(), $data->status);
+                        }
+                    ],
+                    [
+                        'attribute' => 'number_1c',
+                        'value' => function ($data) {
+                            return $data->number_1c ?? '';
+                        }
+                    ],
 
 //            'summ_retail',
 //            'created_at',
 //            'send_at',
 
-            [
-                'attribute' => 'send_at',
-                'value' => function ($data) {
-                    return $data->send_at ?? 'не отправлен';
-                }
-            ],
-//            'updated_at',
-            [
-                'attribute' => 'productsList',
-                'label' => 'Товары',
-                'format' => 'raw',
-                'value' => function ($model) {
-                    $dataTable = '<table>';
-                    $dataTable .= '<tr>';
-                        $dataTable .= '<th>Название</th>';
-                        $dataTable .= '<th>Количество</th>';
-                        if (!$model->isShowSum) {
-                            $dataTable .= '<th>Цена</th>';
-                            $dataTable .= '<th>Сумма</th>';
-                        }
-                        $dataTable .= '<th>Причина списания</th>';
-                        $dataTable .= '<th>Коментарий</th>';
-                        $dataTable .= '<th>Изображения</th>';
-                    $dataTable .= '</tr>';
-                    foreach ($model->writeOffsProductsErps as $key => $product) {
-                        $causeName = $product['cause_id'];
-                        if (!empty($model->listCauseDict)) {
-                            $causeName = ArrayHelper::getValue($model->listCauseDict, $product['cause_id']);
+                    [
+                        'attribute' => 'send_at',
+                        'value' => function ($data) {
+                            return $data->send_at ?? 'не отправлен';
                         }
-                        $forWidget = false;
-                        $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp, $forWidget);
-                        $dataTable .= '<tr>';
-                            $dataTable .= '<td>' . $product['name'] . '</td>';
-                            $dataTable .= '<td>' . $product['quantity'] . '</td>';
+                    ],
+//            'updated_at',
+                    [
+                        'attribute' => 'productsList',
+                        'label' => 'Товары',
+                        'format' => 'raw',
+                        'value' => function ($model) {
+                            $dataTable = '<table>';
+                            $dataTable .= '<tr>';
+                            $dataTable .= '<th>Название</th>';
+                            $dataTable .= '<th>Количество</th>';
                             if (!$model->isShowSum) {
-                                $dataTable .= '<td>' . $product['price'] . '</td>';
-                                $dataTable .= '<td>' . $product['summ'] . '</td>';
+                                $dataTable .= '<th>Цена</th>';
+                                $dataTable .= '<th>Сумма</th>';
                             }
-                            $dataTable .= '<td>' . $causeName . '</td>';
-                            $dataTable .= '<td>' . $product['comment'] . '</td>';
-                            $dataTable .= '<td>';
-
-                            if (!empty($images)) {
-                                if ($forWidget) {
-                                    $dataTable .= '<div class="gallery-container">';
-                                    $dataTable .= dosamigos\gallery\Gallery::widget(['items' => $images]);
-                                    $dataTable .= '</div>';
-                                } else {
-                                    $dataTable .= implode('', $images);
+                            $dataTable .= '<th>Причина списания</th>';
+                            $dataTable .= '<th>Коментарий</th>';
+                            $dataTable .= '<th>Изображения</th>';
+                            $dataTable .= '<th>Видео</th>';
+                            $dataTable .= '</tr>';
+                            foreach ($model->writeOffsProductsErps as $key => $product) {
+                                $causeName = $product['cause_id'];
+                                if (!empty($model->listCauseDict)) {
+                                    $causeName = ArrayHelper::getValue($model->listCauseDict, $product['cause_id']);
                                 }
-                            }
+                                $forWidget = false;
+                                $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp, $forWidget);
+                                $dataTable .= '<tr>';
+                                $dataTable .= '<td>' . $product['name'] . '</td>';
+                                $dataTable .= '<td>' . $product['quantity'] . '</td>';
+                                if (!$model->isShowSum) {
+                                    $dataTable .= '<td>' . $product['price'] . '</td>';
+                                    $dataTable .= '<td>' . $product['summ'] . '</td>';
+                                }
+                                $dataTable .= '<td>' . $causeName . '</td>';
+                                $dataTable .= '<td>' . $product['comment'] . '</td>';
+                                $dataTable .= '<td>'; ?>
+                                <?php $images = $model->imagesWriteOffsErp; ?>
+
+                                <?php if (!empty($images)): ?>
+                                    <div class="gallery-container">
+                                        <?php foreach ($images as $link): ?>
+                                            <?php
+                                            $image = \yii_app\records\Images::findOne(['id' => $link->image_id]);
+                                            if (!$image || empty($image->filename)) continue;
 
+                                            $url = $image->filename;
+                                            $caption = $image->original_name ?? '';
+                                            ?>
+                                            <a href="<?= Html::encode($url) ?>" data-fancybox="gallery"
+                                               data-caption="<?= Html::encode($caption) ?>">
+                                                <img src="<?= Html::encode($url) ?>" alt="<?= Html::encode($caption) ?>"
+                                                     style="max-width: 150px; margin: 5px; cursor: pointer;">
+                                            </a>
+                                        <?php endforeach; ?>
+                                    </div>
+                                <?php endif; ?>
+                                <?
+                                $dataTable .= '</td>';
+                                $dataTable .= '<td>';
+
+                                if (!empty($videos)) {
+                                    if ($forWidget) {
+                                        $dataTable .= '<div class="gallery-container">';
+                                        $dataTable .= dosamigos\gallery\Gallery::widget(['items' => $videos]);
+                                        $dataTable .= '</div>';
+                                    } else {
+                                        $dataTable .= implode('', $videos);
+                                    }
+                                }
 
-                            $dataTable .= '</td>';
-                        $dataTable .= '</tr>';
-                    }
-                    $dataTable .= '<tr>';
-                        $dataTable .= '<td></td>';
-                        $dataTable .= '<td></td>';
-                        if (!$model->isShowSum) {
+
+                                $dataTable .= '</td>';
+                                $dataTable .= '</tr>';
+                            }
+                            $dataTable .= '<tr>';
                             $dataTable .= '<td></td>';
-                            $dataTable .= '<td>' . $model->summ . '</td>';
-                        }
-                        $dataTable .= '<td></td>';
-                        $dataTable .= '<td></td>';
-                    $dataTable .= '</tr>';
-                    $dataTable .= '</table>';
-                    return $dataTable;
-                },
-            ]
-        ],
-    ]) ?>
-    </div>
+                            $dataTable .= '<td></td>';
+                            if (!$model->isShowSum) {
+                                $dataTable .= '<td></td>';
+                                $dataTable .= '<td>' . $model->summ . '</td>';
+                            }
+                            $dataTable .= '<td></td>';
+                            $dataTable .= '<td></td>';
+                            $dataTable .= '</tr>';
+                            $dataTable .= '</table>';
+                            return $dataTable;
+                        },
+                    ]
+                ],
+            ]) ?>
+        </div>
 
-    <div class="row">
-        <p class="error-text">
+        <div class="row">
+            <p class="error-text">
 
-        </p>
-    </div>
-    <p>
-        <?= Html::a('К списку', ['index'], ['class' => 'btn btn-primary']) ?>
+            </p>
+        </div>
+        <p>
+            <?= Html::a('К списку', ['index'], ['class' => 'btn btn-primary']) ?>
         <?php
         if ($model->status === \yii_app\records\WriteOffsErp::STATUS_CREATED) {
             echo Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
@@ -187,20 +231,20 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::
                 ],
             ]);
 
-           ?><p>
-                <?php
-                if ($isCanConfirmWriteOffs) {
-                    ?>
-                    <?= Html::beginForm(['/write-offs-erp/confirm-write-off'], 'POST', [
+            ?><p>
+            <?php
+            if ($isCanConfirmWriteOffs) {
+                ?>
+                <?= Html::beginForm(['/write-offs-erp/confirm-write-off'], 'POST', [
 
-                    ]); ?>
+                ]); ?>
 
-                    <?= Html::csrfMetaTags();?>
+                <?= Html::csrfMetaTags(); ?>
 
-                    <?php
-                    echo Html::button('Согласовать', [
-                        'class' => 'btn btn-success btn-lg',
-                        'onclick' => "
+                <?php
+                echo Html::button('Согласовать', [
+                    'class' => 'btn btn-success btn-lg',
+                    'onclick' => "
                             if (confirm('Вы уверены, что хотите согласовать этот документ?')) {
                                 $('.error-text').text('');
                                 $.ajax ({
@@ -225,12 +269,12 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::
                                 }
     
                                     "
-                    ]);
-                    ?>
-                    <?= Html::endForm(); ?>
-                    <?php
-                }
+                ]);
                 ?>
+                <?= Html::endForm(); ?>
+                <?php
+            }
+            ?>
             </p>
             <?php
         }
@@ -245,7 +289,7 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::
 
                     ]); ?>
 
-                    <?= Html::csrfMetaTags();?>
+                    <?= Html::csrfMetaTags(); ?>
 
                     <?php
                     echo Html::button('Отправить повторно', [
@@ -284,9 +328,9 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::
             <?php
         }
         ?>
-    </p>
+        </p>
 
-</div>
+    </div>
 <?php
 /*
 */
\ No newline at end of file