2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

Return all part parameters to the main part edit form

- refactor purchaseorder view
- refactor salesorder view
This commit is contained in:
Oliver
2021-07-15 16:07:46 +10:00
parent 352a58b373
commit 984e16d5af
11 changed files with 156 additions and 225 deletions

View File

@ -56,15 +56,10 @@ function activatePanel(panelName, options={}) {
// Iterate through the available 'select' elements until one matches
panelName = null;
console.log("no match for panel:", panelName);
$('.nav-toggle').each(function(item) {
var panel_name = $(this).attr('id').replace('select-', '');
console.log("checking:", panel_name);
if ($(`#panel-${panel_name}`).length && (panelName == null)) {
console.log("found match -", panel_name);
panelName = panel_name;
}

View File

@ -13,6 +13,94 @@ function yesNoLabel(value) {
}
}
function editPart(pk, options={}) {
var url = `/api/part/${pk}/`;
var fields = {
category: {
/*
secondary: {
label: '{% trans "New Category" %}',
title: '{% trans "Create New Part Category" %}',
api_url: '{% url "api-part-category-list" %}',
method: 'POST',
fields: {
name: {},
description: {},
parent: {
secondary: {
title: '{% trans "New Parent" %}',
api_url: '{% url "api-part-category-list" %}',
method: 'POST',
fields: {
name: {},
description: {},
parent: {},
}
}
},
}
},
*/
},
name: {
placeholder: 'part name',
},
IPN: {},
description: {},
revision: {},
keywords: {
icon: 'fa-key',
},
variant_of: {},
link: {
icon: 'fa-link',
},
default_location: {
/*
secondary: {
label: '{% trans "New Location" %}',
title: '{% trans "Create new stock location" %}',
},
*/
},
default_supplier: {
filters: {
part: pk,
part_detail: true,
manufacturer_detail: true,
supplier_detail: true,
},
/*
secondary: {
label: '{% trans "New Supplier Part" %}',
title: '{% trans "Create new supplier part" %}',
}
*/
},
units: {},
minimum_stock: {},
virtual: {},
is_template: {},
assembly: {},
component: {},
trackable: {},
purchaseable: {},
salable: {},
active: {},
};
constructForm(url, {
fields: fields,
title: '{% trans "Edit Part" %}',
reload: true,
});
}
function toggleStar(options) {
/* Toggle the 'starred' status of a part.
* Performs AJAX queries and updates the display on the button.