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> <span translate>{{$ctrl.label}}</span>
<vn-icon <vn-icon
icon="{{::$ctrl.icon}}" icon="{{::$ctrl.icon}}"

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ class Controller {
this.$http = $http; this.$http = $http;
this.$state = $state; this.$state = $state;
this.vnApp = vnApp; this.vnApp = vnApp;
this.translate = $translate; this.$translate = $translate;
} }
set edit(value) { set edit(value) {
@ -37,7 +37,7 @@ class Controller {
let editLines = []; let editLines = [];
let modified = false; let modified = false;
for (let i = 0; i < this.edit.length; i++) { 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}); editLines.push({id: this.edit[i].id, discount: this.newDiscount, ticketFk: this.$state.params.id});
modified = true; modified = true;
} }
@ -45,14 +45,14 @@ class Controller {
if (modified) { if (modified) {
this.$http.post(`/ticket/api/Sales/updateDiscount`, {editLines}).then(() => { this.$http.post(`/ticket/api/Sales/updateDiscount`, {editLines}).then(() => {
this.hide(); this.hide();
this.vnApp.showSuccess(this.translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.clear(); this.clear();
modified = false; modified = false;
}).catch(e => { }).catch(e => {
this.vnApp.showError(this.translate.instant(e.data.error.message)); this.vnApp.showError(e.data.error.message);
}); });
} else { } 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()"> data="sales" on-data-change="$ctrl.onDataChange()">
</vn-crud-model> </vn-crud-model>
<vn-watcher
vn-id="watcher"
data="sales">
</vn-watcher>
<vn-vertical> <vn-vertical>
<vn-card pad-large> <vn-card pad-large>
<vn-vertical> <vn-vertical>
@ -13,7 +18,7 @@
<vn-button <vn-button
disabled="!$ctrl.isEditable" disabled="!$ctrl.isEditable"
label="Ok" label="Ok"
on-click="$ctrl.onStateOkClick()"> ng-click="$ctrl.onStateOkClick()">
</vn-button> </vn-button>
<vn-icon-menu <vn-icon-menu
disabled="!$ctrl.isEditable" disabled="!$ctrl.isEditable"
@ -32,14 +37,14 @@
</vn-icon-menu> </vn-icon-menu>
<vn-button <vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable" disabled="!$ctrl.isChecked || !$ctrl.isEditable"
on-click="$ctrl.showRemoveLinesDialog()" ng-click="$ctrl.showRemoveLinesDialog()"
vn-tooltip="Remove lines" vn-tooltip="Remove lines"
tooltip-position="up" tooltip-position="up"
icon="delete"> icon="delete">
</vn-button> </vn-button>
<vn-button <vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable" disabled="!$ctrl.isChecked || !$ctrl.isEditable"
on-click="$ctrl.showTransferPopover($event);" ng-click="$ctrl.showTransferPopover($event);"
vn-tooltip="Transfer lines" vn-tooltip="Transfer lines"
tooltip-position="right" tooltip-position="right"
icon="call_split"> icon="call_split">
@ -96,7 +101,7 @@
<vn-td ng-if="$ctrl.isEditable" number> <vn-td ng-if="$ctrl.isEditable" number>
<vn-textfield <vn-textfield
model="sale.quantity" model="sale.quantity"
accept="$ctrl.updateQuantity(sale.id, sale.quantity)" on-change="$ctrl.updateQuantity(sale.id, sale.quantity)"
type="text"> type="text">
</vn-textfield> </vn-textfield>
</vn-td> </vn-td>

View File

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

View File

@ -11,7 +11,6 @@ New ticket: Nuevo ticket
Edit price: Editar precio Edit price: Editar precio
You are going to delete lines of the ticket: Vas a borrar lineas del ticket You are going to delete lines of the ticket: Vas a borrar lineas del ticket
Continue anyway?: ¿Estás seguro? 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: 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 Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente
Disc: Dto 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", "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", "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", "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"
} }