Merge branch '1875-send-sms-dialog' of verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat Exposito 2019-11-21 13:13:05 +00:00 committed by Gitea
commit 9f345fe244
5 changed files with 35 additions and 11 deletions

View File

@ -67,4 +67,7 @@
links="$ctrl.quicklinks">
</vn-quick-links>
</div>
</div>
</div>
<!-- SMS Dialog -->
<vn-client-sms vn-id="sms" sms="$ctrl.newSMS"></vn-client-sms>
<!-- SMS Dialog -->

View File

@ -1,11 +1,13 @@
import ngModule from '../module';
import Component from 'core/lib/component';
class Controller extends Component {
constructor($element, $) {
super($element, $);
class Controller {
constructor($http, $state) {
this.$state = $state;
this.$http = $http;
this.moreOptions = [
{callback: this.newTicket, name: 'Simple ticket'}
{name: 'Simple ticket', callback: this.newTicket},
{name: 'Send SMS', callback: this.showSMSDialog},
];
}
@ -22,6 +24,9 @@ class Controller {
if (!value) return;
if (this.$params.sendSMS)
this.showSMSDialog();
this._quicklinks = {
btnOne: {
icon: 'icon-ticket',
@ -47,9 +52,20 @@ class Controller {
newTicket() {
this.$state.go('ticket.create', {clientFk: this.client.id});
}
showSMSDialog() {
const phone = this.$params.phone || this.client.phone;
const message = this.$params.message || '';
this.newSMS = {
destinationFk: this.client.id,
destination: phone,
message: message
};
this.$.sms.open();
}
}
Controller.$inject = ['$http', '$state'];
Controller.$inject = ['$element', '$scope'];
ngModule.component('vnClientDescriptor', {
template: require('./index.html'),

View File

@ -56,7 +56,7 @@
"component": "vn-client-create",
"description": "New client"
}, {
"url": "/:id",
"url": "/:id?sendSMS&phone&message",
"state": "client.card",
"abstract": true,
"component": "vn-client-card"

View File

@ -166,6 +166,9 @@ class Controller extends Component {
if (!value) return;
if (this.$params.sendSMS)
this.showSMSDialog();
this.canStowaway();
let links = {
@ -227,10 +230,12 @@ class Controller extends Component {
showSMSDialog() {
const address = this.ticket.address;
const phone = this.$params.phone || address.mobile;
const message = this.$params.message || this.$translate.instant('SMSPayment');
this.newSMS = {
destinationFk: this.ticket.clientFk,
destination: address.mobile || null,
message: this.$translate.instant('SMSPayment')
destination: phone,
message: message
};
this.$.sms.open();
}

View File

@ -43,7 +43,7 @@
"component": "vn-ticket-index",
"description": "Tickets"
}, {
"url": "/:id",
"url": "/:id?sendSMS&phone&message",
"state": "ticket.card",
"abstract": true,
"component": "vn-ticket-card"