mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Redirect to step 3
This commit is contained in:
parent
064431e94f
commit
fa90c92a2a
51
InvenTree/part/templates/part/bom_upload/select_parts.html
Normal file
51
InvenTree/part/templates/part/bom_upload/select_parts.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{% extends "part/part_base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block details %}
|
||||||
|
{% include "part/tabs.html" with tab="bom" %}
|
||||||
|
<h4>Upload Bill of Materials</h4>
|
||||||
|
|
||||||
|
<p>Step 3 - Select Parts</p>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<form method="post" action='' class='js-modal-form' enctype="multipart/form-data">
|
||||||
|
|
||||||
|
{% csrf_token %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
<input type='hidden' name='form_step' value='select_parts'/>
|
||||||
|
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Row</th>
|
||||||
|
{% for col in bom_columns %}
|
||||||
|
<th>
|
||||||
|
{{ col.name }}
|
||||||
|
</th>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for row in bom_rows %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<button class='btn btn-default btn-remove' id='del_row_{{ forloop.counter }}' style='display: inline; float: right;' title='Remove row'>
|
||||||
|
<span row_id='{{ forloop.counter }}' onClick='removeRowFromBomWizard()' class='glyphicon glyphicon-small glyphicon-remove'></span>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td>{{ forloop.counter }}</td>
|
||||||
|
{% for item in row.data %}
|
||||||
|
<td>
|
||||||
|
{{ item }}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -796,6 +796,9 @@ class BomUpload(FormView):
|
|||||||
|
|
||||||
self.bom_columns = []
|
self.bom_columns = []
|
||||||
|
|
||||||
|
# Track any duplicate column selections
|
||||||
|
duplicates = False
|
||||||
|
|
||||||
for col in col_ids:
|
for col in col_ids:
|
||||||
if col not in column_selections:
|
if col not in column_selections:
|
||||||
continue
|
continue
|
||||||
@ -812,6 +815,7 @@ class BomUpload(FormView):
|
|||||||
n = list(column_selections.values()).count(column_selections[col])
|
n = list(column_selections.values()).count(column_selections[col])
|
||||||
if n > 1:
|
if n > 1:
|
||||||
header['duplicate'] = True
|
header['duplicate'] = True
|
||||||
|
duplicates = True
|
||||||
|
|
||||||
self.bom_columns.append(header)
|
self.bom_columns.append(header)
|
||||||
|
|
||||||
@ -838,8 +842,14 @@ class BomUpload(FormView):
|
|||||||
|
|
||||||
self.bom_rows.append({'index': row_idx, 'data': items})
|
self.bom_rows.append({'index': row_idx, 'data': items})
|
||||||
|
|
||||||
|
valid = len(self.missing_columns) == 0 and not duplicates
|
||||||
|
|
||||||
form = part_forms.BomUploadSelectFields
|
form = part_forms.BomUploadSelectFields
|
||||||
self.template_name = 'part/bom_upload/select_fields.html'
|
|
||||||
|
if valid:
|
||||||
|
form = self.template_name = 'part/bom_upload/select_parts.html'
|
||||||
|
else:
|
||||||
|
self.template_name = 'part/bom_upload/select_fields.html'
|
||||||
|
|
||||||
return self.render_to_response(self.get_context_data(form=form))
|
return self.render_to_response(self.get_context_data(form=form))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user