1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +00:00
ocsms/js/app.min.js
2018-11-11 14:21:48 +01:00

1 line
1.2 KiB
JavaScript

var SmsSettings=new Vue({el:"#app-settings",data:{messageLimit:100,enableNotifications:!0,contactOrderBy:"lastmsg",reverseContactOrder:!0,country:""},created:function(){var t=this;$.getJSON(Sms.generateURL("/front-api/v1/settings"),function(e,n){!0===e.status&&(t.messageLimit=parseInt(e.message_limit),t.enableNotifications=0!==parseInt(e.notification_state)?1:0,t.contactOrderBy=e.contact_order,t.reverseContactOrder=toBool(e.contact_order_reverse),t.country=e.country)})},methods:{sendMessageLimit:function(){if(null!==this.messageLimit){$.post(Sms.generateURL("/set/msglimit"),{limit:this.messageLimit})}},sendNotificationFlag:function(){$.post(Sms.generateURL("/set/notification_state"),{notification:parseInt(this.enableNotifications)})},sendContactOrder:function(){$.post(Sms.generateURL("/set/contact_order"),{attribute:this.contactOrderBy,reverse:this.reverseContactOrder})},sendCountry:function(){$.post(Sms.generateURL("/set/country"),{country:this.country})},wipeAllMessages:function(){$.post(Sms.generateURL("/front-api/v1/delete/all"),{},function(){ContactList.reset(),Conversation.clear()})},isContactListEmpty:function(){return 0===ContactList.contacts.length}}});