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

View File

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

View File

@ -40,7 +40,9 @@ class Controller extends Descriptor {
const route = `Clients/${this.id}/sendSms`; 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, destinationFk: this.ticket.clientFk,
destination: phone destination: phone
}, params); }, params);
this.$.sms.open(route);
document.dispatchEvent(new CustomEvent('openSmsDialog', {
detail: {route}
}));
} }
makeInvoice() { makeInvoice() {