New-OMIS/public/assets/js/pages/mailbox.init.js

1 line
14 KiB
JavaScript
Raw Permalink Normal View History

2024-04-04 07:23:00 +00:00
var url="assets/json/",allmaillist="";const loader=document.querySelector("#elmLoader");var getJSON=function(e,t){var a=new XMLHttpRequest;a.open("GET",url+e,!0),a.responseType="json",a.onload=function(){var e=a.status;200===e?(document.getElementById("elmLoader").innerHTML="",t(null,a.response)):t(e,a.response)},a.send()};function loadMailData(e){document.querySelector('#mail-filter-navlist button[data-bs-target="#pills-primary"]').click(),document.querySelector("#mail-list").innerHTML="",Array.from(e).forEach(function(e,t){var a=e.readed?"":"unread",l=e.starred?"active":"",c=e.counted?"("+e.counted+")":"";document.querySelector("#mail-list").innerHTML+='<li class="'+a+'"> <div class="col-mail col-mail-1"> <div class="form-check checkbox-wrapper-mail fs-14"> <input class="form-check-input" type="checkbox" value="'+e.id+'" id="checkbox-'+e.id+'"> <label class="form-check-label" for="checkbox-'+e.id+'"></label> </div> <input type="hidden" value='+e.userImg+' class="mail-userimg" /> <button type="button" class="btn avatar-xs p-0 favourite-btn fs-15 '+l+'"> <i class="ri-star-fill"></i> </button> <a href="javascript: void(0);" class="title"><span class="title-name">'+e.name+"</span> "+c+'</a> </div> <div class="col-mail col-mail-2"> <a href="javascript: void(0);" class="subject"><span class="subject-title">'+e.title+'</span> <span class="teaser">'+e.description+'</span> </a> <div class="date">'+e.date+"</div> </div> </li>",favouriteBtn(),emailDetailShow(),emailDetailChange(),checkBoxAll()})}function loadSocialMailData(e){Array.from(e).forEach(function(e,t){var a=e.readed?"":"unread",l=e.starred?"active":"",c=e.counted?"("+e.counted+")":"";document.getElementById("social-mail-list").innerHTML+='<li class="'+a+'"> <div class="col-mail col-mail-1"> <div class="form-check checkbox-wrapper-mail fs-14"> <input class="form-check-input" type="checkbox" value="'+e.id+'" id="checkbox-'+e.id+'"> <label class="form-check-label" for="checkbox-'+e.id+'"></label> </div> <input type="hidden" value='+e.userImg+' class="mail-userimg" /> <button type="button" class="btn avatar-xs p-0 favourite-btn fs-15 '+l+'"> <i class="ri-star-fill"></i> </button> <a href="javascript: void(0);" class="title"><span class="title-name">'+e.name+"</span> "+c+'</a> </div> <div class="col-mail col-mail-2"> <a href="javascript: void(0);" class="subject"><span class="subject-title">'+e.title+'</span> <span class="teaser">'+e.description+'</span> </a> <div class="date">'+e.date+"</div> </div> </li>",emailDetailShow(),emailDetailChange(),checkBoxAll()})}function loadPromotionsMailData(e){Array.from(e).forEach(function(e,t){var a=e.readed?"":"unread",l=e.starred?"active":"",c=e.counted?"("+e.counted+")":"";document.getElementById("promotions-mail-list").innerHTML+='<li class="'+a+'"> <div class="col-mail col-mail-1"> <div class="form-check checkbox-wrapper-mail fs-14"> <input class="form-check-input" type="checkbox" value="'+e.id+'" id="checkbox-'+e.id+'"> <label class="form-check-label" for="checkbox-'+e.id+'"></label> </div> <input type="hidden" value='+e.userImg+' class="mail-userimg" /> <button type="button" class="btn avatar-xs p-0 favourite-btn fs-15 '+l+'"> <i class="ri-star-fill"></i> </button> <a href="javascript: void(0);" class="title"><span class="title-name">'+e.name+"</span> "+c+'</a> </div> <div class="col-mail col-mail-2"> <a href="javas