<commit_before>{% extends "two_column.html" %}
{% load static %}
{% load inventree_extras %}
{% load status_codes %}
{% load i18n %}

{% block page_title %}
InvenTree | {% trans "Stock Item" %} - {{ item }}
{% endblock %}

{% block sidenav %}
<div id='stock-tree'></div>
{% endblock %}

{% block pre_content %}
{% include 'stock/loc_link.html' with location=item.location %}

{% if item.hasRequiredTests and not item.passedAllRequiredTests %}
<div class='alert alert-block alert-danger'>
    {% trans "This stock item has not passed all required tests" %}
</div>
{% endif %}

{% for allocation in item.sales_order_allocations.all %}
<div class='alert alert-block alert-info'>
    {% trans "This stock item is allocated to Sales Order" %} <a href="{% url 'so-detail' allocation.line.order.id %}"><b>#{{ allocation.line.order.reference }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %})
</div>
{% endfor %}

{% for allocation in item.allocations.all %}
<div class='alert alert-block alert-info'>
    {% trans "This stock item is allocated to Build" %} <a href="{% url 'build-detail' allocation.build.id %}"><b>#{{ allocation.build.id }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %})
</div>
{% endfor %}

{% if item.serialized %}
<div class='alert alert-block alert-warning'>
    {% trans "This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted." %}
</div>
{% elif item.child_count > 0 %}
<div class='alert alert-block alert-warning'>
    {% trans "This stock item cannot be deleted as it has child items" %}
</div>
{% elif item.delete_on_deplete and item.can_delete %}
<div class='alert alert-block alert-warning'>
    {% trans "This stock item will be automatically deleted when all stock is depleted." %}
</div>
{% endif %}

{% endblock %}

{% block thumbnail %}
<img class='part-thumb' {% if item.part.image %}src="{{ item.part.image.url }}"{% else %}src="{% static 'img/blank_image.png' %}"{% endif %}/>
{% endblock %}

{% block page_data %}
<h3>
    {% trans "Stock Item" %}
    {% stock_status_label item.status large=True %}
</h3>
<hr>
<h4>
{% if item.serialized %}
{{ item.part.full_name}} # {{ item.serial }}
{% else %}
{% decimal item.quantity %} &times {{ item.part.full_name }}
{% endif %}
</h4>

<div class='btn-group action-buttons'>
    {% include "qr_button.html" %}
    {% if item.in_stock %}
    {% if not item.serialized %}
    <button type='button' class='btn btn-default' id='stock-add' title='{% trans "Add to stock" %}'>
        <span class='fas fa-plus-circle icon-green'/>
    </button>
    <button type='button' class='btn btn-default' id='stock-remove' title='{% trans "Take from stock" %}'>
        <span class='fas fa-minus-circle icon-red''/>
    </button>
    <button type='button' class='btn btn-default' id='stock-count' title='{% trans "Count stock" %}'>
        <span class='fas fa-clipboard-list'/>
    </button>
    {% if item.part.trackable %}
    <button type='button' class='btn btn-default' id='stock-serialize' title='{% trans "Serialize stock" %}'>
        <span class='fas fa-hashtag'/>
    </button>
    {% endif %}
    {% if item.part.salable %}
    <button type='button' class='btn btn-default' id='stock-assign-to-customer' title='{% trans "Assign to Customer" %}'>
        <span class='fas fa-user-tie'/>
    </button>
    {% endif %}
    {% endif %}
    <button type='button' class='btn btn-default' id='stock-move' title='{% trans "Transfer stock" %}'>
        <span class='fas fa-exchange-alt icon-blue'/>
    </button>
    <button type='button' class='btn btn-default' id='stock-duplicate' title='{% trans "Duplicate stock item" %}'>
        <span class='fas fa-copy'/>
    </button>
    {% endif %}
    {% if item.part.has_variants %}
    <button type='button' class='btn btn-default' id='stock-convert' title='{% trans "Convert stock to variant" %}'>
        <span class='fas fa-screwdriver'/>
    </button>
    {% endif %}
    {% if item.part.has_test_report_templates %}
    <button type='button' class='btn btn-default' id='stock-test-report' title='{% trans "Generate test report" %}'>
        <span class='fas fa-tasks'/>
    </button>
    {% endif %}
    <button type='button' class='btn btn-default' id='stock-edit' title='{% trans "Edit stock item" %}'>
        <span class='fas fa-edit icon-blue'/>
    </button>
    {% if item.can_delete %}
    <button type='button' class='btn btn-default' id='stock-delete' title='{% trans "Edit stock item" %}'>
        <span class='fas fa-trash-alt icon-red'/>
    </button>
    {% endif %}
</div>

{% endblock %}

{% block page_details %}<commit_msg>Fix display of buttons for stock item<commit_after>{% extends "two_column.html" %}
{% load static %}
{% load inventree_extras %}
{% load status_codes %}
{% load i18n %}

{% block page_title %}
InvenTree | {% trans "Stock Item" %} - {{ item }}
{% endblock %}

{% block sidenav %}
<div id='stock-tree'></div>
{% endblock %}

{% block pre_content %}
{% include 'stock/loc_link.html' with location=item.location %}

{% if item.hasRequiredTests and not item.passedAllRequiredTests %}
<div class='alert alert-block alert-danger'>
    {% trans "This stock item has not passed all required tests" %}
</div>
{% endif %}

{% for allocation in item.sales_order_allocations.all %}
<div class='alert alert-block alert-info'>
    {% trans "This stock item is allocated to Sales Order" %} <a href="{% url 'so-detail' allocation.line.order.id %}"><b>#{{ allocation.line.order.reference }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %})
</div>
{% endfor %}

{% for allocation in item.allocations.all %}
<div class='alert alert-block alert-info'>
    {% trans "This stock item is allocated to Build" %} <a href="{% url 'build-detail' allocation.build.id %}"><b>#{{ allocation.build.id }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %})
</div>
{% endfor %}

{% if item.serialized %}
<div class='alert alert-block alert-warning'>
    {% trans "This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted." %}
</div>
{% elif item.child_count > 0 %}
<div class='alert alert-block alert-warning'>
    {% trans "This stock item cannot be deleted as it has child items" %}
</div>
{% elif item.delete_on_deplete and item.can_delete %}
<div class='alert alert-block alert-warning'>
    {% trans "This stock item will be automatically deleted when all stock is depleted." %}
</div>
{% endif %}

{% endblock %}

{% block thumbnail %}
<img class='part-thumb' {% if item.part.image %}src="{{ item.part.image.url }}"{% else %}src="{% static 'img/blank_image.png' %}"{% endif %}/>
{% endblock %}

{% block page_data %}
<h3>
    {% trans "Stock Item" %}
    {% stock_status_label item.status large=True %}
</h3>
<hr>
<h4>
{% if item.serialized %}
{{ item.part.full_name}} # {{ item.serial }}
{% else %}
{% decimal item.quantity %} &times {{ item.part.full_name }}
{% endif %}
</h4>

<div class='btn-group action-buttons'>
    {% include "qr_button.html" %}
    {% if item.in_stock %}
    {% if not item.serialized %}
    <button type='button' class='btn btn-default' id='stock-add' title='{% trans "Add to stock" %}'>
        <span class='fas fa-plus-circle icon-green'/>
    </button>
    <button type='button' class='btn btn-default' id='stock-remove' title='{% trans "Take from stock" %}'>
        <span class='fas fa-minus-circle icon-red''/>
    </button>
    <button type='button' class='btn btn-default' id='stock-count' title='{% trans "Count stock" %}'>
        <span class='fas fa-clipboard-list'/>
    </button>
    {% if item.part.trackable %}
    <button type='button' class='btn btn-default' id='stock-serialize' title='{% trans "Serialize stock" %}'>
        <span class='fas fa-hashtag'/>
    </button>
    {% endif %}
    {% endif %}
    {% if item.part.salable %}
    <button type='button' class='btn btn-default' id='stock-assign-to-customer' title='{% trans "Assign to Customer" %}'>
        <span class='fas fa-user-tie'/>
    </button>
    {% endif %}
    <button type='button' class='btn btn-default' id='stock-move' title='{% trans "Transfer stock" %}'>
        <span class='fas fa-exchange-alt icon-blue'/>
    </button>
    <button type='button' class='btn btn-default' id='stock-duplicate' title='{% trans "Duplicate stock item" %}'>
        <span class='fas fa-copy'/>
    </button>
    {% endif %}
    {% if item.part.has_variants %}
    <button type='button' class='btn btn-default' id='stock-convert' title='{% trans "Convert stock to variant" %}'>
        <span class='fas fa-screwdriver'/>
    </button>
    {% endif %}
    {% if item.part.has_test_report_templates %}
    <button type='button' class='btn btn-default' id='stock-test-report' title='{% trans "Generate test report" %}'>
        <span class='fas fa-tasks'/>
    </button>
    {% endif %}
    <button type='button' class='btn btn-default' id='stock-edit' title='{% trans "Edit stock item" %}'>
        <span class='fas fa-edit icon-blue'/>
    </button>
    {% if item.can_delete %}
    <button type='button' class='btn btn-default' id='stock-delete' title='{% trans "Edit stock item" %}'>
        <span class='fas fa-trash-alt icon-red'/>
    </button>
    {% endif %}
</div>

{% endblock %}

{% block page_details %}
{'fraction_non_alphanumeric': 0.19212564543889846, 'fraction_numerical': 0.0015060240963855422, 'mean_word_length': 3.683627204030227, 'pattern_counts': {'":': 0, '<': 129, '<?xml version=': 0, '>': 131, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6951673', 'n_tokens_mistral': 3251, 'n_tokens_neox': 2954, 'n_words': 822}