salix/modules/item/front/index/product.js

50 lines
1.0 KiB
JavaScript
Raw Normal View History

2017-12-19 13:28:19 +00:00
import ngModule from '../module';
2018-02-22 07:18:57 +00:00
class ItemProduct {
2018-03-01 20:18:43 +00:00
onClick(event) {
if (event.defaultPrevented)
event.stopImmediatePropagation();
}
2018-10-22 12:32:05 +00:00
set item(value) {
if (value) {
let tags = [];
for (let i = 5; i < 9; i++) {
if (value['tag' + i]) {
let tagValue = value['value' + i];
let tagKey = value['tag' + i];
tags.push({tag: {name: tagKey}, value: tagValue});
}
}
value.tags = tags;
}
this._item = value;
}
get item() {
return this._item;
}
2018-03-01 20:18:43 +00:00
clone(event) {
event.preventDefault();
2018-07-06 14:32:23 +00:00
this.index.cloneItem(this.item);
2018-02-22 07:18:57 +00:00
}
2018-03-01 20:18:43 +00:00
preview(event) {
event.preventDefault();
2018-07-06 14:32:23 +00:00
this.index.showItemPreview(this.item);
2018-02-22 07:18:57 +00:00
}
}
2017-12-19 13:28:19 +00:00
ngModule.component('vnItemProduct', {
2018-04-04 17:59:03 +00:00
template: require('./product.html'),
2017-12-19 13:28:19 +00:00
bindings: {
item: '<'
2018-02-22 07:18:57 +00:00
},
controller: ItemProduct,
require: {
2018-07-06 14:32:23 +00:00
index: '^vnItemIndex'
2017-12-19 13:28:19 +00:00
}
});