import ngModule from '../module'; import './product'; import './style.scss'; class ItemList { constructor($http, $state, $scope) { this.$http = $http; this.$state = $state; this.$scope = $scope; this.model = {}; this.itemSelected = null; this.items = []; } search(index) { index.accept(); /* this.items = []; index.accept().then(res => { this.items = res.instances; }); */ } cloneItem(item) { this.itemSelected = item; this.$scope.clone.show(); } onCloneAccept(response) { if (response == 'ACCEPT' && this.itemSelected) { this.$http.post(`/item/api/Items/${this.itemSelected.id}/clone`).then(res => { if (res && res.data && res.data.id) { this.$state.go('item.card.tags', {id: res.data.id}); } }); } this.itemSelected = null; } showItemPreview(item) { this.itemSelected = item; this.$scope.preview.show(); } } ItemList.$inject = ['$http', '$state', '$scope']; ngModule.component('vnItemList', { template: require('./list.html'), controller: ItemList });