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