![]() 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/keeview_app/html/ |
Upload File : |
hr.activities_meeting.deleteActivitiesMeeting = function(host, id){ return new Promise(function(resolve,reject){ ModalElement.show_loading(); FormClass.api_call({ url: "meetings_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.meetings.getIndex(id); host.database.meetings.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.activities_meeting.deleteActivitiesMeetingConfirm = function(host, id){ return new Promise(function(resolve,reject){ var index = host.database.meetings.getIndex(id); ModalElement.question({ title: LanguageModule.text("war_title_delete_activities_meeting"), message: LanguageModule.text2("war_txt_detele", [host.database.meetings.items[index].name]), onclick: function(sel){ if (sel == 0){ hr.activities_meeting.deleteActivitiesMeeting(host, id).then(function(value){ resolve(value); }); } } }); }); }; hr.activities_meeting.addActivitiesMeetingSubmit = function(host, id, getValueFunction){ return new Promise(function(resolve, reject){ var data = getValueFunction(); if (!data) return; var oldData; if (id > 0){ oldData = host.dataMeetingEdit; var ischange = contentModule.isChanged(oldData, data, ["name", "type", "location", "status", "starttime", "endtime", "allday", "reminder", "assignto", "participant", "result"] ); if (!ischange){ ModalElement.close(); return; } } for (var i = 0; i < host.database.meetings.items.length; i++){ if (host.database.meetings.items[i].id == id) continue; if (host.database.meetings.items[i].name.toLowerCase() == data.name.toLowerCase()){ ModalElement.alert({message: LanguageModule.text("war_txt_exist_name")}); return; } } data.id = id; data.status = data.status ? 1 : 0; data.allday = data.allday ? 1 : 0; participantStr = ""; data.participant.forEach(function(elt){ participantStr += "_" + elt; }); if (participantStr != "") participantStr += "_"; data.participant = participantStr; if (id > 0){ var index = host.database.meetings.getIndex(id); data.ver = host.dataMeetingEdit.ver; } else { data.ver = 1; } data.extrainfo = EncodingClass.string.fromVariable(data.extrainfo); ModalElement.show_loading(); FormClass.api_call({ url: "activities_meeting_save.php", params: [{name: "data", value: EncodingClass.string.fromVariable(data)}], func: function(success, message){ ModalElement.close(-1); if (success){ if (message.substr(0, 2) == "ok"){ host.dataMeetingEdit = EncodingClass.string.toVariable(message.substr(2)); if (host.dataMeetingEdit.extrainfo == "") host.dataMeetingEdit.extrainfo = {}; else host.dataMeetingEdit.extrainfo = EncodingClass.string.toVariable(host.dataMeetingEdit.extrainfo); var strIdx = 0; var participantStr = host.dataMeetingEdit.participant; var strLength = participantStr.length; var participant = []; while (strIdx < strLength - 2){ var num = parseInt(participantStr[strIdx + 1]); if (!isNaN(num)) participant.push(num); strIdx += 2; } host.dataMeetingEdit.participant = participant; if (id > 0){ var index = host.database.meetings.getIndex(id); host.database.meetings.items[index] = host.dataMeetingEdit; host.drawGeneralInforFunc(); } else { id = host.dataMeetingEdit.id; data.id = id; host.id = id; host.database.meetings.items.push(host.dataMeetingEdit); hr.activities_meeting.redraw(host); // hr.activities_meeting.showActivitiesMeeting() } resolve(hr.activities_meeting.getCellActivitiesMeeting(host, id)); ModalElement.close(); hr.menu.changeCurrentUrlTab(host, "activities_meeting"); } else if (message == "lock_system"){ ModalElement.alert({message: LanguageModule.text("war_txt_system_lock")}); } else if (message == "deleted" || message == "edited"){ ModalElement.alert({ message: LanguageModule.text("war_txt_failed_ver_reload_data") }); } else if (message == "exist_name"){ ModalElement.alert({message: LanguageModule.text("war_txt_exist_name")}); } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); }); }; hr.activities_meeting.addActivitiesMeetingClose = function(host, id, getValueFunction, resolve, resolveAdd){ var data = getValueFunction(); if (!data) { ModalElement.close(); ModalElement.close(); return; } var oldData; if (id > 0){ oldData = host.dataMeetingEdit; } else { oldData = { name: "", type: "type_visit", location: "", status: 0, starttime: new Date(), endtime: new Date(), allday: 0, reminder: "type_reminder_none", assignto: 0, participant: [], result: "" }; } var ischange = contentModule.isChanged(oldData, data, ["name", "type", "location", "status", "starttime", "endtime", "allday", "reminder", "assignto", "participant", "result"] ); if (!ischange){ ModalElement.close(); return; } contentModule.questionChange({ onclick: function(sel){ if (sel == 0){ if (host.id == 0){ hr.activities_meeting.addActivitiesMeetingSubmit(host, host.id, getValueFunction).then(function(value){ resolveAdd(value); }); } else { hr.activities_meeting.addActivitiesMeetingSubmit(host, host.id, getValueFunction).then(function(value){ resolve(value); }); } } else if (sel == 1){ ModalElement.close(); } } }); }; hr.activities_meeting.redrawDetails = function(host, id, resolve, resolveAdd){ if (id > 0) hr.menu.changeCurrentUrlTab(host, "activities_meeting/" + id); host.id = id; function redraw(value){ var formContainer = DOMElement.div({}); ModalElement.showWindow({ title: LanguageModule.text("txt_activities_meeting"), bodycontent: formContainer, buttonlist: [ { text: LanguageModule.text("txt_save"), onclick: function(){ if (host.id == 0){ hr.activities_meeting.addActivitiesMeetingSubmit(host, host.id, getValueFunction).then(function(value){ resolveAdd(value); }); } else { hr.activities_meeting.addActivitiesMeetingSubmit(host, host.id, getValueFunction).then(function(value){ resolve(value); }); } } }, { text: LanguageModule.text("txt_cancel"), onclick: function(){ hr.activities_meeting.addActivitiesMeetingClose(host, host.id, getValueFunction, resolve, resolveAdd); } } ] }); var getValueFunction; contentModule.makeFormData({ typeid: host.form_config.meeting.typeid, formid: host.form_config.meeting.input_form, initialValue: value, formContainer: formContainer, typelists: host.database.typelists.items, variableType: "system" }).then(function(getValue){ getValueFunction = getValue; absol.form.traversal(formContainer.formFragment.view, function(item){ if (item.node.tag === "TextInput") { item.node.domElt.focus(); item.stop(); return; } }); }); }; if (id > 0){ redraw(host.dataMeetingEdit); } else { redraw({}); } }; hr.activities_meeting.addActivitiesMeeting = function(host, id, resolve, resolveAdd){ hr.activities_meeting.redrawDetails(host, id, resolve, resolveAdd); }; hr.activities_meeting.drawGeneralInformation = function(host, params){ var viewGeneralInformation = DOMElement.div({ attrs: { style: { paddingLeft: "var(--control-verticle-distance-2)", paddingTop: "var(--control-verticle-distance-2)" } } }); host.drawGeneralInforFunc = function(){ contentModule.makeOutputFormData({ typeid: host.form_config['meeting'].typeid, formid: host.form_config['meeting'].output_form, initialValue: host.dataMeetingEdit, formContainer: viewGeneralInformation, typelists: host.database.typelists.items, variableType: "system" }).then(function(getValue){}); }; host.drawGeneralInforFunc(); var childs = [ { class: 'mk-section-header-name', child: { text: LanguageModule.text("txt_general_information") }, } ]; childs.push({ class: 'mk-section-header-right', child: [ DOMElement.a({ attrs: { onclick: function(){ params.editInforFunc(); } }, text: LanguageModule.text("txt_edit") }) ] }); var res = absol.buildDom({ attr: { "data-sectionid": "general_information" }, child: [ absol.buildDom({ class: 'mk-section-header', child: childs }), viewGeneralInformation ] }); return res; }; hr.activities_meeting.showActivitiesMeeting = function(host, params){ hr.menu.changeCurrentUrlTab(host, "activities_meeting/" + params.meetingid); var nav = absol.buildDom({ tag:'mknav', class: 'mk-nav', props: { items: [ {text: LanguageModule.text("txt_general_information"), value: "general_information"}, {text: LanguageModule.text("txt_comment"), value: "comment"} ], value: "general_information" }, on:{ clickitem: function(event){ rightCtn.off('scroll',scrollRightFunc);// prevent loop if (sectionList[this.value]) sectionList[this.value].scrollIntoView(); setTimeout(function(){ rightCtn.on('scroll',scrollRightFunc ); }, 10); } } }); var scrollRightFunc = function(){ var elt; var bound = rightCtn.getBoundingClientRect(); var eltBound; var nearestEltId; var nearestDistance = 100000000; var distance; for (var i in sectionList){ elt = sectionList[i]; eltBound = elt.getBoundingClientRect(); distance = 1000000; if (eltBound.top <= bound.top){ if (eltBound.bottom >= bound.bottom){ distance = -1e6; } else if (bound.top - eltBound.top < 30){ distance = eltBound.top - bound.bottom;//negative } else if (eltBound.bottom > bound.top){ distance = bound.top - eltBound.top; } } else if (eltBound.top < bound.bottom){ distance = eltBound.top - bound.bottom;//negative } else { distance = Math.abs(bound.top - eltBound.top) } if (nearestDistance > distance){ nearestDistance = distance; nearestEltId = i; } } nav.value = nearestEltId; }; var rightCtn = absol.buildDom({ class: 'mk-main-right', style: { paddingBottom: "var(--footer-margin)" }, on: { scroll: scrollRightFunc } }); rightCtn.appendChild(hr.activities_meeting.drawGeneralInformation(host, params)); rightCtn.appendChild(contentModule.drawComment({taskid: params.meetingid, tablename: "meeting"})); var data_ctn = absol._({ class: 'mk-main', style: { height: '100%' }, child: [ { class: 'mk-main-left-ctn', child: [nav] }, rightCtn ] }); var sectionList = {}; absol.$("div", rightCtn, function(elt){ var id = elt.getAttribute("data-sectionid"); if (!id) return; sectionList[id] = elt; }); var singlePage = absol.buildDom({ tag: "singlepage", class: ["cd-page-not-padding-right", "as-viewport-full", "as-no-scroll"], child: [ DOMElement.div({ attrs: {className: 'button-panel-header absol-single-page-header'}, children: [ DOMElement.div({ attrs: {className: "single-button-header"}, children: [theme.backButton({ onclick: function(){ host.frameList.removeLast(); hr.menu.changeCurrentUrlTab(host, "activities_meeting"); } })] }) ] }), data_ctn ] }); host.frameList.addChild(singlePage); singlePage.requestActive(); }; hr.activities_meeting.showActivitiesMeetingPre = function(host, id, resolve){ if (host.database.meetings.getIndex(id) < 0) return; ModalElement.show_loading(); FormClass.api_call({ url: "database_load.php", params: [ {name: "task", value: "meeting_load_by_id"}, {name: "id", value: id} ], func: function(success, message){ ModalElement.close(-1); if (success){ if (message.substr(0, 2) == "ok"){ host.dataMeetingEdit = EncodingClass.string.toVariable(message.substr(2)); if (host.dataMeetingEdit.extrainfo == "") host.dataMeetingEdit.extrainfo = {}; else host.dataMeetingEdit.extrainfo = EncodingClass.string.toVariable(host.dataMeetingEdit.extrainfo); var strIdx = 0; var participantStr = host.dataMeetingEdit.participant; var strLength = participantStr.length; var participant = []; while (strIdx < strLength - 2){ var num = parseInt(participantStr[strIdx + 1]); if (!isNaN(num)) participant.push(num); strIdx += 2; } host.dataMeetingEdit.participant = participant; hr.activities_meeting.showActivitiesMeeting(host, { meetingid: id, editInforFunc: function(){ hr.activities_meeting.addActivitiesMeeting(host, id, resolve); } }); } else if (message == "war_txt_failed_data"){ ModalElement.alert({ message: LanguageModule.text("war_txt_failed_data"), func: function(){ hr.activities_meeting.init(host); } }); } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); }; hr.activities_meeting.getCellActivitiesMeeting = function(host, id){ var index = host.database.meetings.getIndex(id); var func = { view: function(resolve){ hr.activities_meeting.showActivitiesMeetingPre(host, id, resolve); }, }; func.delete = function(){ return new Promise(function(resolve,reject){ hr.activities_meeting.deleteActivitiesMeetingConfirm(host, id).then(function(value){ resolve(value); }); }); }; func.changeStatus = function(value){ hr.onboarding.activitiesStatusChangeSave(host, "meeting", id, value); }; var res = host.database.meetings.items[index]; res.func = func; return res; }; hr.activities_meeting.redraw = function(host){ var holderForSort = host.database.meetings.items.map(function(item){ return { item: item, val: absol.string.nonAccentVietnamese(item.name.toLowerCase()) } }); holderForSort.sort(function(a, b){ if (a.val < b.val) return -1; if (a.val > b.val) return 1; return 0; }); host.database.meetings.items = holderForSort.map(function(holder){ return holder.item; }); var displayDic = { status: true, name: true, assignto: true, userid: true, createdtime: true }; var columnList = contentModule.getColumnListFromDatatype(host, "meeting", displayDic); if (!host.user_column_configsDic["activities_meeting_list"]){ for (var i = 0; i < columnList.length; i++){ if (columnList[i].value == "status"){ var x = columnList[i]; console.log(x); columnList.splice(i, 1); columnList.unshift(x); break; } } } console.log(columnList); var redrawTableFunc = function(){ var data = []; for (var i = 0; i < host.database.meetings.items.length; i++){ data.push(hr.activities_meeting.getCellActivitiesMeeting(host, host.database.meetings.items[i].id)); } contentModule.getColumnListConfig(host, host.user_column_configsDic, columnList, "activities_meeting_list").then(function(value){ host.configColumnActivitiesMeeting = value; DOMElement.removeAllChildren(host.data_container); host.dataView = host.funcs.formActivitiesMeetingContentData({ data: data, inputsearchbox: host.inputsearchbox, configColumnActivitiesMeeting: host.configColumnActivitiesMeeting, configColumnFunc: function(){ contentModule.userColumnConfigForm({ type: "activities_meeting_list", columnList: columnList }).then(function(value){ host.user_column_configsDic["activities_meeting_list"] = value; redrawTableFunc(); }); } }); host.data_container.appendChild(host.dataView); }); }; redrawTableFunc(); }; hr.activities_meeting.init = function(host){ return new Promise(function(resolveMn, rejectMn){ host.database = {}; ModalElement.show_loading(); FormClass.api_call({ url: "database_load.php", params: [ {name: "task", value: "meetings_load_init"} ], func: function(success, message){ ModalElement.close(-1); if (success){ if (message.substr(0, 2) == "ok"){ var content = EncodingClass.string.toVariable(message.substr(2)); contentModule.makeDatabaseContent(host, content); host.form_config = contentModule.configVariable(host); // contentModule.makeInputFormDecode(host.database.input_forms.items); // hr.input_form.loadFormConstructorToAssembler(host.database.input_forms.items, host.database.typelists.items); host.user_column_configsDic = contentModule.getUser_column_configsDic(host); host.dictionary = { input_forms: contentModule.makeDictionaryIndex(host.database.input_forms.items), output_forms: contentModule.makeDictionaryIndex(host.database.output_forms.items), typelists: contentModule.makeDictionaryIndex(host.database.typelists.items), meetings: contentModule.makeDictionaryIndex(host.database.meetings.items), employees: contentModule.makeDictionaryIndex(host.database.employees.items), peoples: contentModule.makeDictionaryIndex(host.database.peoples.items) }; host.database.meetings.items.forEach(function(elt){ var strIdx = 0; var participantStr = elt.participant; var strLength = participantStr.length; var participant = []; while (strIdx < strLength - 2){ participant.push(parseInt(participantStr[strIdx + 1])); strIdx += 2; } elt.participant = participant; }) host.dictionary.users = {}; host.database.users.items.forEach(function(elt, index){ host.dictionary.users[elt.homeid] = index; }); host.inputsearchbox = absol.buildDom({ tag:'searchcrosstextinput', style: { width: "var(--searchbox-width)" }, props:{ placeholder: LanguageModule.text("txt_search") } }); var cmdbutton = { close: function(host){ return function (event, me) { if (hr.isMobile){ host.holder.selfRemove(); hr.menu.loadPage(100); } else { hr.menu.tabPanel.removeTab(host.holder.id); } } } (host), add: function(host){ return function (event, me) { hr.activities_meeting.addActivitiesMeeting(host, 0, function onSave(value){ host.newRecord = host.newRecord.updateCurrentRow(host.funcs.formActivitiesMeetingGetRow(host.configColumnActivitiesMeeting, value)); }, function onAdd(value){ host.newRecord = host.dataView.insertRow(host.funcs.formActivitiesMeetingGetRow(host.configColumnActivitiesMeeting, value)); }); } } (host) }; host.data_container = DOMElement.div({attrs: {style: {paddingBottom: "var(--footer-margin)"}}}); host.holder.addChild(host.frameList); var singlePage = host.funcs.formActivitiesMeetingInit({ cmdbutton: cmdbutton, data_container: host.data_container, inputsearchbox: host.inputsearchbox }); host.frameList.addChild(singlePage); singlePage.requestActive(); hr.activities_meeting.redraw(host); resolveMn(host); } else { ModalElement.alert({message: message}); } } else { ModalElement.alert({message: message}); } } }); }); };