Built files from Bizgaze WebServer
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

gallery.js 55KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Communications;
  6. (function (Communications) {
  7. let Events;
  8. (function (Events) {
  9. let Components;
  10. (function (Components) {
  11. class Gallery extends Unibase.Platform.Core.BaseComponent {
  12. constructor() {
  13. super();
  14. this.filePath = [];
  15. this.documentId = [];
  16. this.hashMapFilePath = {};
  17. this.galleryCurrentId = '';
  18. this.displayFileTypeEl = '';
  19. this.fileTypeDate = [];
  20. this.statusid = '';
  21. this.galleryPage = 0;
  22. this.carousel = '';
  23. this.inputParameters = [];
  24. this.elName = '';
  25. this.isPlaying = false;
  26. this.isDoc = false;
  27. this.isDocCall = false;
  28. this.reportIdGallery = null;
  29. this.nextClickHandler = (e) => {
  30. let instance = this;
  31. if ($('.carousel-item.active').next().length === 1) {
  32. $('.carousel-control-prev').removeClass('d-none');
  33. if ($('.carousel-item.active').next().next().length === 0) {
  34. if (!instance.isDocCall && $('._bizgaze_popup_container').length === 1) {
  35. instance.loadMoreGallery();
  36. }
  37. else {
  38. $('.carousel-control-next').addClass('d-none');
  39. }
  40. }
  41. let bannerliked = $('.carousel-item.active').next().find('img').attr('data-bannerliked');
  42. if (bannerliked == "false" || bannerliked == '' || bannerliked == null ||
  43. bannerliked == 'undefined') {
  44. $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart");
  45. }
  46. else {
  47. $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger");
  48. }
  49. }
  50. };
  51. this.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance();
  52. }
  53. cssFiles() {
  54. return [];
  55. }
  56. jsFiles() {
  57. return ["apps/communications/events/managers/gallerymanager.js", "apps/communications/events/components/shareimage.js"];
  58. }
  59. load(id, containerid, callback) {
  60. let Instance = this;
  61. Instance.displayImages();
  62. if (Instance.isDocCall) {
  63. this.displayFileType();
  64. }
  65. let imagegalleryheading = $('#div_App_DefaultWidget').find('.biz-header-main-text').text();
  66. $('#imagegalleryheading').text(imagegalleryheading);
  67. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
  68. $(`#${ContainerId}`).find('.carousel-control-prev').click(this.prevClickHandler);
  69. $(`#${ContainerId}`).find('.carousel-control-next').click(this.nextClickHandler);
  70. $('#modellikebtn').click(function (e) {
  71. let bannerfileid = $('.carousel-item.active').find('img').attr('data-bannerfileid');
  72. let checkclass = $('#modellikebtn').find("i").hasClass('icon-heart');
  73. if (checkclass == true) {
  74. Instance.likePhoto(bannerfileid, true);
  75. }
  76. else {
  77. Instance.likePhoto(bannerfileid, false);
  78. }
  79. });
  80. $('.carousel').on('slide.bs.carousel', function (e) {
  81. if (Instance.isPlaying) {
  82. if ($('.carousel-item.active').next().length > 0) {
  83. $('.carousel-control-prev').removeClass('d-none');
  84. if ($('.carousel-item.active').next().next().length == 0) {
  85. $('.carousel-control-next').addClass('d-none');
  86. }
  87. }
  88. }
  89. });
  90. $('#btn_autoplay').click(function (e) {
  91. Instance.isPlaying = true;
  92. if ($(e.target).find('.fa-pause').length != 0) {
  93. $(e.target).find('.fa-pause').removeClass('fa-pause').addClass('fa-play');
  94. $('.carousel').carousel('pause');
  95. Instance.isPlaying = false;
  96. }
  97. else {
  98. $('.carousel').carousel('cycle');
  99. $(e.target).find('.fa-play').removeClass('fa-play').addClass('fa-pause');
  100. }
  101. });
  102. $('#galleryimagedownloadbtn').click((e) => {
  103. if (this.isDoc) {
  104. let docIdNumber = $('.carousel-item.active').find('img').attr('data-liid');
  105. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/controls/filedragndrop/w_documentfiles.js', function () {
  106. Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(docIdNumber);
  107. });
  108. }
  109. else {
  110. let bannerfileid = $('.carousel-item.active').find('img').attr('data-bannerfileid');
  111. let bannerenable = $('.carousel-item.active').find('img').attr('data-bannerenable');
  112. let idnumberDoc = $('.carousel-item.active').find('img').attr('data-idnumber');
  113. if ($('#modellikebtn').hasClass('d-none')) {
  114. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/controls/filedragndrop/w_documentfiles.js', function () { Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(idnumberDoc); });
  115. }
  116. else if (bannerenable == 'true') {
  117. Instance.downloadImage(bannerfileid);
  118. }
  119. }
  120. });
  121. $('#shareimggallery').click(function (e) {
  122. let galleryIdImg = $('.carousel-item.active').find('img').attr('data-liId');
  123. let galleryDocId = $('.carousel-item.active').find('img').attr('data-documentfileidimg');
  124. Instance.shareImage(galleryDocId, galleryIdImg);
  125. });
  126. }
  127. prevClickHandler(e) {
  128. if ($('.carousel-item.active').prev().length === 1) {
  129. $('.carousel-control-next').removeClass('d-none');
  130. if ($('.carousel-item.active').prev().prev().length === 0) {
  131. $('.carousel-control-prev').addClass('d-none');
  132. }
  133. let bannerliked = $('.carousel-item.active').prev().find('img').attr('data-bannerliked');
  134. if (bannerliked == "false" || bannerliked == '' || bannerliked == null ||
  135. bannerliked == 'undefined') {
  136. $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart");
  137. }
  138. else {
  139. $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger");
  140. }
  141. }
  142. }
  143. loadMoreGallery() {
  144. let instance = this;
  145. var fromDate = "";
  146. var toDate = "";
  147. var cf_fromDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_FromDate;
  148. var cf_toDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_ToDate;
  149. if (cf_fromDate != null && cf_toDate != null) {
  150. fromDate = cf_fromDate.toString();
  151. toDate = cf_toDate.toString();
  152. }
  153. else {
  154. fromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
  155. toDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
  156. }
  157. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 2];
  158. instance.reportIdGallery = $(`#${ContainerId}`).find('#hf_ReportId').val();
  159. let objPayload = {
  160. ReportId: Number(instance.reportIdGallery),
  161. page: instance.galleryPage,
  162. Filter: [],
  163. InputParameters: instance.inputParameters,
  164. pageSize: 5,
  165. SearchTerm: null,
  166. FilterId: 0,
  167. DateFilter: [],
  168. IsEnableCount: true,
  169. DisplayModeTypeId: 1,
  170. FromDate: fromDate,
  171. ToDate: toDate,
  172. viewerTypeId: 2,
  173. IsDynamicFilterApplied: undefined,
  174. IsPortletWidget: true,
  175. };
  176. Unibase.Platform.Analytics.Viewers.TemplateViewer.Instance().reportManager.getReportInfo(objPayload).then(function (reportresponse) {
  177. if (reportresponse.result == null) {
  178. console.log('reportresponse.result == null');
  179. $('.carousel-control-next').addClass('d-none');
  180. return;
  181. }
  182. if (reportresponse.result.ReportJsonData.Result.Data === '') {
  183. $('.carousel-control-next').addClass('d-none');
  184. return;
  185. }
  186. ;
  187. let dataObj = JSON.parse(reportresponse.result.ReportJsonData.Result.Data);
  188. let newFilePath = [];
  189. dataObj.forEach((currentImg, index) => {
  190. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
  191. let screenHeight = screen.height;
  192. let heightHeader = $(`#${ContainerId}`).find('.modal-header').first().outerHeight(true);
  193. let heightFooter = $(`#${ContainerId}`).find('.modal-footer').first().outerHeight(true);
  194. let sumHeight = (screenHeight - (heightHeader + heightFooter));
  195. let fileType = currentImg.documentfilepath.split('.')[1].toLowerCase() != 'mp4' ? 'img' : 'video';
  196. let file = currentImg.documentfilepath.slice(1, currentImg.documentfilepath.length);
  197. let id = currentImg.documentfilename;
  198. let bannerenable = currentImg.enabledownload;
  199. let liId = currentImg.documentfileid;
  200. let bannerliked = currentImg.liked === null ? '' : currentImg.liked;
  201. newFilePath.push({ fileType, file, id, bannerenable, liId, bannerfileid: liId, bannerliked });
  202. let details = navigator.userAgent;
  203. let regexp = /android|iphone|kindle|ipad/i;
  204. let isMobileDevice = regexp.test(details);
  205. let el = '';
  206. el = `${instance.elName}`;
  207. if (instance.isDoc == false) {
  208. if (isMobileDevice) {
  209. if (fileType === 'video') {
  210. $('.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>`);
  211. }
  212. else if (fileType === 'img') {
  213. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ">
  214. <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="
  215. padding-top: 5vh;
  216. " data-dynamic="1" data-loaded="0">
  217. </div>`);
  218. }
  219. $('.carousel-inner').css('padding', 0);
  220. }
  221. else {
  222. if (fileType === 'video') {
  223. $('.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>`);
  224. }
  225. else if (fileType === 'img') {
  226. $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item" >
  227. <img style="
  228. height: auto !important;
  229. max-height: 80vh !important;
  230. margin-top: 5vh;
  231. " 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"">
  232. </div>`);
  233. }
  234. }
  235. }
  236. if (instance.isDoc) {
  237. if (isMobileDevice) {
  238. if (currentImg.documenttypename === 'png' || currentImg.documenttypename === 'jpg' || currentImg.documenttypename === 'jpeg') {
  239. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ">
  240. <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="
  241. padding-top: 5vh;
  242. " data-dynamic="1" data-loaded="0">
  243. </div>`);
  244. }
  245. else if (currentImg.documenttypename === 'pdf' || currentImg.documenttypename === 'word' || currentImg.documenttypename === 'excel' || currentImg.fileType != 'removeme') {
  246. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ">
  247. <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="
  248. padding-top: 5vh;
  249. " data-dynamic="1" data-loaded="0">
  250. </div>`);
  251. }
  252. $('.carousel-inner').css('padding', 0);
  253. }
  254. else {
  255. if (currentImg.documenttypename === 'png' || currentImg.documenttypename === 'jpg' || currentImg.documenttypename === 'jpeg' || currentImg.fileType === 'svg') {
  256. $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item">
  257. <img style="
  258. height: auto !important;
  259. max-height: 80vh !important;
  260. margin-top: 5vh;
  261. " 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">
  262. </div>`);
  263. }
  264. else if (currentImg.documenttypename === 'pdf' || currentImg.documenttypename === 'word' || currentImg.documenttypename === 'excel' || currentImg.fileType != 'removeme') {
  265. $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item">
  266. <img style="
  267. height: auto !important;
  268. max-height: 80vh !important;
  269. margin-top: 5vh;
  270. width:100px;
  271. " 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">
  272. </div>`);
  273. }
  274. }
  275. }
  276. $('.carousel-control-next').removeClass('d-none');
  277. });
  278. instance.galleryPage++;
  279. });
  280. let bannerliked = $('.carousel-item.active').next().find('img').attr('data-bannerliked');
  281. if (bannerliked == "false" || bannerliked == '' || bannerliked == null ||
  282. bannerliked == 'undefined') {
  283. $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart");
  284. }
  285. else {
  286. $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger");
  287. }
  288. }
  289. init(containerid) {
  290. }
  291. html(id, containerid) {
  292. let html = `
  293. <div id="img-modal" class="modal-content h-100">
  294. <div class="modal-header pa-10"> <strong class="modal-title biz-highlight-bg-color" id="imagegalleryheading">Gallery</strong>
  295. <div class="d-flex align-items-center justify-content-between">
  296. <div> <button type="button"
  297. id="btn_autoplay"
  298. 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:;"
  299. "><span class="btn-icon-wrap"><i class="fa fa-share-alt"></i></span></button> <button
  300. class="btn btn-icon btn-icon-circle btn-success btn-icon-style-3" id="galleryimagedownloadbtn" href="javascript:;"><span
  301. class="btn-icon-wrap"><i class="fa fa-download"></i></span></button> </div>
  302. </div>
  303. <div id="divEditFiltersErrMsg" class="form-error-message"></div>
  304. </div>
  305. <div class="modal-body simple-scroll-bar edit-filters-body py-0 bg-cyan-light-5">
  306. <div class="d-flex" id="galleryheightmodel" style="gap: 10px;align-items: center;height:80vh">
  307. <a style="opacity: 1; width:20px; " class="carousel-control-prev d-none position-static" href="#carouselExampleControls" role="button"
  308. data-slide="prev"> <span style="background-image: none;" class="carousel-control-prev-icon"
  309. aria-hidden="true"> <i class="fa fa-angle-double-left " style=" color: black; font-size: 34px; "></i>
  310. </span> <span class="preImgHandler sr-only">Previous</span> </a>
  311. <div class="card bg-transparent border-0 shadow-none" id="staticFiltersCard" style="
  312. flex-grow: 1;
  313. ">
  314. <div id="carouselExampleControls" data-interval="2000" class="carousel slide-fade" data-ride="carousel">
  315. <div class="carousel-inner " style="padding:0px 100px "> </div>
  316. </div>
  317. </div>
  318. <a style="opacity: 1;width: 20px;" class="carousel-control-next position-static" href="#carouselExampleControls" role="button"
  319. data-slide="next"> <span style="background-image: none;" class="carousel-control-next-icon"
  320. aria-hidden="true"> <i class="fa fa-angle-double-right" style=" color: black; font-size: 34px;"></i>
  321. </span> <span class="sr-only ">Next</span> </a>
  322. </div>
  323. </div>
  324. <div class="modal-footer pa-10"> <button type="button"
  325. onclick="Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp()" id="btn_CloseForm_${id}"
  326. class="btn btn-light btn-sm mr-auto">Close</button>
  327. <div> <button id="modellikebtn" class="btn btn-icon btn-icon-circle btn-liked btn-danger btn-icon-style-3"
  328. href="javascript:;"><span class="btn-icon-wrap"><i class="modelgallery icon-heart"></i></span></button> <a
  329. class="badge badge-soft-info badge-pill align-items-center justify-content-center biz-highlight-text-color"
  330. href="javascript:;" onclick="">1235 <i class="fa fa-thumbs-up ml-1"></i></a> </div>
  331. </div>
  332. </div>`;
  333. return html;
  334. }
  335. openModalFile(currentElId) {
  336. this.galleryPage = 2;
  337. this.elName = '.documenttypegapCustom';
  338. let Instance = this;
  339. Instance.isDocCall = true;
  340. this.displayFileTypeEl = currentElId;
  341. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
  342. this.isDoc = true;
  343. Instance.fileTypeDate = [];
  344. let el = '';
  345. if ($('._bizgaze_popup_container').length === 0) {
  346. el = `.documenttypegapCustom`;
  347. }
  348. else {
  349. el = `._bizgaze_popup_container .documenttypegapCustom`;
  350. }
  351. $(el).each(function (i, e) {
  352. let fileType = $(e).find('[data-filetype]').val();
  353. fileType = `${fileType}`.toLowerCase();
  354. let documentfilepath = $(`#list-group-item-${$(e).find('[data-documentfileidCus]').val()}`).find('[data-documentfilepath]').val();
  355. let id = $(e).find('[data-documentfileidCus]').val();
  356. debugger;
  357. Instance.fileTypeDate.push({
  358. id,
  359. fileType,
  360. documentfilepath,
  361. dataIdNumber: $(e).find('[data-documentfileidCus]').val()
  362. });
  363. });
  364. }
  365. displayFileType() {
  366. let Instance = this;
  367. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
  368. if (this.isDoc) {
  369. $('#shareimggallery').addClass('d-none');
  370. $('#modellikebtn').addClass('d-none');
  371. $('.fa-thumbs-up').parent().addClass('d-none');
  372. }
  373. let screenHeight = screen.height;
  374. let heightHeader = $(`#${ContainerId}`).find('.modal-header').first().outerHeight(true);
  375. let heightFooter = $(`#${ContainerId}`).find('.modal-footer').first().outerHeight(true);
  376. let sumHeight = (screenHeight - (heightHeader + heightFooter));
  377. $('.carousel-inner').html('');
  378. Instance.fileTypeDate.forEach(function (e, i) {
  379. let active = '';
  380. if (Instance.displayFileTypeEl == +e.id) {
  381. active = 'active';
  382. }
  383. debugger;
  384. let details = navigator.userAgent;
  385. let regexp = /android|iphone|kindle|ipad/i;
  386. let isMobileDevice = regexp.test(details);
  387. if (isMobileDevice) {
  388. if (e.fileType === 'png' || e.fileType === 'jpg' || e.fileType === 'jpeg') {
  389. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
  390. <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="
  391. padding-top: 5vh;
  392. " data-dynamic="1" data-loaded="0">
  393. </div>`);
  394. }
  395. else if (e.fileType === 'mp4') {
  396. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
  397. <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">
  398. Your browser does not support the video tag.
  399. </video>
  400. </div>`);
  401. }
  402. else if (e.fileType === 'txt' || e.fileType === 'pdf') {
  403. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
  404. <iframe src='${e.documentfilepath.replace('~/', '')}' title="W3Schools Free Online Web Tutorials"></iframe>
  405. </div>`);
  406. }
  407. else if (e.fileType === 'pdf' || e.fileType === 'word' || e.fileType === 'excel' || e.fileType != 'removeme') {
  408. $('.carousel-inner').append(`<div data-pathsrc="${e.documentfilepath}" style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
  409. <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="
  410. padding-top: 5vh;
  411. " data-dynamic="1" data-loaded="0">
  412. </div>`);
  413. }
  414. $('.carousel-inner').css('padding', 0);
  415. }
  416. else {
  417. if (e.fileType === 'png' || e.fileType === 'jpg' || e.fileType === 'jpeg' || e.fileType === 'svg') {
  418. $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item ${active}">
  419. <img style="
  420. height: auto !important;
  421. max-height: 80vh !important;
  422. margin-top: 5vh;
  423. " 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">
  424. </div>`);
  425. }
  426. else if (e.fileType === 'mp4') {
  427. $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item ${active}">
  428. <video style="
  429. height: auto !important;
  430. max-height: 80vh !important;
  431. margin-top: 5vh;
  432. " 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">
  433. Your browser does not support the video tag.
  434. </video>
  435. </div>`);
  436. }
  437. else if (e.fileType === 'txt' || e.fileType === 'pdf') {
  438. $('.carousel-inner').append(`<div style="text-align:center;" data-pathsrc="${e.documentfilepath}" class="carousel-item ${active}">
  439. <iframe style="
  440. height: 80vh !important;
  441. margin-top: 5vh;
  442. width:100%;
  443. " src='${e.documentfilepath.replace('~/', '')}' title="W3Schools Free Online Web Tutorials"></iframe>
  444. </div>`);
  445. }
  446. else if (e.fileType === 'word' || e.fileType === 'excel' || e.fileType != 'removeme') {
  447. $('.carousel-inner').append(`<div style="text-align:center;" data-pathsrc="${e.documentfilepath}" class="carousel-item ${active}">
  448. <img style="
  449. height: auto !important;
  450. max-height: 80vh !important;
  451. margin-top: 5vh;
  452. width:100px;
  453. " 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">
  454. </div>`);
  455. }
  456. }
  457. });
  458. $('.carousel').carousel({
  459. interval: 2000,
  460. wrap: false,
  461. });
  462. $('.carousel').carousel('pause');
  463. if ($('.carousel-item.active').next().length === 0) {
  464. if ($('._bizgaze_popup_container').length === 1) {
  465. $('.carousel-control-next').addClass('d-none');
  466. Instance.loadMoreGallery();
  467. }
  468. }
  469. else {
  470. $('.carousel-control-next').removeClass('d-none');
  471. }
  472. if ($('.carousel-item.active').prev().length === 0) {
  473. $('.carousel-control-prev').addClass('d-none');
  474. }
  475. else {
  476. $('.carousel-control-prev').removeClass('d-none');
  477. }
  478. Instance.isDocCall = false;
  479. }
  480. filePathPush(galleryCurrentId) {
  481. let Instance = this;
  482. this.galleryCurrentId = galleryCurrentId;
  483. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[0];
  484. Instance.galleryPage = 2;
  485. Instance.elName = `.banner-media`;
  486. Instance.filePath = [];
  487. let el = '';
  488. if ($('._bizgaze_popup_container').length === 0) {
  489. el = `.banner-media`;
  490. }
  491. else {
  492. el = `._bizgaze_popup_container .banner-media`;
  493. }
  494. $(el).each(function (i, e) {
  495. let file = '';
  496. let fileType = '';
  497. let id = $(e).parents('.gallery-list').attr('data-documentfileidimg');
  498. if (id == '') {
  499. id = $(e).parents('.gallery-list').attr('data-otherid');
  500. }
  501. let liId = $(e).parents('.gallery-list').attr('id');
  502. liId = liId.replace(/list-group-item-/g, '');
  503. let bannerfileid = $(e).parents('.gallery-list').find('.bannerfileid').val();
  504. let bannerliked = $(e).parents('.gallery-list').find('.bannerliked').val();
  505. let bannerenable = $(e).parents('.gallery-list').find('.enabledownload').val();
  506. if ($(this).find('img').length === 1) {
  507. fileType = 'img';
  508. file = $(this).find('img').attr('src');
  509. }
  510. else if ($(this).find('video').length === 1) {
  511. fileType = 'video';
  512. file = $(this).find('video').attr('src');
  513. }
  514. if (!Instance.hashMapFilePath[id]) {
  515. Instance.hashMapFilePath[id] = true;
  516. }
  517. Instance.filePath.push({ fileType, file, id, bannerfileid, bannerliked, liId, bannerenable });
  518. });
  519. }
  520. displayImages() {
  521. let Instance = this;
  522. let ContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
  523. $('.carousel-inner').html('');
  524. let screenHeight = screen.height;
  525. let heightHeader = $(`#${ContainerId}`).find('.modal-header').first().outerHeight(true);
  526. let heightFooter = $(`#${ContainerId}`).find('.modal-footer').first().outerHeight(true);
  527. let sumHeight = (screenHeight - (heightHeader + heightFooter));
  528. this.filePath.forEach(function (e, i) {
  529. let active = '';
  530. if (Instance.galleryCurrentId == e.id) {
  531. active = 'active';
  532. if (e.bannerliked == "false" || e.bannerliked == '' || e.bannerliked == null ||
  533. e.bannerliked == 'undefined') {
  534. $('.modelgallery').removeClass("fa fa-heart text-danger").addClass("icon-heart");
  535. }
  536. else {
  537. $('.modelgallery').removeClass("icon-heart").addClass("fa fa-heart text-danger");
  538. }
  539. if (e.bannerenable == 'false') {
  540. $('#galleryimagedownloadbtn').addClass('d-none');
  541. }
  542. }
  543. let details = navigator.userAgent;
  544. let regexp = /android|iphone|kindle|ipad/i;
  545. let isMobileDevice = regexp.test(details);
  546. if (isMobileDevice) {
  547. if (e.fileType === 'video') {
  548. $('.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>`);
  549. }
  550. else if (e.fileType === 'img') {
  551. $('.carousel-inner').append(`<div style="max-height: ${sumHeight}px !important" class="carousel-item ${active} ">
  552. <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="
  553. padding-top: 5vh;
  554. " data-dynamic="1" data-loaded="0">
  555. </div>`);
  556. }
  557. $('.carousel-inner').css('padding', 0);
  558. }
  559. else {
  560. if (e.fileType === 'video') {
  561. $('.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>`);
  562. }
  563. else if (e.fileType === 'img') {
  564. $('.carousel-inner').append(`<div style="text-align:center;" class="carousel-item ${active}">
  565. <img style="
  566. height: auto !important;
  567. max-height: 80vh !important;
  568. margin-top: 5vh;
  569. " 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"">
  570. </div>`);
  571. }
  572. }
  573. });
  574. $('.carousel').carousel({
  575. wrap: false
  576. });
  577. $('.carousel').carousel('pause');
  578. if ($('.carousel-item.active').next().length === 0) {
  579. if (!Instance.isDoc && $('._bizgaze_popup_container').length === 1) {
  580. Instance.loadMoreGallery();
  581. }
  582. else {
  583. $('.carousel-control-next').addClass('d-none');
  584. }
  585. }
  586. else {
  587. $('.carousel-control-next').removeClass('d-none');
  588. }
  589. if ($('.carousel-item.active').prev().length === 0) {
  590. $('.carousel-control-prev').addClass('d-none');
  591. }
  592. else {
  593. $('.carousel-control-prev').removeClass('d-none');
  594. }
  595. }
  596. likePhoto(documentfileId, isLiked) {
  597. if (documentfileId != 0) {
  598. var data = {
  599. PhotoId: Number(documentfileId),
  600. LikedBy: Unibase.Platform.Membership.Infos.Identity.currentUser.userId,
  601. Liked: isLiked
  602. };
  603. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js", function () {
  604. Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().changephotplike(data).then((responce) => {
  605. if (responce.result != null) {
  606. if (responce.result.Liked) {
  607. $("gallery_liked_" + responce.result.PhotoId).closest(".gallery-list").addClass("liked-image");
  608. $("#gallery_liked_" + responce.result.PhotoId).removeClass("icon-heart").addClass("fa fa-heart text-danger");
  609. $(`[data-documentfileidimg="${responce.result.PhotoId}"]`).find('.bannerliked').attr('value', 'true');
  610. $('#modellikebtn').find('i').removeClass("icon-heart").addClass("fa fa-heart text-danger");
  611. }
  612. else {
  613. $("#gallery_liked_" + responce.result.PhotoId).removeClass("fa fa-heart text-danger").addClass("icon-heart");
  614. $(`[data-documentfileidimg="${responce.result.PhotoId}"]`).find('.bannerliked').attr('value', 'false');
  615. $('#modellikebtn').find('i').removeClass("fa fa-heart text-danger").addClass("icon-heart");
  616. }
  617. }
  618. });
  619. });
  620. }
  621. }
  622. downloadImage(documentfileId, isTrue) {
  623. if (isTrue) {
  624. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/controls/ filedragndrop/w_documentfiles.js', function () {
  625. Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(documentfileId);
  626. });
  627. return;
  628. }
  629. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/filedragndrop/w_documentfiles.js", function () {
  630. Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(documentfileId);
  631. });
  632. }
  633. shareImage(documentfileId, galleryId) {
  634. var instance = this;
  635. instance.documentfileId = documentfileId;
  636. instance.galleryId = galleryId;
  637. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/components/shareimage.js", function () {
  638. var obj = new Bizgaze.Apps.Communications.Events.Components.ShareImage;
  639. instance.navigationHelper.popup(0, '', obj, null, Unibase.Platform.Helpers.Size.Large);
  640. });
  641. }
  642. deleteImage(DocumentFileId, galleryId) {
  643. var instance = this;
  644. instance.documentfileId = DocumentFileId;
  645. instance.galleryId = galleryId;
  646. bootbox.confirm("Are you sure?", function (result) {
  647. if (!result)
  648. return;
  649. instance.fileCacheHelper.loadJsFile("platform/files/managers/filemanager.js", function () {
  650. Unibase.Platform.Files.Managers.FileManager.Instance().deleteDocumentFile(DocumentFileId).then(function (response) {
  651. if (response.message == 'File Deleted Successfully') {
  652. $('.photoidCustom[data-documentfileidimg="' + DocumentFileId + '"]').remove();
  653. }
  654. });
  655. var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
  656. detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
  657. detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  658. detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id");
  659. var idetailObj = detailobj;
  660. detailobj.loadPortlets(idetailObj);
  661. });
  662. });
  663. }
  664. importPortability(containerid) {
  665. var instance = this;
  666. $('.sp_widget_create_' + containerid + '').find('#LinkButton').click(function () {
  667. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/portability/components/portability.js', function () {
  668. let InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  669. let portabilityinstance = 'Unibase.Platform.Portability.Components.ImportAndExport.Instance()';
  670. var jsinstance = eval(portabilityinstance);
  671. var component = jsinstance;
  672. var appSettingComponent = jsinstance;
  673. if (appSettingComponent !== null && appSettingComponent !== undefined) {
  674. appSettingComponent.appSettings.InstalledAppId = InstalledAppId;
  675. }
  676. if (component != null && component != undefined) {
  677. instance.navigationhelper.popup(0, '', component, function () {
  678. }, Unibase.Platform.Helpers.Size.Large);
  679. }
  680. });
  681. });
  682. }
  683. predictedimages() {
  684. var eventid = Unibase.Themes.Providers.Detail_Settings.instance.InputParameters.find(f => f.Key.endsWith('eventid')).Value;
  685. this.navigationhelper.showLoading();
  686. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js", function () {
  687. bootbox.alert("Face Detection Initiated !<br> Sit back and relax", function () {
  688. bootbox.alert("You will receive a notification once Face Recognition is completed.!<br>Sit back and relax !", function () {
  689. Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().predictedImages().then((response) => {
  690. if (response === 'ALL MATCH FOUND') {
  691. this.navigationhelper.hideLoading();
  692. bootbox.alert("Sucess");
  693. }
  694. else {
  695. this.navigationhelper.hideLoading();
  696. }
  697. });
  698. });
  699. });
  700. });
  701. }
  702. eventWisePrediction(eventId) {
  703. var instance = this;
  704. instance.eventid = eventId;
  705. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/communications/events/managers/gallerymanager.js", function () {
  706. var imgbase64 = "~/tenants/themes/compact/imgs/alertimg.png";
  707. bootbox.alert("The prediction has started", function () {
  708. Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().eventWisePredictedImages(eventId).then((response) => {
  709. if (response === 'ALL MATCH FOUND') {
  710. instance.navigationhelper = Unibase.Platform.Helpers.NavigationHelper.Instance();
  711. instance.navigationhelper.hideLoading();
  712. bootbox.alert("Sucess");
  713. $("#widgetconfig_Predict").show();
  714. }
  715. else {
  716. instance.navigationhelper.hideLoading();
  717. $("#widgetconfig_Predict").show();
  718. }
  719. });
  720. });
  721. });
  722. }
  723. aprovedImage(DocumentFileId, statusid) {
  724. var instance = this;
  725. instance.documentfileId = DocumentFileId;
  726. instance.statusid = statusid;
  727. instance.fileCacheHelper.loadJsFile("apps/communications/events/managers/gallerymanager.js", function () {
  728. Bizgaze.Apps.Communications.Events.Managers.GalleryManager.Instance().approvedImage(DocumentFileId, statusid).then(function (response) {
  729. });
  730. var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
  731. detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
  732. detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  733. detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id");
  734. var idetailObj = detailobj;
  735. detailobj.loadPortlets(idetailObj);
  736. });
  737. }
  738. static Instance() {
  739. if (this.instance === undefined) {
  740. this.instance = new Gallery();
  741. }
  742. return this.instance;
  743. }
  744. }
  745. Components.Gallery = Gallery;
  746. })(Components = Events.Components || (Events.Components = {}));
  747. })(Events = Communications.Events || (Communications.Events = {}));
  748. })(Communications = Apps.Communications || (Apps.Communications = {}));
  749. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  750. })(Bizgaze || (Bizgaze = {}));