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=`
No Data found!
`;$("#"+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='
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;ureasons<\/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
${g}
    `),v=g);const lt=r.setTimelineAvatar(t.result[u]);if(o+=`
  • ${lt}
    ${tt}
    • ${d}
    ${h?`${h}`:""}${t.result[u].ParentUserId?`logged from ${t.result[u].ParentUserName}`:""}
    ${ct}
  • `,l=``,a=``,$(`#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(`
  • ${d}
  • `)}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(`
    Load more
    `);r.removeDuplicateFilterOptions(i);r.timelineTxtTrim(i)}})})}}setTimelineAvatar(n){let t="";const{UserName:i,UserPhotoPath:r}=n;if(r)t=``;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=`${r}`}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('More<\/a>'):i>40?n.addClass("d-flex align-items-end").append('More<\/a>').find(".timeline-note").addClass("timeline-data-hide-single"):$(t).find(".timeline_data").eq(1).addClass("d-flex").append('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='
    Reason<\/th>Description<\/th><\/tr>
    '+i+"<\/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={}));