var Bizgaze; (function (Bizgaze) { let Apps; (function (Apps) { let Communications; (function (Communications) { let Events; (function (Events) { let Components; (function (Components) { class Gallery 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 = false; this.isDoc = false; this.isDocCall = false; this.reportIdGallery = null; this.nextClickHandler = (e) => { let instance = this; if ($('.carousel-item.active').next().length === 1) { $('.carousel-control-prev').removeClass('d-none'); if ($('.carousel-item.active').next().next().length === 0) { if (!instance.isDocCall && $('._bizgaze_popup_container').length === 1) { instance.loadMoreGallery(); } else { $('.carousel-control-next').addClass('d-none'); } } let bannerliked = $('.carousel-item.active').next().find('img').attr('data-bannerliked'); if (bannerliked == "false" || bannerliked == '' || bannerliked == null || bannerliked == 'undefined') { $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart"); } else { $('.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(id, containerid, callback) { let Instance = this; Instance.displayImages(); if (Instance.isDocCall) { this.displayFileType(); } let imagegalleryheading = $('#div_App_DefaultWidget').find('.biz-header-main-text').text(); $('#imagegalleryheading').text(imagegalleryheading); let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1]; $(`#${ContainerId}`).find('.carousel-control-prev').click(this.prevClickHandler); $(`#${ContainerId}`).find('.carousel-control-next').click(this.nextClickHandler); $('#modellikebtn').click(function (e) { let bannerfileid = $('.carousel-item.active').find('img').attr('data-bannerfileid'); let checkclass = $('#modellikebtn').find("i").hasClass('icon-heart'); if (checkclass == true) { Instance.likePhoto(bannerfileid, true); } else { Instance.likePhoto(bannerfileid, false); } }); $('.carousel').on('slide.bs.carousel', function (e) { if (Instance.isPlaying) { if ($('.carousel-item.active').next().length > 0) { $('.carousel-control-prev').removeClass('d-none'); if ($('.carousel-item.active').next().next().length == 0) { $('.carousel-control-next').addClass('d-none'); } } } }); $('#btn_autoplay').click(function (e) { Instance.isPlaying = true; if ($(e.target).find('.fa-pause').length != 0) { $(e.target).find('.fa-pause').removeClass('fa-pause').addClass('fa-play'); $('.carousel').carousel('pause'); Instance.isPlaying = false; } else { $('.carousel').carousel('cycle'); $(e.target).find('.fa-play').removeClass('fa-play').addClass('fa-pause'); } }); $('#galleryimagedownloadbtn').click((e) => { if (this.isDoc) { let docIdNumber = $('.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(docIdNumber); }); } else { let bannerfileid = $('.carousel-item.active').find('img').attr('data-bannerfileid'); let bannerenable = $('.carousel-item.active').find('img').attr('data-bannerenable'); let idnumberDoc = $('.carousel-item.active').find('img').attr('data-idnumber'); if ($('#modellikebtn').hasClass('d-none')) { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/controls/filedragndrop/w_documentfiles.js', function () { Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(idnumberDoc); }); } else if (bannerenable == 'true') { Instance.downloadImage(bannerfileid); } } }); $('#shareimggallery').click(function (e) { let galleryIdImg = $('.carousel-item.active').find('img').attr('data-liId'); let galleryDocId = $('.carousel-item.active').find('img').attr('data-documentfileidimg'); Instance.shareImage(galleryDocId, galleryIdImg); }); } prevClickHandler(e) { if ($('.carousel-item.active').prev().length === 1) { $('.carousel-control-next').removeClass('d-none'); if ($('.carousel-item.active').prev().prev().length === 0) { $('.carousel-control-prev').addClass('d-none'); } let bannerliked = $('.carousel-item.active').prev().find('img').attr('data-bannerliked'); if (bannerliked == "false" || bannerliked == '' || bannerliked == null || bannerliked == 'undefined') { $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart"); } else { $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger"); } } } loadMoreGallery() { let instance = this; var fromDate = ""; var toDate = ""; var cf_fromDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_FromDate; var cf_toDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_ToDate; if (cf_fromDate != null && cf_toDate != null) { fromDate = cf_fromDate.toString(); toDate = cf_toDate.toString(); } else { fromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD"); toDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD"); } let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 2]; instance.reportIdGallery = $(`#${ContainerId}`).find('#hf_ReportId').val(); let objPayload = { ReportId: Number(instance.reportIdGallery), page: instance.galleryPage, Filter: [], InputParameters: instance.inputParameters, pageSize: 5, SearchTerm: null, FilterId: 0, DateFilter: [], IsEnableCount: true, DisplayModeTypeId: 1, FromDate: fromDate, ToDate: toDate, viewerTypeId: 2, IsDynamicFilterApplied: undefined, IsPortletWidget: true, }; Unibase.Platform.Analytics.Viewers.TemplateViewer.Instance().reportManager.getReportInfo(objPayload).then(function (reportresponse) { if (reportresponse.result == null) { console.log('reportresponse.result == null'); $('.carousel-control-next').addClass('d-none'); return; } if (reportresponse.result.ReportJsonData.Result.Data === '') { $('.carousel-control-next').addClass('d-none'); return; } ; let dataObj = JSON.parse(reportresponse.result.ReportJsonData.Result.Data); let newFilePath = []; dataObj.forEach((currentImg, index) => { let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1]; let screenHeight = screen.height; let heightHeader = $(`#${ContainerId}`).find('.modal-header').first().outerHeight(true); let heightFooter = $(`#${ContainerId}`).find('.modal-footer').first().outerHeight(true); let sumHeight = (screenHeight - (heightHeader + heightFooter)); let fileType = currentImg.documentfilepath.split('.')[1].toLowerCase() != 'mp4' ? 'img' : 'video'; let file = currentImg.documentfilepath.slice(1, currentImg.documentfilepath.length); let id = currentImg.documentfilename; let bannerenable = currentImg.enabledownload; let liId = currentImg.documentfileid; let bannerliked = currentImg.liked === null ? '' : currentImg.liked; newFilePath.push({ fileType, file, id, bannerenable, liId, bannerfileid: liId, bannerliked }); let details = navigator.userAgent; let regexp = /android|iphone|kindle|ipad/i; let isMobileDevice = regexp.test(details); let el = ''; el = `${instance.elName}`; if (instance.isDoc == false) { if (isMobileDevice) { if (fileType === 'video') { $('.carousel-inner').append(` `); } else if (fileType === 'img') { $('.carousel-inner').append(``); } $('.carousel-inner').css('padding', 0); } else { if (fileType === 'video') { $('.carousel-inner').append(` `); } else if (fileType === 'img') { $('.carousel-inner').append(``); } } } if (instance.isDoc) { if (isMobileDevice) { if (currentImg.documenttypename === 'png' || currentImg.documenttypename === 'jpg' || currentImg.documenttypename === 'jpeg') { $('.carousel-inner').append(``); } else if (currentImg.documenttypename === 'pdf' || currentImg.documenttypename === 'word' || currentImg.documenttypename === 'excel' || currentImg.fileType != 'removeme') { $('.carousel-inner').append(``); } $('.carousel-inner').css('padding', 0); } else { if (currentImg.documenttypename === 'png' || currentImg.documenttypename === 'jpg' || currentImg.documenttypename === 'jpeg' || currentImg.fileType === 'svg') { $('.carousel-inner').append(``); } else if (currentImg.documenttypename === 'pdf' || currentImg.documenttypename === 'word' || currentImg.documenttypename === 'excel' || currentImg.fileType != 'removeme') { $('.carousel-inner').append(``); } } } $('.carousel-control-next').removeClass('d-none'); }); instance.galleryPage++; }); let bannerliked = $('.carousel-item.active').next().find('img').attr('data-bannerliked'); if (bannerliked == "false" || bannerliked == '' || bannerliked == null || bannerliked == 'undefined') { $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart"); } else { $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger"); } } init(containerid) { } html(id, containerid) { let html = ` `; return html; } openModalFile(currentElId) { this.galleryPage = 2; this.elName = '.documenttypegapCustom'; let Instance = this; Instance.isDocCall = true; this.displayFileTypeEl = currentElId; let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1]; this.isDoc = true; Instance.fileTypeDate = []; let el = ''; if ($('._bizgaze_popup_container').length === 0) { el = `.documenttypegapCustom`; } else { el = `._bizgaze_popup_container .documenttypegapCustom`; } $(el).each(function (i, e) { let fileType = $(e).find('[data-filetype]').val(); fileType = `${fileType}`.toLowerCase(); let documentfilepath = $(`#list-group-item-${$(e).find('[data-documentfileidCus]').val()}`).find('[data-documentfilepath]').val(); let id = $(e).find('[data-documentfileidCus]').val(); debugger; Instance.fileTypeDate.push({ id, fileType, documentfilepath, dataIdNumber: $(e).find('[data-documentfileidCus]').val() }); }); } displayFileType() { let Instance = this; let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1]; if (this.isDoc) { $('#shareimggallery').addClass('d-none'); $('#modellikebtn').addClass('d-none'); $('.fa-thumbs-up').parent().addClass('d-none'); } let screenHeight = screen.height; let heightHeader = $(`#${ContainerId}`).find('.modal-header').first().outerHeight(true); let heightFooter = $(`#${ContainerId}`).find('.modal-footer').first().outerHeight(true); let sumHeight = (screenHeight - (heightHeader + heightFooter)); $('.carousel-inner').html(''); Instance.fileTypeDate.forEach(function (e, i) { let active = ''; if (Instance.displayFileTypeEl == +e.id) { active = 'active'; } debugger; let details = navigator.userAgent; let regexp = /android|iphone|kindle|ipad/i; let isMobileDevice = regexp.test(details); if (isMobileDevice) { if (e.fileType === 'png' || e.fileType === 'jpg' || e.fileType === 'jpeg') { $('.carousel-inner').append(``); } else if (e.fileType === 'mp4') { $('.carousel-inner').append(``); } else if (e.fileType === 'txt' || e.fileType === 'pdf') { $('.carousel-inner').append(``); } else if (e.fileType === 'pdf' || e.fileType === 'word' || e.fileType === 'excel' || e.fileType != 'removeme') { $('.carousel-inner').append(``); } $('.carousel-inner').css('padding', 0); } else { if (e.fileType === 'png' || e.fileType === 'jpg' || e.fileType === 'jpeg' || e.fileType === 'svg') { $('.carousel-inner').append(``); } else if (e.fileType === 'mp4') { $('.carousel-inner').append(``); } else if (e.fileType === 'txt' || e.fileType === 'pdf') { $('.carousel-inner').append(``); } else if (e.fileType === 'word' || e.fileType === 'excel' || e.fileType != 'removeme') { $('.carousel-inner').append(``); } } }); $('.carousel').carousel({ interval: 2000, wrap: false, }); $('.carousel').carousel('pause'); if ($('.carousel-item.active').next().length === 0) { if ($('._bizgaze_popup_container').length === 1) { $('.carousel-control-next').addClass('d-none'); Instance.loadMoreGallery(); } } else { $('.carousel-control-next').removeClass('d-none'); } if ($('.carousel-item.active').prev().length === 0) { $('.carousel-control-prev').addClass('d-none'); } else { $('.carousel-control-prev').removeClass('d-none'); } Instance.isDocCall = false; } filePathPush(galleryCurrentId) { let Instance = this; this.galleryCurrentId = galleryCurrentId; let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[0]; Instance.galleryPage = 2; Instance.elName = `.banner-media`; Instance.filePath = []; let el = ''; if ($('._bizgaze_popup_container').length === 0) { el = `.banner-media`; } else { el = `._bizgaze_popup_container .banner-media`; } $(el).each(function (i, e) { let file = ''; let fileType = ''; let id = $(e).parents('.gallery-list').attr('data-documentfileidimg'); if (id == '') { id = $(e).parents('.gallery-list').attr('data-otherid'); } let liId = $(e).parents('.gallery-list').attr('id'); liId = liId.replace(/list-group-item-/g, ''); let bannerfileid = $(e).parents('.gallery-list').find('.bannerfileid').val(); let bannerliked = $(e).parents('.gallery-list').find('.bannerliked').val(); let bannerenable = $(e).parents('.gallery-list').find('.enabledownload').val(); if ($(this).find('img').length === 1) { fileType = 'img'; file = $(this).find('img').attr('src'); } else if ($(this).find('video').length === 1) { fileType = 'video'; file = $(this).find('video').attr('src'); } if (!Instance.hashMapFilePath[id]) { Instance.hashMapFilePath[id] = true; } Instance.filePath.push({ fileType, file, id, bannerfileid, bannerliked, liId, bannerenable }); }); } displayImages() { let Instance = this; let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1]; $('.carousel-inner').html(''); let screenHeight = screen.height; let heightHeader = $(`#${ContainerId}`).find('.modal-header').first().outerHeight(true); let heightFooter = $(`#${ContainerId}`).find('.modal-footer').first().outerHeight(true); let sumHeight = (screenHeight - (heightHeader + heightFooter)); this.filePath.forEach(function (e, i) { let active = ''; if (Instance.galleryCurrentId == e.id) { active = 'active'; if (e.bannerliked == "false" || e.bannerliked == '' || e.bannerliked == null || e.bannerliked == 'undefined') { $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart"); } else { $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger"); } if (e.bannerenable == 'false') { $('#galleryimagedownloadbtn').addClass('d-none'); } } let details = navigator.userAgent; let regexp = /android|iphone|kindle|ipad/i; let isMobileDevice = regexp.test(details); if (isMobileDevice) { if (e.fileType === 'video') { $('.carousel-inner').append(` `); } else if (e.fileType === 'img') { $('.carousel-inner').append(``); } $('.carousel-inner').css('padding', 0); } else { if (e.fileType === 'video') { $('.carousel-inner').append(` `); } else if (e.fileType === 'img') { $('.carousel-inner').append(``); } } }); $('.carousel').carousel({ wrap: false }); $('.carousel').carousel('pause'); if ($('.carousel-item.active').next().length === 0) { if (!Instance.isDoc && $('._bizgaze_popup_container').length === 1) { Instance.loadMoreGallery(); } else { $('.carousel-control-next').addClass('d-none'); } } else { $('.carousel-control-next').removeClass('d-none'); } if ($('.carousel-item.active').prev().length === 0) { $('.carousel-control-prev').addClass('d-none'); } else { $('.carousel-control-prev').removeClass('d-none'); } } likePhoto(documentfileId, isLiked) { if (documentfileId != 0) { var data = { PhotoId: Number(documentfileId), LikedBy: Unibase.Platform.Membership.Infos.Identity.currentUser.userId, Liked: isLiked }; Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js", function () { Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().changephotplike(data).then((responce) => { if (responce.result != null) { if (responce.result.Liked) { $("gallery_liked_" + responce.result.PhotoId).closest(".gallery-list").addClass("liked-image"); $("#gallery_liked_" + responce.result.PhotoId).removeClass("icon-heart").addClass("fa fa-heart text-danger"); $(`[data-documentfileidimg="${responce.result.PhotoId}"]`).find('.bannerliked').attr('value', 'true'); $('#modellikebtn').find('i').removeClass("icon-heart").addClass("fa fa-heart text-danger"); } else { $("#gallery_liked_" + responce.result.PhotoId).removeClass("fa fa-heart text-danger").addClass("icon-heart"); $(`[data-documentfileidimg="${responce.result.PhotoId}"]`).find('.bannerliked').attr('value', 'false'); $('#modellikebtn').find('i').removeClass("fa fa-heart text-danger").addClass("icon-heart"); } } }); }); } } downloadImage(documentfileId, isTrue) { if (isTrue) { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/controls/ filedragndrop/w_documentfiles.js', function () { Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(documentfileId); }); return; } Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/filedragndrop/w_documentfiles.js", function () { Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(documentfileId); }); } shareImage(documentfileId, galleryId) { var instance = this; instance.documentfileId = documentfileId; instance.galleryId = galleryId; Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/components/shareimage.js", function () { var obj = new Bizgaze.Apps.Communications.Events.Components.ShareImage; instance.navigationHelper.popup(0, '', obj, null, Unibase.Platform.Helpers.Size.Large); }); } deleteImage(DocumentFileId, galleryId) { var instance = this; instance.documentfileId = DocumentFileId; instance.galleryId = galleryId; bootbox.confirm("Are you sure?", function (result) { if (!result) return; instance.fileCacheHelper.loadJsFile("platform/files/managers/filemanager.js", function () { Unibase.Platform.Files.Managers.FileManager.Instance().deleteDocumentFile(DocumentFileId).then(function (response) { if (response.message == 'File Deleted Successfully') { $('.photoidCustom[data-documentfileidimg="' + DocumentFileId + '"]').remove(); } }); var detailobj = Unibase.Themes.Compact.Components.Details.Instance(); detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId; detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id"); var idetailObj = detailobj; detailobj.loadPortlets(idetailObj); }); }); } importPortability(containerid) { var instance = this; $('.sp_widget_create_' + containerid + '').find('#LinkButton').click(function () { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/portability/components/portability.js', function () { let InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; let portabilityinstance = 'Unibase.Platform.Portability.Components.ImportAndExport.Instance()'; var jsinstance = eval(portabilityinstance); var component = jsinstance; var appSettingComponent = jsinstance; if (appSettingComponent !== null && appSettingComponent !== undefined) { appSettingComponent.appSettings.InstalledAppId = InstalledAppId; } if (component != null && component != undefined) { instance.navigationhelper.popup(0, '', component, function () { }, Unibase.Platform.Helpers.Size.Large); } }); }); } predictedimages() { var eventid = Unibase.Themes.Providers.Detail_Settings.instance.InputParameters.find(f => f.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 () { Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().predictedImages().then((response) => { if (response === 'ALL MATCH FOUND') { this.navigationhelper.hideLoading(); bootbox.alert("Sucess"); } else { this.navigationhelper.hideLoading(); } }); }); }); }); } eventWisePrediction(eventId) { var instance = this; instance.eventid = eventId; Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js", function () { var imgbase64 = "~/tenants/themes/compact/imgs/alertimg.png"; bootbox.alert("The prediction has started", function () { Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().eventWisePredictedImages(eventId).then((response) => { if (response === 'ALL MATCH FOUND') { instance.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance(); instance.navigationhelper.hideLoading(); bootbox.alert("Sucess"); $("#widgetconfig_Predict").show(); } else { instance.navigationhelper.hideLoading(); $("#widgetconfig_Predict").show(); } }); }); }); } aprovedImage(DocumentFileId, statusid) { var instance = this; instance.documentfileId = DocumentFileId; instance.statusid = statusid; instance.fileCacheHelper.loadJsFile("apps/communications/events/managers/gallerymanager.js", function () { Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().approvedImage(DocumentFileId, statusid).then(function (response) { }); var detailobj = Unibase.Themes.Compact.Components.Details.Instance(); detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId; detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id"); var idetailObj = detailobj; detailobj.loadPortlets(idetailObj); }); } static Instance() { if (this.instance === undefined) { this.instance = new Gallery(); } return this.instance; } } Components.Gallery = Gallery; })(Components = Events.Components || (Events.Components = {})); })(Events = Communications.Events || (Communications.Events = {})); })(Communications = Apps.Communications || (Apps.Communications = {})); })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {})); })(Bizgaze || (Bizgaze = {}));