+from htsworkflow.frontend.samples.changelist import ChangeList
from htsworkflow.frontend.inventory.models import Item, LongTermStorage, ItemType
from htsworkflow.frontend.inventory.bcmagic import item_search
from htsworkflow.frontend.bcmagic.plugin import register_search_plugin
"""
Inventory Index View
"""
+ # build changelist
+ item_changelist = ChangeList(request, Item,
+ list_filter=[],
+ search_fields=[],
+ list_per_page=200,
+ queryset=Item.objects.all()
+ )
+
context_dict = {
+ 'item_changelist': item_changelist,
'page_name': 'Inventory Index'
}
context_dict.update(INVENTORY_CONTEXT_DEFAULTS)
-{% extends "inventory/inventory_app.html" %}
-
-{% block additional_javascript %}
-<script type="text/javascript" src="/static/js/htsw-inventory.js"></script>
+{% extends "base_site.html" %}
+{% load adminmedia admin_list i18n %}
+{% block extrahead %}
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $(window).resize(function() {
+ var window_height = $(window).height();
+ var position = $("#changelist table").position();
+ height = window_height - position.top;
+ $("#changelist table.filtered").height(height);
+ $("#changelist-filter").height(height);
+ });
+ $(window).resize();
+ });
+ </script>
{% endblock %}
-
+{% block bodyclass %}change-list{% endblock %}
+{% block coltype %}flex{% endblock %}
{% block content %}
-<div id="grid_target"></div>
+<div id="inventory-index-div" >
+ <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
+ {% block search %}{% search_form item_changelist %}{% endblock %}
+
+ {% block pagination %}{% pagination item_changelist %}{% endblock %}
+
+ {% block filters %}
+ {% if item_changelist.has_filters %}
+ <div id="changelist-filter">
+ <h2 >{% trans 'Filter' %}</h2>
+ {% for spec in item_changelist.filter_specs %}
+ {% admin_list_filter cl spec %}
+ {% endfor %}
+ </div>
+ {% endif %}
+ {% endblock %}
+ {% block summary_stats %}
+ <table class="{% if cl.has_filters %} filtered{% endif %}">
+ <thead >
+ <tr >
+ <td >UUID</td>
+ <td >Barcode ID</td>
+ <td >Location</td>
+ <td >Model</td>
+ <td >Vendor</td>
+ <td >Created</td>
+ <td >Contains</td>
+ </tr>
+ </thead>
+ <tbody >
+ {% for item in item_changelist.get_query_set %}
+ <tr >
+ <td >{{ item.uuid }}</td>
+ <td >{{ item.barcode_id}}</td>
+ <td >{{ item.location }}</td>
+ <td >{{ item.item_type }}</td>
+ <td ></td>
+ <td >{{ item.creation_date }}</td>
+ <td >
+ {% for content in item.longtermstorage_set.all %}
+ {{ content.flowcell }}
+ {% endfor %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endblock %}
+</div>
{% endblock %}
-
\ No newline at end of file
</p>
<br />
<center><div id="lts-grid"></div></center>
- <script>
- var lts_data = [
- {% for lts in item.longtermstorage_set.all %}
- {% for lib in lts.libraries.iterator %}[ "{{ lts.flowcell.flowcell_id }}","{{ lib.id }}","{% for sd in lts.storage_devices.iterator %}{{ sd }}{% if forloop.last %}"{% else %}|{% endif %}{% endfor %}{% if forloop.parentloop.last %}{% if forloop.last %}]{% else %}],{% endif %}{% else %}],{% endif %}
- {% endfor %}
- {% endfor %}
- ];
-
- var lts_reader = new Ext.data.ArrayReader({}, [
- {name: 'flowcell'},
- {name: 'library'},
- {name: 'storage_devices'}
- ]);
-
- var lts_grid = new Ext.grid.GridPanel({
- store: new Ext.data.GroupingStore({
- reader: lts_reader,
- data: lts_data,
- sortInfo: {'field': 'flowcell', 'direction': 'DESC'},
- groupField: 'flowcell'
- }),
-
- columns: [
- {id: 'flowcell', header: 'Flowcell', width: 30, sortable: true, dataIndex: 'flowcell', hidden: true},
- {header: 'Library', width: 30, sortable: true, dataIndex: 'library'},
- {header: 'Storage Devices', width: 60, sortable: true, dataIndex: 'storage_devices'}
- ],
-
- view: new Ext.grid.GroupingView({
- forceFit: true,
- groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
- }),
-
- frame: true,
- width: 700,
- autoHeight: true,
- collapisble: true,
- animCollapisble: true,
- stateful: true,
- stateId: 'inventory-item-lts-storage-grid',
- title: 'Long Term Storage Info',
- iconCls: 'icon-grid',
- renderTo: 'lts-grid'
- })
- </script>
{% else %}
<h3>Item with UUID of {{ uuid }} not found.</h3>