revert Bug #575 ng-click se llama en los vn-button deshabilitados

This commit is contained in:
gerard 2018-08-02 15:33:24 +02:00
parent dd22309e7c
commit 84462be55a
5 changed files with 20 additions and 15 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

@ -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;
@ -116,7 +116,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 +129,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 +145,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 +267,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 +305,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