![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/tech_preview/hr/ |
Upload File : |
hr.partner_checkin.deletePartner_checkin = function(host, id){ return new Promise(function(resolve,reject){ ModalElement.show_loading(); FormClass.api_call({ url: "partner_checkin_delete.php", params: [{name: "id", value: id}], func: function(success, message){ ModalElement.close(-1); if (success){ if (message.substr(0, 2) == "ok"){ var index = host.database.partner_checkin.getIndex(id); host.database.partner_checkin.items.splice(index, 1); resolve(); } else if (message == "lock_system"){ ModalElement.alert({message: LanguageModule.text("war_txt_system_lock")}); } else if (message == "failed_used"){ ModalElement.alert({ message: LanguageModule.text("war_txt_can_not_delete") }); } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); }); }; hr.partner_checkin.deletePartner_checkinConfirm = function(host, id){ return new Promise(function(resolve,reject){ var index = host.database.partner_checkin.getIndex(id); ModalElement.question({ title: LanguageModule.text("war_title_delete_partner_checkin"), message: LanguageModule.text2("war_txt_detele", [""]), onclick: function(sel){ if (sel == 0){ hr.partner_checkin.deletePartner_checkin(host, id).then(function(value){ resolve(value); }); } } }); }); }; hr.partner_checkin.addPartner_checkinSubmit = function(host, data){ return new Promise(function(resolve, reject){ ModalElement.show_loading(); FormClass.api_call({ url: "partner_checkin_save_auto.php", params: [ {name: "data", value: EncodingClass.string.fromVariable(data)} ], func: function(success, message){ ModalElement.close(-1); if (success){ if (message.substr(0, 2) == "ok"){ var st = EncodingClass.string.toVariable(message.substr(2)); var index = host.database.partner.getIndex(st.partnerid); if (index > 0){ st.partner = host.database.partner.items[index].partner; st.address = host.database.partner.items[index].address; } else { st.partner = ""; st.address = ""; } host.database.partner_checkin.items.push(st); hr.partner_checkin.redraw(host); resolve(); } else { ModalElement.alert({message: message}); return; } } else { ModalElement.alert({message: message}); return; } } }); }); }; hr.partner_checkin.addPartner_checkin = function(host){ theme.formPartner_checkinEdit({ database: host.database, employeeOfMe: host.employeeOfMe, frameList: host.frameList, func: { save: function(data){ return hr.partner_checkin.addPartner_checkinSubmit(host, data); } }, partner_select_click_func: function(value){ return contentModule.selectPartnerForm(host.hostSelectPartner, {selectValue: true, value: value}); } }); }; hr.partner_checkin.getCellPartner_checkin = function(host, item){ var func = {}; if (host.employeeOfMe[0] == item.employeeid) func.delete = function(){ return new Promise(function(resolve,reject){ hr.partner_checkin.deletePartner_checkinConfirm(host, item.id).then(function(value){ resolve(value); for (var i = 0; i < host.dataView.length; i++){ if (host.dataView[i].id == id){ host.dataView.splice(i, 1); break; } } }); }); }; var res = item; res.func = func; return res; }; hr.partner_checkin.viewMaps = function(host){ var listEmp = {}, empid, lat, lng, x, gps; host.dataView.sort(function(a, b){ return a.checkintime.getTime() - b.checkintime.getTime(); }); var employeesDic = contentModule.makeDictionaryIndex(host.database.employees.items); var partnerDic = contentModule.makeDictionaryIndex(host.database.partner.items); var eIndex, pIndex; for (var i = 0; i < host.dataView.length; i++){ empid = host.dataView[i].employeeid; eIndex = employeesDic[empid]; if (eIndex === undefined) continue; pIndex = partnerDic[host.dataView[i].partnerid]; if (pIndex === undefined) continue; if (!listEmp[empid]){ listEmp[empid] = []; } if (host.dataView[i].checkin_follow_gps){ gps = host.dataView[i].checkingps; } else { gps = host.dataView[i].gps; } x = gps.indexOf(","); if (x > 0){ lat = parseFloat(gps.substr(0, x)); lng = parseFloat(gps.substr(x + 1)); } else continue; listEmp[empid].push({ lat: lat, lng: lng, info: { content: host.database.partner.items[pIndex].name + "<br>" + host.database.employees.items[eIndex].fullname + "<br>" + "<strong>"+ contentModule.getDateTimeView(host.dataView[i].checkintime) + "</strong>" } }); } var polylines = []; for (var x in listEmp){ polylines.push({ path: listEmp[x], id: x }); }; theme.formPartner_checkinViewMaps({ polylines: polylines, view_line: host.dataView.length <= 10, database: host.database, frameList: host.frameList }); }; hr.partner_checkin.loadDataPartnerList = function(host){ if (data_module.partnerReady){ host.database.partner = data_module.partner; host.partnerDataLoaded = true; } else { var partner = []; var loadData = function(startIndex){ FormClass.api_call({ url: "database_load.php", params: [ {name: "task", value: 'partner_checkin_load_partner'}, {name: "startIndex", value: startIndex} ], func: function(success, message){ if (success){ if (message.substr(0, 2) == 'ok'){ var content = EncodingClass.string.toVariable(message.substr(2)); partner = partner.concat(content.partner); if (content.done){ contentModule.makeDatabaseContent(host, { partner: partner }); host.partnerDataLoaded = true; } else { loadData(partner.length); } } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); }; loadData(0); } }; hr.partner_checkin.export = function(host){ ModalElement.alert({message: LanguageModule.text("txt_export_notification")}); if (host.typeView == "details"){ var x = contentModule.getDateTimeExcelExport(new Date()); var startWorker = function(result, fileName = "check_in_list_"+x+".xlsx") { var w; if(typeof(Worker) !== "undefined") { if(typeof(w) == "undefined") { w = new Worker(window.domain + "exceljs.js"); w.postMessage(result); } w.onmessage = function(event) { var data = event.data; if(data.name == "end") { var link = document.createElement('a'); link.href = window.URL.createObjectURL(data.data); link.download = fileName; link.click(); } } } else { console.log("Sorry, your browser does not support Web Workers..."); } } startWorker(host.data_container.excelData); } else { var x = contentModule.getDateTimeExcelExport(new Date()); var startWorker = function(result, fileName = "check_in_list_summary_"+x+".xlsx") { var w; if(typeof(Worker) !== "undefined") { if(typeof(w) == "undefined") { w = new Worker(window.domain + "exceljs.js"); w.postMessage(result); } w.onmessage = function(event) { var data = event.data; if(data.name == "end") { var link = document.createElement('a'); link.href = window.URL.createObjectURL(data.data); link.download = fileName; link.click(); } } } else { console.log("Sorry, your browser does not support Web Workers..."); } } startWorker(host.data_container.excelData); } }; hr.partner_checkin.redraw = function(host){ if (!host.filter_column_name) host.filter_column_name = "partner_checkin_list"; var partnerid, employeeid, cityid; if (host.fromPartner){ partnerid = host.partnerid; cityid = 0; } else if (host.fromReport){ partnerid = 0; cityid = 0; } else { partnerid = host.partner_select.value; cityid = host.nation_city_select.value[1]; } host.dataView = theme.formPartner_checkinContentData({ database: host.database, inputsearchbox: host.inputsearchbox, ctn: host.data_container, user_column_configsDic: host.user_column_configsDic, partnerid: partnerid, employeeid: employeeid, cityid: cityid, filter_column_name: host.filter_column_name, typeView: host.typeView, getCellPartner_checkin: function(item){ return hr.partner_checkin.getCellPartner_checkin(host, item); } }); }; hr.partner_checkin.init3 = function(host){ if (!host.partnerDataLoaded){ setTimeout(function(resolve, reject){ hr.partner_checkin.init3(host); }, 50); return; } ModalElement.close(-1); contentModule.makeParnerCheckinData(host); hr.partner_checkin.redraw(host); }; hr.partner_checkin.init2 = function(host){ return new Promise(function(resolveMn, rejectMn){ var x = contentModule.generateRelativeTime({ value: host.time_select.value, from: host.start_input.value, to: host.end_input.value }); x.start = new Date(x.start); x.end = new Date(x.end); var employees = host.employee_select.values; var employeeIdList = []; var orgDic = contentModule.makeDictionaryIndex(host.database.orgs.items); employees.forEach(function(employeeid){ if (employeeid > 0){ employeeIdList.push(employeeid); } else { var oIndex = host.database.orgs.getIndex(-employeeid); var orgIDList = contentModule.getDepartmentIDListPrivView(host, oIndex); for (var i = 0; i < orgIDList.length; i++){ oIndex = orgDic[orgIDList[i]]; host.database.orgs.items[oIndex].employeeIndexList.forEach(function(empIndex){ if (host.database.employees.items[empIndex].available){ employeeIdList.push(host.database.employees.items[empIndex].id); } }); } } }); employeeIdList.sort(function(a, b){ return a - b; }); if (employeeIdList.length == 0){ ModalElement.close(-1); DOMElement.removeAllChildren(host.data_container); return; } ModalElement.show_loading(); FormClass.api_call({ url: "database_load.php", params: [ {name: "task", value: "partner_checkin_load_init2"}, {name: "params", value: EncodingClass.string.fromVariable(x)}, {name: "employeeIdList", value: EncodingClass.string.fromVariable(employeeIdList)} ], func: function(success, message){ if (success){ if (message.substr(0, 2) == "ok"){ var st = EncodingClass.string.toVariable(message.substr(2)); console.log(st); st.partner_checkin.sort(function(a, b){ return b.checkintime.getTime() - a.checkintime.getTime(); }); console.log(host.database); contentModule.makeDatabaseContent(host, st); hr.partner_checkin.init3(host); resolveMn(host); } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); }); }; hr.partner_checkin.init = function(host){ return new Promise(function(resolveMn, rejectMn){ hr.menu.changeCurrentUrlTab(host, "partner_checkin"); ModalElement.show_loading(); host.hostSelectPartner = {}; host.database = {}; host.typeView = "details"; FormClass.api_call({ url: "database_load.php", params: [ {name: "task", value: "partner_checkin_load_init"} ], func: function(success, message){ if (success){ if (message.substr(0, 2) == "ok"){ var content = EncodingClass.string.toVariable(message.substr(2)); host.employeeOfMe = content.employeeOfMe; delete content.employeeOfMe; contentModule.makeDatabaseContent(host, content); host.form_config = contentModule.configVariable(host); host.user_column_configsDic = contentModule.getUser_column_configsDic(host); contentModule.makeCitiesIndex(host); contentModule.makeOrgsIndex(host); contentModule.makeEmployeeData(host); contentModule.makeEmployeesIndex(host); var cmdbutton = { close: function() { if (hr.isMobile){ host.holder.selfRemove(); hr.menu.loadPage(1000); } else { hr.menu.tabPanel.removeTab(host.holder.id); } }, add: function() { hr.partner_checkin.addPartner_checkin(host, 0); }, view_maps: function(){ hr.partner_checkin.viewMaps(host); } }; host.data_container = DOMElement.div({attrs: {style: {paddingBottom: "var(--footer-margin)"}}}); host.holder.addChild(host.frameList); var singlePage = theme.formPartner_checkinInit({ employeeOfMe: host.employeeOfMe, database: host.database, cmdbutton: cmdbutton, data_container: host.data_container, typeView: host.typeView, changeTimeFunc: function(){ hr.partner_checkin.init2(host); }, filter_change_func: function(){ hr.partner_checkin.redraw(host); // hr.partner_checkin.init2(host); }, change_type_view: function(type){ host.typeView = type; hr.partner_checkin.redraw(host); }, employeeOfMe: host.employeeOfMe, partner_select_click_func: function(value){ return contentModule.selectPartnerForm(host.hostSelectPartner, {allValue: true, value: value}); }, export: function(){ hr.partner_checkin.export(host); } }); host.employee_select = singlePage.employee_select; host.partner_select = singlePage.partner_select; host.nation_city_select = singlePage.nation_city_select; host.inputsearchbox = singlePage.inputsearchbox; host.time_select = singlePage.time_select; host.start_input = singlePage.start; host.end_input = singlePage.end; host.frameList.addChild(singlePage); singlePage.requestActive(); hr.partner_checkin.init2(host).then(function(value){ resolveMn(value); }); } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); hr.partner_checkin.loadDataPartnerList(host); }); };