{% extends "page_base.html" %}
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block page_title %}
{% inventree_title %} | {% trans "Company" %} - {{ company.name }}
{% endblock %}
{% block heading %}
{% trans "Company" %}: {{ company.name }}
{% endblock %}
{% block actions %}
{% if user.is_staff and perms.company.change_company %}
{% url 'admin:company_company_change' company.pk as url %}
{% include "admin_button.html" with url=url %}
{% endif %}
{% if company.is_supplier and roles.purchase_order.add %}
{% endif %}
{% if perms.company.change_company %}
{% endif %}
{% if perms.company.delete_company %}
{% endif %}
{% endblock %}
{% block thumbnail %}
{% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %}
{% if allow_download %}
{% endif %}
{% endblock %}
{% block details %}
|
{% trans "Description" %} |
{{ company.description }} |
|
{%trans "Manufacturer" %} |
{% include "yesnolabel.html" with value=company.is_manufacturer %} |
|
{% trans "Supplier" %} |
{% include 'yesnolabel.html' with value=company.is_supplier %} |
|
{% trans "Customer" %} |
{% include 'yesnolabel.html' with value=company.is_customer %} |
{% endblock %}
{% block details_right %}
{% if company.website %}
|
{% trans "Website" %} |
{{ company.website }}{% include "clip.html"%} |
{% endif %}
|
{% trans "Currency" %} |
{% if company.currency %}
{{ company.currency }}
{% else %}
{% trans "Uses default currency" %}
{% endif %}
|
{% if company.address %}
|
{% trans "Address" %} |
{{ company.address }}{% include "clip.html"%} |
{% endif %}
{% if company.phone %}
|
{% trans "Phone" %} |
{% include "tel.html" with tel=company.phone %} |
{% endif %}
{% if company.email %}
|
{% trans "Email" %} |
{% include "mail.html" with mail=company.email %} |
{% endif %}
{% if company.contact %}
|
{% trans "Contact" %} |
{{ company.contact }}{% include "clip.html"%} |
{% endif %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
$('#company-edit').click(function() {
editCompany({{ company.id }});
});
$("#company-order-2").click(function() {
createPurchaseOrder({
supplier: {{ company.pk }},
});
});
$('#company-delete').click(function() {
constructForm('{% url "api-company-detail" company.pk %}', {
method: 'DELETE',
title: '{% trans "Delete Company" %}',
redirect: '{% url "company-index" %}',
});
});
function reloadImage(data) {
if (data.image) {
$('#company-image').attr('src', data.image);
// Reset the "modal image" view
$('#company-image').click(function() {
showModalImage(data.image);
});
} else {
location.reload();
}
}
enableDragAndDrop(
"#company-thumb",
"{% url 'api-company-detail' company.id %}",
{
label: 'image',
method: 'PATCH',
success: function(data, status, xhr) {
reloadImage(data);
}
}
);
{% if company.image %}
$('#company-image').click(function() {
showModalImage('{{ company.image.url }}');
});
{% endif %}
$("#company-image-upload").click(function() {
constructForm(
'{% url "api-company-detail" company.pk %}',
{
method: 'PATCH',
fields: {
image: {},
},
title: '{% trans "Upload Image" %}',
onSuccess: function(data) {
reloadImage(data);
}
}
);
});
if (global_settings.INVENTREE_DOWNLOAD_FROM_URL) {
$('#company-image-url').click(function() {
launchModalForm(
'{% url "company-image-download" company.id %}',
{
reload: true,
}
)
});
}
{% endblock %}