SIM Exchange Settings

This commit is contained in:
Michael Harding committed 2018-08-10 15:49:15 -04:00
1 parent dc2b0c8efe
commit eb739b33f9
3 files changed
+33 -11

No files matched your search

+17 -8
View File
@@ -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<Msg> =
{ 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 ->
+6
View File
@@ -35,6 +35,11 @@ type CMEExchangeField =
| CommodityDerivativeIndicator of string
| MiscTagMapping of JSMap<string>
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
+10 -3
View File
@@ -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) =