|
@@ -1547,51 +1547,7 @@ function urlFetchKontrahenci(page) {
|
|
var btnGraphView = $('<button class="btn btn-primary smad-kontrahenci-graph-button" onClick="graphShowHide(\'kontrahenci\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>')
|
|
var btnGraphView = $('<button class="btn btn-primary smad-kontrahenci-graph-button" onClick="graphShowHide(\'kontrahenci\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>')
|
|
|
|
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
- btnAddAll.on('click', { pagination: data.body.pagination }, function (event) {
|
|
|
|
- // event.data.pagination: { [ filter_idGroup: ... ] }
|
|
|
|
- // fetch ids from request, set to LocatStorage, update selected on gui
|
|
|
|
- var postData = {}
|
|
|
|
- if ('filter_idGroup' in event.data.pagination && event.data.pagination['filter_idGroup']) postData['filter_idGroup'] = event.data.pagination['filter_idGroup']
|
|
|
|
- Object.keys(event.data.pagination).filter(function (key) {
|
|
|
|
- return ('f_' === key.substr(0, 2))
|
|
|
|
- }).forEach(function (filterKey) {
|
|
|
|
- var value = event.data.pagination[filterKey]
|
|
|
|
- postData[filterKey] = value
|
|
|
|
- })
|
|
|
|
- var thisButton = $(this)
|
|
|
|
- thisButton.attr('disabled', true)
|
|
|
|
- thisButton.text( thisButton.text() + '...' )
|
|
|
|
- p5UI__notifyAjaxCallback({ type: 'info', msg: "Pobieranie podmiotów/kontrahentów..." })
|
|
|
|
- global.fetch(URL_FETCH_KONTRAHENCI_IDS_AJAX, {
|
|
|
|
- credentials: 'same-origin',
|
|
|
|
- method: 'POST',
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
- },
|
|
|
|
- body: JSON.stringify(postData)
|
|
|
|
- })
|
|
|
|
- .then(function __parseJSON(response) {
|
|
|
|
- return response.json()
|
|
|
|
- })
|
|
|
|
- .then(function (json) {
|
|
|
|
- if ('success' === json.type && json.body && json.body.ids) {
|
|
|
|
- updateListIdBiAuditReaport('KONTRAHENCI', json.body.ids.map(function (id) {
|
|
|
|
- return parseInt(id)
|
|
|
|
- }))
|
|
|
|
- jQuery('#body-kontrahenci').find('input[name="kontrID[]"]').attr('checked', true)
|
|
|
|
- thisButton.attr('disabled', false)
|
|
|
|
- var txt = thisButton.text()
|
|
|
|
- thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
- p5UI__notifyAjaxCallback({ type: 'success', msg: "Dodano "+json.body.ids.length+" kontrahentów" })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch(function (e) {
|
|
|
|
- p5UI__notifyAjaxCallback({ type: 'error', msg: '' + e })
|
|
|
|
- thisButton.attr('disabled', false)
|
|
|
|
- var txt = thisButton.text()
|
|
|
|
- thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ btnAddAll.on('click', { type: 'kontrahenci', pagination: data.body.pagination }, addAllMatchesToReport);
|
|
$('#smad-filter-desc-kontrahenci').append(btnAddAll);
|
|
$('#smad-filter-desc-kontrahenci').append(btnAddAll);
|
|
$('#smad-filter-desc-kontrahenci').append(btnGraphView);
|
|
$('#smad-filter-desc-kontrahenci').append(btnGraphView);
|
|
}
|
|
}
|
|
@@ -1735,54 +1691,9 @@ function urlFetchPracownicy(page) {
|
|
var btnGraphView = $('<button class="btn btn-primary smad-pracownicy-graph-button" onClick="graphShowHide(\'pracownicy\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>')
|
|
var btnGraphView = $('<button class="btn btn-primary smad-pracownicy-graph-button" onClick="graphShowHide(\'pracownicy\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>')
|
|
|
|
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
- btnAddAll.on('click', { pagination: data.body.pagination }, function (event) {
|
|
|
|
- // event.data.pagination: { [ filter_idGroup: ... ] }
|
|
|
|
- // fetch ids from request, set to LocatStorage, redirect to '#KONTRAHENCI'
|
|
|
|
- var postData = {}
|
|
|
|
- if ('filter_idGroup' in event.data.pagination && event.data.pagination['filter_idGroup']) postData['filter_idGroup'] = event.data.pagination['filter_idGroup']
|
|
|
|
- Object.keys(event.data.pagination).filter(function (key) {
|
|
|
|
- return ('f_' === key.substr(0, 2))
|
|
|
|
- }).forEach(function (filterKey) {
|
|
|
|
- var value = event.data.pagination[filterKey]
|
|
|
|
- postData[filterKey] = value
|
|
|
|
- })
|
|
|
|
- var thisButton = $(this)
|
|
|
|
- thisButton.attr('disabled', true)
|
|
|
|
- thisButton.text( thisButton.text() + '...' )
|
|
|
|
- p5UI__notifyAjaxCallback({ type: 'info', msg: "Pobieranie pracowników..." })
|
|
|
|
- global.fetch(URL_FETCH_PRACOWNICY_IDS_AJAX, {
|
|
|
|
- credentials: 'same-origin',
|
|
|
|
- method: 'POST',
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
- },
|
|
|
|
- body: JSON.stringify(postData)
|
|
|
|
- })
|
|
|
|
- .then(function __parseJSON(response) {
|
|
|
|
- return response.json()
|
|
|
|
- })
|
|
|
|
- .then(function (json) {
|
|
|
|
- if ('success' === json.type && json.body && json.body.ids) {
|
|
|
|
- updateListIdBiAuditReaport('PRACOWNICY', json.body.ids.map(function (id) {
|
|
|
|
- return parseInt(id)
|
|
|
|
- }))
|
|
|
|
- thisButton.attr('disabled', false)
|
|
|
|
- var txt = thisButton.text()
|
|
|
|
- thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
- p5UI__notifyAjaxCallback({ type: 'success', msg: "Dodano "+json.body.ids.length+" pracowników" })
|
|
|
|
- window.location.hash = 'KONTRAHENCI'
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch(function (e) {
|
|
|
|
- p5UI__notifyAjaxCallback({ type: 'error', msg: '' + e })
|
|
|
|
- thisButton.attr('disabled', false)
|
|
|
|
- var txt = thisButton.text()
|
|
|
|
- thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ btnAddAll.on('click', { type: 'pracownicy', pagination: data.body.pagination }, addAllMatchesToReport);
|
|
$('#smad-filter-desc-pracownicy').append(btnAddAll);
|
|
$('#smad-filter-desc-pracownicy').append(btnAddAll);
|
|
$('#smad-filter-desc-pracownicy').append(btnGraphView);
|
|
$('#smad-filter-desc-pracownicy').append(btnGraphView);
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2612,6 +2523,93 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
|
|
};
|
|
};
|
|
global.p5UI_TableAjax_generateFunctionNode = p5UI_TableAjax_generateFunctionNode
|
|
global.p5UI_TableAjax_generateFunctionNode = p5UI_TableAjax_generateFunctionNode
|
|
|
|
|
|
|
|
+function addAllMatchesToReport(event) {
|
|
|
|
+ switch (event.data.type) {
|
|
|
|
+ case 'kontrahenci': break; // OK
|
|
|
|
+ case 'pracownicy': break; // OK
|
|
|
|
+ default: throw "Wrong type";
|
|
|
|
+ }
|
|
|
|
+ var postData = {}
|
|
|
|
+ if ('filter_idGroup' in event.data.pagination && event.data.pagination['filter_idGroup']) postData['filter_idGroup'] = event.data.pagination['filter_idGroup']
|
|
|
|
+ Object.keys(event.data.pagination).filter(function (key) {
|
|
|
|
+ return ('f_' === key.substr(0, 2))
|
|
|
|
+ }).forEach(function (filterKey) {
|
|
|
|
+ var value = event.data.pagination[filterKey]
|
|
|
|
+ postData[filterKey] = value
|
|
|
|
+ })
|
|
|
|
+ var thisButton = $(this)
|
|
|
|
+ thisButton.attr('disabled', true)
|
|
|
|
+ thisButton.text( thisButton.text() + '...' )
|
|
|
|
+
|
|
|
|
+ if ('pracownicy' === event.data.type) {
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'info', msg: "Pobieranie pracowników..." })
|
|
|
|
+ global.fetch(URL_FETCH_PRACOWNICY_IDS_AJAX, {
|
|
|
|
+ credentials: 'same-origin',
|
|
|
|
+ method: 'POST',
|
|
|
|
+ headers: { 'Content-Type': 'application/json' },
|
|
|
|
+ body: JSON.stringify(postData)
|
|
|
|
+ })
|
|
|
|
+ .then(function __parseJSON(response) {
|
|
|
|
+ return response.json()
|
|
|
|
+ })
|
|
|
|
+ .then(function (json) {
|
|
|
|
+ if ('success' === json.type && json.body && json.body.ids) {
|
|
|
|
+ updateListIdBiAuditReaport('PRACOWNICY', json.body.ids.map(function (id) {
|
|
|
|
+ return parseInt(id)
|
|
|
|
+ }))
|
|
|
|
+ // jQuery('#body-pracownicy').find('input[name="prID[]"]').attr('checked', true)
|
|
|
|
+ jQuery('#body-pracownicy').find('input[name="prID[]"]').each(function (idx, inputNode) {
|
|
|
|
+ inputNode.checked = true;
|
|
|
|
+ })
|
|
|
|
+ thisButton.attr('disabled', false)
|
|
|
|
+ var txt = thisButton.text()
|
|
|
|
+ thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
+ updateCountItemCheckedByType('pracownicy');
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'success', msg: "Dodano "+json.body.ids.length+" pracowników" })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(function (e) {
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'error', msg: '' + e })
|
|
|
|
+ thisButton.attr('disabled', false)
|
|
|
|
+ var txt = thisButton.text()
|
|
|
|
+ thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if ('kontrahenci' === event.data.type) {
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'info', msg: "Pobieranie podmiotów/kontrahentów..." })
|
|
|
|
+ global.fetch(URL_FETCH_KONTRAHENCI_IDS_AJAX, {
|
|
|
|
+ credentials: 'same-origin',
|
|
|
|
+ method: 'POST',
|
|
|
|
+ headers: { 'Content-Type': 'application/json' },
|
|
|
|
+ body: JSON.stringify(postData)
|
|
|
|
+ })
|
|
|
|
+ .then(function __parseJSON(response) {
|
|
|
|
+ return response.json()
|
|
|
|
+ })
|
|
|
|
+ .then(function (json) {
|
|
|
|
+ if ('success' === json.type && json.body && json.body.ids) {
|
|
|
|
+ updateListIdBiAuditReaport('KONTRAHENCI', json.body.ids.map(function (id) {
|
|
|
|
+ return parseInt(id)
|
|
|
|
+ }))
|
|
|
|
+ // jQuery('#body-kontrahenci').find('input[name="kontrID[]"]').attr('checked', true); // Not working
|
|
|
|
+ jQuery('#body-kontrahenci').find('input[name="kontrID[]"]').each(function (idx, inputNode) {
|
|
|
|
+ inputNode.checked = true;
|
|
|
|
+ })
|
|
|
|
+ thisButton.attr('disabled', false);
|
|
|
|
+ var txt = thisButton.text()
|
|
|
|
+ thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
+ updateCountItemCheckedByType('kontrahenci');
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'success', msg: "Dodano "+json.body.ids.length+" kontrahentów" })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(function (e) {
|
|
|
|
+ p5UI__notifyAjaxCallback({ type: 'error', msg: '' + e })
|
|
|
|
+ thisButton.attr('disabled', false)
|
|
|
|
+ var txt = thisButton.text()
|
|
|
|
+ thisButton.text( '...' === txt.substr(-3) ? txt.substr(0, txt.length - 3) : txt )
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
$(document).ready(function(){
|
|
$(document).ready(function(){
|
|
rootChangeForm();
|
|
rootChangeForm();
|