diff --git a/InvenTree/order/templates/order/order_wizard/po_upload.html b/InvenTree/order/templates/order/order_wizard/po_upload.html index 5c680e509c..3b20f356f3 100644 --- a/InvenTree/order/templates/order/order_wizard/po_upload.html +++ b/InvenTree/order/templates/order/order_wizard/po_upload.html @@ -10,54 +10,11 @@ {% endblock %} {% block page_content %} - -
-
- {% block heading %} -

{% trans "Upload File for Purchase Order" %}

- {{ wizard.form.media }} - {% endblock %} -
-
- {% block details %} - {% if order.status == PurchaseOrderStatus.PENDING and roles.purchase_order.change %} - -

{% blocktrans with step=wizard.steps.step1 count=wizard.steps.count %}Step {{step}} of {{count}}{% endblocktrans %} - {% if description %}- {{ description }}{% endif %}

- - {% block form_alert %} - {% endblock form_alert %} - -
- {% csrf_token %} - {% load crispy_forms_tags %} - - {% block form_buttons_top %} - {% endblock form_buttons_top %} - - - {{ wizard.management_form }} - {% block form_content %} - {% crispy wizard.form %} - {% endblock form_content %} -
- - {% block form_buttons_bottom %} - {% if wizard.steps.prev %} - - {% endif %} - -
- {% endblock form_buttons_bottom %} - - {% else %} - - {% endif %} - {% endblock details %} -
- + {% trans "Upload File for Purchase Order" as header_text %} + {% order.status == PurchaseOrderStatus.PENDING and roles.purchase_order.change as upload_go_ahead %} + {% trans "Order is already processed. Files cannot be uploaded." as error_text %} + {% 'panel-upload-file' as panel_id %} + {% include "patterns/wizard/upload.html" with header_text=header_text upload_go_ahead=upload_go_ahead error_text=error_text panel_id=panel_id %} {% endblock %} {% block js_ready %} diff --git a/InvenTree/part/templates/part/import_wizard/part_upload.html b/InvenTree/part/templates/part/import_wizard/part_upload.html index 666afad1cb..4fef625d1d 100644 --- a/InvenTree/part/templates/part/import_wizard/part_upload.html +++ b/InvenTree/part/templates/part/import_wizard/part_upload.html @@ -10,51 +10,10 @@ {% endblock %} {% block content %} -
-
-

- {% trans "Import Parts from File" %} - {{ wizard.form.media }} -

-
-
- {% if roles.part.change %} - -

{% blocktrans with step=wizard.steps.step1 count=wizard.steps.count %}Step {{step}} of {{count}}{% endblocktrans %} - {% if description %}- {{ description }}{% endif %}

- - {% block form_alert %} - {% endblock form_alert %} - -
- {% csrf_token %} - {% load crispy_forms_tags %} - - {% block form_buttons_top %} - {% endblock form_buttons_top %} - - - {{ wizard.management_form }} - {% block form_content %} - {% crispy wizard.form %} - {% endblock form_content %} -
- - {% block form_buttons_bottom %} - {% if wizard.steps.prev %} - - {% endif %} - -
- {% endblock form_buttons_bottom %} - - {% else %} - - {% endif %} -
-
+ {% trans "Import Parts from File" as header_text %} + {% roles.part.change as upload_go_ahead %} + {% trans "Unsuffitient privileges." as error_text %} + {% include "patterns/wizard/upload.html" with header_text=header_text upload_go_ahead=upload_go_ahead error_text=error_text %} {% endblock %} {% block js_ready %} diff --git a/InvenTree/templates/patterns/wizard/upload.html b/InvenTree/templates/patterns/wizard/upload.html new file mode 100644 index 0000000000..1688e538bf --- /dev/null +++ b/InvenTree/templates/patterns/wizard/upload.html @@ -0,0 +1,45 @@ +
+
+

+ {{ header_text }} + {{ wizard.form.media }} +

+
+
+ {% if upload_go_ahead %} + +

{% blocktrans with step=wizard.steps.step1 count=wizard.steps.count %}Step {{step}} of {{count}}{% endblocktrans %} + {% if description %}- {{ description }}{% endif %}

+ + {% block form_alert %} + {% endblock form_alert %} + +
+ {% csrf_token %} + {% load crispy_forms_tags %} + + {% block form_buttons_top %} + {% endblock form_buttons_top %} + + + {{ wizard.management_form }} + {% block form_content %} + {% crispy wizard.form %} + {% endblock form_content %} +
+ + {% block form_buttons_bottom %} + {% if wizard.steps.prev %} + + {% endif %} + +
+ {% endblock form_buttons_bottom %} + + {% else %} + + {% endif %} +
+
\ No newline at end of file