Added Basic Order Screen
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
mode: [],
|
||||
languageVars: {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Parses a language variable. */
|
||||
let lang = (key: string, replacements?: string[] | string) => {
|
||||
|
||||
@@ -500,12 +500,14 @@ const decorationClicked = (event: Konva.KonvaEventObject<any>) => {
|
||||
let decorationShape = event.target as Konva.Image
|
||||
if(isInMode('edit')){
|
||||
turnOffMode('tableSelected')
|
||||
if ((Floorplan.transformer.nodes().length > 0 && Floorplan.transformer.nodes()[0] != decorationShape) || Floorplan.transformer.nodes().length == 0) {
|
||||
if ((isInMode('decorationSelected') && Floorplan.selectedDecorationId != Number(decorationShape.id())) || !isInMode('decorationSelected')) {
|
||||
selectDecorationShape(decorationShape)
|
||||
} else {
|
||||
deselectTables()
|
||||
decorationShape.moveToBottom()
|
||||
}
|
||||
} else {
|
||||
deselectTables()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,11 +614,14 @@ const setupKonva = () => {
|
||||
height: dimensions.height,
|
||||
})
|
||||
|
||||
Floorplan.stage.on('click', e => {
|
||||
const stageClick = (e: Konva.KonvaEventObject<any> ) => {
|
||||
if(e.target == Floorplan.stage){
|
||||
deselectTables()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Floorplan.stage.on('click', stageClick)
|
||||
Floorplan.stage.on('tap', stageClick)
|
||||
|
||||
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],
|
||||
|
||||
48
wwwroot/scripts/ts/dredgepos.orderScreen.ts
Normal file
48
wwwroot/scripts/ts/dredgepos.orderScreen.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
interface OrderScreen{
|
||||
order_screen_pages: order_screen_page[]
|
||||
}
|
||||
|
||||
let OrderScreen : OrderScreen = {
|
||||
order_screen_pages: null
|
||||
}
|
||||
|
||||
const loadPageGroup = (e: Event) => {
|
||||
let button = $(e.target)
|
||||
$('.loadPageGroup').removeClass('active')
|
||||
button.addClass('active')
|
||||
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
|
||||
? navButtons.show()
|
||||
: navButtons.hide()
|
||||
|
||||
activeGrid.css('display', 'inline-flex')
|
||||
}
|
||||
|
||||
const setupOrderScreen = (data: OrderScreen) => {
|
||||
OrderScreen = data
|
||||
let doc = $(document)
|
||||
doc.on('click', '.nextButton', goToNextPage)
|
||||
doc.on('click', '.prevButton', goToPrevPage)
|
||||
doc.on('click', '.loadPageGroup', loadPageGroup)
|
||||
|
||||
let initialPage = $('.loadPageGroup').first().trigger('click')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param direction 1 for forward, -1 for backwards.
|
||||
*/
|
||||
const navigatePage = (direction: number) => {
|
||||
let grid = $('.pageGroup:visible')
|
||||
grid.get()[0].scrollLeft += grid.width() * direction
|
||||
}
|
||||
|
||||
const goToNextPage = () => navigatePage(1)
|
||||
const goToPrevPage = () => navigatePage(-1)
|
||||
|
||||
|
||||
$(() => ajax('/orderScreen/getOrderScreenData/1', null, 'get', setupOrderScreen, null, null) )
|
||||
@@ -63,4 +63,8 @@ interface keyboard {
|
||||
shift: boolean
|
||||
layouts: VirtualKeyboard
|
||||
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}
|
||||
Reference in New Issue
Block a user