diff --git a/mirzaev/skillparts/system/controllers/ProductController.php b/mirzaev/skillparts/system/controllers/ProductController.php index b4fc80d..0664a88 100644 --- a/mirzaev/skillparts/system/controllers/ProductController.php +++ b/mirzaev/skillparts/system/controllers/ProductController.php @@ -468,7 +468,11 @@ class ProductController extends Controller yii::$app->response->format = Response::FORMAT_JSON; // Запись в буфер возврата - $return['list'] = $this->renderPartial('analogs', ['model' => $from]); + $return['list'] = $this->renderPartial('analogs', [ + 'page' => 1, + 'amount' => yii::$app->request->post('amount') ?? yii::$app->request->get('amount') ?? 30, + 'model' => $from + ]); return $return; } diff --git a/mirzaev/skillparts/system/controllers/ProfileController.php b/mirzaev/skillparts/system/controllers/ProfileController.php index 2980f80..50f9eb7 100644 --- a/mirzaev/skillparts/system/controllers/ProfileController.php +++ b/mirzaev/skillparts/system/controllers/ProfileController.php @@ -50,7 +50,6 @@ class ProfileController extends Controller 'supplies', 'import', 'monitoring', - 'readGroups', 'geolocation-write', 'panel-suppliers-requests-search', 'imports-delete', @@ -428,7 +427,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); // Обработка настроек аккаунта if ($vars = yii::$app->request->post('Warehouse') ?? yii::$app->request->get('Warehouse') and $warehouse = yii::$app->request->post('_key') ?? yii::$app->request->get('_key')) { @@ -461,7 +459,6 @@ class ProfileController extends Controller return [ 'main' => $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )), @@ -472,7 +469,6 @@ class ProfileController extends Controller return $this->render('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); @@ -494,7 +490,6 @@ class ProfileController extends Controller $number = yii::$app->request->post('number') ?? yii::$app->request->get('number'); $warehouse = yii::$app->request->post('warehouse') ?? yii::$app->request->get('warehouse'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // AJAX-POST-запрос @@ -538,7 +533,6 @@ class ProfileController extends Controller return [ 'main' => $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )), @@ -563,7 +557,6 @@ class ProfileController extends Controller return [ 'main' => $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )), @@ -578,7 +571,6 @@ class ProfileController extends Controller return [ 'main' => $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )), @@ -586,21 +578,6 @@ class ProfileController extends Controller ]; } - public static function readGroups() - { - // Инициализация - $groups = []; - - foreach (SupplyGroup::read() as $group) { - // Перебор всех групп - - // Генерация [КЛЮЧ => ИМЯ] - $groups[$group->_key] = $group->name; - } - - return $groups; - } - /** * Инициализация данных о геолокации * @@ -1026,7 +1003,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // POST-запрос @@ -1097,7 +1073,6 @@ class ProfileController extends Controller // Запись в буфер вывода реинициализированного элемента $return['main'] = $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); @@ -1120,7 +1095,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // POST-запрос @@ -1140,7 +1114,6 @@ class ProfileController extends Controller // Запись в буфер вывода реинициализированного элемента $return['main'] = $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); @@ -1164,7 +1137,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // POST-запрос @@ -1222,7 +1194,6 @@ class ProfileController extends Controller // Запись в буфер вывода реинициализированного элемента $return['main'] = $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); @@ -1248,7 +1219,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // POST-запрос @@ -1340,7 +1310,6 @@ class ProfileController extends Controller // Запись в буфер вывода реинициализированного элемента $return['main'] = $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); @@ -1363,7 +1332,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // POST-запрос @@ -1414,7 +1382,6 @@ class ProfileController extends Controller // Запись в буфер вывода реинициализированного элемента $return['main'] = $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); @@ -1437,7 +1404,6 @@ class ProfileController extends Controller $supply = new Supply(yii::$app->request->post('Supply') ?? yii::$app->request->get('Supply')); $panel = yii::$app->request->post('panel') ?? yii::$app->request->get('panel'); $sidebar = $this->renderPartial('sidebar'); - $groups = self::readGroups(); if (yii::$app->request->isPost) { // POST-запрос @@ -1488,7 +1454,6 @@ class ProfileController extends Controller // Запись в буфер вывода реинициализированного элемента $return['main'] = $this->renderPartial('supplies', compact( 'supply', - 'groups', 'sidebar', 'panel' )); diff --git a/mirzaev/skillparts/system/views/product/index.php b/mirzaev/skillparts/system/views/product/index.php index 54ae048..e1e3858 100644 --- a/mirzaev/skillparts/system/views/product/index.php +++ b/mirzaev/skillparts/system/views/product/index.php @@ -241,7 +241,7 @@ use app\models\Search;
- +
diff --git a/mirzaev/skillparts/system/web/js/product_panel.js b/mirzaev/skillparts/system/web/js/product_panel.js index 7b07db0..57bc276 100644 --- a/mirzaev/skillparts/system/web/js/product_panel.js +++ b/mirzaev/skillparts/system/web/js/product_panel.js @@ -388,7 +388,7 @@ function product_panel_description_save(catn, prod, element) { * @param {*} catn * @returns */ -function product_panel_connect(catn, prod, target_catn, target_prod) { +function product_panel_connect(catn, prod, target_catn, target_prod, list) { if (catn !== null && catn !== undefined && prod !== null && prod !== undefined) { if (target_catn === undefined) { @@ -412,7 +412,22 @@ function product_panel_connect(catn, prod, target_catn, target_prod) { 'catn': target_catn, 'prod': target_prod }, - success: product_response_success, + success: (data, status, xhr) => { + if (data.list !== undefined && data.list !== null) { + // Найдены данные поставщиков + + // Запись cookie с номером страницы + Cookies.set('product_analogs_page', 1, { path: window.location.pathname }); + + // Инициализация оболочки + let wrap = document.getElementById(list); + + // Запись в документ + wrap.innerHTML = data.list; + + // Переход к остальным обработчикам + product_response_success(data, status, xhr); + }}, error: product_response_error });