Converted from MySQL to PgSQL

This commit is contained in:
2021-11-28 16:50:58 +10:00
parent db1b620aec
commit 969e6b1b87
13 changed files with 44 additions and 73 deletions

View File

@@ -113,7 +113,7 @@ const loadRoom = (roomToLoad: room) => {
setupKonva()
$('.roomButton').removeClass('active')
let button = $(`.roomButton[data-value=${roomToLoad.id}]`)
let button = $(`.roomButton[data-value=${roomToLoad?.id}]`)
button.addClass('active')
const tablesInRoom = Floorplan.tables.filter(table => table.room_id == roomToLoad.id)
@@ -391,7 +391,7 @@ const tableUnreserved = (table: table) => {
const getSelectedTableData = () => getTableDataFromTableNumber(Floorplan.selectedTableNumber)
const deselectTables = () => {
Floorplan.stage.find('Rect, Ellipse').forEach( (shape: Konva.Shape, index) => {
Floorplan.stage.find('Rect, Ellipse').forEach( (shape: Konva.Shape) => {
shape.stroke('black')
});
@@ -536,6 +536,7 @@ const decorationTransformed = (event: Konva.KonvaEventObject<MouseEvent>|Konva.K
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,
venue_id: oldDecorationData.venue_id,
}
saveDecoration(newDecoration)
@@ -569,7 +570,8 @@ const addDecoration = (e: Event) => {
decoration_rotation: 0,
decoration_width: 200,
decoration_height: 200,
decoration_image: button.data('image')
decoration_image: button.data('image'),
venue_id: Floorplan.currentRoom.venue_id
}
ajax('/ajax/addDecoration', newDecoration, 'post', decorationAdded, null, null)
@@ -599,8 +601,10 @@ 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`)
if(roomToLoad.background_image) {
Floorplan.floorplanDiv.css("background-image", `url(images/rooms/${roomToLoad?.background_image})`)
Floorplan.floorplanDiv.css("background-size", `${width}px ${height}px`)
}
}
const setupKonva = () => {

View File

@@ -13,7 +13,6 @@ const loadPageGroup = (e: Event) => {
let pageGroupId = button.data('page-group-id')
$('.pageGroup').hide()
let activeGrid = $(`.pageGroup[data-page-group-id=${pageGroupId}]`)
let navButtons = $('.pageNavigation')
activeGrid.find('.gridPage').length > 1
@@ -30,7 +29,7 @@ const setupOrderScreen = (data: OrderScreen) => {
doc.on('click', '.prevButton', goToPrevPage)
doc.on('click', '.loadPageGroup', loadPageGroup)
let initialPage = $('.loadPageGroup').first().trigger('click')
$('.loadPageGroup').first().trigger('click')
}
/**

View File

@@ -39,6 +39,7 @@ interface decoration {
decoration_width: number
decoration_height: number
decoration_image: string
venue_id: number
}
interface room {
@@ -65,6 +66,6 @@ interface keyboard {
currentLayout: string
}
interface order_screen_page_group {id: number; venue_id: number; label: string}
interface order_screen_page{id: number; order_screen_page_group_id: number; grid_id: number}
interface grid {id: number; grid_name: string; grid_rows: number; grid_cols: number; grid_data: string}
interface grid {id: number; grid_name: string; grid_rows: number; grid_cols: number; grid_data: string}