From 64e3705669e7c12b8013704654f17cf8eaf659d4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 25 May 2023 18:08:20 -0300 Subject: [PATCH] cases, account details and new-form screen --- .../exchange-backoffice-ui/src/Dashboard.tsx | 344 +++++++------ .../exchange-backoffice-ui/src/NiceForm.tsx | 13 +- .../exchange-backoffice-ui/src/account.ts | 48 +- .../src/assets/logo-2021.svg | 9 + .../src/declaration.d.ts | 28 ++ .../src/forms/902_11e.ts | 11 +- .../src/forms/902_12e.ts | 11 +- .../src/forms/902_13e.ts | 11 +- .../src/forms/902_15e.ts | 11 +- .../src/forms/902_1e.ts | 11 +- .../src/forms/902_4e.ts | 5 +- .../src/forms/902_5e.ts | 11 +- .../src/forms/902_9e.ts | 11 +- .../src/forms/simplest.ts | 96 ++++ .../src/handlers/FormProvider.tsx | 43 +- .../src/handlers/InputAmount.tsx | 34 ++ .../src/handlers/InputChoiceHorizontal.tsx | 86 ++++ .../src/handlers/InputChoiceStacked.tsx | 18 +- .../src/handlers/InputLine.tsx | 6 +- .../src/handlers/forms.ts | 32 +- .../src/handlers/useField.ts | 31 +- .../exchange-backoffice-ui/src/index.html | 2 + packages/exchange-backoffice-ui/src/pages.ts | 30 +- .../src/pages/AccountDetails.tsx | 457 ++++++++++++++++++ .../src/pages/AntiMoneyLaunderingForm.tsx | 22 +- .../src/pages/Cases.tsx | 282 +++++++++++ .../exchange-backoffice-ui/src/pages/Info.tsx | 5 - .../src/pages/NewFormEntry.tsx | 78 +++ .../src/pages/Officer.tsx | 204 ++++---- packages/exchange-backoffice-ui/src/route.ts | 4 +- packages/exchange-backoffice-ui/src/types.ts | 81 ++++ packages/web-util/src/hooks/useLang.ts | 4 +- .../web-util/src/hooks/useLocalStorage.ts | 64 ++- 33 files changed, 1722 insertions(+), 381 deletions(-) create mode 100644 packages/exchange-backoffice-ui/src/assets/logo-2021.svg create mode 100644 packages/exchange-backoffice-ui/src/forms/simplest.ts create mode 100644 packages/exchange-backoffice-ui/src/handlers/InputAmount.tsx create mode 100644 packages/exchange-backoffice-ui/src/handlers/InputChoiceHorizontal.tsx create mode 100644 packages/exchange-backoffice-ui/src/pages/AccountDetails.tsx create mode 100644 packages/exchange-backoffice-ui/src/pages/Cases.tsx delete mode 100644 packages/exchange-backoffice-ui/src/pages/Info.tsx create mode 100644 packages/exchange-backoffice-ui/src/pages/NewFormEntry.tsx create mode 100644 packages/exchange-backoffice-ui/src/types.ts diff --git a/packages/exchange-backoffice-ui/src/Dashboard.tsx b/packages/exchange-backoffice-ui/src/Dashboard.tsx index 9be86c533..9f4a43513 100644 --- a/packages/exchange-backoffice-ui/src/Dashboard.tsx +++ b/packages/exchange-backoffice-ui/src/Dashboard.tsx @@ -23,39 +23,14 @@ import { useMemoryStorage, useNotifications, } from "@gnu-taler/web-util/browser"; - -/** - * references between forms - * - * 902.1e - * --> 902.11 (operational legal entity or partnership) - * --> 902.12 (a foundation) - * --> 902.13 (a trust) - * --> 902.15 (life insurance policy) - * --> 902.9 (all other cases) - * --> 902.5 (cash transaction with no customer profile) - * --> 902.4 (risk profile) - * - * 902.11 - * --> 902.9 (beneficial owner in fiduciary holding assets) - * - * 902.12 - * - * 902.13 - * - * 902.15 - * - * 902.9 - * - * 902.5 - * - * 902.4 - */ - -const userNavigation = [ - { name: "Your profile", href: "#" }, - { name: "Sign out", href: "#" }, -]; +import { + AbsoluteTime, + Codec, + buildCodecForObject, + codecForAbsoluteTime, + codecForString, +} from "@gnu-taler/taler-util"; +import logo from "./assets/logo-2021.svg"; function classNames(...classes: string[]) { return classes.filter(Boolean).join(" "); @@ -153,7 +128,7 @@ function LeftMenu() { )} aria-hidden="true" /> - Info + Cases
  • @@ -175,7 +150,7 @@ function LeftMenu() { )} aria-hidden="true" /> - Officer + Account
  • @@ -203,7 +178,7 @@ function LeftMenu() { */} -
  • + {/*
  • Settings -
  • + */} ); @@ -237,26 +212,18 @@ export function Dashboard({ }): VNode { const [sidebarOpen, setSidebarOpen] = useState(false); - const logRef = useRef(null); - function showFormOnSidebar(v: any) { - if (!logRef.current) return; - logRef.current.innerHTML = JSON.stringify(v, undefined, 1); - } return (
    - Taler +
    +

    + Exchange AML Backoffice +

    +
    -
    -
    
    -          
    @@ -362,123 +329,193 @@ function NavigationBar({ ); } +export interface Officer { + salt: string; + when: AbsoluteTime; + key: string; +} + +export const codecForOfficer = (): Codec => + buildCodecForObject() + .property("salt", codecForString()) // FIXME + .property("when", codecForAbsoluteTime) // FIXME + .property("key", codecForString()) + .build("Officer"); + function TopBar({ onOpenSidebar }: { onOpenSidebar: () => void }) { const password = useMemoryStorage("password"); - const officer = useLocalStorage("officer"); + const officer = useLocalStorage("officer", { + codec: codecForOfficer(), + }); return ( -
    - - - {/* Separator */} -