Bug #437 Boton cancelar

This commit is contained in:
gerard 2018-07-25 14:18:12 +02:00
parent d6f3f22970
commit a2de55fae5
4 changed files with 21 additions and 1 deletions

View File

@ -40,5 +40,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 {
shipped: new Date() shipped: new Date()
}; };
} }
cancel(event) {
event.preventDefault();
event.stopImmediatePropagation();
this.goToIndex();
}
goToIndex() {
this.$state.go('client.card.greuge.index');
}
onSubmit() { onSubmit() {
this.greuge.clientFk = this.$state.params.id; this.greuge.clientFk = this.$state.params.id;
this.$.watcher.submit().then( this.$.watcher.submit().then(
() => { () => {
this.$state.go('client.card.greuge.index'); this.goToIndex();
} }
); );
} }

View File

@ -21,5 +21,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

@ -2,11 +2,18 @@ import ngModule from '../../module';
export default class Controller { export default class Controller {
constructor($state) { constructor($state) {
this.$state = $state;
this.note = { this.note = {
clientFk: parseInt($state.params.id), clientFk: parseInt($state.params.id),
text: null text: null
}; };
} }
cancel(event) {
event.preventDefault();
event.stopImmediatePropagation();
this.$state.go('client.card.note.index', {id: this.$state.params.id});
}
} }
Controller.$inject = ['$state']; Controller.$inject = ['$state'];