diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 20b0663b..147ba4d5 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -144,7 +144,6 @@ class ErasureListView(DeviceListMixin): EraseBasic.created.desc() ) self.context['orphans'] = True - # import pdb; pdb.set_trace() erasure = erasure.paginate(page=page, per_page=per_page) erasure.first = per_page * erasure.page - per_page + 1 @@ -159,8 +158,17 @@ class DeviceListView(DeviceListMixin): class AllDeviceListView(DeviceListMixin): + template_name = 'inventory/all_device_list.html' + def dispatch_request(self): self.get_context(all_devices=True) + # import pdb; pdb.set_trace() + page = int(request.args.get('page', 1)) + per_page = int(request.args.get('per_page', 5)) + devices = self.context['devices'].paginate(page=page, per_page=per_page) + devices.first = per_page * devices.page - per_page + 1 + devices.last = len(devices.items) + devices.first - 1 + self.context['devices'] = devices return flask.render_template(self.template_name, **self.context) diff --git a/ereuse_devicehub/templates/inventory/all_device_list.html b/ereuse_devicehub/templates/inventory/all_device_list.html new file mode 100644 index 00000000..79ff81cd --- /dev/null +++ b/ereuse_devicehub/templates/inventory/all_device_list.html @@ -0,0 +1,671 @@ +{% extends "ereuse_devicehub/base_site.html" %} +{% block main %} + +
+

Inventory

+ +
+ +
+
+ +
+ +
+ {% if lot %} +
+ + +
+
+

+ {{ lot.name }} +

+
+ +
+ {% if lot.is_temporary or not lot.transfer.closed %} + + {% if lot and lot.is_temporary %} + + Create Outgoing Lot + + + Create Incoming Lot + + {% endif %} + + Delete Lot + + + {% endif %} +
+
+
+ {% endif %} +
+ + {% if lot %} + + {% endif %} +
+
+ + + + + + + + + + + + + + +
+
+
+ {% for f in form_filter %} + {{ f }} + {% endfor %} + +
+
+ +

+ Displaying devices of type + {{ form_filter.filter.data or "Computer" }} +

+ +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + {% for dev in devices.items %} + {% if dev.placeholder and (not dev.parent_id or dev.parent.placeholder.kangaroo) %} + + + + + + + + + + + + + + + {% endif %} + {% endfor %} + +
SelectTitleDHIDPHIDTypeUnique IdentifiersLifecycle StatusAllocated StatusPhysical StatusUpdated inRegistered in
+ + + + {% if dev.get_type_logo() %} + + {% endif %} + {{ dev.verbose_name }} + + {% if dev.lots | length > 0 %} +
+ {% for lot in dev.get_lots_for_template() %} + {{ lot }} + {% endfor %} +
+ {% endif %} +
+ + {{ dev.devicehub_id }} + + + {{ dev.binding and dev.binding.phid or dev.placeholder and dev.placeholder.phid or '' }} + + {{ dev.is_abstract() }} + + {% for t in dev.tags | sort(attribute="id") %} + {{ t.id }} + {% if not loop.last %},{% endif %} + {% endfor %} + {% if dev.status %}{{ dev.status.type }}{% endif %}{% if dev.allocated_status %}{{ dev.allocated_status.type }}{% endif %}{% if dev.physical_status %}{{ dev.physical_status.type }}{% endif %}{{ dev.get_updated.strftime('%Y-%m-%d %H:%M:%S')}}{{ dev.created.strftime('%Y-%m-%d %H:%M:%S')}} + + + +
+
+
+ Showing {{ devices.first }} to {{ devices.last }} of {{ devices.total }} entries +
+ +
+
+ +
+
+ {% if lot and not lot.is_temporary %} +
+ + +
Documents
+ + + + + + + + + {% for doc in lot.documents %} + + + + + {% endfor %} + {% for doc in lot.trade.documents %} + + + + + {% endfor %} + +
FileUploaded on
+ {% if doc.get_url() %} + {{ doc.file_name}} + {% else %} + {{ doc.file_name}} + {% endif %} + + {{ doc.created.strftime('%Y-%m-%d %H:%M')}} +
+ {% if doc.get_url() %} + {{ doc.file_name}} + {% else %} + {{ doc.file_name}} + {% endif %} + + {{ doc.created.strftime('%Y-%m-%d %H:%M')}} +
+
+
+
Transfer
+
+ {{ form_transfer.csrf_token }} + + {% for field in form_transfer %} + {% if field != form_transfer.csrf_token %} +
+ {% if field != form_transfer.type %} + {{ field.label(class_="form-label") }} + {% if field == form_transfer.code %} + * + {% endif %} + {{ field }} + {{ field.description }} + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }}
+ {% endfor %} +

+ {% endif %} + {% endif %} +
+ {% endif %} + {% endfor %} + +
+ Cancel + +
+
+
+
+
Delivery Note
+
+ {{ form_delivery.csrf_token }} + + {% for field in form_delivery %} + {% if field != form_delivery.csrf_token %} +
+ {% if field != form_delivery.type %} + {{ field.label(class_="form-label") }} + {{ field }} + {{ field.description }} + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }}
+ {% endfor %} +

+ {% endif %} + {% endif %} +
+ {% endif %} + {% endfor %} + + {% if lot.transfer and form_receiver.is_editable() %} +
+ Cancel + +
+ {% endif %} +
+
+
+
Receiver Note
+
+ {{ form_receiver.csrf_token }} + + {% for field in form_receiver %} + {% if field != form_receiver.csrf_token %} +
+ {% if field != form_receiver.type %} + {{ field.label(class_="form-label") }} + {{ field }} + {{ field.description }} + {% if field.errors %} +

+ {% for error in field.errors %} + {{ error }}
+ {% endfor %} +

+ {% endif %} + {% endif %} +
+ {% endif %} + {% endfor %} + + {% if lot.transfer and form_receiver.is_editable() %} +
+ Cancel + +
+ {% endif %} +
+
+ {% endif %} + +
+
+
+
+ +
+ +
+ +
+{% include "inventory/lot_delete_modal.html" %} +{% include "inventory/actions.html" %} +{% include "inventory/allocate.html" %} +{% include "inventory/data_wipe.html" %} +{% include "inventory/trade.html" %} +{% include "inventory/alert_export_error.html" %} +{% include "inventory/alert_lots_changes.html" %} + + + + +{% if config['DEBUG'] %} + +{% else %} + +{% endif %} + + +{% endblock main %} diff --git a/ereuse_devicehub/templates/inventory/device_list.html b/ereuse_devicehub/templates/inventory/device_list.html index 8f14446a..98894fe5 100644 --- a/ereuse_devicehub/templates/inventory/device_list.html +++ b/ereuse_devicehub/templates/inventory/device_list.html @@ -7,11 +7,7 @@