mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Add base part info to [Add Supplier Part] modal form (#4427)
* Add base part info to [Add Supplier Part] modal form * fix JS style
This commit is contained in:
parent
03e105dd95
commit
f86bea75a1
@ -146,7 +146,7 @@ function supplierPartFields(options={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Launch a form to create a new ManufacturerPart
|
* Launch a form to create a new SupplierPart
|
||||||
*/
|
*/
|
||||||
function createSupplierPart(options={}) {
|
function createSupplierPart(options={}) {
|
||||||
|
|
||||||
@ -194,11 +194,26 @@ function createSupplierPart(options={}) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var header = '';
|
||||||
|
if (options.part) {
|
||||||
|
var part_model = {};
|
||||||
|
inventreeGet(`/api/part/${options.part}/.*`, {}, {
|
||||||
|
async: false,
|
||||||
|
success: function(response) {
|
||||||
|
part_model = response;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
header = constructLabel('Base Part', {});
|
||||||
|
header += renderPart('header', part_model);
|
||||||
|
header += `<div> </div>`;
|
||||||
|
}
|
||||||
|
|
||||||
constructForm('{% url "api-supplier-part-list" %}', {
|
constructForm('{% url "api-supplier-part-list" %}', {
|
||||||
fields: fields,
|
fields: fields,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
title: '{% trans "Add Supplier Part" %}',
|
title: '{% trans "Add Supplier Part" %}',
|
||||||
onSuccess: options.onSuccess,
|
onSuccess: options.onSuccess,
|
||||||
|
header_html: header,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +487,11 @@ function constructFormBody(fields, options) {
|
|||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
|
// add additional content as a header on top (provided as html by the caller)
|
||||||
|
if (options.header_html) {
|
||||||
|
html += options.header_html;
|
||||||
|
}
|
||||||
|
|
||||||
// Client must provide set of fields to be displayed,
|
// Client must provide set of fields to be displayed,
|
||||||
// otherwise *all* fields will be displayed
|
// otherwise *all* fields will be displayed
|
||||||
var displayed_fields = options.fields || fields;
|
var displayed_fields = options.fields || fields;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user