You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
6.7 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <script src="/assets/node_modules/datatable/jQuery-3.7.0/jquery-3.7.0.min.js"></script>
  2. <script src="/assets/node_modules/popper.js/dist/umd/popper.min.js"></script>
  3. <script src="/assets/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
  4. <script src="/assets/node_modules/perfect-scrollbar/dist/perfect-scrollbar.min.js"></script>
  5. <script src="/assets/node_modules/screenfull/dist/screenfull.js"></script>
  6. <script src="/assets/node_modules/moment/moment.js"></script>
  7. <script src="/assets/node_modules/sweetalert2/sweetalert2.min.js"></script>
  8. <script src="/assets/node_modules/datatable/JSZip-3.10.1/jszip.min.js"></script>
  9. <script src="/assets/node_modules/datatable/pdfmake-0.2.7/pdfmake.min.js"></script>
  10. <script src="/assets/node_modules/datatable/pdfmake-0.2.7/vfs_fonts.js"></script>
  11. <script src="/assets/node_modules/datatable/DataTables-1.13.6/js/jquery.dataTables.min.js"></script>
  12. <script src="/assets/node_modules/datatable/AutoFill-2.6.0/js/dataTables.autoFill.min.js"></script>
  13. <script src="/assets/node_modules/datatable/Buttons-2.4.1/js/dataTables.buttons.min.js"></script>
  14. <script src="/assets/node_modules/datatable/Buttons-2.4.1/js/buttons.bootstrap4.min.js"></script>
  15. <script src="/assets/node_modules/datatable/Buttons-2.4.1/js/buttons.colVis.min.js"></script>
  16. <script src="/assets/node_modules/datatable/Buttons-2.4.1/js/buttons.html5.min.js"></script>
  17. <script src="/assets/node_modules/datatable/Buttons-2.4.1/js/buttons.print.min.js"></script>
  18. <script src="/assets/node_modules/datatable/ColReorder-1.7.0/js/dataTables.colReorder.min.js"></script>
  19. <script src="/assets/node_modules/datatable/DateTime-1.5.1/js/dataTables.dateTime.min.js"></script>
  20. <script src="/assets/node_modules/datatable/FixedColumns-4.3.0/js/dataTables.fixedColumns.min.js"></script>
  21. <script src="/assets/node_modules/datatable/FixedHeader-3.4.0/js/dataTables.fixedHeader.min.js"></script>
  22. <script src="/assets/node_modules/datatable/KeyTable-2.10.0/js/dataTables.keyTable.min.js"></script>
  23. <script src="/assets/node_modules/datatable/Responsive-2.5.0/js/dataTables.responsive.min.js"></script>
  24. <script src="/assets/node_modules/datatable/RowGroup-1.4.0/js/dataTables.rowGroup.min.js"></script>
  25. <script src="/assets/node_modules/datatable/RowReorder-1.4.1/js/dataTables.rowReorder.min.js"></script>
  26. <script src="/assets/node_modules/datatable/Scroller-2.2.0/js/dataTables.scroller.min.js"></script>
  27. <script src="/assets/node_modules/datatable/SearchBuilder-1.5.0/js/dataTables.searchBuilder.min.js"></script>
  28. <script src="/assets/node_modules/datatable/SearchPanes-2.2.0/js/dataTables.searchPanes.min.js"></script>
  29. <script src="/assets/node_modules/datatable/Select-1.7.0/js/dataTables.select.min.js"></script>
  30. <script src="/assets/node_modules/datatable/StateRestore-1.3.0/js/dataTables.stateRestore.min.js"></script>
  31. <script src="/assets/dist/js/theme.js"></script>
  32. <script>
  33. // Get the current page URL path
  34. var currentPagePath = window.location.pathname;
  35. // Remove the leading slash from the current page URL path
  36. currentPagePath = currentPagePath.substr(1);
  37. //alert(currentPagePath);
  38. // Get the parent menu item and the sub-menu item based on the current page URL path
  39. var parentMenuItem = document.querySelector('.nav-item.has-sub');
  40. var subMenuItem = document.querySelector('.submenu-content .menu-item[href="' + currentPagePath + '"]');
  41. // Add the "active" class to the parent menu item and its associated sub-menu item
  42. if (parentMenuItem && subMenuItem) {
  43. parentMenuItem.classList.add('active', 'open');
  44. subMenuItem.classList.add('active');
  45. }
  46. </script>
  47. -->
  48. <script>
  49. $(document).ready(function() {
  50. var currentPagePath = window.location.pathname;
  51. currentPagePath = "/"+currentPagePath.substr(1);
  52. // Set active class for parent menu items
  53. $('.nav-item').each(function() {
  54. var link = $(this).find('a').attr('href');
  55. //console.log(link +" == "+ currentPagePath);
  56. if (link === currentPagePath || link === currentPagePath) {
  57. $(this).addClass('active');
  58. $(this).parents('.has-sub').addClass('active open');
  59. }
  60. });
  61. // Set active class for submenu items
  62. $('.submenu-content .menu-item').each(function() {
  63. var link = $(this).attr('href');
  64. if (link === currentPagePath || link === currentPagePath) {
  65. $(this).addClass('active');
  66. $(this).parents('.has-sub').addClass('active open');
  67. }
  68. });
  69. $(document).ready(function(){
  70. $('[data-toggle="popover"]').popover();
  71. });
  72. });
  73. function call_loading(div,action){
  74. var divID="#"+div;
  75. var loadingimage= `<center><img src="/assets/images/loading.svg" style="opacity: 1; visibility: visible; height:40px;"></center>`;
  76. if(action=='start'){
  77. $(divID).html(loadingimage)
  78. }
  79. }
  80. // Date format
  81. function convertdate(date_txt){
  82. var datetxt = date_txt;
  83. var date = new Date(datetxt);
  84. // Extract the date components
  85. var day = date.getDate();
  86. var month = date.getMonth() + 1; // Month starts from 0, so add 1
  87. var year = date.getFullYear();
  88. // Extract the time components
  89. var hours = date.getHours();
  90. var minutes = date.getMinutes();
  91. // Determine if it's AM or PM
  92. var period = hours >= 12 ? 'PM' : 'AM';
  93. // Adjust the hours to 12-hour format
  94. hours = hours % 12;
  95. hours = hours ? hours : 12; // Handle the case when hours is 0
  96. // Format the date and time string
  97. //var formattedDate = `${day}/${month}/${year}`;
  98. //var formattedTime = `${hours}:${minutes.toString().padStart(2, '0')} ${period}`;
  99. // Format the date and time strings
  100. var formattedDate = `${day.toString().padStart(2, '0')}-${month.toString().padStart(2, '0')}-${year}`;
  101. var formattedTime = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')} ${period}`;
  102. // Concatenate the formatted date and time
  103. var formattedDateTime = `${formattedDate} ${formattedTime}`;
  104. return formattedDateTime;
  105. }
  106. function date_difference(fromdate,todate,type='time'){
  107. // Parse the date strings into moment objects with the specified format
  108. var startDate = moment(fromdate, 'DD-MM-YYYY hh:mm A');
  109. var endDate = moment(todate, 'DD-MM-YYYY hh:mm A');
  110. // Calculate the difference in days
  111. var daysDifference = endDate.diff(startDate, 'days');
  112. // Calculate the remaining time components (hours, minutes)
  113. var duration = moment.duration(endDate - startDate);
  114. var hoursDifference = duration.hours();
  115. var minutesDifference = duration.minutes();
  116. // Display the result
  117. if(type=='days'){
  118. return daysDifference + ' days';
  119. }else{
  120. return (hoursDifference) + ' hours and ' + (minutesDifference) + ' minutes';
  121. }
  122. }
  123. </script>
  124. <!--
  125. <script th:inline="javascript">
  126. function logout() {
  127. fetch(/*[[ @{/logout} ]]*/"", { method: 'POST' })
  128. .then(() => window.location.href = /*[[ @{/login} ]]*/"")
  129. .catch(error => console.error('Error logging out:', error));
  130. }
  131. </script>
  132. -->