requested changes refs #4791 @1h
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2022-11-22 07:59:18 +01:00
parent 153f5f56fa
commit 4bd643143b
4 changed files with 23 additions and 18 deletions

View File

@ -1,18 +1,20 @@
import ngModule from '../../module';
import './style.scss';
import Dialog from '../dialog';
export default class sendSmsDialog {
export default class sendSmsDialog extends Dialog {
constructor($element, $scope, $http, $translate, vnApp) {
this.$element = $element;
this.$scope = $scope;
this.$http = $http;
this.$t = $translate;
this.vnApp = vnApp;
}
super($element, $scope, $http, $translate, vnApp);
open(route) {
this.route = route;
this.$scope.SMSDialog.show();
new CustomEvent('openSmsDialog', {
detail: {
this: this
}
});
document.addEventListener('openSmsDialog', e => {
this.route = e.detail.route;
this.$.SMSDialog.show();
});
}
charactersRemaining() {
@ -31,18 +33,16 @@ export default class sendSmsDialog {
throw new Error(`The message it's too long`);
this.$http.post(this.route, this.sms).then(res => {
this.vnApp.showMessage(this.$t.instant('SMS sent!'));
this.vnApp.showMessage(this.$t('SMS sent!'));
});
} catch (e) {
this.vnApp.showError(this.$t.instant(e.message));
this.vnApp.showError(this.$t(e.message));
return false;
}
return true;
}
}
sendSmsDialog.$inject = ['$element', '$scope', '$http', '$translate', 'vnApp'];
ngModule.vnComponent('vnSmsDialog', {
template: require('./index.html'),
controller: sendSmsDialog,

View File

@ -114,8 +114,8 @@
</slot-body>
</vn-descriptor-content>
<vn-sms-dialog
vn-id="sms"
sms="$ctrl.newSMS">
vn-id="sms"
sms="$ctrl.newSMS">
</vn-sms-dialog>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">

View File

@ -40,7 +40,9 @@ class Controller extends Descriptor {
const route = `Clients/${this.id}/sendSms`;
this.$.sms.open(route);
document.dispatchEvent(new CustomEvent('openSmsDialog', {
detail: {route}
}));
}
}

View File

@ -239,7 +239,10 @@ class Controller extends Section {
destinationFk: this.ticket.clientFk,
destination: phone
}, params);
this.$.sms.open(route);
document.dispatchEvent(new CustomEvent('openSmsDialog', {
detail: {route}
}));
}
makeInvoice() {