{% extends "company/company_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block sidebar %} {% include 'company/sidebar.html' %} {% endblock sidebar %} {% block page_content %}

{% trans "Supplier Parts" %}

{% include "spacer.html" %}
{% if roles.purchase_order.add and not part.virtual %} {% endif %}
{% if roles.purchase_order.change %}
{% include "filter_list.html" with id="supplier-part" %}
{% endif %}

{% trans "Manufacturer Parts" %}

{% include "spacer.html" %}
{% if roles.purchase_order.add and not part.virtual %} {% endif %}
{% if roles.purchase_order.change %}
{% include "filter_list.html" with id="manufacturer-part" %}
{% endif %}

{% trans "Supplier Stock" %}

{% include "stock_table.html" %}

{% trans "Purchase Orders" %}

{% include "spacer.html" %}
{% if roles.purchase_order.add %} {% endif %}
{% include "filter_list.html" with id="purchaseorder" %}
{% if company.is_customer %} {% if roles.sales_order.view %}

{% trans "Sales Orders" %}

{% include "spacer.html" %}
{% if roles.sales_order.add %} {% endif %}
{% include "filter_list.html" with id="salesorder" %}
{% endif %} {% if roles.stock.view %}

{% trans "Assigned Stock" %}

{% include "filter_list.html" with id="customerstock" %}
{% endif %} {% if roles.return_order.view and return_order_enabled %}

{% trans "Return Orders" %}

{% include "spacer.html" %}
{% if roles.return_order.add %} {% endif %}
{% include "filter_list.html" with id="returnorder" %}
{% endif %} {% endif %}

{% trans "Company Notes" %}

{% include "spacer.html" %}
{% include "notes_buttons.html" %}

{% trans "Company Contacts" %}

{% include "spacer.html" %}
{% if roles.purchase_order.add or roles.sales_order.add %} {% endif %}
{% include "filter_list.html" with id="contacts" %}

{% trans "Company addresses" %}

{% include "spacer.html" %}
{% if roles.purchase_order.add or roles.sales_order.add %} {% endif %}
{% include "filter_list.html" with id="addresses" %}

{% trans "Attachments" %}

{% include "spacer.html" %}
{% include "attachment_button.html" %}
{% include "attachment_table.html" %}
{% endblock page_content %} {% block js_ready %} {{ block.super }} onPanelLoad("attachments", function() { loadAttachmentTable('company', {{ company.pk }}); }); // Callback function when the 'contacts' panel is loaded onPanelLoad('company-contacts', function() { loadContactTable('#contacts-table', { params: { company: {{ company.pk }}, }, allow_edit: {% js_bool roles.purchase_order.change %} || {% js_bool roles.sales_order.change %}, allow_delete: {% js_bool roles.purchase_order.delete %} || {% js_bool roles.sales_order.delete %}, }); $('#new-contact').click(function() { createContact({ company: {{ company.pk }}, onSuccess: function() { $('#contacts-table').bootstrapTable('refresh'); } }); }); }); // Callback function for when the 'addresses' panel is loaded onPanelLoad('company-addresses', function(){ loadAddressTable('#addresses-table', { params: { company: {{ company.pk }}, }, allow_edit: {% js_bool roles.purchase_order.change %} || {% js_bool roles.sales_order.change %}, allow_delete: {% js_bool roles.purchase_order.delete %} || {% js_bool roles.sales_order.delete %}, }); $('#new-address').click(function() { createAddress({ company: {{ company.pk }}, onSuccess: function() { $('#addresses-table').bootstrapTable('refresh'); } }) }) }) // Callback function when the 'notes' panel is loaded onPanelLoad('company-notes', function() { setupNotesField( 'company-notes', '{% url "api-company-detail" company.pk %}', { editable: true, model_type: "company", model_id: {{ company.pk }}, } ); }); onPanelLoad('company-stock', function() { loadStockTable($('#stock-table'), { url: "{% url 'api-stock-list' %}", params: { company: {{ company.id }}, part_detail: true, supplier_part_detail: true, location_detail: true, }, filterKey: "companystock", }); }); {% if company.is_customer %} {% if return_order_enabled %} // Callback function when the 'return orders' panel is loaded onPanelLoad('return-orders', function() { {% if roles.return_order.view %} loadReturnOrderTable('#return-order-table', { params: { customer: {{ company.pk }}, } }); {% endif %} {% if roles.return_order.add %} $('#new-return-order').click(function() { createReturnOrder({ customer: {{ company.pk }}, }); }); {% endif %} }); {% endif %} // Callback function when the 'assigned stock' panel is loaded onPanelLoad('assigned-stock', function() { {% if roles.stock.view %} loadStockTable($("#assigned-stock-table"), { params: { customer: {{ company.id }}, part_detail: true, location_detail: true, }, url: "{% url 'api-stock-list' %}", filterKey: "customerstock", filterTarget: '#filter-list-customerstock', }); {% endif %} }); // Callback function when the 'sales orders' panel is loaded onPanelLoad('sales-orders', function() { {% if roles.sales_order.view %} loadSalesOrderTable("#sales-order-table", { url: "{% url 'api-so-list' %}", params: { customer: {{ company.id }}, } }); {% endif %} {% if roles.sales_order.add %} $("#new-sales-order").click(function() { createSalesOrder({ customer: {{ company.pk }}, }); }); {% endif %} }); {% endif %} {% if company.is_supplier %} loadPurchaseOrderTable("#purchase-order-table", { url: "{% url 'api-po-list' %}", params: { supplier: {{ company.id }}, } }); function newOrder() { createPurchaseOrder({ supplier: {{ company.pk }}, }); } $("#company-order").click(function() { newOrder(); }); $("#company-order2").click(function() { newOrder(); }); {% endif %} {% if company.is_manufacturer %} function reloadManufacturerPartTable() { $('#manufacturer-part-table').bootstrapTable('refresh'); } $("#manufacturer-part-create").click(function () { createManufacturerPart({ manufacturer: {{ company.pk }}, onSuccess: function() { $("#part-table").bootstrapTable('refresh'); } }); }); loadManufacturerPartTable( "#manufacturer-part-table", "{% url 'api-manufacturer-part-list' %}", { params: { part_detail: true, manufacturer_detail: true, manufacturer: {{ company.id }}, }, } ); {% endif %} {% if company.is_supplier %} function reloadSupplierPartTable() { $('#supplier-part-table').bootstrapTable('refresh'); } $("#supplier-part-create").click(function () { createSupplierPart({ supplier: {{ company.pk }}, onSuccess: reloadSupplierPartTable, }); }); loadSupplierPartTable( "#supplier-part-table", "{% url 'api-supplier-part-list' %}", { params: { part_detail: true, supplier_detail: true, manufacturer_detail: true, supplier: {{ company.id }}, }, } ); {% endif %} enableSidebar('company'); {% endblock js_ready %}