1var languageCode = $('.hdnSessionLangCode').val(); 2if (languageCode == "da-DK") { languageCode = "da"; } 3else if (languageCode == "kl-GL") { languageCode = "gl"; } 4else if (languageCode == "en-US") { languageCode = "en"; } 5else if (languageCode == "ga-IE") { languageCode = "ga"; } 6else if (languageCode == "fo-FO") { languageCode = "nl"; } 7else { languageCode = "da"; } 8var currentCulture = languageCode; 9function GetDanishDateTime(date) { 10 // Sample date and time 11 const dateTime = new Date(date); 12 13 // Convert to Danish format 14 const danishDateTime = dateTime.toLocaleString('da-DK', { 15 day: '2-digit', 16 month: 'short', 17 //year: 'numeric', 18 //hour: '2-digit', 19 //minute: '2-digit', 20 //second: '2-digit', 21 }); 22 return danishDateTime; 23} 24 25function GetDanishDay(date) { 26 // Sample date and time 27 var days = [So_Resource,Ma_Resource,Ti_Resource,On_Resource,To_Resource,Fr_Resource,Lo_Resource]; 28 const dateTime = new Date(date); 29 var dayName = days[dateTime.getDay()]; 30 return dayName; 31} 32 33function ConvertIntoDanishNumber(number) { 34 var langCode = $(".hdnSessionLangCode").val(); 35 if (langCode == null || langCode == "" || langCode != "en-US") { 36 langCode = "da-DK"; 37 } 38 if (number != undefined) { 39 const formattedNumber = number.toLocaleString(langCode, { 40 minimumFractionDigits: 2, 41 maximumFractionDigits: 2 42 }); 43 return formattedNumber; 44 } 45} 46function ConvertIntoNoramlNumber(number) { 47 if (number != undefined) { 48 var langCode = $(".hdnSessionLangCode").val(); 49 if (langCode == "en-US") { 50 if (number != "0") {
51 return number.replace(/,/g, '') // Remove commas (thousands separator) 52 .replace(/\s?(kr|USD|EUR)/g, ''); 53 }// Remove currency symbols 54 else { 55 return number; 56 } 57 } else { 58 if (number != "0") { 59 return number.replace(/\./g, '') // Remove dots (thousands separator) 60 .replace(/,/g, '.') // Replace decimal comma with dot 61 .replace(/\s?(kr|USD|EUR)/g, ''); // Remove currency symbols 62 } else { 63 return number; 64 } 65 } 66 } 67} 68 69 70function GetMonthNameFromDate(date) { 71 const monthNames = [ 72 Jan_Resource, Feb_Resource, Mar_Resource, Apr_Resource, May_Resource, Jun_Resource, Jul_Resource, Aug_Resource, Sep_Resource, Okt_Resource, Nov_Resource, Dec_Resource 73 ]; 74 const currentDate = new Date(date); 75 const currentMonth = currentDate.getMonth(); 76 const currentMonthName = monthNames[currentMonth]; 77 return currentMonthName; 78} 79 80function GetDayOfMonth(date) { 81 const currentDate = new Date(date); 82 const currentDay = currentDate.getDate(); 83 return currentDay; 84} 85 86function ShortDateWithOnlyMonth(date) { 87 // for ex : 25Aug 88 const monthNames = [ 89 Jan_Resource, Feb_Resource, Mar_Resource, Apr_Resource, May_Resource, Jun_Resource, Jul_Resource, Aug_Resource, Sep_Resource, Okt_Resource, Nov_Resource, Dec_Resource 90 ]; 91 const currentDate = new Date(date); 92 const currentMonth = currentDate.getMonth(); 93 const currentDay = currentDate.getDate(); 94 const currentMonthName = monthNames[currentMonth]; 95 const shortDate = currentDay + " " + currentMonthName; 96 return shortDate; 97} 98 99 100function ShortDateWithOnlyLongMonth(date) { 101 // for ex : 25august 102 const monthNames = [ 103 Januar_Resource, Februar_Resource, Marts_Resource, April_Resource, Maj_Resource, Juni_Resource, Juli_Resource, August_Resource, September_Resource, Oktober_Resource, November_Resource, December_Resource 104 ]; 105 const currentDate = new Date(date); 106 const currentMonth = currentDate.getMonth(); 107 const currentDay = currentDate.getDate(); 108 const currentMonthName = monthNames[currentMonth]; 109 const shortDate = currentDay + " " + currentMonthName; 110 return shortDate; 111 112 113 return danishDateTime; 114} 115 116 117function GetDanishDayLongFormat(date) { 118 // Sample date and time 119 var days = [Sunday_Resource,Monday_Resource ,Tuesday_Resource ,Wednesday_Resource,Thursday_Resource ,Friday_Resource ,Saturday_Resource ]; 120 const dateTime = new Date(date); 121 var dayName = days[dateTime.getDay()]; 122 return dayName; 123} 124 125 126function GetDateDifference(startdate, enddate) { 127 //var diff = Math.abs(new Date(enddate) - new Date(startdate)); 128 //var ms, ss, mm, hh, days; 129 //ms = diff % 1000; 130 //diff = (diff - ms) / 1000 131 //ss = diff % 60; 132 //diff = (diff - ss) / 60 133 //mm = diff % 60; 134 //diff = (diff - mm) / 60 135 //hh = diff % 24; 136 //days = (diff - hh) / 24 137 138 //if (mm.toString().length == 1) { 139 // mm = "0" + mm; 140 //} 141 ////var finaldiff = hh + ":" + mm + ":" + ss + "." + ms; 142 //var finaldiff = hh + " timer og " + mm + " minutter"; //, inkl. pause på 00 minutter 143 //return finaldiff; 144 145 /* New Time hour diff*/ 146 var start = new Date(startdate) 147 var end = new Date(enddate); 148 149 var diff = new Date(end - start).toISOString(); // "yyyy-mm-ddThh:mm:ss.zzzZ" 150 var hms = diff.match(/T([\d:]+)\./)[1].split(':'); // Get time and split by `:` 151 var finaldiff = ""; 152 var hm = hms[0].split(''); 153 154 if (hms[1] == "00") { 155 if (hm[0] == 0) { 156 finaldiff = hm[1] + " timer"; 157 } 158 else { 159 finaldiff = hms[0] + " timer"; 160 } 161 } 162 else { 163 164 if (hm[0] == 0) { 165 finaldiff = hm[1] + " timer og " + hms[1] + " minutter"; 166 } 167 else { 168 finaldiff = hms[0] + " timer og " + hms[1] + " minutter"; 169 } 170 } 171 172 return finaldiff; 173} 174//function GetLongMonthNameFromDate(date) { 175// const monthNames = [ 176// "januar", "februar", "marts", "april", "maj", "juni", 177// "juli", "august", "september", "oktober", "november", "december" 178// ]; 179// const currentDate = new Date(date); 180// const currentMonth = currentDate.getMonth(); 181// const currentMonthName = monthNames[currentMonth]; 182// return currentMonthName; 183//} 184 185function SetResponseOfPartialView(selectorid, response) { 186 $(selectorid).html(""); 187 $(selectorid).html(response); 188} 189 190 191function ShortDateWithOnlyMonthYear(date) { 192 // for ex : 25 Aug 2023 193 const monthNames = [ 194 Jan_Resource, Feb_Resource, Mar_Resource, Apr_Resource, May_Resource, Jun_Resource, Jul_Resource, Aug_Resource, Sep_Resource, Okt_Resource, Nov_Resource, Dec_Resource 195 ]; 196 const currentDate = new Date(date); 197 const currentMonth = currentDate.getMonth(); 198 const currentDay = currentDate.getDate(); 199 const currentYear = currentDate.getFullYear(); 200 const currentMonthName = monthNames[currentMonth]; 201 const shortDate = currentDay + " " + currentMonthName + " " + currentYear; 202 return shortDate; 203} 204 205function GetOnlyLongMonth(date) { 206 // for ex : Januar 207 const monthNames = [ 208 Januar_Resource, Februar_Resource, Marts_Resource, April_Resource, Maj_Resource, Juni_Resource, Juli_Resource, August_Resource, September_Resource, Oktober_Resource, November_Resource, December_Resource 209 ]; 210 const currentDate = new Date(date); 211 const currentMonth = currentDate.getMonth(); 212 const currentMonthName = monthNames[currentMonth]; 213 const shortDate = currentMonthName; 214 return shortDate; 215} 216 217function fnDateToGetYearName(date) { 218 // for ex : 2023 219 const currentDate = new Date(date); 220 const currentDay = currentDate.getFullYear(); 221 return currentDay; 222} 223 224function fnGetOnlyDate(date) { 225 // for ex : 01/01/2023 226 const currentDate = new Date(date); 227 const currentDay = ((currentDate.getDate() > 9) ? currentDate.getDate() : ('0' + currentDate.getDate())) + '/' + ((currentDate.getMonth() > 8) ? (currentDate.getMonth() + 1) : ('0' + (currentDate.getMonth() + 1))) + '/' + currentDate.getFullYear(); 228 return currentDay; 229} 230 231function fnGetOnlyTime(date) { 232 // for ex : 00:00 233 const currentDate = new Date(date); 234 const currentDay = currentDate.getHours() + ":" + currentDate.getMinutes(); 235 const currentDay1 = currentDay == "0:0" ? ", 00:00 " : + ', ' + currentDay; 236 return currentDay1; 237} 238 239 240/* Event Related Date Solt start*/ 241function fnFullDateToGetOnlyDayNameForEvent(startdate, enddate) { 242 const st = GetDayOfMonth(startdate); 243 const et = GetDayOfMonth(enddate); 244 const DayName = st != et ? st + "-" + et : st; 245 return DayName; 246} 247 248function fnFullDateToGetOnlyMonthNameForEvent(startdate, enddate) { 249 const st = GetMonthNameFromDate(startdate); 250 const et = GetMonthNameFromDate(enddate); 251 const MonthName = st != et ? st + "-" + et : st; 252 return MonthName; 253} 254 255function fnFullDateToGetOnlyYearNameForEvent(startdate, enddate) { 256 const st = fnDateToGetYearName(startdate); 257 const et = fnDateToGetYearName(enddate); 258 const YearName = st != et ? st + "/" + et : st; 259 return YearName; 260} 261 262function fnEventDateDescription(startdate, enddate, startTime) { 263 264 var startdt = GetDayOfMonth(startdate); 265 266 const enddt = GetDayOfMonth(enddate); 267 268 const startDayName = GetDanishDay(startdate); 269 270 const endDayName = GetDanishDay(enddate); 271 272 const startdateName = fnGetOnlyDate(startdate); 273 274 const enddateName = fnGetOnlyDate(enddate); 275 276 const startmonthName = GetMonthNameFromDate(startdate); 277 278 const enddatemonthName = GetMonthNameFromDate(enddate); 279 280 const startyearName = fnDateToGetYearName(startdate); 281 282 const enddateyearName = fnDateToGetYearName(enddate); 283 284 const startdateTime = fnGetOnlyTime(startdate); 285 const enddateTime = fnGetOnlyTime(enddate); 286 287 const startdateFullDayName = GetDanishDayLongFormat(startdate); 288 const startdateFullMonthName = GetOnlyLongMonth(startdate); 289 290 291 const EventDateDescription = startyearName != enddateyearName ? (startDayName + " " + startdateName + " - " + endDayName + " " + enddateName + ", kl. " + startTime) : startmonthName != enddatemonthName ? (startDayName + " " + startdateName + " - " + endDayName + " " + enddateName + ", kl. " + startTime) : startdt != enddt ? (startDayName + " - " + endDayName + " den " + startdt + " - " + enddt + " " + enddatemonthName + " " + startyearName + ", kl. " + startTime) : (startdateFullDayName + " den " + startdt + ". " + startdateFullMonthName + " " + startyearName + ", kl. " + startTime); 292 293 const modStr = EventDateDescription[0].toUpperCase() + EventDateDescription.slice(1).toLowerCase(); 294 295 return modStr; 296} 297 298/* Event Related Date Solt End */ 299 300(function (window, $) { 301 if (window.AppLoader) { 302 return; 303 } 304 305 var hideTimer = null; 306 var hideDelay = 10; 307 var activeProcesses = 0; 308 var fetchPatched = false; 309 var xhrPatched = false; 310 var ajaxPatched = false; 311 var suppressXhrTracking = false; 312 var keepLoaderStorageKey = "keepLoader"; 313 var navigationPending = false; 314 var backgroundUrlPatterns = [
315 "UpdateVerificationTimer", 316 "/SessionKeepAlive/KeepAlive", 317 "/User/IsCheckPassword", 318 "/User/GetRoleList", 319 "/Booking/DownloadBelaegningskalenderFile" 320 ]; 321 322 function getLoader() { 323 return document.getElementById("loader-container"); 324 } 325 326 function shouldHandleAjax(settings) { 327 if (settings && (settings.skipLoader === true || settings.showLoader === false)) { 328 return false; 329 } 330 331 return shouldHandleUrl(settings && settings.url); 332 } 333 334 function shouldHandleUrl(url) { 335 if (!url) { 336 return true; 337 } 338 339 return !backgroundUrlPatterns.some(function (pattern) { 340 return url.indexOf(pattern) !== -1; 341 }); 342 } 343 344 function shouldHandleFetch(input, init) { 345 if (init && (init.skipLoader === true || init.showLoader === false)) { 346 return false; 347 } 348 349 var url = ""; 350 if (typeof input === "string") { 351 url = input; 352 } else if (input && input.url) { 353 url = input.url; 354 } 355 356 return shouldHandleUrl(url); 357 } 358 359 function hasKeepLoaderFlag() { 360 try { 361 return window.sessionStorage && window.sessionStorage.getItem(keepLoaderStorageKey) === "true"; 362 } catch (error) { 363 return false; 364 } 365 } 366 367 function setKeepLoaderFlag() { 368 try { 369 if (window.sessionStorage) { 370 window.sessionStorage.setItem(keepLoaderStorageKey, "true"); 371 } 372 } catch (error) { 373 // Browsers can block sessionStorage in some privacy modes. 374 } 375 } 376 377 function clearKeepLoaderFlag() { 378 try { 379 if (window.sessionStorage) { 380 window.sessionStorage.removeItem(keepLoaderStorageKey); 381 } 382 } catch (error) { 383 // Browsers can block sessionStorage in some privacy modes. 384 } 385 } 386 387 function shouldKeepLoaderVisible() { 388 return navigationPending || hasKeepLoaderFlag(); 389 } 390 391 function showElement() { 392 var loader = getLoader(); 393 if (!loader) { 394 return; 395 } 396 397 clearTimeout(hideTimer); 398 loader.style.display = "flex"; 399 } 400 401 function hideElement(force) { 402 var loader = getLoader(); 403 if (!loader) { 404 return; 405 } 406 407 clearTimeout(hideTimer); 408 if (!force && shouldKeepLoaderVisible()) { 409 showElement(); 410 return; 411 } 412 413 hideTimer = setTimeout(function () { 414 if (force || (activeProcesses <= 0 && !shouldKeepLoaderVisible())) { 415 loader.style.display = "none"; 416 } 417 }, hideDelay); 418 } 419 420 function startProcess() { 421 activeProcesses += 1; 422 showElement(); 423 } 424 425 function stopProcess(force) { 426 if (force) { 427 activeProcesses = 0; 428 hideElement(true); 429 return; 430 } 431 432 activeProcesses = Math.max(0, activeProcesses - 1); 433 if (activeProcesses === 0) { 434 if (shouldKeepLoaderVisible()) { 435 showElement(); 436 } else { 437 hideElement(false); 438 } 439 } 440 } 441 442 function showManual() { 443 showElement(); 444 } 445 446 function hideManual() { 447 if (activeProcesses === 0 && !shouldKeepLoaderVisible()) { 448 hideElement(false); 449 } 450 } 451 452 function markNavigationPending() { 453 navigationPending = true; 454 setKeepLoaderFlag(); 455 showElement(); 456 scrollHandled = false; 457 } 458 459 function cancelNavigationPending() { 460 navigationPending = false; 461 clearKeepLoaderFlag(); 462 463 if (activeProcesses === 0) { 464 hideElement(false); 465 } 466 } 467 468 function isEventDefaultPrevented(event) { 469 return !!event && ( 470 event.defaultPrevented || 471 (typeof event.isDefaultPrevented === "function" && event.isDefaultPrevented()) 472 ); 473 } 474 475 function cancelNavigationIfPrevented(event) { 476 //window.setTimeout(function () { 477 if (isEventDefaultPrevented(event)) { 478 cancelNavigationPending(); 479 } 480 //}, 0); 481 } 482 483 function completePageLoad() { 484 clearKeepLoaderFlag(); 485 navigationPending = false; 486 487 if (activeProcesses === 0) { 488 hideElement(true); 489 } 490 } 491 492 function navigate(url, replace) { 493 if (!url) { 494 return; 495 } 496 497 markNavigationPending(); 498 //window.setTimeout(function () { 499 if (replace && window.location.replace) { 500 window.location.replace(url); 501 } else { 502 window.location.href = url; 503 } 504 //}, 0); 505 } 506 507 function isNavigationLink(link) { 508 if (!link || link.target === "_blank" || link.hasAttribute("download")) { 509 return false; 510 } 511 512 var href = link.getAttribute("href"); 513 return href && 514 href !== "#" && 515 href.indexOf("javascript:") !== 0 && 516 !link.hasAttribute("data-bs-toggle") && 517 !link.hasAttribute("data-toggle"); 518 } 519 520 function shouldSkipLoaderElement(element) { 521 if (!element) { 522 return false; 523 } 524 525 return element.classList.contains("no-loader") || 526 element.getAttribute("data-skip-loader") === "true"; 527 } 528 529 window.AppLoader = { 530 show: showManual, 531 hide: function () { 532 hideManual(); 533 }, 534 forceHide: function () { 535 activeProcesses = 0; 536 navigationPending = false; 537 clearKeepLoaderFlag(); 538 hideElement(true); 539 }, 540 forceReset: function () { 541 activeProcesses = 0; 542 navigationPending = false; 543 clearKeepLoaderFlag(); 544 hideElement(true); 545 }, 546 beginRequest: startProcess, 547 endRequest: function () { 548 stopProcess(false); 549 }, 550 markNavigationPending: markNavigationPending, 551 cancelNavigationPending: cancelNavigationPending, 552 completePageLoad: completePageLoad, 553 navigate: navigate, 554 shouldHandleAjax: shouldHandleAjax, 555 activeCount: function () { 556 return activeProcesses; 557 } 558 }; 559 560 function patchJQueryAjax() { 561 if (ajaxPatched || !$ || !$.ajax) { 562 return; 563 } 564 565 ajaxPatched = true; 566 var originalAjax = $.ajax; 567 568 $.ajax = function (url, options) { 569 var ajaxOptions = typeof url === "object" ? url : (options || {}); 570 571 if (!shouldHandleAjax(ajaxOptions)) { 572 suppressXhrTracking = true; 573 try { 574 return typeof url === "object" 575 ? originalAjax.call(this, ajaxOptions) 576 : originalAjax.call(this, url, ajaxOptions); 577 } finally { 578 suppressXhrTracking = false; 579 } 580 } 581 582 var originalComplete = ajaxOptions.complete; 583 startProcess(); 584 585 ajaxOptions.complete = function () { 586 var completeArgs = arguments; 587 try { 588 if (typeof originalComplete === "function") { 589 originalComplete.apply(this, completeArgs); 590 } else if ($.isArray && $.isArray(originalComplete)) { 591 var completeContext = this; 592 $.each(originalComplete, function (index, completeCallback) { 593 if (typeof completeCallback === "function") { 594 completeCallback.apply(completeContext, completeArgs); 595 } 596 }); 597 } 598 } finally { 599 stopProcess(false); 600 } 601 }; 602 603 try { 604 suppressXhrTracking = true; 605 return typeof url === "object" 606 ? originalAjax.call(this, ajaxOptions) 607 : originalAjax.call(this, url, ajaxOptions); 608 } catch (error) { 609 stopProcess(false); 610 throw error; 611 } finally { 612 suppressXhrTracking = false; 613 } 614 }; 615 } 616 617 function patchFetch() { 618 if (fetchPatched || typeof window.fetch !== "function") { 619 return; 620 } 621 622 fetchPatched = true; 623 var originalFetch = window.fetch; 624 window.fetch = function () { 625 var shouldTrack = shouldHandleFetch(arguments[0], arguments[1]); 626 if (shouldTrack) { 627 startProcess(); 628 } 629 630 try { 631 return originalFetch.apply(this, arguments) 632 .then(function (response) { 633 if (shouldTrack) { 634 stopProcess(false); 635 } 636 return response; 637 }) 638 .catch(function (error) { 639 if (shouldTrack) { 640 stopProcess(false); 641 } 642 throw error; 643 }); 644 } catch (error) { 645 if (shouldTrack) { 646 stopProcess(false); 647 } 648 throw error; 649 } 650 }; 651 } 652 653 function patchXmlHttpRequest() { 654 if (xhrPatched || !window.XMLHttpRequest || !window.XMLHttpRequest.prototype) { 655 return; 656 } 657 658 xhrPatched = true; 659 var originalOpen = window.XMLHttpRequest.prototype.open; 660 var originalSend = window.XMLHttpRequest.prototype.send; 661 662 window.XMLHttpRequest.prototype.open = function () { 663 this.__appLoaderUrl = arguments[1] || ""; 664 this.__appLoaderTracked = shouldHandleUrl(this.__appLoaderUrl); 665 return originalOpen.apply(this, arguments); 666 }; 667 668 window.XMLHttpRequest.prototype.send = function () { 669 var didTrack = false; 670 if (this.__appLoaderTracked && !suppressXhrTracking) { 671 didTrack = true; 672 startProcess(); 673 this.addEventListener("loadend", function () { 674 stopProcess(false); 675 }, { once: true });
676 } 677 678 try { 679 return originalSend.apply(this, arguments); 680 } catch (error) { 681 if (didTrack) { 682 stopProcess(false); 683 } 684 throw error; 685 } 686 }; 687 } 688 689 patchJQueryAjax(); 690 patchFetch(); 691 patchXmlHttpRequest(); 692 693 if (hasKeepLoaderFlag()) { 694 showElement(); 695 } 696 697 let isNavigationPending = true; 698 let scrollHandled = false; 699 700 if ($ && $.fn) { 701 $(window).on("load.appLoader pageshow.appLoader", function () { 702 completePageLoad(); 703 }); 704 705 $(window).on("pagehide.appLoader beforeunload.appLoader", function () { 706 markNavigationPending(); 707 }); 708 709 window.addEventListener("scroll", function () { 710 if (!scrollHandled && isNavigationPending) { 711 scrollHandled = true; 712 713 stopProcess(false); 714 cancelNavigationPending(); 715 } 716 }, { passive: true }); 717 718 $(document) 719 .on("submit.appLoader", "form", function (event) { 720 if (shouldSkipLoaderElement(this)) { 721 return; 722 } 723 724 markNavigationPending(); 725 cancelNavigationIfPrevented(event); 726 }) 727 .on("click.appLoader", "a", function (event) { 728 if (shouldSkipLoaderElement(this)) { 729 return; 730 } 731 732 var href = $(this).attr("href"); 733 734 // Mailto links - hide loader and skip navigation loader logic 735 if (href && href.toLowerCase().indexOf("mailto:") === 0) { 736 //setTimeout(function () { 737 $('#loader-container').hide(); 738 //}, 10); 739 return; 740 } 741 // telephone - hide loader and skip navigation loader logic 742 if (href && href.toLowerCase().indexOf("tel:") === 0) { 743 //setTimeout(function () { 744 $('#loader-container').hide(); 745 //}, 10); 746 return; 747 } 748 749 // Ctrl+Click, Cmd+Click, Middle-click 750 var isNewTabAction = 751 event.ctrlKey || 752 event.metaKey || 753 event.which === 2 || 754 event.button === 1; 755 756 // Do not show loader for new tab actions 757 if (isNewTabAction) { 758 cancelNavigationPending(); 759 return; 760 } 761 762 if (isNavigationLink(this)) { 763 markNavigationPending(); 764 cancelNavigationIfPrevented(event); 765 } 766 }); 767 //.on("click.appLoader", "a", function (event) { 768 // if (isNavigationLink(this)) { 769 // markNavigationPending(); 770 // cancelNavigationIfPrevented(event); 771 // } 772 //}); 773 } 774})(window, window.jQuery); 775 776function markNavigationPending() { 777 scrollHandled = false; 778 isNavigationPending = true; 779} 780function showLoader() { 781 window.AppLoader && window.AppLoader.show(); 782} 783 784function hideLoader() { 785 window.AppLoader && window.AppLoader.hide(); 786} 787 788function hideLoaderNew() { 789 window.AppLoader && window.AppLoader.hide(); 790} 791 792function GetUserLoginDetailsByUserID() { 793 $.ajax({
794 type: "POST", 795 url: "/MyProfile/GetUserLoginDetailsByUserID", 796 datatype: "html", 797 success: function (response) { 798 SetResponseOfPartialView("#headerAccount", response); 799 }, 800 failure: function (response) { 801 802 }, 803 error: function (response) { 804 } 805 }); 806} 807var SIndex = 1; 808var EIndex = 10; 809var pageArray = []; 810var TotalItems = 0; 811function commonCreatePagination(Total, CurrentPage, controllerName, actionName, prlId) { 812 pageArray = []; 813 TotalItems = Total; 814 if (TotalItems > 0) { 815 var totalPage = Math.ceil((TotalItems) / EIndex); 816 var _currentPage = 0; 817 818 var totalcount = totalPage; 819 var HTML = ""; 820 821 if (CurrentPage > 1) { 822 HTML += '<li class="page-item"><a class="page-link d-flex align-items-center text-decoration-none" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + "'frst'" + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');"><span class="material-symbols-sharp text-4">arrow_back_ios_new</span></a></li>'; 823 HTML += '<li class="page-item next"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + "'prev'" + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + Forrige +'</a></li>'; 824 } 825 826 for (var i = 1; i <= totalPage; i++) { 827 var itemsInPage = ""; 828 if (EIndex >= parseInt(TotalItems)) { 829 itemsInPage = i + "_" + TotalItems; 830 pageArray.push(itemsInPage); 831 _currentPage = i; 832 } 833 else { 834 var lastIndexValueArray = []; 835 if (i == 1) { 836 itemsInPage = i + "_" + EIndex; 837 pageArray.push(itemsInPage); 838 } else { 839 lastIndexValueArray = (pageArray[i - 2]).split("_"); 840 if ((parseInt(lastIndexValueArray[1]) + EIndex) >= parseInt(TotalItems)) { 841 itemsInPage = (parseInt(lastIndexValueArray[1]) + 1) + "_" + TotalItems; 842 } else { 843 itemsInPage = (parseInt(lastIndexValueArray[1]) + 1) + "_" + (parseInt(lastIndexValueArray[1]) + EIndex); 844 } 845 pageArray.push(itemsInPage); 846 } 847 lastIndexValueArray = (pageArray[i - 1]).split("_"); 848 if (parseInt(CurrentPage) >= parseInt(lastIndexValueArray[0]) && parseInt(CurrentPage) <= parseInt(lastIndexValueArray[1])) { 849 _currentPage = i; 850 } 851 } 852 } 853 854 if (totalcount <= 5) { 855 for (i = 1; i <= totalcount; i++) { 856 if (i == _currentPage) 857 HTML += '<li class="page-item active" id="current_page"><a class="page-link" href="javascript:void(0);">' + i + '</a></li>'; 858 else 859 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + i + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + i + '</a></li>'; 860 } 861 } 862 else { 863 if (_currentPage == 1) { 864 HTML += '<li class="page-item active" id="current_page"><a class="page-link" href="javascript:void(0);">' + 1 + '</a></li>'; 865 } 866 else { 867 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + 1 + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + 1 + '</a></li>'; 868 } if (_currentPage > 3) { 869 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);">' + "..." + '</a></li>'; 870 } if (_currentPage == totalcount) { 871 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage - 4) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage - 4) + '</a></li>'; 872 } if (_currentPage == totalcount) { 873 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage - 3) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage - 3) + '</a></li>'; 874 } if (_currentPage == totalcount) { 875 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage - 2) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage - 2) + '</a></li>'; 876 } if (_currentPage > 2) { 877 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage - 1) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage - 1) + '</a></li>'; 878 } if (_currentPage != 1 && _currentPage != totalcount) { 879 HTML += '<li class="page-item active" id="current_page"><a class="page-link" href="javascript:void(0);">' + _currentPage + '</a></li>'; 880 } if (_currentPage < totalcount - 1) { 881 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage + 1) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage + 1) + '</a></li>'; 882 } if (_currentPage == 1) { 883 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage + 2) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage + 2) + '</a></li>'; 884 } if (_currentPage == 1) { 885 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage + 3) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage + 3) + '</a></li>'; 886 } if (_currentPage == 1) { 887 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + (_currentPage + 4) + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + (_currentPage + 4) + '</a></li>'; 888 } if (_currentPage < totalcount - 2) { 889 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);">' + "..." + '</a></li>'; 890 } 891 if (_currentPage == totalcount) { 892 HTML += '<li class="page-item active" id="current_page"><a class="page-link" href="javascript:void(0);">' + totalcount + '</a></li>'; 893 } 894 else { 895 HTML += '<li class="page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + totalcount + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + totalcount + '</a></li>'; 896 } 897 } 898 if (_currentPage != totalcount) { 899 HTML += '<li class="next page-item"><a class="page-link" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + "'nxt'" + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');">' + Næste +'</a></li>'; 900 HTML += '<li class="page-item"><a class="page-link d-flex align-items-center text-decoration-none" href="javascript:void(0);" onclick="getCommonMenuDataByPaging(' + "'lst'" + ',\'' + controllerName + '\',\'' + actionName + '\',\'' + prlId + '\');"><span class="material-symbols-sharp text-4">arrow_forward_ios</span></a></li>'; 901 } 902 $("#render_paging").html(HTML); 903 } 904} 905function getCommonMenuDataByPaging(value, controllerName, actionName, prlId) { 906 var pageStartNum = 0, pageEndNum = 0; 907 var _currentPage = parseInt($("#current_page").text()); 908 var pageDataArr = []; 909 switch (value) { 910 case "frst": 911 pageDataArr = (pageArray[0]).split("_"); 912 pageStartNum = parseInt(pageDataArr[0]); 913 pageEndNum = parseInt(pageDataArr[1]); 914 break; 915 case "lst": 916 pageDataArr = (pageArray[(pageArray.length - 1)]).split("_"); 917 pageStartNum = parseInt(pageDataArr[0]); 918 pageEndNum = parseInt(pageDataArr[1]); 919 break; 920 case "nxt": 921 pageDataArr = (pageArray[(_currentPage)]).split("_"); 922 pageStartNum = parseInt(pageDataArr[0]); 923 pageEndNum = parseInt(pageDataArr[1]); 924 break; 925 case "prev": 926 pageDataArr = (pageArray[(_currentPage - 2)]).split("_"); 927 pageStartNum = parseInt(pageDataArr[0]); 928 pageEndNum = parseInt(pageDataArr[1]); 929 break; 930 default: 931 pageDataArr = (pageArray[(value - 1)]).split("_"); 932 pageStartNum = parseInt(pageDataArr[0]); 933 pageEndNum = parseInt(pageDataArr[1]); 934 } 935 GetSearchData(pageStartNum, pageEndNum, controllerName, actionName, prlId); 936} 937function GetSearchData(StartIndex, EndIndex, conterollerName, actionName, prlId) { 938 var setURL = "/" + conterollerName + "/" + actionName; 939 $.ajax({
940 type: "POST", 941 url: setURL, 942 data: { 943 StartIndex: StartIndex, EndIndex: EndIndex 944 }, 945 async: true, 946 datatype: "json", 947 success: function (response) { 948 CommonSetResponseOfPartialView("#" + prlId, response); 949 $("#" + prlId).css("display", "block"); 950 }, 951 failure: function (response) { 952 alert("Something went wrong"); 953 }, 954 error: function (response) { 955 alert("Something went wrong"); 956 } 957 }); 958}; 959function CommonSetResponseOfPartialView(selectorid, response) { 960 $(selectorid).html(""); 961 $(selectorid).html(response); 962} 963function CheckMobileValid(input) { 964 var value = input.value; 965 var errorSpan = document.getElementById(input.id + '_error'); 966 967 if (value !== '' && value !== undefined) { 968 // Allow values between 6 and 10 digits (inclusive) 969 if (value.length >= 6 && value.length <= 10) { 970 errorSpan.innerText = ''; // Clear the error message if valid 971 } else { 972 errorSpan.innerText = lblTelephoneVadilMsg1; // Display an error message if invalid 973 return false; 974 } 975 } else { 976 errorSpan.innerText = ''; // Clear the error message 977 } 978} 979function CheckEmailValid(emailInput) { 980 if (!isEmail(emailInput.value)) { 981 document.getElementById(emailInput.id + '_error').textContent = decodeHtmlEntities(validationEmail); 982 return false; // Return false if the email is not valid 983 } else { 984 document.getElementById(emailInput.id + '_error').textContent = ''; 985 return true; // Return true if the email is valid 986 } 987} 988function CheckCompulsoryEmailValid(emailInput) { 989 if (emailInput.value != '') { 990 if (!isEmail(emailInput.value)) { 991 document.getElementById(emailInput.id + '_error').textContent = decodeHtmlEntities(validationEmail); 992 return false; // Return false if the email is not valid 993 } else { 994 document.getElementById(emailInput.id + '_error').textContent = ''; 995 } 996 } 997 else { 998 document.getElementById(emailInput.id + '_error').textContent = decodeHtmlEntities(lblDettefelterpåkrævet); 999 } 1000} 1001function CheckWebsiteValid(WebsiteInput) { 1002 var website = $('#' + WebsiteInput.id).val(); 1003 if (website != "") { 1004 $("#" + WebsiteInput.id + "_error").html(""); 1005 if (!isUrlValid(website)) { 1006 $("#" + WebsiteInput.id + "_error").html(decodeHtmlEntities(validationURL)); 1007 return false; 1008 } 1009 } else { 1010 $("#" + WebsiteInput.id + "_error").html(""); 1011 } 1012} 1013function CheckZipCodeValid(ZipCodeInput) { 1014 var ZipCode = $('#' + ZipCodeInput.id).val(); 1015 $("#" + ZipCodeInput.id + "_error").html(""); 1016 if (ZipCode != "") { 1017 var regex = /^.{4,10}$/; 1018 if (!regex.test(ZipCode)) { 1019 event.preventDefault(); 1020 $("#" + ZipCodeInput.id + "_error").html(decodeHtmlEntities(txtzipcodeErrorMsg)); 1021 return false; 1022 } 1023 } 1024} 1025function EmailIsValid(emailInput) { 1026 if (!isEmail(emailInput)) { 1027 return false; // Return false if the email is not valid 1028 } else { 1029 return true; // Return true if the email is valid 1030 } 1031} 1032function isEmail(email) { 1033 return email.match( 1034 /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 1035 ); 1036} 1037function isUrlValid(url) { 1038 return /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url); 1039} 1040function isMobileValid(mobile) { 1041 return /^\d{6,10}$/.test(mobile); 1042} 1043function OnlyNumber(input) { 1044 // Remove non-numeric characters 1045 input.value = input.value.replace(/\D/g, ''); 1046 1047 // Limit the length to 8 digits 1048 if (input.value.length > 10) { 1049 input.value = input.value.slice(0, 10); 1050 } 1051} 1052function capitalizeFirstLetter(input) { 1053 let value = input.value; 1054 if (value) { 1055 input.value = value.charAt(0).toUpperCase() + value.slice(1).toLowerCase(); 1056 } 1057 if (value != "") { 1058 $('#' + input.id + '_error').html(''); 1059 } 1060} 1061function ChangecheckBgColor() { 1062 var tempSelectedBgColor = $("input[name='radio-group']:checked").val(); 1063 $("#edit_anonymouse_image").removeClass('bg-secondary'); 1064 $("#edit_anonymouse_image").css("background-color", tempSelectedBgColor); 1065 $("#disp_nickname").css("background-color", tempSelectedBgColor); 1066} 1067function MomentDateFormat(date) { 1068 return moment(date, "DD-MM-YYYY").format("YYYY-MM-DD"); 1069} 1070function RefreshDateTimePicker(input) { 1071 const instance = mobiscroll.getInst(document.getElementById(input)); 1072 if (instance) { 1073 instance.setVal(null, true); 1074 } 1075} 1076function toMinutes(time) { 1077 var b = time.split(':'); 1078 return b[0] * 60 + +b[1]; 1079} 1080function NumberFormatCal(num) { 1081 var str2 = "00"; 1082 var str1 = ""; 1083 if (num != "" && num != 'undefined' && num.split(",").length > 0) { 1084 if (currentCulture === 'da' || currentCulture === 'gl') { 1085 str2 = num.split(",")[1] != undefined ? num.split(",")[1] : str2;
1086 str1 = parseFloat(num).toLocaleString('en-IN').replace(/[,]+/g, ".") + ',' + str2; 1087 } else if (currentCulture === 'en') { 1088 str1 = num.replace(',', '.'); 1089 } 1090 } 1091 return str1; 1092} 1093function removeCommafy(num) { 1094 var str = num.toString(); 1095 if (currentCulture === 'da') { 1096 str = str.replace("Kr.", ""); 1097 str = str.replace(",00", ""); 1098 str = str.replace(".", "."); 1099 str = str.replace("-", ""); 1100 str = str.replace(/\./g, ''); 1101 } else if (currentCulture === 'en') { 1102 str = str.replace("Kr.", ""); 1103 str = str.replace(".00", ""); 1104 str = str.replace(".", "."); 1105 str = str.replace("-", ""); 1106 } 1107 else { 1108 str = str.replace("Kr.", ""); 1109 str = str.replace(".00", ""); 1110 str = str.replace(".", "."); 1111 str = str.replace("-", ""); 1112 } 1113 return str; 1114 //return str.split(",").join(""); 1115} 1116function OnlyNumberWithRemoveSpace($this) { 1117 var a = $($this).val(); 1118 a.split(' ').join(''); 1119 1120 $($this).val(a.replace(/\s/g, "")); 1121 while (! /^([0-9]+)?$/.test($($this).val())) { 1122 $($this).val($($this).val().slice(0, -1)); 1123 } 1124} 1125window.onerror = function (msg, url, lineNo, columnNo, error) { 1126 hideLoaderNew(); 1127 return false; // allow normal browser logging 1128};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.