Test Push
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,3 +6,5 @@
|
|||||||
/tables/*
|
/tables/*
|
||||||
/Properties/
|
/Properties/
|
||||||
/.idea/
|
/.idea/
|
||||||
|
/wwwroot/scripts/js/*.js
|
||||||
|
/wwwroot/scripts/js/*.map
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
module AjaxController
|
module AjaxController
|
||||||
|
|
||||||
open DredgeFramework
|
open DredgeFramework
|
||||||
|
open DredgePos
|
||||||
open Floorplan
|
open Floorplan
|
||||||
open Microsoft.AspNetCore.Http
|
open Microsoft.AspNetCore.Http
|
||||||
open Reservations
|
open Reservations
|
||||||
open language
|
open language
|
||||||
open Giraffe
|
open Giraffe
|
||||||
open Dapper.FSharp
|
open Types
|
||||||
|
|
||||||
let loginWithLoginCode (context: HttpContext) (login_code: int) =
|
let loginWithLoginCode (context: HttpContext) (login_code: int) =
|
||||||
if Session.clerkLogin login_code context then ajaxSuccess "success"
|
if Session.clerkLogin login_code context then ajaxSuccess "success"
|
||||||
@@ -74,11 +75,11 @@ let getRoomTablesAndDecorations roomId =
|
|||||||
|
|
||||||
let getTableData tableNumber = json <| Floorplan.getTable tableNumber
|
let getTableData tableNumber = json <| Floorplan.getTable tableNumber
|
||||||
|
|
||||||
let updateTableShape (table: Floorplan.floorplan_table_shape) =
|
let updateTableShape (table: floorplan_table) =
|
||||||
Floorplan.updateTableShape table |> ignore
|
Floorplan.updateTableShape table |> ignore
|
||||||
getTableData table.table_number
|
getTableData table.table_number
|
||||||
|
|
||||||
let transformTable (table: Floorplan.floorplan_table) =
|
let transformTable (table: floorplan_table) =
|
||||||
Floorplan.updateTablePosition table |> ignore
|
Floorplan.updateTablePosition table |> ignore
|
||||||
getTableData table.table_number
|
getTableData table.table_number
|
||||||
|
|
||||||
@@ -99,12 +100,12 @@ let transferTable (origin, destination) =
|
|||||||
let data = map ["origin", getTable origin ; "destination", getTable destination]
|
let data = map ["origin", getTable origin ; "destination", getTable destination]
|
||||||
ajaxSuccess data |> json
|
ajaxSuccess data |> json
|
||||||
|
|
||||||
let AddDecoration (data: Decorations.floorplan_decoration) =
|
let AddDecoration (data: floorplan_decoration) =
|
||||||
let image = "wwwroot/images/decorations/" + data.decoration_image
|
let image = "wwwroot/images/decorations/" + data.decoration_image
|
||||||
let width, height = image |> GetImageSize
|
let width, height = image |> GetImageSize
|
||||||
let aspectRatio = decimal width / decimal height
|
let aspectRatio = decimal width / decimal height
|
||||||
|
|
||||||
let decoration : Decorations.floorplan_decoration = {
|
let decoration : floorplan_decoration = {
|
||||||
id = 0
|
id = 0
|
||||||
decoration_height = (200m / aspectRatio) |> int
|
decoration_height = (200m / aspectRatio) |> int
|
||||||
decoration_width = 200
|
decoration_width = 200
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
module Clerk
|
module Clerk
|
||||||
|
|
||||||
open System
|
|
||||||
open Dapper.FSharp
|
open Dapper.FSharp
|
||||||
open DredgeFramework
|
open DredgeFramework
|
||||||
open Renci.SshNet
|
open DredgePos
|
||||||
open Thoth.Json.Net
|
open Thoth.Json.Net
|
||||||
|
open Types
|
||||||
|
|
||||||
let mutable loginCookie = ""
|
let mutable loginCookie = ""
|
||||||
|
|
||||||
type clerk = {id: int; clerk_name: string; clerk_login_code: int; clerk_usergroup: int}
|
|
||||||
let clerk_decoder : Decoder<clerk> =
|
let clerk_decoder : Decoder<clerk> =
|
||||||
Decode.object
|
Decode.object
|
||||||
(fun get ->
|
(fun get ->
|
||||||
|
|||||||
@@ -4,21 +4,9 @@ open System
|
|||||||
open System.IO
|
open System.IO
|
||||||
open System.Text.RegularExpressions
|
open System.Text.RegularExpressions
|
||||||
open DredgeFramework
|
open DredgeFramework
|
||||||
open Dapper
|
|
||||||
open Dapper.FSharp
|
open Dapper.FSharp
|
||||||
open Floorplan
|
open DredgePos
|
||||||
|
open Types
|
||||||
[<CLIMutable>]
|
|
||||||
type floorplan_decoration = {
|
|
||||||
id: int
|
|
||||||
decoration_room: int
|
|
||||||
decoration_pos_x: int
|
|
||||||
decoration_pos_y: int
|
|
||||||
decoration_rotation: int
|
|
||||||
decoration_width: int
|
|
||||||
decoration_height: int
|
|
||||||
decoration_image: string
|
|
||||||
}
|
|
||||||
|
|
||||||
let decorationList venue =
|
let decorationList venue =
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Types.fs" />
|
||||||
<Compile Include="DredgeFramework.module.fs" />
|
<Compile Include="DredgeFramework.module.fs" />
|
||||||
<Compile Include="Browser.module.fs" />
|
<Compile Include="Browser.module.fs" />
|
||||||
<Compile Include="Database.module.fs" />
|
<Compile Include="Database.module.fs" />
|
||||||
<Compile Include="Language.module.fs" />
|
|
||||||
<Compile Include="GenericEntities.module.fs" />
|
<Compile Include="GenericEntities.module.fs" />
|
||||||
|
<Compile Include="Language.module.fs" />
|
||||||
<Compile Include="Theme.module.fs" />
|
<Compile Include="Theme.module.fs" />
|
||||||
<Compile Include="Reservations.module.fs" />
|
<Compile Include="Reservations.module.fs" />
|
||||||
<Compile Include="Floorplan.module.fs" />
|
<Compile Include="Floorplan.module.fs" />
|
||||||
|
|||||||
@@ -1,54 +1,18 @@
|
|||||||
module Floorplan
|
module Floorplan
|
||||||
|
|
||||||
|
open DredgePos
|
||||||
open Reservations
|
open Reservations
|
||||||
|
|
||||||
let currentVenue = 1
|
let currentVenue = 1
|
||||||
|
|
||||||
open System
|
open System
|
||||||
open System.Collections
|
|
||||||
open System.Collections.Generic
|
|
||||||
open System.IO
|
open System.IO
|
||||||
open System.Xml
|
|
||||||
open System.Xml.Linq
|
open System.Xml.Linq
|
||||||
open System.Linq
|
|
||||||
open DredgeFramework
|
open DredgeFramework
|
||||||
open Dapper
|
open Dapper
|
||||||
open Dapper.FSharp
|
open Dapper.FSharp
|
||||||
open Dapper.FSharp.MySQL
|
|
||||||
open MySql.Data.MySqlClient
|
|
||||||
open Thoth.Json.Net
|
open Thoth.Json.Net
|
||||||
|
open Types
|
||||||
[<CLIMutable>]
|
|
||||||
type floorplan_table_shape = { table_number: int; shape: string; width: int; height: int; rotation: int}
|
|
||||||
[<CLIMutable>]
|
|
||||||
type floorplan_table_transform = { table_number: int; pos_x: int; pos_y: int; width: int; height: int; rotation: int}
|
|
||||||
|
|
||||||
|
|
||||||
[<CLIMutable>]
|
|
||||||
type floorplan_table = {
|
|
||||||
table_number: int
|
|
||||||
room_id: int
|
|
||||||
venue_id: int
|
|
||||||
pos_x: int
|
|
||||||
pos_y: int
|
|
||||||
shape: string
|
|
||||||
width: int
|
|
||||||
height: int
|
|
||||||
default_covers: int
|
|
||||||
rotation: int
|
|
||||||
merged_children: string
|
|
||||||
previous_state: string
|
|
||||||
status: int
|
|
||||||
id: int
|
|
||||||
}
|
|
||||||
|
|
||||||
[<CLIMutable>]
|
|
||||||
type floorplan_room = {
|
|
||||||
id: int
|
|
||||||
room_name: string
|
|
||||||
background_image: string
|
|
||||||
venue_id: int
|
|
||||||
}
|
|
||||||
|
|
||||||
let floorplan_table_decoder : Decoder<floorplan_table> =
|
let floorplan_table_decoder : Decoder<floorplan_table> =
|
||||||
Decode.object
|
Decode.object
|
||||||
@@ -188,7 +152,7 @@ let updateFloorplanTable (tableNumber:int) (column: string) value =
|
|||||||
|
|
||||||
getTable tableNumber
|
getTable tableNumber
|
||||||
|
|
||||||
let updateTableShape (floorplanTable: floorplan_table_shape) =
|
let updateTableShape (floorplanTable: floorplan_table) =
|
||||||
update {
|
update {
|
||||||
table "floorplan_tables"
|
table "floorplan_tables"
|
||||||
set floorplanTable
|
set floorplanTable
|
||||||
@@ -221,7 +185,11 @@ let getChildTables tableNumber =
|
|||||||
let table = getTable tableNumber
|
let table = getTable tableNumber
|
||||||
let json = table.merged_children
|
let json = table.merged_children
|
||||||
|
|
||||||
json |> Decode.unsafeFromString(Decode.array floorplan_table_decoder)
|
let result = json |> Decode.Auto.fromString<floorplan_table[]>
|
||||||
|
match result with
|
||||||
|
| Ok tables -> tables
|
||||||
|
| Error _ -> [||]
|
||||||
|
|
||||||
|
|
||||||
let matchTable (tableNumberToMatch: int) (floorplanTableToCheck: floorplan_table) =
|
let matchTable (tableNumberToMatch: int) (floorplanTableToCheck: floorplan_table) =
|
||||||
tableNumberToMatch = floorplanTableToCheck.table_number
|
tableNumberToMatch = floorplanTableToCheck.table_number
|
||||||
|
|||||||
@@ -1 +1,26 @@
|
|||||||
module GenericEntities
|
module Entity
|
||||||
|
open DredgePos
|
||||||
|
open Types
|
||||||
|
open Dapper.FSharp
|
||||||
|
open DredgeFramework
|
||||||
|
|
||||||
|
let getDatabaseTable (record: 'a) = record.GetType().ToString().ToLower() + "s"
|
||||||
|
|
||||||
|
let addToDatabase (record: 'x)=
|
||||||
|
let tableName = getDatabaseTable record
|
||||||
|
insert {
|
||||||
|
table tableName
|
||||||
|
value record
|
||||||
|
}
|
||||||
|
|> db.InsertOutput
|
||||||
|
|> first
|
||||||
|
|
||||||
|
let updateInDatabase (record: 'x) =
|
||||||
|
let tableName = getDatabaseTable record
|
||||||
|
(* Run an update query *)
|
||||||
|
update {
|
||||||
|
table tableName
|
||||||
|
set record
|
||||||
|
}
|
||||||
|
|> db.Update |> ignore
|
||||||
|
record
|
||||||
@@ -26,7 +26,7 @@ let loadFloorplan (ctx: HttpContext) : HttpHandler =
|
|||||||
"decorator", Decorations.generateDecorator()
|
"decorator", Decorations.generateDecorator()
|
||||||
]
|
]
|
||||||
let styles = ["tableMap.css"]
|
let styles = ["tableMap.css"]
|
||||||
let scripts = ["konva.js" ; "dredgepos.floorplan.js"]
|
let scripts = ["external/konva.min.js" ; "dredgepos.floorplan.js"]
|
||||||
let currentClerk = recordToMap <| Session.getCurrentClerk ctx
|
let currentClerk = recordToMap <| Session.getCurrentClerk ctx
|
||||||
|
|
||||||
let arrays = map["clerk", currentClerk]
|
let arrays = map["clerk", currentClerk]
|
||||||
|
|||||||
24
Program.fs
24
Program.fs
@@ -1,14 +1,11 @@
|
|||||||
namespace WebApplication
|
namespace WebApplication
|
||||||
|
|
||||||
open Clerk
|
|
||||||
open Floorplan
|
open DredgePos
|
||||||
open Microsoft.AspNetCore.Http
|
|
||||||
open Microsoft.AspNetCore.Mvc.RazorPages
|
|
||||||
open Microsoft.Extensions.Hosting;
|
|
||||||
open Reservations
|
open Reservations
|
||||||
open Saturn
|
open Saturn
|
||||||
open Giraffe
|
open Giraffe
|
||||||
open DredgeFramework
|
open Types
|
||||||
|
|
||||||
module Program =
|
module Program =
|
||||||
|
|
||||||
@@ -23,14 +20,13 @@ module Program =
|
|||||||
pipe_through browser
|
pipe_through browser
|
||||||
post "/authenticateClerk" (bindJson<int> (handlePostRoute AjaxController.loginWithLoginCode) )
|
post "/authenticateClerk" (bindJson<int> (handlePostRoute AjaxController.loginWithLoginCode) )
|
||||||
post "/getTableData" (bindJson<int> AjaxController.getTableData)
|
post "/getTableData" (bindJson<int> AjaxController.getTableData)
|
||||||
post "/updateTableShape" (bindJson<Floorplan.floorplan_table_shape> AjaxController.updateTableShape)
|
post "/transformTable" (bindJson<floorplan_table> AjaxController.transformTable)
|
||||||
post "/transformTable" (bindJson<Floorplan.floorplan_table> AjaxController.transformTable)
|
post "/createTable" (bindJson<floorplan_table> AjaxController.createTable)
|
||||||
post "/createTable" (bindJson<Floorplan.floorplan_table> AjaxController.createTable)
|
post "/addDecoration" (bindJson<floorplan_decoration> AjaxController.AddDecoration)
|
||||||
post "/addDecoration" (bindJson<Decorations.floorplan_decoration> AjaxController.AddDecoration)
|
post "/updateDecoration" (bindJson<floorplan_decoration> AjaxController.UpdateDecoration)
|
||||||
post "/updateDecoration" (bindJson<Decorations.floorplan_decoration> AjaxController.UpdateDecoration)
|
post "/deleteDecoration" (bindJson<floorplan_decoration> AjaxController.DeleteDecoration)
|
||||||
post "/deleteDecoration" (bindJson<Decorations.floorplan_decoration> AjaxController.DeleteDecoration)
|
post "/deleteTable" (bindJson<floorplan_table> AjaxController.deleteTable)
|
||||||
post "/deleteTable" (bindJson<Floorplan.floorplan_table> AjaxController.deleteTable)
|
post "/mergeTables" (bindJson<floorplan_table[]> AjaxController.mergeTables)
|
||||||
post "/mergeTables" (bindJson<Floorplan.floorplan_table[]> AjaxController.mergeTables)
|
|
||||||
post "/newEmptyReservation" (bindJson<reservation> AjaxController.newEmptyReservation)
|
post "/newEmptyReservation" (bindJson<reservation> AjaxController.newEmptyReservation)
|
||||||
post "/updateReservation" (bindJson<reservation> AjaxController.updateReservation)
|
post "/updateReservation" (bindJson<reservation> AjaxController.updateReservation)
|
||||||
post "/getReservation" (bindJson<int> (fun reservation -> json <| GetReservationById reservation) )
|
post "/getReservation" (bindJson<int> (fun reservation -> json <| GetReservationById reservation) )
|
||||||
|
|||||||
@@ -3,15 +3,8 @@
|
|||||||
open System
|
open System
|
||||||
open DredgeFramework
|
open DredgeFramework
|
||||||
open Dapper.FSharp
|
open Dapper.FSharp
|
||||||
[<CLIMutable>]
|
open DredgePos
|
||||||
type reservation = {
|
open Types
|
||||||
id: int
|
|
||||||
reservation_name: string
|
|
||||||
reservation_time: int
|
|
||||||
reservation_covers: int
|
|
||||||
reservation_table_id: int
|
|
||||||
reservation_created_at: int
|
|
||||||
}
|
|
||||||
|
|
||||||
let GetReservationById (id: int) =
|
let GetReservationById (id: int) =
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ open System
|
|||||||
open DredgeFramework
|
open DredgeFramework
|
||||||
open Dapper.FSharp
|
open Dapper.FSharp
|
||||||
open Clerk
|
open Clerk
|
||||||
|
open DredgePos
|
||||||
open Thoth.Json.Net
|
open Thoth.Json.Net
|
||||||
|
open Types
|
||||||
[<CLIMutable>]
|
|
||||||
type session = {id: int; session_id: string; clerk_json: string; clerk_id: int; expires: int}
|
|
||||||
|
|
||||||
let deleteSession sessionId context =
|
let deleteSession sessionId context =
|
||||||
delete {
|
delete {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ let getHTMLForFile file =
|
|||||||
|
|
||||||
|
|
||||||
let ParseScriptsAndStylesheets files html =
|
let ParseScriptsAndStylesheets files html =
|
||||||
let defaultScriptsAndStyles = ["jquery.js" ; "dredgepos.core.css"; "dredgepos.core.js"; "keyboards.js"; "theme.css"; "screen.css"; ]
|
let defaultScriptsAndStyles = ["external/jquery.js" ; "dredgepos.core.css"; "dredgepos.core.js"; "keyboards.js"; "theme.css"; "screen.css"; ]
|
||||||
let scriptsAndStylesheets = defaultScriptsAndStyles @ files
|
let scriptsAndStylesheets = defaultScriptsAndStyles @ files
|
||||||
|
|
||||||
let scriptAndStylesheetHTML =
|
let scriptAndStylesheetHTML =
|
||||||
|
|||||||
55
Types.fs
Normal file
55
Types.fs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
module DredgePos.Types
|
||||||
|
|
||||||
|
[<CLIMutable>]
|
||||||
|
type reservation = {
|
||||||
|
id: int
|
||||||
|
reservation_name: string
|
||||||
|
reservation_time: int
|
||||||
|
reservation_covers: int
|
||||||
|
reservation_table_id: int
|
||||||
|
reservation_created_at: int
|
||||||
|
}
|
||||||
|
|
||||||
|
[<CLIMutable>]
|
||||||
|
type floorplan_table = {
|
||||||
|
table_number: int
|
||||||
|
room_id: int
|
||||||
|
venue_id: int
|
||||||
|
pos_x: int
|
||||||
|
pos_y: int
|
||||||
|
shape: string
|
||||||
|
width: int
|
||||||
|
height: int
|
||||||
|
default_covers: int
|
||||||
|
rotation: int
|
||||||
|
merged_children: string
|
||||||
|
previous_state: string
|
||||||
|
status: int
|
||||||
|
id: int
|
||||||
|
}
|
||||||
|
|
||||||
|
[<CLIMutable>]
|
||||||
|
type floorplan_room = {
|
||||||
|
id: int
|
||||||
|
room_name: string
|
||||||
|
background_image: string
|
||||||
|
venue_id: int
|
||||||
|
}
|
||||||
|
|
||||||
|
[<CLIMutable>]
|
||||||
|
type floorplan_decoration = {
|
||||||
|
id: int
|
||||||
|
decoration_room: int
|
||||||
|
decoration_pos_x: int
|
||||||
|
decoration_pos_y: int
|
||||||
|
decoration_rotation: int
|
||||||
|
decoration_width: int
|
||||||
|
decoration_height: int
|
||||||
|
decoration_image: string
|
||||||
|
}
|
||||||
|
|
||||||
|
[<CLIMutable>]
|
||||||
|
type clerk = {id: int; clerk_name: string; clerk_login_code: int; clerk_usergroup: int}
|
||||||
|
|
||||||
|
[<CLIMutable>]
|
||||||
|
type session = {id: int; session_id: string; clerk_json: string; clerk_id: int; expires: int}
|
||||||
@@ -50,6 +50,10 @@ const Floorplan: floorplan = {
|
|||||||
selectedDecorationId: 0
|
selectedDecorationId: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getData = (dataType: entity) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$(() => ajax('/ajax/getFloorplanData/1', null, 'get', setupFloorplan, null, null) )
|
$(() => ajax('/ajax/getFloorplanData/1', null, 'get', setupFloorplan, null, null) )
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
type PosMode = "edit" | "void" | "transfer" | "default" | "tableSelected" | "decorationSelected" | "activeTableSelected" | "merge" | "reservedTableSelected"
|
type PosMode = "edit" | "void" | "transfer" | "default" | "tableSelected" | "decorationSelected" | "activeTableSelected" | "merge" | "reservedTableSelected"
|
||||||
type PosModes = PosMode[]
|
type PosModes = PosMode[]
|
||||||
|
|
||||||
|
|
||||||
interface ajaxResult {
|
interface ajaxResult {
|
||||||
status: string
|
status: string
|
||||||
data : any
|
data : any
|
||||||
|
|||||||
Reference in New Issue
Block a user