Bug #437 Boton cancelar

This commit is contained in:
gerard 2018-07-25 13:37:27 +02:00
parent 82b0323847
commit d6f3f22970
6 changed files with 37 additions and 3 deletions

View File

@ -102,5 +102,6 @@
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Save"></vn-submit> <vn-submit label="Save"></vn-submit>
<vn-button ng-click="$ctrl.cancel($event)" label="Cancel"></vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>

View File

@ -12,6 +12,16 @@ export default class Controller {
this.$.model.remove(index); this.$.model.remove(index);
} }
cancel(event) {
event.preventDefault();
event.stopImmediatePropagation();
this.goToIndex();
}
goToIndex() {
this.$state.go('client.card.address.index');
}
submit() { submit() {
this.$.watcher.check(); this.$.watcher.check();
this.$.watcher.realSubmit() this.$.watcher.realSubmit()
@ -20,7 +30,7 @@ export default class Controller {
this.$.watcher.setPristine(); this.$.watcher.setPristine();
this.$.watcher.notifySaved(); this.$.watcher.notifySaved();
this.card.reload(); this.card.reload();
this.$state.go('client.card.address.index', {id: this.$stateParams.id}); this.goToIndex();
}); });
} }
} }

View File

@ -14,6 +14,7 @@
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Save"></vn-submit> <vn-submit label="Save"></vn-submit>
<vn-button ng-click="$ctrl.cancel($event)" label="Cancel"></vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>
<vn-confirm <vn-confirm

View File

@ -17,15 +17,25 @@ class Controller {
}); });
} }
cancel(event) {
event.preventDefault();
event.stopImmediatePropagation();
this.goToIndex();
}
returnDialog(response) { returnDialog(response) {
if (response === 'ACCEPT') if (response === 'ACCEPT')
this.addCredit(); this.addCredit();
} }
goToIndex() {
this.$state.go('client.card.credit.index');
}
addCredit() { addCredit() {
this.$scope.watcher.submit().then( this.$scope.watcher.submit().then(
() => { () => {
this.$state.go('client.card.credit.index'); this.goToIndex();
} }
); );
} }

View File

@ -38,5 +38,6 @@
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Save"></vn-submit> <vn-submit label="Save"></vn-submit>
<vn-button ng-click="$ctrl.cancel($event)" label="Cancel"></vn-button>
</vn-button-bar> </vn-button-bar>
</form> </form>

View File

@ -8,11 +8,22 @@ class Controller {
started: new Date() started: new Date()
}; };
} }
cancel(event) {
event.preventDefault();
event.stopImmediatePropagation();
this.goToIndex();
}
goToIndex() {
this.$state.go('client.card.recovery.index');
}
onSubmit() { onSubmit() {
this.recovery.clientFk = this.$state.params.id; this.recovery.clientFk = this.$state.params.id;
this.$.watcher.submit().then( this.$.watcher.submit().then(
() => { () => {
this.$state.go('client.card.recovery.index'); this.goToIndex();
} }
); );
} }