Commit 476e20f3 authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

записи реестр - массовые действия

parent 26f7d817
...@@ -215,27 +215,6 @@ const registryTable = { ...@@ -215,27 +215,6 @@ const registryTable = {
}, () => null); }, () => null);
}, },
removeSelectedRow: function() {
UIkit.modal.confirm(i18n.tr('Вы действительно хотите удалить все выделенные записи реестра?'), {labels: {ok: i18n.tr('Да'), cancel: i18n.tr('Отмена')}}).then(() => {
Cons.showLoader();
try {
let promises = [];
this.selectedItems.forEach(docID => promises.push(deleteDoc(docID)));
Promise.all(promises).then(res => {
showMessage(i18n.tr("Все выделенные записи реестра удалены"), "success");
this.createBody();
Cons.hideLoader();
});
} catch (err) {
Cons.hideLoader();
showMessage(i18n.tr("Произошла ошибка при удалении записей реестра"), "error");
console.log(error);
}
}, () => null);
},
documentInfo: function(dataRow, e){ documentInfo: function(dataRow, e){
const createRow = (label, value) => $(`<tr><td>${label}</td><td>${value}</td></tr>`); const createRow = (label, value) => $(`<tr><td>${label}</td><td>${value}</td></tr>`);
...@@ -502,6 +481,27 @@ const registryTable = { ...@@ -502,6 +481,27 @@ const registryTable = {
}, 100); }, 100);
}, },
createMenuActions: function(massActions){
const {containerID, items} = massActions;
const menuContainer = $('<div uk-dropdown="mode: click">');
const nav = $('<ul>', {class: 'uk-nav uk-dropdown-nav'});
menuContainer.append(nav);
$(`#${containerID}`).append(menuContainer);
items.forEach(item => {
const {name, handler, className = ''} = item;
const navItem = $(`<li class="action-menu-item uk-disabled ${className}"><a href="#">${name}</a></li>`);
nav.append(navItem);
navItem.on('click', e => {
handler(this.selectedItems, () => {
this.createBody();
});
});
});
},
reset: function(){ reset: function(){
this.filterRights = []; this.filterRights = [];
this.allRights = []; this.allRights = [];
...@@ -577,6 +577,8 @@ const registryTable = { ...@@ -577,6 +577,8 @@ const registryTable = {
if(params.filterCode) this.filterCode = params.filterCode; if(params.filterCode) this.filterCode = params.filterCode;
if(params.searchString) this.searchString = params.searchString; if(params.searchString) this.searchString = params.searchString;
if(params.massActions) this.createMenuActions(params.massActions);
if(params.hasOwnProperty('sum') && params.sum) { if(params.hasOwnProperty('sum') && params.sum) {
this.sum = params.sum; this.sum = params.sum;
fire({type: 'change_label', text: localizedText('0', '0', '0', '0')}, this.sum.resultLabel); fire({type: 'change_label', text: localizedText('0', '0', '0', '0')}, this.sum.resultLabel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment