From 5a2c63a8a7c7abd0974d539d705c438e20b5b455 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 17 Apr 2025 22:08:53 +0300 Subject: [PATCH] [ERP-405] stop list tab --- .../UsersMessageManagementController.php | 5 ++- .../views/users-message-management/index.php | 37 ++++++++++++++++++- .../web/js/users-message-management/index.js | 12 +++++- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/erp24/controllers/UsersMessageManagementController.php b/erp24/controllers/UsersMessageManagementController.php index 33e9b6e2..231beae1 100644 --- a/erp24/controllers/UsersMessageManagementController.php +++ b/erp24/controllers/UsersMessageManagementController.php @@ -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, ]); } diff --git a/erp24/views/users-message-management/index.php b/erp24/views/users-message-management/index.php index c9785d29..2dd61a11 100644 --- a/erp24/views/users-message-management/index.php +++ b/erp24/views/users-message-management/index.php @@ -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(' + @@ -335,7 +340,37 @@ $this->registerCss(' ]) ?> - + +
+ + + + + + + + + + + + + + + + + + + + + +
ТелефонКомментарийДатаАвтор
+ ', + ['/crud/users-stop-list/view', 'phone' => $userStop->phone], ['class' => 'btn btn-link', 'style' => 'max-width: 20px', 'target' => '_blank']) ?> + ', + ['/crud/users-stop-list/update', 'phone' => $userStop->phone], ['class' => 'btn btn-link', 'style' => 'max-width: 20px', 'target' => '_blank']) ?> + ', + ['/crud/users-stop-list/delete', 'phone' => $userStop->phone], ['class' => 'btn btn-link', 'style' => 'max-width: 20px', 'target' => '_blank', 'data-confirm' => 'Вы действительно хотите удалить этот элемент?', 'data-method' => 'POST']) ?> + phone ?>name ?>date ?>author->name ?? '-' ?>
diff --git a/erp24/web/js/users-message-management/index.js b/erp24/web/js/users-message-management/index.js index 2dc46f57..69e81244 100644 --- a/erp24/web/js/users-message-management/index.js +++ b/erp24/web/js/users-message-management/index.js @@ -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 () { -- 2.39.5