{% extends "stock/stock_app_base.html" %} {% load static %} {% block content %}
{% if location %}

{{ location.name }}

{{ location.description }}

{% else %}

Stock

{% endif %}

{% if location %} {% endif %}

{% if location %} {% include 'stock/location_list.html' with children=location.children.all %} {% else %} {% include 'stock/location_list.html' with children=locations %} {% endif %}
{% include 'modals.html' %} {% endblock %} {% block js_load %} {{ block.super }} {% endblock %} {% block js_ready %} {{ block.super }} $('#location-create').click(function () { launchModalForm("#modal-form", "{% url 'stock-location-create' %}", { data: { {% if location %} location: {{ location.id }} {% endif %} }, follow: true }); return false; }); {% if location %} $('#location-edit').click(function() { launchModalForm("#modal-form", "{% url 'stock-location-edit' location.id %}", { reload: true }); return false; }); $('#location-delete').click(function() { launchDeleteForm("#modal-delete", "{% url 'stock-location-delete' location.id %}", { redirect: "{% url 'stock-index' %}" }); return false; }); {% endif %} $('#item-create').click(function () { launchModalForm("#modal-form", "{% url 'stock-item-create' %}", { success: function() { $("#stock-table").bootstrapTable('refresh'); }, data: { {% if location %} location: {{ location.id }} {% endif %} } }); return false; }); function selectedStock() { return $("#stock-table").bootstrapTable('getSelections'); } $("#multi-item-move").click(function() { var items = selectedStock(); alert('Moving ' + items.length + ' items'); return false; }); $("#multi-item-delete").click(function() { var items = selectedStock(); alert('Deleting ' + items.length + ' items'); return false; }); $("#multi-item-stocktake").click(function() { var items = selectedStock(); alert('Stocktake on ' + items.length + ' items'); return false; }); $("#stock-table").bootstrapTable({ sortable: true, search: true, method: 'get', pagination: true, rememberOrder: true, {% if location %} queryParams: function(p) { return { location: {{ location.id }} } }, {% endif %} columns: [ { checkbox: true, title: 'Select', searchable: false, }, { field: 'pk', title: 'ID', visible: false, }, { field: 'part.name', title: 'Part', sortable: true, formatter: function(value, row, index, field) { return renderLink(value, row.part.url); } }, {% if location == None %} { field: 'location', title: 'Location', sortable: true, formatter: function(value, row, index, field) { if (row.location) { return renderLink(row.location.name, row.location.url); } else { return ''; } } }, {% endif %} { field: 'quantity', title: 'Stock', sortable: true, }, { field: 'status', title: 'Status', sortable: true, } ], url: "{% url 'api-stock-list' %}", }); {% endblock %}