# W2-TAB — «Open in new tab» everywhere (FE only)

Read `_COMMON.md` first. Runs AFTER all W1 FE work (it touches many list templates).

Client: «البرنامج عايزين يكون فيه إمكانية open in new tab لأنها بضان جداً مبرضاش يفتح».

Today: expanded sidebar leaves are real `<a [routerLink]>` (`layout/sidebar/sidebar.component.html:97-104,124-133,145-150,245,274,293,387`), `module-nav.component.ts:35` too; deep-link reload works (`/home/moonui3/public_html/app/.htaccess` fallback, `<base href="/app/">`, token in localStorage `core/services/auth.service.ts:42-46`). NOT anchors: mini-sidebar popover links (`sidebar.component.html:346-375`, `navigateFromMini`), sidebar search results (`:47-50,197`), topbar mega-menu items + module buttons (`topbar.component.html:43-45,78-80`), command bar, mobile tab bar. List rows: View/Edit are `<p-button (onClick)>` opening in-page dialogs (e.g. `purchases/orders/orders.component.html:51-57`, `sales/invoices/invoices.component.html:111`); linked-document chips use `router.navigate` (`orders.component.ts:1502`). `?viewId=` deep-link is handled in 33 components (e.g. `orders.component.ts:731-737`). Shared `data-table.component.ts` has no row links. Default sidebar style `compact` (`core/models/theme.model.ts:136`).

Build:
1. Every navigation surface in the layout becomes a real anchor with `routerLink` (+ queryParams) so right-click «فتح في علامة تبويب جديدة», Ctrl/Cmd-click and middle-click work, while a normal click behaves exactly as today (close popover, etc.). Mini popover, sidebar search, topbar mega menu + module buttons, command bar results, mobile tab bar, notifications links, dashboard cards/links.
2. Document lists: in the 33 components that support `?viewId=`, make the document number cell an anchor `[routerLink]="[]" [queryParams]="{viewId: row.id}"` (plain click keeps opening the in-page view dialog as now — intercept plain left click without modifiers and preventDefault; let modified/middle clicks fall through to the browser). Do it through ONE shared directive (e.g. `appDocLink` that renders the href and handles the plain-click callback) so each template change is tiny. Linked-document chips (`router.navigate` in orders and similar) → same directive.
3. Make sure opening `…/app/<route>?viewId=123` in a fresh tab opens that record's view dialog after load (verify a few: sales invoice, purchase order, inventory transfer, clinic appointment if applicable).
4. `ng build` green. Sample manual check list in your report (which screens you converted).
Out of scope: changing dialogs into routed pages.
