Множественное исправление багов
This commit is contained in:
parent
d21c6ce0ed
commit
b3f2ef72da
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
));
|
||||
|
|
|
@ -241,7 +241,7 @@ use app\models\Search;
|
|||
<div class="my-3 p-3 d-flex rounded">
|
||||
<input type="text" class="mr-2 col-2 form-control button_clean" title="Производитель" placeholder="Производитель" value="<?= $model['prod'] ?>">
|
||||
<input type="text" class="mr-2 col form-control button_clean" title="Артикулы (через запятую)" placeholder="Артикулы (через запятую)">
|
||||
<button class="col-3 btn button_green button_clean" onclick="return product_panel_connect('<?= $model['catn'] ?>', '<?= $model['prod'] ?>', this.parentElement.children[1].value, this.parentElement.children[0].value);">Подключить аналог</button>
|
||||
<button class="col-3 btn button_green button_clean" onclick="return product_panel_connect('<?= $model['catn'] ?>', '<?= $model['prod'] ?>', this.parentElement.children[1].value, this.parentElement.children[0].value, 'products_list');">Подключить аналог</button>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
||||
|
|
Reference in New Issue