Терминалы

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2021-12-27 14:56:06 +10:00
parent 913a67d400
commit 70d2ae2935
3 changed files with 65 additions and 1 deletions

View File

@ -408,6 +408,28 @@ class ProfileController extends Controller
$sidebar = $this->renderPartial('sidebar'); $sidebar = $this->renderPartial('sidebar');
$groups = self::readGroups(); $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')) {
// Обнаружены входные параметры
if (isset($vars['trmn'])) {
// Передан параметр
if ($warehouse = Warehouse::searchById(Warehouse::collectionName() . "/$warehouse")) {
// Найден склад
// Запись в буфер
$warehouse->trmn = $vars['trmn'];
// Запись в базу данных
$warehouse->update();
}
} else {
/**
* @todo Написать обработчик ошибок
*/
}
}
if (yii::$app->request->isPost) { if (yii::$app->request->isPost) {
// POST-запрос // POST-запрос

View File

@ -149,7 +149,7 @@ $panel ?? $panel = 'profile_panel_supplies_input_import';
<?= $form->field($warehouse, 'trmn', ['options' => ['class' => "mb-3"]]) <?= $form->field($warehouse, 'trmn', ['options' => ['class' => "mb-3"]])
->dropDownList($list, [ ->dropDownList($list, [
'onChange' => 'page_profile_settings(this.parentElement.parentElement, \'profile_panel_settings_company\')', 'onChange' => 'page_supplies_settings(this.parentElement.parentElement, ' . $warehouse->_key . ', \'profile_panel_supplies\')',
'disabled' => count($list) <= 1 'disabled' => count($list) <= 1
])->label(false); ?> ])->label(false); ?>

View File

@ -83,6 +83,48 @@ function page_profile_supplies_import_excel(form, warehouse, account, panel) {
return false; return false;
}; };
function page_supplies_settings(form, warehouse, panel) {
if (form == undefined) {
form = {
'_csrf': yii.getCsrfToken()
};
if (warehouse !== undefined) {
form._key = warehouse;
};
if (panel !== undefined) {
form.panel = panel;
};
} else {
form = $(form).serializeArray();
form.push({
name: "_key",
value: warehouse
});
form.push({
name: "panel",
value: panel
});
};
$.ajax({
url: '/profile/supplies',
type: 'post',
dataType: 'json',
data: form,
success: page_profile_response_success,
error: page_profile_response_error
});
// Реинициализация
initDropdownOem();
return false;
};
function page_profile_settings(form, panel) { function page_profile_settings(form, panel) {
if (form == undefined) { if (form == undefined) {
form = { form = {