mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
company.js
This commit is contained in:
parent
0835fe92a0
commit
7d4945d302
@ -1,5 +1,28 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
|
/* globals
|
||||||
|
constructForm,
|
||||||
|
imageHoverIcon,
|
||||||
|
inventreeDelete,
|
||||||
|
loadTableFilters,
|
||||||
|
makeIconButton,
|
||||||
|
renderLink,
|
||||||
|
setupFilterList,
|
||||||
|
showQuestionDialog,
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* exported
|
||||||
|
createCompany,
|
||||||
|
createManufacturerPart,
|
||||||
|
createSupplierPart,
|
||||||
|
deleteManufacturerParts,
|
||||||
|
editCompany,
|
||||||
|
loadCompanyTable,
|
||||||
|
loadManufacturerPartTable,
|
||||||
|
loadManufacturerPartParameterTable,
|
||||||
|
loadSupplierPartTable,
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
function manufacturerPartFields() {
|
function manufacturerPartFields() {
|
||||||
|
|
||||||
@ -32,7 +55,7 @@ function createManufacturerPart(options={}) {
|
|||||||
|
|
||||||
fields.manufacturer.secondary = {
|
fields.manufacturer.secondary = {
|
||||||
title: '{% trans "Add Manufacturer" %}',
|
title: '{% trans "Add Manufacturer" %}',
|
||||||
fields: function(data) {
|
fields: function() {
|
||||||
var company_fields = companyFormFields();
|
var company_fields = companyFormFields();
|
||||||
|
|
||||||
company_fields.is_manufacturer.value = true;
|
company_fields.is_manufacturer.value = true;
|
||||||
@ -126,7 +149,7 @@ function createSupplierPart(options={}) {
|
|||||||
// Add a secondary modal for the supplier
|
// Add a secondary modal for the supplier
|
||||||
fields.supplier.secondary = {
|
fields.supplier.secondary = {
|
||||||
title: '{% trans "Add Supplier" %}',
|
title: '{% trans "Add Supplier" %}',
|
||||||
fields: function(data) {
|
fields: function() {
|
||||||
var company_fields = companyFormFields();
|
var company_fields = companyFormFields();
|
||||||
|
|
||||||
company_fields.is_supplier.value = true;
|
company_fields.is_supplier.value = true;
|
||||||
@ -185,7 +208,7 @@ function deleteSupplierPart(part, options={}) {
|
|||||||
|
|
||||||
|
|
||||||
// Returns a default form-set for creating / editing a Company object
|
// Returns a default form-set for creating / editing a Company object
|
||||||
function companyFormFields(options={}) {
|
function companyFormFields() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: {},
|
name: {},
|
||||||
@ -228,7 +251,7 @@ function editCompany(pk, options={}) {
|
|||||||
title: '{% trans "Edit Company" %}',
|
title: '{% trans "Edit Company" %}',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Launches a form to create a new company.
|
* Launches a form to create a new company.
|
||||||
@ -285,7 +308,7 @@ function loadCompanyTable(table, url, options={}) {
|
|||||||
title: '{% trans "Company" %}',
|
title: '{% trans "Company" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
switchable: false,
|
switchable: false,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
var html = imageHoverIcon(row.image) + renderLink(value, row.url);
|
var html = imageHoverIcon(row.image) + renderLink(value, row.url);
|
||||||
|
|
||||||
if (row.is_customer) {
|
if (row.is_customer) {
|
||||||
@ -310,7 +333,7 @@ function loadCompanyTable(table, url, options={}) {
|
|||||||
{
|
{
|
||||||
field: 'website',
|
field: 'website',
|
||||||
title: '{% trans "Website" %}',
|
title: '{% trans "Website" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
return renderLink(value, value);
|
return renderLink(value, value);
|
||||||
}
|
}
|
||||||
@ -445,7 +468,7 @@ function loadManufacturerPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'part_detail.full_name',
|
field: 'part_detail.full_name',
|
||||||
title: '{% trans "Part" %}',
|
title: '{% trans "Part" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
|
|
||||||
var url = `/part/${row.part}/`;
|
var url = `/part/${row.part}/`;
|
||||||
|
|
||||||
@ -470,7 +493,7 @@ function loadManufacturerPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'manufacturer',
|
field: 'manufacturer',
|
||||||
title: '{% trans "Manufacturer" %}',
|
title: '{% trans "Manufacturer" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
if (value && row.manufacturer_detail) {
|
if (value && row.manufacturer_detail) {
|
||||||
var name = row.manufacturer_detail.name;
|
var name = row.manufacturer_detail.name;
|
||||||
var url = `/company/${value}/`;
|
var url = `/company/${value}/`;
|
||||||
@ -486,14 +509,14 @@ function loadManufacturerPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'MPN',
|
field: 'MPN',
|
||||||
title: '{% trans "MPN" %}',
|
title: '{% trans "MPN" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
return renderLink(value, `/manufacturer-part/${row.pk}/`);
|
return renderLink(value, `/manufacturer-part/${row.pk}/`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'link',
|
field: 'link',
|
||||||
title: '{% trans "Link" %}',
|
title: '{% trans "Link" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
return renderLink(value, value);
|
return renderLink(value, value);
|
||||||
} else {
|
} else {
|
||||||
@ -695,7 +718,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'part_detail.full_name',
|
field: 'part_detail.full_name',
|
||||||
title: '{% trans "Part" %}',
|
title: '{% trans "Part" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
|
|
||||||
var url = `/part/${row.part}/`;
|
var url = `/part/${row.part}/`;
|
||||||
|
|
||||||
@ -720,7 +743,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'supplier',
|
field: 'supplier',
|
||||||
title: '{% trans "Supplier" %}',
|
title: '{% trans "Supplier" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
if (value) {
|
if (value) {
|
||||||
var name = row.supplier_detail.name;
|
var name = row.supplier_detail.name;
|
||||||
var url = `/company/${value}/`;
|
var url = `/company/${value}/`;
|
||||||
@ -736,7 +759,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'SKU',
|
field: 'SKU',
|
||||||
title: '{% trans "Supplier Part" %}',
|
title: '{% trans "Supplier Part" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
return renderLink(value, `/supplier-part/${row.pk}/`);
|
return renderLink(value, `/supplier-part/${row.pk}/`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -746,7 +769,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'manufacturer_detail.name',
|
field: 'manufacturer_detail.name',
|
||||||
title: '{% trans "Manufacturer" %}',
|
title: '{% trans "Manufacturer" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
if (value && row.manufacturer_detail) {
|
if (value && row.manufacturer_detail) {
|
||||||
var name = value;
|
var name = value;
|
||||||
var url = `/company/${row.manufacturer_detail.pk}/`;
|
var url = `/company/${row.manufacturer_detail.pk}/`;
|
||||||
@ -764,7 +787,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'manufacturer_part_detail.MPN',
|
field: 'manufacturer_part_detail.MPN',
|
||||||
title: '{% trans "MPN" %}',
|
title: '{% trans "MPN" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row) {
|
||||||
if (value && row.manufacturer_part) {
|
if (value && row.manufacturer_part) {
|
||||||
return renderLink(value, `/manufacturer-part/${row.manufacturer_part}/`);
|
return renderLink(value, `/manufacturer-part/${row.manufacturer_part}/`);
|
||||||
} else {
|
} else {
|
||||||
@ -775,7 +798,7 @@ function loadSupplierPartTable(table, url, options) {
|
|||||||
{
|
{
|
||||||
field: 'link',
|
field: 'link',
|
||||||
title: '{% trans "Link" %}',
|
title: '{% trans "Link" %}',
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
return renderLink(value, value);
|
return renderLink(value, value);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user