replaced most of the translate.instant for $t

This commit is contained in:
Carlos Jimenez Ruiz 2020-07-23 16:07:08 +02:00
parent 648c87e763
commit 7d5dc776c1
35 changed files with 67 additions and 67 deletions

View File

@ -192,7 +192,7 @@ export default class Autocomplete extends Field {
if (this.translateFields) {
if (this.translateFields.indexOf(this.showField) > -1)
this.input.value = this.$translate.instant(display);
this.input.value = this.$t(display);
}
}

View File

@ -276,7 +276,7 @@ export default class DropDown extends Popover {
if (this.translateFields) {
option = Object.assign({}, option);
for (let field of this.translateFields)
option[field] = this.$translate.instant(option[field]);
option[field] = this.$t(option[field]);
}
let li = this.document.createElement('li');

View File

@ -36,7 +36,7 @@ export default class Searchbar extends Component {
}
this.searchState = `${this.baseState}.index`;
this.placeholder = this.$translate.instant('Search by', {
this.placeholder = this.$t('Search by', {
module: this.baseState
});
}

View File

@ -75,7 +75,7 @@ class Controller extends Section {
this.$http.post(query, saleToAdd).then(() => {
this.$.addSales.hide();
this.$.model.refresh();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
if (this.aclService.hasAny(['salesAssistant']))
this.$state.go('claim.card.development');
@ -90,7 +90,7 @@ class Controller extends Section {
deleteClaimedSale() {
let query = `ClaimBeginnings/${this.sale.id}`;
this.$http.delete(query).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.remove(this.sale);
this.calculateTotals();
});
@ -100,7 +100,7 @@ class Controller extends Section {
let params = {id: id, quantity: claimedQuantity};
let query = `ClaimBeginnings/`;
this.$http.patch(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.calculateTotals();
});
}
@ -134,7 +134,7 @@ class Controller extends Section {
showEditPopover(event, saleClaimed) {
if (this.isEditable) {
if (!this.aclService.hasAny(['salesAssistant']))
return this.vnApp.showError(this.$translate.instant('Insuficient permisos'));
return this.vnApp.showError(this.$t('Insuficient permisos'));
this.saleClaimed = saleClaimed;
this.$.editPopover.parent = event.target;
@ -175,7 +175,7 @@ class Controller extends Section {
this.calculateTotals();
this.clearDiscount();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
}).catch(err => {
this.vnApp.showError(err.message);
});

View File

@ -50,7 +50,7 @@ class Controller extends Section {
if (res.data) {
this.client.defaultAddressFk = res.data.defaultAddressFk;
this.sortAddresses();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
}
});
}

View File

@ -5,7 +5,7 @@ class Controller extends Section {
add() {
this.$.model.insert({
clientFk: this.client.id,
name: this.$translate.instant('Phone'),
name: this.$t('Phone'),
phone: null
});
}

View File

@ -11,7 +11,7 @@ class Controller extends Section {
onSubmit() {
if (this.$.form.$invalid)
return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
return this.vnApp.showError(this.$t('Some fields are invalid'));
let query = `creditClassifications/createWithInsurance`;
let data = this.creditClassification;

View File

@ -33,7 +33,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -51,7 +51,7 @@ class Controller extends Section {
warehouseId: warehouseId,
companyId: companyId,
dmsTypeId: dmsType.id,
description: this.$translate.instant('ClientFileDescription', {
description: this.$t('ClientFileDescription', {
dmsTypeName: dmsType.name,
clientId: this.client.id,
clientName: this.client.name
@ -83,7 +83,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('client.card.dms.index');
}

View File

@ -24,7 +24,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -67,7 +67,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('client.card.dms.index');
}

View File

@ -65,7 +65,7 @@ export default class Controller extends Section {
onAcceptEt() {
const query = `Clients/${this.client.id}/addressesPropagateRe`;
return this.$http.patch(query, {isEqualizated: this.client.isEqualizated}).then(
() => this.vnApp.showMessage(this.$translate.instant('Equivalent tax spreaded'))
() => this.vnApp.showMessage(this.$t('Equivalent tax spreaded'))
);
}

View File

@ -35,11 +35,11 @@ class Controller extends Component {
throw new Error(`The town can't be empty`);
this.$http.patch(`postcodes`, this.data).then(res => {
this.vnApp.showMessage(this.$translate.instant('The postcode has been saved'));
this.vnApp.showMessage(this.$t('The postcode has been saved'));
this.emit('response', {$response: res.data});
});
} catch (e) {
this.vnApp.showError(this.$translate.instant(e.message));
this.vnApp.showError(this.$t(e.message));
return false;
}
return true;

View File

@ -53,7 +53,7 @@ class Controller extends Section {
sendSample() {
this.send(false, () => {
this.vnApp.showSuccess(this.$translate.instant('Notification sent!'));
this.vnApp.showSuccess(this.$t('Notification sent!'));
this.$state.go('client.card.sample.index');
});
}
@ -66,13 +66,13 @@ class Controller extends Section {
};
if (!params.recipient)
return this.vnApp.showError(this.$translate.instant('Email cannot be blank'));
return this.vnApp.showError(this.$t('Email cannot be blank'));
if (!sampleType)
return this.vnApp.showError(this.$translate.instant('Choose a sample'));
return this.vnApp.showError(this.$t('Choose a sample'));
if (sampleType.hasCompany && !this.clientSample.companyFk)
return this.vnApp.showError(this.$translate.instant('Choose a company'));
return this.vnApp.showError(this.$t('Choose a company'));
if (sampleType.hasCompany)
params.companyId = this.clientSample.companyFk;

View File

@ -27,12 +27,12 @@ class Controller extends Section {
throw new Error(`The message it's too long`);
this.$http.post(`Clients/${this.$params.id}/sendSms`, this.sms).then(res => {
this.vnApp.showMessage(this.$translate.instant('SMS sent!'));
this.vnApp.showMessage(this.$t('SMS sent!'));
if (res.data) this.emit('send', {response: res.data});
});
} catch (e) {
this.vnApp.showError(this.$translate.instant(e.message));
this.vnApp.showError(this.$t(e.message));
return false;
}
}

View File

@ -50,10 +50,10 @@ export default class Controller extends Section {
};
this.$http.patch(`Accounts/${this.client.id}`, account).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
});
} catch (e) {
this.vnApp.showError(this.$translate.instant(e.message));
this.vnApp.showError(this.$t(e.message));
return false;
}

View File

@ -99,7 +99,7 @@ class Controller extends Component {
agencyModeId: this.order.agencyModeFk
};
this.$http.post(`Orders/new`, params).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$state.go('order.card.catalog', {id: res.data});
});
}

View File

@ -59,7 +59,7 @@ class Controller extends Section {
let params = {priority: priority};
let query = `Tickets/${id}/`;
this.$http.patch(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.refresh();
});
}
@ -106,7 +106,7 @@ class Controller extends Section {
let params = {routeFk: null};
let query = `Tickets/${this.selectedTicket}/`;
this.$http.patch(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Ticket removed from route'));
this.vnApp.showSuccess(this.$t('Ticket removed from route'));
this.updateVolume();
});
}
@ -123,7 +123,7 @@ class Controller extends Section {
guessPriority() {
let query = `Routes/${this.$params.id}/guessPriority/`;
this.$http.get(query).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Order changed'));
this.vnApp.showSuccess(this.$t('Order changed'));
this.$.model.refresh();
});
}
@ -159,7 +159,7 @@ class Controller extends Section {
if (matches && matches.length)
this.insert(matches[1]);
else
this.vnApp.showError(this.$translate.instant('Ticket not found'));
this.vnApp.showError(this.$t('Ticket not found'));
}
if (!isNaN(ticketId))
@ -169,12 +169,12 @@ class Controller extends Section {
insert(id) {
const params = {routeFk: this.route.id};
this.$http.patch(`Tickets/${id}`, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.refresh();
this.card.reload();
}).catch(error => {
if (error.status == 404)
return this.vnApp.showError(this.$translate.instant('Ticket not found'));
return this.vnApp.showError(this.$t('Ticket not found'));
throw error;
});
}

View File

@ -173,7 +173,7 @@ class Controller extends Component {
async onStepChange() {
if (this.isFormInvalid()) {
return this.vnApp.showError(
this.$translate.instant('Some fields are invalid')
this.$t('Some fields are invalid')
);
}
@ -193,7 +193,7 @@ class Controller extends Component {
return true;
}, err => {
this.vnApp.showError(
this.$translate.instant(err.data.error.message)
this.$t(err.data.error.message)
);
});
}
@ -211,7 +211,7 @@ class Controller extends Component {
this.ticket.shipped = params.shipped;
} else {
return this.vnApp.showError(
this.$translate.instant(`No delivery zone available for this landing date`)
this.$t(`No delivery zone available for this landing date`)
);
}
});
@ -230,7 +230,7 @@ class Controller extends Component {
this.ticket.shipped = res.data.shipped;
} else {
return this.vnApp.showError(
this.$translate.instant(`No delivery zone available for this landing date`)
this.$t(`No delivery zone available for this landing date`)
);
}
});

View File

@ -63,7 +63,7 @@ class Controller extends Component {
onSubmit() {
if (!this.ticket.option) {
return this.vnApp.showError(
this.$translate.instant('Choose an option')
this.$t('Choose an option')
);
}
@ -83,7 +83,7 @@ class Controller extends Component {
this.$http.post(query, params).then(res => {
this.vnApp.showMessage(
this.$translate.instant(`The ticket has been unrouted`)
this.$t(`The ticket has been unrouted`)
);
this.card.reload();
this.$state.go('ticket.card.summary', {id: this.$params.id});

View File

@ -120,7 +120,7 @@ class Controller extends Component {
warehouseId: this.ticket.warehouseFk,
};
this.$http.post(`Tickets/new`, params).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$state.go('ticket.card.summary', {id: res.data.id});
});
}

View File

@ -8,7 +8,7 @@ class Controller extends Component {
this.$http.post(`Stowaways/`, params)
.then(() => this.cardReload())
.then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.dialog.hide();
});
}

View File

@ -32,7 +32,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -49,7 +49,7 @@ class Controller extends Section {
warehouseId: warehouseId,
companyId: this.ticket.companyFk,
dmsTypeId: dmsTypeId,
description: this.$translate.instant('FileDescription', {
description: this.$t('FileDescription', {
ticketId: this.ticket.id,
clientId: this.ticket.client.id,
clientName: this.ticket.client.name
@ -81,7 +81,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('ticket.card.dms.index');
}

View File

@ -23,7 +23,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -66,7 +66,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('ticket.card.dms.index');
}

View File

@ -61,7 +61,7 @@
<vn-icon
ng-show="ticket.risk"
class="bright"
vn-tooltip="{{::$ctrl.$translate.instant('Risk')}}: {{ticket.risk}}"
vn-tooltip="{{::$ctrl.$t('Risk')}}: {{ticket.risk}}"
icon="icon-risk">
</vn-icon>
</vn-td>

View File

@ -281,7 +281,7 @@ class Controller extends Section {
const params = {salesIds: saleIds, newDiscount: this.edit.discount};
const query = `Tickets/${this.$params.id}/updateDiscount`;
this.$http.post(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
for (let sale of sales)
sale.discount = this.edit.discount;

View File

@ -27,12 +27,12 @@ class Controller extends Component {
throw new Error(`The message it's too long`);
this.$http.post(`Tickets/${this.$params.id}/sendSms`, this.sms).then(res => {
this.vnApp.showMessage(this.$translate.instant('SMS sent!'));
this.vnApp.showMessage(this.$t('SMS sent!'));
if (res.data) this.emit('send', {response: res.data});
});
} catch (e) {
this.vnApp.showError(this.$translate.instant(e.message));
this.vnApp.showError(this.$t(e.message));
return false;
}
}

View File

@ -108,7 +108,7 @@
<vn-icon
ng-show="sale.claimBeginning.claimFk"
icon="icon-claims"
vn-tooltip="{{::$ctrl.$translate.instant('Claim')}}: {{::sale.claimBeginning.claimFk}}">
vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}">
</vn-icon>
</a>
<vn-icon

View File

@ -54,7 +54,7 @@ class Controller extends Section {
params.code = 'OK';
this.$http.post(`TicketTrackings/changeState`, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
if (this.card)
this.card.reload();
else

View File

@ -56,7 +56,7 @@ class Controller extends Section {
this.$http.post(`TicketTrackings/changeState`, this.params).then(() => {
this.$.watcher.updateOriginalData();
this.card.reload();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$state.go('ticket.card.tracking.index');
});
}

View File

@ -67,7 +67,7 @@ describe('Ticket', () => {
expect(controller.card.reload).toHaveBeenCalledWith();
expect(controller.$.watcher.updateOriginalData).toHaveBeenCalledWith();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith(controller.$translate.instant('Data saved!'));
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith(controller.$t('Data saved!'));
expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.tracking.index');
});
});

View File

@ -28,7 +28,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -46,7 +46,7 @@ class Controller extends Section {
warehouseId: warehouseId,
companyId: companyId,
dmsTypeId: dmsTypeId,
description: this.$translate.instant('FileDescription', {
description: this.$t('FileDescription', {
travelId: this.travel.id
}).toUpperCase()
};
@ -97,7 +97,7 @@ class Controller extends Section {
data: this.dms.files
};
this.$http(options).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('travel.card.thermograph.index');
});

View File

@ -24,7 +24,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -71,7 +71,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('travel.card.thermograph.index');
}

View File

@ -26,7 +26,7 @@ class Controller extends Section {
const thermographId = data[this.thermographIndex].id;
const query = `Travels/deleteThermograph?id=${thermographId}`;
this.$http.delete(query).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Thermograph deleted'));
this.vnApp.showSuccess(this.$t('Thermograph deleted'));
this.$.model.remove(this.thermographIndex);
this.thermographIndex = null;
});

View File

@ -58,7 +58,7 @@ class Controller extends Section {
this.$.treeview.create(item);
});
} catch (e) {
this.vnApp.showError(this.$translate.instant(e.message));
this.vnApp.showError(this.$t(e.message));
return false;
}
}

View File

@ -33,7 +33,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -51,7 +51,7 @@ class Controller extends Section {
warehouseId: warehouseId,
companyId: companyId,
dmsTypeId: dmsType.id,
description: this.$translate.instant('WorkerFileDescription', {
description: this.$t('WorkerFileDescription', {
dmsTypeName: dmsType.name,
workerId: this.worker.id,
workerName: this.worker.name
@ -83,7 +83,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('worker.card.dms.index');
}

View File

@ -24,7 +24,7 @@ class Controller extends Section {
}
get contentTypesInfo() {
return this.$translate.instant('ContentTypesInfo', {
return this.$t('ContentTypesInfo', {
allowedContentTypes: this.allowedContentTypes
});
}
@ -67,7 +67,7 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.watcher.updateOriginalData();
this.$state.go('worker.card.dms.index');
}