diff --git a/.idea/.idea.DredgePos.dir/.idea/compiler.xml b/.idea/.idea.DredgePos.dir/.idea/compiler.xml new file mode 100644 index 0000000..1a2fb33 --- /dev/null +++ b/.idea/.idea.DredgePos.dir/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/AjaxController.fs b/AjaxController.fs index 7828b6c..e35477d 100644 --- a/AjaxController.fs +++ b/AjaxController.fs @@ -1,9 +1,12 @@ module AjaxController open DredgeFramework +open Floorplan open Microsoft.AspNetCore.Http +open Reservations open language open Giraffe +open Dapper.FSharp let loginWithLoginCode (context: HttpContext) (login_code: int) = if Session.clerkLogin login_code context then ajaxSuccess "success" @@ -15,28 +18,50 @@ let getActiveTables venue = Floorplan.getActiveTables venue |> ajaxSuccess |> js let getRoomData roomId = Floorplan.getRoom roomId |> ajaxSuccess |> json -let mergeTables (parent, child) = +let mergeTables (tables: floorplan_table[]) = let status = - if Floorplan.mergeTables parent child then "success" - else "fail" - - map [ - "status", status - "data" , parent |> Floorplan.getTable |> jsonEncode - ] - |> json + if mergeTables tables.[0].table_number tables.[1].table_number then + let outputTables = map [ + "parent", tables.[0]; + "child", tables.[1]; + "merged", getTable tables.[0].table_number; + ] + ajaxSuccess outputTables + else ajaxFail "Could Not Merge Tables" + status |> json let unmergeTable tableNumber = - let status = - if Floorplan.unmergeTable tableNumber then "success" - else "fail" + let unmerged = Floorplan.unmergeTable tableNumber + let unmergedTables = + match unmerged with + | Some (parent, child) -> + map["parent", parent; "child", child] |> ajaxSuccess + | None -> ajaxFail "Could not Unmerge Table" - map [ - "status", status - "data" , "[true]" - ] + unmergedTables |> json + + +let getFloorplanData venue = + let tableList = Floorplan.tableList venue + let reservationList = getReservationList tableList + {| + tables = tableList + decorations = Decorations.decorationList venue + activeTableNumbers = Floorplan.getActiveTables venue + rooms = Floorplan.getRoomList venue + reservations = reservationList + |} + |> ajaxSuccess |> json +let getKeyboardLayout (language: string) = + let layout = $"""wwwroot/languages/{language}/keyboardLayout.json""" |> GetFileContents + map [ + "status", "success" + "data", layout + ] |> json + + let getRoomTablesAndDecorations roomId = let tables = Floorplan.tablesInRoom roomId let decorations = Decorations.decorationsInRoom roomId @@ -53,50 +78,70 @@ let updateTableShape (table: Floorplan.floorplan_table_shape) = Floorplan.updateTableShape table |> ignore getTableData table.table_number -let transformTable (table: Floorplan.floorplan_table_transform) = +let transformTable (table: Floorplan.floorplan_table) = Floorplan.updateTablePosition table |> ignore getTableData table.table_number -let createTable (tableData) = - let newTableCreated = Floorplan.addNewTable tableData +let createTable (tableData: floorplan_table) = let result = - if newTableCreated then Floorplan.getTable tableData.table_number |> jsonEncode |> ajaxSuccess - else Floorplan.tableExists tableData.table_number |> jsonEncode |> ajaxFail + if tableExists tableData.table_number = "False" then + ajaxSuccess (addNewTable tableData) + else ajaxFail (tableExists tableData.table_number) - json result + result |> json + +let deleteTable (table: floorplan_table) = + Floorplan.deleteTable table.table_number + table |> ajaxSuccess |> json let transferTable (origin, destination) = Floorplan.transferTable origin destination - ajaxSuccess "true" |> json + let data = map ["origin", getTable origin ; "destination", getTable destination] + ajaxSuccess data |> json -let AddDecoration (data: Decorations.decoration_creator) = +let AddDecoration (data: Decorations.floorplan_decoration) = let image = "wwwroot/images/decorations/" + data.decoration_image let width, height = image |> GetImageSize let aspectRatio = decimal width / decimal height let decoration : Decorations.floorplan_decoration = { - decoration_id = 0 + id = 0 decoration_height = (200m / aspectRatio) |> int decoration_width = 200 decoration_rotation = 0 decoration_image = data.decoration_image - decoration_pos_x = data.basis/2 - decoration_pos_y = data.basis/2 + decoration_pos_x = data.decoration_pos_x + decoration_pos_y = data.decoration_pos_y decoration_room = data.decoration_room } - Decorations.CreateDecoration decoration |> ignore - ajaxSuccess "true" |> json + Decorations.CreateDecoration decoration |> ajaxSuccess |> json let UpdateDecoration data = Decorations.UpdateDecoration data |> ignore ajaxSuccess "true" |> json -let DeleteDecoration id = - Decorations.DeleteDecorationById id |> ignore - ajaxSuccess "true" |> json +let DeleteDecoration id = ajaxSuccess (Decorations.DeleteDecoration id) |> json -let newEmptyReservation tableNumber = - Floorplan.createEmptyReservation tableNumber 2 +let newEmptyReservation (reservation: reservation) = + let newReservation = {reservation with + reservation_created_at = CurrentTime() + reservation_time = CurrentTime() + } - json <| ajaxSuccess "true" + if reservation.reservation_table_id > 0 then + let table = {(getTableById reservation.reservation_table_id) with + status = 2 + default_covers = reservation.reservation_covers} + updateTablePosition table |> ignore + + let createdReservation = Floorplan.createEmptyReservation newReservation + ajaxSuccess createdReservation |> json + +let updateReservation (reservation: reservation) = updateReservation reservation |> ajaxSuccess |> json + +let unreserveTable (table: floorplan_table) = + let newTable = {table with status = 0} + updateTablePosition newTable |> ignore + DeleteReservation newTable.id + newTable |> ajaxSuccess |> json diff --git a/Clerk.module.fs b/Clerk.module.fs index 0f0d082..9d2ad91 100644 --- a/Clerk.module.fs +++ b/Clerk.module.fs @@ -8,12 +8,12 @@ open Thoth.Json.Net let mutable loginCookie = "" -type clerk = {clerk_id: int; clerk_name: string; clerk_login_code: int; clerk_usergroup: int} +type clerk = {id: int; clerk_name: string; clerk_login_code: int; clerk_usergroup: int} let clerk_decoder : Decoder = Decode.object (fun get -> { - clerk_id = get.Required.Field "clerk_id" Decode.int + id = get.Required.Field "clerk_id" Decode.int clerk_name = get.Required.Field "clerk_name" Decode.string clerk_login_code = get.Required.Field "clerk_login_code" Decode.int clerk_usergroup = get.Required.Field "clerk_usergroup" Decode.int diff --git a/Database.module.fs b/Database.module.fs index 74f9794..a8b1f74 100644 --- a/Database.module.fs +++ b/Database.module.fs @@ -1,5 +1,7 @@ module db +open Dapper +open Dapper.FSharp open Dapper.FSharp.MySQL open MySql.Data.MySqlClient open DredgeFramework @@ -24,6 +26,16 @@ let Insert<'a> asyncQuery = |> connection.InsertAsync<'a> |> RunSynchronously +let InsertOutput<'a> asyncQuery = + asyncQuery + |> connection.InsertAsync<'a> + |> RunSynchronously + |> ignore + + let table = asyncQuery.Table + connection.Query<'a>($"""Select * From {table} Where id = (select last_insert_id())""") + |> EnumerableToArray + let Update<'a> asyncQuery = asyncQuery |> connection.UpdateAsync<'a> diff --git a/Decorations.module.fs b/Decorations.module.fs index 4fcab24..6fc2b54 100644 --- a/Decorations.module.fs +++ b/Decorations.module.fs @@ -6,10 +6,11 @@ open System.Text.RegularExpressions open DredgeFramework open Dapper open Dapper.FSharp +open Floorplan [] type floorplan_decoration = { - decoration_id: int + id: int decoration_room: int decoration_pos_x: int decoration_pos_y: int @@ -19,12 +20,14 @@ type floorplan_decoration = { decoration_image: string } -type decoration_creator = { - decoration_room: int - decoration_image: string - basis: int -} - +let decorationList venue = + select { + table "floorplan_decorations" + innerJoin "floorplan_rooms" "id" "decoration_room" + } + |> db.SelectJoin + |> Array.filter (fun (_, room) -> room.venue_id = venue ) + |> Array.map fst let decorationsInRoom (roomId: int) = select { @@ -43,8 +46,6 @@ let getImageName (image: string, path: string) = imageName, path - - let isImageFile (fileName: string) = Regex.IsMatch(fileName |> ToLowerCase, @"^.+\.(jpg|jpeg|png|gif)$") let getImageHTML (imageName: string, imageUrl: string) = @@ -77,20 +78,21 @@ let CreateDecoration (decoration: floorplan_decoration) = insert { table "floorplan_decorations" value decoration - } |> db.Insert + } + |> db.InsertOutput + |> first + let UpdateDecoration (decoration: floorplan_decoration) = - let imageFile = GetFileName decoration.decoration_image - let updatedDecoration = {decoration with decoration_image = imageFile} - update { table "floorplan_decorations" - set updatedDecoration - where (eq "decoration_id" decoration.decoration_id ) + set decoration + where (eq "id" decoration.id ) } |> db.Update -let DeleteDecorationById (id: int) = +let DeleteDecoration (decoration: floorplan_decoration) = delete { table "floorplan_decorations" - where (eq "decoration_id" id) - } |> db.Delete \ No newline at end of file + where (eq "id" decoration.id) + } |> db.Delete |> ignore + decoration \ No newline at end of file diff --git a/DredgeFramework.module.fs b/DredgeFramework.module.fs index 88e7cbe..245e541 100644 --- a/DredgeFramework.module.fs +++ b/DredgeFramework.module.fs @@ -14,13 +14,11 @@ open FSharp.Reflection 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 map list = list |> Map.ofList -let JoinArray (char: string) (array: string[]) = String.Join(char, array) - -let first (array: 'a[]) = array.[0] +let JoinArray (char: string) (array: 'a[]) = String.Join(char, array) let StringReplace (search:string) (replace:string) (string:string) = (search, replace) |> string.Replace @@ -37,6 +35,9 @@ let GetFileContents (file: string) = File.ReadAllText file let GetFileName (file: string) = Path.GetFileName file let length (variable: 'T[]) = variable.Length +let first (array: 'a[]) = array.[0] +let last (array: 'a[]) = array.[array.Length-1] + let removeFalseValues (variable: bool[]) = variable |> Array.filter id @@ -67,14 +68,15 @@ let RunSynchronously task = |> Async.AwaitTask |> Async.RunSynchronously +let AppendToArray (element: 'T) (array : 'T[]) = Array.append [|element|] array + let ToLowerCase (string: string) = string.ToLower() let ToUpperCase (string: string) = string.ToUpper() let ToTitleCase (string: string) = CultureInfo.CurrentCulture.TextInfo.ToTitleCase <| string let recordToMap (record: 'T) = seq { - for prop in FSharpType.GetRecordFields(typeof<'T>) -> - prop.Name, prop.GetValue(record) |> string + for prop in FSharpType.GetRecordFields(typeof<'T>) -> prop.Name, prop.GetValue(record) |> string } |> Map.ofSeq diff --git a/DredgePos.fsproj b/DredgePos.fsproj index 65bede8..d7950d2 100644 --- a/DredgePos.fsproj +++ b/DredgePos.fsproj @@ -9,6 +9,7 @@ + @@ -31,6 +32,7 @@ PreserveNewest + diff --git a/Floorplan.module.fs b/Floorplan.module.fs index 1d046dc..dbd50b1 100644 --- a/Floorplan.module.fs +++ b/Floorplan.module.fs @@ -38,13 +38,13 @@ type floorplan_table = { rotation: int merged_children: string previous_state: string - status: string - table_id: int + status: int + id: int } [] type floorplan_room = { - room_id: int + id: int room_name: string background_image: string venue_id: int @@ -66,8 +66,8 @@ let floorplan_table_decoder : Decoder = rotation = get.Required.Field "rotation" Decode.int merged_children = get.Required.Field "merged_children" Decode.string previous_state = get.Required.Field "previous_state" Decode.string - status = get.Required.Field "status" Decode.string - table_id = get.Required.Field "table_id" Decode.int + status = get.Required.Field "status" Decode.int + id = get.Required.Field "id" Decode.int }) @@ -78,10 +78,12 @@ let getTableFile (tableNumber: int) = let tableNumberString = tableNumber |> string activeTablePath + "table" + tableNumberString + ".table" -let tableIsOpen (tableNumber: int) = +let tableNumberIsOpen (tableNumber: int) = let tableFile = getTableFile tableNumber File.Exists tableFile +let tableIsOpen (table: floorplan_table) = tableNumberIsOpen table.table_number + let fileNameToTableNumber (fileName: string) = //Takes a file name for a floorplan table and returns the table number if fileName.Contains ".table" then let fileName = (fileName.Split ".").[0] @@ -105,15 +107,14 @@ let tablesInRoom (roomId: int) = //Get a list of all tables in a particular room |> db.Select - let getActiveTables (venueId: int) = select{ table "floorplan_tables" where (eq "venue_id" venueId) } |> db.Select - |> Array.map getTableNumber |> Array.filter tableIsOpen + |> Array.map (fun table -> table.table_number) let openNewTable tableNumber = //Create a new table file pre-populated with skeleton data let tableFile = getTableFile tableNumber @@ -128,10 +129,10 @@ let transferTable origin destination = //Transfers a table from one to another let originFile = getTableFile origin let destinationFile = getTableFile destination - if tableIsOpen origin then + if tableNumberIsOpen origin then (* If the destination is not an already open table, then we simply have to rename the origin to destination *) - if not <| tableIsOpen destination then + if not <| tableNumberIsOpen destination then let content = File.ReadAllText originFile let newContent = content.Replace($"number=\"{origin|>string}\">", $"number=\"{destination|>string}\">") File.WriteAllText(originFile, newContent) @@ -159,10 +160,18 @@ let getTable (tableNumber : int) = |> db.Select |> first +let getTableById (id : int) = + select { + table "floorplan_tables" + where (eq "id" id) + } + |> db.Select + |> first + let getRoom (roomId: int) = select { table "floorplan_rooms" - where (eq "room_id" roomId) + where (eq "id" roomId) } |> db.Select |> first let getRoomList (venueId: int) = @@ -172,6 +181,7 @@ let getRoomList (venueId: int) = } |> db.Select let updateFloorplanTable (tableNumber:int) (column: string) value = + //TODO: Make update query venue specific let sql = "Update floorplan_tables Set @column = @value Where table_number = @tableNumber" let parameters = [("column", box column); ("value", box value); ("tableNumber", box tableNumber)] db.connection.Execute(sql, parameters) |> ignore @@ -185,25 +195,26 @@ let updateTableShape (floorplanTable: floorplan_table_shape) = where (eq "table_number" floorplanTable.table_number + eq "venue_id" currentVenue) } |> db.Update -let updateTablePosition (floorplanTable: floorplan_table_transform) = + +let updateTablePosition (floorplanTable: floorplan_table) = update { table "floorplan_tables" set floorplanTable where (eq "table_number" floorplanTable.table_number + eq "venue_id" currentVenue) } |> db.Update -let createEmptyReservation tableNumber covers = - let table = getTable tableNumber - let status = if table.status = "" then "reserved" else table.status - - //let res = newReservation "" 0 covers - - update{ +let createEmptyReservation (reservation: reservation) = + update { table "floorplan_tables" - set {| status = status |} - where(eq "table_number" tableNumber) + set {| status = 2 |} + where(eq "id" reservation.reservation_table_id) } |> db.Update |> ignore + insert{ + table "reservations" + value reservation + } |> db.InsertOutput |> first + let getChildTables tableNumber = @@ -217,7 +228,7 @@ let matchTable (tableNumberToMatch: int) (floorplanTableToCheck: floorplan_table let findChildTable (childTable: int) (parentTable: floorplan_table) = let json = parentTable.merged_children - let childTables = json |> Decode.fromString(Decode.array floorplan_table_decoder) + let childTables = json |> Decode.Auto.fromString let matchedTables = match childTables with @@ -262,16 +273,24 @@ let tableExists (tableNumber: int) = language.getAndReplace "error_table_exists" [room.room_name] -let addNewTable newTable = - if tableExists newTable.table_number = "False" then - insert{ - table "floorplan_tables" - value newTable - } |> db.Insert |> ignore - true - else false +let addNewTableWithoutOutput (newTable: floorplan_table) = + insert{ + table "floorplan_tables" + value newTable + } + |> db.Insert -let deleteTable tableNumber = +let addNewTable (newTable: floorplan_table) = + let newTableList = + insert{ + table "floorplan_tables" + value newTable + } + |> db.InsertOutput + + newTableList |> first + +let deleteTable (tableNumber: int) = delete { table "floorplan_tables" where (eq "table_number" tableNumber + eq "venue_id" currentVenue) @@ -342,7 +361,7 @@ let updateUnmergedTables parentTable childTable = where(eq "table_number" parentTable.table_number + eq "venue_id" currentVenue) } |> db.Update |> ignore - addNewTable childTable |> ignore + addNewTableWithoutOutput childTable |> ignore true let processUnmerge originalTable unmergedChild = @@ -354,25 +373,35 @@ let processUnmerge originalTable unmergedChild = let unmergeTable tableNumber = //Separates a merged table into itself and the last table merged into it. let currentTable = getTable tableNumber - let mergedChildren = currentTable.merged_children |> Decode.fromString(Decode.list floorplan_table_decoder) + let mergedChildren = currentTable.merged_children |> Decode.Auto.fromString match mergedChildren with | Ok listOfChildTables -> - let unmergedChild = listOfChildTables |> List.last - processUnmerge currentTable unmergedChild - | Error _ -> false + let unmergedChild = listOfChildTables |> last + processUnmerge currentTable unmergedChild |> ignore + Some (getTable currentTable.table_number, unmergedChild) + | Error _ -> None let convertRoomListToLinks (room: floorplan_room) = let vars = map [ - "roomId", room.room_id |> string + "roomId", room.id |> string "roomName", room.room_name ] Theme.loadTemplateWithVars "roomButton" vars +let getReservationList (tableList: floorplan_table[]) = + let tableIds = + tableList + |> Array.map(fun table -> table.id) + |> JoinArray "," + + db.connection.Query($"""Select * From reservations Where reservation_table_id In ({tableIds})""") + |> EnumerableToArray + let newReservation name time covers = let reservation = { - reservation_id = 0 + id = 0 reservation_name = name reservation_time = time reservation_covers = covers @@ -385,12 +414,12 @@ let newReservation name time covers = value reservation } |> db.Insert -let unReserveTable tableNumber = - let table = getTable tableNumber - DeleteReservation table.table_id - if table.status = "reserved" then - update { - table "floorplan_tables" - set {| status = "" ; reservation_id = 0 |} - } |> db.Update |> ignore +let tableList venueId = + select{ + table "floorplan_tables" + innerJoin "floorplan_rooms" "id" "floorplan_tables.room_id" + } + |> db.SelectJoin + |> Array.filter (fun (_, room) -> room.venue_id = venueId ) + |> Array.map fst diff --git a/GenericEntities.module.fs b/GenericEntities.module.fs new file mode 100644 index 0000000..d2badc2 --- /dev/null +++ b/GenericEntities.module.fs @@ -0,0 +1 @@ +module GenericEntities diff --git a/Program.fs b/Program.fs index 0a6dea3..bba4273 100644 --- a/Program.fs +++ b/Program.fs @@ -1,6 +1,7 @@ namespace WebApplication open Clerk +open Floorplan open Microsoft.AspNetCore.Http open Microsoft.AspNetCore.Mvc.RazorPages open Microsoft.Extensions.Hosting; @@ -23,25 +24,28 @@ module Program = post "/authenticateClerk" (bindJson (handlePostRoute AjaxController.loginWithLoginCode) ) post "/getTableData" (bindJson AjaxController.getTableData) post "/updateTableShape" (bindJson AjaxController.updateTableShape) - post "/transformTable" (bindJson AjaxController.transformTable) + post "/transformTable" (bindJson AjaxController.transformTable) post "/createTable" (bindJson AjaxController.createTable) - post "/addDecoration" (bindJson AjaxController.AddDecoration) + post "/addDecoration" (bindJson AjaxController.AddDecoration) post "/updateDecoration" (bindJson AjaxController.UpdateDecoration) - post "/deleteDecoration" (bindJson AjaxController.DeleteDecoration) - post "/newEmptyReservation" (bindJson AjaxController.newEmptyReservation) + post "/deleteDecoration" (bindJson AjaxController.DeleteDecoration) + post "/deleteTable" (bindJson AjaxController.deleteTable) + post "/mergeTables" (bindJson AjaxController.mergeTables) + post "/newEmptyReservation" (bindJson AjaxController.newEmptyReservation) + post "/updateReservation" (bindJson AjaxController.updateReservation) post "/getReservation" (bindJson (fun reservation -> json <| GetReservationById reservation) ) - post "/unreserveTable" (bindJson (fun tableNumber -> json <| Floorplan.unReserveTable tableNumber) ) + post "/unreserveTable" (bindJson AjaxController.unreserveTable ) getf "/getRoomData/%i" AjaxController.getRoomData + getf "/getKeyboardLayout/%s" AjaxController.getKeyboardLayout getf "/getTablesAndDecorations/%i" AjaxController.getRoomTablesAndDecorations get "/languageVars" (json <| AjaxController.getLanguageVars) get "/getOpenTables" (json <| Floorplan.getActiveTables Floorplan.currentVenue) getf "/getActiveTables/%i" AjaxController.getActiveTables - getf "/tableIsOpen/%i" (fun tableNumber -> json <| Floorplan.tableIsOpen tableNumber) - getf "/transferTables/%i/%i" AjaxController.transferTable - getf "/mergeTables/%i/%i" AjaxController.mergeTables + getf "/getFloorplanData/%i" AjaxController.getFloorplanData + getf "/tableIsOpen/%i" (fun tableNumber -> json <| Floorplan.tableNumberIsOpen tableNumber) + getf "/transferTable/%i/%i" AjaxController.transferTable getf "/unmergeTable/%i" AjaxController.unmergeTable getf "/tableExists/%i" (fun tableNumber -> json <| Floorplan.tableExists tableNumber) - getf "/deleteTable/%i" (fun tableNumber -> json <| Floorplan.deleteTable tableNumber) } let pageRouter = router { @@ -56,6 +60,7 @@ module Program = let app = application { use_static "wwwroot" use_router pageRouter + } run app diff --git a/Reservations.module.fs b/Reservations.module.fs index f58c9f5..c161ae1 100644 --- a/Reservations.module.fs +++ b/Reservations.module.fs @@ -3,9 +3,9 @@ open System open DredgeFramework open Dapper.FSharp - +[] type reservation = { - reservation_id: int + id: int reservation_name: string reservation_time: int reservation_covers: int @@ -16,13 +16,21 @@ type reservation = { let GetReservationById (id: int) = select { table "reservations" - where (eq "reservation_id" id) + where (eq "id" id) } |> db.Select |> first +let updateReservation (reservation: reservation) = + update{ + table "reservations" + set reservation + where(eq "id" reservation.id) + } |> db.Update |> ignore + reservation + let DeleteReservation (tableId: int) = delete { table "reservations" - where (eq "table_id" tableId) + where (eq "reservation_table_id" tableId) } |> db.Delete |> ignore \ No newline at end of file diff --git a/Session.module.fs b/Session.module.fs index 62e8e5c..674dbc0 100644 --- a/Session.module.fs +++ b/Session.module.fs @@ -6,7 +6,8 @@ open Dapper.FSharp open Clerk open Thoth.Json.Net -type session = {session_id: string; clerk_json: string; clerk_id: int; expires: int} +[] +type session = {id: int; session_id: string; clerk_json: string; clerk_id: int; expires: int} let deleteSession sessionId context = delete { @@ -25,19 +26,22 @@ let deleteSessionByClerkId clerk_id context = let createNewSession (clerk: clerk) context = if (getClerkByLoginCode clerk.clerk_login_code).IsSome then - deleteSessionByClerkId clerk.clerk_id context + deleteSessionByClerkId clerk.id context let newSessionId = (Guid.NewGuid().ToString "N") + (Guid.NewGuid().ToString "N") - let newSession = { session_id = newSessionId + let newSession = { + id = 0 + session_id = newSessionId clerk_json = clerk |> jsonEncode - clerk_id = clerk.clerk_id + clerk_id = clerk.id expires = int <| DateTimeOffset.Now.AddHours(24.0).ToUnixTimeSeconds() } - insert { table "sessions" value newSession - } |> db.Insert |> ignore + } + |> db.Insert + |> ignore Browser.setCookie "dredgepos_clerk_logged_in" newSessionId (DateTimeOffset.UtcNow.AddHours(24.0)) context @@ -63,7 +67,7 @@ let sessionExists (sessionId: string) context = let checkAuthentication clerk = let existingClerk = getClerkByLoginCode clerk.clerk_login_code if existingClerk.IsSome - && existingClerk.Value.clerk_id = clerk.clerk_id + && existingClerk.Value.id = clerk.id && existingClerk.Value.clerk_name = clerk.clerk_name && existingClerk.Value.clerk_login_code = clerk.clerk_login_code then true @@ -79,12 +83,12 @@ let getSession (sessionId: string) = } |> db.Select match sessions |> length with - | 0 -> {session_id = ""; clerk_json = ""; clerk_id= 0; expires= 0} + | 0 -> {session_id = ""; clerk_json = ""; clerk_id= 0; expires= 0; id=0} | _ -> sessions |> first let getCurrentClerk context = let cookie = getLoginCookie context - let emptyClerk = {clerk_id=0; clerk_login_code=0; clerk_usergroup=0; clerk_name=""} + let emptyClerk = {id=0; clerk_login_code=0; clerk_usergroup=0; clerk_name=""} match cookie with | "" -> Browser.redirect "/login" context diff --git a/bin/Debug/net6.0/DredgePos.dll b/bin/Debug/net6.0/DredgePos.dll new file mode 100644 index 0000000..e866682 Binary files /dev/null and b/bin/Debug/net6.0/DredgePos.dll differ diff --git a/tables/active/table24.table b/tables/active/table24.table new file mode 100644 index 0000000..e69de29 diff --git a/wwwroot/languages/english/keyboardLayout.json b/wwwroot/languages/english/keyboardLayout.json index 7613c07..07d54e9 100644 --- a/wwwroot/languages/english/keyboardLayout.json +++ b/wwwroot/languages/english/keyboardLayout.json @@ -117,10 +117,10 @@ "<", ">", "?" - ], + ], "row5": [ "[space]space" - ], + ], "row5_shift": [ "[space] " ] diff --git a/wwwroot/languages/english/main.json b/wwwroot/languages/english/main.json index 3546af1..a1fa358 100644 --- a/wwwroot/languages/english/main.json +++ b/wwwroot/languages/english/main.json @@ -14,7 +14,7 @@ "logged_in_as":"Logged in as [1]", "covers":"[1] Covers", "selected_cover":"Cover [1]", - "activeTable":"Table [1]", + "active_table":"Table [1]", "totalPrice":"Total Price: [1]", "selectedPrice":"([1] Selected)", "next_page":"Next Page", @@ -60,7 +60,8 @@ "delete_table":"Delete Table", "change_shape":"Change Shape", "new_table_number":"New Table Number", - "transfer_table":"Transfer to New Table", + "transfer_table":"Transfer to Other Table", + "transfer_self_error":"Cannot transfer a table to itself.", "add_decoration":"Add Decoration", "choose_decoration":"Choose a Decoration", "delete_decoration":"Delete Decoration", @@ -68,9 +69,11 @@ "reserved_for":"Reserved for [1]", "reserved":"Reserved", "confirm_delete_reservation":"Are you sure you want to delete the reservation on table [1]?", + "confirm_reservation_name":"Who is this reservation for?", "error_table_exists":"Table already exists in room \"[1]\"", "error_table_exists_merged":"Table already exists in room \"[1]\", it is merged with table [2].", "error_delete_existing_table":"Can't delete a table that's currently active.", + "error_self_merge" : "You can't merge a table with itself", "confirm_delete_table":"Are you sure you want to delete table [1]?", "orig_qty_header":"Original Qty", "selected_qty_header":"Selected Qty", diff --git a/wwwroot/scripts/js/dredgepos.core.js b/wwwroot/scripts/js/dredgepos.core.js index d71c222..8d9c851 100644 --- a/wwwroot/scripts/js/dredgepos.core.js +++ b/wwwroot/scripts/js/dredgepos.core.js @@ -1,11 +1,11 @@ let Application = { keyboard: null, - mode: "default", + mode: [], languageVars: {} }; /** Parses a language variable. */ let lang = (key, replacements) => { - let finalValue = Application.languageVars[key]; + let finalValue = Application.languageVars[key] || ''; if (!replacements) return finalValue; if (typeof replacements === 'string') @@ -28,16 +28,19 @@ let ajax = (endpoint, data, method = 'POST', successFunction, errorFunction, bef method: method, data: data, success: (response) => { - if (successFunction) + if (successFunction && response.status == 'success') successFunction(JSON.parse(response.data)); + else if (errorFunction && response.status != 'success') { + errorFunction(JSON.parse(response.data)); + } }, - error: errorFunction, + error: (error) => console.log(error.statusCode), beforeSend: beforeFunction }); }; /* For the flow of the app, synchronous is commonly preferred - though trying to keep it's usage as low as possible. + though trying to keep its usage as low as possible. */ let ajaxSync = (endpoint, data, method = 'POST') => { let response = JSON.parse($.ajax({ @@ -56,11 +59,14 @@ let ajaxSync = (endpoint, data, method = 'POST') => { let redirect = (url) => { window.location.href = url; }; -let setLanguageVariables = () => { - Application.languageVars = ajaxSync('/ajax/languageVars', null, 'GET'); +let setupCore = (languageVars) => { + Application.languageVars = languageVars; + const doc = $(document); + doc.on('click', '#alertNo, #alertOk', hideAlerts); + setElementVisibilityByMode(); }; // @ts-ignore -let alert = (message, title = 'Message') => { +let posAlert = (message, title = 'Message') => { let alertBox = $('#alert'); alertBox.css('display', 'flex'); alertBox.data('value', ''); @@ -70,12 +76,11 @@ let alert = (message, title = 'Message') => { $('#alertYes').css('display', 'none'); $('#alertNo').css('display', 'none'); }; -// @ts-ignore -let confirm = (message, data, title = 'Confirm', submitFunction = (data) => { hideAlerts(); }) => { +let confirmation = (message, data, title = 'Confirm', submitFunction = (data) => { hideAlerts(); }) => { let alert = $('#alert'); $(document).on('click', '#alert #alertYes', () => { - submitFunction(data); hideAlerts(); + submitFunction(data); $(document).off('click', '#alert #alertYes'); }); alert.css('display', 'flex'); @@ -85,12 +90,58 @@ let confirm = (message, data, title = 'Confirm', submitFunction = (data) => { hi $('#alertYes').css('display', 'flex'); $('#alertNo').css('display', 'flex'); }; -let hideAlerts = () => { - $('#alert').hide(); +let hideAlerts = () => $('#alert').hide(); +let turnOnMode = (mode) => { + Application.mode.push(mode); + setElementVisibilityByMode(); }; -$(() => { - let doc = $(document); - setLanguageVariables(); - doc.on('click', '#alertNo, #alertOk', () => $('#alert').hide()); -}); +let turnOffMode = (mode) => { + Application.mode = Application.mode.filter((value) => value != mode); + setElementVisibilityByMode(); +}; +let toggleMode = (mode) => { + if (!isInMode(mode)) + turnOnMode(mode); + else + turnOffMode(mode); +}; +let clearModes = () => { Application.mode = []; }; +let isInMode = (mode) => Application.mode.includes(mode); +let setElementVisibilityByMode = () => { + const mode = Application.mode; + const elements = $('[data-visible-in-mode]'); + elements.each((index, elem) => { + let element = $(elem); + let visibleInModes = element.data('visible-in-mode'); + let showElement = visibleInModes.every(visibleMode => { + return mode.includes(visibleMode); + }); + if (element.hasClass('useVisibility')) { + if (showElement) { + element.css('visibility', 'visible'); + } + else + element.css('visibility', 'hidden'); + } + else + element.toggle(showElement); + }); + const invisibleElements = $('[data-invisible-in-mode]'); + invisibleElements.each((index, elem) => { + let element = $(elem); + let inVisibleInModes = element.data('invisible-in-mode'); + let hideElement = inVisibleInModes.every(invisibleMode => { + return mode.includes(invisibleMode); + }); + element.toggle(!hideElement); + }); + $('[data-active-in-mode]').each((index, elem) => { + const button = $(elem); + const activeInMode = button.data('active-in-mode'); + mode.includes(activeInMode) + ? button.addClass('active') + : button.removeClass('active'); + }); +}; +$(() => ajax('/ajax/languageVars', null, 'GET', setupCore, null, null)); //# sourceMappingURL=dredgepos.core.js.map \ No newline at end of file diff --git a/wwwroot/scripts/js/dredgepos.core.js.map b/wwwroot/scripts/js/dredgepos.core.js.map index 528d941..77a1276 100644 --- a/wwwroot/scripts/js/dredgepos.core.js.map +++ b/wwwroot/scripts/js/dredgepos.core.js.map @@ -1 +1 @@ -{"version":3,"file":"dredgepos.core.js","sourceRoot":"","sources":["../ts/dredgepos.core.ts"],"names":[],"mappings":"AAAK,IAAI,WAAW,GAAsB;IAClC,QAAQ,EAAG,IAAI;IACf,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,EAAE;CACnB,CAAA;AAGD,kCAAkC;AACjC,IAAI,IAAI,GAAG,CAAC,GAAW,EAAE,YAAgC,EAAE,EAAE;IAC1D,IAAI,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAE9C,IAAG,CAAC,YAAY;QAAE,OAAO,UAAU,CAAA;IACnC,IAAG,OAAO,YAAY,KAAK,QAAQ;QAAE,YAAY,GAAG,CAAC,YAAY,CAAC,CAAA;IAElE,YAAY,CAAC,OAAO,CAAE,CAAC,WAAW,EAAE,KAAK,EAAE,EAA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AAC,mBAAmB,CAAC,CAAA;QAClE,IAAI,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;YACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAGD,CAAC,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;QACtB,MAAM,YAAY,GAAa,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAE7D,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YACvB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC3B,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAErC,CAAC,CAAC,CAAA;AAEN,CAAC,CAAA;AAEN,CAAC,CAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/wwwroot/scripts/js/dredgepos.floorplan.js b/wwwroot/scripts/js/dredgepos.floorplan.js index 734010a..991d481 100644 --- a/wwwroot/scripts/js/dredgepos.floorplan.js +++ b/wwwroot/scripts/js/dredgepos.floorplan.js @@ -1,301 +1,107 @@ /// -let stage; -let transformer; -let tableLayer; -let editMode = false; -let activeTables = []; -let selectedTable; -let selectedTableNumber; -let currentRoom; -let basis = 1280; -let scale = 1; -let newTable; -let roomName; -//Makes sure canvas always fits inside the div -function getDimensions(parentDiv) { - let tableMap = $('#tableMap'); - let outerWidth = parentDiv.outerWidth(); - let outerHeight = parentDiv.outerHeight(); - let width = outerWidth; - let height = outerWidth; - if (outerWidth >= outerHeight) { - width = outerHeight; - height = outerHeight; - } - tableMap.height(height); - tableMap.width(width); - scale = width / basis; - return { width: width, height: height }; -} -function setupTableMap() { - let doc = $(document); - activeTables = ajaxSync('/ajax/getActiveTables/1', null, 'GET'); - let dimensions = getDimensions($('#mapContainer')); - roomName = 'Deck & Courtyard'; - stage = new Konva.Stage({ - container: 'tableMap', - width: dimensions.width, - height: dimensions.height, - }); - $('body').on('click', '.editModeButton', () => { toggleEditMode(); }); - $('.roomButton').on('click', function () { - roomName = $(this).text(); - loadRoom($(this).data('value')); - }); - $('.transferTableButton').on('click', function () { - transferModeOn(); - }); - $('.addDecoration').on('click', function () { - $('#decorator').css('display', 'flex'); - }); - $('.deleteDecoration').on('click', function () { - deleteDecoration(selectedDecoration); - }); - $('.decoratorItem').on('click', function () { - addDecoration(this); - }); - $('.changeShapeButton').on('click', function () { - changeTableShape(selectedTableNumber); - }); - $('.reserveTableButton').on('click', function () { - if ($(this).text() === lang('reserve_table')) { - reserveTable(); +const Floorplan = { + rooms: [], + tables: [], + decorations: [], + reservations: [], + activeTableNumbers: [], + stage: null, + transformer: null, + tableLayer: null, + selectedTableNumber: 0, + currentRoom: null, + roomToLoad: null, + visualScale: 1, + visualScaleBasis: 1280, + floorplanDiv: null, + selectedDecorationId: 0 +}; +$(() => ajax('/ajax/getFloorplanData/1', null, 'get', setupFloorplan, null, null)); +const setupFloorplanEvents = () => { + const doc = $(document); + doc.on('click', '.roomButton', roomButtonClicked); + doc.on('click', '.editModeButton', editModeButtonClicked); + doc.on('click', '.changeShapeButton', changeTableShape); + doc.on('click', '.addTableButton', showAddTablePopup); + doc.on('click', '.deleteTableButton', confirmDeleteTable); + doc.on('click', '.addDecoration', showDecorator); + doc.on('click', '.deleteDecoration', deleteDecoration); + doc.on('click', '.decoratorItem', addDecoration); + doc.on('click', '.mergeButton', toggleMergeMode); + doc.on('click', '.unmergeButton', unmergeTable); + doc.on('click', '.transferTableButton', toggleTransferMode); + doc.on('click', '.reserveTableButton', reserveTable); + doc.on('click', '.unreserveTableButton', unreserveTable); +}; +const roomButtonClicked = (e) => { + const button = $(e.target); + const roomId = button.data('value'); + loadRoom(getRoomById(roomId)); +}; +const editModeButtonClicked = (e) => { + const button = $(e.target); + button.toggleClass('active'); + toggleMode('edit'); + if (isInMode('edit')) { + Floorplan.stage.find('Group, Image').forEach(table => table.draggable(true)); + if (isInMode('tableSelected')) { + const selectedTableShape = getTableShapeFromTableNumber(Floorplan.selectedTableNumber); + selectTable(selectedTableShape); } - else { - unreserveTable(); - } - }); - $('.addTableButton').on('click', function () { - addTable(); - }); - $('.deleteTableButton').on('click', function () { - deleteTable(); - }); - loadRoom(roomToLoad); -} -let updateTableShape = (tableData) => { - return ajaxSync('/ajax/updateTableShape', tableData); -}; -//Change the shape of a table in edit mode. -function changeTableShape(tableNumber) { - let tableData = getTableData(tableNumber); - let tableShape = tableData['shape']; - let tableWidth = tableData['width']; - let tableHeight = tableData['height']; - let tableRotation = tableData['rotation']; - let order = ['square', 'rect', 'longrect', 'diamond', 'circle', 'ellipse', 'longellipse']; - if (order.indexOf(tableShape) === -1) - tableShape = 'square'; - //What the next shape is - let currentIndex = order.indexOf(tableShape); - let nextIndex = currentIndex + 1; - if (nextIndex > (order.length) - 1) - nextIndex = 0; - let nextShape = order[nextIndex]; - switch (nextShape) { - case 'square': - case 'circle': - tableHeight = tableWidth; - tableRotation = 0; - break; - case 'diamond': - tableHeight = tableWidth; - tableRotation = 45; - break; - case 'rect': - case 'ellipse': - tableHeight = tableWidth * 2; - tableRotation = 0; - break; - case 'longrect': - case 'longellipse': - tableRotation = 90; - break; - } - let updateData = { - table_number: tableNumber, - shape: nextShape, - height: tableHeight, - width: tableWidth, - rotation: tableRotation - }; - tableData = updateTableShape(updateData); - let tableGroup = stage.find('#' + tableNumber)[0]; - transformer.nodes([]); - tableGroup.destroy(); - let newTable = createTableElement(tableData); - tableLayer.add(newTable); - stage.draw(); - selectTable(tableNumber); - loadRoom(currentRoom, tableNumber); -} -let createTable = (tableData) => { - return ajaxSync('/ajax/createTable', tableData); -}; -let tableExists = (tableNumber) => { - return ajaxSync(`/ajax/tableExists/${tableNumber}`); -}; -function addTable(tableNumber) { - if (!tableNumber) { - showVirtualNumpad(lang('new_table_number'), 4, false, false, true, addTable); } else { - let newTableInfo = { - table_number: tableNumber, - room_id: currentRoom, - default_covers: 2, - width: 200, - height: 200, - rotation: 0, - pos_x: basis / 2, - pos_y: basis / 2, - shape: 'square', - merged_children: '', - previous_state: '', - status: 0, - reservation: 0, - venue_id: 1 - }; - let newTableData = createTable(newTableInfo); - if (!newTableData.table_number) { - alert(newTableData); - return false; - } - newTable = createTableElement(newTableData); - tableLayer.add(newTable); - tableLayer.draw(); - selectTable(tableNumber); + setTransformerNodes([]); + Floorplan.stage.find('Group, Image').forEach(table => table.draggable(false)); } -} -function selectTable(tableNumber) { - let table = stage.find('#' + tableNumber)[0]; - table.fire('click'); -} -function deleteTable(tableNumber = 0) { - if (!tableNumber) { - confirm(lang('confirm_delete_table', selectedTableNumber), selectedTableNumber, 'Confirm', deleteTable); - } - else { - if (tableIsOpen(selectedTableNumber)) { - alert(lang('error_delete_existing_table')); - } - else { - ajax(`/ajax/deleteTable/${selectedTableNumber}`, null, 'GET'); - let table = stage.find('#' + tableNumber)[0]; - transformer.nodes([]); - table.destroy(); - tableLayer.draw(); - selectedTable = null; - selectedTableNumber = null; - } - } -} -// Rotate a shape around any point. -// shape is a Konva shape -// angleDegrees is the angle to rotate by, in degrees. -// point is an object {x: posX, y: posY} -function rotateAroundPoint(shape, angleDegrees, point) { - let angleRadians = angleDegrees * Math.PI / 180; - // they lied, I did have to use trigonometry - const x = point.x + - (shape.x() - point.x) * Math.cos(angleRadians) - - (shape.y() - point.y) * Math.sin(angleRadians); - const y = point.y + - (shape.x() - point.x) * Math.sin(angleRadians) + - (shape.y() - point.y) * Math.cos(angleRadians); - shape.rotation(shape.rotation() + angleDegrees); // rotate the shape in place - shape.x(x); // move the rotated shape in relation to the rotation point. - shape.y(y); -} -function createDecoration(data, idToSelect = false) { - let draggable = editMode; - var decoration = new Image(); - decoration.onload = function () { - var dec = new Konva.Image({ - id: data.decoration_id.toString(), - x: data.decoration_pos_x * scale, - y: data.decoration_pos_y * scale, - image: decoration, - offsetX: data.decoration_width * 0.5 * scale, - offsetY: data.decoration_height * 0.5 * scale, - rotation: data.decoration_rotation, - width: data.decoration_width * scale, - height: data.decoration_height * scale, - draggable: draggable, - }); - if (editMode && dec.id() === idToSelect) { - transformer.nodes([dec]); - transformer.moveToTop(); - } - dec.on('click', function () { - selectDecoration(this); - }); - dec.on('tap', function () { - selectDecoration(this); - }); - dec.on('dragend', function () { - saveDecTransformation(this); - }); - dec.on('transformend', function () { - saveDecTransformation(this); - }); - // add the shape to the layer - tableLayer.add(dec); - tableLayer.draw(); - dec.moveToBottom(); - }; - decoration.src = 'images/decorations/' + data.decoration_image; - return decoration; -} -var selectedDecoration = false; -function selectDecoration(decoration) { - if (editMode) { - if ((transformer.nodes().length > 0 && transformer.nodes()[0] != decoration) || transformer.nodes().length == 0) { - resetActiveTable(); - transformer.nodes([decoration]); - decoration.moveToTop(); - transformer.moveToTop(); - selectedDecoration = decoration; - toggleFloorplanControls(); - } - else { - transformer.nodes([]); - selectedDecoration = false; - $('.deleteDecoration').css('display', 'none'); - } - } -} -function createTableElement(data, selectTable = false) { - // Create container group - let draggable = editMode || newTable === data.table_number; - let table = new Konva.Group({ - x: data.pos_x * scale, - y: data.pos_y * scale, +}; +const setupFloorplan = (floorplanData) => { + Floorplan.tables = floorplanData.tables; + Floorplan.activeTableNumbers = floorplanData.activeTableNumbers; + Floorplan.rooms = floorplanData.rooms; + Floorplan.decorations = floorplanData.decorations; + Floorplan.reservations = floorplanData.reservations; + getDimensions(); + setupFloorplanEvents(); + loadRoom(Floorplan.rooms[0]); +}; +const loadRoom = (roomToLoad) => { + setRoomBackground(roomToLoad); + setupKonva(); + const tablesInRoom = Floorplan.tables.filter(table => table.room_id == roomToLoad.id); + const decorationsInRoom = Floorplan.decorations.filter(decoration => decoration.decoration_room == roomToLoad.id); + decorationsInRoom.forEach(decoration => createDecorationShape(decoration, false)); + tablesInRoom.forEach(createTableShape); + Floorplan.currentRoom = roomToLoad; +}; +const getRoomById = (roomId) => { + return Floorplan.rooms.find((room) => room.id == roomId); +}; +const tableIsOpen = (table) => Floorplan.activeTableNumbers.includes(table.table_number); +const createTableShape = (table) => { + const draggable = isInMode('edit'); + const tableGroup = new Konva.Group({ + x: table.pos_x * Floorplan.visualScale, + y: table.pos_y * Floorplan.visualScale, draggable: draggable, listening: true, - id: data.table_number.toString() + id: table.table_number.toString() }); - let fillColor = 'gray'; - if (data.status === 'reserved') { - fillColor = 'lightgreen'; - } - if (activeTables.includes(data.table_number)) { - fillColor = 'lightblue'; - } - data.width = data.width * scale; - data.height = data.height * scale; - // Create background shape - let shape; - switch (data.shape) { + const fillColor = tableIsOpen(table) + ? 'lightblue' + : table.status == 2 + ? 'lightgreen' + : 'gray'; + let tableShape; + switch (table.shape) { case "circle": // fall-through case "ellipse": // fall-through case "longellipse": - shape = new Konva.Ellipse({ + tableShape = new Konva.Ellipse({ x: 0, y: 0, - radiusX: data.width * 0.5, - radiusY: data.height * 0.5, - rotation: data.rotation, + radiusX: table.width * 0.5 * Floorplan.visualScale, + radiusY: table.height * 0.5 * Floorplan.visualScale, + rotation: table.rotation, fill: fillColor, stroke: "black", strokeWidth: 4, @@ -304,14 +110,14 @@ function createTableElement(data, selectTable = false) { }); break; default: - shape = new Konva.Rect({ + tableShape = new Konva.Rect({ x: 0, y: 0, - offsetX: data.width * 0.5, - offsetY: data.height * 0.5, - width: data.width, - height: data.height, - rotation: data.rotation, + offsetX: table.width * 0.5 * Floorplan.visualScale, + offsetY: table.height * 0.5 * Floorplan.visualScale, + width: table.width * Floorplan.visualScale, + height: table.height * Floorplan.visualScale, + rotation: table.rotation, fill: fillColor, stroke: "black", strokeWidth: 4, @@ -319,466 +125,514 @@ function createTableElement(data, selectTable = false) { listening: true }); break; - } // End switch - // Create label - let label = new Konva.Text({ - x: data.width * -0.5, - y: data.height * -0.5, - width: data.width, - height: data.height, - text: data.table_number.toString(), - fontSize: 40 * scale, + } + const label = new Konva.Text({ + x: table.width * -0.5 * Floorplan.visualScale, + y: table.height * -0.5 * Floorplan.visualScale, + width: table.width * Floorplan.visualScale, + height: table.height * Floorplan.visualScale, + text: table.table_number.toString(), + fontSize: 40 * Floorplan.visualScale, fill: "black", align: "center", verticalAlign: "middle", draggable: false, listening: false }); - tableNumber = data.tablenumber; - table.add(shape, label); - table.on('dblclick', function () { - tableNumber = parseInt(getTableNumber(this)); - if (!editMode) { - loadScreen('orderScreen', 'table=' + tableNumber); - } - }); - table.on('dbltap', function () { - tableNumber = getTableNumber(this); - loadScreen('orderScreen', 'table=' + tableNumber); - }); - table.on('dragend', function () { - saveTransformation(table); - }); - innerShape = getTableShape(table); - table.on('click', function () { - selectTableShape(this); - }); - table.on('tap', function () { - selectTableShape(this); - }); - innerShape.on('transformend', function () { - saveTransformation(table); - }); - // add the shape to the layer - tableLayer.add(table); - table.moveToTop(); - if (tableNumber === selectedTableNumber) { - selectTable = table; - } - if (selectTable) { - if (selectTable === tableNumber) { - table.fire('click'); - } - } - return table; -} -function loadRoom(room, selectTable = 0, selectDecoration = false) { - //if (room === currentRoom) return false - ajax(`/ajax/getRoomData/${room}`, null, 'GET', (response) => { - let floorplanDiv = $('#tableMap'); - let backgroundImage = response.background_image; - floorplanDiv.css("background-image", `url(images/rooms/${backgroundImage})`); - floorplanDiv.css("background-size", `${width}px ${height}px`); - }, null, null); - $('.roomButton').removeClass('active'); - let selector = ".roomButton:contains('" + roomName + "')"; - $(selector).addClass('active'); - currentRoom = room; - resetActiveTable(); - stage.destroy(); - stage = new Konva.Stage({ - container: 'tableMap', - width: width, - height: height, - }); - transformer = new Konva.Transformer({ - rotationSnaps: [0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 225, 270, -15, -30, -45, -60, -75, -90, -105, -120, -135, -150, -165, -180, -225, -270, 360, -360], - anchorSize: 40 * scale, - ignoreStroke: true, - centeredScaling: true - }); - let tablesAndDecorations = ajaxSync(`/ajax/getTablesAndDecorations/${room}`, null, 'GET'); - let decorations = tablesAndDecorations['decorations']; - let tables = tablesAndDecorations['tables']; - tableLayer = new Konva.Layer(); - tableLayer.add(transformer); - // Loop data and call the creation method for each decoration/table. - decorations.forEach(itemData => { - createDecoration(itemData, selectDecoration); - }); - tables.forEach(itemData => { - tableLayer.add(createTableElement(itemData, selectTable)); - }); - activeTables = getOpenTables(); - stage.add(tableLayer); -} -var mergeMode = false; -var parentMergeTable; -var childMergeTable; -var tableTransferOrigin; -var transferMode = false; -function transferModeOn() { - mergeModeOff(); - if (!transferMode) { - tableTransferOrigin = selectedTableNumber; - transferMode = true; - $('.transferTableButton').addClass('active'); - $('.transferTableButton').text('Select a table to transfer items to'); - } - else { - transferModeOff(); - } -} -function transferModeOff() { - transferMode = false; - $('.transferTableButton').removeClass('active'); - $('.transferTableButton').text(lang('transfer_table')); -} -let getOpenTables = () => { - return ajaxSync('/ajax/getActiveTables/1', null, 'GET'); + tableGroup.add(tableShape, label); + setupTableEvents(tableGroup); + Floorplan.tableLayer.add(tableGroup); + return tableGroup; }; -let transferTableAjax = (origin, destination) => { - ajax(`/ajax/transferTables/${origin}/${destination}`, null, 'GET'); +const setupTableEvents = (tableGroup) => { + const tableShape = getTableShapeFromGroup(tableGroup); + tableGroup.on('click', (e) => tableClicked(e.target)); + tableGroup.on('tap', (e) => tableClicked(e.target)); + tableGroup.on('dragend', (e) => saveTableTransformation(e.target)); + tableShape.on('transformend', (e) => { + const group = getTableGroupFromShape(e.target); + saveTableTransformation(group); + }); }; -function transferTables() { - destination = selectedTableNumber; - origin = tableTransferOrigin; - if (destination !== origin) { - transferTableAjax(origin, destination); - activeTables = getOpenTables(); - transferModeOff(); - getTableShape(selectedTable).fill('lightblue'); - getTableShape(getTableGroup(origin)).fill('gray'); - } - else { - alert("Can't transfer a table to itself."); - transferModeOff(); - } -} -function mergeModeOn() { - transferModeOff(); - if (!mergeMode) { - mergeMode = true; - $('.mergeButton').addClass('active'); - $('.mergeButton').text('Select a table to merge with Table ' + selectedTableNumber); - parentMergeTable = selectedTableNumber; - } - else { - mergeModeOff(); - } -} -function mergeModeOff() { - mergeMode = false; - $('.mergeButton').removeClass('active'); - $('.mergeButton').text(lang('merge_table')); -} -let ajaxMergeTables = (parent, child) => { - return ajaxSync(`/ajax/mergeTables/${parent}/${child}`, null, 'GET'); +const getTableShapeFromGroup = (group) => group.getChildren()[0]; +const getTableGroupFromShape = (shape) => shape.parent; +const saveTableTransformation = (tableGroup) => { + const originalTable = getTableDataFromGroup(tableGroup); + const tableShape = getTableShapeFromGroup(tableGroup); + const newTableInfo = { + table_number: originalTable.table_number, + previous_state: originalTable.previous_state, + merged_children: originalTable.merged_children, + id: originalTable.id, + width: Math.round(tableShape.scaleX() * tableShape.width() / Floorplan.visualScale), + height: Math.round(tableShape.scaleY() * tableShape.height() / Floorplan.visualScale), + pos_x: Math.round(tableGroup.x() / Floorplan.visualScale), + pos_y: Math.round(tableGroup.y() / Floorplan.visualScale), + rotation: Math.round(tableShape.rotation()), + room_id: originalTable.room_id, + status: originalTable.status, + venue_id: originalTable.venue_id, + shape: originalTable.shape, + default_covers: originalTable.default_covers, + }; + saveTable(newTableInfo); + redrawTable(tableGroup); }; -let ajaxUnmergeTable = (parent) => { - return ajaxSync(`/ajax/unmergeTable/${parent}`, null, 'GET'); +const saveTable = (tableToUpdate) => { + const tables = Floorplan + .tables + .filter(table => { + return table.id != tableToUpdate.id; + }); + tables.push(tableToUpdate); + Floorplan.tables = tables; + ajax("/ajax/transformTable", tableToUpdate, 'post', null, null, null); }; -function mergeTables() { - parentMergeTable = parseInt(parentMergeTable); - childMergeTable = parseInt(childMergeTable); - if (childMergeTable !== parentMergeTable) { - let result = ajaxMergeTables(parentMergeTable, childMergeTable); - mergeModeOff(); - loadRoom(currentRoom); - newTable = getTableGroup(parentMergeTable); - newTable.draggable(true); - if (tableIsOpen(parentMergeTable)) { - getTableShape(newTable).fill('lightblue'); - } - } - else { - alert("Can't merge a table with itself!"); - mergeModeOff(); - } -} -//When a table is passed (a group of the shape plus the text), returns the number as string. -function getTableNumber(tableGroup) { - textItem = tableGroup.getChildren()[1]; - return textItem.getText(); -} -function getTableGroup(tableNumber) { - return stage.find('#' + tableNumber)[0]; -} -function getTableShape(tableGroup) { +const setTransformerNodes = (nodes) => { + Floorplan.transformer.moveToTop(); + if (nodes.length < 1) + Floorplan.transformer.moveToBottom(); + Floorplan.transformer.nodes(nodes); +}; +const getTableDataFromTableNumber = (tableNumber) => { + return Floorplan.tables.filter(table => table.table_number == tableNumber)[0]; +}; +const getTableDataFromGroup = (tableGroup) => { + const tableNumber = tableGroup.attrs.id; + return Floorplan.tables.find(table => tableNumber == table.table_number); +}; +const getTableDataFromShape = (tableShape) => getTableDataFromGroup(tableShape.parent); +const getTableShapeFromTableNumber = (tableNumber) => { + const tableGroup = Floorplan.stage.find('Group').find((group) => { + return group.attrs.id == tableNumber; + }); return tableGroup.getChildren()[0]; -} -function getReservation(id) { - return ajaxSync('/ajax/getReservation', id); -} -//When a user selects a table. -function selectTableShape(table) { - let tableNumber = getTableNumber(table); - let shape = getTableShape(table); - let strokeColor = shape.stroke(); - selectedTable = table; - selectedTableNumber = tableNumber; - if (transferMode) - transferTables(); - if (mergeMode) { - childMergeTable = tableNumber; - mergeTables(); - } - else { - //If table is not selected - if (strokeColor !== "yellow") { - let tableData = getTableData(selectedTableNumber); - let coverNumberString = lang('covers', tableData.default_covers.toString()); - let tableString = '' + lang('activeTable', selectedTableNumber.toString()) + ''; - $('.reserveTableButton').text(lang('reserve_table')); - if (tableData.status === 'reserved') { - let reservation = getReservation(tableData.reservation_id); - console.log(reservation); - $('.reserveTableButton').text(lang('unreserve_table')); - if (reservation.reservation_name) { - reservationString = lang('reserved_for', reservation.reservation_name); - } - else { - reservationString = lang('reserved'); - } - tableString += '' + reservationString + ''; - } - tableString += " (" + coverNumberString + ")"; - $('.currentTable').html(tableString); - stage.find('Rect').forEach(function (rect, index) { - rect.stroke("black"); - }); - stage.find('Ellipse').forEach(function (circ, index) { - circ.stroke("black"); - }); - shape.stroke("yellow"); - toggleEditControls(true); - if (editMode) { - toggleFloorplanControls(); - $('.deleteDecoration').css('display', 'none'); - transformer.nodes([getTableShape(table)]); - table.moveToTop(); - transformer.moveToTop(); - } - tableLayer.draw(); - //If the table is already selected - } - else { - resetActiveTable(); - transformer.nodes([]); - tableLayer.draw(); - } - } -} -let getTableData = (tableNumber) => { - return ajaxSync('/ajax/getTableData', tableNumber); }; -let isTableMerged = (tableNumber) => { - let mergeData = getTableData(tableNumber).merged_children; - return mergeData !== ""; +const getTableGroupFromTableNumber = (tableNumber) => { + const tableShape = getTableShapeFromTableNumber(tableNumber); + return getTableGroupFromShape(tableShape); }; -function resetActiveTable() { - if (!transferMode) { - if (selectedTable) { - getTableShape(selectedTable).stroke('black'); - } - selectedTable = null; - selectedTableNumber = ""; - toggleFloorplanControls(false, editMode); - toggleEditControls(false); - } - else { - $('.editControls').css('display', 'none'); - } -} -function addDecoration(button) { - let insertData = { - decoration_room: currentRoom, - basis: basis, - decoration_image: $(button).data('image') - }; - ajaxSync('/ajax/addDecoration', insertData); - $('#decorator').css('display', 'none'); - selectedDecoration = false; - loadRoom(currentRoom); -} -function deleteDecoration(decoration) { - ajax('/ajax/deleteDecoration', decoration.id()); - $('.deleteDecoration').css('display', 'none'); - decoration.destroy(); - selectedDecoration = false; - transformer.nodes([]); -} -function saveDecTransformation(decoration) { - let newData = { - decoration_id: decoration.id(), - decoration_pos_x: decoration.x() / scale, - decoration_pos_y: decoration.y() / scale, - decoration_width: parseInt((decoration.scaleX() * decoration.width()) / scale), - decoration_height: parseInt((decoration.scaleY() * decoration.height()) / scale), - decoration_rotation: parseInt(decoration.rotation()), - decoration_image: decodeURIComponent(decoration.image().src), - decoration_room: currentRoom - }; - if (editMode) { - idToSelect = decoration.id(); - } - ajax('/ajax/updateDecoration', newData); -} -//When a table has been resized, rotated etc. -function saveTransformation(table) { - tableNumber = getTableNumber(table); - shape = getTableShape(table); - newRotation = parseInt(shape.rotation()); - newWidth = parseInt(shape.scaleX() * shape.width() / scale); - newHeight = parseInt((shape.scaleY() * shape.height()) / scale); - newXPos = parseInt(table.x() / scale); - newYPos = parseInt(table.y() / scale); - updateData = { - table_number: tableNumber, - rotation: newRotation, - width: newWidth, - height: newHeight, - pos_x: newXPos, - pos_y: newYPos - }; - transformTable(updateData); -} -let transformTable = (tableData) => { - return ajax("/ajax/transformTable", tableData); -}; -function unmergeTable() { - ajaxUnmergeTable(selectedTableNumber); - loadRoom(currentRoom); -} -function reserveTable(covers) { - if (!covers) { - showVirtualNumpad(lang('how_many_covers'), 2, false, false, true, reserveTable); - } - else { - let table = getTableGroup(selectedTableNumber); - let newReservation = ajaxSync('/ajax/newEmptyReservation', selectedTableNumber); - table.fire('click'); - let tableShape = getTableShape(table); +const setReservationStatus = (table) => { + const reservationText = $('.reservationStatus'); + const tableShape = getTableShapeFromTableNumber(table.table_number); + reservationText.text(''); + if (table.status == 2) { tableShape.fill('lightgreen'); - table.draw(); - table.fire('click'); - completeReservation(newReservation); - } -} -function unreserveTable(input) { - if (!input) { - confirm(lang('confirm_delete_reservation', selectedTableNumber), selectedTableNumber, lang('confirm'), unreserveTable); - } - else { - ajaxSync('/ajax/unreserveTable', input); - hideAlerts(); - table = getTableGroup(input); - table.fire('click'); - tableShape = getTableShape(table); - tableShape.fill('gray'); - table.draw(); - table.fire('click'); - } -} -function completeReservation(resName) { - if (!resName) { - showVirtualKeyboard(lang('enter_reservation_name')); - } - else { - //callPhpFunction('updateTableMapTable', [selectedTableNumber, 'reservation_name', resName]); - loadRoom(currentRoom, selectedTableNumber); - } -} -function toggleEditMode() { - let editModeButton = $('.editModeButton'); - if (editMode === true) { - editMode = false; - loadRoom(currentRoom); - editModeButton.removeClass('active'); - editModeButton.html(lang('edit_floorplan')); - toggleFloorplanControls(false); - if (selectedTable) - selectedTable.fire('click'); - stage.find('Group').forEach(function (table, index) { - table.draggable(false); - }); - } - else { - editMode = true; - stage.find('Group').forEach(function (table, index) { - table.draggable(true); - if (getTableShape(table).stroke() === "yellow") { - table.moveToTop(); - transformer.nodes([getTableShape(table)]); - transformer.moveToTop(); + const reservations = Floorplan.reservations.filter(reservation => reservation.reservation_table_id == table.id); + if (reservations.length) { + turnOnMode('reservedTableSelected'); + reservationText.text(lang('reserved')); + let reservation = reservations[0]; + if (reservation.reservation_name != '') { + reservationText.text(lang('reserved_for', reservation.reservation_name)); } - }); - stage.find('Image').forEach(function (img, index) { - img.draggable(true); - }); - toggleFloorplanControls(); - transformer.moveToTop(); - tableLayer.draw(); - editModeButton.addClass('active'); - editModeButton.html(lang('stop_edit_floorplan')); - } -} -function toggleFloorplanControls(onOrOff = true, subControlsOnly = false) { - if (onOrOff || subControlsOnly) { - $('.floorplanControls').css('visibility', 'visible'); + } } else { - $('.floorplanControls').css('visibility', 'hidden'); + let fillColor = tableIsOpen(table) ? 'lightblue' : 'gray'; + tableShape.fill(fillColor); + turnOffMode('reservedTableSelected'); } - if (selectedTable) { - $('.changeShapeButton').css('visibility', 'visible'); - $('.deleteTableButton').css('visibility', 'visible'); - } - else { - $('.changeShapeButton').css('visibility', 'hidden'); - $('.deleteTableButton').css('visibility', 'hidden'); - } - if (selectedDecoration) { - $('.deleteDecoration').css('display', 'flex'); - } - else { - $('.deleteDecoration').css('display', 'none'); - } -} -let tableIsOpen = (tableNumber) => { - return ajaxSync(`/ajax/tableIsOpen/${tableNumber}`, null, 'GET'); }; -function toggleEditControls(onOrOff = true) { - if (onOrOff) { - $('.editControls').css("display", "flex"); - if (isTableMerged(selectedTableNumber)) { - $('.mergeControls').css("visibility", "visible"); - $('.unmergeButton').css('display', 'flex'); - $('.mergeButton').css('display', 'flex'); +const reserveTable = () => { + showVirtualNumpad(lang('how_many_covers'), 2, false, false, true, createEmptyReservation); +}; +const createEmptyReservation = (covers) => { + const newReservation = { + id: 0, + reservation_covers: covers, + reservation_created_at: 0, + reservation_table_id: getSelectedTableData().id, + reservation_name: '', + reservation_time: 0, + }; + ajax('/ajax/newEmptyReservation', newReservation, 'post', emptyReservationCreated, null, null); +}; +const emptyReservationCreated = (reservation) => { + Floorplan.reservations.push(reservation); + const selectedTable = getSelectedTableData(); + selectedTable.status = 2; + selectedTable.default_covers = reservation.reservation_covers; + updateTableData(selectedTable); + updateCoverText(selectedTable); + setReservationStatus(getSelectedTableData()); + showVirtualKeyboard(lang('confirm_reservation_name'), 32, false, addReservationName); +}; +const addReservationName = (name) => { + hideVirtualKeyboard(); + const reservation = Floorplan.reservations.filter(reservation => reservation.reservation_table_id == getSelectedTableData().id)[0]; + reservation.reservation_name = name; + ajax('/ajax/updateReservation', reservation, 'post', reservationNameAdded, null, null); +}; +const reservationNameAdded = (updatedReservation) => { + console.log(updatedReservation); + Floorplan.reservations = Floorplan.reservations.filter(reservation => reservation.id != updatedReservation.id); + Floorplan.reservations.push(updatedReservation); + setReservationStatus(getSelectedTableData()); +}; +const getReservationsOnTable = (table) => Floorplan.reservations.filter(reservation => reservation.reservation_table_id == table.id); +const updateTableData = (tableToRemove) => { + Floorplan.tables = Floorplan.tables.filter(table => table.id != tableToRemove.id); + Floorplan.tables.push(tableToRemove); +}; +const unreserveTable = () => { + const selectedTable = getSelectedTableData(); + selectedTable.status = 0; + ajax('/ajax/unreserveTable', selectedTable, 'post', tableUnreserved, null, null); +}; +const tableUnreserved = (table) => { + Floorplan.reservations = Floorplan.reservations.filter(reservation => reservation.reservation_table_id != table.id); + updateTableData(table); + setReservationStatus(table); +}; +const getSelectedTableData = () => getTableDataFromTableNumber(Floorplan.selectedTableNumber); +const deselectTables = () => { + Floorplan.stage.find('Rect, Ellipse').forEach((shape, index) => { + shape.stroke('black'); + }); + Floorplan.selectedDecorationId = 0; + Floorplan.selectedTableNumber = 0; + turnOffMode('tableSelected'); + turnOffMode('activeTableSelected'); + turnOffMode('decorationSelected'); + turnOffMode('merge'); + turnOffMode('transfer'); + setTransformerNodes([]); +}; +const selectTable = (tableShape) => { + tableShape.stroke('yellow'); + const table = getTableDataFromShape(tableShape); + Floorplan.selectedTableNumber = table.table_number; + if (isInMode('edit')) { + setTransformerNodes([tableShape]); + } + if (tableIsOpen(table)) { + turnOnMode('activeTableSelected'); + } + $('.reservationStatus').html('' + lang('active_table', table.table_number.toString() + '')); + updateCoverText(table); + $('.selectedTableNumber').text(lang('active_table', table.table_number.toString())); + setReservationStatus(table); + const unmergeVisibility = table.merged_children ? 'visible' : 'hidden'; + $('.unmergeButton').css('visibility', unmergeVisibility); + turnOnMode('tableSelected'); +}; +const updateCoverText = (table) => $('.selectedTableCovers').text(lang('covers', table.default_covers.toString())); +const tableClicked = (tableShape) => { + const table = getTableDataFromShape(tableShape); + if (isInMode('merge')) { + mergeTables(getTableDataFromTableNumber(Floorplan.selectedTableNumber), table); + return; + } + if (isInMode('transfer')) { + transferTables(getTableDataFromTableNumber(Floorplan.selectedTableNumber), table); + } + const selectedTableNumber = Floorplan.selectedTableNumber; + deselectTables(); + if (selectedTableNumber != table.table_number) { + selectTable(tableShape); + } +}; +const createDecorationShape = (decoration, select) => { + const draggable = isInMode('edit'); + const decorationShape = new Image(); + decorationShape.onload = () => { + const decorationImage = new Konva.Image({ + id: decoration.id.toString(), + x: decoration.decoration_pos_x * Floorplan.visualScale, + y: decoration.decoration_pos_y * Floorplan.visualScale, + image: decorationShape, + offsetX: decoration.decoration_width * 0.5 * Floorplan.visualScale, + offsetY: decoration.decoration_height * 0.5 * Floorplan.visualScale, + rotation: decoration.decoration_rotation, + width: decoration.decoration_width * Floorplan.visualScale, + height: decoration.decoration_height * Floorplan.visualScale, + draggable: draggable, + }); + // add the shape to the layer + Floorplan.tableLayer.add(decorationImage); + Floorplan.tableLayer.draw(); + decorationImage.moveToBottom(); + setupDecorationEvents(decorationImage); + if (select) { + decorationImage.moveToTop(); + selectDecorationShape(decorationImage); + } + }; + decorationShape.src = 'images/decorations/' + decoration.decoration_image; +}; +const setupDecorationEvents = (decorationShape) => { + decorationShape.on('click', e => { + decorationClicked(e.target); + }); + decorationShape.on('transformend', e => { + decorationTransformed(e.target); + }); + decorationShape.on('dragend', e => { + decorationTransformed(e.target); + }); +}; +const decorationClicked = (decorationShape) => { + if (isInMode('edit')) { + turnOffMode('tableSelected'); + if ((Floorplan.transformer.nodes().length > 0 && Floorplan.transformer.nodes()[0] != decorationShape) || Floorplan.transformer.nodes().length == 0) { + selectDecorationShape(decorationShape); } else { - $('.mergeControls').css("visibility", "visible"); - $('.mergeButton').css('display', 'flex'); - $('.unmergeButton').css('display', 'none'); - } - if (tableIsOpen(selectedTableNumber)) { - $('.payTableButton').css('display', 'flex'); - $('.viewTableButton').css('display', 'flex'); - $('.reserveTableButton').css('display', 'none'); - $('.transferTableButton').css('display', 'flex'); - } - else { - $('.payTableButton').css('display', 'none'); - $('.viewTableButton').css('display', 'none'); - $('.reserveTableButton').css('display', 'flex'); - $('.transferTableButton').css('display', 'none'); + deselectTables(); + decorationShape.moveToBottom(); } } - else { - $('.editControls').css("display", "none"); - $('.mergeControls').css("visibility", "hidden"); - $('.mergeButton').css("display", "none"); - $('.unmergeButton').css("display", "none"); +}; +const selectDecorationShape = (decorationShape) => { + deselectTables(); + Floorplan.transformer.nodes([decorationShape]); + Floorplan.selectedDecorationId = Number(decorationShape.id()); + decorationShape.moveToTop(); + Floorplan.transformer.moveToTop(); + turnOnMode('decorationSelected'); +}; +const getDecorationDataById = (id) => { + return Floorplan.decorations.find(decoration => id == decoration.id); +}; +const decorationTransformed = (decorationShape) => { + const oldDecorationData = getDecorationDataById(Number(decorationShape.id())); + const newDecoration = { + id: oldDecorationData.id, + decoration_room: oldDecorationData.decoration_room, + decoration_pos_x: Math.round(decorationShape.x() / Floorplan.visualScale), + decoration_pos_y: Math.round(decorationShape.y() / Floorplan.visualScale), + decoration_rotation: Math.round(decorationShape.rotation()), + decoration_width: Math.round((decorationShape.scaleX() * decorationShape.width()) / Floorplan.visualScale), + decoration_height: Math.round((decorationShape.scaleY() * decorationShape.height()) / Floorplan.visualScale), + decoration_image: oldDecorationData.decoration_image, + }; + saveDecoration(newDecoration); +}; +const saveDecoration = (decorationToUpdate) => { + const decorations = Floorplan + .decorations + .filter(decoration => { + return decoration.id != decorationToUpdate.id; + }); + decorations.push(decorationToUpdate); + Floorplan.decorations = decorations; + ajax("/ajax/updateDecoration", decorationToUpdate, 'post', null, null, null); +}; +const showDecorator = () => $('#decorator').css('display', 'flex'); +const hideDecorator = () => $('#decorator').css('display', 'flex').hide(); +const addDecoration = (e) => { + const button = $(e.currentTarget); + const newDecoration = { + id: 0, + decoration_room: Floorplan.currentRoom.id, + decoration_pos_x: Floorplan.visualScaleBasis / 2, + decoration_pos_y: Floorplan.visualScaleBasis / 2, + decoration_rotation: 0, + decoration_width: 200, + decoration_height: 200, + decoration_image: button.data('image') + }; + ajax('/ajax/addDecoration', newDecoration, 'post', decorationAdded, null, null); +}; +const decorationAdded = (decoration) => { + Floorplan.decorations.push(decoration); + createDecorationShape(decoration, true); + hideDecorator(); +}; +const deleteDecoration = () => ajax('/ajax/deleteDecoration', getDecorationDataById(Floorplan.selectedDecorationId), 'post', decorationDeleted, null, null); +const decorationDeleted = (deletedDecoration) => { + Floorplan.decorations = Floorplan.decorations.filter(decoration => decoration.id != deletedDecoration.id); + const decorationShape = Floorplan.stage.findOne(`#${deletedDecoration.id}`); + decorationShape.destroy(); + deselectTables(); +}; +const setRoomBackground = (roomToLoad) => { + const width = Floorplan.floorplanDiv.width(); + const height = Floorplan.floorplanDiv.height(); + Floorplan.floorplanDiv.css("background-image", `url(images/rooms/${roomToLoad.background_image})`); + Floorplan.floorplanDiv.css("background-size", `${width}px ${height}px`); +}; +const setupKonva = () => { + const dimensions = getDimensions(); + if (Floorplan.stage !== null) + Floorplan.stage.destroy(); + Floorplan.stage = new Konva.Stage({ + container: 'tableMap', + width: dimensions.width, + height: dimensions.height, + }); + Floorplan.stage.on('click', e => { + if (e.target == Floorplan.stage) { + deselectTables(); + } + }); + Floorplan.transformer = new Konva.Transformer({ + rotationSnaps: [0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 225, 270, -15, -30, -45, -60, -75, -90, -105, -120, -135, -150, -165, -180, -225, -270, 360, -360], + anchorSize: 30 * Floorplan.visualScale, + ignoreStroke: true, + centeredScaling: true, + anchorCornerRadius: 10, + }); + Floorplan.tableLayer = new Konva.Layer(); + Floorplan.tableLayer.add(Floorplan.transformer); + Floorplan.stage.add(Floorplan.tableLayer); +}; +const resetKonva = setupKonva; +const changeTableShape = () => { + if (!Floorplan.selectedTableNumber) + return; + const table = getTableDataFromTableNumber(Floorplan.selectedTableNumber); + const tableGroup = getTableGroupFromTableNumber(table.table_number); + const order = ['square', 'rect', 'longrect', 'diamond', 'circle', 'ellipse', 'longellipse']; + if (order.indexOf(table.shape) === -1) + table.shape = 'square'; + const currentIndex = order.indexOf(table.shape); + let nextIndex = currentIndex + 1; + if (nextIndex > (order.length) - 1) + nextIndex = 0; + table.shape = order[nextIndex]; + switch (table.shape) { + case 'square': + case 'circle': + // noinspection JSSuspiciousNameCombination + table.height = table.width; + table.rotation = 0; + break; + case 'diamond': + // noinspection JSSuspiciousNameCombination + table.height = table.width; + table.rotation = 45; + break; + case 'rect': + case 'ellipse': + table.height = table.width * 2; + table.rotation = 0; + break; + case 'longrect': + case 'longellipse': + table.rotation = 90; + break; } -} + saveTable(table); + deselectTables(); + redrawTable(tableGroup); +}; +const redrawTable = (tableGroup) => { + deselectTables(); + const draggable = tableGroup.draggable(); + const table = getTableDataFromGroup(tableGroup); + tableGroup.destroy(); + const newTableGroup = createTableShape(table); + const newTableShape = getTableShapeFromTableNumber(table.table_number); + selectTable(newTableShape); + newTableGroup.draggable(draggable); +}; +const showAddTablePopup = () => showVirtualNumpad(lang('new_table_number'), 4, false, false, true, addTable); +const addTable = (tableNumber) => { + const newTable = { + id: 0, + table_number: tableNumber, + room_id: Floorplan.currentRoom.id, + default_covers: 2, + width: 200, + height: 200, + rotation: 0, + pos_x: Floorplan.visualScaleBasis / 2, + pos_y: Floorplan.visualScaleBasis / 2, + shape: 'square', + merged_children: '', + previous_state: '', + status: 0, + venue_id: 1 + }; + ajax('/ajax/createTable', newTable, 'post', tableAdded, tableNotAdded, null); +}; +const tableAdded = (table) => { + deselectTables(); + const newTableGroup = createTableShape(table); + Floorplan.tables.push(table); + selectTable(getTableShapeFromGroup(newTableGroup)); +}; +const tableNotAdded = (response) => { + posAlert(response); +}; +const confirmDeleteTable = () => confirmation(lang('confirm_delete_table', Floorplan.selectedTableNumber.toString()), Floorplan.selectedTableNumber, 'Confirm', deleteTable); +const deleteTable = (tableNumber) => { + if (!tableNumber) + return false; + const tableToDelete = getTableDataFromTableNumber(tableNumber); + if (tableIsOpen(tableToDelete)) { + posAlert(lang('error_delete_existing_table')); + return false; + } + ajax(`/ajax/deleteTable`, tableToDelete, 'post', tableDeleted, null, null); +}; +const tableDeleted = (deletedTable) => { + Floorplan.tables = Floorplan.tables.filter(table => table.table_number != deletedTable.table_number); + const tableGroup = getTableGroupFromTableNumber(deletedTable.table_number); + deselectTables(); + tableGroup.destroy(); +}; +const toggleMergeMode = () => toggleMode('merge'); +const mergeTables = (table1, table2) => { + toggleMergeMode(); + if (table1.table_number == table2.table_number) { + posAlert(lang('error_self_merge')); + return false; + } + ajax('/ajax/mergeTables', [table1, table2], 'post', tablesMerged, null, null); +}; +const tablesMerged = (tables) => { + tableDeleted(tables['child']); + tableDeleted(tables['parent']); + tableAdded(tables['merged']); + deselectTables(); + const tableGroup = getTableGroupFromTableNumber(tables['merged'].table_number); + selectTable(getTableShapeFromGroup(tableGroup)); + tableGroup.draggable(true); +}; +const unmergeTable = () => ajax(`/ajax/unmergeTable/${Floorplan.selectedTableNumber}`, null, 'get', tablesUnmerged, null, null); +const tablesUnmerged = (tables) => { + const parentTable = tables['parent']; + const childTable = tables['child']; + tableDeleted(parentTable); + tableAdded(parentTable); + tableAdded(childTable); + deselectTables(); +}; +const toggleTransferMode = () => toggleMode('transfer'); +const transferTables = (origin, destination) => { + if (origin.table_number == destination.table_number) { + posAlert(lang('transfer_self_error')); + return; + } + ajax(`/ajax/transferTable/${origin.table_number}/${destination.table_number}`, null, 'get', tableTransferred, null, null); +}; +const tableTransferred = (tables) => { + const origin = tables['origin']; + const destination = tables['destination']; + Floorplan.activeTableNumbers = Floorplan.activeTableNumbers.filter(tableNumber => tableNumber != origin.table_number); + Floorplan.activeTableNumbers.push(destination.table_number); + if (Floorplan.currentRoom.id == origin.room_id) { + redrawTable(getTableGroupFromTableNumber(origin.table_number)); + } + redrawTable(getTableGroupFromTableNumber(destination.table_number)); +}; +const getDimensions = () => { + Floorplan.floorplanDiv = $('#tableMap'); + const parentDiv = $('#mapContainer'); + const outerWidth = parentDiv.outerWidth(); + const outerHeight = parentDiv.outerHeight(); + let width = outerWidth; + let height = outerWidth; + if (outerWidth >= outerHeight) { + width = outerHeight; + height = outerHeight; + } + Floorplan.floorplanDiv.height(height); + Floorplan.floorplanDiv.width(width); + Floorplan.visualScale = width / Floorplan.visualScaleBasis; + return { width: width, height: height }; +}; //# sourceMappingURL=dredgepos.floorplan.js.map \ No newline at end of file diff --git a/wwwroot/scripts/js/dredgepos.floorplan.js.map b/wwwroot/scripts/js/dredgepos.floorplan.js.map index 51005a1..b091686 100644 --- a/wwwroot/scripts/js/dredgepos.floorplan.js.map +++ b/wwwroot/scripts/js/dredgepos.floorplan.js.map @@ -1 +1 @@ -{"version":3,"file":"dredgepos.floorplan.js","sourceRoot":"","sources":["../ts/dredgepos.floorplan.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,IAAI,KAAmB,CAAA;AACvB,IAAI,WAA8B,CAAC;AACnC,IAAI,UAAuB,CAAC;AAC5B,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,YAAY,GAAc,EAAE,CAAC;AACjC,IAAI,aAAqB,CAAC;AAC1B,IAAI,mBAA4B,CAA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,WAAW,CAAA;KACvB;IAED,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACrC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACnC,SAAS,CAAC,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC,gBAAgB,CAAA;IAE1D,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAC,MAAM,EAAC,CAAA;AACxC,CAAC,CAAA"} \ No newline at end of file diff --git a/wwwroot/scripts/js/keyboards.js b/wwwroot/scripts/js/keyboards.js index c9f7cdc..d6b1b02 100644 --- a/wwwroot/scripts/js/keyboards.js +++ b/wwwroot/scripts/js/keyboards.js @@ -17,8 +17,8 @@ let showVirtualNumpad = (heading, maxlength = 4, isPassword, allowDecimals = tru numpad.data('submitfunction', submitFunction); numpad.data('password', isPassword); numpad.data('allowdecimals', allowDecimals); - $(document).unbind('keyup'); - $(document).keyup(e => { + $(document).off('keyup'); + $(document).on('keyup', e => { let key = e.key; switch (key) { case 'Backspace': @@ -52,7 +52,6 @@ let virtualNumpadInput = (input) => { let submitFunction = numpad.data('submitfunction'); let allowedValues = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'submit', 'clear']; let currentValue = numpad.data('value').toString(); - //Test if (allowDecimals) allowedValues.push('.', ','); let validInput = allowedValues.includes(input); @@ -91,11 +90,12 @@ let setupVirtualNumpad = () => { hideVirtualNumpad(); }); }; -let setupVirtualKeyboard = () => { +let setupVirtualKeyboard = (keyboardLayouts) => { Application.keyboard = { capsLock: false, shift: false, - layout: 'default' + layouts: keyboardLayouts, + currentLayout: 'default', }; $(document).on('click', '.virtualKeyboardButton', e => { virtualKeyboardInput($(e.target).data('value')); @@ -138,7 +138,7 @@ let virtualKeyboardInput = (input) => { case 'submit': hideVirtualKeyboard(); let submitFunction = keyboard.data('submitfunction'); - submitFunction(); + submitFunction(inputBox.text()); break; case 'shift': if (Application.keyboard.capsLock) @@ -174,16 +174,17 @@ let virtualKeyboardInput = (input) => { } }; let setKeyboardLayout = (layout, modifier = '') => { - let keyboardLayout = ajaxSync('/languages/english/keyboardLayout.json', null, 'get'); if (modifier != '') modifier = `_${modifier}`; + Application.keyboard.currentLayout = layout; + let layoutToLoad = Application.keyboard.layouts[layout]; $('.virtualKeyboardRow').each((index, row) => { /* We start at 1 instead of 0. Makes it easier for non-programmers and translators making their own language packs */ index = index + 1; - let currentRow = keyboardLayout[layout]["row" + index + modifier]; + let currentRow = layoutToLoad[`row${index}${modifier}`]; $(row).children('a').each((keyIndex, button) => { let key = $(button); let keyValue = currentRow[keyIndex]; @@ -211,6 +212,6 @@ let setKeyboardLayout = (layout, modifier = '') => { }; $(() => { setupVirtualNumpad(); - setupVirtualKeyboard(); + ajax('/ajax/getKeyboardLayout/english', null, 'get', setupVirtualKeyboard, null, null); }); //# sourceMappingURL=keyboards.js.map \ No newline at end of file diff --git a/wwwroot/scripts/js/keyboards.js.map b/wwwroot/scripts/js/keyboards.js.map index 2db3eeb..ecd7e1d 100644 --- a/wwwroot/scripts/js/keyboards.js.map +++ b/wwwroot/scripts/js/keyboards.js.map @@ -1 +1 @@ -{"version":3,"file":"keyboards.js","sourceRoot":"","sources":["../ts/keyboards.ts"],"names":[],"mappings":"AAAC,IAAI,iBAAiB,GAAG,CAAC,OAAe,EAAE,SAAS,GAAG,CAAC,EAAE,UAAmB,EAAE,aAAa,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,cAAwB,EAAE,EAAE;IAC5I,IAAI,MAAM,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACjC,IAAI,QAAQ,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAA;IACvC,IAAI,mBAAmB,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAA;IAE9C,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IAE7B,IAAI,eAAe,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,C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;YAED,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAEjB,0DAA0D;YAC1D,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;YAC/B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAE9B,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAEL,CAAC,CAAC,GAAG,EAAE;IACJ,kBAAkB,EAAE,CAAA;IACpB,IAAI,CAAC,iCAAiC,EAAE,IAAI,EAAE,KAAK,EAAC,oBAAoB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACxF,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/wwwroot/scripts/js/test.js b/wwwroot/scripts/js/test.js new file mode 100644 index 0000000..6f3fefb --- /dev/null +++ b/wwwroot/scripts/js/test.js @@ -0,0 +1 @@ +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/wwwroot/scripts/js/test.js.map b/wwwroot/scripts/js/test.js.map new file mode 100644 index 0000000..79b94d2 --- /dev/null +++ b/wwwroot/scripts/js/test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ts/test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/wwwroot/scripts/ts/dredgepos.core.ts b/wwwroot/scripts/ts/dredgepos.core.ts index 04fc556..73c8be3 100644 --- a/wwwroot/scripts/ts/dredgepos.core.ts +++ b/wwwroot/scripts/ts/dredgepos.core.ts @@ -1,13 +1,13 @@  let Application : ApplicationState = { keyboard : null, - mode: "default", + mode: [], languageVars: {} } /** Parses a language variable. */ let lang = (key: string, replacements?: string[] | string) => { - let finalValue = Application.languageVars[key] + let finalValue = Application.languageVars[key] || '' if(!replacements) return finalValue if(typeof replacements === 'string') replacements = [replacements] @@ -26,17 +26,20 @@ } /** Call an Ajax function asynchronously */ - let ajax = (endpoint : string, data: any, method = 'POST', successFunction : Function , errorFunction : JQuery.Ajax.ErrorCallback, beforeFunction: any) => { + let ajax = (endpoint : string, data: any, method = 'POST', successFunction : Function , errorFunction : Function, beforeFunction: any) => { data = (data == null) ? data : JSON.stringify(data) return $.ajax({ url: endpoint, method: method, data: data, - success: (response) => { - if(successFunction) + success: (response: ajaxResult) => { + if(successFunction && response.status == 'success') successFunction(JSON.parse(response.data)) + else if (errorFunction && response.status != 'success'){ + errorFunction(JSON.parse(response.data)) + } }, - error: errorFunction, + error: (error) => console.log(error.statusCode), beforeSend: beforeFunction }) } @@ -44,7 +47,7 @@ /* For the flow of the app, synchronous is commonly preferred - though trying to keep it's usage as low as possible. + though trying to keep its usage as low as possible. */ let ajaxSync = (endpoint : string, data?: any, method = 'POST') => { let response = JSON.parse( @@ -69,12 +72,17 @@ } - let setLanguageVariables = () => { - Application.languageVars = ajaxSync('/ajax/languageVars', null, 'GET') - } + let setupCore = (languageVars: Record) => { + Application.languageVars = languageVars + const doc = $(document) + doc.on('click', '#alertNo, #alertOk', hideAlerts) + + setElementVisibilityByMode() + } + // @ts-ignore - let alert = (message: string, title='Message') => { + let posAlert = (message: string, title='Message') => { let alertBox = $('#alert') alertBox.css('display', 'flex'); alertBox.data('value', ''); @@ -86,13 +94,12 @@ $('#alertNo').css('display', 'none'); } - // @ts-ignore - let confirm = (message: string, data: any, title='Confirm', submitFunction = (data: any) => {hideAlerts()}) => { + let confirmation = (message: string, data: any, title='Confirm', submitFunction = (data: any) => {hideAlerts()}) => { let alert = $('#alert') $(document).on('click', '#alert #alertYes', () => { - submitFunction(data) hideAlerts() + submitFunction(data) $(document).off('click', '#alert #alertYes') }) @@ -106,13 +113,69 @@ } - let hideAlerts = () => { - $('#alert').hide() - } + let hideAlerts = () => $('#alert').hide() -$( () => { - let doc = $(document) - setLanguageVariables() + let turnOnMode = (mode : PosMode) => { + Application.mode.push(mode) + setElementVisibilityByMode() + } - doc.on('click', '#alertNo, #alertOk', () => $('#alert').hide()) -}) \ No newline at end of file + let turnOffMode = (mode : PosMode) => { + Application.mode = Application.mode.filter((value) => value != mode) + setElementVisibilityByMode() + + } + + let toggleMode = (mode: PosMode) => { + if(!isInMode(mode)) + turnOnMode(mode) + else + turnOffMode(mode) + } + + let clearModes = () => {Application.mode = []} + let isInMode = (mode: PosMode) => Application.mode.includes(mode) + + let setElementVisibilityByMode = () => { + const mode = Application.mode + const elements = $('[data-visible-in-mode]') + + elements.each((index, elem) => { + let element = $(elem) + let visibleInModes : PosModes = element.data('visible-in-mode') + + let showElement = visibleInModes.every( visibleMode => { + return mode.includes(visibleMode) + }); + + if(element.hasClass('useVisibility')){ + if(showElement) { + element.css('visibility', 'visible') + } else element.css('visibility', 'hidden') + } else element.toggle(showElement) + }) + + const invisibleElements = $('[data-invisible-in-mode]') + invisibleElements.each((index, elem) => { + let element = $(elem) + let inVisibleInModes: PosModes = element.data('invisible-in-mode') + let hideElement = inVisibleInModes.every(invisibleMode => { + return mode.includes(invisibleMode) + }) + element.toggle(!hideElement) + }) + + + $('[data-active-in-mode]').each((index, elem) =>{ + const button = $(elem) + const activeInMode : PosMode = button.data('active-in-mode') + + mode.includes(activeInMode) + ? button.addClass('active') + : button.removeClass('active') + + }) + + } + +$( () => ajax('/ajax/languageVars', null, 'GET', setupCore, null, null)) \ No newline at end of file diff --git a/wwwroot/scripts/ts/dredgepos.floorplan.ts b/wwwroot/scripts/ts/dredgepos.floorplan.ts index 787e9c5..8ed9686 100644 --- a/wwwroot/scripts/ts/dredgepos.floorplan.ts +++ b/wwwroot/scripts/ts/dredgepos.floorplan.ts @@ -1,335 +1,163 @@ /// -let stage : Konva.Stage -let transformer: Konva.Transformer; -let tableLayer: Konva.Layer; -let editMode = false; -let activeTables : number[] = []; -let selectedTable : table; -let selectedTableNumber : number; -let currentRoom : number; -let basis = 1280; -let scale : number = 1; -let newTable : number; -let roomName : string; -//Makes sure canvas always fits inside the div -function getDimensions(parentDiv : JQuery) { - let tableMap = $('#tableMap') - let outerWidth = parentDiv.outerWidth(); - let outerHeight = parentDiv.outerHeight(); - - let width = outerWidth; - let height = outerWidth; - - if (outerWidth >= outerHeight) { - width = outerHeight; - height = outerHeight; - } - - tableMap.height(height) - tableMap.width(width) - scale = width / basis - - return {width: width, height:height} +interface dimensions{ + height:number + width:number } -function setupTableMap() { - let doc = $(document) - activeTables = ajaxSync('/ajax/getActiveTables/1', null, 'GET'); +interface floorplan{ + stage: Konva.Stage + transformer: Konva.Transformer + tableLayer: Konva.Layer + rooms: room[] + tables: table[] + decorations: decoration[] + activeTableNumbers: number[] + selectedTableNumber: number + selectedDecorationId: number + currentRoom: room + roomToLoad: room + visualScale: number + visualScaleBasis: number + floorplanDiv: JQuery + reservations: reservation[] +} - let dimensions = getDimensions($('#mapContainer')); - roomName = 'Deck & Courtyard'; - stage = new Konva.Stage({ - container: 'tableMap', - width: dimensions.width, - height: dimensions.height, - }); +interface floorplan_data{ + tables: table[] + decorations: decoration[] + activeTableNumbers: number[] + rooms: room[] + reservations:reservation[] +} - $('body').on('click', '.editModeButton', () => {toggleEditMode()} ) - $('.roomButton').on('click', function () { - roomName = $(this).text(); - loadRoom($(this).data('value')); - }); - $('.transferTableButton').on('click', function () { - transferModeOn(); - }); - $('.addDecoration').on('click', function () { - $('#decorator').css('display', 'flex'); - }); - $('.deleteDecoration').on('click', function () { - deleteDecoration(selectedDecoration); - }); - $('.decoratorItem').on('click', function () { - addDecoration(this); - }); - $('.changeShapeButton').on('click', function () { - changeTableShape(selectedTableNumber); - }); - $('.reserveTableButton').on('click', function () { - if ($(this).text() === lang('reserve_table')) { - reserveTable(); +const Floorplan: floorplan = { + rooms: [], + tables: [], + decorations:[], + reservations:[], + activeTableNumbers: [], + stage: null, + transformer:null, + tableLayer: null, + selectedTableNumber: 0, + currentRoom: null, + roomToLoad: null, + visualScale: 1, + visualScaleBasis: 1280, + floorplanDiv: null, + selectedDecorationId: 0 +}; + +$(() => ajax('/ajax/getFloorplanData/1', null, 'get', setupFloorplan, null, null) ) + + +const setupFloorplanEvents = () => { + const doc = $(document) + doc.on('click', '.roomButton', roomButtonClicked) + doc.on('click', '.editModeButton', editModeButtonClicked) + doc.on('click', '.changeShapeButton', changeTableShape) + doc.on('click', '.addTableButton', showAddTablePopup) + doc.on('click', '.deleteTableButton', confirmDeleteTable) + doc.on('click', '.addDecoration', showDecorator) + doc.on('click', '.deleteDecoration', deleteDecoration) + doc.on('click', '.decoratorItem', addDecoration) + doc.on('click', '.mergeButton', toggleMergeMode) + doc.on('click', '.unmergeButton', unmergeTable) + doc.on('click', '.transferTableButton', toggleTransferMode) + doc.on('click', '.reserveTableButton', reserveTable) + doc.on('click', '.unreserveTableButton', unreserveTable) +} + +const roomButtonClicked = (e: Event) => { + const button = $(e.target) + const roomId = button.data('value') + loadRoom(getRoomById(roomId)) +} + +const editModeButtonClicked = (e: Event) => { + const button = $(e.target) + button.toggleClass('active') + toggleMode('edit') + + if(isInMode('edit')){ + Floorplan.stage.find('Group, Image').forEach(table => table.draggable(true)) + + if(isInMode('tableSelected')){ + const selectedTableShape = getTableShapeFromTableNumber(Floorplan.selectedTableNumber) + selectTable(selectedTableShape) } - else { - unreserveTable(); - } - }); - $('.addTableButton').on('click', function () { - addTable(); - }); - $('.deleteTableButton').on('click', function () { - deleteTable(); - }); - loadRoom(roomToLoad); -} - -let updateTableShape = (tableData) => { - return ajaxSync('/ajax/updateTableShape', tableData) -} - -//Change the shape of a table in edit mode. -function changeTableShape(tableNumber: number) { - let tableData = getTableData(tableNumber) - let tableShape = tableData['shape'] - let tableWidth = tableData['width'] - let tableHeight = tableData['height'] - let tableRotation = tableData['rotation'] - - let order = ['square', 'rect', 'longrect', 'diamond', 'circle', 'ellipse', 'longellipse'] - - if (order.indexOf(tableShape) === -1) tableShape = 'square' - - //What the next shape is - let currentIndex = order.indexOf(tableShape) - let nextIndex = currentIndex + 1 - if (nextIndex > (order.length) - 1) nextIndex = 0 - - let nextShape = order[nextIndex] - - switch(nextShape) { - case 'square': - case 'circle': - tableHeight = tableWidth - tableRotation = 0 - break - case 'diamond': - tableHeight = tableWidth - tableRotation = 45 - break - case 'rect': - case 'ellipse': - tableHeight = tableWidth * 2 - tableRotation = 0 - break - case 'longrect': - case 'longellipse': - tableRotation = 90 - break - } - - let updateData = { - table_number: tableNumber, - shape: nextShape, - height: tableHeight, - width: tableWidth, - rotation: tableRotation - } - - tableData = updateTableShape(updateData) - let tableGroup = stage.find('#' + tableNumber)[0] - transformer.nodes([]); - tableGroup.destroy(); - - let newTable = createTableElement(tableData); - tableLayer.add(newTable); - stage.draw(); - - selectTable(tableNumber); - loadRoom(currentRoom, tableNumber); -} - -let createTable = (tableData) => { - return ajaxSync('/ajax/createTable', tableData) -} - -let tableExists = (tableNumber : number) => { - return ajaxSync(`/ajax/tableExists/${tableNumber}`) -} - -function addTable(tableNumber : number) { - if (!tableNumber) { - showVirtualNumpad(lang('new_table_number'), 4, false, false, true, addTable); - } - else { - let newTableInfo = { - table_number: tableNumber, - room_id: currentRoom, - default_covers: 2, - width: 200, - height: 200, - rotation: 0, - pos_x: basis / 2, - pos_y: basis / 2, - shape: 'square', - merged_children : '', - previous_state: '', - status: 0, - reservation: 0, - venue_id: 1 - }; - - let newTableData = createTable(newTableInfo) - - if (!newTableData.table_number){ - alert(newTableData) - return false - } - - newTable = createTableElement(newTableData); - tableLayer.add(newTable); - tableLayer.draw(); - selectTable(tableNumber); - + } else { + setTransformerNodes([]) + Floorplan.stage.find('Group, Image').forEach(table => table.draggable(false)) } } -function selectTable(tableNumber: number) { - let table = stage.find('#' + tableNumber)[0]; - table.fire('click'); + +const setupFloorplan = (floorplanData : floorplan_data) => { + + Floorplan.tables = floorplanData.tables + Floorplan.activeTableNumbers = floorplanData.activeTableNumbers + Floorplan.rooms = floorplanData.rooms + Floorplan.decorations = floorplanData.decorations + Floorplan.reservations = floorplanData.reservations + + getDimensions() + setupFloorplanEvents() + + loadRoom(Floorplan.rooms[0]) } -function deleteTable(tableNumber = 0) { - if (!tableNumber) { - confirm(lang('confirm_delete_table', selectedTableNumber), selectedTableNumber, 'Confirm', deleteTable); - } - else { - if (tableIsOpen(selectedTableNumber)) { - alert(lang('error_delete_existing_table')); - } - else { - ajax(`/ajax/deleteTable/${selectedTableNumber}`, null, 'GET'); - let table = stage.find('#' + tableNumber)[0]; - transformer.nodes([]); - table.destroy(); - tableLayer.draw(); - selectedTable = null - selectedTableNumber = null - } - } -} -// Rotate a shape around any point. -// shape is a Konva shape -// angleDegrees is the angle to rotate by, in degrees. -// point is an object {x: posX, y: posY} -function rotateAroundPoint(shape, angleDegrees, point) { - let angleRadians = angleDegrees * Math.PI / 180; - // they lied, I did have to use trigonometry - const x = point.x + - (shape.x() - point.x) * Math.cos(angleRadians) - - (shape.y() - point.y) * Math.sin(angleRadians); - const y = point.y + - (shape.x() - point.x) * Math.sin(angleRadians) + - (shape.y() - point.y) * Math.cos(angleRadians); - shape.rotation(shape.rotation() + angleDegrees); // rotate the shape in place - shape.x(x); // move the rotated shape in relation to the rotation point. - shape.y(y); +const loadRoom = (roomToLoad: room) => { + setRoomBackground(roomToLoad) + setupKonva() + + const tablesInRoom = Floorplan.tables.filter(table => table.room_id == roomToLoad.id) + const decorationsInRoom = Floorplan.decorations.filter(decoration => decoration.decoration_room == roomToLoad.id) + decorationsInRoom.forEach(decoration => createDecorationShape(decoration, false)) + tablesInRoom.forEach(createTableShape) + + Floorplan.currentRoom = roomToLoad } -function createDecoration(data, idToSelect = false) { - let draggable = editMode; - var decoration = new Image(); - decoration.onload = function () { - var dec = new Konva.Image({ - id: data.decoration_id.toString(), - x: data.decoration_pos_x * scale, - y: data.decoration_pos_y * scale, - image: decoration, - offsetX: data.decoration_width * 0.5 * scale, - offsetY: data.decoration_height * 0.5 * scale, - rotation: data.decoration_rotation, - width: data.decoration_width * scale, - height: data.decoration_height * scale, - draggable: draggable, - }); - - if (editMode && dec.id() === idToSelect) { - transformer.nodes([dec]); - transformer.moveToTop(); - } - - - dec.on('click', function () { - selectDecoration(this); - }); - dec.on('tap', function () { - selectDecoration(this); - }); - dec.on('dragend', function () { - saveDecTransformation(this); - }); - - dec.on('transformend', function () { - saveDecTransformation(this); - }); - // add the shape to the layer - tableLayer.add(dec); - tableLayer.draw(); - dec.moveToBottom(); - }; - decoration.src = 'images/decorations/' + data.decoration_image; - return decoration; +const getRoomById = (roomId: number) => { + return Floorplan.rooms.find( + (room) => room.id == roomId + ) } -var selectedDecoration = false; -function selectDecoration(decoration) { - if (editMode) { - if ((transformer.nodes().length > 0 && transformer.nodes()[0] != decoration) || transformer.nodes().length == 0) { - resetActiveTable(); - transformer.nodes([decoration]); - decoration.moveToTop(); - transformer.moveToTop(); - selectedDecoration = decoration; - toggleFloorplanControls(); - } - else { - transformer.nodes([]); - selectedDecoration = false; - $('.deleteDecoration').css('display', 'none'); - } - } -} -function createTableElement(data, selectTable = false) { - // Create container group +const tableIsOpen = (table: table) => Floorplan.activeTableNumbers.includes(table.table_number) - let draggable = editMode || newTable === data.table_number; +const createTableShape = (table: table) => { + const draggable = isInMode('edit') - let table = new Konva.Group({ - x: data.pos_x * scale, - y: data.pos_y * scale, + const tableGroup = new Konva.Group({ + x: table.pos_x * Floorplan.visualScale, + y: table.pos_y * Floorplan.visualScale, draggable: draggable, listening: true, - id: data.table_number.toString() + id: table.table_number.toString() }); - let fillColor = 'gray'; - if (data.status === 'reserved') { - fillColor = 'lightgreen'; - } - if (activeTables.includes(data.table_number)) { - fillColor = 'lightblue'; - } - data.width = data.width * scale; - data.height = data.height * scale; - // Create background shape - let shape; - switch (data.shape) { + + const fillColor = tableIsOpen(table) + ? 'lightblue' + : table.status == 2 + ? 'lightgreen' + : 'gray' + + + let tableShape: Konva.Shape + + switch(table.shape){ case "circle": // fall-through case "ellipse": // fall-through case "longellipse": - shape = new Konva.Ellipse({ + tableShape = new Konva.Ellipse({ x: 0, y: 0, - radiusX: data.width * 0.5, - radiusY: data.height * 0.5, - rotation: data.rotation, + radiusX: table.width * 0.5 * Floorplan.visualScale, + radiusY: table.height * 0.5 * Floorplan.visualScale, + rotation: table.rotation, fill: fillColor, stroke: "black", strokeWidth: 4, @@ -338,14 +166,14 @@ function createTableElement(data, selectTable = false) { }); break; default: - shape = new Konva.Rect({ + tableShape = new Konva.Rect({ x: 0, y: 0, - offsetX: data.width * 0.5, - offsetY: data.height * 0.5, - width: data.width, - height: data.height, - rotation: data.rotation, + offsetX: table.width * 0.5 * Floorplan.visualScale, + offsetY: table.height * 0.5 * Floorplan.visualScale, + width: table.width * Floorplan.visualScale, + height: table.height * Floorplan.visualScale, + rotation: table.rotation, fill: fillColor, stroke: "black", strokeWidth: 4, @@ -353,497 +181,643 @@ function createTableElement(data, selectTable = false) { listening: true }); break; - } // End switch - // Create label - let label = new Konva.Text({ - x: data.width * -0.5, - y: data.height * -0.5, - width: data.width, - height: data.height, - text: data.table_number.toString(), - fontSize: 40 * scale, + } + + const label = new Konva.Text({ + x: table.width * -0.5 * Floorplan.visualScale, + y: table.height * -0.5 * Floorplan.visualScale, + width: table.width * Floorplan.visualScale, + height: table.height * Floorplan.visualScale, + text: table.table_number.toString(), + fontSize: 40 * Floorplan.visualScale, fill: "black", align: "center", verticalAlign: "middle", draggable: false, listening: false }); - tableNumber = data.tablenumber; - table.add(shape, label); - table.on('dblclick', function () { - tableNumber = parseInt(getTableNumber(this)); - if (!editMode) { - loadScreen('orderScreen', 'table=' + tableNumber); - } - }); - table.on('dbltap', function () { - tableNumber = getTableNumber(this); - loadScreen('orderScreen', 'table=' + tableNumber); - }); - table.on('dragend', function () { - saveTransformation(table); - }); - innerShape = getTableShape(table); - table.on('click', function () { - selectTableShape(this); - }); - table.on('tap', function () { - selectTableShape(this); - }); - innerShape.on('transformend', function () { - saveTransformation(table); - }); - // add the shape to the layer - tableLayer.add(table); - table.moveToTop(); - if (tableNumber === selectedTableNumber) { - selectTable = table; - } - if (selectTable) { - if (selectTable === tableNumber) { - table.fire('click'); - } - } - return table; + + tableGroup.add(tableShape, label) + + setupTableEvents(tableGroup) + + Floorplan.tableLayer.add(tableGroup) + return tableGroup } -function loadRoom(room: number, selectTable : number = 0, selectDecoration = false) { - //if (room === currentRoom) return false - ajax(`/ajax/getRoomData/${room}`, null, 'GET', (response) => { - let floorplanDiv = $('#tableMap') - let backgroundImage = response.background_image - floorplanDiv.css("background-image", `url(images/rooms/${backgroundImage})`) - floorplanDiv.css("background-size", `${width}px ${height}px`) - }, null, null) +const setupTableEvents = (tableGroup: Konva.Group) => { + const tableShape = getTableShapeFromGroup(tableGroup) - $('.roomButton').removeClass('active'); - let selector = ".roomButton:contains('" + roomName + "')"; - $(selector).addClass('active'); - currentRoom = room; - resetActiveTable(); - stage.destroy(); - stage = new Konva.Stage({ + tableGroup.on('click', (e) => tableClicked(e.target as Konva.Shape)) + tableGroup.on('tap', (e) => tableClicked(e.target as Konva.Shape)) + tableGroup.on('dragend', (e) => saveTableTransformation(e.target as Konva.Group)) + tableShape.on('transformend', (e) => { + const group = getTableGroupFromShape(e.target as Konva.Shape) + saveTableTransformation(group) + }) +} + +const getTableShapeFromGroup = (group: Konva.Group) => group.getChildren()[0] as Konva.Shape +const getTableGroupFromShape = (shape: Konva.Shape) => shape.parent as Konva.Group + +const saveTableTransformation = (tableGroup: Konva.Group) => { + const originalTable = getTableDataFromGroup(tableGroup) + const tableShape = getTableShapeFromGroup(tableGroup) + + const newTableInfo : table = { + table_number : originalTable.table_number, + previous_state : originalTable.previous_state, + merged_children : originalTable.merged_children, + id : originalTable.id, + width : Math.round(tableShape.scaleX() * tableShape.width()/Floorplan.visualScale), + height: Math.round(tableShape.scaleY() * tableShape.height()/Floorplan.visualScale), + pos_x: Math.round(tableGroup.x()/Floorplan.visualScale), + pos_y: Math.round(tableGroup.y()/Floorplan.visualScale), + rotation: Math.round(tableShape.rotation()), + room_id: originalTable.room_id, + status: originalTable.status, + venue_id: originalTable.venue_id, + shape : originalTable.shape, + default_covers: originalTable.default_covers, + } + + saveTable(newTableInfo) + redrawTable(tableGroup) +} + + +const saveTable = (tableToUpdate: table) => { + const tables = + Floorplan + .tables + .filter(table => { + return table.id != tableToUpdate.id + }) + + tables.push(tableToUpdate) + + Floorplan.tables = tables + ajax("/ajax/transformTable", tableToUpdate, 'post', null,null,null) +} + +const setTransformerNodes = (nodes: Konva.Shape[]) => { + Floorplan.transformer.moveToTop() + if (nodes.length < 1) Floorplan.transformer.moveToBottom() + Floorplan.transformer.nodes(nodes) +} + +const getTableDataFromTableNumber = (tableNumber: number) => { + return Floorplan.tables.filter(table => table.table_number == tableNumber)[0] +} + +const getTableDataFromGroup = (tableGroup: Konva.Node) => { + const tableNumber = tableGroup.attrs.id + return Floorplan.tables.find(table => tableNumber == table.table_number) +} + +const getTableDataFromShape = (tableShape: Konva.Shape) => getTableDataFromGroup(tableShape.parent) + +const getTableShapeFromTableNumber = (tableNumber: number) => { + const tableGroup = Floorplan.stage.find('Group').find((group: Konva.Shape) => { + return group.attrs.id == tableNumber + }) as Konva.Group + + return tableGroup.getChildren()[0] as Konva.Shape +} + +const getTableGroupFromTableNumber = (tableNumber : number) => { + const tableShape = getTableShapeFromTableNumber(tableNumber) + return getTableGroupFromShape(tableShape) +} + +const setReservationStatus = (table: table) => { + const reservationText = $('.reservationStatus') + const tableShape = getTableShapeFromTableNumber(table.table_number) + reservationText.text('') + + if(table.status == 2) { + tableShape.fill('lightgreen') + const reservations = Floorplan.reservations.filter(reservation => reservation.reservation_table_id == table.id) + if (reservations.length) { + turnOnMode('reservedTableSelected') + reservationText.text(lang('reserved')) + let reservation = reservations[0] + if (reservation.reservation_name != '') { + reservationText.text(lang('reserved_for', reservation.reservation_name)) + } + } + } else { + let fillColor = tableIsOpen(table) ? 'lightblue' : 'gray' + tableShape.fill(fillColor) + turnOffMode('reservedTableSelected') + } + +} + +const reserveTable = () => { + showVirtualNumpad(lang('how_many_covers'), 2, false, false, true, createEmptyReservation) +} + +const createEmptyReservation = (covers: number) => { + const newReservation: reservation = { + id: 0, + reservation_covers: covers, + reservation_created_at: 0, + reservation_table_id: getSelectedTableData().id, + reservation_name: '', + reservation_time: 0, + } + + ajax('/ajax/newEmptyReservation', newReservation,'post', emptyReservationCreated, null, null ) +} + +const emptyReservationCreated = (reservation: reservation) => { + Floorplan.reservations.push(reservation) + const selectedTable = getSelectedTableData() + selectedTable.status = 2 + selectedTable.default_covers = reservation.reservation_covers + updateTableData(selectedTable) + updateCoverText(selectedTable) + setReservationStatus(getSelectedTableData()) + + showVirtualKeyboard(lang('confirm_reservation_name'), 32, false, addReservationName) +} + +const addReservationName = (name: string) => { + hideVirtualKeyboard() + const reservation = Floorplan.reservations.filter(reservation => reservation.reservation_table_id == getSelectedTableData().id)[0] + reservation.reservation_name = name + ajax('/ajax/updateReservation', reservation, 'post', reservationNameAdded, null, null) +} + +const reservationNameAdded = (updatedReservation: reservation) => { + console.log(updatedReservation) + Floorplan.reservations = Floorplan.reservations.filter(reservation => reservation.id != updatedReservation.id) + Floorplan.reservations.push(updatedReservation) + setReservationStatus(getSelectedTableData()) +} + +const getReservationsOnTable = (table: table) => Floorplan.reservations.filter(reservation => reservation.reservation_table_id == table.id) + +const updateTableData = (tableToRemove: table) => { + Floorplan.tables = Floorplan.tables.filter(table => table.id != tableToRemove.id) + Floorplan.tables.push(tableToRemove) +} + +const unreserveTable = () => { + const selectedTable = getSelectedTableData() + selectedTable.status = 0 + ajax('/ajax/unreserveTable', selectedTable, 'post', tableUnreserved, null, null) +} + +const tableUnreserved = (table: table) => { + Floorplan.reservations = Floorplan.reservations.filter(reservation => reservation.reservation_table_id != table.id) + updateTableData(table) + setReservationStatus(table) +} + +const getSelectedTableData = () => getTableDataFromTableNumber(Floorplan.selectedTableNumber) + +const deselectTables = () => { + Floorplan.stage.find('Rect, Ellipse').forEach( (shape: Konva.Shape, index) => { + shape.stroke('black') + }); + + Floorplan.selectedDecorationId = 0 + Floorplan.selectedTableNumber = 0 + turnOffMode('tableSelected') + turnOffMode('activeTableSelected') + turnOffMode('decorationSelected') + turnOffMode('merge') + turnOffMode('transfer') + + setTransformerNodes([]) +} + +const selectTable = (tableShape: Konva.Shape) => { + tableShape.stroke('yellow') + const table = getTableDataFromShape(tableShape) + Floorplan.selectedTableNumber = table.table_number + + if(isInMode('edit')){ + setTransformerNodes([tableShape]) + } + + if(tableIsOpen(table)){ + turnOnMode('activeTableSelected') + } + + $('.reservationStatus').html(''+lang('active_table', table.table_number.toString()+'')) + + + updateCoverText(table) + $('.selectedTableNumber').text(lang('active_table', table.table_number.toString())) + setReservationStatus(table) + + const unmergeVisibility = table.merged_children ? 'visible' : 'hidden' + $('.unmergeButton').css('visibility', unmergeVisibility) + turnOnMode('tableSelected') +} + +const updateCoverText = (table:table) => $('.selectedTableCovers').text(lang('covers', table.default_covers.toString())) + +const tableClicked = (tableShape: Konva.Shape) => { + const table = getTableDataFromShape(tableShape) + + if(isInMode('merge')) { + mergeTables(getTableDataFromTableNumber(Floorplan.selectedTableNumber), table) + return; + } + + if(isInMode('transfer')){ + transferTables(getTableDataFromTableNumber(Floorplan.selectedTableNumber), table) + } + + const selectedTableNumber = Floorplan.selectedTableNumber + deselectTables() + + if(selectedTableNumber != table.table_number){ + selectTable(tableShape) + } + +} + +const createDecorationShape = (decoration:decoration, select?: boolean) => { + const draggable = isInMode('edit') + const decorationShape = new Image() + + decorationShape.onload = () => { + const decorationImage = new Konva.Image({ + id: decoration.id.toString(), + x: decoration.decoration_pos_x * Floorplan.visualScale, + y: decoration.decoration_pos_y * Floorplan.visualScale, + image: decorationShape, + offsetX: decoration.decoration_width * 0.5 * Floorplan.visualScale, + offsetY: decoration.decoration_height * 0.5 * Floorplan.visualScale, + rotation: decoration.decoration_rotation, + width: decoration.decoration_width * Floorplan.visualScale, + height: decoration.decoration_height * Floorplan.visualScale, + draggable: draggable, + }); + + // add the shape to the layer + Floorplan.tableLayer.add(decorationImage) + Floorplan.tableLayer.draw() + decorationImage.moveToBottom() + + setupDecorationEvents(decorationImage) + + if(select){ + decorationImage.moveToTop() + selectDecorationShape(decorationImage) + } + } + + decorationShape.src = 'images/decorations/' + decoration.decoration_image +} + +const setupDecorationEvents = (decorationShape: Konva.Image) => { + decorationShape.on('click', e => { + decorationClicked(e.target as Konva.Image) + }) + + decorationShape.on('transformend', e => { + decorationTransformed(e.target as Konva.Image) + }) + + decorationShape.on('dragend', e => { + decorationTransformed(e.target as Konva.Image) + }) +} + +const decorationClicked = (decorationShape: Konva.Image) => { + if(isInMode('edit')){ + turnOffMode('tableSelected') + if ((Floorplan.transformer.nodes().length > 0 && Floorplan.transformer.nodes()[0] != decorationShape) || Floorplan.transformer.nodes().length == 0) { + selectDecorationShape(decorationShape) + } else { + deselectTables() + decorationShape.moveToBottom() + } + } +} + +const selectDecorationShape = (decorationShape: Konva.Image) => { + deselectTables() + Floorplan.transformer.nodes([decorationShape]) + Floorplan.selectedDecorationId = Number(decorationShape.id()) + decorationShape.moveToTop() + Floorplan.transformer.moveToTop() + turnOnMode('decorationSelected') +} + +const getDecorationDataById = (id: number) => { + return Floorplan.decorations.find(decoration => id == decoration.id) +} + +const decorationTransformed = (decorationShape: Konva.Image) => { + + const oldDecorationData = getDecorationDataById(Number(decorationShape.id())) + const newDecoration: decoration = { + id: oldDecorationData.id, + decoration_room: oldDecorationData.decoration_room, + decoration_pos_x: Math.round(decorationShape.x() / Floorplan.visualScale), + decoration_pos_y: Math.round(decorationShape.y() / Floorplan.visualScale), + decoration_rotation: Math.round(decorationShape.rotation()), + decoration_width: Math.round((decorationShape.scaleX() * decorationShape.width()) / Floorplan.visualScale), + decoration_height: Math.round((decorationShape.scaleY() * decorationShape.height()) / Floorplan.visualScale), + decoration_image: oldDecorationData.decoration_image, + } + + saveDecoration(newDecoration) +} + +const saveDecoration = (decorationToUpdate: decoration) => { + const decorations = + Floorplan + .decorations + .filter(decoration => { + return decoration.id != decorationToUpdate.id + }) + + decorations.push(decorationToUpdate) + + Floorplan.decorations = decorations + ajax("/ajax/updateDecoration", decorationToUpdate, 'post', null,null,null) +} + +const showDecorator = () => $('#decorator').css('display', 'flex') +const hideDecorator = () => $('#decorator').css('display', 'flex').hide() + +const addDecoration = (e: Event) => { + const button = $(e.currentTarget) + + const newDecoration: decoration = { + id: 0, + decoration_room: Floorplan.currentRoom.id, + decoration_pos_x: Floorplan.visualScaleBasis / 2, + decoration_pos_y: Floorplan.visualScaleBasis / 2, + decoration_rotation: 0, + decoration_width: 200, + decoration_height: 200, + decoration_image: button.data('image') + } + + ajax('/ajax/addDecoration', newDecoration, 'post', decorationAdded, null, null) +} + +const decorationAdded = (decoration: decoration) => { + Floorplan.decorations.push(decoration) + createDecorationShape(decoration, true) + + hideDecorator() +} + + +const deleteDecoration = () => ajax( + '/ajax/deleteDecoration', + getDecorationDataById(Floorplan.selectedDecorationId), + 'post', decorationDeleted, null, null) + +const decorationDeleted = (deletedDecoration:decoration) => { + Floorplan.decorations = Floorplan.decorations.filter(decoration => decoration.id != deletedDecoration.id) + const decorationShape = Floorplan.stage.findOne(`#${deletedDecoration.id}`) + decorationShape.destroy() + deselectTables() +} + +const setRoomBackground = (roomToLoad: room) => { + const width = Floorplan.floorplanDiv.width() + const height = Floorplan.floorplanDiv.height() + + Floorplan.floorplanDiv.css("background-image", `url(images/rooms/${roomToLoad.background_image})`) + Floorplan.floorplanDiv.css("background-size", `${width}px ${height}px`) +} + +const setupKonva = () => { + const dimensions = getDimensions() + + if(Floorplan.stage !== null) Floorplan.stage.destroy() + + Floorplan.stage = new Konva.Stage({ container: 'tableMap', - width: width, - height: height, - }); + width: dimensions.width, + height: dimensions.height, + }) - transformer = new Konva.Transformer({ + Floorplan.stage.on('click', e => { + if(e.target == Floorplan.stage){ + deselectTables() + } + }) + + Floorplan.transformer = new Konva.Transformer({ rotationSnaps: [0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 225, 270, -15, -30, -45, -60, -75, -90, -105, -120, -135, -150, -165, -180, -225, -270, 360, -360], - anchorSize: 40 * scale, + anchorSize: 30 * Floorplan.visualScale, ignoreStroke: true, - centeredScaling: true + centeredScaling: true, + anchorCornerRadius: 10, }); - let tablesAndDecorations = ajaxSync(`/ajax/getTablesAndDecorations/${room}`, null, 'GET'); - let decorations = tablesAndDecorations['decorations'] - let tables = tablesAndDecorations['tables'] + Floorplan.tableLayer = new Konva.Layer() + Floorplan.tableLayer.add(Floorplan.transformer) - - tableLayer = new Konva.Layer(); - tableLayer.add(transformer); - - // Loop data and call the creation method for each decoration/table. - decorations.forEach(itemData => { - createDecoration(itemData, selectDecoration); - }); - - tables.forEach(itemData => { - tableLayer.add(createTableElement(itemData, selectTable)); - }); - activeTables = getOpenTables() - stage.add(tableLayer); + Floorplan.stage.add(Floorplan.tableLayer) } -var mergeMode = false; -var parentMergeTable; -var childMergeTable; -var tableTransferOrigin; -var transferMode = false; -function transferModeOn() { - mergeModeOff(); - if (!transferMode) { - tableTransferOrigin = selectedTableNumber; - transferMode = true; - $('.transferTableButton').addClass('active'); - $('.transferTableButton').text('Select a table to transfer items to'); - } - else { - transferModeOff(); - } -} -function transferModeOff() { - transferMode = false; - $('.transferTableButton').removeClass('active'); - $('.transferTableButton').text(lang('transfer_table')); -} +const resetKonva = setupKonva -let getOpenTables = () => { - return ajaxSync('/ajax/getActiveTables/1', null, 'GET'); -} +const changeTableShape = () => { -let transferTableAjax = (origin, destination) => { - ajax(`/ajax/transferTables/${origin}/${destination}`, null, 'GET') -} + if(!Floorplan.selectedTableNumber) return -function transferTables() { - destination = selectedTableNumber; - origin = tableTransferOrigin; - if (destination !== origin) { - transferTableAjax(origin, destination) - activeTables = getOpenTables() - transferModeOff(); - getTableShape(selectedTable).fill('lightblue') - getTableShape( getTableGroup(origin) ).fill('gray') - } - else { - alert("Can't transfer a table to itself."); - transferModeOff(); - } -} -function mergeModeOn() { - transferModeOff(); - if (!mergeMode) { - mergeMode = true; - $('.mergeButton').addClass('active'); - $('.mergeButton').text('Select a table to merge with Table ' + selectedTableNumber); - parentMergeTable = selectedTableNumber; - } - else { - mergeModeOff(); - } -} -function mergeModeOff() { - mergeMode = false; - $('.mergeButton').removeClass('active'); - $('.mergeButton').text(lang('merge_table')); -} + const table = getTableDataFromTableNumber(Floorplan.selectedTableNumber) + const tableGroup = getTableGroupFromTableNumber(table.table_number) -let ajaxMergeTables = (parent, child) => { - return ajaxSync(`/ajax/mergeTables/${parent}/${child}`, null, 'GET') -} + const order = ['square', 'rect', 'longrect', 'diamond', 'circle', 'ellipse', 'longellipse'] + if (order.indexOf(table.shape) === -1) + table.shape = 'square' -let ajaxUnmergeTable = (parent) => { - return ajaxSync(`/ajax/unmergeTable/${parent}`, null, 'GET') -} + const currentIndex = order.indexOf(table.shape) + let nextIndex = currentIndex + 1 + if (nextIndex > (order.length) - 1) + nextIndex = 0 -function mergeTables() { - parentMergeTable = parseInt(parentMergeTable); - childMergeTable = parseInt(childMergeTable); - if (childMergeTable !== parentMergeTable) { - let result = ajaxMergeTables(parentMergeTable, childMergeTable) - mergeModeOff(); + table.shape = order[nextIndex] - loadRoom(currentRoom) - newTable = getTableGroup(parentMergeTable); - newTable.draggable(true); - - if (tableIsOpen(parentMergeTable)) { - getTableShape(newTable).fill('lightblue'); - } - } - else { - alert("Can't merge a table with itself!"); - mergeModeOff(); - } -} -//When a table is passed (a group of the shape plus the text), returns the number as string. -function getTableNumber(tableGroup) { - textItem = tableGroup.getChildren()[1]; - return textItem.getText(); -} -function getTableGroup(tableNumber) { - return stage.find('#' + tableNumber)[0]; -} -function getTableShape(tableGroup) { - return tableGroup.getChildren()[0]; -} - -function getReservation(id) { - return ajaxSync('/ajax/getReservation', id) -} - -//When a user selects a table. -function selectTableShape(table) { - let tableNumber = getTableNumber(table); - let shape = getTableShape(table); - let strokeColor = shape.stroke(); - selectedTable = table; - selectedTableNumber = tableNumber; - if(transferMode) transferTables() - if (mergeMode) { - childMergeTable = tableNumber; - mergeTables(); - } - else { - //If table is not selected - if (strokeColor !== "yellow") { - let tableData = getTableData(selectedTableNumber) - - let coverNumberString = lang('covers', tableData.default_covers.toString()); - let tableString = '' + lang('activeTable', selectedTableNumber.toString()) + ''; - $('.reserveTableButton').text(lang('reserve_table')); - if (tableData.status === 'reserved') { - let reservation = getReservation(tableData.reservation_id) - console.log(reservation) - $('.reserveTableButton').text(lang('unreserve_table')); - if (reservation.reservation_name) { - reservationString = lang('reserved_for', reservation.reservation_name); - } - else { - reservationString = lang('reserved'); - } - tableString += '' + reservationString + ''; - } - tableString += " (" + coverNumberString + ")"; - $('.currentTable').html(tableString); - - stage.find('Rect').forEach(function (rect, index) { - rect.stroke("black"); - }); - stage.find('Ellipse').forEach(function (circ, index) { - circ.stroke("black"); - }); - shape.stroke("yellow"); - toggleEditControls(true); - if (editMode) { - toggleFloorplanControls(); - $('.deleteDecoration').css('display', 'none'); - transformer.nodes([getTableShape(table)]); - table.moveToTop(); - transformer.moveToTop(); - } - tableLayer.draw(); - //If the table is already selected - } - else { - resetActiveTable(); - transformer.nodes([]); - tableLayer.draw(); - } - } -} - -let getTableData = (tableNumber) => { - return ajaxSync('/ajax/getTableData', tableNumber) -} - -let isTableMerged = (tableNumber) => { - let mergeData = getTableData(tableNumber).merged_children - return mergeData !== "" -} - -function resetActiveTable() { - if (!transferMode) { - if (selectedTable) { - getTableShape(selectedTable).stroke('black'); - } - selectedTable = null; - selectedTableNumber = ""; - toggleFloorplanControls(false, editMode); - toggleEditControls(false); - } - else { - $('.editControls').css('display', 'none'); - } -} -function addDecoration(button) { - let insertData = { - decoration_room: currentRoom, - basis: basis, - decoration_image: $(button).data('image') + switch(table.shape) { + case 'square': + case 'circle': + // noinspection JSSuspiciousNameCombination + table.height = table.width + table.rotation = 0 + break + case 'diamond': + // noinspection JSSuspiciousNameCombination + table.height = table.width + table.rotation = 45 + break + case 'rect': + case 'ellipse': + table.height = table.width * 2 + table.rotation = 0 + break + case 'longrect': + case 'longellipse': + table.rotation = 90 + break } - ajaxSync('/ajax/addDecoration', insertData) - $('#decorator').css('display', 'none'); - selectedDecoration = false; - loadRoom(currentRoom); -} -function deleteDecoration(decoration) { - ajax('/ajax/deleteDecoration', decoration.id()); - $('.deleteDecoration').css('display', 'none'); - decoration.destroy() - selectedDecoration = false; - transformer.nodes([]) -} -function saveDecTransformation(decoration: Konva.Shape) { - let newData = { - decoration_id: decoration.id(), - decoration_pos_x: decoration.x() / scale, - decoration_pos_y: decoration.y() / scale, - decoration_width: parseInt((decoration.scaleX() * decoration.width()) / scale), - decoration_height: parseInt((decoration.scaleY() * decoration.height()) / scale), - decoration_rotation: parseInt(decoration.rotation()), - decoration_image: decodeURIComponent(decoration.image().src), - decoration_room: currentRoom - }; - if (editMode) { - idToSelect = decoration.id(); - } - ajax('/ajax/updateDecoration', newData) + saveTable(table) + deselectTables() + redrawTable(tableGroup) } -//When a table has been resized, rotated etc. -function saveTransformation(table) { - tableNumber = getTableNumber(table); - shape = getTableShape(table); - newRotation = parseInt(shape.rotation()); - newWidth = parseInt(shape.scaleX() * shape.width() / scale); - newHeight = parseInt((shape.scaleY() * shape.height()) / scale); - newXPos = parseInt(table.x() / scale); - newYPos = parseInt(table.y() / scale); - updateData = { + +const redrawTable = (tableGroup: Konva.Group) => { + deselectTables() + const draggable = tableGroup.draggable() + const table = getTableDataFromGroup(tableGroup) + tableGroup.destroy() + const newTableGroup = createTableShape(table) + const newTableShape = getTableShapeFromTableNumber(table.table_number) + selectTable(newTableShape) + newTableGroup.draggable(draggable) +} + +const showAddTablePopup = () => showVirtualNumpad(lang('new_table_number'), 4, false, false, true, addTable); + +const addTable = (tableNumber: number) => { + const newTable : table = { + id: 0, table_number: tableNumber, - rotation: newRotation, - width: newWidth, - height: newHeight, - pos_x: newXPos, - pos_y: newYPos + room_id: Floorplan.currentRoom.id, + default_covers: 2, + width: 200, + height: 200, + rotation: 0, + pos_x: Floorplan.visualScaleBasis / 2, + pos_y: Floorplan.visualScaleBasis / 2, + shape: 'square', + merged_children : '', + previous_state: '', + status: 0, + venue_id: 1 }; - transformTable(updateData) + + ajax('/ajax/createTable', newTable, 'post', tableAdded, tableNotAdded, null) } -let transformTable = (tableData) => { - return ajax("/ajax/transformTable", tableData) +const tableAdded = (table: table) => { + deselectTables() + const newTableGroup = createTableShape(table) + Floorplan.tables.push(table) + selectTable(getTableShapeFromGroup(newTableGroup)) } -function unmergeTable() { - - ajaxUnmergeTable(selectedTableNumber) - loadRoom(currentRoom); -} -function reserveTable(covers) { - if (!covers) { - showVirtualNumpad(lang('how_many_covers'), 2, false, false, true, reserveTable); - } - else { - let table = getTableGroup(selectedTableNumber); - let newReservation = ajaxSync('/ajax/newEmptyReservation', selectedTableNumber) - - table.fire('click'); - let tableShape = getTableShape(table); - tableShape.fill('lightgreen'); - table.draw(); - table.fire('click'); - completeReservation(newReservation); - } +const tableNotAdded = (response: string) => { + posAlert(response) } -function unreserveTable(input) { - if (!input) { - confirm(lang('confirm_delete_reservation', selectedTableNumber), selectedTableNumber, lang('confirm'), unreserveTable); - } - else { - ajaxSync('/ajax/unreserveTable', input) - hideAlerts() - table = getTableGroup(input); - table.fire('click'); - tableShape = getTableShape(table); - tableShape.fill('gray'); - table.draw(); - table.fire('click'); - } -} -function completeReservation(resName) { - if (!resName) { - showVirtualKeyboard(lang('enter_reservation_name')); - } - else { - //callPhpFunction('updateTableMapTable', [selectedTableNumber, 'reservation_name', resName]); - loadRoom(currentRoom, selectedTableNumber); - } -} -function toggleEditMode() { - let editModeButton = $('.editModeButton'); - if (editMode === true) { - editMode = false; - loadRoom(currentRoom); - editModeButton.removeClass('active'); - editModeButton.html(lang('edit_floorplan')); - toggleFloorplanControls(false); - if (selectedTable) - selectedTable.fire('click'); - stage.find('Group').forEach(function (table, index) { - table.draggable(false); - }); - } - else { - editMode = true; - stage.find('Group').forEach(function (table, index) { - table.draggable(true); - if (getTableShape(table).stroke() === "yellow") { - table.moveToTop(); - transformer.nodes([getTableShape(table)]); - transformer.moveToTop(); - } - }); - stage.find('Image').forEach(function (img, index) { - img.draggable(true); - }); - toggleFloorplanControls(); - transformer.moveToTop(); - tableLayer.draw(); - editModeButton.addClass('active'); - editModeButton.html(lang('stop_edit_floorplan')); - } -} -function toggleFloorplanControls(onOrOff = true, subControlsOnly = false) { - if (onOrOff || subControlsOnly) { - $('.floorplanControls').css('visibility', 'visible'); - } - else { - $('.floorplanControls').css('visibility', 'hidden'); - } - if (selectedTable) { - $('.changeShapeButton').css('visibility', 'visible'); - $('.deleteTableButton').css('visibility', 'visible'); - } - else { - $('.changeShapeButton').css('visibility', 'hidden'); - $('.deleteTableButton').css('visibility', 'hidden'); - } - if (selectedDecoration) { - $('.deleteDecoration').css('display', 'flex'); - } - else { - $('.deleteDecoration').css('display', 'none'); +const confirmDeleteTable = () => confirmation( + lang('confirm_delete_table', Floorplan.selectedTableNumber.toString()), + Floorplan.selectedTableNumber, + 'Confirm', deleteTable) + +const deleteTable = (tableNumber: number) => { + if(!tableNumber) return false + const tableToDelete = getTableDataFromTableNumber(tableNumber) + + if(tableIsOpen(tableToDelete)){ + posAlert(lang('error_delete_existing_table')) + return false } + + ajax(`/ajax/deleteTable`, tableToDelete, 'post', tableDeleted, null, null); } -let tableIsOpen = (tableNumber) => { - return ajaxSync(`/ajax/tableIsOpen/${tableNumber}`, null, 'GET') +const tableDeleted = (deletedTable: table) => { + Floorplan.tables = Floorplan.tables.filter(table => table.table_number != deletedTable.table_number) + const tableGroup = getTableGroupFromTableNumber(deletedTable.table_number) + deselectTables() + tableGroup.destroy() } -function toggleEditControls(onOrOff = true) { - if (onOrOff) { - $('.editControls').css("display", "flex"); - if (isTableMerged(selectedTableNumber)) { - $('.mergeControls').css("visibility", "visible"); - $('.unmergeButton').css('display', 'flex'); - $('.mergeButton').css('display', 'flex'); - } - else { - $('.mergeControls').css("visibility", "visible"); - $('.mergeButton').css('display', 'flex'); - $('.unmergeButton').css('display', 'none'); - } - if (tableIsOpen(selectedTableNumber)) { - $('.payTableButton').css('display', 'flex'); - $('.viewTableButton').css('display', 'flex'); - $('.reserveTableButton').css('display', 'none'); - $('.transferTableButton').css('display', 'flex'); - } - else { - $('.payTableButton').css('display', 'none'); - $('.viewTableButton').css('display', 'none'); - $('.reserveTableButton').css('display', 'flex'); - $('.transferTableButton').css('display', 'none'); - } - } - else { - $('.editControls').css("display", "none"); - $('.mergeControls').css("visibility", "hidden"); - $('.mergeButton').css("display", "none"); - $('.unmergeButton').css("display", "none"); +const toggleMergeMode = () => toggleMode('merge') + + +const mergeTables = (table1: table, table2: table ) => { + toggleMergeMode() + if(table1.table_number == table2.table_number){ + posAlert(lang('error_self_merge')) + return false; } + ajax('/ajax/mergeTables', [table1, table2], 'post', tablesMerged, null, null) } + +const tablesMerged = (tables: Record<'child'|'parent'|'merged', table>) => { + tableDeleted(tables['child']) + tableDeleted(tables['parent']) + tableAdded(tables['merged']) + deselectTables() + const tableGroup = getTableGroupFromTableNumber(tables['merged'].table_number) + selectTable(getTableShapeFromGroup(tableGroup)) + tableGroup.draggable(true) +} + +const unmergeTable = () => ajax(`/ajax/unmergeTable/${Floorplan.selectedTableNumber}`, null, 'get', tablesUnmerged, null, null) + +const tablesUnmerged = (tables: Record<'child'|'parent', table>) => { + const parentTable = tables['parent'] + const childTable = tables['child'] + + tableDeleted(parentTable) + tableAdded(parentTable) + tableAdded(childTable) + deselectTables() +} + +const toggleTransferMode = () => toggleMode('transfer') + +const transferTables = (origin: table, destination: table) => { + if(origin.table_number == destination.table_number){ + posAlert(lang('transfer_self_error')) + return + } + + ajax(`/ajax/transferTable/${origin.table_number}/${destination.table_number}`, null, 'get', tableTransferred, null, null) +} + +const tableTransferred = (tables: Record<"origin"|"destination", table>) => { + const origin = tables['origin'] + const destination = tables['destination'] + + Floorplan.activeTableNumbers = Floorplan.activeTableNumbers.filter(tableNumber => tableNumber != origin.table_number) + Floorplan.activeTableNumbers.push(destination.table_number) + if(Floorplan.currentRoom.id == origin.room_id) { + redrawTable(getTableGroupFromTableNumber(origin.table_number)) + } + redrawTable(getTableGroupFromTableNumber(destination.table_number)) +} + +const getDimensions = () => { + + Floorplan.floorplanDiv = $('#tableMap') + const parentDiv = $('#mapContainer') + const outerWidth = parentDiv.outerWidth() + const outerHeight = parentDiv.outerHeight() + + let width = outerWidth; + let height = outerWidth; + + if (outerWidth >= outerHeight) { + width = outerHeight + height = outerHeight + } + + Floorplan.floorplanDiv.height(height) + Floorplan.floorplanDiv.width(width) + Floorplan.visualScale = width / Floorplan.visualScaleBasis + + return {width: width, height:height} +} \ No newline at end of file diff --git a/wwwroot/scripts/ts/keyboards.ts b/wwwroot/scripts/ts/keyboards.ts index f328615..3c13858 100644 --- a/wwwroot/scripts/ts/keyboards.ts +++ b/wwwroot/scripts/ts/keyboards.ts @@ -1,4 +1,9 @@ - let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, allowDecimals = true, allowClose = true, submitFunction: Function) => { +type KeyboardRowName = `row${number}${"" | "_"}${string}`; +interface VirtualKeyboard { + [layoutName: string]: Partial>; +} + +let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, allowDecimals = true, allowClose = true, submitFunction: Function) => { let numpad = $('#virtualNumpad'); let inputBox = $('#virtualNumpadInput') let closeKeyboardButton = $('.closeKeyboards') @@ -23,10 +28,9 @@ numpad.data('password', isPassword); numpad.data('allowdecimals', allowDecimals); - $(document).unbind('keyup'); - $(document).keyup(e => { + $(document).off('keyup'); + $(document).on('keyup', e => { let key = e.key; - switch (key) { case 'Backspace': case 'Delete': @@ -64,7 +68,7 @@ let submitFunction = numpad.data('submitfunction') let allowedValues = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'submit', 'clear'] let currentValue = numpad.data('value').toString() - //Test + if (allowDecimals) allowedValues.push('.', ',') @@ -96,7 +100,7 @@ let clearNumpadInput = () => { $('#virtualNumpadInput').text("") $('#virtualNumpad').data('value', '') - } + } let setupVirtualNumpad = () => { $(document).on('click', '.virtualNumpadButton', e => { @@ -109,11 +113,12 @@ }); } - let setupVirtualKeyboard = () => { + let setupVirtualKeyboard = (keyboardLayouts: VirtualKeyboard) => { Application.keyboard = { capsLock: false, shift: false, - layout: 'default' + layouts: keyboardLayouts, + currentLayout: 'default', } $(document).on('click', '.virtualKeyboardButton', e => { @@ -123,7 +128,7 @@ setKeyboardLayout('default') } - let showVirtualKeyboard = (heading: string, maxlength = 32, isPassword = false, submitFunction = () => { + let showVirtualKeyboard = (heading: string, maxlength = 32, isPassword = false, submitFunction :Function = () => { hideVirtualKeyboard() }) => { let keyboard = $('#virtualKeyboard') @@ -166,7 +171,7 @@ case 'submit': hideVirtualKeyboard(); let submitFunction = keyboard.data('submitfunction') - submitFunction(); + submitFunction(inputBox.text()); break; case 'shift': if (Application.keyboard.capsLock) break; @@ -206,8 +211,10 @@ } let setKeyboardLayout = (layout: string, modifier = '') => { - let keyboardLayout = ajaxSync('/languages/english/keyboardLayout.json', null, 'get') + if (modifier != '') modifier = `_${modifier}` + Application.keyboard.currentLayout = layout + let layoutToLoad = Application.keyboard.layouts[layout] $('.virtualKeyboardRow').each((index, row) => { /* @@ -215,7 +222,7 @@ and translators making their own language packs */ index = index + 1; - let currentRow: Record = keyboardLayout[layout]["row" + index + modifier] + let currentRow = layoutToLoad[`row${index}${modifier}`] $(row).children('a').each((keyIndex, button) => { let key = $(button); @@ -251,6 +258,6 @@ } $(() => { - setupVirtualNumpad() - setupVirtualKeyboard(); + setupVirtualNumpad() + ajax('/ajax/getKeyboardLayout/english', null, 'get',setupVirtualKeyboard, null, null) }) diff --git a/wwwroot/scripts/ts/test.ts b/wwwroot/scripts/ts/test.ts new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/wwwroot/scripts/ts/test.ts @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wwwroot/scripts/ts/types.ts b/wwwroot/scripts/ts/types.ts index 821a8d7..88c5d4a 100644 --- a/wwwroot/scripts/ts/types.ts +++ b/wwwroot/scripts/ts/types.ts @@ -1,4 +1,5 @@ -type PosMode = "edit" | "void" | "transfer" | "default" +type PosMode = "edit" | "void" | "transfer" | "default" | "tableSelected" | "decorationSelected" | "activeTableSelected" | "merge" | "reservedTableSelected" +type PosModes = PosMode[] interface ajaxResult { status: string @@ -7,11 +8,10 @@ interface ajaxResult { interface ApplicationState { keyboard: keyboard - mode: PosMode + mode: PosModes languageVars: Record } - interface table { table_number: number, room_id: number @@ -25,20 +25,41 @@ interface table { rotation: number merged_children: string previous_state: string - status: string - table_id: number + status: number + id: number +} + +interface decoration { + id: number + decoration_room: number + decoration_pos_x: number + decoration_pos_y: number + decoration_rotation: number + decoration_width: number + decoration_height: number + decoration_image: string } interface room { - room_id: number + id: number room_name: string background_image: string venue_id: number } +interface reservation { + id: number, + reservation_name: string, + reservation_time: number, + reservation_covers: number, + reservation_created_at: number, + reservation_table_id: number, +} + interface keyboard { capsLock: boolean shift: boolean - layout: string + layouts: VirtualKeyboard + currentLayout: string } \ No newline at end of file diff --git a/wwwroot/styles/screen.css b/wwwroot/styles/screen.css index 8b42ae3..9864baf 100644 --- a/wwwroot/styles/screen.css +++ b/wwwroot/styles/screen.css @@ -26,7 +26,7 @@ body{ display:flex; align-items:center; justify-content:center; - + } #tableDetails div{ @@ -154,7 +154,7 @@ body{ #bottomHalf{ flex:1; overflow-x:auto; - overflow-y:hidden; + overflow-y:hidden; scroll-behavior: smooth; } @@ -233,7 +233,7 @@ td .posButton.normal.hasImage a:first-of-type{ flex-basis:24%; background-size:contain; background-repeat:no-repeat; - background-position:center; + background-position:center; align-items:center; } @@ -242,7 +242,7 @@ td .posButton.normal.hasImage a:nth-of-type(2){ } td .posButton.doubleHeight{ - flex-direction:column; + flex-direction:column; } td .posButton.doubleHeight.hasImage a:first-of-type{ @@ -254,7 +254,7 @@ td .posButton.doubleHeight.hasImage a:first-of-type{ flex-basis:66%; background-size:contain; background-repeat:no-repeat; - background-position:center 20%; + background-position:center 20%; } .mobile td .posButton.doubleHeight.hasImage a:first-of-type{ @@ -274,7 +274,7 @@ td .posButton.doubleWidth.hasImage a:first-of-type{ flex-basis:24%; background-size:contain; background-repeat:no-repeat; - background-position:0 center; + background-position:0 center; display:flex; align-items:center; } @@ -294,7 +294,7 @@ td .posButton.doubleWidth.doubleHeight.hasImage a:first-of-type{ height:100%; background-size:contain; background-repeat:no-repeat; - background-position:center; + background-position:center; } td .posButton.doubleWidth.doubleHeight.hasImage a:nth-of-type(2){ @@ -326,7 +326,7 @@ td .posButton.doubleWidth.doubleHeight.hasImage a:nth-of-type(2){ .instructionRow td{ font-weight:lighter !important; font-size:1em !important; - + } td.itemCell{ @@ -489,7 +489,7 @@ a.logOut{ .bottomCell{ flex-basis:10%; - width:100%; + width:100%; } @@ -498,7 +498,7 @@ a.logOut{ display:flex; flex-direction:column; flex-basis:80%; - + } #tablemapLeftColumn a, @@ -553,14 +553,14 @@ a.logOut{ .floorplanControls, .mergeControls{ - visibility:hidden; width:100%; flex-basis:33%; display:flex; flex-direction:column; } -.editControls a{ +.editControls > a, +.editControls .posHeader{ height:100%; display:flex; flex-wrap:wrap; @@ -568,12 +568,23 @@ a.logOut{ align-items:center; justify-content:center; text-align:center; + padding:0.5em; } - .editControls .posHeader{ flex-direction:column; } +.posHeader.currentTable > * { + width: 100%; + flex:1; + align-items: center; + display: flex; + justify-content: center; +} + +.posHeader.currentTable b {align-items: flex-end} +.posHeader.currentTable small {align-items: flex-start} + .floorplanControls a, .mergeControls a{ display:flex; diff --git a/wwwroot/themes/restaurant/tableMap.tpl.htm b/wwwroot/themes/restaurant/tableMap.tpl.htm index 43b9a62..7fb4e23 100644 --- a/wwwroot/themes/restaurant/tableMap.tpl.htm +++ b/wwwroot/themes/restaurant/tableMap.tpl.htm @@ -27,13 +27,17 @@
-
- - - - - - +
+
+ + + +
+ + + + +
@@ -43,22 +47,22 @@
-
- +
+ - - - + + +
-
- - - +
+ + +
-
-
+
+
-
+
@@ -70,14 +74,5 @@
- \ No newline at end of file