Fixed bug when subtabs works only in Items doctype
This commit is contained in:
parent
bee51701cd
commit
a77620953f
|
|
@ -3,8 +3,10 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const tabs = this.wrapper.find("ul.form-tabs > li.nav-item");
|
const tabs = this.wrapper.find("ul.form-tabs > li.nav-item");
|
||||||
|
|
||||||
const doctype = this.frm.doctype;
|
// Получение текущего Doctype в нижнем регистре
|
||||||
const hierarchy = frappe.boot.tab_hierarchy[doctype];
|
const currentDoctype = cur_frm.doctype;
|
||||||
|
|
||||||
|
const hierarchy = frappe.boot.tab_hierarchy[currentDoctype];
|
||||||
|
|
||||||
if (!hierarchy) {
|
if (!hierarchy) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -18,7 +20,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
if (tabPane) {
|
if (tabPane) {
|
||||||
tabPane.style.display = 'block';
|
tabPane.style.display = 'block';
|
||||||
tabPane.classList.add('active', 'show');
|
tabPane.classList.add('active', 'show');
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,12 +48,11 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Show the subtabs for the parent tab
|
// Show the subtabs for the parent tab
|
||||||
const parentSubtabs = subtabs[parentTabName] || [];
|
const parentSubtabs = subtabs[parentTabName] || [];
|
||||||
parentSubtabs.forEach((subtabName) => {
|
parentSubtabs.forEach((subtabName) => {
|
||||||
const subtabElement = $(`.nav-item:contains(${subtabName})`);
|
const subtabElement = $(`.nav-item:contains(${subtabName})`);
|
||||||
const subtabContentId = `item-${subtabName.toLowerCase().replace(/\s+/g, '_')}_tab`;
|
const subtabContentId = `${currentDoctype.toLowerCase()}-${subtabName.toLowerCase().replace(/\s+/g, '_')}_tab`;
|
||||||
const subtabContent = $(`#${subtabContentId}`);
|
const subtabContent = $(`#${subtabContentId}`);
|
||||||
|
|
||||||
if (subtabElement.length) {
|
if (subtabElement.length) {
|
||||||
|
|
@ -62,12 +62,12 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
if (subtabName === currentTabName) {
|
if (subtabName === currentTabName) {
|
||||||
subtabContent.addClass("active show").css("display", "block");
|
subtabContent.addClass("active show").css("display", "block");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show the parent tab's content
|
// Show the parent tab's content
|
||||||
showTabContent(`item-${parentTabName.toLowerCase().replace(/\s+/g, '_')}_tab`);
|
const parentTabContentId = `${currentDoctype.toLowerCase()}-${parentTabName.toLowerCase().replace(/\s+/g, '_')}_tab`;
|
||||||
|
showTabContent(parentTabContentId);
|
||||||
|
|
||||||
// Recursively handle the parent tab
|
// Recursively handle the parent tab
|
||||||
findParentAndShowSubtabs(parentTabName);
|
findParentAndShowSubtabs(parentTabName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue