//zaznaczanie element??a li?ie i operacje z tym zwi?ane var actionSelRow = new function() { this.checkboxRow; var ch_obj; var flow_id; var elrepl_total; var group_type; var bind = false; var value; var column; var ch = false; this.init = function () { if (ES_CONF.get.bind != undefined){ bind = ES_CONF.get.bind; }; flow_id = $(this.checkboxRow).attr('id'); // var checkboxRow_id = $(this.checkboxRow).attr('id'); if(flow_id != null && flow_id != ''){ if($(this.checkboxRow).is(':checked')){ ch = true; var selRowId = new Array(); var CookieSelRowId = showCookie('selRowId'); if(CookieSelRowId != false && CookieSelRowId != 'false'){ selRowId = JSON.parse(CookieSelRowId); for(i=0;i value){ $(elrepl).attr('value', value); $(elrepl).find('div').html(value); } if(val_elrepl_total > value){ $(elrepl_total).attr('value', value); $(elrepl_total).find('div').html(value); } } else { if(val_elrepl > value){ $(elrepl).attr('value', val_elrepl); $(elrepl).find('div').html(val_elrepl); } if(val_elrepl_total > value){ $(elrepl_total).attr('value', val_elrepl_total); $(elrepl_total).find('div').html(val_elrepl_total); } } } } */ } this.max = function () { /* if($(ch_obj).hasClass('fs_finish_max')) { var elrepl = $('span[column="'+column+'"][class="fs_finish_max_total"]'); var elrepl_total = $('span[column="'+column+'"][class="fs_finish_max"][name*="_'+flow_id+'_"]'); var val_elrepl = $(elrepl).attr('value'); var val_elrepl_total = $(elrepl_total).attr('value'); if(!isNaN(val_elrepl) && !isNaN(val_elrepl_total) && !isNaN(value)){ if(ch){ if(val_elrepl < value){ $(elrepl).attr('value', value); $(elrepl).find('div').html(value); } if(val_elrepl_total < value){ $(elrepl_total).attr('value', value); $(elrepl_total).find('div').html(value); } } else { if(val_elrepl < value){ $(elrepl).attr('value', val_elrepl); $(elrepl).find('div').html(val_elrepl); } if(val_elrepl_total < value){ $(elrepl_total).attr('value', val_elrepl_total); $(elrepl_total).find('div').html(val_elrepl_total); } } } } */ } this.sr = function () { /* if($(ch_obj).hasClass('fs_finish_sr')) { var elrepl = $('span[column="'+column+'"][class="fs_finish_sr_total"]'); var elrepl_total = $('span[column="'+column+'"][class="fs_finish_sr"][name*="_'+flow_id+'_"]'); var val_elrepl = $(elrepl).attr('value'); var val_elrepl_total = $(elrepl_total).attr('value'); if(!isNaN(val_elrepl) && !isNaN(val_elrepl_total) && !isNaN(value)){ if(ch){ $(elrepl).attr('value', 0); $(elrepl).find('div').html(0); $(elrepl_total).attr('value', 0); $(elrepl_total).find('div').html(0); } else { $(elrepl).attr('value', 0) ; $(elrepl).find('div').html(0); $(elrepl_total).attr('value', 0) ; $(elrepl_total).find('div').html(0); } } } */ } this.sum = function () { if($(ch_obj).hasClass('fs_finish_sum')) { var elrepl = $('span[column="'+column+'"][class="fs_finish_sum"][name*="_'+flow_id+'_"]'); var elrepl_total = $('span[column="'+column+'"][class="fs_finish_sum_total"]'); var val_elrepl = $(elrepl).attr('value'); var val_elrepl_total = $(elrepl_total).attr('value'); val_elrepl_total = parseFloat(val_elrepl_total); if(isNaN(val_elrepl_total)){ val_elrepl_total = 0; } if(!isNaN(val_elrepl) && !isNaN(val_elrepl_total) && !isNaN(value)){ $(elrepl).css('color', 'red'); $(elrepl_total).css('color', 'red'); if(ch){ new_val = val_elrepl -(- value); // new_val = new_val.toFixed(2); $(elrepl).attr('value', new_val); new_val = new_val.toLocaleString('pl'); $(elrepl).find('div').html(new_val); new_val_total = val_elrepl_total -(- value); $(elrepl_total).attr('value', new_val_total); // new_val_total = new_val_total.toFixed(2); new_val_total = new_val_total.toLocaleString('pl'); $(elrepl_total).find('div').html(new_val_total); } else { new_val = val_elrepl - value; $(elrepl).attr('value', new_val) ; // new_val = new_val.toFixed(2); new_val = new_val.toLocaleString('pl'); $(elrepl).find('div').html(new_val); new_val_total = val_elrepl_total - value; $(elrepl_total).attr('value', new_val_total) ; // new_val_total = new_val_total.toFixed(2); new_val_total = new_val_total.toLocaleString('pl'); $(elrepl_total).find('div').html(new_val_total); } } } } } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); // document.cookie = cname + '=a; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/'; document.cookie = cname + "=" + cvalue + "; " + expires; } function showCookie(name) { if (document.cookie!="") { //jeli document.cookie w ogistnieje var cookies=document.cookie.split("; "); //tworzymy z niego tablic?iastek for (var i=0; i'); $.ajax({ type: "POST", url: "custom/ajax/ajax_task.php", // async: false, data: { keyAction: groupActionKey, branch_id: $(obj).attr('branch_id'), aj_function: 'moveToNextPreStage' }, success: function(msg) { $(obj).attr('status', '3'); $(obj).addClass('icon-operator-is-not-blank'); $(obj).html(''); if(msg == 'true'){ $(obj).css( "color", "green" ); } else { $(obj).css( "color", "red" ); } groupActionCounter++; if(processgroupAction && groupActionCounter < groupActionRequests) { var count_row_send = groupActionRequests - groupActionCounter - 1; $('#count_row_send').html(count_row_send); groupActionSEND() } else { var count_row_send = groupActionRequests - groupActionCounter; $('#count_row_send').html(count_row_send); groupActionSTOP(); } }, complete: function() { $(obj).attr('status', '1'); $(obj).addClass('icon-operator-is-not-blank'); }, error: function() { $(obj).attr('status', '2'); $(obj).html(''); $(obj).addClass('icon-operator-is-not-blank'); $(obj).css( "color", "red" ); } }); } } $( document ).ready(function() { $('.js-select').click(function () { if($(this).attr('data-type') == 'SelectRows'){ ConvertEverything(true, false); } if($(this).attr('data-type') == 'SelectAllList'){ setCookie('SelectAllList', '1', 360); setCookie('UnSelectAll', '0', 360); ConvertEverything(true, false); } if($(this).attr('data-type') == 'SelectSum'){ ConvertEverything(false, true); } if($(this).attr('data-type') == 'SelectSumAll'){ setCookie('SelectSumAll', '1', 360); setCookie('UnSelectAll', '0', 360); ConvertEverything(false, true); } if($(this).attr('data-type') == 'SelectAllList'){ ConvertEverything(true, true); } if($(this).attr('data-type') == 'SelectAll'){ setCookie('SelectAll', '1', 360); setCookie('UnSelectAll', '0', 360); ConvertEverything(true, true); } if($(this).attr('data-type') == 'UnSelect'){ ConvertEverythingUnselected(true, true); } if($(this).attr('data-type') == 'UnSelectAll'){ setCookie('UnSelectAll', '0', 360); setCookie('SelectAllList', '0', 360); setCookie('SelectSumAll', '0', 360); ConvertEverythingUnselected(true, true); } }) $('input[id ^= "rec_"]').click(function () { actionSelRow.checkboxRow = this; actionSelRow.init(); }) $('input[id ^= "fs_finish_"]').click(function () { actionSelRow.checkboxRow = this; actionSelRow.init(); }) })