diff options
author | Sebastian <sebasjm@gmail.com> | 2021-03-23 14:09:10 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-03-23 14:09:16 -0300 |
commit | da73a14c6909150b5779574dfc0036b27a3752e8 (patch) | |
tree | 7f86ff55f81b5159b03a179195fff0836fb24968 /packages/frontend/src/paths/admin/create/CreatePage.tsx | |
parent | 0e365961bee9abf78fa7a0dc3eaae91a8985af3e (diff) | |
download | merchant-backoffice-da73a14c6909150b5779574dfc0036b27a3752e8.tar.gz merchant-backoffice-da73a14c6909150b5779574dfc0036b27a3752e8.tar.bz2 merchant-backoffice-da73a14c6909150b5779574dfc0036b27a3752e8.zip |
pagination into the orders
Diffstat (limited to 'packages/frontend/src/paths/admin/create/CreatePage.tsx')
-rw-r--r-- | packages/frontend/src/paths/admin/create/CreatePage.tsx | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/packages/frontend/src/paths/admin/create/CreatePage.tsx b/packages/frontend/src/paths/admin/create/CreatePage.tsx index a286ba4..4c26caa 100644 --- a/packages/frontend/src/paths/admin/create/CreatePage.tsx +++ b/packages/frontend/src/paths/admin/create/CreatePage.tsx @@ -35,28 +35,30 @@ import { InputDuration } from "../../../components/form/InputDuration"; import { InputCurrency } from "../../../components/form/InputCurrency"; import { InputPayto } from "../../../components/form/InputPayto"; -type Entity = MerchantBackend.Instances.InstanceConfigurationMessage & {auth_token?: string} +type Entity = MerchantBackend.Instances.InstanceConfigurationMessage & { auth_token?: string } interface Props { onCreate: (d: Entity) => void; isLoading: boolean; onBack?: () => void; + forceId?: string; } interface KeyValue { [key: string]: string; } -function with_defaults(): Partial<Entity> { +function with_defaults(id?:string): Partial<Entity> { return { + id, default_pay_delay: { d_ms: 1000 }, default_wire_fee_amortization: 10, default_wire_transfer_delay: { d_ms: 2000 }, }; } -export function CreatePage({ onCreate, isLoading, onBack }: Props): VNode { - const [value, valueHandler] = useState(with_defaults()) +export function CreatePage({ onCreate, isLoading, onBack, forceId }: Props): VNode { + const [value, valueHandler] = useState(with_defaults(forceId)) const [errors, setErrors] = useState<FormErrors<Entity>>({}) const submit = (): void => { @@ -85,7 +87,7 @@ export function CreatePage({ onCreate, isLoading, onBack }: Props): VNode { <div class="column is-two-thirds"> <FormProvider<Entity> errors={errors} object={value} valueHandler={valueHandler} > - <InputWithAddon<Entity> name="id" addonBefore={`${backend.url}/private/instances/`} /> + <InputWithAddon<Entity> name="id" addonBefore={`${backend.url}/private/instances/`} readonly={!!forceId}/> <Input<Entity> name="name" /> @@ -100,11 +102,35 @@ export function CreatePage({ onCreate, isLoading, onBack }: Props): VNode { <Input<Entity> name="default_wire_fee_amortization" /> <InputGroup name="address"> - <Input<Entity> name="name" /> + <Input name="address.country" /> + <Input name="address.address_lines" inputType="multiline" + toStr={(v: string[] | undefined) => !v ? '' : v.join('\n')} + fromStr={(v: string) => v.split('\n')} + /> + <Input name="address.building_number" /> + <Input name="address.building_name" /> + <Input name="address.street" /> + <Input name="address.post_code" /> + <Input name="address.town_location" /> + <Input name="address.town" /> + <Input name="address.district" /> + <Input name="address.country_subdivision" /> </InputGroup> <InputGroup name="jurisdiction"> - <Input<Entity> name="name" /> + <Input name="jurisdiction.country" /> + <Input name="jurisdiction.address_lines" inputType="multiline" + toStr={(v: string[] | undefined) => !v ? '' : v.join('\n')} + fromStr={(v: string) => v.split('\n')} + /> + <Input name="jurisdiction.building_number" /> + <Input name="jurisdiction.building_name" /> + <Input name="jurisdiction.street" /> + <Input name="jurisdiction.post_code" /> + <Input name="jurisdiction.town_location" /> + <Input name="jurisdiction.town" /> + <Input name="jurisdiction.district" /> + <Input name="jurisdiction.country_subdivision" /> </InputGroup> <InputDuration<Entity> name="default_pay_delay" /> @@ -114,7 +140,7 @@ export function CreatePage({ onCreate, isLoading, onBack }: Props): VNode { </FormProvider> <div class="buttons is-right mt-5"> - { onBack && <button class="button" onClick={onBack} ><Message id="Cancel" /></button> } + {onBack && <button class="button" onClick={onBack} ><Message id="Cancel" /></button>} <button class="button is-success" onClick={submit} ><Message id="Confirm" /></button> </div> |