123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760 |
- 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(` <div style="max-height: ${sumHeight}px !important" class="h-100 carousel-item "><video playsinline muted data-bannerenable="${bannerenable}" src="${file}" type="video/mp4" data-liId="${liId}" data-bannerfileid="${+liId}" data-bannerliked="${bannerliked}" onerror="sanitizeURL(event)" data-dynamic="1" data-loaded="0" class="mh-100 mw-100 w-100" controls autoplay loop webkit-playsinline webkitRequestFullscreen msRequestFullscreen style="object-fit: cover; padding-top:5vh;"></video></div>`);
- }
- else if (fileType === 'img') {
- $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ">
- <img data-bannerenable="${bannerenable}" class="mh-100 mw-100 w-100" data-liId="${liId}" src="${file}" data-bannerfileid="${+liId}" data-bannerliked="${bannerliked}" alt="image not found" onerror="ReloadImage(event)" style="
- padding-top: 5vh;
- " data-dynamic="1" data-loaded="0">
- </div>`);
- }
- $('.carousel-inner').css('padding', 0);
- }
- else {
- if (fileType === 'video') {
- $('.carousel-inner').append(` <div style="max-height: ${sumHeight}px !important" class=" carousel-item "><video muted data-bannerenable="${bannerenable}" data-bannerfileid="${+liId}" data-bannerliked="${bannerliked}" data-liId="${liId}" playsinline src="${file}" type="video/mp4" onerror="sanitizeURL(event)" data-dynamic="1" data-loaded="0" class=" mh-100 mw-100" controls autoplay loop webkit-playsinline webkitRequestFullscreen msRequestFullscreen style="object-fit: cover;"></video></div>`);
- }
- else if (fileType === 'img') {
- $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item" >
- <img style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${liId}" data-bannerenable="${bannerenable}" data-bannerfileid="${+liId}" data-bannerliked="${bannerliked}" src="${file}" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0"">
- </div>`);
- }
- }
- }
- if (instance.isDoc) {
- if (isMobileDevice) {
- if (currentImg.documenttypename === 'png' || currentImg.documenttypename === 'jpg' || currentImg.documenttypename === 'jpeg') {
- $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ">
- <img class="mh-100 mw-100 w-100" data-liId="${currentImg.documentfileid}" data-idnumber="${currentImg.documentfileid}" src="${currentImg.documentfilepath}" alt="image not found" onerror="ReloadImage(event)" style="
- padding-top: 5vh;
- " data-dynamic="1" data-loaded="0">
- </div>`);
- }
- else if (currentImg.documenttypename === 'pdf' || currentImg.documenttypename === 'word' || currentImg.documenttypename === 'excel' || currentImg.fileType != 'removeme') {
- $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ">
- <img class="mh-100 mw-100 w-100" data-liId="${currentImg.documentfileid}" data-idnumber="${currentImg.documentfileid}" src="/tenants/themes/compact/imgs/pdfimgdoc.png" alt="${currentImg.documenttypename}" onerror="ReloadImage(event)" style="
- padding-top: 5vh;
- " data-dynamic="1" data-loaded="0">
- </div>`);
- }
- $('.carousel-inner').css('padding', 0);
- }
- else {
- if (currentImg.documenttypename === 'png' || currentImg.documenttypename === 'jpg' || currentImg.documenttypename === 'jpeg' || currentImg.fileType === 'svg') {
- $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item">
- <img style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${currentImg.documentfileid}" data-idnumber="${currentImg.documentfileid}" src="${currentImg.documentfilepath}" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0">
- </div>`);
- }
- else if (currentImg.documenttypename === 'pdf' || currentImg.documenttypename === 'word' || currentImg.documenttypename === 'excel' || currentImg.fileType != 'removeme') {
- $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item">
- <img style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
- width:100px;
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${currentImg.documentfileid}" data-idnumber="${currentImg.documentfileid}" src="/tenants/themes/compact/imgs/pdfimgdoc.png" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0">
- </div>`);
- }
- }
- }
- $('.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 = `
- <div id="img-modal" class="modal-content h-100">
-
- <div class="modal-header pa-10"> <strong class="modal-title biz-highlight-bg-color" id="imagegalleryheading">Gallery</strong>
- <div class="d-flex align-items-center justify-content-between">
-
- <div> <button type="button"
- id="btn_autoplay"
- class="btn btn-icon btn-icon-circle btn-warning btn-icon-style-3" ><span style="pointer-events:none" class="btn-icon-wrap"><i class="fa fa-play"></i></span></button> <button id="shareimggallery" class="btn btn-icon btn-icon-circle btn-warning btn-icon-style-3" href="javascript:;"
- "><span class="btn-icon-wrap"><i class="fa fa-share-alt"></i></span></button> <button
- class="btn btn-icon btn-icon-circle btn-success btn-icon-style-3" id="galleryimagedownloadbtn" href="javascript:;"><span
- class="btn-icon-wrap"><i class="fa fa-download"></i></span></button> </div>
- </div>
- <div id="divEditFiltersErrMsg" class="form-error-message"></div>
- </div>
- <div class="modal-body simple-scroll-bar edit-filters-body py-0 bg-cyan-light-5">
- <div class="d-flex" id="galleryheightmodel" style="gap: 10px;align-items: center;height:80vh">
- <a style="opacity: 1; width:20px; " class="carousel-control-prev d-none position-static" href="#carouselExampleControls" role="button"
- data-slide="prev"> <span style="background-image: none;" class="carousel-control-prev-icon"
- aria-hidden="true"> <i class="fa fa-angle-double-left " style=" color: black; font-size: 34px; "></i>
- </span> <span class="preImgHandler sr-only">Previous</span> </a>
- <div class="card bg-transparent border-0 shadow-none" id="staticFiltersCard" style="
- flex-grow: 1;
- ">
- <div id="carouselExampleControls" data-interval="2000" class="carousel slide-fade" data-ride="carousel">
- <div class="carousel-inner " style="padding:0px 100px "> </div>
- </div>
- </div>
- <a style="opacity: 1;width: 20px;" class="carousel-control-next position-static" href="#carouselExampleControls" role="button"
- data-slide="next"> <span style="background-image: none;" class="carousel-control-next-icon"
- aria-hidden="true"> <i class="fa fa-angle-double-right" style=" color: black; font-size: 34px;"></i>
- </span> <span class="sr-only ">Next</span> </a>
- </div>
- </div>
-
- <div class="modal-footer pa-10"> <button type="button"
- onclick="Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp()" id="btn_CloseForm_${id}"
- class="btn btn-light btn-sm mr-auto">Close</button>
-
- <div> <button id="modellikebtn" class="btn btn-icon btn-icon-circle btn-liked btn-danger btn-icon-style-3"
- href="javascript:;"><span class="btn-icon-wrap"><i class="modelgallery icon-heart"></i></span></button> <a
- class="badge badge-soft-info badge-pill align-items-center justify-content-center biz-highlight-text-color"
- href="javascript:;" onclick="">1235 <i class="fa fa-thumbs-up ml-1"></i></a> </div>
- </div>
- </div>`;
- 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(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
- <img class="mh-100 mw-100 w-100" data-liId="${e.dataIdNumber}" data-idnumber="${e.dataIdNumber}" src="${e.documentfilepath}" alt="image not found" onerror="ReloadImage(event)" style="
- padding-top: 5vh;
- " data-dynamic="1" data-loaded="0">
- </div>`);
- }
- else if (e.fileType === 'mp4') {
- $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
- <video class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${e.id}" data-idnumber="${e.dataIdNumber}" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0" controls > <source src="${e.documentfilepath.replace('~/', '')}" type="video/mp4">
-
- Your browser does not support the video tag.
- </video>
- </div>`);
- }
- else if (e.fileType === 'txt' || e.fileType === 'pdf') {
- $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
- <iframe src='${e.documentfilepath.replace('~/', '')}' title="W3Schools Free Online Web Tutorials"></iframe>
- </div>`);
- }
- else if (e.fileType === 'pdf' || e.fileType === 'word' || e.fileType === 'excel' || e.fileType != 'removeme') {
- $('.carousel-inner').append(`<div data-pathsrc="${e.documentfilepath}" style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
- <img class="mh-100 mw-100 w-100" data-liId="${e.dataIdNumber}" data-idnumber="${e.dataIdNumber}" src="/tenants/themes/compact/imgs/pdfimgdoc.png" alt="image not found" onerror="ReloadImage(event)" style="
- padding-top: 5vh;
- " data-dynamic="1" data-loaded="0">
- </div>`);
- }
- $('.carousel-inner').css('padding', 0);
- }
- else {
- if (e.fileType === 'png' || e.fileType === 'jpg' || e.fileType === 'jpeg' || e.fileType === 'svg') {
- $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item ${active}">
- <img style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${e.id}" data-idnumber="${e.dataIdNumber}" src="${e.documentfilepath}" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0">
- </div>`);
- }
- else if (e.fileType === 'mp4') {
- $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item ${active}">
- <video style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
-
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${e.id}" data-idnumber="${e.dataIdNumber}" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0" controls > <source src="${e.documentfilepath.replace('~/', '')}" type="video/mp4">
-
- Your browser does not support the video tag.
- </video>
- </div>`);
- }
- else if (e.fileType === 'txt' || e.fileType === 'pdf') {
- $('.carousel-inner').append(`<div style="text-align:center;" data-pathsrc="${e.documentfilepath}" class="carousel-item ${active}">
-
- <iframe style="
-
- height: 80vh !important;
- margin-top: 5vh;
- width:100%;
- " src='${e.documentfilepath.replace('~/', '')}' title="W3Schools Free Online Web Tutorials"></iframe>
-
- </div>`);
- }
- else if (e.fileType === 'word' || e.fileType === 'excel' || e.fileType != 'removeme') {
- $('.carousel-inner').append(`<div style="text-align:center;" data-pathsrc="${e.documentfilepath}" class="carousel-item ${active}">
- <img style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
- width:100px;
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${e.id}" data-idnumber="${e.dataIdNumber}" src="/tenants/themes/compact/imgs/pdfimgdoc.png" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0">
- </div>`);
- }
- }
- });
- $('.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(` <div style="max-height: ${sumHeight}px !important" class="h-100 carousel-item ${active}"><video playsinline muted data-bannerenable="${e.bannerenable}" src="${e.file}" type="video/mp4" data-liId="${e.liId}" data-bannerfileid="${e.bannerfileid}" data-bannerliked="${e.bannerliked}" onerror="sanitizeURL(event)" data-dynamic="1" data-loaded="0" class="mh-100 mw-100 w-100" controls autoplay loop webkit-playsinline webkitRequestFullscreen msRequestFullscreen style="object-fit: cover; padding-top:5vh;"></video></div>`);
- }
- else if (e.fileType === 'img') {
- $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
- <img data-bannerenable="${e.bannerenable}" class="mh-100 mw-100 w-100" data-liId="${e.liId}" src="${e.file}" data-bannerfileid="${e.bannerfileid}" data-bannerliked="${e.bannerliked}" alt="image not found" onerror="ReloadImage(event)" style="
- padding-top: 5vh;
- " data-dynamic="1" data-loaded="0">
- </div>`);
- }
- $('.carousel-inner').css('padding', 0);
- }
- else {
- if (e.fileType === 'video') {
- $('.carousel-inner').append(` <div style="max-height: ${sumHeight}px !important" class=" carousel-item ${active}"><video muted data-bannerenable="${e.bannerenable}" data-bannerfileid="${e.bannerfileid}" data-bannerliked="${e.bannerliked}" data-liId="${e.liId}" playsinline src="${e.file}" type="video/mp4" onerror="sanitizeURL(event)" data-dynamic="1" data-loaded="0" class=" mh-100 mw-100" controls autoplay loop webkit-playsinline webkitRequestFullscreen msRequestFullscreen style="object-fit: cover;"></video></div>`);
- }
- else if (e.fileType === 'img') {
- $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item ${active}">
- <img style="
- height: auto !important;
- max-height: 80vh !important;
- margin-top: 5vh;
- " class="d-block mh-100 mw-100 ml-auto mr-auto" data-liId="${e.liId}" data-bannerenable="${e.bannerenable}" data-bannerfileid="${e.bannerfileid}" data-bannerliked="${e.bannerliked}" src="${e.file}" alt="image not found" onerror="ReloadImage(event)" data-dynamic="1" data-loaded="0"">
- </div>`);
- }
- }
- });
- $('.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 !<br> Sit back and relax", function () {
- bootbox.alert("You will receive a notification once Face Recognition is completed.!<br>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 = {}));
|