diff --git a/src/web/ui/src/Accounts/State.fs b/src/web/ui/src/Accounts/State.fs index d8a82ffa6..f297d27cd 100644 --- a/src/web/ui/src/Accounts/State.fs +++ b/src/web/ui/src/Accounts/State.fs @@ -51,16 +51,21 @@ let applyUpdate (account:BTSAccount) = function | IsActive b -> { account with isActive = b } let applyCMEUpdate (data:CMEAccountData) = function + | CMEExchangeField.CTI v -> { data with cti = v } + | CMEExchangeField.Origin v -> { data with origin = v } + | CMEExchangeField.TakeupMember v -> { data with takeupMemberCode = v } + | CMEExchangeField.ClearingAccount v -> { data with clearingAccount = v } + | CMEExchangeField.DirectElectronicAccess v -> { data with directElectronicAccess = v } + | CMEExchangeField.TradingCapacity v -> { data with tradingCapacity = v } + | CMEExchangeField.LiquidityProvision v -> { data with liquidityProvision = v } + | CMEExchangeField.CommodityDerivativeIndicator v -> { data with commodityDerivativeIndicator = v } + | CMEExchangeField.MiscTagMapping mp -> { data with miscTags = mp } + +let applySIMUpdate (data:SIMAccountData) = function | CTI v -> { data with cti = v } | Origin v -> { data with origin = v } - | TakeupMember v -> { data with takeupMemberCode = v } | ClearingAccount v -> { data with clearingAccount = v } - | DirectElectronicAccess v -> { data with directElectronicAccess = v } - | TradingCapacity v -> { data with tradingCapacity = v } - | LiquidityProvision v -> { data with liquidityProvision = v } - | CommodityDerivativeIndicator v -> { data with commodityDerivativeIndicator = v } - | MiscTagMapping mp -> { data with miscTags = mp } - + | _ -> data let saveAccount (admin:IAdminService) (account:BTSAccount) = promise { let! result = admin.update_account { completeData = account } @@ -250,10 +255,14 @@ let update msg (model:Model) : Model * Cmd = { model with scratch = { model.scratch with connections = { model.scratch.connections with exchangeConnectionNames = newCons }}; ConfirmModal = ("", Msg.SelectTab model.tab)}, Cmd.Empty // // Exchange data - | UpdateCME field -> + | UpdateCME (field:CMEExchangeField) -> let newCme = applyCMEUpdate model.scratch.exchangeAccountData.cmeAccountData field let scratch = { model.scratch with exchangeAccountData = { cmeAccountData = newCme; iceAccountData = model.scratch.exchangeAccountData.iceAccountData; simAccountData = model.scratch.exchangeAccountData.simAccountData } } { model with scratch = scratch }, Cmd.Empty + | UpdateSIM field -> + let newSim = applySIMUpdate model.scratch.exchangeAccountData.simAccountData field + let scratch = { model.scratch with exchangeAccountData = { cmeAccountData = model.scratch.exchangeAccountData.cmeAccountData ; iceAccountData = model.scratch.exchangeAccountData.iceAccountData; simAccountData = newSim } } + { model with scratch = scratch }, Cmd.Empty | RequestProducts -> model, Cmd.ofExistingPromise (requestProducts model.mdRelay) id (box>>ErrorOccured) | UpdateProducts data -> diff --git a/src/web/ui/src/Accounts/Types.fs b/src/web/ui/src/Accounts/Types.fs index 8765f7ec0..63f87d71a 100644 --- a/src/web/ui/src/Accounts/Types.fs +++ b/src/web/ui/src/Accounts/Types.fs @@ -35,6 +35,11 @@ type CMEExchangeField = | CommodityDerivativeIndicator of string | MiscTagMapping of JSMap +type SIMExchangeField = + | CTI of CTICode + | Origin of CustomerOrFirm + | ClearingAccount of string + type Msg = | UpdateAdminData of AdminData | NoAdminData of string @@ -64,6 +69,7 @@ type Msg = | DeleteSecurityLimit of int // ExchangeData | UpdateCME of CMEExchangeField + | UpdateSIM of SIMExchangeField | RequestProducts | UpdateProducts of Product[] | RequestExpirationNames diff --git a/src/web/ui/src/Accounts/View.fs b/src/web/ui/src/Accounts/View.fs index 456bd467d..2e60e7388 100644 --- a/src/web/ui/src/Accounts/View.fs +++ b/src/web/ui/src/Accounts/View.fs @@ -633,17 +633,24 @@ let creditLimitsView model dispatch = div [] [str "lorem ipsum"] let exchangeSettings model dispatch = let cme = model.scratch.exchangeAccountData.cmeAccountData + let sim = model.scratch.exchangeAccountData.simAccountData let send = UpdateCME>>dispatch + let sendSim = UpdateSIM>>dispatch div [] [ h2 [Class "is-size-3"] [ str "CME" ] - Fields.enumSelect "CTI" (toHuman false CTICode.values cme.cti) (allToHuman false CTICode.values) [] (fromHuman CTICode.values>>CTI>>send) - Fields.enumSelect "Origin" (toHuman false CustomerOrFirm.values cme.origin) (allToHuman false CustomerOrFirm.values) [] (fromHuman CustomerOrFirm.values>>Origin>>send) + Fields.enumSelect "CTI" (toHuman false CTICode.values cme.cti) (allToHuman false CTICode.values) [] (fromHuman CTICode.values>>CMEExchangeField.CTI>>send) + Fields.enumSelect "Origin" (toHuman false CustomerOrFirm.values cme.origin) (allToHuman false CustomerOrFirm.values) [] (fromHuman CustomerOrFirm.values>>CMEExchangeField.Origin>>send) //Fields.text "Takeup Member Code" cme.takeupMemberCode [] (TakeupMember>>send) - Fields.text "Clearing Account" cme.clearingAccount [] (ClearingAccount>>send) + Fields.text "Clearing Account" cme.clearingAccount [] (CMEExchangeField.ClearingAccount>>send) //Fields.text "Direct Electronic Access" cme.directElectronicAccess [] (DirectElectronicAccess>>send) //Fields.text "Trading Capacity" cme.tradingCapacity [] (TradingCapacity>>send) //Fields.text "Liquidity Provision" cme.liquidityProvision [] (LiquidityProvision>>send) //Fields.map "Misc Tag Mapping" cme.miscTags [] (MiscTagMapping>>send) + h2 [Class "is-size-3"] [ str "SIM" ] + Fields.enumSelect "CTI" (toHuman false CTICode.values sim.cti) (allToHuman false CTICode.values) [] (fromHuman CTICode.values>>SIMExchangeField.CTI>>sendSim) + Fields.enumSelect "Origin" (toHuman false CustomerOrFirm.values sim.origin) (allToHuman false CustomerOrFirm.values) [] (fromHuman CustomerOrFirm.values>>SIMExchangeField.Origin>>sendSim) + Fields.text "Clearing Account" sim.clearingAccount [] (SIMExchangeField.ClearingAccount>>sendSim) + ] let accountControls model (dispatch:Msg->unit) =