mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Refactor admin button for:
- build order - part detail - stock item - stock location - company detail - manufacturer-part - purchase order - sales order
This commit is contained in:
		| @@ -23,44 +23,88 @@ src="{% static 'img/blank_image.png' %}" | |||||||
| {% endif %}/>             | {% endif %}/>             | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details %} | {% block heading %} | ||||||
| <h4> | {% trans "Build Order" %} {{ build }} | ||||||
|     {% trans "Build Order" %} {{ build }} | {% endblock %} | ||||||
|     {% if user.is_staff and roles.build.change %} |  | ||||||
|     <a  href="{% url 'admin:build_build_change' build.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a> | {% block actions %} | ||||||
|     {% endif %} | <!-- Admin Display --> | ||||||
| </h4> | {% if user.is_staff and roles.build.change %} | ||||||
| <p>{{ build.title }}</p> | {% url 'admin:build_build_change' build.pk as url %} | ||||||
| <div class='btn-group' role='group'> | {% include "admin_button.html" with url=url %} | ||||||
|     <!-- Printing options --> | {% endif %} | ||||||
|     <div class='btn-group'> | <!-- Printing options --> | ||||||
|         <button id='print-options' title='{% trans "Print actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | <div class='btn-group'> | ||||||
|             <span class='fas fa-print'></span> <span class='caret'></span> |     <button id='print-options' title='{% trans "Print actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|         </button> |         <span class='fas fa-print'></span> <span class='caret'></span> | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='print-build-report'><span class='fas fa-file-pdf'></span> {% trans "Print build order report" %}</a></li> |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     <!-- Build actions --> |  | ||||||
|     {% if roles.build.change %} |  | ||||||
|     <div class='btn-group'> |  | ||||||
|         <button id='build-options' title='{% trans "Build actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-tools'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='build-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit Build" %}</a></li> |  | ||||||
|             {% if build.is_active %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='build-cancel'><span class='fas fa-times-circle icon-red'></span> {% trans "Cancel Build" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|             {% if build.status == BuildStatus.CANCELLED and roles.build.delete %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='build-delete'><span class='fas fa-trash-alt'></span> {% trans "Delete Build" %}</a> |  | ||||||
|             {% endif %} |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% if build.active %} |  | ||||||
|     <button id='build-complete' title='{% trans "Complete Build" %}' class='btn btn-success'> |  | ||||||
|         <span class='fas fa-check-circle'></span> |  | ||||||
|     </button> |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='print-build-report'><span class='fas fa-file-pdf'></span> {% trans "Print build order report" %}</a></li> | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | <!-- Build actions --> | ||||||
|  | {% if roles.build.change %} | ||||||
|  | <div class='btn-group'> | ||||||
|  |     <button id='build-options' title='{% trans "Build actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-tools'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='build-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit Build" %}</a></li> | ||||||
|  |         {% if build.is_active %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='build-cancel'><span class='fas fa-times-circle icon-red'></span> {% trans "Cancel Build" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |         {% if build.status == BuildStatus.CANCELLED and roles.build.delete %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='build-delete'><span class='fas fa-trash-alt'></span> {% trans "Delete Build" %}</a> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% if build.active %} | ||||||
|  | <button id='build-complete' title='{% trans "Complete Build" %}' class='btn btn-success'> | ||||||
|  |     <span class='fas fa-check-circle'></span> {% trans "Complete Build" %} | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block details %} | ||||||
|  |  | ||||||
|  | <p>{{ build.title }}</p> | ||||||
|  |  | ||||||
|  | <div class='info-messages'> | ||||||
|  |     {% if build.sales_order %} | ||||||
|  |     <div class='alert alert-block alert-info'> | ||||||
|  |         {% object_link 'so-detail' build.sales_order.id build.sales_order as link %} | ||||||
|  |         {% blocktrans %}This Build Order is allocated to Sales Order {{link}}{% endblocktrans %} | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  |  | ||||||
|  |     {% if build.parent %} | ||||||
|  |     <div class='alert alert-block alert-info'> | ||||||
|  |         {% object_link 'build-detail' build.parent.id build.parent as link %} | ||||||
|  |         {% blocktrans %}This Build Order is a child of Build Order {{link}}{% endblocktrans %} | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  |  | ||||||
|  |     {% if build.active %} | ||||||
|  |     {% if build.can_complete %} | ||||||
|  |     <div class='alert alert-block alert-success'> | ||||||
|  |         {% trans "Build Order is ready to mark as completed" %} | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  |     {% if build.incomplete_count > 0 %} | ||||||
|  |     <div class='alert alert-block alert-danger'> | ||||||
|  |         {% trans "Build Order cannot be completed as outstanding outputs remain" %} | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  |     {% if build.completed < build.quantity %} | ||||||
|  |     <div class='alert alert-block alert-warning'> | ||||||
|  |         {% trans "Required build quantity has not yet been completed" %} | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  |     {% if not build.areUntrackedPartsFullyAllocated %} | ||||||
|  |     <div class='alert alert-block alert-warning'> | ||||||
|  |         {% trans "Stock has not been fully allocated to this Build Order" %} | ||||||
|  |     </div> | ||||||
|     {% endif %} |     {% endif %} | ||||||
|     {% endif %} |     {% endif %} | ||||||
| </div> | </div> | ||||||
| @@ -133,44 +177,6 @@ src="{% static 'img/blank_image.png' %}" | |||||||
|     </tr> |     </tr> | ||||||
|     {% endif %} |     {% endif %} | ||||||
| </table> | </table> | ||||||
| <div class='info-messages'> |  | ||||||
|     {% if build.sales_order %} |  | ||||||
|     <div class='alert alert-block alert-info'> |  | ||||||
|         {% object_link 'so-detail' build.sales_order.id build.sales_order as link %} |  | ||||||
|         {% blocktrans %}This Build Order is allocated to Sales Order {{link}}{% endblocktrans %} |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|  |  | ||||||
|     {% if build.parent %} |  | ||||||
|     <div class='alert alert-block alert-info'> |  | ||||||
|         {% object_link 'build-detail' build.parent.id build.parent as link %} |  | ||||||
|         {% blocktrans %}This Build Order is a child of Build Order {{link}}{% endblocktrans %} |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|  |  | ||||||
|     {% if build.active %} |  | ||||||
|     {% if build.can_complete %} |  | ||||||
|     <div class='alert alert-block alert-success'> |  | ||||||
|         {% trans "Build Order is ready to mark as completed" %} |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if build.incomplete_count > 0 %} |  | ||||||
|     <div class='alert alert-block alert-danger'> |  | ||||||
|         {% trans "Build Order cannot be completed as outstanding outputs remain" %} |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if build.completed < build.quantity %} |  | ||||||
|     <div class='alert alert-block alert-warning'> |  | ||||||
|         {% trans "Required build quantity has not yet been completed" %} |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if not build.areUntrackedPartsFullyAllocated %} |  | ||||||
|     <div class='alert alert-block alert-warning'> |  | ||||||
|         {% trans "Stock has not been fully allocated to this Build Order" %} |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
| </div> |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block page_data %} | {% block page_data %} | ||||||
|   | |||||||
| @@ -8,56 +8,58 @@ | |||||||
| {% inventree_title %} | {% trans "Company" %} - {{ company.name }} | {% inventree_title %} | {% trans "Company" %} - {{ company.name }} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_left %} | {% block heading %} | ||||||
| <div class='row g-0'> | {% trans "Company" %}: {{ company.name }} | ||||||
|     <div class='col-md-4'> | {% endblock %} | ||||||
|         <div class='dropzone part-thumb-container' id='company-thumb'> |  | ||||||
|             <img class="part-thumb" id='company-image' | {% block actions %} | ||||||
|             {% if company.image %} | <!-- Admin View --> | ||||||
|             src="{{ company.image.url }}" | {% if user.is_staff and perms.company.change_company %} | ||||||
|             {% else %} | {% url 'admin:company_company_change' company.pk as url %} | ||||||
|             src="{% static 'img/blank_image.png' %}" | {% include "admin_button.html" with url=url %} | ||||||
|             {% endif %}/> | {% endif %} | ||||||
|             <div class='btn-row part-thumb-overlay'> | {% if company.is_supplier and roles.purchase_order.add %} | ||||||
|                 <div class='btn-group'> | <button type='button' class='btn btn-outline-secondary' id='company-order-2' title='{% trans "Create Purchase Order" %}'> | ||||||
|                     <button type='button' class='btn btn-outline-secondary' title='{% trans "Upload new image" %}' id='company-image-upload'><span class='fas fa-file-upload'></span></button> |     <span class='fas fa-shopping-cart'/> | ||||||
|                     {% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %} | </button> | ||||||
|                     {% if allow_download %} | {% endif %} | ||||||
|                     <button type='button' class='btn btn-outline-secondary' title="{% trans 'Download image from URL' %}" id='company-image-url'><span class='fas fa-cloud-download-alt'></span></button> | {% if perms.company.change_company %} | ||||||
|                     {% endif %} | <button type='button' class='btn btn-outline-secondary' id='company-edit' title='{% trans "Edit company information" %}'> | ||||||
|                 </div> |     <span class='fas fa-edit icon-green'/> | ||||||
|             </div> | </button> | ||||||
|         </div> | {% endif %} | ||||||
|     </div> | {% if perms.company.delete_company %} | ||||||
|     <div class='col-md-8'> | <button type='button' class='btn btn-outline-secondary' id='company-delete' title='{% trans "Delete Company" %}'> | ||||||
|         <h4> |     <span class='fas fa-trash-alt icon-red'/> | ||||||
|             {{ company.name }} | </button> | ||||||
|             {% if user.is_staff and perms.company.change_company %} | {% endif %} | ||||||
|             <a  href="{% url 'admin:company_company_change' company.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a> | {% endblock %} | ||||||
|             {% endif %} |  | ||||||
|         </h4> | {% block thumbnail %} | ||||||
|         <p>{{ company.description }}</p> | <div class='dropzone part-thumb-container' id='company-thumb'> | ||||||
|         <div class='btn-group' role='group'> |     <img class="part-thumb" id='company-image' | ||||||
|             {% if company.is_supplier and roles.purchase_order.add %} |     {% if company.image %} | ||||||
|             <button type='button' class='btn btn-outline-secondary' id='company-order-2' title='{% trans "Create Purchase Order" %}'> |     src="{{ company.image.url }}" | ||||||
|                 <span class='fas fa-shopping-cart'/> |     {% else %} | ||||||
|             </button> |     src="{% static 'img/blank_image.png' %}" | ||||||
|             {% endif %} |     {% endif %}/> | ||||||
|             {% if perms.company.change_company %} |     <div class='btn-row part-thumb-overlay'> | ||||||
|             <button type='button' class='btn btn-outline-secondary' id='company-edit' title='{% trans "Edit company information" %}'> |         <div class='btn-group'> | ||||||
|                 <span class='fas fa-edit icon-green'/> |             <button type='button' class='btn btn-outline-secondary' title='{% trans "Upload new image" %}' id='company-image-upload'><span class='fas fa-file-upload'></span></button> | ||||||
|             </button> |             {% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %} | ||||||
|             {% endif %} |             {% if allow_download %} | ||||||
|             {% if perms.company.delete_company %} |             <button type='button' class='btn btn-outline-secondary' title="{% trans 'Download image from URL' %}" id='company-image-url'><span class='fas fa-cloud-download-alt'></span></button> | ||||||
|             <button type='button' class='btn btn-outline-secondary' id='company-delete' title='{% trans "Delete Company" %}'> |  | ||||||
|                 <span class='fas fa-trash-alt icon-red'/> |  | ||||||
|             </button> |  | ||||||
|             {% endif %} |             {% endif %} | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
| </div> | </div> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block details %} | ||||||
|  | <p>{{ company.description }}</p> | ||||||
|  |  | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_right %} | {% block details_right %} | ||||||
|  |  | ||||||
| <table class="table table-striped table-condensed"> | <table class="table table-striped table-condensed"> | ||||||
|   | |||||||
| @@ -18,6 +18,36 @@ InvenTree | {% trans "Manufacturer Part" %} | |||||||
| <li class="breadcrumb-item active" aria-current="page"><a href='{% url "manufacturer-part-detail" part.id %}'>{{ part.MPN }}</a></li> | <li class="breadcrumb-item active" aria-current="page"><a href='{% url "manufacturer-part-detail" part.id %}'>{{ part.MPN }}</a></li> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block heading %} | ||||||
|  | <h4> | ||||||
|  |     {% trans "Manufacturer Part" %}: {{ part.part.full_name }} | ||||||
|  | </h4> | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block actions %} | ||||||
|  | {% if user.is_staff and perms.company.change_company %} | ||||||
|  | {% url 'admin:company_supplierpart_change' part.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  | {% if roles.purchase_order.change %} | ||||||
|  | {% comment "for later" %} | ||||||
|  | {% if roles.purchase_order.add %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='order-part' title='{% trans "Order part" %}'> | ||||||
|  |     <span class='fas fa-shopping-cart'></span> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endcomment %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='edit-part' title='{% trans "Edit manufacturer part" %}'> | ||||||
|  |     <span class='fas fa-edit icon-green'/> | ||||||
|  | </button> | ||||||
|  | {% if roles.purchase_order.delete %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='delete-part' title='{% trans "Delete manufacturer part" %}'> | ||||||
|  |     <span class='fas fa-trash-alt icon-red'/> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block thumbnail %} | {% block thumbnail %} | ||||||
| <img class='part-thumb' | <img class='part-thumb' | ||||||
| {% if part.part.image %} | {% if part.part.image %} | ||||||
| @@ -28,34 +58,6 @@ src="{% static 'img/blank_image.png' %}" | |||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details %} | {% block details %} | ||||||
| <h4> |  | ||||||
|     {% trans "Manufacturer Part" %}: {{ part.part.full_name }} |  | ||||||
|     {% if user.is_staff and perms.company.change_company %} |  | ||||||
|     <a href="{% url 'admin:company_supplierpart_change' part.pk %}"> |  | ||||||
|         <span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span> |  | ||||||
|     </a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
|  |  | ||||||
| {% if roles.purchase_order.change %} |  | ||||||
| <div class='btn-group' role='group'> |  | ||||||
|     {% comment "for later" %} |  | ||||||
|     {% if roles.purchase_order.add %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='order-part' title='{% trans "Order part" %}'> |  | ||||||
|         <span class='fas fa-shopping-cart'></span> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endcomment %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='edit-part' title='{% trans "Edit manufacturer part" %}'> |  | ||||||
|         <span class='fas fa-edit icon-green'/> |  | ||||||
|     </button> |  | ||||||
|     {% if roles.purchase_order.delete %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='delete-part' title='{% trans "Delete manufacturer part" %}'> |  | ||||||
|         <span class='fas fa-trash-alt icon-red'/> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
| </div> |  | ||||||
| {% endif %} |  | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,6 +19,32 @@ | |||||||
| <li class="breadcrumb-item active" aria-current="page"><a href='{% url "supplier-part-detail" part.id %}'>{{ part.SKU }}</a></li> | <li class="breadcrumb-item active" aria-current="page"><a href='{% url "supplier-part-detail" part.id %}'>{{ part.SKU }}</a></li> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block heading %} | ||||||
|  | <h4> | ||||||
|  |     {% trans "Supplier Part" %}: {{ part.SKU }} | ||||||
|  | </h4> | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block actions %} | ||||||
|  | {% if user.is_staff and perms.company.change_company %} | ||||||
|  | {% url 'admin:company_supplierpart_change' part.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  | {% if roles.purchase_order.add %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='order-part' title='{% trans "Order part" %}'> | ||||||
|  |     <span class='fas fa-shopping-cart'></span> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='edit-part' title='{% trans "Edit supplier part" %}'> | ||||||
|  |     <span class='fas fa-edit icon-green'/> | ||||||
|  | </button> | ||||||
|  | {% if roles.purchase_order.delete %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='delete-part' title='{% trans "Delete supplier part" %}'> | ||||||
|  |     <span class='fas fa-trash-alt icon-red'/> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block thumbnail %} | {% block thumbnail %} | ||||||
| <img class='part-thumb' | <img class='part-thumb' | ||||||
| {% if part.part.image %} | {% if part.part.image %} | ||||||
| @@ -29,38 +55,11 @@ src="{% static 'img/blank_image.png' %}" | |||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details %} | {% block details %} | ||||||
| <h4> |  | ||||||
|     {% trans "Supplier Part" %}: {{ part.SKU }} |  | ||||||
|     {% if user.is_staff and perms.company.change_company %} |  | ||||||
|     <a href="{% url 'admin:company_supplierpart_change' part.pk %}"> |  | ||||||
|         <span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span> |  | ||||||
|     </a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
| <p> | <p> | ||||||
|     {{ part.part.full_name }} |     {{ part.part.full_name }} | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| {% if roles.purchase_order.change %} |  | ||||||
| <div class='btn-row'> |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         {% if roles.purchase_order.add %} |  | ||||||
|         <button type='button' class='btn btn-outline-secondary' id='order-part' title='{% trans "Order part" %}'> |  | ||||||
|             <span class='fas fa-shopping-cart'></span> |  | ||||||
|         </button> |  | ||||||
|         {% endif %} |  | ||||||
|         <button type='button' class='btn btn-outline-secondary' id='edit-part' title='{% trans "Edit supplier part" %}'> |  | ||||||
|             <span class='fas fa-edit icon-green'/> |  | ||||||
|         </button> |  | ||||||
|         {% if roles.purchase_order.delete %} |  | ||||||
|         <button type='button' class='btn btn-outline-secondary' id='delete-part' title='{% trans "Delete supplier part" %}'> |  | ||||||
|             <span class='fas fa-trash-alt icon-red'/> |  | ||||||
|         </button> |  | ||||||
|         {% endif %} |  | ||||||
|     </div> |  | ||||||
| </div> |  | ||||||
| {% endif %} |  | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_right %} | {% block details_right %} | ||||||
|   | |||||||
| @@ -14,6 +14,53 @@ | |||||||
| <li class="breadcrumb-item active" aria-current="page"><a href='{% url "po-detail" order.id %}'>{{ order }}</a></li> | <li class="breadcrumb-item active" aria-current="page"><a href='{% url "po-detail" order.id %}'>{{ order }}</a></li> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block heading %} | ||||||
|  | {% trans "Purchase Order" %}: {{ order.reference }} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block actions %} | ||||||
|  | {% if user.is_staff and roles.purchase_order.change %} | ||||||
|  | {% url 'admin:order_purchaseorder_change' order.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  | <!-- Printing options --> | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='print-options' title='{% trans "Print actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-print'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='print-order-report'><span class='fas fa-file-pdf'></span> {% trans "Print purchase order report" %}</a></li> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='export-order'><span class='fas fa-file-download'></span> {% trans "Export order to file" %}</a></li> | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% if roles.purchase_order.change %} | ||||||
|  | <!-- order actions --> | ||||||
|  | <div class='btn-group'> | ||||||
|  |     <button id='order-options' title='{% trans "Order actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-tools'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='edit-order'><span class='fas fa-edit icon-green'></span> {% trans "Edit order" %}</a></li> | ||||||
|  |         {% if order.can_cancel %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='cancel-order'><span class='fas fa-times-circle icon-red'></span> {% trans "Cancel order" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='place-order' title='{% trans "Place order" %}'> | ||||||
|  |     <span class='fas fa-shopping-cart icon-blue'></span> | ||||||
|  | </button> | ||||||
|  | {% elif order.status == PurchaseOrderStatus.PLACED %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='receive-order' title='{% trans "Receive items" %}'> | ||||||
|  |     <span class='fas fa-sign-in-alt icon-blue'></span> | ||||||
|  | </button> | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='complete-order' title='{% trans "Mark order as complete" %}'> | ||||||
|  |     <span class='fas fa-check-circle icon-green'></span> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block thumbnail %} | {% block thumbnail %} | ||||||
| <img class='part-thumb' | <img class='part-thumb' | ||||||
| {% if order.supplier.image %} | {% if order.supplier.image %} | ||||||
| @@ -25,12 +72,7 @@ src="{% static 'img/blank_image.png' %}" | |||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details %} | {% block details %} | ||||||
| <h4> |  | ||||||
|     {% trans "Purchase Order" %}: {{ order.reference }} |  | ||||||
|     {% if user.is_staff and roles.purchase_order.change %} |  | ||||||
|     <a href="{% url 'admin:order_purchaseorder_change' order.pk %}"><span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span></a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
| <h4> | <h4> | ||||||
|     {% purchase_order_status_label order.status large=True %} |     {% purchase_order_status_label order.status large=True %} | ||||||
|     {% if order.is_overdue %} |     {% if order.is_overdue %} | ||||||
| @@ -38,44 +80,7 @@ src="{% static 'img/blank_image.png' %}" | |||||||
|     {% endif %} |     {% endif %} | ||||||
| </h4> | </h4> | ||||||
| <p>{{ order.description }}{% include "clip.html"%}</p> | <p>{{ order.description }}{% include "clip.html"%}</p> | ||||||
| <div class='btn-group' role='group'> |  | ||||||
|     <!-- Printing options --> |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='print-options' title='{% trans "Print actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-print'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='print-order-report'><span class='fas fa-file-pdf'></span> {% trans "Print purchase order report" %}</a></li> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='export-order'><span class='fas fa-file-download'></span> {% trans "Export order to file" %}</a></li> |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% if roles.purchase_order.change %} |  | ||||||
|     <!-- order actions --> |  | ||||||
|     <div class='btn-group'> |  | ||||||
|         <button id='order-options' title='{% trans "Order actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-tools'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='edit-order'><span class='fas fa-edit icon-green'></span> {% trans "Edit order" %}</a></li> |  | ||||||
|             {% if order.can_cancel %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='cancel-order'><span class='fas fa-times-circle icon-red'></span> {% trans "Cancel order" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='place-order' title='{% trans "Place order" %}'> |  | ||||||
|         <span class='fas fa-shopping-cart icon-blue'></span> |  | ||||||
|     </button> |  | ||||||
|     {% elif order.status == PurchaseOrderStatus.PLACED %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='receive-order' title='{% trans "Receive items" %}'> |  | ||||||
|         <span class='fas fa-sign-in-alt icon-blue'></span> |  | ||||||
|     </button> |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='complete-order' title='{% trans "Mark order as complete" %}'> |  | ||||||
|         <span class='fas fa-check-circle icon-green'></span> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
| </div> |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_right %} | {% block details_right %} | ||||||
|   | |||||||
| @@ -24,14 +24,52 @@ src="{% static 'img/blank_image.png' %}" | |||||||
| /> | /> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block heading %} | ||||||
|  | {% trans "Sales Order" %} {{ order.reference }} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block actions %} | ||||||
|  | {% if user.is_staff and roles.sales_order.change %} | ||||||
|  | {% url 'admin:order_salesorder_change' order.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  | <!-- Printing actions --> | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='print-options' title='{% trans "Print actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-print'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='print-order-report'><span class='fas fa-file-pdf'></span> {% trans "Print sales order report" %}</a></li> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='export-order'><span class='fas fa-file-download'></span> {% trans "Export order to file" %}</a></li> | ||||||
|  |         <!-- | ||||||
|  |         <li><a href='#' id='print-packing-list'><span class='fas fa-clipboard-list'></span>{% trans "Print packing list" %}</a></li> | ||||||
|  |         --> | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% if roles.sales_order.change %} | ||||||
|  | <!-- Order actions --> | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='order-options' title='{% trans "Order actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-tools'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='edit-order'><span class='fas fa-edit icon-green'></span> {% trans "Edit order" %}</a></li> | ||||||
|  |         {% if order.status == SalesOrderStatus.PENDING %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='cancel-order'><span class='fas fa-times-circle icon-red'></span> {% trans "Cancel order" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  |  | ||||||
|  | </div> | ||||||
|  | {% if order.status == SalesOrderStatus.PENDING %} | ||||||
|  | <button type='button' class='btn btn-success' id='ship-order' title='{% trans "Ship Order" %}'> | ||||||
|  |     <span class='fas fa-truck'></span> {% trans "Ship Order" %} | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block details %} | {% block details %} | ||||||
|  |  | ||||||
| <h4> |  | ||||||
|     {% trans "Sales Order" %} {{ order.reference }} |  | ||||||
|     {% if user.is_staff and roles.sales_order.change %} |  | ||||||
|     <a href="{% url 'admin:order_salesorder_change' order.pk %}"><span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span></a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
| <h4> | <h4> | ||||||
|     {% sales_order_status_label order.status large=True %} |     {% sales_order_status_label order.status large=True %} | ||||||
|     {% if order.is_overdue %} |     {% if order.is_overdue %} | ||||||
| @@ -39,42 +77,7 @@ src="{% static 'img/blank_image.png' %}" | |||||||
|     {% endif %} |     {% endif %} | ||||||
| </h4> | </h4> | ||||||
| <p>{{ order.description }}{% include "clip.html"%}</p> | <p>{{ order.description }}{% include "clip.html"%}</p> | ||||||
| <div class='btn-group' role='group'> |  | ||||||
|     <!-- Printing actions --> |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='print-options' title='{% trans "Print actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-print'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='print-order-report'><span class='fas fa-file-pdf'></span> {% trans "Print sales order report" %}</a></li> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='export-order'><span class='fas fa-file-download'></span> {% trans "Export order to file" %}</a></li> |  | ||||||
|             <!-- |  | ||||||
|             <li><a href='#' id='print-packing-list'><span class='fas fa-clipboard-list'></span>{% trans "Print packing list" %}</a></li> |  | ||||||
|             --> |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% if roles.sales_order.change %} |  | ||||||
|     <!-- Order actions --> |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='order-options' title='{% trans "Order actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-tools'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='edit-order'><span class='fas fa-edit icon-green'></span> {% trans "Edit order" %}</a></li> |  | ||||||
|             {% if order.status == SalesOrderStatus.PENDING %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='cancel-order'><span class='fas fa-times-circle icon-red'></span> {% trans "Cancel order" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|         </ul> |  | ||||||
|  |  | ||||||
|     </div> |  | ||||||
|     {% if order.status == SalesOrderStatus.PENDING %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='ship-order' title='{% trans "Ship order" %}'> |  | ||||||
|         <span class='fas fa-truck icon-blue'></span> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
| </div> |  | ||||||
| {% block below_thumbnail %} |  | ||||||
| <div class='info-messages'> | <div class='info-messages'> | ||||||
|     {% if order.status == SalesOrderStatus.PENDING and not order.is_fully_allocated %} |     {% if order.status == SalesOrderStatus.PENDING and not order.is_fully_allocated %} | ||||||
|     <div class='alert alert-block alert-danger'> |     <div class='alert alert-block alert-danger'> | ||||||
| @@ -82,7 +85,7 @@ src="{% static 'img/blank_image.png' %}" | |||||||
|     </div> |     </div> | ||||||
|     {% endif %} |     {% endif %} | ||||||
| </div> | </div> | ||||||
|     {% endblock %} |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_right %} | {% block details_right %} | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| {% load i18n %} | {% load i18n %} | ||||||
|  |  | ||||||
| <li><a href='#' id='toggle-part-tree'><strong><span class='fas fa-stream'></span></strong></a></li> |  | ||||||
| <li class="breadcrumb-item{% if category is None %} active" aria-current="page{% endif %}"><a href="/part/">{% trans "Parts" %}</a></li> | <li class="breadcrumb-item{% if category is None %} active" aria-current="page{% endif %}"><a href="/part/">{% trans "Parts" %}</a></li> | ||||||
| {% if category %} | {% if category %} | ||||||
| {% for path_item in category.parentpath %} | {% for path_item in category.parentpath %} | ||||||
|   | |||||||
| @@ -6,42 +6,45 @@ | |||||||
| {% include 'part/category_sidebar.html' %} | {% include 'part/category_sidebar.html' %} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block heading %} | ||||||
|  | {% if category %} | ||||||
|  | {% trans "Part Category" %}: {{ category.name }} | ||||||
|  | {% else %} | ||||||
|  | {% trans "Parts" %} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block actions %} | ||||||
|  | {% if user.is_staff and roles.part_category.change %} | ||||||
|  | {% url 'admin:part_partcategory_change' category.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  | {% if category %} | ||||||
|  | {% if roles.part_category.change %} | ||||||
|  | <button class='btn btn-outline-secondary' id='cat-edit' title='{% trans "Edit part category" %}'> | ||||||
|  |     <span class='fas fa-edit'/> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% if roles.part_category.delete %} | ||||||
|  | <button class='btn btn-outline-secondary' id='cat-delete' title='{% trans "Delete part category" %}'> | ||||||
|  |     <span class='fas fa-trash-alt icon-red'/> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% if roles.part_category.add %} | ||||||
|  | <button class='btn btn-success' id='cat-create' title='{% trans "Create new part category" %}'> | ||||||
|  |     <span class='fas fa-plus-circle'></span> {% trans "Add Category" %} | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_left %} | {% block details_left %} | ||||||
| {% if category %} | {% if category %} | ||||||
| <h4> |  | ||||||
|     {% trans "Part Category" %}: {{ category.name }} |  | ||||||
|     {% if user.is_staff and roles.part_category.change %} |  | ||||||
|     <a href="{% url 'admin:part_partcategory_change' category.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
| <p>{{ category.description }}</p> | <p>{{ category.description }}</p> | ||||||
| {% else %} | {% else %} | ||||||
| <h4> |  | ||||||
|     {% trans "Parts" %} |  | ||||||
| </h4> |  | ||||||
| <p>{% trans "Top level part category" %}</p> | <p>{% trans "Top level part category" %}</p> | ||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
| <div class='btn-group' role='group'> |  | ||||||
|     {% if roles.part_category.add %} |  | ||||||
|     <button class='btn btn-success' id='cat-create' title='{% trans "Create new part category" %}'> |  | ||||||
|         <span class='fas fa-plus-circle icon-green'/> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if category %} |  | ||||||
|     {% if roles.part_category.change %} |  | ||||||
|     <button class='btn btn-outline-secondary' id='cat-edit' title='{% trans "Edit part category" %}'> |  | ||||||
|         <span class='fas fa-edit icon-blue'/> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if roles.part_category.delete %} |  | ||||||
|     <button class='btn btn-outline-secondary' id='cat-delete' title='{% trans "Delete part category" %}'> |  | ||||||
|         <span class='fas fa-trash-alt icon-red'/> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_right %} | {% block details_right %} | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ | |||||||
| {% load markdownify %} | {% load markdownify %} | ||||||
|  |  | ||||||
| {% block sidebar %} | {% block sidebar %} | ||||||
| {% include 'part/sidebar.html' %} | {% include 'part/part_sidebar.html' %} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block page_content %} | {% block page_content %} | ||||||
|   | |||||||
| @@ -12,14 +12,84 @@ | |||||||
| {% include "part/part_thumb.html" %} | {% include "part/part_thumb.html" %} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block heading %} | ||||||
|  | {{ part.full_name }} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block actions %} | ||||||
|  | <!-- Admin View --> | ||||||
|  | {% if user.is_staff and roles.part.change %} | ||||||
|  | {% url 'admin:part_part_change' part.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  |  | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='toggle-starred' title='{% trans "Star this part" %}'> | ||||||
|  |     <span id='part-star-icon' class='fas fa-star {% if starred %}icon-yellow{% endif %}'/> | ||||||
|  | </button> | ||||||
|  |  | ||||||
|  | {% if barcodes %} | ||||||
|  | <!-- Barcode actions menu --> | ||||||
|  | <div class='btn-group'> | ||||||
|  |     <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button> | ||||||
|  |     <ul class='dropdown-menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% endif %} | ||||||
|  | {% if part.active %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='price-button' title='{% trans "Show pricing information" %}'> | ||||||
|  |     <span id='part-price-icon' class='fas fa-dollar-sign'/> | ||||||
|  | </button> | ||||||
|  | {% if roles.stock.change %} | ||||||
|  | <div class='btn-group'> | ||||||
|  |     <button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-boxes'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu'> | ||||||
|  |         <li> | ||||||
|  |             <a class='dropdown-item' href='#' id='part-count'> | ||||||
|  |                 <span class='fas fa-clipboard-list'></span> | ||||||
|  |                 {% trans "Count part stock" %} | ||||||
|  |             </a> | ||||||
|  |         </li> | ||||||
|  |         <li> | ||||||
|  |             <a class='dropdown-item' href='#' id='part-move'> | ||||||
|  |                 <span class='fas fa-exchange-alt'></span> | ||||||
|  |                 {% trans "Transfer part stock" %} | ||||||
|  |             </a> | ||||||
|  |         </li> | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% endif %} | ||||||
|  | {% if part.purchaseable and roles.purchase_order.add %} | ||||||
|  | <button type='button' class='btn btn-outline-secondary' id='part-order' title='{% trans "Order part" %}'> | ||||||
|  |     <span id='part-order-icon' class='fas fa-shopping-cart'/> | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | <!-- Part actions --> | ||||||
|  | {% if roles.part.add or roles.part.change or roles.part.delete %} | ||||||
|  | <div class='btn-group'> | ||||||
|  |     <button id='part-actions' title='{% trans "Part actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> <span class='fas fa-shapes'></span> <span class='caret'></span></button> | ||||||
|  |     <ul class='dropdown-menu'> | ||||||
|  |         {% if roles.part.add %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='part-duplicate'><span class='fas fa-copy'></span> {% trans "Duplicate part" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |         {% if roles.part.change %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='part-edit'><span class='fas fa-edit icon-blue'></span> {% trans "Edit part" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |         {% if roles.part.delete %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='part-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete part" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
| {% block details %} | {% block details %} | ||||||
|  |  | ||||||
| <h4> |  | ||||||
|     {{ part.full_name }} |  | ||||||
|     <!-- Admin View --> |  | ||||||
|     {% if user.is_staff and roles.part.change %} |  | ||||||
|     <a  href="{% url 'admin:part_part_change' part.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>  |  | ||||||
|     {% endif %} |  | ||||||
| </h4> | </h4> | ||||||
| <!-- Properties --> | <!-- Properties --> | ||||||
| <h4> | <h4> | ||||||
| @@ -67,72 +137,7 @@ | |||||||
|     </div> |     </div> | ||||||
| </h4> | </h4> | ||||||
|  |  | ||||||
| <!-- Part Actions --> |  | ||||||
| <div class='btn-group' role='group'> |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='toggle-starred' title='{% trans "Star this part" %}'> |  | ||||||
|         <span id='part-star-icon' class='fas fa-star {% if starred %}icon-yellow{% endif %}'/> |  | ||||||
|     </button> |  | ||||||
|  |  | ||||||
|     {% if barcodes %} |  | ||||||
|     <!-- Barcode actions menu --> |  | ||||||
|     <div class='btn-group'> |  | ||||||
|         <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button> |  | ||||||
|         <ul class='dropdown-menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if part.active %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='price-button' title='{% trans "Show pricing information" %}'> |  | ||||||
|         <span id='part-price-icon' class='fas fa-dollar-sign'/> |  | ||||||
|     </button> |  | ||||||
|     {% if roles.stock.change %} |  | ||||||
|     <div class='btn-group'> |  | ||||||
|         <button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-boxes'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu'> |  | ||||||
|             <li> |  | ||||||
|                 <a class='dropdown-item' href='#' id='part-count'> |  | ||||||
|                     <span class='fas fa-clipboard-list'></span> |  | ||||||
|                     {% trans "Count part stock" %} |  | ||||||
|                 </a> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|                 <a class='dropdown-item' href='#' id='part-move'> |  | ||||||
|                     <span class='fas fa-exchange-alt'></span> |  | ||||||
|                     {% trans "Transfer part stock" %} |  | ||||||
|                 </a> |  | ||||||
|             </li> |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     {% if part.purchaseable and roles.purchase_order.add %} |  | ||||||
|     <button type='button' class='btn btn-outline-secondary' id='part-order' title='{% trans "Order part" %}'> |  | ||||||
|         <span id='part-order-icon' class='fas fa-shopping-cart'/> |  | ||||||
|     </button> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
|     <!-- Part actions --> |  | ||||||
|     {% if roles.part.add or roles.part.change or roles.part.delete %} |  | ||||||
|     <div class='btn-group'> |  | ||||||
|         <button id='part-actions' title='{% trans "Part actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> <span class='fas fa-shapes'></span> <span class='caret'></span></button> |  | ||||||
|         <ul class='dropdown-menu'> |  | ||||||
|             {% if roles.part.add %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='part-duplicate'><span class='fas fa-copy'></span> {% trans "Duplicate part" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|             {% if roles.part.change %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='part-edit'><span class='fas fa-edit icon-blue'></span> {% trans "Edit part" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|             {% if roles.part.delete %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='part-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete part" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <!-- Part info messages --> | <!-- Part info messages --> | ||||||
| <div class='info-messages'> | <div class='info-messages'> | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| {% decimal total_stock %} | {% decimal total_stock %} | ||||||
|  |  | ||||||
| {% if total_stock == 0 %} | {% if total_stock == 0 %} | ||||||
| <span class='badge rounded-pill bg-danger'>{% trans "No Stock" %}</span> | <span class='badge badge-right rounded-pill bg-danger'>{% trans "No Stock" %}</span> | ||||||
| {% elif total_stock < part.minimum_stock %} | {% elif total_stock < part.minimum_stock %} | ||||||
| <span class='badge rounded-pill bg-warning'>{% trans "Low Stock" %}</span> | <span class='badge badge-right rounded-pill bg-warning'>{% trans "Low Stock" %}</span> | ||||||
| {% endif %} | {% endif %} | ||||||
| @@ -13,9 +13,105 @@ | |||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block heading %} | {% block heading %} | ||||||
| <h4> |     {% trans "Stock Item" %}: {{ item.part.full_name}} | ||||||
|     {% trans "Stock Item Details" %} | {% endblock %} | ||||||
| </h4> |  | ||||||
|  | {% block actions %} | ||||||
|  |  | ||||||
|  | {% if user.is_staff and roles.stock.change %} | ||||||
|  | {% url 'admin:stock_stockitem_change' item.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
|  | {% endif %} | ||||||
|  | {% if barcodes %} | ||||||
|  | <!-- Barcode actions menu --> | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-qrcode'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> | ||||||
|  |         {% if roles.stock.change %} | ||||||
|  |         {% if item.uid %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='barcode-unlink'><span class='fas fa-unlink'></span> {% trans "Unlink Barcode" %}</a></li> | ||||||
|  |         {% else %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='barcode-link'><span class='fas fa-link'></span> {% trans "Link Barcode" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='barcode-scan-into-location'><span class='fas fa-sitemap'></span> {% trans "Scan to Location" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% endif %} | ||||||
|  | <!-- Document / label menu --> | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='document-options' title='{% trans "Printing actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-print'></span> <span class='caret'></span></button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> | ||||||
|  |         {% if test_report_enabled %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='stock-test-report'><span class='fas fa-file-pdf'></span> {% trans "Test Report" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | <!-- Stock adjustment menu --> | ||||||
|  | <!-- Check permissions and owner --> | ||||||
|  | {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} | ||||||
|  |     {% if roles.stock.change and not item.is_building %} | ||||||
|  |     <div class='btn-group'> | ||||||
|  |         <button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button> | ||||||
|  |         <ul class='dropdown-menu' role='menu'> | ||||||
|  |             {% if not item.serialized %} | ||||||
|  |             {% if item.in_stock %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-count' title='{% trans "Count stock" %}'><span class='fas fa-clipboard-list'></span> {% trans "Count stock" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if not item.customer %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-add' title='{% trans "Add stock" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if item.in_stock %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-remove' title='{% trans "Remove stock" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if item.in_stock and item.part.trackable %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-serialize' title='{% trans "Serialize stock" %}'><span class='fas fa-hashtag'></span> {% trans "Serialize stock" %}</a> </li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% endif %} | ||||||
|  |             {% if item.in_stock and item.can_adjust_location %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-move' title='{% trans "Transfer stock" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if item.in_stock and item.can_adjust_location and item.part.salable and not item.customer %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-assign-to-customer' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if item.customer %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if item.belongs_to %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-uninstall' title='{% trans "Uninstall stock item" %}'><span class='fas fa-unlink'></span> {% trans "Uninstall" %}</a></li> | ||||||
|  |             {% else %} | ||||||
|  |             {% if item.part.get_used_in %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-install-in' title='{% trans "Install stock item" %}'><span class='fas fa-link'></span> {% trans "Install" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% endif %} | ||||||
|  |         </ul> | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  |     <!-- Edit stock item --> | ||||||
|  |     {% if roles.stock.change and not item.is_building %} | ||||||
|  |     <div class='btn-group'> | ||||||
|  |         <button id='stock-edit-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-tools'></span> <span class='caret'></span></button> | ||||||
|  |         <ul class='dropdown-menu' role='menu'> | ||||||
|  |             {% if item.part.can_convert %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-convert' title='{% trans "Convert to variant" %}'><span class='fas fa-screwdriver'></span> {% trans "Convert to variant" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if roles.stock.add %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-duplicate' title='{% trans "Duplicate stock item" %}'><span class='fas fa-copy'></span> {% trans "Duplicate stock item" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-edit' title='{% trans "Edit stock item" %}'><span class='fas fa-edit icon-blue'></span> {% trans "Edit stock item" %}</a></li> | ||||||
|  |             {% if user.is_staff or roles.stock.delete %} | ||||||
|  |             {% if item.can_delete %} | ||||||
|  |             <li><a class='dropdown-item' href='#' id='stock-delete' title='{% trans "Delete stock item" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete stock item" %}</a></li> | ||||||
|  |             {% endif %} | ||||||
|  |             {% endif %} | ||||||
|  |         </ul> | ||||||
|  |     </div> | ||||||
|  |     {% endif %} | ||||||
|  | {% endif %} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block thumbnail %} | {% block thumbnail %} | ||||||
| @@ -29,19 +125,6 @@ | |||||||
|     {% authorized_owners item.owner as owners %} |     {% authorized_owners item.owner as owners %} | ||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
| <h4> |  | ||||||
|     {{ item.part.full_name}} |  | ||||||
|     {% if roles.part.view %} |  | ||||||
|     {% endif %} |  | ||||||
|     {% if item.serialized %} |  | ||||||
|     # {{ item.serial }} |  | ||||||
|     {% else %} |  | ||||||
|     × {% decimal item.quantity %} |  | ||||||
|     {% endif %} |  | ||||||
|     {% if user.is_staff and roles.stock.change %} |  | ||||||
|     <a  href="{% url 'admin:stock_stockitem_change' item.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
| <h4> | <h4> | ||||||
|     {% if item.is_expired %} |     {% if item.is_expired %} | ||||||
|     <span class='badge rounded-pill bg-danger'>{% trans "Expired" %}</span> |     <span class='badge rounded-pill bg-danger'>{% trans "Expired" %}</span> | ||||||
| @@ -59,99 +142,7 @@ | |||||||
|     {% endif %} |     {% endif %} | ||||||
| </h4> | </h4> | ||||||
|  |  | ||||||
| <div class='btn-group' role='group'> |  | ||||||
|  |  | ||||||
|     {% if barcodes %} |  | ||||||
|     <!-- Barcode actions menu --> |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-qrcode'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> |  | ||||||
|             {% if roles.stock.change %} |  | ||||||
|             {% if item.uid %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='barcode-unlink'><span class='fas fa-unlink'></span> {% trans "Unlink Barcode" %}</a></li> |  | ||||||
|             {% else %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='barcode-link'><span class='fas fa-link'></span> {% trans "Link Barcode" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='barcode-scan-into-location'><span class='fas fa-sitemap'></span> {% trans "Scan to Location" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     {% endif %} |  | ||||||
|     <!-- Document / label menu --> |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='document-options' title='{% trans "Printing actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-print'></span> <span class='caret'></span></button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> |  | ||||||
|             {% if test_report_enabled %} |  | ||||||
|             <li><a class='dropdown-item' href='#' id='stock-test-report'><span class='fas fa-file-pdf'></span> {% trans "Test Report" %}</a></li> |  | ||||||
|             {% endif %} |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     <!-- Stock adjustment menu --> |  | ||||||
|     <!-- Check permissions and owner --> |  | ||||||
|     {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} |  | ||||||
|         {% if roles.stock.change and not item.is_building %} |  | ||||||
|         <div class='btn-group'> |  | ||||||
|             <button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button> |  | ||||||
|             <ul class='dropdown-menu' role='menu'> |  | ||||||
|                 {% if not item.serialized %} |  | ||||||
|                 {% if item.in_stock %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-count' title='{% trans "Count stock" %}'><span class='fas fa-clipboard-list'></span> {% trans "Count stock" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if not item.customer %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-add' title='{% trans "Add stock" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if item.in_stock %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-remove' title='{% trans "Remove stock" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if item.in_stock and item.part.trackable %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-serialize' title='{% trans "Serialize stock" %}'><span class='fas fa-hashtag'></span> {% trans "Serialize stock" %}</a> </li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if item.in_stock and item.can_adjust_location %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-move' title='{% trans "Transfer stock" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if item.in_stock and item.can_adjust_location and item.part.salable and not item.customer %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-assign-to-customer' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if item.customer %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if item.belongs_to %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-uninstall' title='{% trans "Uninstall stock item" %}'><span class='fas fa-unlink'></span> {% trans "Uninstall" %}</a></li> |  | ||||||
|                 {% else %} |  | ||||||
|                 {% if item.part.get_used_in %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-install-in' title='{% trans "Install stock item" %}'><span class='fas fa-link'></span> {% trans "Install" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% endif %} |  | ||||||
|             </ul> |  | ||||||
|         </div> |  | ||||||
|         {% endif %} |  | ||||||
|         <!-- Edit stock item --> |  | ||||||
|         {% if roles.stock.change and not item.is_building %} |  | ||||||
|         <div class='btn-group'> |  | ||||||
|             <button id='stock-edit-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-tools'></span> <span class='caret'></span></button> |  | ||||||
|             <ul class='dropdown-menu' role='menu'> |  | ||||||
|                 {% if item.part.can_convert %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-convert' title='{% trans "Convert to variant" %}'><span class='fas fa-screwdriver'></span> {% trans "Convert to variant" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% if roles.stock.add %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-duplicate' title='{% trans "Duplicate stock item" %}'><span class='fas fa-copy'></span> {% trans "Duplicate stock item" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-edit' title='{% trans "Edit stock item" %}'><span class='fas fa-edit icon-blue'></span> {% trans "Edit stock item" %}</a></li> |  | ||||||
|                 {% if user.is_staff or roles.stock.delete %} |  | ||||||
|                 {% if item.can_delete %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='stock-delete' title='{% trans "Delete stock item" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete stock item" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|                 {% endif %} |  | ||||||
|             </ul> |  | ||||||
|         </div> |  | ||||||
|         {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
| <div class='info-messages'> | <div class='info-messages'> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| {% load i18n %} | {% load i18n %} | ||||||
|  |  | ||||||
| <li><a href='#' title='Toggle Stock Tree' id='toggle-stock-tree'><strong><span class='fas fa-stream'></span></strong></a></li>   |  | ||||||
| <li class="breadcrumb-item{% if location is None %} active" aria-current="page{% endif %}"><a href="/stock/">{% trans "Stock" %}</a></li> | <li class="breadcrumb-item{% if location is None %} active" aria-current="page{% endif %}"><a href="/stock/">{% trans "Stock" %}</a></li> | ||||||
| {% if location %} | {% if location %} | ||||||
| {% for path_item in location.parentpath %} | {% for path_item in location.parentpath %} | ||||||
|   | |||||||
| @@ -7,79 +7,84 @@ | |||||||
| {% include "stock/location_sidebar.html" %} | {% include "stock/location_sidebar.html" %} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block details_left %} | {% block heading %} | ||||||
| {% if location %} | {% if location %} | ||||||
| <h4> | {% trans "Stock Location" %}: {{ location.name }} | ||||||
|     {% trans "Stock Location" %}: {{ location.name }} |  | ||||||
|     {% if user.is_staff and roles.stock_location.change %} |  | ||||||
|     <a  href="{% url 'admin:stock_stocklocation_change' location.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a> |  | ||||||
|     {% endif %} |  | ||||||
| </h4> |  | ||||||
| <p>{{ location.description }}</p> |  | ||||||
| {% else %} | {% else %} | ||||||
| <h4> | {% trans "Stock" %} | ||||||
|     {% trans "Stock" %} | {% endif %} | ||||||
| </h4> | {% endblock %} | ||||||
| <p>{% trans "Top level stock location" %}</p> |  | ||||||
|  | {% block actions %} | ||||||
|  | <!-- Admin view --> | ||||||
|  | {% if location and user.is_staff and roles.stock_location.change %} | ||||||
|  | {% url 'admin:stock_stocklocation_change' location.pk as url %} | ||||||
|  | {% include "admin_button.html" with url=url %} | ||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
|  | {% if barcodes %} | ||||||
|  | <!-- Barcode actions menu --> | ||||||
|  | {% if location %} | ||||||
| <div class='btn-group' role='group'> | <div class='btn-group' role='group'> | ||||||
|     {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %} |     <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button> | ||||||
|     {% if roles.stock_location.add %} |     <ul class='dropdown-menu'> | ||||||
|     <button class='btn btn-success' id='location-create' type='button' title='{% trans "Create new stock location" %}'> |         <li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> | ||||||
|         <span class='fas fa-plus-circle'></span> |         <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> | ||||||
|     </button> |         <li><a class='dropdown-item' href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li> | ||||||
|     {% endif %} |     </ul> | ||||||
|     {% endif %} |  | ||||||
|     {% if barcodes %} |  | ||||||
|     <!-- Barcode actions menu --> |  | ||||||
|     {% if location %} |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button> |  | ||||||
|         <ul class='dropdown-menu'> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li> |  | ||||||
|             <li><a class='dropdown-item' href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li> |  | ||||||
|         </ul> |  | ||||||
|     </div> |  | ||||||
|     <!-- Check permissions and owner --> |  | ||||||
|     {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} |  | ||||||
|     {% if roles.stock.change %} |  | ||||||
|     <div class='btn-group' role='group'> |  | ||||||
|         <button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> |  | ||||||
|             <span class='fas fa-boxes'></span> <span class='caret'></span> |  | ||||||
|         </button> |  | ||||||
|         <ul class='dropdown-menu' role='menu'> |  | ||||||
|             <li> |  | ||||||
|                 <a class='dropdown-item' href='#' id='location-count'> |  | ||||||
|                     <span class='fas fa-clipboard-list'></span> |  | ||||||
|                     {% trans "Count stock" %} |  | ||||||
|                 </a> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|                 <a class='dropdown-item' href='#' id='location-move'> |  | ||||||
|                     <span class='fas fa-exchange-alt'></span> |  | ||||||
|                     {% trans "Transfer stock" %} |  | ||||||
|                 </a> |  | ||||||
|             </li> |  | ||||||
|         </ul> |  | ||||||
|         </div> |  | ||||||
|         {% endif %} |  | ||||||
|         {% if roles.stock_location.change %} |  | ||||||
|         <div class='btn-group' role='group'> |  | ||||||
|             <button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button> |  | ||||||
|             <ul class='dropdown-menu' role='menu'> |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li> |  | ||||||
|                 {% if roles.stock.delete %} |  | ||||||
|                 <li><a class='dropdown-item' href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li> |  | ||||||
|                 {% endif %} |  | ||||||
|             </ul> |  | ||||||
|         </div> |  | ||||||
|         {% endif %} |  | ||||||
|         {% endif %} |  | ||||||
|         {% endif %} |  | ||||||
|     {% endif %} |  | ||||||
| </div> | </div> | ||||||
|  | <!-- Check permissions and owner --> | ||||||
|  | {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} | ||||||
|  | {% if roles.stock.change %} | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> | ||||||
|  |         <span class='fas fa-boxes'></span> <span class='caret'></span> | ||||||
|  |     </button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li> | ||||||
|  |             <a class='dropdown-item' href='#' id='location-count'> | ||||||
|  |                 <span class='fas fa-clipboard-list'></span> | ||||||
|  |                 {% trans "Count stock" %} | ||||||
|  |             </a> | ||||||
|  |         </li> | ||||||
|  |         <li> | ||||||
|  |             <a class='dropdown-item' href='#' id='location-move'> | ||||||
|  |                 <span class='fas fa-exchange-alt'></span> | ||||||
|  |                 {% trans "Transfer stock" %} | ||||||
|  |             </a> | ||||||
|  |         </li> | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% endif %} | ||||||
|  | {% if roles.stock_location.change %} | ||||||
|  | <div class='btn-group' role='group'> | ||||||
|  |     <button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button> | ||||||
|  |     <ul class='dropdown-menu' role='menu'> | ||||||
|  |         <li><a class='dropdown-item' href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li> | ||||||
|  |         {% if roles.stock.delete %} | ||||||
|  |         <li><a class='dropdown-item' href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li> | ||||||
|  |         {% endif %} | ||||||
|  |     </ul> | ||||||
|  | </div> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %} | ||||||
|  | {% if roles.stock_location.add %} | ||||||
|  | <button class='btn btn-success' id='location-create' type='button' title='{% trans "Create new stock location" %}'> | ||||||
|  |     <span class='fas fa-plus-circle'></span> {% trans "New Location" %} | ||||||
|  | </button> | ||||||
|  | {% endif %} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block details_left %} | ||||||
|  | {% if location %} | ||||||
|  | <p>{{ location.description }}</p> | ||||||
|  | {% else %} | ||||||
|  | <p>{% trans "Top level stock location" %}</p> | ||||||
|  | {% endif %} | ||||||
|  |  | ||||||
| {% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} | {% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} | ||||||
| {% if owner_control.value == "True" %} | {% if owner_control.value == "True" %} | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								InvenTree/templates/admin_button.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								InvenTree/templates/admin_button.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | {% load i18n %} | ||||||
|  | <button id='admin-button' title='{% trans "View in administration panel" %}' type='button' class='btn btn-primary' url='{{ url }}'> | ||||||
|  |     <span class='fas fa-user-shield'></span> | ||||||
|  | </button> | ||||||
| @@ -190,6 +190,13 @@ function inventreeDocReady() { | |||||||
|     $('.brand-icon').each(function(i, obj) { |     $('.brand-icon').each(function(i, obj) { | ||||||
|         loadBrandIcon($(this), $(this).attr('brand_name')); |         loadBrandIcon($(this), $(this).attr('brand_name')); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     // Callback for "admin view" button | ||||||
|  |     $('#admin-button').click(function() { | ||||||
|  |         var url = $(this).attr('url'); | ||||||
|  |  | ||||||
|  |         location.href = url; | ||||||
|  |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| function isFileTransfer(transfer) { | function isFileTransfer(transfer) { | ||||||
|   | |||||||
| @@ -6,6 +6,21 @@ | |||||||
| {% block content %} | {% block content %} | ||||||
|  |  | ||||||
| <div class='panel'> | <div class='panel'> | ||||||
|  |     <div class='panel-heading'> | ||||||
|  |         <div class='d-flex flex-row'> | ||||||
|  |             <h4> | ||||||
|  |                 {% block heading %} | ||||||
|  |                 <i>-- page header goes here --</i> | ||||||
|  |                 {% endblock %} | ||||||
|  |             </h4> | ||||||
|  |             <span class='flex' style='flex-grow: 1;'></span> | ||||||
|  |             <div id='page-actions' class='btn-group' role='group'> | ||||||
|  |                 {% block actions %} | ||||||
|  |                 <i>-- actions go here --</i> | ||||||
|  |                 {% endblock %} | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|     <div class='panel-content'> |     <div class='panel-content'> | ||||||
|         <div class='row'> |         <div class='row'> | ||||||
|             <div class='col-sm-6' id='detail-panel-left'> |             <div class='col-sm-6' id='detail-panel-left'> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user