1 line
3.3 KiB
JavaScript
1 line
3.3 KiB
JavaScript
|
"use strict";var KTAppTodo=function(){var t,e,i,o;return{init:function(){t=KTUtil.getById("kt_todo_aside"),e=KTUtil.getById("kt_todo_list"),i=KTUtil.getById("kt_todo_view"),o=KTUtil.getById("kt_todo_reply"),KTAppTodo.initAside(),KTAppTodo.initList(),KTAppTodo.initView(),KTAppTodo.initReply()},initAside:function(){new KTOffcanvas(t,{overlay:!0,baseClass:"offcanvas-mobile",toggleBy:"kt_subheader_mobile_toggle"}),KTUtil.on(t,'.list-item[data-action="list"]',"click",function(o){var a=KTUtil.attr(this,"data-type"),n=KTUtil.find(e,".kt-inbox__items"),l=this.closest(".kt-nav__item"),s=KTUtil.find(t,".kt-nav__item.kt-nav__item--active"),d=new KTDialog({type:"loader",placement:"top center",message:"Loading ..."});d.show(),setTimeout(function(){d.hide(),KTUtil.css(e,"display","flex"),KTUtil.css(i,"display","none"),KTUtil.addClass(l,"kt-nav__item--active"),KTUtil.removeClass(s,"kt-nav__item--active"),KTUtil.attr(n,"data-type",a)},600)})},initList:function(){KTUtil.on(e,'[data-inbox="group-select"] input',"click",function(){for(var t=KTUtil.findAll(e,'[data-inbox="message"]'),i=0,o=t.length;i<o;i++){var a=t[i];KTUtil.find(a,".checkbox input").checked=this.checked,this.checked?KTUtil.addClass(a,"active"):KTUtil.removeClass(a,"active")}}),KTUtil.on(e,'[data-inbox="message"] [data-inbox="actions"] .checkbox input',"click",function(){var t=this.closest('[data-inbox="message"]');t&&this.checked?KTUtil.addClass(t,"active"):KTUtil.removeClass(t,"active")})},initView:function(){KTUtil.on(i,'[data-inbox="back"]',"click",function(){var t=new KTDialog({type:"loader",placement:"top center",message:"Loading ..."});t.show(),setTimeout(function(){t.hide(),KTUtil.addClass(e,"d-block"),KTUtil.removeClass(e,"d-none"),KTUtil.addClass(i,"d-none"),KTUtil.removeClass(i,"d-block")},700)}),KTUtil.on(i,'[data-inbox="message"]',"click",function(t){var e=this.closest('[data-inbox="message"]'),i=KTUtil.find(this,'[data-toggle="dropdown"]'),o=KTUtil.find(this,'[data-inbox="toolbar"]');return!(t.target===i||i&&!0===i.contains(t.target))&&(!(t.target===o||o&&!0===o.contains(t.target))&&void(KTUtil.hasClass(e,"toggle-on")?(KTUtil.addClass(e,"toggle-off"),KTUtil.removeClass(e,"toggle-on")):(KTUtil.removeClass(e,"toggle-off"),KTUtil.addClass(e,"toggle-on"))))})},initReply:function(){!function(t,e){if(KTUtil.getById(e)){e=new Quill("#"+e,{modules:{toolbar:{}},placeholder:"Type message...",theme:"snow"});var i=KTUtil.find(t,".ql-toolbar");e=KTUtil.find(t,".ql-editor"),i&&KTUtil.addClass(i,"px-5 border-top-0 border-left-0 border-right-0"),e&&KTUtil.addClass(e,"px-8")}}(o,"kt_todo_reply_editor"),function(t){if(KTUtil.getById(t)){var e="#"+t,i=$(e+" .dropzone-item");i.id="";var o=i.parent(".dropzone-items").html();i.remove();var a=new Dropzone(e,{url:"https://keenthemes.com/scripts/void.php",parallelUploads:20,maxFilesize:1,previewTemplate:o,previewsContainer:e+" .dropzone-items",clickable:e+"_select"});a.on("addedfile",function(t){$(document).find(e+" .dropzone-item").css("display","")}),a.on("totaluploadprogress",function(t){document.querySelector(e+" .progress-bar").style.width=t+"%"}),a.on("sending",function(t){document.querySelector(e+" .progress-bar").style.opacity="1"}),a.on("complete",function(t){var i=e+" .dz-complete";setTimeout(function(){$(i+" .progress-bar, "+i+" .progress").css("opacity","0")},300)})}}("kt_todo_reply_attachments")}}}();jQuery(document).ready(function(){KTAppTodo.init()});
|