Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

timeline.min.js 19KB

1234567891011121314151617181920212223242526272829303132333435
  1. var Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(i){class r extends t.Core.BaseComponent{constructor(){super(...arguments);this.isFilterApplied=!1;this.Followers=[];this.recordId=0}cssFiles(){return[]}jsFiles(){return["platform/automation/enums/eventtype.js","platform/forms/managers/formmanager.js","platform/automation/components/actions/externalfollowers.js","platform/apps/managers/stagemanager.js","platform/automation/managers/commentmanager.js","platform/automation/infos/comment.js","platform/automation/requests/comment.js","platform/automation/enums/commenttype.js"]}html(){return null}load(){}init(t){const i=this;i.render(t);i.loadJsFiles();let r="";if(n.Themes.Providers.Detail_Settings.Instance().InputParameters.length>0)for(let t of n.Themes.Providers.Detail_Settings.Instance().InputParameters)t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_versionguid"&&(r=t.Value.toString());i.loadDataComments(r,t);$(`#toggleCommentInputBtn_${t}`).click(function(){$(this).addClass("d-none");$(`#timelineHeaderRight_${t}`).removeClass("d-flex").addClass("d-none");$(`#timelineCommentInputWrap_${t}`).removeClass("d-none").addClass("d-flex")});$(`#closeCommentSearchBtn_${t}`).click(function(){$(`#toggleCommentInputBtn_${t}`).removeClass("d-none");$(`#timelineHeaderRight_${t}`).removeClass("d-none").addClass("d-flex");$(`#timelineCommentInputWrap_${t}`).removeClass("d-flex").addClass("d-none")});$(`#timelineCommentForm_${t}`).submit(function(n){n.preventDefault();i.saveComment(r,t)});$(`#timelineCommentInput_${t}`).on("input",function(){const n=$(this).val().toString().trim();n?$(`#saveCommentBtn_${t}`).removeClass("d-none"):$(`#saveCommentBtn_${t}`).addClass("d-none")})}loadJsFiles(){var t=this.jsFiles();n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(t,function(){n.Platform.TimeLine.Components.TimeLine.Instance().getFollowers()})}getFollowers(){var t=n.Themes.Providers.Detail_Settings.Instance().InputParameters.find(t=>t.Key=="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_recordid");t!=undefined&&(this.recordId=Number(t.Value),n.Platform.Automation.Managers.RuleManager.Instance().GetFollwersByPkid(this.recordId).then(function(n){n.result!=null&&(r.Instance().Followers=n.result)}))}render(n){$("#"+n).empty();let t=`<div id="timeLineWrap_${n}" class="timeline-wrap card d-flex flex-column r-gap-15 pa-10">
  2. <div class="flex-between-center position-relative text-dark c-gap-5 c-gap-sm-10 timeline-header"><div class="timeline-header-left flex-grow-1"><a href="javascript:;" class="btn btn-outline-primary btn-sm d-md-none" id="toggleCommentInputBtn_${n}">Comment</a><div id="timelineCommentInputWrap_${n}" class="d-none d-md-flex align-items-center c-gap-10 flex-grow-1"><div class="d-flex position-relative c-gap-10 flex-grow-1"><form id="timelineCommentForm_${n}" method="post" class="w-100"><input type="text" id="timelineCommentInput_${n}" class="form-control timeline-comment-input pr-40 shadow-none" placeholder="Type Comments here...." />
  3. <div class="d-flex align-items-center c-gap-5 absolute-top-center r-5"><a href="javascript:;" class="btn btn-flush-biz-theme btn-icon btn-file btn-rounded btn-sm flush-soft-hover d-30 d-none" data-tooltip="true" title="Upload file"><span class="btn-icon-wrap"><i class="las la-file-upload font-20"></i></i></span><input type="file" name="comment-file-upload"></a><button type="submit" id="saveCommentBtn_${n}" class="btn btn-flush-biz-theme btn-icon btn-rounded btn-sm flush-soft-hover d-30 save-comment-btn d-none" data-tooltip="true" title="Save"><span class="btn-icon-wrap"><i class="las la-paper-plane font-20"></i></span></button></div></form></div><a href="javascript:;" id="closeCommentSearchBtn_${n}" class="btn btn-icon btn-icon-circle btn-outline-danger btn-sm d-md-none"><span class="btn-icon-wrap"><i class="las la-times font-20"></i></span></a></div>
  4. </div>
  5. <div class="timeline-header-right d-flex align-items-center justify-content-end gap-5 c-gap-sm-10 flex-wrap" id="timelineHeaderRight_${n}">
  6. <a href="javascript:;" class="btn btn-icon btn-icon-circle btn-outline-primary btn-sm" data-tooltip="true" title="Call" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().loadform(3)"><span class="btn-icon-wrap"><i class="las la-phone font-20"></i></span></a><a href="javascript:;" class="btn btn-icon btn-icon-circle btn-outline-primary btn-sm" data-tooltip="true" title="Mail" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().loadform(0)"><span class="btn-icon-wrap"><i class="las la-envelope font-20"></i></span></a><a href="javascript:;" class="btn btn-icon btn-icon-circle btn-outline-primary btn-sm" data-tooltip="true" title="To Do" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().loadform(1)"><span class="btn-icon-wrap"><i class="las la-list font-20"></i></span></a>
  7. <a href="javascript:;" class="btn btn-icon btn-icon-circle btn-outline-primary btn-sm" data-tooltip="true" title="Sms" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().loadform(2)"><span class="btn-icon-wrap"><i class="las la-comment font-20"></i></span></a>
  8. <a href="javascript:;" class="btn btn-icon btn-icon-circle btn-outline-primary btn-sm" data-tooltip="true" title="Meetings" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().loadform(4)"><span class="btn-icon-wrap"><i class="las la-users font-20"></i></span></a><div class="timeline-filter-dropdown" id="timelineFilterDropdown_${n}">
  9. <a class="btn btn-icon btn-icon btn-icon-circle btn-outline-primary btn-sm" href="javascript:;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-tooltip="true" title="Filter">
  10. <span class="btn-icon-wrap"><i class="las la-filter font-20"></i></span>
  11. </a>
  12. <div class="dropdown-menu timeline_dropdown_menu biz-custom-dropdown" id="timelineFilterDropdownMenu_${n}" onclick="event.stopPropagation();">
  13. <div class="row biz-select2-wrap">
  14. <div class="col-sm-6">
  15. <select class="form-control mr-4 event_filter" id="eventFilterSelect_${n}" data-placeholder="Select Event Type">
  16. </select>
  17. </div>
  18. <div class="col-sm-6">
  19. <select class="form-control custom-select time_filter" id="dateFilterSelect_${n}" data-placeholder="Select Date">
  20. </select>
  21. </div>
  22. </div>
  23. <div class="filter_footer d-flex justify-content-between align-items-center gap-10 mt-10">
  24. <a href="javascript:;" class="btn btn-outline-danger btn-sm Filterbuttons" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().clearTimelineFilters('${n}');">Clear</a>
  25. <a href="javascript:;" class="btn btn-outline-primary btn-sm Filterbuttons" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().applyTimelineFilters('${n}');">Apply</a>
  26. </div>
  27. </div></div>
  28. </div>
  29. </div>
  30. <div class="timeline-body px-10 d-none" id="timelineBody_${n}">
  31. <div class="text-danger text-center d-none" id="noTimelineDataMsg_${n}">No Data found!</div>
  32. <ul class="timeline d-flex flex-column r-gap-15" id="timeLineList_${n}"></ul>
  33. </div>
  34. <div class="form-error-message ml-0 r-0" id="timeLineErrMsg_${n}"></div>
  35. </div>`;$("#"+n).append(t)}loadDataComments(t,i){if(t!=""&&t!=undefined){var r=this;this.fileCacheHelper.loadJsFile("platform/automation/managers/rulemanager.js",function(){n.Platform.Automation.Managers.RuleManager.Instance().getTimeLineLogs(t).then(function(t){var u,y,p,w,b,h,c;let o="",s="",l="",a="",f="",e={},v="";if(t.result==null||t.result.length==0)$(`#timelineFilterDropdown_${i}`).addClass("d-none"),$(`#timeLineWrap_${i}`).find(".alert").length||(o='<div class="alert alert-primary text-center mb-0 border-0 w-100" style="border-radius:0">No data available<\/div>',$(`#timeLineWrap_${i}`).append(o));else if(t.result!=null){const k=$(`#timeLineList_${i}`);for(k.html(""),$(`#timelineBody_${i}`).removeClass("d-none"),u=0;u<t.result.length;u++)if(t.result[u].EventTemplateNote!=null){let nt=n.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateTimeWithoutSeconds(t.result[u].CreatedDate),at=t.result[u].CreatedBy,tt=t.result[u].EventTemplateNote.EventName.split("_"),rt=tt[tt.length-1],it=t.result[u].UserName,ot=nt.split(" "),ft=ot[0].split("/"),st=ot[1].split(":"),et=`${Date.now()}_${moment().unix()}`,ht=new Date(+ft[2],+ft[0],+ft[1],+st[0],+st[1]);tt=tt[tt.length-2]+" "+tt[tt.length-1];let d=t.result[u].EventTemplateNote.NotesText.toLowerCase();y=t.result[u].OldValue;p=t.result[u].NewValue;const g=moment(t.result[u].CreatedDate).format("DD-MM-YYYY");w=n.Platform.Helpers.DateTimeHelper.Instance().formatLocalDate(t.result[u].CreatedDate);b=n.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateTimeWithT(t.result[u].CreatedDate);const ct=b.replace(w,"");h="";const ut=t.result[u].EventTypeId;if(ut==Number(n.Platform.Automation.Enums.EventType.Created)?(s="fa fa-plus",f="Create"):ut==Number(n.Platform.Automation.Enums.EventType.Updated)?(s="fa fa-pencil",f="Updated"):ut==Number(n.Platform.Automation.Enums.EventType.Deleted)?(s="fa fa-trash",f="Deleted"):ut==Number(n.Platform.Automation.Enums.EventType.StageEvent)?(s="fa fa-cogs",f="Changed",h='<a onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().StageChangeReasons('+t.result[u].CommentId+')"><span class="biz-highlight-bg-color font-12">reasons<\/span><\/a>'):(s="",f="Result Action"),t.result[u].Keys!="{}"&&t.result[u].Keys!=null){let n=JSON.parse(t.result[u].Keys);c=Object.getOwnPropertyNames(n);for(let t=0;t<c.length;t++)d=d.replaceAll("{{"+c[t].toLowerCase()+"}}",n[c[t]])}d.indexOf("{{oldvalue}}")!=-1&&(d=d.replace("{{oldvalue}}",y));d.indexOf("{{newvalue}}")!=-1&&(d=d.replace("{{newvalue}}",p));d.match("{{.*}}")&&(d=d.replaceAll("{{","").replaceAll("}}",""));t.result[u].EventTemplateNote.EventAliasName!=""&&(tt=t.result[u].EventTemplateNote.EventAliasName);v!==g&&(k.append(`<li id="timeLineByDate_${g}" class="timeline-by-date-item" data-date="${g}"><h6 class="timeline-date-heading mb-15 font-weight-600">${g}</h6><ul id="timeLineByDateList_${g}" class="timeline-by-date-list d-flex flex-column r-gap-10"></ul></li>`),v=g);const lt=r.setTimelineAvatar(t.result[u]);if(o+=`<li id="timelineItem_${et}" class="filtersearch timeline-item d-none my-1 my-md-0 mb-2" data-filterType="${f}" data-filterdate="${g}"><div class="d-flex c-gap-10"><div class="avatar avatar-sm flex-shrink-0 timeline-avatar" data-tooltip="true" title="${t.result[u].UserName}">${lt}<span class="btn btn-icon btn-icon-circle btn-primary btn-xs d-20 timeline_icon_wrap" data-tooltip="true" title="${f}"><span class="btn-icon-wrap"><i class="${s} font-10"></i></span></span></div><div class="d-flex flex-grow-1 c-gap-10 mnw-0"><div class="timeline_desc text-dark w-100 mnw-0 d-flex flex-column r-gap-5 font-12"><h6 class="text-capitalize font-14 time_title">${tt}</h6><ul class="timelineContainer text-light-80"><li class="timeline_data"><span class="timeline-note">${d}</span></li></ul>${h?`<span class="reason_div">${h}</span>`:""}${t.result[u].ParentUserId?`<span class="logged-from-div biz-highlight-bg-color font-12">logged from ${t.result[u].ParentUserName}</span>`:""}</div><span class="timeline_date flex-shrink-0">${ct}</span></div></div></li>`,l=`<option value='${f}'>${f}</option>`,a=`<option value='${g}'>${g}</option>`,$(`#eventFilterSelect_${i}`).append(l),$(`#dateFilterSelect_${i}`).append(a),e[nt]==undefined)e[nt]={FormatedDate:ht,users:{}},e[nt].users[it]={username:it},e[nt].users[it][rt]=et,k.find(`#timeLineByDateList_${g}`).append(o);else if(e[nt].users[it]||(e[nt].users[it]={username:it}),e[nt].users[it][rt]==undefined)e[nt].users[it][rt]=et,k.find(`#timeLineByDateList_${g}`).append(o);else{let n=e[nt].users[it][rt];k.find(`#timelineItem_${n} .timelineContainer`).append(`<li class="timeline_data"><span class="timeline-note">${d}</span></li>`)}o=""}k.find(".timeline-item:lt(10)").removeClass("d-none");k.find(".timeline-by-date-item").each(function(n,t){$(t).find(".timeline-item:visible").length||$(t).addClass("d-none")});k.find(".timeline-item").length>10&&k.append(`<div id="loadMoreTimelineBtn_${i}" class="btn btn-sm btn-outline-primary mx-auto" onclick="Unibase.Platform.TimeLine.Components.TimeLine.Instance().loadMoreTimeline('${i}');">Load more</div>`);r.removeDuplicateFilterOptions(i);r.timelineTxtTrim(i)}})})}}setTimelineAvatar(n){let t="";const{UserName:i,UserPhotoPath:r}=n;if(r)t=`<img src="${r}" class="avatar-img rounded-circle">`;else if(i){let r="";const n=i;let u=n.match(/\b(\w)/g);r=u.length==1?$.trim(n).substr(0,1).toUpperCase()+$.trim(n).substr(1,1):u.join("").slice(0,2).toUpperCase();t=`<span class="avatar-text avatar-text-primary rounded-circle text-uppercase"><span class="initial-wrap"><span>${r}</span></span></span>`}return t}removeDuplicateFilterOptions(n){const t={};$(`#dateFilterSelect_${n} option,#eventFilterSelect_${n} option`).each(function(){var n=$(this).text();t.hasOwnProperty(n)?$(this).closest("option").remove():t[n]=!0});$(`#eventFilterSelect_${n},#dateFilterSelect_${n}`).select2({allowClear:!0});$(`#eventFilterSelect_${n},#dateFilterSelect_${n}`).val("").trigger("change")}applyTimelineFilters(n){const r=this,t=$(`#eventFilterSelect_${n}`).val(),i=$(`#dateFilterSelect_${n}`).val();if(t||i){const f=$(`#timeLineList_${n}`);f.find(".timeline-by-date-item,.timeline-item").addClass("d-none");let u=$();u=t?f.find(`.timeline-item[data-filtertype="${t}"]`):f.find(`.timeline-item[data-filterdate="${i}"]`);t&&i&&(u=f.find(`.timeline-item[data-filterdate="${i}"][data-filtertype="${t}"]`));u.slice(0,10).removeClass("d-none").parents(".timeline-by-date-item").removeClass("d-none");u.not(":visible").length?$(`#loadMoreTimelineBtn_${n}`).removeClass("d-none"):$(`#loadMoreTimelineBtn_${n}`).addClass("d-none");u.length?$(`#noTimelineDataMsg_${n}`).addClass("d-none"):$(`#noTimelineDataMsg_${n}`).removeClass("d-none");$(`#timelineFilterDropdownMenu_${n}`).removeClass("show");r.isFilterApplied=!0}}clearTimelineFilters(n){if(this.isFilterApplied){const t=$(`#timeLineList_${n}`);$(`#eventFilterSelect_${n},#dateFilterSelect_${n}`).val("").trigger("change");t.find(".timeline-item").addClass("d-none");t.find(".timeline-by-date-item,.timeline-item:lt(10)").removeClass("d-none");t.find(".timeline-by-date-item").each(function(n,t){$(t).find(".timeline-item:visible").length?$(t).removeClass("d-none"):$(t).addClass("d-none")});t.find(".timeline-item").length>10&&$(`#loadMoreTimelineBtn_${n}`).removeClass("d-none");$(`#timelineFilterDropdownMenu_${n}`).removeClass("show");this.isFilterApplied=!1}}loadMoreTimeline(n){const i=this,t=$(`#timeLineList_${n}`);if(i.isFilterApplied){const i=$(`#eventFilterSelect_${n}`).val(),r=$(`#dateFilterSelect_${n}`).val();if(i||r){let u=$();u=i?t.find(`.timeline-item[data-filtertype="${i}"]`):t.find(`.timeline-item[data-filterdate="${r}"]`);i&&r&&(u=t.find(`.timeline-item[data-filterdate="${r}"][data-filtertype="${i}"]`));u.not(":visible").slice(0,10).removeClass("d-none").parents(".timeline-by-date-item").removeClass("d-none");u.not(":visible").length?$(`#loadMoreTimelineBtn_${n}`).removeClass("d-none"):$(`#loadMoreTimelineBtn_${n}`).addClass("d-none")}}else t.find(".timeline-item:hidden:lt(10)").removeClass("d-none").parents(".timeline-by-date-item").removeClass("d-none"),t.find(".timeline-item:hidden").length||$(`#loadMoreTimelineBtn_${n}`).addClass("d-none")}timelineTxtTrim(n){const t=$(`#timeLineList_${n}`);t.find(".timelineContainer").each(function(n,t){let i=$(t).outerHeight(!0);if(i>40){$(t).addClass("timeline-data-hide");const n=$(t).find(".timeline_data").first(),i=n.outerHeight(!0);i>18&&i<40?n.append('<a href="javascript:;" class="font-13 font-weight-600 timeline-more text-dark text-underline ml-10">More<\/a>'):i>40?n.addClass("d-flex align-items-end").append('<a href="javascript:;" class="font-13 font-weight-600 timeline-more text-dark text-underline ml-10">More<\/a>').find(".timeline-note").addClass("timeline-data-hide-single"):$(t).find(".timeline_data").eq(1).addClass("d-flex").append('<a href="javascript:;" class="font-13 font-weight-600 timeline-more text-dark text-underline ml-10">More<\/a>').find(".timeline-note").addClass("text-truncate")}});t.find(".timeline-more").on("click",function(){$(this).parents(".timelineContainer").removeClass("timeline-data-hide");$(this).parent().removeClass("d-flex").find(".timeline-note").removeClass("timeline-data-hide-single text-truncate");$(this).remove()})}StageChangeReasons(t){var i="NA",r="NA";n.Platform.Apps.Managers.StageManager.Instance().getStageChangesByCommentId(t).then(function(n){n.result!=null&&n.result!=""&&(i=n.result.Reason==null?"NA":n.result.Reason,r=n.result.Description==null?"NA":n.result.Description);var t='<table class="stagereason_table w-100"><tbody style="height:100px"><tr class="mb-2"><th class="text-dark" style="font-size:16px;">Reason<\/th><th class="text-dark" style="font-size:16px;">Description<\/th><\/tr><tr><td>'+i+"<\/td><td>"+r+"<\/td><\/tr><\/tbody><\/table>";bootbox.dialog({message:t})})}loadform(t){var i="Unibase_Platform_Communications_mails_App_mails_CreateForm_Duplicate";switch(t){case 1:i="Bizgaze_Extension_Communication_Tasks_App_Tasks_CreateForm_Duplicate";break;case 2:i="Unibase_Platform_Communications_SMS_App_SMS_CreateForm_Duplicate";break;case 3:i="Bizgaze_Platform_Crm_Calls_App_Calls_CreateForm_Duplicate";break;case 4:i="Bizgaze_Platform_Communication_Meetings_App_Meetings_CreateForm_Duplicate"}n.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(i).then(function(t){t.result!=null&&n.Platform.Helpers.NavigationHelper.Instance().loadForm(t.result.FormId,0,0,0,function(){})})}saveComment(t,i){const f=this,r=$(`#timelineCommentInput_${i}`),u=r.val().toString().trim();if(!u)return MessageHelper.Instance().showError("Please Enter Something...",`timeLineErrMsg_${i}`),!1;const e={CommentId:0,RefGuid:t,CommentSubject:u,CommentType:n.Platform.Automation.Enums.CommentType.Comment,Followers:null,InstallPageId:n.Themes.Providers.DetailHelper.installedAppId,ParentId:0};n.Platform.Automation.Managers.CommentManager.Instance().saveComment(e).then(function(u){if(u.status==n.Data.Status.Error)return MessageHelper.Instance().showError(u.message,`timeLineErrMsg_${i}`),!1;u.result&&(f.loadDataComments(t,i),r.val(""),$(`#saveCommentBtn_${i}`).addClass("d-none"))})}static Instance(){return this.instance===undefined&&(this.instance=new r),this.instance}}i.TimeLine=r})(r=i.Components||(i.Components={}))})(i=t.TimeLine||(t.TimeLine={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));