Refactor company base page

This commit is contained in:
Oliver 2021-10-27 22:44:40 +11:00
parent 8fdaab233c
commit 9536231cb0
2 changed files with 60 additions and 54 deletions

View File

@ -1,68 +1,66 @@
{% extends "two_column.html" %} {% extends "page_base.html" %}
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% load inventree_extras %} {% load inventree_extras %}
{% block page_title %} {% block page_title %}
{% inventree_title %} | {% trans "Company" %} - {{ company.name }} {% inventree_title %} | {% trans "Company" %} - {{ company.name }}
{% endblock %} {% endblock %}
{% block details_left %}
{% block thumbnail %} <div class='row g-0'>
{% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %} <div class='col-md-4'>
<div class='dropzone part-thumb-container' id='company-thumb'>
<div class='dropzone part-thumb-container' id='company-thumb'> <img class="part-thumb" id='company-image'
<img class="part-thumb" id='company-image' {% if company.image %}
{% if company.image %} src="{{ company.image.url }}"
src="{{ company.image.url }}" {% else %}
{% else %} src="{% static 'img/blank_image.png' %}"
src="{% static 'img/blank_image.png' %}" {% endif %}/>
{% endif %}/> <div class='btn-row part-thumb-overlay'>
<div class='btn-row part-thumb-overlay'> <div class='btn-group'>
<div class='btn-group'> <button type='button' class='btn btn-outline-secondary btn-glyph' title='{% trans "Upload new image" %}' id='company-image-upload'><span class='fas fa-file-upload'></span></button>
<button type='button' class='btn btn-default btn-glyph' title='{% trans "Upload new image" %}' id='company-image-upload'><span class='fas fa-file-upload'></span></button> {% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %}
{% if allow_download %} {% if allow_download %}
<button type='button' class='btn btn-default btn-glyph' 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 btn-glyph' title="{% trans 'Download image from URL' %}" id='company-image-url'><span class='fas fa-cloud-download-alt'></span></button>
{% endif %}
</div>
</div>
</div>
</div>
<div class='col-md-8'>
<h4>
{{ company.name }}
{% if user.is_staff and perms.company.change_company %}
<a href="{% url 'admin:company_company_change' company.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>
<p>{{ company.description }}</p>
<div class='btn-group' role='group'>
{% if company.is_supplier and roles.purchase_order.add %}
<button type='button' class='btn btn-outline-secondary' id='company-order-2' title='{% trans "Create Purchase Order" %}'>
<span class='fas fa-shopping-cart'/>
</button>
{% endif %}
{% if perms.company.change_company %}
<button type='button' class='btn btn-outline-secondary' id='company-edit' title='{% trans "Edit company information" %}'>
<span class='fas fa-edit icon-green'/>
</button>
{% endif %}
{% if perms.company.delete_company %}
<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 page_data %} {% block details_right %}
<h3>{% trans "Company" %}</h3>
<hr>
<h4>
{{ company.name }}
{% if user.is_staff and perms.company.change_company %}
<a href="{% url 'admin:company_company_change' company.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>
<p>{{ company.description }}</p>
<div class='btn-group action-buttons'>
{% if company.is_supplier and roles.purchase_order.add %}
<button type='button' class='btn btn-default' id='company-order-2' title='{% trans "Create Purchase Order" %}'>
<span class='fas fa-shopping-cart'/>
</button>
{% endif %}
{% if perms.company.change_company %}
<button type='button' class='btn btn-default' id='company-edit' title='{% trans "Edit company information" %}'>
<span class='fas fa-edit icon-green'/>
</button>
{% endif %}
{% if perms.company.delete_company %}
<button type='button' class='btn btn-default' id='company-delete' title='{% trans "Delete Company" %}'>
<span class='fas fa-trash-alt icon-red'/>
</button>
{% endif %}
</div>
{% endblock %}
{% block page_details %} <table class="table table-striped table-condensed">
<h4>{% trans "Company Details" %}</h4>
<table class="table">
<col width='25'> <col width='25'>
{% if company.website %} {% if company.website %}
<tr> <tr>

View File

@ -29,10 +29,14 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% if roles.purchase_order.add %} {% if roles.purchase_order.add %}
<li><a href='#' id='multi-supplier-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li> <li><a class='dropdown-item' href='#' id='multi-supplier-part-order' title='{% trans "Order parts" %}'>
<span class='fas fa-shopping-cart'></span> {% trans "Order Parts" %}
</a></li>
{% endif %} {% endif %}
{% if roles.purchase_order.delete %} {% if roles.purchase_order.delete %}
<li><a href='#' id='multi-supplier-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li> <li><a class='dropdown-item' href='#' id='multi-supplier-part-delete' title='{% trans "Delete parts" %}'>
<span class='fas fa-trash-alt icon-red'></span> {% trans "Delete Parts" %}
</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
@ -69,10 +73,14 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% if roles.purchase_order.add %} {% if roles.purchase_order.add %}
<li><a href='#' id='multi-manufacturer-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li> <li><a class='dropdown-item' href='#' id='multi-manufacturer-part-order' title='{% trans "Order parts" %}'>
<span class='fas fa-shopping-cart'></span> {% trans "Order Parts" %}
</a></li>
{% endif %} {% endif %}
{% if roles.purchase_order.delete %} {% if roles.purchase_order.delete %}
<li><a href='#' id='multi-manufacturer-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li> <li><a class='dropdown-item' href='#' id='multi-manufacturer-part-delete' title='{% trans "Delete parts" %}'>
<span class='fas fa-trash-alt icon-red'></span> {% trans "Delete Parts" %}
</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
@ -166,7 +174,7 @@
</div> </div>
<div class='col-sm-6'> <div class='col-sm-6'>
<div class='btn-group float-right'> <div class='btn-group float-right'>
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-default'> <button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-outline-secondary'>
<span class='fas fa-edit'> <span class='fas fa-edit'>
</span> </span>
</button> </button>