From 73ed2d90019c08f3b043a7ef15624badbd26f41c Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sat, 18 Apr 2026 23:32:21 +0000 Subject: [PATCH] [monitoring] Add detailed-payslips table + full-deductions panels Two new panels below the 4 existing ones: - Detailed table: every payslip sorted by pay_date DESC with all fields (gross, all deductions, net, tax_year, validated flag, paperless_doc_id). Footer reducer sums the numeric columns. - Full deductions stacked bars: income_tax + NI + pension_employee + pension_employer + student_loan per payslip. The earlier panel only showed 4 deductions; this one shows the complete picture. --- .../monitoring/dashboards/uk-payslip.json | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) diff --git a/stacks/monitoring/modules/monitoring/dashboards/uk-payslip.json b/stacks/monitoring/modules/monitoring/dashboards/uk-payslip.json index 67e22ca3..123ed959 100644 --- a/stacks/monitoring/modules/monitoring/dashboards/uk-payslip.json +++ b/stacks/monitoring/modules/monitoring/dashboards/uk-payslip.json @@ -368,6 +368,243 @@ "editorMode": "code" } ] + }, + { + "id": 5, + "title": "All payslips \u2014 detailed breakdown", + "type": "table", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "payslips-pg" + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 18 + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "right", + "cellOptions": { + "type": "auto" + }, + "inspect": true + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "pay_date" + }, + "properties": [ + { + "id": "custom.width", + "value": 110 + }, + { + "id": "custom.align", + "value": "left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "employer" + }, + "properties": [ + { + "id": "custom.width", + "value": 150 + }, + { + "id": "custom.align", + "value": "left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tax_year" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "validated" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "mappings", + "value": [ + { + "type": "value", + "options": { + "true": { + "color": "green", + "text": "\u2713" + }, + "false": { + "color": "red", + "text": "\u26a0" + } + } + } + ] + } + ] + }, + { + "matcher": { + "id": "byType", + "options": "number" + }, + "properties": [ + { + "id": "unit", + "value": "currencyGBP" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "paperless_doc_id" + }, + "properties": [ + { + "id": "unit", + "value": "none" + }, + { + "id": "custom.width", + "value": 80 + } + ] + } + ] + }, + "options": { + "footer": { + "show": true, + "reducer": [ + "sum" + ], + "fields": [ + "gross_pay", + "net_pay", + "income_tax", + "national_insurance", + "pension_employee", + "pension_employer", + "student_loan" + ] + } + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "payslips-pg" + }, + "rawQuery": true, + "editorMode": "code", + "format": "table", + "rawSql": "SELECT pay_date, employer, tax_year, gross_pay, income_tax, national_insurance, pension_employee, pension_employer, student_loan, COALESCE(other_deductions, '{}'::jsonb) AS other_deductions, net_pay, validated, paperless_doc_id FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date DESC" + } + ] + }, + { + "id": 6, + "title": "All deductions (incl. pension_employer + other)", + "type": "timeseries", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "payslips-pg" + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 32 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "bars", + "stacking": { + "mode": "normal" + }, + "fillOpacity": 80, + "lineWidth": 0, + "axisCenteredZero": false + }, + "unit": "currencyGBP", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "options": { + "legend": { + "showLegend": true, + "placement": "right" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "payslips-pg" + }, + "rawQuery": true, + "editorMode": "code", + "format": "time_series", + "rawSql": "SELECT pay_date AS \"time\", income_tax, national_insurance, pension_employee, pension_employer, student_loan FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date" + } + ] } ], "refresh": "5m",