|
@@ -1010,6 +1010,103 @@ function addKontrahenciAllToGroup(event) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function removeKontrahenciFromGroup(event){
|
|
|
+ event.preventDefault;
|
|
|
+
|
|
|
+ var kontrahenciIdsArray = getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds');
|
|
|
+ if (kontrahenciIdsArray === null || !kontrahenciIdsArray || !kontrahenciIdsArray.length) {
|
|
|
+ showTextListIdKontrahentow = 'nie wybrano kontrahentów';
|
|
|
+ } else {
|
|
|
+ showTextListIdKontrahentow = '' + kontrahenciIdsArray.length + ' podmiotów/kontrahentów';
|
|
|
+ }
|
|
|
+
|
|
|
+ var groupId = localStorage.getItem("Bocian.biAuditForm.kontrahenci.filterIdGroup");
|
|
|
+ var removeTitle = "Czy chcesz usunąć z "
|
|
|
+ if(groupId === "0"){
|
|
|
+ removeTitle+= "systemu";
|
|
|
+ } else {
|
|
|
+ var arrayGroupOptions = [];
|
|
|
+ var listGroupStorage = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups');
|
|
|
+ // utworzenie tablicy Optionsów grupy
|
|
|
+ listGroupStorage.map(function(item) {
|
|
|
+ if (item.ID !== undefined) {
|
|
|
+ arrayGroupOptions[item.ID] = item.NAZWA;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ removeTitle+= "grupy ";
|
|
|
+ removeTitle+= arrayGroupOptions[groupId];
|
|
|
+ }
|
|
|
+ swal({
|
|
|
+ title: removeTitle,
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: 'Submit',
|
|
|
+ showLoaderOnConfirm: true,
|
|
|
+ preConfirm: function () {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+
|
|
|
+ if (!kontrahenciIdsArray || !kontrahenciIdsArray.length) {
|
|
|
+ reject('Wybierz kontrahentów');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ window.fetch(URL_ADD_KONTRAHENCI_TO_GROUP, {
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'contentType': 'applications/json'
|
|
|
+ },
|
|
|
+ credentials: 'same-origin',
|
|
|
+ body: JSON.stringify({
|
|
|
+ 'idGroup': getItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup'),
|
|
|
+ 'kontrahenciIds': getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds'),
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .then(function(response) {
|
|
|
+ return response.text();
|
|
|
+ })
|
|
|
+ .then(function(responseText) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ return JSON.parse(responseText);
|
|
|
+ } catch (e) {
|
|
|
+ throw responseText;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(function(result) {
|
|
|
+ result
|
|
|
+ if (result.type == 'success') {
|
|
|
+ p5UI__notifyAjaxCallback(result);
|
|
|
+ resolve(result.msg);
|
|
|
+ } else {
|
|
|
+ reject(result.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ allowOutsideClick: false
|
|
|
+ }).then((result) => {
|
|
|
+ if (result.value) {
|
|
|
+ swal({
|
|
|
+ type: 'success',
|
|
|
+ title: 'Ajax request finished!',
|
|
|
+ html: 'Submitted email: ' + result.value
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function removePracownikFromGroup(event){
|
|
|
+ event.preventDefault;
|
|
|
+
|
|
|
+ var pracownicyIdsArray = getItemLocalStorage('Bocian.biAuditForm.pracownicyIds');
|
|
|
+ if (pracownicyIdsArray === null || !pracownicyIdsArray || !pracownicyIdsArray.length) {
|
|
|
+ showTextListIdPracownikow = 'nie wybrano osób';
|
|
|
+ } else {
|
|
|
+ showTextListIdPracownikow = '' + pracownicyIdsArray.length + ' osób';
|
|
|
+ }
|
|
|
+ var groupId = localStorage.getItem("Bocian.biAuditForm.pracownicy.filterIdGroup");
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
function createGroupKontrahenci(event) {
|
|
|
event.preventDefault();
|
|
@@ -3053,6 +3150,8 @@ global.addKontrahenciToGroup = addKontrahenciToGroup;
|
|
|
global.addKontrahenciAllToGroup = addKontrahenciAllToGroup;
|
|
|
global.createPracownikAjax = createPracownikAjax;
|
|
|
global.createKontrahentAjax = createKontrahentAjax;
|
|
|
+global.removePracownikFromGroup = removePracownikFromGroup;
|
|
|
+global.removeKontrahenciFromGroup= removeKontrahenciFromGroup;
|
|
|
|
|
|
global.showViewUploadFile = showViewUploadFile;
|
|
|
global.parseCsvFile = parseCsvFile;
|