2019-03-29 06:29:09 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Component from 'core/lib/component';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
class Controller extends Component {
|
|
|
|
constructor($element, $scope, $http, $translate, vnApp) {
|
|
|
|
super($element, $scope);
|
|
|
|
|
|
|
|
this.$scope = $scope;
|
|
|
|
this.$http = $http;
|
|
|
|
this.$translate = $translate;
|
|
|
|
this.vnApp = vnApp;
|
|
|
|
}
|
|
|
|
|
|
|
|
open() {
|
|
|
|
this.$scope.SMSDialog.show();
|
|
|
|
}
|
|
|
|
|
2020-01-14 08:10:54 +00:00
|
|
|
charactersRemaining() {
|
|
|
|
let elementMaxLength;
|
|
|
|
let textAreaLength;
|
|
|
|
const element = this.$scope.message;
|
|
|
|
|
|
|
|
textAreaLength = element.input.textLength;
|
|
|
|
elementMaxLength = element.maxlength;
|
|
|
|
return elementMaxLength - textAreaLength;
|
|
|
|
}
|
|
|
|
|
2019-03-29 06:29:09 +00:00
|
|
|
onResponse(response) {
|
2019-10-30 15:57:14 +00:00
|
|
|
if (response === 'accept') {
|
2019-10-24 22:53:53 +00:00
|
|
|
this.$http.post(`Sms/send`, this.sms).then(res => {
|
2019-03-29 06:29:09 +00:00
|
|
|
this.vnApp.showMessage(this.$translate.instant('SMS sent!'));
|
|
|
|
|
|
|
|
if (res.data) this.emit('send', {response: res.data});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$element', '$scope', '$http', '$translate', 'vnApp'];
|
|
|
|
|
|
|
|
ngModule.component('vnClientSms', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
sms: '<',
|
|
|
|
}
|
|
|
|
});
|