Removed developer logs
This commit is contained in:
parent
587ab6edf5
commit
bee51701cd
|
|
@ -1,20 +1,16 @@
|
||||||
frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
console.log("Initializing tab system...");
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const tabs = this.wrapper.find("ul.form-tabs > li.nav-item");
|
const tabs = this.wrapper.find("ul.form-tabs > li.nav-item");
|
||||||
console.log(`Found ${tabs.length} main tabs.`);
|
|
||||||
|
|
||||||
const doctype = this.frm.doctype;
|
const doctype = this.frm.doctype;
|
||||||
const hierarchy = frappe.boot.tab_hierarchy[doctype];
|
const hierarchy = frappe.boot.tab_hierarchy[doctype];
|
||||||
|
|
||||||
if (!hierarchy) {
|
if (!hierarchy) {
|
||||||
console.warn(`No hierarchy found for Doctype: ${doctype}`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const subtabs = hierarchy.subtabs || {};
|
const subtabs = hierarchy.subtabs || {};
|
||||||
console.log("Subtabs:", subtabs);
|
|
||||||
|
|
||||||
// Function to show tab content
|
// Function to show tab content
|
||||||
function showTabContent(tabId) {
|
function showTabContent(tabId) {
|
||||||
|
|
@ -22,9 +18,7 @@ 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');
|
||||||
console.log(`Tab content for '${tabId}' is now visible.`);
|
|
||||||
} else {
|
} else {
|
||||||
console.error(`Tab with ID '${tabId}' not found.`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,11 +44,9 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parentTabName) {
|
if (!parentTabName) {
|
||||||
console.log(`Parent tab not found for: ${currentTabName}`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Parent tab: ${parentTabName}`);
|
|
||||||
|
|
||||||
// Show the subtabs for the parent tab
|
// Show the subtabs for the parent tab
|
||||||
const parentSubtabs = subtabs[parentTabName] || [];
|
const parentSubtabs = subtabs[parentTabName] || [];
|
||||||
|
|
@ -65,15 +57,12 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
|
|
||||||
if (subtabElement.length) {
|
if (subtabElement.length) {
|
||||||
subtabElement.css("display", "block");
|
subtabElement.css("display", "block");
|
||||||
console.log(`Made subtab visible: ${subtabName}`);
|
|
||||||
|
|
||||||
// If the current tab is the subtab, show its content
|
// If the current tab is the subtab, show its content
|
||||||
if (subtabName === currentTabName) {
|
if (subtabName === currentTabName) {
|
||||||
subtabContent.addClass("active show").css("display", "block");
|
subtabContent.addClass("active show").css("display", "block");
|
||||||
console.log(`Displayed content for subtab: '${subtabName}'`);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Subtab element not found in DOM: '${subtabName}'`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -87,21 +76,18 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
// Process subtabs
|
// Process subtabs
|
||||||
tabs.each((index, tab) => {
|
tabs.each((index, tab) => {
|
||||||
const tabLabel = $(tab).text().trim();
|
const tabLabel = $(tab).text().trim();
|
||||||
console.log(`Processing subtabs for main tab: '${tabLabel}'`);
|
|
||||||
|
|
||||||
if (subtabs[tabLabel]) {
|
if (subtabs[tabLabel]) {
|
||||||
const tabContentId = $(tab).find("a").attr("aria-controls");
|
const tabContentId = $(tab).find("a").attr("aria-controls");
|
||||||
const tabContent = $(`#${tabContentId}`);
|
const tabContent = $(`#${tabContentId}`);
|
||||||
|
|
||||||
if (!tabContent.length) {
|
if (!tabContent.length) {
|
||||||
console.warn(`Content container not found for main tab: '${tabLabel}'`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sectionContainer = tabContent.find(".row.form-section.card-section.visible-section");
|
const sectionContainer = tabContent.find(".row.form-section.card-section.visible-section");
|
||||||
|
|
||||||
if (!sectionContainer.length) {
|
if (!sectionContainer.length) {
|
||||||
console.warn(`Section container not found for main tab: '${tabLabel}'`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +107,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
|
|
||||||
subtabContainer.append(subtabClone);
|
subtabContainer.append(subtabClone);
|
||||||
subtabElement.remove();
|
subtabElement.remove();
|
||||||
console.log(`Processed subtab: '${subtab}' under main tab '${tabLabel}'`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -132,14 +117,11 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
const clickedTab = $(this);
|
const clickedTab = $(this);
|
||||||
const tabId = clickedTab.find("a").attr("aria-controls");
|
const tabId = clickedTab.find("a").attr("aria-controls");
|
||||||
|
|
||||||
console.log(`Main tab clicked: '${clickedTab.text().trim()}' (ID: ${tabId})`);
|
|
||||||
|
|
||||||
hideAllTabContents();
|
hideAllTabContents();
|
||||||
|
|
||||||
const tabContent = document.querySelector(`#${tabId}`);
|
const tabContent = document.querySelector(`#${tabId}`);
|
||||||
if (tabContent) {
|
if (tabContent) {
|
||||||
$(tabContent).addClass("active show").css("display", "block");
|
$(tabContent).addClass("active show").css("display", "block");
|
||||||
console.log(`Activated main tab: '${tabId}' with content shown.`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".nav-item").removeClass("active");
|
$(".nav-item").removeClass("active");
|
||||||
|
|
@ -149,7 +131,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
const containerParentId = $(this).attr("data-parent-id");
|
const containerParentId = $(this).attr("data-parent-id");
|
||||||
if (containerParentId === tabId) {
|
if (containerParentId === tabId) {
|
||||||
$(this).find(".sub-tab").css("display", "block");
|
$(this).find(".sub-tab").css("display", "block");
|
||||||
console.log(`Displaying subtabs for parent tab: '${tabId}'`);
|
|
||||||
} else {
|
} else {
|
||||||
$(this).find(".sub-tab").css("display", "none");
|
$(this).find(".sub-tab").css("display", "none");
|
||||||
}
|
}
|
||||||
|
|
@ -164,8 +145,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
const subtabId = clickedSubtab.find("a").attr("aria-controls");
|
const subtabId = clickedSubtab.find("a").attr("aria-controls");
|
||||||
const subtabName = clickedSubtab.text().trim();
|
const subtabName = clickedSubtab.text().trim();
|
||||||
|
|
||||||
console.log(`Subtab clicked: '${subtabName}' (ID: ${subtabId})`);
|
|
||||||
|
|
||||||
$(".sub-tab").removeClass("active");
|
$(".sub-tab").removeClass("active");
|
||||||
clickedSubtab.addClass("active");
|
clickedSubtab.addClass("active");
|
||||||
|
|
||||||
|
|
@ -174,7 +153,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
const subtabContent = $(`#${subtabId}`);
|
const subtabContent = $(`#${subtabId}`);
|
||||||
if (subtabContent.length) {
|
if (subtabContent.length) {
|
||||||
subtabContent.addClass("active show").css("display", "block");
|
subtabContent.addClass("active show").css("display", "block");
|
||||||
console.log(`Displaying content for subtab: '${subtabName}'`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
findParentAndShowSubtabs(subtabName);
|
findParentAndShowSubtabs(subtabName);
|
||||||
|
|
@ -194,10 +172,6 @@ frappe.ui.form.Layout.prototype.setup_tab_events = function () {
|
||||||
})
|
})
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
console.log("Debug State:");
|
|
||||||
console.log("Active Main Tab:", activeMainTab);
|
|
||||||
console.log("Active Subtabs:", activeSubTabs);
|
|
||||||
console.log("Visible Content:", visibleContent);
|
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue