Delete sendsms from core/components
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
ace153996a
commit
9ed9c1a82c
|
@ -1,45 +0,0 @@
|
||||||
<vn-dialog
|
|
||||||
vn-id="SMSDialog"
|
|
||||||
on-accept="$ctrl.onResponse()">
|
|
||||||
<tpl-body>
|
|
||||||
<section class="SMSDialog">
|
|
||||||
<h5 class="vn-py-sm" translate>Send SMS</h5>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-textfield
|
|
||||||
vn-one
|
|
||||||
label="Destination"
|
|
||||||
ng-model="$ctrl.sms.destination"
|
|
||||||
required="true"
|
|
||||||
rule>
|
|
||||||
</vn-textfield>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-textarea vn-one
|
|
||||||
vn-id="message"
|
|
||||||
label="Message"
|
|
||||||
ng-model="$ctrl.sms.message"
|
|
||||||
info="Special characters like accents counts as a multiple"
|
|
||||||
rows="5"
|
|
||||||
required="true"
|
|
||||||
rule>
|
|
||||||
</vn-textarea>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<span>
|
|
||||||
{{'Characters remaining' | translate}}:
|
|
||||||
<vn-chip translate-attr="{title: 'Packing'}" ng-class="{
|
|
||||||
'colored': $ctrl.charactersRemaining() > 25,
|
|
||||||
'warning': $ctrl.charactersRemaining() <= 25,
|
|
||||||
'alert': $ctrl.charactersRemaining() < 0,
|
|
||||||
}">
|
|
||||||
{{$ctrl.charactersRemaining()}}
|
|
||||||
</vn-chip>
|
|
||||||
</span>
|
|
||||||
</vn-horizontal>
|
|
||||||
</section>
|
|
||||||
</tpl-body>
|
|
||||||
<tpl-buttons>
|
|
||||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
|
||||||
<button response="accept" translate>Send</button>
|
|
||||||
</tpl-buttons>
|
|
||||||
</vn-dialog>
|
|
|
@ -1,52 +0,0 @@
|
||||||
import ngModule from '../../module';
|
|
||||||
import './style.scss';
|
|
||||||
import Dialog from '../dialog';
|
|
||||||
|
|
||||||
export default class sendSmsDialog extends Dialog {
|
|
||||||
constructor($element, $scope, $http, $translate, vnApp) {
|
|
||||||
super($element, $scope, $http, $translate, vnApp);
|
|
||||||
|
|
||||||
new CustomEvent('openSmsDialog', {
|
|
||||||
detail: {
|
|
||||||
this: this
|
|
||||||
}
|
|
||||||
});
|
|
||||||
document.addEventListener('openSmsDialog', e => {
|
|
||||||
this.route = e.detail.route;
|
|
||||||
this.$.SMSDialog.show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
charactersRemaining() {
|
|
||||||
const element = this.sms.message;
|
|
||||||
const maxLength = 160;
|
|
||||||
return maxLength - element.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
onResponse() {
|
|
||||||
try {
|
|
||||||
if (!this.sms.destination)
|
|
||||||
throw new Error(`The destination can't be empty`);
|
|
||||||
if (!this.sms.message)
|
|
||||||
throw new Error(`The message can't be empty`);
|
|
||||||
if (this.charactersRemaining() < 0)
|
|
||||||
throw new Error(`The message it's too long`);
|
|
||||||
|
|
||||||
this.$http.post(this.route, this.sms).then(res => {
|
|
||||||
this.vnApp.showMessage(this.$t('SMS sent!'));
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
this.vnApp.showError(this.$t(e.message));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngModule.vnComponent('vnSmsDialog', {
|
|
||||||
template: require('./index.html'),
|
|
||||||
controller: sendSmsDialog,
|
|
||||||
bindings: {
|
|
||||||
sms: '<',
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,9 +0,0 @@
|
||||||
Send SMS: Enviar SMS
|
|
||||||
Destination: Destinatario
|
|
||||||
Message: Mensaje
|
|
||||||
SMS sent!: ¡SMS enviado!
|
|
||||||
Characters remaining: Carácteres restantes
|
|
||||||
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 it's too long: El mensaje es demasiado largo
|
|
||||||
Special characters like accents counts as a multiple: Carácteres especiales como los acentos cuentan como varios
|
|
|
@ -1,5 +0,0 @@
|
||||||
@import "variables";
|
|
||||||
|
|
||||||
.SMSDialog {
|
|
||||||
min-width: 400px
|
|
||||||
}
|
|
Loading…
Reference in New Issue