# baselghanem/dad_sales architecture

> Architecture diagram of the GitHub repository baselghanem/dad_sales, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/baselghanem/dad_sales
- Repository: https://github.com/baselghanem/dad_sales

## Overview

DAD Sales is a static, client-side sales analytics portal. Users sign in with published credentials, then role-specific dashboards read and filter Excel sales data for representatives, supervisors, business units, or the country manager. The principal flow is credential validation and role routing, followed by worker-based workbook parsing and dashboard views. Supporting capabilities include customer profiles, opportunities and follow-up priorities, bonus analysis, target comparisons and administration, and multi-year sales selection. Edges reflect README statements and sampled source; unsampled page wiring is left out where it cannot be verified.

Main entry points: [`dashboard.js`](https://github.com/baselghanem/dad_sales/blob/main/dashboard.js) (Dashboard analytics), [`targets/source.js`](https://github.com/baselghanem/dad_sales/blob/main/targets/source.js) (Target data source), [`app.js`](https://github.com/baselghanem/dad_sales/blob/main/app.js) (Sign-in), [`parser.worker.js`](https://github.com/baselghanem/dad_sales/blob/main/parser.worker.js) (Workbook parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and roles"]
  node_login["Sign-in<br/>[app.js]"]
  node_credentials["Credential validation<br/>[credentials.js]"]
  node_browser[("Browser storage")]
end

subgraph group_sales["Sales analytics"]
  node_rep["Representative view"]
  node_supervisor["Supervisor view<br/>[supervisor.html]"]
  node_bu["Business unit views"]
  node_country["Country manager view"]
  node_salesdata[("Sales workbook<br/>[Up.xlsx]")]
  node_parser["Workbook parser<br/>[parser.worker.js]"]
  node_dashboard["Dashboard analytics<br/>[dashboard.js]"]
  node_years["Year selection<br/>[sales-years.js]"]
  node_bonus["Bonus analysis<br/>[bonus.js]"]
  node_xlsx["XLSX library"]
end

subgraph group_insights["Customer insights"]
  node_profile["Customer profiles"]
  node_opportunities["Opportunities<br/>[opportunities.js]"]
end

subgraph group_targets["Targets"]
  node_targetsdata[("Target workbook<br/>[target.xlsx]")]
  node_targetmodel["Target model<br/>[model.js]"]
  node_targetsource["Target data source<br/>[source.js]"]
  node_targetcompare["Target comparison<br/>[comparison.js]"]
  node_targetadmin["Target administration<br/>[admin.js]"]
  node_areas["Approved target areas<br/>[areas.json]"]
end

node_user(("Portal user"))

node_user -->|"signs in"| node_login
node_login -->|"loads credentials"| node_credentials
node_login -->|"stores session"| node_browser
node_login -->|"routes representatives"| node_rep
node_login -->|"routes supervisors"| node_supervisor
node_login -->|"routes business units"| node_bu
node_login -->|"routes country manager"| node_country
node_rep -->|"loads dashboard"| node_dashboard
node_supervisor -->|"loads dashboard"| node_dashboard
node_bu -->|"loads dashboard"| node_dashboard
node_country -->|"loads dashboard"| node_dashboard
node_dashboard -.->|"starts worker"| node_parser
node_parser -->|"fetches workbook"| node_salesdata
node_parser -->|"parses workbook"| node_xlsx
node_parser -->|"returns sales rows"| node_dashboard
node_dashboard -.->|"selects years"| node_years
node_dashboard -->|"renders bonus views"| node_bonus
node_dashboard -.->|"opens profiles"| node_profile
node_dashboard -.->|"opens opportunities"| node_opportunities
node_targetadmin -->|"checks data"| node_targetsource
node_targetcompare -->|"fetches targets"| node_targetsource
node_targetsource -->|"fetches workbook"| node_targetsdata
node_targetsource -->|"loads approved areas"| node_areas
node_targetsource -->|"loads sales history"| node_parser
node_targetsource -->|"validates targets"| node_targetmodel
node_targetcompare -->|"builds comparison"| node_targetmodel
node_targetcompare -->|"loads comparison data"| node_targetsource
node_dashboard -.->|"loads optional targets"| node_targetsource

click node_login "https://github.com/baselghanem/dad_sales/blob/main/app.js"
click node_credentials "https://github.com/baselghanem/dad_sales/blob/main/credentials.js"
click node_rep "https://github.com/baselghanem/dad_sales/blob/main/representative.html"
click node_supervisor "https://github.com/baselghanem/dad_sales/blob/main/supervisor.html"
click node_bu "https://github.com/baselghanem/dad_sales/blob/main/business-unit-chronic.html"
click node_country "https://github.com/baselghanem/dad_sales/blob/main/country-manager.html"
click node_salesdata "https://github.com/baselghanem/dad_sales/blob/main/data/Up.xlsx"
click node_parser "https://github.com/baselghanem/dad_sales/blob/main/parser.worker.js"
click node_dashboard "https://github.com/baselghanem/dad_sales/blob/main/dashboard.js"
click node_years "https://github.com/baselghanem/dad_sales/blob/main/sales-years.js"
click node_bonus "https://github.com/baselghanem/dad_sales/blob/main/bonus.js"
click node_profile "https://github.com/baselghanem/dad_sales/blob/main/customer-profile.js"
click node_opportunities "https://github.com/baselghanem/dad_sales/blob/main/opportunities.js"
click node_targetsdata "https://github.com/baselghanem/dad_sales/blob/main/data/target.xlsx"
click node_targetmodel "https://github.com/baselghanem/dad_sales/blob/main/targets/model.js"
click node_targetsource "https://github.com/baselghanem/dad_sales/blob/main/targets/source.js"
click node_targetcompare "https://github.com/baselghanem/dad_sales/blob/main/targets/comparison.js"
click node_targetadmin "https://github.com/baselghanem/dad_sales/blob/main/targets/admin.js"
click node_areas "https://github.com/baselghanem/dad_sales/blob/main/targets/areas.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_login,node_credentials,node_browser,node_user toneBlue
class node_rep,node_supervisor,node_bu,node_country,node_salesdata,node_parser,node_dashboard,node_years,node_bonus,node_xlsx toneAmber
class node_profile,node_opportunities toneMint
class node_targetsdata,node_targetmodel,node_targetsource,node_targetcompare,node_targetadmin,node_areas toneRose
```

## Components

### Access and roles

- [Sign-in](https://github.com/baselghanem/dad_sales/blob/main/app.js): `app.js`
- [Credential validation](https://github.com/baselghanem/dad_sales/blob/main/credentials.js): `credentials.js`
- **Browser storage**

### Sales analytics

- [Representative view](https://github.com/baselghanem/dad_sales/blob/main/representative.html): `representative.html`
- [Supervisor view](https://github.com/baselghanem/dad_sales/blob/main/supervisor.html): `supervisor.html`
- [Business unit views](https://github.com/baselghanem/dad_sales/blob/main/business-unit-chronic.html): `business-unit-chronic.html`
- [Country manager view](https://github.com/baselghanem/dad_sales/blob/main/country-manager.html): `country-manager.html`
- [Sales workbook](https://github.com/baselghanem/dad_sales/blob/main/data/Up.xlsx): `data/Up.xlsx`
- [Workbook parser](https://github.com/baselghanem/dad_sales/blob/main/parser.worker.js): `parser.worker.js`
- [Dashboard analytics](https://github.com/baselghanem/dad_sales/blob/main/dashboard.js): `dashboard.js`
- [Year selection](https://github.com/baselghanem/dad_sales/blob/main/sales-years.js): `sales-years.js`
- [Bonus analysis](https://github.com/baselghanem/dad_sales/blob/main/bonus.js): `bonus.js`
- **XLSX library**

### Customer insights

- [Customer profiles](https://github.com/baselghanem/dad_sales/blob/main/customer-profile.js): `customer-profile.js`
- [Opportunities](https://github.com/baselghanem/dad_sales/blob/main/opportunities.js): `opportunities.js`

### Targets

- [Target workbook](https://github.com/baselghanem/dad_sales/blob/main/data/target.xlsx): `data/target.xlsx`
- [Target model](https://github.com/baselghanem/dad_sales/blob/main/targets/model.js): `targets/model.js`
- [Target data source](https://github.com/baselghanem/dad_sales/blob/main/targets/source.js): `targets/source.js`
- [Target comparison](https://github.com/baselghanem/dad_sales/blob/main/targets/comparison.js): `targets/comparison.js`
- [Target administration](https://github.com/baselghanem/dad_sales/blob/main/targets/admin.js): `targets/admin.js`
- [Approved target areas](https://github.com/baselghanem/dad_sales/blob/main/targets/areas.json): `targets/areas.json`

### Other components

- **Portal user**

## Connections

- Portal user → Sign-in: signs in (evidence: `README.md`)
- Sign-in → Credential validation: loads credentials (evidence: `README.md`)
- Sign-in → Browser storage: stores session (evidence: `app.js`)
- Sign-in → Representative view: routes representatives (evidence: `app.js`)
- Sign-in → Supervisor view: routes supervisors (evidence: `app.js`)
- Sign-in → Business unit views: routes business units (evidence: `app.js`)
- Sign-in → Country manager view: routes country manager (evidence: `app.js`)
- Representative view → Dashboard analytics: loads dashboard (evidence: `README.md`)
- Supervisor view → Dashboard analytics: loads dashboard (evidence: `README.md`)
- Business unit views → Dashboard analytics: loads dashboard (evidence: `README.md`)
- Country manager view → Dashboard analytics: loads dashboard (evidence: `README.md`)
- Dashboard analytics → Workbook parser: starts worker
- Workbook parser → Sales workbook: fetches workbook (evidence: `parser.worker.js`)
- Workbook parser → XLSX library: parses workbook (evidence: `parser.worker.js`)
- Workbook parser → Dashboard analytics: returns sales rows (evidence: `README.md`)
- Dashboard analytics → Year selection: selects years
- Dashboard analytics → Bonus analysis: renders bonus views (evidence: `dashboard.js`)
- Dashboard analytics → Customer profiles: opens profiles
- Dashboard analytics → Opportunities: opens opportunities
- Target administration → Target data source: checks data (evidence: `targets/admin.js`)
- Target comparison → Target data source: fetches targets (evidence: `targets/comparison.js`)
- Target data source → Target workbook: fetches workbook (evidence: `targets/source.js`)
- Target data source → Approved target areas: loads approved areas (evidence: `targets/source.js`)
- Target data source → Workbook parser: loads sales history (evidence: `targets/source.js`)
- Target data source → Target model: validates targets (evidence: `targets/source.js`)
- Target comparison → Target model: builds comparison (evidence: `targets/comparison.js`)
- Target comparison → Target data source: loads comparison data (evidence: `targets/comparison.js`)
- Dashboard analytics → Target data source: loads optional targets
