public_html/layouts/basic/components/InterestsConflict.min.js
'use strict';
/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */"use strict";$.Class("AppComponents_InterestsConflict_Js",{/**
* Register unlock tab events
* @param {jQuery} container
*/registerUnlock:function registerUnlock(container){var form=container.find(".js-filter-form");App.Fields.Date.registerRange(form);var table=$("#js-unlock-table");table.hasClass("dataTable")&&table.DataTable().clear().destroy();var dt=app.registerDataTables(table,{processing:!0,serverSide:!0,paging:!0,searching:!1,lengthChange:!1,pageLength:15,ajax:{url:"index.php?module=AppComponents&action=InterestsConflict&mode=getUnlock",type:"POST",data:function data(_data){_data=$.extend(_data,form.serializeFormData());}},order:[[0,"desc"]],columns:[{data:"date_time"},{data:"user_id"},{data:"status",render:function render(data){return 1===data?"<span class=\"fas fa-check text-success\" title=\"".concat(app.vtranslate("JS_UNLOCK_STATUS_ACCEPTED"),"\"></span>"):2===data?"<span class=\"fas fa-times text-danger\" title=\"".concat(app.vtranslate("JS_UNLOCK_STATUS_REJECTED"),"\"></span>"):3===data?"<span class=\"fas fa-slash text-dark\" title=\"".concat(app.vtranslate("JS_UNLOCK_STATUS_CANCELED"),"\"></span>"):"<span class=\"fas fa-question text-warning\" title=\"".concat(app.vtranslate("JS_UNLOCK_STATUS_NEW"),"\"></span>")}},{data:"related"},{orderable:!1,data:"comment"},{orderable:!1,data:function data(row){var action=row.info?"<span class=\"fas fa-info-circle text-primary js-popover-tooltip mr-2\" data-content=\"".concat(row.info,"\"></span>"):"";return 0===row.status&&(action+="<button type=\"button\" class=\"btn btn-success btn-sm js-update\" data-id=\"".concat(row.id,"\" data-status=\"1\" title=\"").concat(app.vtranslate("BTN_UNLOCK_STATUS_ACTION_ACCEPT"),"\" data-js=\"click\"><span class=\"fas fa-check\"></span></button><button type=\"button\" class=\"btn btn-danger btn-sm ml-2 js-update\" data-id=\"").concat(row.id,"\" data-status=\"2\" title=\"").concat(app.vtranslate("BTN_UNLOCK_STATUS_ACTION_REJECT"),"\" data-js=\"click\"><span class=\"fas fa-times\"></span></button>")),action},defaultContent:""}]});container.find("input,select").on("change",function(){dt.ajax.reload();}),table.off("click",".js-update").on("click",".js-update",function(){AppConnector.request({module:"AppComponents",action:"InterestsConflict",mode:"updateUnlockStatus",id:this.dataset.id,status:this.dataset.status}).done(function(){app.showNotify({text:app.vtranslate("JS_SAVE_NOTIFY_OK"),type:"success"}),dt.ajax.reload(null,!1);}).fail(function(){app.showNotify({text:app.vtranslate("JS_ERROR"),type:"error"});});});},/**
* Register confirmations tab events
* @param {jQuery} container
*/registerConfirmations:function registerConfirmations(container){var form=container.find(".js-filter-form");App.Fields.Date.registerRange(form);var table=$("#js-confirm-table");table.hasClass("dataTable")&&table.DataTable().clear().destroy();var dt=app.registerDataTables(table,{processing:!0,serverSide:!0,paging:!0,searching:!1,lengthChange:!1,pageLength:15,ajax:{url:"index.php?module=AppComponents&action=InterestsConflict&mode=getConfirm",type:"POST",data:function data(_data2){_data2=$.extend(_data2,form.serializeFormData());}},order:[[0,"desc"]],columns:[{data:"date_time"},{data:"user"},{data:"status",render:function render(data){return 0===data?"<span class=\"fas fa-times text-success\"></span>":1===data?"<span class=\"fas fa-check text-danger\"></span>":2===data?"<span class=\"fas fa-slash text-dark\"></span>":"<span class=\"fas fa-question\"></span>"}},{data:"related"},{class:"details-control",orderable:!1,data:function data(row){var action=row.info?"<span class=\"fas fa-info-circle text-primary js-popover-tooltip mr-2\" data-content=\"".concat(row.info,"\"></span>"):"";return "base"===row.db?(action+="<button type=\"button\" class=\"btn btn-primary btn-sm js-update\" data-user=\"".concat(row.user_id,"\" data-related=\"").concat(row.related_id,"\" title=\"").concat(app.vtranslate("JS_INTERESTS_CONFLICT_SET_CANCELED"),"\"><span class=\"fas fa-minus\"></span></button>"),action):action},defaultContent:""}]});container.find("input,select").on("change",function(){dt.ajax.reload();}),table.off("click",".js-update").on("click",".js-update",function(){var _this=this;app.showConfirmModal({title:app.vtranslate("JS_ENTER_A_REASON"),showDialog:!0,multiLineDialog:!0,confirmedCallback:function confirmedCallback(notice,value){AppConnector.request({module:"AppComponents",action:"InterestsConflict",mode:"updateConfirmStatus",id:_this.dataset.user,baseRecord:_this.dataset.related,comment:value}).done(function(){app.showNotify({text:app.vtranslate("JS_SAVE_NOTIFY_OK"),type:"success"}),dt.ajax.reload(null,!1);}).fail(function(){app.showNotify({text:app.vtranslate("JS_ERROR"),type:"error"});});}});});}},{/**
* Register events
*/registerEvents:function registerEvents(){var container=$(".contentsDiv");switch(CONFIG.mode){case"unlock":AppComponents_InterestsConflict_Js.registerUnlock(container);break;case"confirm":AppComponents_InterestsConflict_Js.registerConfirmations(container);}}});
//# sourceMappingURL=InterestsConflict.min.js.map