mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Refactor "manufacturer_part" view
This commit is contained in:
		| @@ -511,14 +511,8 @@ | ||||
| .table-price-three tr td:last-child { | ||||
|     width: 30%; | ||||
| } | ||||
| /* !pricing table widths */ | ||||
|  | ||||
| .btn-glyph { | ||||
|     padding-left: 6px; | ||||
|     padding-right: 6px; | ||||
|     padding-top: 3px; | ||||
|     padding-bottom: 2px; | ||||
| } | ||||
| /* !pricing table widths */ | ||||
|  | ||||
| .action-button { | ||||
|     font-size: 125%; | ||||
|   | ||||
| @@ -14,23 +14,23 @@ | ||||
| <li class="breadcrumb-item active" aria-current="page"><a href='{% url "build-detail" build.id %}'>{{ build }}</a></li> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details_left %} | ||||
| <div class='row g-0'> | ||||
|     <div class='col-md-4'> | ||||
| {% block thumbnail %} | ||||
| <img class="part-thumb" | ||||
| {% if build.part.image %} | ||||
| src="{{ build.part.image.url }}" | ||||
| {% else %} | ||||
| src="{% static 'img/blank_image.png' %}" | ||||
| {% endif %}/>             | ||||
|     </div> | ||||
|     <div class='col-md-8'> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
| <h4> | ||||
|     {% trans "Build Order" %} {{ build }} | ||||
|     {% 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> | ||||
|     {% endif %} | ||||
| </h4> | ||||
| <p>{{ build.title }}</p> | ||||
| <div class='btn-group' role='group'> | ||||
|     <!-- Printing options --> | ||||
|     <div class='btn-group'> | ||||
| @@ -64,9 +64,6 @@ | ||||
|     {% endif %} | ||||
|     {% endif %} | ||||
| </div> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details_right %} | ||||
|   | ||||
| @@ -20,10 +20,10 @@ | ||||
|             {% endif %}/> | ||||
|             <div class='btn-row part-thumb-overlay'> | ||||
|                 <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-outline-secondary' 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 %} | ||||
|                     <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> | ||||
|                     <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> | ||||
|                     {% endif %} | ||||
|                 </div> | ||||
|             </div> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| {% extends "two_column.html" %} | ||||
| {% extends "page_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| @@ -10,6 +10,14 @@ InvenTree | {% trans "Manufacturer Part" %} | ||||
| {% include "company/manufacturer_part_navbar.html" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block breadcrumbs %} | ||||
| <li class='breadcrumb-item'><a href='{% url "manufacturer-index" %}'>{% trans "Manufacturers" %}</a></li> | ||||
| {% if part.manufacturer %} | ||||
| <li class='breadcrumb-item'><a href='{% url "company-detail" part.manufacturer.id %}'>{{ part.manufacturer.name }}</a></li> | ||||
| {% endif %} | ||||
| <li class="breadcrumb-item active" aria-current="page"><a href='{% url "manufacturer-part-detail" part.id %}'>{{ part.MPN }}</a></li> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block thumbnail %} | ||||
| <img class='part-thumb' | ||||
| {% if part.part.image %} | ||||
| @@ -19,46 +27,40 @@ src="{% static 'img/blank_image.png' %}" | ||||
| {% endif %}/> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_data %} | ||||
| <h3>{% trans "Manufacturer Part" %}</h3> | ||||
| <hr> | ||||
| {% block details %} | ||||
| <h4> | ||||
|     {{ part.part.full_name }} | ||||
|     {% 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> | ||||
| <p>{{ part.manufacturer.name }} - {{ part.MPN }}</p> | ||||
|  | ||||
| {% if roles.purchase_order.change %} | ||||
| <div class='btn-row'> | ||||
|     <div class='btn-group action-buttons' role='group'> | ||||
| <div class='btn-group' role='group'> | ||||
|     {% comment "for later" %} | ||||
|     {% if roles.purchase_order.add %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='order-part' title='{% trans "Order part" %}'> | ||||
|     <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-default btn-glyph' id='edit-part' title='{% trans "Edit manufacturer part" %}'> | ||||
|     <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-default btn-glyph' id='delete-part' title='{% trans "Delete manufacturer part" %}'> | ||||
|     <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> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_details %} | ||||
| {% block details_right %} | ||||
|  | ||||
| <h4>{% trans "Manufacturer Part Details" %}</h4> | ||||
| <table class="table table-striped table-condensed"> | ||||
|     <col width='25'> | ||||
|         <tr> | ||||
|   | ||||
| @@ -37,15 +37,15 @@ src="{% static 'img/blank_image.png' %}" | ||||
| <div class='btn-row'> | ||||
|     <div class='btn-group action-buttons' role='group'> | ||||
|         {% if roles.purchase_order.add %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='order-part' title='{% trans "Order part" %}'> | ||||
|         <button type='button' class='btn btn-default' id='order-part' title='{% trans "Order part" %}'> | ||||
|             <span class='fas fa-shopping-cart'></span> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit supplier part" %}'> | ||||
|         <button type='button' class='btn btn-default' 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-default btn-glyph' id='delete-part' title='{% trans "Delete supplier part" %}'> | ||||
|         <button type='button' class='btn btn-default' id='delete-part' title='{% trans "Delete supplier part" %}'> | ||||
|             <span class='fas fa-trash-alt icon-red'/> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|   | ||||
| @@ -211,7 +211,7 @@ | ||||
|                             <a href='/part/{{ part.id }}/'>{{ part }}</a> | ||||
|                             <div class='btn-group' style='float: right;'> | ||||
|                                 {% if roles.part.change %} | ||||
|                                 <button title='{% trans "Delete" %}' class='btn btn-default btn-glyph delete-related-part' url="{% url 'part-related-delete' part_related.id %}" type='button'><span class='fas fa-trash-alt icon-red'/></button> | ||||
|                                 <button title='{% trans "Delete" %}' class='btn btn-default delete-related-part' url="{% url 'part-related-delete' part_related.id %}" type='button'><span class='fas fa-trash-alt icon-red'/></button> | ||||
|                                 {% endif %} | ||||
|                             </div> | ||||
|                         </td> | ||||
|   | ||||
| @@ -17,10 +17,10 @@ | ||||
|       {% if roles.part.change %} | ||||
|       <div class='btn-row part-thumb-overlay'> | ||||
|           <div class='btn-group'> | ||||
|               <button type='button' class='btn btn-default btn-glyph' title="{% trans 'Select from existing images' %}" id='part-image-select'><span class='fas fa-th'></span></button> | ||||
|               <button type='button' class='btn btn-default btn-glyph' title="{% trans 'Upload new image' %}" id='part-image-upload'><span class='fas fa-file-upload'></span></button> | ||||
|               <button type='button' class='btn btn-default' title="{% trans 'Select from existing images' %}" id='part-image-select'><span class='fas fa-th'></span></button> | ||||
|               <button type='button' class='btn btn-default' title="{% trans 'Upload new image' %}" id='part-image-upload'><span class='fas fa-file-upload'></span></button> | ||||
|               {% if allow_download %} | ||||
|               <button type='button' class='btn btn-default btn-glyph' title="{% trans 'Download image from URL' %}" id='part-image-url'><span class='fas fa-cloud-download-alt'></span></button> | ||||
|               <button type='button' class='btn btn-default' title="{% trans 'Download image from URL' %}" id='part-image-url'><span class='fas fa-cloud-download-alt'></span></button> | ||||
|               {% endif %} | ||||
|           </div> | ||||
|       </div> | ||||
|   | ||||
| @@ -38,7 +38,7 @@ | ||||
|     </td> | ||||
|     <td> | ||||
|         <div class='btn-group float-right'> | ||||
|             <button class='btn btn-default btn-glyph btn-edit-setting' pk='{{ setting.pk }}' setting='{{ setting.key.upper }}' title='{% trans "Edit setting" %}' {% if user_setting %}user='{{request.user.id}}'{% endif %}> | ||||
|             <button class='btn btn-default btn-edit-setting' pk='{{ setting.pk }}' setting='{{ setting.key.upper }}' title='{% trans "Edit setting" %}' {% if user_setting %}user='{{request.user.id}}'{% endif %}> | ||||
|                 <span class='fas fa-edit icon-green'></span> | ||||
|             </button> | ||||
|         </div> | ||||
|   | ||||
| @@ -174,8 +174,8 @@ $('#cat-param-table').inventreeTable({ | ||||
|             title: '{% trans "Default Value" %}', | ||||
|             sortable: 'true', | ||||
|             formatter: function(value, row, index, field) { | ||||
|                 var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>"; | ||||
|                 var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>"; | ||||
|                 var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>"; | ||||
|                 var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>"; | ||||
|  | ||||
|                 var html = value | ||||
|                 html += "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>"; | ||||
| @@ -273,8 +273,8 @@ $("#param-table").inventreeTable({ | ||||
|         }, | ||||
|         { | ||||
|             formatter: function(value, row, index, field) { | ||||
|                 var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>"; | ||||
|                 var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>"; | ||||
|                 var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>"; | ||||
|                 var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>"; | ||||
|  | ||||
|                 var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>"; | ||||
|  | ||||
|   | ||||
| @@ -103,7 +103,7 @@ function makeIconBadge(icon, title) { | ||||
|  */ | ||||
| function makeIconButton(icon, cls, pk, title, options={}) { | ||||
|  | ||||
|     var classes = `btn btn-default btn-glyph ${cls}`; | ||||
|     var classes = `btn btn-default ${cls}`; | ||||
|  | ||||
|     var id = `${cls}-${pk}`; | ||||
|  | ||||
|   | ||||
| @@ -1684,8 +1684,8 @@ function loadStockTrackingTable(table, options) { | ||||
|         formatter: function(value, row, index, field) { | ||||
|             // Manually created entries can be edited or deleted | ||||
|             if (false && !row.system) { | ||||
|                 var bEdit = "<button title='{% trans 'Edit tracking entry' %}' class='btn btn-entry-edit btn-default btn-glyph' type='button' url='/stock/track/" + row.pk + "/edit/'><span class='fas fa-edit'/></button>"; | ||||
|                 var bDel = "<button title='{% trans 'Delete tracking entry' %}' class='btn btn-entry-delete btn-default btn-glyph' type='button' url='/stock/track/" + row.pk + "/delete/'><span class='fas fa-trash-alt icon-red'/></button>"; | ||||
|                 var bEdit = "<button title='{% trans 'Edit tracking entry' %}' class='btn btn-entry-edit btn-default' type='button' url='/stock/track/" + row.pk + "/edit/'><span class='fas fa-edit'/></button>"; | ||||
|                 var bDel = "<button title='{% trans 'Delete tracking entry' %}' class='btn btn-entry-delete btn-default' type='button' url='/stock/track/" + row.pk + "/delete/'><span class='fas fa-trash-alt icon-red'/></button>"; | ||||
|  | ||||
|                 return "<div class='btn-group' role='group'>" + bEdit + bDel + "</div>"; | ||||
|             } else { | ||||
|   | ||||
| @@ -11,7 +11,16 @@ | ||||
|             <div class='col-sm-6' id='detail-panel-left'> | ||||
|                 <div class='card'> | ||||
|                     {% block details_left %} | ||||
|                     block details_left | ||||
|                     <div class='row g-0'> | ||||
|                         <div class='col-md-4'> | ||||
|                             {% block thumbnail %} | ||||
|                             {% endblock %} | ||||
|                         </div> | ||||
|                         <div class='col-md-8'> | ||||
|                             {% block details %} | ||||
|                             {% endblock %} | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     {% endblock %} | ||||
|                 </div> | ||||
|             </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user