Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Joan Sanchez 2018-08-03 07:52:44 +02:00
commit 901398cfa7
10 changed files with 44 additions and 50 deletions

View File

@ -1,4 +1,4 @@
<button type="{{::$ctrl.type}}" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" ng-click="$ctrl.onClick()">
<button type="{{::$ctrl.type}}" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
<span translate>{{$ctrl.label}}</span>
<vn-icon
icon="{{::$ctrl.icon}}"

View File

@ -16,8 +16,7 @@ ngModule.component('vnButton', {
bindings: {
label: '@?',
disabled: '<?',
icon: '@?',
onClick: '&'
icon: '@?'
}
});

View File

@ -22,34 +22,18 @@ export default class Textfield extends Input {
this.rightIcons = tClone[0];
}, null, 'rightIcons');
}
this.input.addEventListener('keyup', e => {
if (e.key == "Escape") {
this._cancel();
this.input.blur();
}
});
this.input.addEventListener('focus', () => this.saveOldValue());
this.input.addEventListener('keyup', e => {
if (e.key == "Enter") {
this._accept();
this.input.addEventListener('change', e => {
if (this.onChange) {
this.onChange();
}
});
}
_accept() {
if (this.accept) {
this.input.blur();
this.accept();
}
}
_cancel() {
this.input.blur();
this.input.value = this.oldValue;
this.value = this.input.value;
this.$.$apply();
if (this.cancel) {
this.cancel();
}
}
saveOldValue() {
this.oldValue = this.input.value;
}
@ -111,8 +95,7 @@ ngModule.component('vnTextfield', {
rule: '@?',
type: '@?',
vnTabIndex: '@?',
accept: '&',
cancel: '&',
unclearable: '<?'
unclearable: '<?',
onChange: '&'
}
});

View File

@ -19,6 +19,7 @@ input[type=reset]::-moz-focus-inner
}
.link{
text-decoration: underline;
cursor: pointer;
&:hover{
color: $main-01!important;
}

View File

@ -6,7 +6,7 @@
label="Discount"
model="$ctrl.newDiscount"
type="text"
accept="$ctrl.updateDiscount()">
on-change="$ctrl.updateDiscount()">
<t-right-icons>
<span class="filter">%</span>
</t-right-icons>

View File

@ -6,7 +6,7 @@ class Controller {
this.$http = $http;
this.$state = $state;
this.vnApp = vnApp;
this.translate = $translate;
this.$translate = $translate;
}
set edit(value) {
@ -37,7 +37,7 @@ class Controller {
let editLines = [];
let modified = false;
for (let i = 0; i < this.edit.length; i++) {
if (this.newDiscount != this.edit[0].discount || this.bulk) {
if (this.newDiscount != this.edit[0].discount || this.bulk || !this.newDiscount) {
editLines.push({id: this.edit[i].id, discount: this.newDiscount, ticketFk: this.$state.params.id});
modified = true;
}
@ -45,14 +45,14 @@ class Controller {
if (modified) {
this.$http.post(`/ticket/api/Sales/updateDiscount`, {editLines}).then(() => {
this.hide();
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.clear();
modified = false;
}).catch(e => {
this.vnApp.showError(this.translate.instant(e.data.error.message));
this.vnApp.showError(e.data.error.message);
});
} else {
this.vnApp.showError(this.translate.instant('There is no changes to save'));
this.vnApp.showError(this.$translate.instant('There is no changes to save'));
}
}

View File

@ -5,6 +5,11 @@
data="sales" on-data-change="$ctrl.onDataChange()">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="sales">
</vn-watcher>
<vn-vertical>
<vn-card pad-large>
<vn-vertical>
@ -13,7 +18,7 @@
<vn-button
disabled="!$ctrl.isEditable"
label="Ok"
on-click="$ctrl.onStateOkClick()">
ng-click="$ctrl.onStateOkClick()">
</vn-button>
<vn-icon-menu
disabled="!$ctrl.isEditable"
@ -32,14 +37,14 @@
</vn-icon-menu>
<vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
on-click="$ctrl.showRemoveLinesDialog()"
ng-click="$ctrl.showRemoveLinesDialog()"
vn-tooltip="Remove lines"
tooltip-position="up"
icon="delete">
</vn-button>
<vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
on-click="$ctrl.showTransferPopover($event);"
ng-click="$ctrl.showTransferPopover($event);"
vn-tooltip="Transfer lines"
tooltip-position="right"
icon="call_split">
@ -96,7 +101,7 @@
<vn-td ng-if="$ctrl.isEditable" number>
<vn-textfield
model="sale.quantity"
accept="$ctrl.updateQuantity(sale.id, sale.quantity)"
on-change="$ctrl.updateQuantity(sale.id, sale.quantity)"
type="text">
</vn-textfield>
</vn-td>

View File

@ -5,7 +5,7 @@ class Controller {
constructor($scope, $state, $http, vnApp, $translate) {
this.$scope = $scope;
this.vnApp = vnApp;
this.translate = $translate;
this.$translate = $translate;
this.$state = $state;
this.$stateParams = $state.params;
this.$http = $http;
@ -64,11 +64,13 @@ class Controller {
}
getVAT() {
if (this.ticket || this.ticket.id) {
this.$http.get(`/ticket/api/Tickets/${this.ticket.id}/getVAT`).then(res => {
this.VAT = res.data || 0;
this.total = this.subTotal + this.VAT;
});
}
}
get isEditable() {
try {
@ -116,7 +118,7 @@ class Controller {
let params = {ticketFk: this.$state.params.id, stateFk: value};
this.$http.post(`/ticket/api/TicketTrackings/changeState`, params).then(() => {
this.card.reload();
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
@ -129,12 +131,14 @@ class Controller {
let params = {ticketFk: this.$state.params.id, weekDay: day};
this.$http.patch(`/ticket/api/TicketWeeklies`, params).then(() => {
this.$scope.addTurn.hide();
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
// Delete Ticket
showDeleteTicketDialog() {
if (!this.isEditable)
return;
this.$scope.deleteConfirmation.show();
}
@ -143,7 +147,7 @@ class Controller {
let params = {id: this.$state.params.id};
this.$http.post(`/ticket/api/Tickets/deleted`, params).then(() => {
this.$state.go('ticket.index');
this.vnApp.showSuccess(this.translate.instant('Ticket deleted'));
this.vnApp.showSuccess(this.$translate.instant('Ticket deleted'));
});
}
}
@ -265,7 +269,7 @@ class Controller {
this.$http.post(`/ticket/api/Sales/updatePrice`, {id: this.edit.id, price: this.editedPrice, ticketFk: this.ticket.id}).then(() => {
this.sale.price = this.edit.price;
this.$scope.model.refresh();
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
this.$scope.editPricePopover.hide();
@ -303,9 +307,9 @@ class Controller {
updateQuantity(id, quantity) {
this.$http.post(`/ticket/api/Sales/${id}/updateQuantity`, {quantity: parseInt(quantity)}).then(() => {
this.vnApp.showSuccess(this.translate.instant('Data saved!'));
});
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.$scope.model.refresh();
});
}
/**

View File

@ -11,7 +11,6 @@ New ticket: Nuevo ticket
Edit price: Editar precio
You are going to delete lines of the ticket: Vas a borrar lineas del ticket
Continue anyway?: ¿Estás seguro?
The new quantity should be smaller than the old one: La nueva cantidad debe de ser menor que la anterior
You have to allow pop-ups in your web browser to use this functionality:
Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente
Disc: Dto

View File

@ -35,5 +35,8 @@
"The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
"Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
"Description cannot be blank": "Se debe rellenar el campo de texto",
"You don't have enough privileges to change the state of this ticket": "No tienes permisos para cambiar el estado de este ticket"
"You don't have enough privileges to change the state of this ticket": "No tienes permisos para cambiar el estado de este ticket",
"The new quantity should be smaller than the old one": "La nueva cantidad debe de ser menor que la anterior",
"The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
"The value should be a number": "El valor debe ser un numero"
}