import _FrameAdmin from './_FrameAdmin.js';
import FrameAdminListItem from './FrameAdminListItem.js';

var FrameAdmin = function(){
return {
view: function(){
var results_frames = _FrameAdmin.results_frames;
var working_frames = _FrameAdmin.working_frames;
return m('.frame-listing', [
      m('h4', 'Frame Editor'),
      m('.search', [
        m('input[type=text][placeholder=Model]', {
          onchange: _FrameAdmin.search_onchange_handler,
          value: _FrameAdmin.search_term
          })
        ]),
      m('table.table.table-striped', [
        m('thead', [
          m('tr', [
            m('th', 'Name'),
            m('th', 'Brand'),
            m('th', 'Model'),
            m('th', 'Color Code'),
            m('th', 'Color Description'),
            m('th', 'Description (Short)'),
            m('th', 'Size'),
            m('th', 'Material'),
            m('th', 'Price (Silver)'),
            m('th', 'Price (Gold)'),
            m('th', 'Inventory'),
            m('th', 'Delete')
            ])
          ]),
        m('tbody', [
          m('tr', [
            m('td.text-center', {colspan: 11}, [
              m('button.btn.btn-primary.btn-lg.btn-block', {onclick: _FrameAdmin.add_button_onclick_handler}, [
                m('i.icon.icon-plus'),
                ' Add ',
                m('i.icon.icon-plus')
                ])
              ])
            ]),
          working_frames.map(function(frame, i){
            return m(FrameAdminListItem, {frame: frame, collection: working_frames, index_in_collection: i});
            }),
          m('tr', [
            m('td.text-center', {colspan: 11}, [
              m('button.btn.btn-primary.btn-lg.btn-block', {onclick: _FrameAdmin.clear_button_onclick_handler}, [
                m('i.icon.icon-refresh'),
                ' Clear'
                ])
              ])
            ]),
          results_frames.map(function(frame, i){
            return m(FrameAdminListItem, {frame: frame, collection: results_frames, index_in_collection: i});
            })
          ])
        ])
      ]);
}
};
}

export default FrameAdmin;
