]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-405] stop list tab
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 17 Apr 2025 19:08:53 +0000 (22:08 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 17 Apr 2025 19:08:53 +0000 (22:08 +0300)
erp24/controllers/UsersMessageManagementController.php
erp24/views/users-message-management/index.php
erp24/web/js/users-message-management/index.js

index 33e9b6e240c642f759adbf4d82e32ab8cd98eb3a..231beae1339e2a1f030d1ee70ec1c7d98c3e556a 100644 (file)
@@ -21,6 +21,7 @@ use yii_app\records\Users;
 use yii_app\records\UsersEvents;
 use yii_app\records\UsersMessageManagement;
 use yii_app\records\UsersMessageManagementLogs;
+use yii_app\records\UsersStopList;
 use yii_app\records\UsersTelegram;
 use yii_app\records\UsersTelegramLog;
 use yii_app\services\WhatsAppService;
@@ -163,13 +164,15 @@ class UsersMessageManagementController extends Controller
             }
         }
 
+        $userStopList = UsersStopList::find()->with('author')->all();
+
         return $this->render('index', [
             'model' => $model,
             'links' => $dates,
             'month' => $month,
             'year' => $year,
             'tab' => $tab,
-
+            'userStopList' => $userStopList,
         ]);
     }
 
index c9785d298efbdbcdfbebe27cc026d73c217241de..2dd61a11be3ed6d163fb7ff398eafb855753c33d 100644 (file)
@@ -7,6 +7,7 @@ use dosamigos\datetimepicker\DateTimePicker;
 
 use yii_app\records\Admin;
 use yii_app\records\UsersMessageManagement;
+use yii_app\records\UsersStopList;
 
 /* @var $model UsersMessageManagement */
 /* @var $tab integer */
@@ -14,6 +15,7 @@ use yii_app\records\UsersMessageManagement;
 /** @var array $links */
 /** @var string $month */
 /** @var string $year */
+/** @var UsersStopList[] $userStopList */
 
 $this->registerJs('var tab = ' . \yii\helpers\Json::encode(['tab' => $tab]), \yii\web\View::POS_END);
 $this->registerJsFile('/js/users-message-management/index.js', ['position' => \yii\web\View::POS_END]);
@@ -68,6 +70,9 @@ $this->registerCss('
         <li class="nav-item1">
             <a class="nav-link text-primary" id="messageTabAnchor" href="javascript:showTab('messageTab');">Сообщения рассылки</a>
         </li>
+        <li class="nav-item1">
+            <a class="nav-link text-primary" id="stopListTabAnchor" href="javascript:showTab('stopListTab');">Стоп лист</a>
+        </li>
         <li class="nav-item1">
             <a class="nav-link text-primary" id="unloadingTabAnchor" href="javascript:showTab('unloadingTab');">Выгрузки</a>
         </li>
@@ -335,7 +340,37 @@ $this->registerCss('
 
                     ]) ?>
                 </div>
-
+            </div>
+            <div id="stopListTab">
+                <table id="stopListTable">
+                    <thead>
+                        <tr>
+                            <th></th>
+                            <th>Телефон</th>
+                            <th>Комментарий</th>
+                            <th>Дата</th>
+                            <th>Автор</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <?php foreach($userStopList as $userStop): /* @var $userStop UsersStopList */ ?>
+                            <tr>
+                                <td>
+                                    <?= Html::a('<svg aria-hidden="true" style="display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em;width:1.125em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M573 241C518 136 411 64 288 64S58 136 3 241a32 32 0 000 30c55 105 162 177 285 177s230-72 285-177a32 32 0 000-30zM288 400a144 144 0 11144-144 144 144 0 01-144 144zm0-240a95 95 0 00-25 4 48 48 0 01-67 67 96 96 0 1092-71z"></path></svg>',
+                                        ['/crud/users-stop-list/view', 'phone' => $userStop->phone], ['class' => 'btn btn-link', 'style' => 'max-width: 20px', 'target' => '_blank']) ?>
+                                    <?= Html::a('<svg aria-hidden="true" style="display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em;width:1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M498 142l-46 46c-5 5-13 5-17 0L324 77c-5-5-5-12 0-17l46-46c19-19 49-19 68 0l60 60c19 19 19 49 0 68zm-214-42L22 362 0 484c-3 16 12 30 28 28l122-22 262-262c5-5 5-13 0-17L301 100c-4-5-12-5-17 0zM124 340c-5-6-5-14 0-20l154-154c6-5 14-5 20 0s5 14 0 20L144 340c-6 5-14 5-20 0zm-36 84h48v36l-64 12-32-31 12-65h36v48z"></path></svg>',
+                                        ['/crud/users-stop-list/update', 'phone' => $userStop->phone], ['class' => 'btn btn-link', 'style' => 'max-width: 20px', 'target' => '_blank']) ?>
+                                    <?= Html::a('<svg aria-hidden="true" style="display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em;width:.875em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M32 464a48 48 0 0048 48h288a48 48 0 0048-48V128H32zm272-256a16 16 0 0132 0v224a16 16 0 01-32 0zm-96 0a16 16 0 0132 0v224a16 16 0 01-32 0zm-96 0a16 16 0 0132 0v224a16 16 0 01-32 0zM432 32H312l-9-19a24 24 0 00-22-13H167a24 24 0 00-22 13l-9 19H16A16 16 0 000 48v32a16 16 0 0016 16h416a16 16 0 0016-16V48a16 16 0 00-16-16z"></path></svg>',
+                                        ['/crud/users-stop-list/delete', 'phone' => $userStop->phone], ['class' => 'btn btn-link', 'style' => 'max-width: 20px', 'target' => '_blank', 'data-confirm' => 'Вы действительно хотите удалить этот элемент?', 'data-method' => 'POST']) ?>
+                                </td>
+                                <td><?= $userStop->phone ?></td>
+                                <td><?= $userStop->name ?></td>
+                                <td><?= $userStop->date ?></td>
+                                <td><?= $userStop->author->name ?? '-' ?></td>
+                            </tr>
+                        <?php endforeach; ?>
+                    </tbody>
+                </table>
             </div>
         </div>
     </div>
index 2dc46f57b6765395a676cf06c0b4b497efb557da..69e812448b7aacf1d26058fe631fc901556f078e 100644 (file)
@@ -1,6 +1,6 @@
 /* jshint esversion: 6 */
 
-const tabs = ['mainTab', 'messageTab', 'unloadingTab'];
+const tabs = ['mainTab', 'messageTab', 'stopListTab', 'unloadingTab'];
 
 function showTab(tabName) {
     $.each(tabs, function() {
@@ -42,12 +42,20 @@ $(document).ready(() => {
 
 
     $(".nav-link").on("click", function () {
-        if ($(this).attr("id") === "unloadingTabAnchor") {
+        if (['stopListTabAnchor', 'unloadingTabAnchor'].includes($(this).attr("id"))) {
             $("button[type='submit'].btn-primary").hide();
         } else {
             $("button[type='submit'].btn-primary").show();
         }
     });
+
+    $("#stopListTable").DataTable({
+        sorting: false,
+        info: false,
+        paging: true,
+        searching: true,
+        language: data_table_language
+    });
 });
 
 function fetchUsersCount () {