mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add options to show / hide form groups
This commit is contained in:
parent
cb11df4dba
commit
5cbb67b91c
@ -842,10 +842,12 @@ function handleFormErrors(errors, fields, options) {
|
||||
|
||||
var non_field_errors = $(options.modal).find('#non-field-errors');
|
||||
|
||||
// TODO: Display the JSON error text when hovering over the "info" icon
|
||||
non_field_errors.append(
|
||||
`<div class='alert alert-block alert-danger'>
|
||||
<b>{% trans "Form errors exist" %}</b>
|
||||
<span id='form-errors-info' class='float-right fas fa-info-circle icon-red'></span>
|
||||
<span id='form-errors-info' class='float-right fas fa-info-circle icon-red'>
|
||||
</span>
|
||||
</div>`
|
||||
);
|
||||
|
||||
@ -985,6 +987,28 @@ function initializeGroups(fields, options) {
|
||||
} else {
|
||||
$(modal).find(`#form-panel-content-${group}`).collapse("show");
|
||||
}
|
||||
|
||||
if (group_options.hidden) {
|
||||
hideFormGroup(group, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide a form group
|
||||
function hideFormGroup(group, options) {
|
||||
$(options.modal).find(`#form-panel-${group}`).hide();
|
||||
}
|
||||
|
||||
// Show a form group
|
||||
function showFormGroup(group, options) {
|
||||
$(options.modal).find(`#form-panel-${group}`).show();
|
||||
}
|
||||
|
||||
function setFormGroupVisibility(group, vis, options) {
|
||||
if (vis) {
|
||||
showFormGroup(group, options);
|
||||
} else {
|
||||
hideFormGroup(group, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user