Part Details
@@ -194,31 +169,6 @@
},
);
});
-
- $("#duplicate-part").click(function() {
- launchModalForm(
- "{% url 'part-duplicate' part.id %}",
- {
- follow: true,
- }
- );
- });
-
- $("#order-part").click(function() {
- launchModalForm("/order/purchase-order/order-parts/", {
- data: {
- part: {{ part.id }},
- },
- });
- });
-
- $("#edit-part").click(function() {
- launchModalForm(
- "{% url 'part-edit' part.id %}",
- {
- reload: true,
- });
- });
$('#activate-part').click(function() {
showQuestionDialog(
@@ -264,14 +214,5 @@
}
);
});
-
-
- $('#delete-part').click(function() {
- launchModalForm(
- "{% url 'part-delete' part.id %}",
- {
- redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %}
- });
- });
-
+
{% endblock %}
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index 92dccbcae1..3377c730a5 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -46,9 +46,27 @@
{% if part.is_template == False %}
{% include "qr_button.html" %}
+ {% if part.active %}
+ {% if part.purchaseable %}
+
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
+
+ {% if not part.active %}
+
{% endif %}
@@ -170,9 +188,6 @@
});
});
- $('#toggle-starred').click(function() {
- });
-
$("#part-thumb").click(function() {
launchModalForm(
"{% url 'part-image' part.id %}",
@@ -182,4 +197,41 @@
);
});
+ $("#part-edit").click(function() {
+ launchModalForm(
+ "{% url 'part-edit' part.id %}",
+ {
+ reload: true,
+ }
+ );
+ });
+
+ $("#part-order").click(function() {
+ launchModalForm("/order/purchase-order/order-parts/", {
+ data: {
+ part: {{ part.id }},
+ },
+ });
+ });
+
+ $("#part-duplicate").click(function() {
+ launchModalForm(
+ "{% url 'part-duplicate' part.id %}",
+ {
+ follow: true,
+ }
+ );
+ });
+
+ {% if not part.active %}
+ $("#part-delete").click(function() {
+ launchModalForm(
+ "{% url 'part-delete' part.id %}",
+ {
+ redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %}
+ }
+ );
+ });
+ {% endif %}
+
{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 1224d1de22..135a216218 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -446,6 +446,7 @@ class PartDetail(DetailView):
part = self.get_object()
context['starred'] = part.isStarredBy(self.request.user)
+ context['disabled'] = not part.active
context['OrderStatus'] = OrderStatus
diff --git a/InvenTree/static/script/inventree/modals.js b/InvenTree/static/script/inventree/modals.js
index 7d55d02865..31c2233f8d 100644
--- a/InvenTree/static/script/inventree/modals.js
+++ b/InvenTree/static/script/inventree/modals.js
@@ -43,6 +43,22 @@ function partialMatcher(params, data) {
}
+function attachToggle(modal) {
+ /* Attach 'bootstrap-toggle' functionality to any checkbox in the modal.
+ * This is simple for visual improvement,
+ * and also larger toggle style buttons are easier to press!
+ */
+
+ $(modal).find("input[type='checkbox']").each(function(x) {
+ $(this).bootstrapToggle({
+ size: 'small',
+ onstyle: 'success',
+ offstyle: 'warning',
+ });
+ });
+}
+
+
function attachSelect(modal) {
/* Attach 'select2' functionality to any drop-down list in the modal.
* Provides search filtering for dropdown items
@@ -351,6 +367,7 @@ function injectModalForm(modal, form_html) {
*/
$(modal).find('.modal-form-content').html(form_html);
attachSelect(modal);
+ attachToggle(modal);
}
diff --git a/InvenTree/templates/slide.html b/InvenTree/templates/slide.html
index d929f1491c..14afc4aa04 100644
--- a/InvenTree/templates/slide.html
+++ b/InvenTree/templates/slide.html
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file