You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.0 KiB
JavaScript

import _FrameAdminListItem from './_FrameAdminListItem.js';
var FrameAdminListItem = function(){
return {
view: function(vnode){
var frame = vnode.attrs.frame;
var collection = vnode.attrs.collection;
var index_in_collection = vnode.attrs.index_in_collection;
if(frame.loading === true){
return m('tr', [
m('td', {colspan: 11}, [
m('.loading-lg')
])
]);
}
else{
return m('tr', [
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'name', e.target.value);
}, value: frame.name})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'brand', e.target.value);
}, value: frame.brand})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'model', e.target.value);
}, value: frame.model})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'color', e.target.value);
}, value: frame.color})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'color_description', e.target.value);
}, value: frame.color_description})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'description_short', e.target.value);
}, value: frame.description_short})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'size', e.target.value);
}, value: frame.size})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
_FrameAdminListItem.update(frame, 'material', e.target.value);
}, value: frame.material})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
var price = Number(e.target.value)
if(price !== NaN){
_FrameAdminListItem.update(frame, 'price_silver', price);
}
}, value: frame.price_silver})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
var price = Number(e.target.value)
if(price !== NaN){
_FrameAdminListItem.update(frame, 'price_gold', price);
}
}, value: frame.price_gold})
]),
m('td', [
m('input', {type:'text', onchange: function(e){
var inventory = Number(e.target.value)
if(inventory !== NaN){
_FrameAdminListItem.update(frame, 'inventory', inventory);
}
}, value: frame.inventory})
]),
m('td', [
m('button.btn.btn-action.btn-primary.s-circle', {onclick: function(e){
_FrameAdminListItem.delete(frame, collection, index_in_collection);
}}, [m('i.icon.icon-delete')])
])
]);
}
}
};
};
export default FrameAdminListItem;