Merge pull request #3 from dredgy/order_screen

Join With Line function
This commit is contained in:
dredgy
2022-02-13 13:10:24 +10:00
committed by GitHub
3 changed files with 7 additions and 5 deletions

View File

@@ -16,6 +16,8 @@ open Thoth.Json.Net
let (|?) lhs rhs = if lhs = null then rhs else lhs let (|?) lhs rhs = if lhs = null then rhs else lhs
let joinWithNewLine (arr: string[]) = arr |> String.concat "\n"
let getCurrentVenue () = 1 let getCurrentVenue () = 1
let map list = list |> Map.ofList let map list = list |> Map.ofList

View File

@@ -109,7 +109,7 @@ let generateSalesCategoryOverrideButtons () =
Entity.GetAllInVenue<print_group> Entity.GetAllInVenue<print_group>
|> Array.map printGroupPosButton |> Array.map printGroupPosButton
|> Array.append [|PosButton (language.getAndReplace "print_with" ["default"]) "printGroupOverrideButton toggle default active" """data-value="0" """|] |> Array.append [|PosButton (language.getAndReplace "print_with" ["default"]) "printGroupOverrideButton toggle default active" """data-value="0" """|]
|> String.concat "\n" |> joinWithNewLine
let renderGrid (grid: grid) = let renderGrid (grid: grid) =
@@ -123,7 +123,7 @@ let renderGrid (grid: grid) =
|> Array.map snd |> Array.map snd
|> Array.map(fun row -> row |> Array.map renderButton |> String.concat "\n") |> Array.map(fun row -> row |> Array.map renderButton |> String.concat "\n")
|> Array.map (renderPage grid) |> Array.map (renderPage grid)
|> String.concat "\n" |> joinWithNewLine
let loadGrid gridId = renderGrid (Entity.GetById<grid> gridId) let loadGrid gridId = renderGrid (Entity.GetById<grid> gridId)

View File

@@ -22,7 +22,7 @@ let loadFloorplan (ctx: HttpContext) : HttpHandler =
let roomMenu = let roomMenu =
Entity.GetAllInVenue<floorplan_room> Entity.GetAllInVenue<floorplan_room>
|> Array.map makeRoomButton |> Array.map makeRoomButton
|> String.concat "\n" |> joinWithNewLine
let variables = map [ let variables = map [
"title", "Floorplan" "title", "Floorplan"
@@ -64,12 +64,12 @@ let loadOrderScreen (ctx: HttpContext) (tableNumber: int) : HttpHandler =
let categoryArray = map ["page", categoryMap] let categoryArray = map ["page", categoryMap]
Theme.loadTemplateWithArrays "orderScreen/page_group_button" categoryArray Theme.loadTemplateWithArrays "orderScreen/page_group_button" categoryArray
) )
|> String.concat "\n" |> joinWithNewLine
let grids = let grids =
OrderScreen.getAllPageGrids () OrderScreen.getAllPageGrids ()
|> Array.map OrderScreen.getPagesHTML |> Array.map OrderScreen.getPagesHTML
|> String.concat "\n" |> joinWithNewLine
let coverSelectorButtons = let coverSelectorButtons =
Array.init (covers+1) id Array.init (covers+1) id