var Bizgaze;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i extends Unibase.Platform.Core.BaseComponent{constructor(){super();this.filePath=[];this.documentId=[];this.hashMapFilePath={};this.galleryCurrentId="";this.displayFileTypeEl="";this.fileTypeDate=[];this.statusid="";this.galleryPage=0;this.carousel="";this.inputParameters=[];this.elName="";this.isPlaying=!1;this.isDoc=!1;this.isDocCall=!1;this.reportIdGallery=null;this.nextClickHandler=()=>{let n=this;if($(".carousel-item.active").next().length===1){$(".carousel-control-prev").removeClass("d-none");$(".carousel-item.active").next().next().length===0&&(n.isDocCall||$("._bizgaze_popup_container").length!==1?$(".carousel-control-next").addClass("d-none"):n.loadMoreGallery());let t=$(".carousel-item.active").next().find("img").attr("data-bannerliked");t=="false"||t==""||t==null||t=="undefined"?$(".modelgallery").removeClass("fa fa-heart text-danger").addClass("icon-heart"):$(".modelgallery").removeClass("icon-heart").addClass("fa fa-heart text-danger")}};this.navigationhelper=Unibase.Platform.Helpers.NavigationHelper.Instance()}cssFiles(){return[]}jsFiles(){return["apps/communications/events/managers/gallerymanager.js","apps/communications/events/components/shareimage.js"]}load(){let n=this;n.displayImages();n.isDocCall&&this.displayFileType();let i=$("#div_App_DefaultWidget").find(".biz-header-main-text").text();$("#imagegalleryheading").text(i);let t=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length-1];$(`#${t}`).find(".carousel-control-prev").click(this.prevClickHandler);$(`#${t}`).find(".carousel-control-next").click(this.nextClickHandler);$("#modellikebtn").click(function(){let t=$(".carousel-item.active").find("img").attr("data-bannerfileid"),i=$("#modellikebtn").find("i").hasClass("icon-heart");i==!0?n.likePhoto(t,!0):n.likePhoto(t,!1)});$(".carousel").on("slide.bs.carousel",function(){n.isPlaying&&$(".carousel-item.active").next().length>0&&($(".carousel-control-prev").removeClass("d-none"),$(".carousel-item.active").next().next().length==0&&$(".carousel-control-next").addClass("d-none"))});$("#btn_autoplay").click(function(t){n.isPlaying=!0;$(t.target).find(".fa-pause").length!=0?($(t.target).find(".fa-pause").removeClass("fa-pause").addClass("fa-play"),$(".carousel").carousel("pause"),n.isPlaying=!1):($(".carousel").carousel("cycle"),$(t.target).find(".fa-play").removeClass("fa-play").addClass("fa-pause"))});$("#galleryimagedownloadbtn").click(()=>{if(this.isDoc){let n=$(".carousel-item.active").find("img").attr("data-liid");Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/filedragndrop/w_documentfiles.js",function(){Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(n)})}else{let t=$(".carousel-item.active").find("img").attr("data-bannerfileid"),i=$(".carousel-item.active").find("img").attr("data-bannerenable"),r=$(".carousel-item.active").find("img").attr("data-idnumber");$("#modellikebtn").hasClass("d-none")?Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/filedragndrop/w_documentfiles.js",function(){Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(r)}):i=="true"&&n.downloadImage(t)}});$("#shareimggallery").click(function(){let t=$(".carousel-item.active").find("img").attr("data-liId"),i=$(".carousel-item.active").find("img").attr("data-documentfileidimg");n.shareImage(i,t)})}prevClickHandler(){if($(".carousel-item.active").prev().length===1){$(".carousel-control-next").removeClass("d-none");$(".carousel-item.active").prev().prev().length===0&&$(".carousel-control-prev").addClass("d-none");let n=$(".carousel-item.active").prev().find("img").attr("data-bannerliked");n=="false"||n==""||n==null||n=="undefined"?$(".modelgallery").removeClass("fa fa-heart text-danger").addClass("icon-heart"):$(".modelgallery").removeClass("icon-heart").addClass("fa fa-heart text-danger")}}loadMoreGallery(){let n=this;var i="",r="",u=Unibase.Platform.Helpers.NavigationHelper.commonFilter_FromDate,f=Unibase.Platform.Helpers.NavigationHelper.commonFilter_ToDate;u!=null&&f!=null?(i=u.toString(),r=f.toString()):(i=Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()),"YYYY/MM/DD"),r=Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()),"YYYY/MM/DD"));let e=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length-2];n.reportIdGallery=$(`#${e}`).find("#hf_ReportId").val();let o={ReportId:Number(n.reportIdGallery),page:n.galleryPage,Filter:[],InputParameters:n.inputParameters,pageSize:5,SearchTerm:null,FilterId:0,DateFilter:[],IsEnableCount:!0,DisplayModeTypeId:1,FromDate:i,ToDate:r,viewerTypeId:2,IsDynamicFilterApplied:undefined,IsPortletWidget:!0};Unibase.Platform.Analytics.Viewers.TemplateViewer.Instance().reportManager.getReportInfo(o).then(function(t){if(t.result==null){console.log("reportresponse.result == null");$(".carousel-control-next").addClass("d-none");return}if(t.result.ReportJsonData.Result.Data===""){$(".carousel-control-next").addClass("d-none");return}let i=JSON.parse(t.result.ReportJsonData.Result.Data),r=[];i.forEach(t=>{let h=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length-1],l=screen.height,a=$(`#${h}`).find(".modal-header").first().outerHeight(!0),v=$(`#${h}`).find(".modal-footer").first().outerHeight(!0),u=l-(a+v),f=t.documentfilepath.split(".")[1].toLowerCase()!="mp4"?"img":"video",e=t.documentfilepath.slice(1,t.documentfilepath.length),y=t.documentfilename,o=t.enabledownload,i=t.documentfileid,s=t.liked===null?"":t.liked;r.push({fileType:f,file:e,id:y,bannerenable:o,liId:i,bannerfileid:i,bannerliked:s});let p=navigator.userAgent,c=/android|iphone|kindle|ipad/i.test(p),w="";w=`${n.elName}`;n.isDoc==!1&&(c?(f==="video"?$(".carousel-inner").append(` `):f==="img"&&$(".carousel-inner").append(``),$(".carousel-inner").css("padding",0)):f==="video"?$(".carousel-inner").append(` `):f==="img"&&$(".carousel-inner").append(``));n.isDoc&&(c?(t.documenttypename==="png"||t.documenttypename==="jpg"||t.documenttypename==="jpeg"?$(".carousel-inner").append(``):(t.documenttypename==="pdf"||t.documenttypename==="word"||t.documenttypename==="excel"||t.fileType!="removeme")&&$(".carousel-inner").append(``),$(".carousel-inner").css("padding",0)):t.documenttypename==="png"||t.documenttypename==="jpg"||t.documenttypename==="jpeg"||t.fileType==="svg"?$(".carousel-inner").append(``):(t.documenttypename==="pdf"||t.documenttypename==="word"||t.documenttypename==="excel"||t.fileType!="removeme")&&$(".carousel-inner").append(``));$(".carousel-control-next").removeClass("d-none")});n.galleryPage++});let t=$(".carousel-item.active").next().find("img").attr("data-bannerliked");t=="false"||t==""||t==null||t=="undefined"?$(".modelgallery").removeClass("fa fa-heart text-danger").addClass("icon-heart"):$(".modelgallery").removeClass("icon-heart").addClass("fa fa-heart text-danger")}init(){}html(n){return` `}openModalFile(n){this.galleryPage=2;this.elName=".documenttypegapCustom";let t=this;t.isDocCall=!0;this.displayFileTypeEl=n;let r=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length-1];this.isDoc=!0;t.fileTypeDate=[];let i="";i=$("._bizgaze_popup_container").length===0?`.documenttypegapCustom`:`._bizgaze_popup_container .documenttypegapCustom`;$(i).each(function(n,i){let r=$(i).find("[data-filetype]").val();r=`${r}`.toLowerCase();let u=$(`#list-group-item-${$(i).find("[data-documentfileidCus]").val()}`).find("[data-documentfilepath]").val(),f=$(i).find("[data-documentfileidCus]").val();t.fileTypeDate.push({id:f,fileType:r,documentfilepath:u,dataIdNumber:$(i).find("[data-documentfileidCus]").val()})})}displayFileType(){let n=this,i=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length-1];this.isDoc&&($("#shareimggallery").addClass("d-none"),$("#modellikebtn").addClass("d-none"),$(".fa-thumbs-up").parent().addClass("d-none"));let r=screen.height,u=$(`#${i}`).find(".modal-header").first().outerHeight(!0),f=$(`#${i}`).find(".modal-footer").first().outerHeight(!0),t=r-(u+f);$(".carousel-inner").html("");n.fileTypeDate.forEach(function(i){let r="";n.displayFileTypeEl==+i.id&&(r="active");let u=navigator.userAgent,f=/android|iphone|kindle|ipad/i.test(u);f?(i.fileType==="png"||i.fileType==="jpg"||i.fileType==="jpeg"?$(".carousel-inner").append(``):i.fileType==="mp4"?$(".carousel-inner").append(``):i.fileType==="txt"||i.fileType==="pdf"?$(".carousel-inner").append(``):(i.fileType==="pdf"||i.fileType==="word"||i.fileType==="excel"||i.fileType!="removeme")&&$(".carousel-inner").append(``),$(".carousel-inner").css("padding",0)):i.fileType==="png"||i.fileType==="jpg"||i.fileType==="jpeg"||i.fileType==="svg"?$(".carousel-inner").append(``):i.fileType==="mp4"?$(".carousel-inner").append(``):i.fileType==="txt"||i.fileType==="pdf"?$(".carousel-inner").append(``):(i.fileType==="word"||i.fileType==="excel"||i.fileType!="removeme")&&$(".carousel-inner").append(``)});$(".carousel").carousel({interval:2e3,wrap:!1});$(".carousel").carousel("pause");$(".carousel-item.active").next().length===0?$("._bizgaze_popup_container").length===1&&($(".carousel-control-next").addClass("d-none"),n.loadMoreGallery()):$(".carousel-control-next").removeClass("d-none");$(".carousel-item.active").prev().length===0?$(".carousel-control-prev").addClass("d-none"):$(".carousel-control-prev").removeClass("d-none");n.isDocCall=!1}filePathPush(n){let t=this;this.galleryCurrentId=n;let r=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[0];t.galleryPage=2;t.elName=`.banner-media`;t.filePath=[];let i="";i=$("._bizgaze_popup_container").length===0?`.banner-media`:`._bizgaze_popup_container .banner-media`;$(i).each(function(n,i){let u="",f="",r=$(i).parents(".gallery-list").attr("data-documentfileidimg");r==""&&(r=$(i).parents(".gallery-list").attr("data-otherid"));let e=$(i).parents(".gallery-list").attr("id");e=e.replace(/list-group-item-/g,"");let o=$(i).parents(".gallery-list").find(".bannerfileid").val(),s=$(i).parents(".gallery-list").find(".bannerliked").val(),h=$(i).parents(".gallery-list").find(".enabledownload").val();$(this).find("img").length===1?(f="img",u=$(this).find("img").attr("src")):$(this).find("video").length===1&&(f="video",u=$(this).find("video").attr("src"));t.hashMapFilePath[r]||(t.hashMapFilePath[r]=!0);t.filePath.push({fileType:f,file:u,id:r,bannerfileid:o,bannerliked:s,liId:e,bannerenable:h})})}displayImages(){let n=this,i=Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length-1];$(".carousel-inner").html("");let r=screen.height,u=$(`#${i}`).find(".modal-header").first().outerHeight(!0),f=$(`#${i}`).find(".modal-footer").first().outerHeight(!0),t=r-(u+f);this.filePath.forEach(function(i){let r="";n.galleryCurrentId==i.id&&(r="active",i.bannerliked=="false"||i.bannerliked==""||i.bannerliked==null||i.bannerliked=="undefined"?$(".modelgallery").removeClass("fa fa-heart text-danger").addClass("icon-heart"):$(".modelgallery").removeClass("icon-heart").addClass("fa fa-heart text-danger"),i.bannerenable=="false"&&$("#galleryimagedownloadbtn").addClass("d-none"));let u=navigator.userAgent,f=/android|iphone|kindle|ipad/i.test(u);f?(i.fileType==="video"?$(".carousel-inner").append(` `):i.fileType==="img"&&$(".carousel-inner").append(``),$(".carousel-inner").css("padding",0)):i.fileType==="video"?$(".carousel-inner").append(` `):i.fileType==="img"&&$(".carousel-inner").append(``)});$(".carousel").carousel({wrap:!1});$(".carousel").carousel("pause");$(".carousel-item.active").next().length===0?n.isDoc||$("._bizgaze_popup_container").length!==1?$(".carousel-control-next").addClass("d-none"):n.loadMoreGallery():$(".carousel-control-next").removeClass("d-none");$(".carousel-item.active").prev().length===0?$(".carousel-control-prev").addClass("d-none"):$(".carousel-control-prev").removeClass("d-none")}likePhoto(t,i){if(t!=0){var r={PhotoId:Number(t),LikedBy:Unibase.Platform.Membership.Infos.Identity.currentUser.userId,Liked:i};Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js",function(){n.Apps.Communications.Events.Managers.GalleryManager.Instance().changephotplike(r).then(n=>{n.result!=null&&(n.result.Liked?($("gallery_liked_"+n.result.PhotoId).closest(".gallery-list").addClass("liked-image"),$("#gallery_liked_"+n.result.PhotoId).removeClass("icon-heart").addClass("fa fa-heart text-danger"),$(`[data-documentfileidimg="${n.result.PhotoId}"]`).find(".bannerliked").attr("value","true"),$("#modellikebtn").find("i").removeClass("icon-heart").addClass("fa fa-heart text-danger")):($("#gallery_liked_"+n.result.PhotoId).removeClass("fa fa-heart text-danger").addClass("icon-heart"),$(`[data-documentfileidimg="${n.result.PhotoId}"]`).find(".bannerliked").attr("value","false"),$("#modellikebtn").find("i").removeClass("fa fa-heart text-danger").addClass("icon-heart")))})})}}downloadImage(n,t){if(t){Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/ filedragndrop/w_documentfiles.js",function(){Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(n)});return}Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/filedragndrop/w_documentfiles.js",function(){Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(n)})}shareImage(t,i){var r=this;r.documentfileId=t;r.galleryId=i;Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/components/shareimage.js",function(){var t=new n.Apps.Communications.Events.Components.ShareImage;r.navigationHelper.popup(0,"",t,null,Unibase.Platform.Helpers.Size.Large)})}deleteImage(n,t){var i=this;i.documentfileId=n;i.galleryId=t;bootbox.confirm("Are you sure?",function(t){t&&i.fileCacheHelper.loadJsFile("platform/files/managers/filemanager.js",function(){var t,i;Unibase.Platform.Files.Managers.FileManager.Instance().deleteDocumentFile(n).then(function(t){t.message=="File Deleted Successfully"&&$('.photoidCustom[data-documentfileidimg="'+n+'"]').remove()});t=Unibase.Themes.Compact.Components.Details.Instance();t._recordId=Unibase.Themes.Providers.DetailHelper.recordId;t._installedAppId=Unibase.Themes.Providers.DetailHelper.installedAppId;t._containerId=$("._bizgaze_detail_container:visible").attr("id");i=t;t.loadPortlets(i)})})}importPortability(n){var t=this;$(".sp_widget_create_"+n+"").find("#LinkButton").click(function(){Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/portability/components/portability.js",function(){let u=Unibase.Themes.Providers.DetailHelper.installedAppId;var r=eval("Unibase.Platform.Portability.Components.ImportAndExport.Instance()"),n=r,i=r;i!==null&&i!==undefined&&(i.appSettings.InstalledAppId=u);n!=null&&n!=undefined&&t.navigationhelper.popup(0,"",n,function(){},Unibase.Platform.Helpers.Size.Large)})})}predictedimages(){var t=Unibase.Themes.Providers.Detail_Settings.instance.InputParameters.find(n=>n.Key.endsWith("eventid")).Value;this.navigationhelper.showLoading();Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js",function(){bootbox.alert("Face Detection Initiated !
Sit back and relax",function(){bootbox.alert("You will receive a notification once Face Recognition is completed.!
Sit back and relax !",function(){n.Apps.Communications.Events.Managers.GalleryManager.Instance().predictedImages().then(n=>{n==="ALL MATCH FOUND"?(this.navigationhelper.hideLoading(),bootbox.alert("Sucess")):this.navigationhelper.hideLoading()})})})})}eventWisePrediction(t){var i=this;i.eventid=t;Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js",function(){bootbox.alert("The prediction has started",function(){n.Apps.Communications.Events.Managers.GalleryManager.Instance().eventWisePredictedImages(t).then(n=>{n==="ALL MATCH FOUND"?(i.navigationhelper=Unibase.Platform.Helpers.NavigationHelper.Instance(),i.navigationhelper.hideLoading(),bootbox.alert("Sucess"),$("#widgetconfig_Predict").show()):(i.navigationhelper.hideLoading(),$("#widgetconfig_Predict").show())})})})}aprovedImage(t,i){var r=this;r.documentfileId=t;r.statusid=i;r.fileCacheHelper.loadJsFile("apps/communications/events/managers/gallerymanager.js",function(){var r,u;n.Apps.Communications.Events.Managers.GalleryManager.Instance().approvedImage(t,i).then(function(){});r=Unibase.Themes.Compact.Components.Details.Instance();r._recordId=Unibase.Themes.Providers.DetailHelper.recordId;r._installedAppId=Unibase.Themes.Providers.DetailHelper.installedAppId;r._containerId=$("._bizgaze_detail_container:visible").attr("id");u=r;r.loadPortlets(u)})}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.Gallery=i})(i=t.Components||(t.Components={}))})(i=t.Events||(t.Events={}))})(i=t.Communications||(t.Communications={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));