#5081-hotfix-sms-faltas #1250

Merged
joan merged 4 commits from #5081-hotfix-sms-faltas into master 2023-01-12 12:06:59 +00:00
5 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,7 @@
Send SMS: Enviar SMS Send SMS: Enviar SMS
Destination: Destinatario Destination: Destinatario
Message: Mensaje Message: Mensaje
SMS sent!: ¡SMS enviado! SMS sent: ¡SMS enviado!
Characters remaining: Carácteres restantes Characters remaining: Carácteres restantes
The destination can't be empty: El destinatario no puede estar vacio The destination can't be empty: El destinatario no puede estar vacio
The message can't be empty: El mensaje no puede estar vacio The message can't be empty: El mensaje no puede estar vacio

View File

@ -26,7 +26,7 @@ class Controller extends Component {
throw new Error(`The message it's too long`); throw new Error(`The message it's too long`);
this.$http.post(`Routes/sendSms`, this.sms).then(res => { this.$http.post(`Routes/sendSms`, this.sms).then(res => {
this.vnApp.showMessage(this.$t('SMS sent!')); this.vnApp.showMessage(this.$t('SMS sent'));
if (res.data) this.emit('send', {response: res.data}); if (res.data) this.emit('send', {response: res.data});
}); });

View File

@ -30,7 +30,7 @@ describe('Route', () => {
controller.onResponse(); controller.onResponse();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!'); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent');
}); });
it('should call onResponse without the destination and show an error snackbar', () => { it('should call onResponse without the destination and show an error snackbar', () => {

View File

@ -441,10 +441,11 @@
</vn-popover> </vn-popover>
<!-- SMS Dialog --> <!-- SMS Dialog -->
<vn-ticket-sms <vn-sms-dialog
vn-id="sms" vn-id="sms"
sms="$ctrl.newSMS"> sms="$ctrl.newSMS"
</vn-ticket-sms> on-send="$ctrl.onSmsSend($sms)">
</vn-sms-dialog>
<vn-confirm <vn-confirm
vn-id="delete-lines" vn-id="delete-lines"

View File

@ -389,6 +389,11 @@ class Controller extends Section {
this.$.sms.open(); this.$.sms.open();
} }
onSmsSend(sms) {
return this.$http.post(`Tickets/${this.ticket.id}/sendSms`, sms)
.then(() => this.vnApp.showSuccess(this.$t('SMS sent')));
}
/** /**
* Inserts a new instance * Inserts a new instance
*/ */