diff options
| -rw-r--r-- | clients/screens_dashboard.c | 26 | ||||
| -rw-r--r-- | clients/screens_settings.c | 70 | ||||
| -rw-r--r-- | docs/PAYROLL.md | 2 | ||||
| -rw-r--r-- | docs/PROTOCOL.md | 16 | ||||
| -rw-r--r-- | docs/STATE.md | 13 | ||||
| -rwxr-xr-x | scripts/tui-golden.py | 18 |
6 files changed, 90 insertions, 55 deletions
diff --git a/clients/screens_dashboard.c b/clients/screens_dashboard.c index a386dae..9deca37 100644 --- a/clients/screens_dashboard.c +++ b/clients/screens_dashboard.c @@ -276,8 +276,7 @@ static const char *const MAIN_ITEMS[] = { "Lönekörningar", MK_SECTION "Rapporter & bokslut", "Rapporter", "Bokslut", - MK_SECTION "Företag", - "Anställda", "Kunder", "Bolaget", "Momsregler", + "Bolaget", MK_SECTION "System", "Skattetabeller", "Revision", "Systeminställningar", MK_SECTION "Räkenskapsår", @@ -330,34 +329,25 @@ void dashboard(struct app *a) case 11: open_scene(a, "bokslut"); break; - case 13: - open_scene(a, "employees"); - break; - case 14: - open_scene(a, "customers"); - break; - case 15: + case 12: open_scene(a, "company"); break; - case 16: - open_scene(a, "rules"); - break; - case 18: + case 14: open_scene(a, "tax_tables"); break; - case 19: + case 15: open_scene(a, "audit"); break; - case 20: + case 16: open_scene(a, "system"); break; - case 22: + case 18: open_scene(a, "ib"); break; - case 23: + case 19: select_fiscal_year(a); break; - case 24: + case 20: return; default: break; /* section header */ diff --git a/clients/screens_settings.c b/clients/screens_settings.c index c6a46c5..227ee68 100644 --- a/clients/screens_settings.c +++ b/clients/screens_settings.c @@ -355,19 +355,17 @@ void system_settings_screen(struct app *a) settings_can_write(a), 0, &sel); } -void company_screen(struct app *a) +static void company_data_screen(struct app *a) { static int sel = 0; const int nf = (int)(sizeof COMPANY_FIELDS / sizeof COMPANY_FIELDS[0]); int owner = a->role[0] && strcmp(a->role, "owner") == 0; - int writer = settings_can_write(a); - const char *settings_reason = writer ? NULL : "du har inte behörighet"; for (;;) { if (g_quit) return; char *resp = client_rpc(&a->conn, "org.get", a->session, a->org, "{}"); if (!resp || !client_ok(resp)) { - show_error("Bolaget", resp); + show_error("Företagsuppgifter", resp); free(resp); return; } @@ -392,15 +390,7 @@ void company_screen(struct app *a) ff[i].kind = TUI_F_TEXT; } free(resp); - struct tui_form_action acts[3] = { - { "Fakturauppgifter…", writer ? 1 : 0, settings_reason }, - { "E-post (SMTP)…", writer ? 1 : 0, settings_reason }, - { "Styrelseledamöter", 1, NULL }, - }; - tui_form_hint("upp/ned/Tab = flytta Enter = ändra/utför" - " F5 = uppdatera Esc/q = tillbaka ^C = avsluta"); - int r = tui_form_run_actions("Bolaget", ff, nf, owner, acts, 3, NULL, - &sel); + int r = tui_form_run("Företagsuppgifter", ff, nf, owner, &sel); if (r >= 0 && r < nf) { if (!company_field_valid(&COMPANY_FIELDS[r], vals[r])) { tui_message("Ogiltigt värde", "%s", COMPANY_FIELDS[r].label); @@ -426,14 +416,58 @@ void company_screen(struct app *a) } for (int i = 0; i < nf; i++) free(vals[i]); - if (r == TUI_FORM_ACTION + 0) + if (r == TUI_FORM_BACK) + return; + } +} + +static const char *const COMPANY_ITEMS[] = { + "Företagsuppgifter", + "Fakturauppgifter", + "E-post (SMTP)", + "Styrelseledamöter", + MK_SECTION "Register", + "Anställda", + "Kunder", + "Momsregler", +}; + +void company_screen(struct app *a) +{ + static int sel = 0; + for (;;) { + if (g_quit) + return; + int r = tui_menu("Bolaget", COMPANY_ITEMS, + (int)(sizeof COMPANY_ITEMS / sizeof COMPANY_ITEMS[0]), + 0, &sel); + if (r < 0) + return; + switch (r) { + case 0: + company_data_screen(a); + break; + case 1: invoice_settings_screen(a); - else if (r == TUI_FORM_ACTION + 1) + break; + case 2: smtp_settings_screen(a); - else if (r == TUI_FORM_ACTION + 2) + break; + case 3: board_screen(a); - else if (r == TUI_FORM_BACK) - return; + break; + case 5: + employees_screen(a); + break; + case 6: + customers_screen(a); + break; + case 7: + rules_screen(a); + break; + default: + break; + } } } diff --git a/docs/PAYROLL.md b/docs/PAYROLL.md index 23e7fb1..7d7bdba 100644 --- a/docs/PAYROLL.md +++ b/docs/PAYROLL.md @@ -228,7 +228,7 @@ the base is the gross. `SMTP_FAILED` (the stored attachment stays linked). `dry_run` validates, renders and stores nothing. See `PROTOCOL.md` §7.12. - **TUI — Lön** (done, `clients/screens_payroll.c`): `Lönekörningar` (list, - Ctrl+N for a new run) under Lön, `Anställda` under Företag, and a + Ctrl+N for a new run) under Lön, `Anställda` under Bolaget, and a **Skattetabeller** screen (System, since the tables are national) with status, the Skatteverket fetch and the offline file import. - The run screen shows the preview (F5), posts with Ctrl+Enter after diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index 01f5dd1..1e9f6fa 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -959,13 +959,15 @@ commands. Implemented screens (0.1.0-dev): events, AGM and payment dates, proposed dividend, employees, other notes), edited per field; a new fiscal year inherits the stable fields. The årsredovisning draft reads them without prompting. -- **Bolaget** — the org record (name, org number, VAT number, address, - e-mail, phone, moms period, framework, fiscal-year start month), editable - in place by owners; others see it read-only. The sub-forms - **Fakturauppgifter…** (standardserie, fordringskonto, intäktskonto, - bankgiro, vår referens) and **E-post (SMTP)…** (host, port, user, sender, - reply-to, security, password) are `settings.set` and open to bookkeepers, - and **Styrelseledamöter** lists the board. +- **Bolaget** — the dashboard's hub for the org's master data: + **Företagsuppgifter** (name, org number, VAT number, address, e-mail, + phone, moms period, framework, fiscal-year start month), editable in + place by owners, others see it read-only; **Fakturauppgifter** + (standardserie, fordringskonto, intäktskonto, bankgiro, vår referens) and + **E-post (SMTP)** (host, port, user, sender, reply-to, security, + password), both `settings.set` and open to bookkeepers; + **Styrelseledamöter**; and the registers **Anställda**, **Kunder** and + **Momsregler**. - **Systeminställningar** (System) — bilagornas mapp, the file browser's start directory. - **Revision** (System) — chain verification and behandlingshistorik. diff --git a/docs/STATE.md b/docs/STATE.md index bd38963..20c0729 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -34,12 +34,13 @@ unit tests and the docs consistency check. fetch/import/status screen under System. A pty scenario posts a run and fetches its lönebesked, so the payslip PDF path is exercised end to end. - **Menu (2026-09-21)**: the dashboard has the sections Bokföring (with - Mallar), Fakturering, Lön, Rapporter & bokslut, Företag (Anställda, - Kunder, Bolaget, Momsregler) and System (Skattetabeller, Revision, - Systeminställningar). Inställningar is gone: standardserie, - fordrings-/intäktskonto, bankgiro, vår referens and SMTP now live under - Bolaget (the Fakturauppgifter and E-post sub-forms) and bilagornas mapp - under System. `--screen settings` remains an alias for Bolaget. + Mallar), Fakturering, Lön, Rapporter & bokslut, System (Skattetabeller, + Revision, Systeminställningar) and Räkenskapsår, plus the standalone + **Bolaget** hub: Företagsuppgifter, Fakturauppgifter, E-post (SMTP), + Styrelseledamöter and the registers Anställda, Kunder and Momsregler. + Inställningar is gone: standardserie, fordrings-/intäktskonto, bankgiro, + vår referens and SMTP live under Bolaget, bilagornas mapp under System. + `--screen settings` remains an alias for Bolaget. ## Open decisions diff --git a/scripts/tui-golden.py b/scripts/tui-golden.py index fbcfc57..d4a6076 100755 --- a/scripts/tui-golden.py +++ b/scripts/tui-golden.py @@ -66,7 +66,7 @@ SCENARIOS = [ "name": "dashboard", "screen": "dashboard", "expect": ["{org_name}", "{fy_label}", "{fy_start}", "{fy_end}", - "Företag", "Bolaget"], + "Bolaget", "System", "Skattetabeller"], }, { "name": "audit-ok", @@ -221,17 +221,25 @@ SCENARIOS = [ { "name": "company", "screen": "company", - "expect": ["Bolaget", "Fakturauppgifter", "E-post (SMTP)", - "Styrelseledamöter", "Test AB"], + "expect": ["Bolaget", "Företagsuppgifter", "Fakturauppgifter", + "E-post (SMTP)", "Anställda", "Kunder", "Momsregler"], "steps": [ { - "keys": ["end", "up", "enter"], + "keys": ["3"], "expect": ["E-post (SMTP)", "SMTP-server", "lämna tomt för oförändrat"], }, { "keys": ["esc"], - "expect": ["Bolaget", "Fakturauppgifter"], + "expect": ["Bolaget", "Företagsuppgifter"], + }, + { + "keys": ["5"], + "expect": ["Anställda", "Testanställd"], + }, + { + "keys": ["esc"], + "expect": ["Bolaget", "Kunder"], }, ], }, |
