This commit is contained in:
oliver committed 2026-10-12 10:09:44 -03:00
1 parent 1ea3de74f2
commit 9db080faea
8 files changed
+2064 -55

No files matched your search

+59 -8
View File
@@ -15,6 +15,12 @@ The page calls the webhook directly:
https://brandize.app.n8n.cloud/webhook/bi-dashboard
```
via a **POST** request with a JSON body:
```json
{ "query": "Summe je Abgangsland", "month": "2026-SEP" }
```
The webhook sends CORS headers (it reflects the request `Origin`, including
`null` for `file://`), so a direct browser call works.
@@ -24,9 +30,11 @@ The left sidebar groups reports by topic:
- **Amazon** → *Umsatz je Abgangsland* (Brutto inkl. USt je Abgangsland)
- **Amazon** → *VAT Summary* (USt-Übersicht je Land)
- **ODOO** → *Dashboard* (placeholder, to follow)
- **ODOO** → *Rechnungen pro Monat* (Pivot über Odoo-Rechnungen)
- **Gesamt** → *Alle Rechnungen pro Monat* (PivotTable.js-Experiment)
- **Schweiz** → *Quartal Schweiz* (AMAZON + ODOO, Lieferung in die Schweiz)
Both groups start collapsed, so no submenu is visible when the page opens.
All groups start collapsed, so no submenu is visible when the page opens.
Clicking a topic expands its submenu; clicking a submenu item switches the
view.
@@ -49,8 +57,11 @@ Gesamt row:
- *Umsatz je Abgangsland* → `umsatz-je-abgangsland_YYYY-MMM.csv`
- *VAT Summary* → `vat-summary_YYYY-MMM.csv`
- *Rechnungen pro Monat* → `odoo-rechnungen_YYYY-MMM.csv`
- *Alle Rechnungen pro Monat* → `gesamt-rechnungen-pivot_YYYY-MMM.csv`
- *Quartal Schweiz* → `schweiz-quartal_YYYY-QN.csv`
The button is disabled on dashboards without data (e.g. the ODOO placeholder).
The button is disabled while no dataset is loaded for the current dashboard.
## Filter
@@ -58,15 +69,55 @@ A shared filter bar sits above every dashboard (labelled **Filter** with a
funnel icon and the hint *gilt für alle Dashboards*). It holds the **Zeitraum**
month + year selector (e.g. `2026-SEP`) and the reload button, and stays visible
across all views. The previous month is preselected. The selected period is
sent to the webhook as `?month=YYYY-MMM`, matching the `%(month)s` parameter
used in `../sql/Summe_je_Abgangsland.sql`.
sent to the webhook in the POST body as `month` (e.g. `2026-SEP`), matching the
`%(month)s` parameter used in `../sql/*.sql`.
The invoice dashboards (*ODOO Rechnungen pro Monat*, *Alle Rechnungen pro Monat*
and *Quartal Schweiz*) have an additional, dashboard-specific filter row. *ODOO
Rechnungen pro Monat* filters by **Tag**, **Bestellnummer**, **Lieferland** and
**Rechnungsnummer**; *Alle Rechnungen pro Monat* and *Quartal Schweiz* add a
**Quelle** field. Filtering re-renders the KPIs, chart and pivot live.
For *Quartal Schweiz* the shared **Zeitraum** control shows a **quarter**
selector (Q1–Q4) instead of the month selector; the year selector is shared.
## Pivot (Experiment)
The three invoice dashboards (*ODOO Rechnungen pro Monat*, *Alle Rechnungen pro
Monat* and *Quartal Schweiz*) render their data as an interactive
[PivotTable.js](https://pivottable.js.org/) pivot instead of a detail table.
The pivot's rows, columns, values and aggregator are freely configurable in the
pivotUI control panel; the renderer is fixed to *Table*. Each dashboard has its
own filter row and **Vorlage** dropdown with presets:
- *ODOO Rechnungen pro Monat*: *Standard* (**Rechnungsland** rows, no column
group, **Sum(Gesamtpreis brutto)**) and *Zahlart*.
- *Alle Rechnungen pro Monat* and *Quartal Schweiz*: *Standard* (**Quelle**
rows, no column group, **Sum(Gesamtpreis brutto)**) and *Rechnungsland
(Spalten)* (adds **Rechnungsland** as the column group).
*Quartal Schweiz* is filtered to invoices with a **delivery into Switzerland**.
Applying a preset also resets the filters. The chosen layout is kept while you
type in the filters.
It loads jQuery, jQuery UI and PivotTable.js from public CDNs, so — unlike the
rest of the app — it needs an **internet connection** to render; offline it shows
a short message instead. To vendor the libraries locally, download them next to
`index.html` and change the `<link>`/`<script>` URLs in the `<head>`.
## Data sources
One request to the webhook returns both datasets, which are read by key:
Because the datasets are large, the dashboard requests **only the dataset of
the currently displayed dashboard** — one POST per dashboard, sent only when
that dashboard is opened or reloaded. Nothing is prefetched. The dataset is
selected with the `query` field:
- `Summe je Abgangsland` → the *Umsatz je Abgangsland* report
- `VAT Summary` → the *VAT Summary* report
- *Umsatz je Abgangsland* → `query: "Summe je Abgangsland"`
- *VAT Summary* → `query: "VAT Summary"`
- *Rechnungen pro Monat* → `query: "ODOO Rechnungen pro Monat"`
- *Alle Rechnungen pro Monat* → `query: "Alle Rechnungen pro Monat"`
- *Quartal Schweiz* → `query: "Quartal Schweiz"` (sends `quarter` instead of `month`)
## Files