Commit Graph

37 Commits

Author SHA1 Message Date
Ali 63476b39aa fix: keep subtabs open when Frappe re-activates a tab
Frappe's tab model does not know subtabs exist. Tab.set_active() strips
`show active` off every pane except the one it activates, and Frappe calls it on
every refresh_sections() — which runs on every refresh_field() and every value
change. So editing any field wiped the open subtab: its content appeared for a
fraction of a second and vanished.

Clicking a subtab now registers its top-level ancestor as the active tab, so
Frappe's own bookkeeping stays coherent and keeps re-activating the right tab, and
Tab.set_active is wrapped to re-assert the rest of the chain once Frappe is done.

The whole ancestor chain has to be restored, not just the leaf: subtabs nest two
deep in several declarations, where the top pane holds the first subtab bar, the
middle pane holds the second and the leaf holds the content — three panes active
at once, which Frappe's one-tab-at-a-time model will never do on its own.

This replaces the MutationObserver, which was fighting the same battle from the
wrong end: it could not tell a genuine tab switch from a refresh re-asserting the
tab already open.

Verified: 70 subtabs across 11 doctypes stay visible through refresh_field() and
refresh_sections().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:22:07 +00:00
Ali 7d9fb69f3b perf(assets): serve desk js/css as hashed bundles
Rename custom_subtabs.js/.css to .bundle.js/.bundle.css so esbuild emits
content-hashed filenames → automatic cache-busting (no more nginx 1-year
stale-asset issue on edits). setup_custom_subtabs is defined and called
within the file (verified self-contained), so esbuild's IIFE wrap is safe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 10:28:31 +00:00
Ali c5e637fef2 fix: keep subtab bar above content when subtab panes precede parent
The subtab bar lives inside the parent tab pane. When the doctype's field_order
places the subtab content panes BEFORE the parent pane (e.g. E-Taxes Settings
"Data": customers_tab/suppliers_tab come before data_tab), the activated content
renders above the bar and pushes it off-screen — looking like the subtabs vanished.
Parents whose children come after them (e.g. "Mappings") were unaffected.

On subtab click, move the active content pane to sit right after the parent pane
so the bar always renders above it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 09:53:30 +00:00
Ali 5719f9017e fix: keep subtab bar visible on subtab click (drop cloned Frappe handler)
clone(true) copied Frappe's per-nav-link click handler (tab.js -> set_active)
onto the subtab buttons, so every subtab click also ran set_active(), which
deactivates the parent tab pane that physically contains the subtab buttons.
Our handler then had to undo it by reconstructing the parent pane id from the
(translated) label — fragile.

Drop the copied handler on cloned subtab links, and restore the parent pane
by its reliable data-parent-id instead of label string-building.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 09:46:45 +00:00
Ali a915f82aed fix: match subtabs by translated label, not raw English key
tab_hierarchy stores raw (English) Tab Break labels, but Frappe renders
tab text through __(), so under AZ/RU the DOM text never equals the
hierarchy key and subtabs silently stay flat (e.g. E-Taxes Settings,
Bank Integration Profile). Doctypes with native-AZ labels were unaffected.

Compare DOM tab text against tr(key) at the matching boundary; keep all
internal bookkeeping (childToParentMap, data-subtab-name) in English so
clicks and parent-chain reveal stay consistent across languages.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 09:29:37 +00:00
Ali 174fbe8f29 subtab bug fix 2026-01-12 19:14:24 +04:00
Ali 5cf9e982dd subtab bug fix 2026-01-12 18:57:01 +04:00
Ali 994d44cdaf subtab bug fix 2026-01-12 18:51:42 +04:00
Ali 9d57da7061 subtab bug fix 2026-01-12 18:45:00 +04:00
Ali 751de46b7b fix: add error handling and safe attribute access in boot_session_handler
Problem:
- boot_session_handler was failing silently for some DocTypes
- Direct access to field.js_parent_subtab caused AttributeError
- DocTypes with errors prevented entire hierarchy from being built

Solution:
- Added try-except around DocType processing loop
- Changed field.js_parent_subtab to getattr(field, 'js_parent_subtab', None)
- Errors are logged but don't break the entire boot process

Result:
- All DocTypes with subtabs now properly included in tab_hierarchy
- "Declaration of value added tax" and similar DocTypes now work correctly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 18:38:19 +04:00
Ali ff3924f0fd fix: hide entire subtab container instead of just subtabs
Problem:
- When switching to a tab without subtabs, the subtab text was hidden
- But the container remained visible with border and took up space
- Invisible buttons were still clickable and could switch to previous subtabs
- Cursor changed to pointer over the invisible container

Solution:
- Changed logic to hide/show entire .sub-tab-container instead of individual .sub-tab elements
- Now container is completely removed from layout when not active
- Prevents phantom clicks and visual artifacts

Changed in custom_subtabs.js (lines 192, 194):
- Before: $(this).find(".sub-tab").show/hide()
- After: $(this).show/hide()

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 18:29:20 +04:00
Ali 2a97ca39bc fix: add DocType reload and cache clear to patch
- Added frappe.reload_doc() after modifying docfield.json
- Added frappe.clear_cache() to ensure changes are applied
- Now patch automatically syncs JSON changes to database
- Fixed issue where js_parent_subtab field existed in JSON but not in DB

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 17:33:26 +04:00
Ali 76b178b93a fixed subtabs for v16 2025-12-09 15:52:37 +04:00
Away e5e7e3b93c removed logs 2025-04-01 10:12:52 +00:00
Away d1e4598d22 commented fixtures 2025-04-01 10:09:53 +00:00
Away 0536f4f335 commented fixtures 2025-04-01 10:08:25 +00:00
Away 0852ec3a44 commented fixtures 2025-04-01 10:06:09 +00:00
Away 4c6c3c3f9e commented fixtures 2025-04-01 10:03:15 +00:00
Away 71ded58b0a added script for subtab field 2025-04-01 09:41:32 +00:00
Away 8d3e6aa467 added js_parent field that was deleted 2025-04-01 09:12:30 +00:00
Ali b0e7dcd8c0 Fixed bug when subtabs won't work in doctype with seperate name 2024-12-05 14:36:14 +04:00
Ali a77620953f Fixed bug when subtabs works only in Items doctype 2024-12-05 14:23:33 +04:00
Ali bee51701cd Removed developer logs 2024-12-05 13:01:54 +04:00
Ali 587ab6edf5 Sub and Sub Sub Tabs works well 2024-12-04 23:00:43 +04:00
ali 9fc4ad8c23 Исправлен баг с дублированием поля 2024-12-04 12:37:36 +00:00
ali 6cc4125650 Удалить custom_subtabs/fixtures/custom_fieldtest.json 2024-12-04 12:12:43 +00:00
ali cc83182151 revert 0eed82a049
revert Лишний файл который конфликтует с созданием поля
2024-12-04 12:11:41 +00:00
ali a071b674b0 revert 79f7ee2830
revert Обновить custom_subtabs/hooks.py
2024-12-04 12:11:22 +00:00
ali 96e638b500 revert d8decd20d3
revert Не нужен
2024-12-04 12:10:10 +00:00
ali 79f7ee2830 Обновить custom_subtabs/hooks.py 2024-12-04 11:10:16 +00:00
ali 0eed82a049 Лишний файл который конфликтует с созданием поля 2024-12-04 11:09:53 +00:00
ali d8decd20d3 Не нужен 2024-12-04 09:52:09 +00:00
ali dcfe5262a5 Обновить custom_subtabs/fixtures/custom_fieldtest.json 2024-12-04 09:47:26 +00:00
Awey01 4af4298a09 Subtabs are in perfect state, with perfect visual, but no sub-subtabs 2024-12-03 13:02:34 +00:00
Awey01 1a0be36b24 Added sub-subtabs with poor visual 2024-12-03 11:26:02 +00:00
Awey01 461d6424f0 first commit 2024-12-02 13:08:47 +00:00
Awey01 314954dd18 feat: Initialize App 2024-11-07 19:23:30 +00:00