salix/client/item/src/list/list.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-12-19 10:05:07 +00:00
import ngModule from '../module';
2018-04-04 17:59:03 +00:00
import './product';
2018-02-22 07:18:57 +00:00
import './style.scss';
2017-12-19 10:05:07 +00:00
2017-12-19 10:24:24 +00:00
class ItemList {
2018-02-22 12:40:23 +00:00
constructor($http, $state, $scope) {
this.$http = $http;
this.$state = $state;
2018-02-22 07:18:57 +00:00
this.$scope = $scope;
2017-12-19 10:05:07 +00:00
this.model = {};
2018-02-22 07:18:57 +00:00
this.itemSelected = null;
this.items = [];
2017-12-19 10:05:07 +00:00
}
2017-12-19 10:05:07 +00:00
search(index) {
2018-05-11 06:35:28 +00:00
index.accept();
/* this.items = [];
index.accept().then(res => {
this.items = res.instances;
2018-05-11 06:35:28 +00:00
}); */
2017-12-19 10:05:07 +00:00
}
2018-02-22 12:40:23 +00:00
cloneItem(item) {
this.itemSelected = item;
this.$scope.clone.show();
}
2018-02-22 12:40:23 +00:00
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;
}
2018-02-22 07:18:57 +00:00
showItemPreview(item) {
this.itemSelected = item;
this.$scope.preview.show();
}
2017-12-19 10:05:07 +00:00
}
2018-02-22 12:40:23 +00:00
ItemList.$inject = ['$http', '$state', '$scope'];
2017-12-19 10:05:07 +00:00
2017-12-19 10:24:24 +00:00
ngModule.component('vnItemList', {
template: require('./list.html'),
controller: ItemList
2017-12-19 10:05:07 +00:00
});