function loadingTemplate() { return 'Пожалуйста подождите, мы готовим для вас отчет. '; } //таблица отчета function showRaportExport(type, raport_id) { var user_id = $('#session_user_id').val(); var agency_id = $('#session_agency_id').val(); var pr = { agency_id: agency_id, user_id: user_id, type: type, raport_id: raport_id, } main_selector = '#table-order_export-selection'; main_selector_fixet = '#table-order_export-selection-fixed'; main_class_selector = "#order_export"; /* var period = $('.filter-popup-type.period.active').attr('id'); pr.period = period; if (period == 'dates') { var onDate = $('#onDate').val(); var offDate = $('#offDate').val(); pr.onDate = onDate; pr.offDate = offDate; }*/ $.post('/ajax/getGridTableRaportExport.php', pr, function(data) { $('#order_export').show(); //console.log(data); $("#order_export").html(data); var $table_sales = $('#table-order_export-selection'); $table_sales.bootstrapTable('destroy'); $table_sales.bootstrapTable({ formatColumnsToggleAll: function () { return 'Выбрать все' }, /* treeShowField: 'fio', parentIdField: 'pid', onPostBody: function() { var columns = $table_sales.bootstrapTable('getOptions').columns if (columns && columns[0][0].visible) { $table_sales.treegrid({ initialState: 'collapsed', onChange: function() { $table_sales.bootstrapTable('resetView') } }) } },*/ onLoadSuccess: function() { $('#order_export .fixed-table-border').css('height', '0px'); //$(main_selector_fixet).hide(); $(main_selector).closest(".fixed-table-body").unbind("mouseup"); $(main_selector).closest(".fixed-table-body").unbind("mousedown"); setTimeout(function() { var th = $(main_selector + ' thead th'); for (var i = 0; i < th.length; i++) { var width = $(th[i]).find('.fht-cell').width(); $(main_class_selector + ' .fixed-table-header th').eq(i).find('.fht-cell').width(width); $(main_selector + ' thead th').eq(i).find('.fht-cell').width(width); } // getStatFixet(main_selector, main_selector_fixet, main_class_selector); }, 200); $(main_selector).closest(".fixed-table-body").css("cursor", "grab"); $(main_selector).closest(".fixed-table-body").mousedown(function() { $(this).css("cursor", "grabbing"); }); $(main_selector).closest(".fixed-table-body").mouseup(function() { $(this).css("cursor", "grab"); }); $(main_selector).closest(".fixed-table-body").addClass("dragscroll"); dragscroll.reset(); /* $(main_class_selector + ' .dropdown-item input').change(function() { //console.log(this); $(main_selector_fixet).hide(); setTimeout(function() { var th = $(main_selector + ' thead th'); for (var i = 0; i < th.length; i++) { var width = $(th[i]).find('.fht-cell').width(); $(main_class_selector + ' .fixed-table-header th').eq(i).find('.fht-cell').width(width); $(main_selector + ' thead th').eq(i).find('.fht-cell').width(width); } getStatFixet(main_selector, main_selector_fixet, main_class_selector); }, 500); });*/ }, onScrollBody: function(el) { var scrolltop = $(el).scrollTop(); $(main_selector_fixet + " .fixed-table-body").scrollTop(scrolltop); }, }); }); } function ajaxRequestExportRaport(params) { var url = "/ajax/raport_export_table.php"; var pr = { agency_id: $('#session_agency_id').val(), user_id: $('#session_user_id').val(), type: export_settings.type, raport_id: export_settings.raport_id, } $.post(url, pr, function(res) { // console.log(res); params.success(JSON.parse(res)); }); } $(document).ready(function() { $('body').on('click', '#openExportSetting', function() { export_settings.open(); }); $('body').on('click', '#export_excel_req', function() { $('#__TABLE_LIST').css('display', 'block'); // export_settings.export_req(); }); $('body').on('click', '#__TABLE_LIST div p', function (e) { $('#__TABLE_LIST').css('display', 'none'); let tableId = Number($(e.target).attr('data-table-id')); export_settings.raport_id = tableId; if(tableId > 0){ export_settings.open_raport(); } else { export_settings.export_req(); } /* __currTableId = tableId; if (tableId) { $('.crm__table').addClass('hidden'); $('.__stat_table').css('display', 'block'); __buildStatTable(tableId); } else { $('.crm__table').removeClass('hidden'); $('.__stat_table').css('display', 'none'); }*/ }); $('body').on('click', '#__TABLE_LIST_CLOSE', function (e) { $('#__TABLE_LIST').css('display', 'none'); }); });