Separated models, controllers and routers
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
let showLoginBox = () => showVirtualNumpad('Enter Login Code', 6, true, false, false, authenticate)
|
||||
|
||||
let authenticate = (input : string) => {
|
||||
let login = ajaxSync('/ajax/authenticateClerk', input)
|
||||
let login = ajaxSync('/login/authenticateClerk', input)
|
||||
if(login === 'success'){
|
||||
location.assign('/floorplan')
|
||||
location.assign('/floorplan/')
|
||||
}
|
||||
else
|
||||
showLoginBox()
|
||||
|
||||
@@ -50,7 +50,7 @@ const Floorplan: floorplan = {
|
||||
selectedDecorationId: 0
|
||||
};
|
||||
|
||||
$(() => ajax('/ajax/getFloorplanData/1', null, 'get', setupFloorplan, null, null) )
|
||||
$(() => ajax('/floorplan/getFloorplanData/1', null, 'get', setupFloorplan, null, null) )
|
||||
|
||||
|
||||
const setupFloorplanEvents = () => {
|
||||
@@ -276,7 +276,7 @@ const saveTable = (tableToUpdate: floorplan_table) => {
|
||||
tables.push(tableToUpdate)
|
||||
|
||||
Floorplan.tables = tables
|
||||
ajax("/ajax/transformTable", tableToUpdate, 'post', null,null,null)
|
||||
ajax("/floorplan/transformTable", tableToUpdate, 'post', null,null,null)
|
||||
}
|
||||
|
||||
const setTransformerNodes = (nodes: Konva.Shape[]) => {
|
||||
@@ -347,7 +347,7 @@ const createEmptyReservation = (covers: number) => {
|
||||
time: 0,
|
||||
}
|
||||
|
||||
ajax('/ajax/newEmptyReservation', newReservation,'post', emptyReservationCreated, null, null )
|
||||
ajax('/reservations/newEmptyReservation', newReservation,'post', emptyReservationCreated, null, null )
|
||||
}
|
||||
|
||||
const emptyReservationCreated = (reservation: reservation) => {
|
||||
@@ -366,7 +366,7 @@ const addReservationName = (name: string) => {
|
||||
hideVirtualKeyboard()
|
||||
const reservation = Floorplan.reservations.filter(reservation => reservation.floorplan_table_id == getSelectedTableData().id)[0]
|
||||
reservation.name = name
|
||||
ajax('/ajax/updateReservation', reservation, 'post', reservationNameAdded, null, null)
|
||||
ajax('/reservations/updateReservation', reservation, 'post', reservationNameAdded, null, null)
|
||||
}
|
||||
|
||||
const reservationNameAdded = (updatedReservation: reservation) => {
|
||||
@@ -386,7 +386,7 @@ const updateTableData = (tableToRemove: floorplan_table) => {
|
||||
const unreserveTable = () => {
|
||||
const selectedTable = getSelectedTableData()
|
||||
selectedTable.status = 0
|
||||
ajax('/ajax/unreserveTable', selectedTable, 'post', tableUnreserved, null, null)
|
||||
ajax('/reservations/unreserveTable', selectedTable, 'post', tableUnreserved, null, null)
|
||||
}
|
||||
|
||||
const tableUnreserved = (table: floorplan_table) => {
|
||||
@@ -500,7 +500,7 @@ const createDecorationShape = (decoration:decoration, select?: boolean) => {
|
||||
}
|
||||
}
|
||||
|
||||
decorationShape.src = 'images/decorations/' + decoration.decoration_image
|
||||
decorationShape.src = '/images/decorations/' + decoration.decoration_image
|
||||
}
|
||||
|
||||
const setupDecorationEvents = (decorationShape: Konva.Image) => {
|
||||
@@ -567,7 +567,7 @@ const saveDecoration = (decorationToUpdate: decoration) => {
|
||||
decorations.push(decorationToUpdate)
|
||||
|
||||
Floorplan.decorations = decorations
|
||||
ajax("/ajax/updateDecoration", decorationToUpdate, 'post', null,null,null)
|
||||
ajax("/floorplan/updateDecoration", decorationToUpdate, 'post', null,null,null)
|
||||
}
|
||||
|
||||
const showDecorator = () => $('#decorator').css('display', 'flex')
|
||||
@@ -588,7 +588,7 @@ const addDecoration = (e: Event) => {
|
||||
venue_id: Floorplan.currentRoom.venue_id
|
||||
}
|
||||
|
||||
ajax('/ajax/addDecoration', newDecoration, 'post', decorationAdded, null, null)
|
||||
ajax('/floorplan/addDecoration', newDecoration, 'post', decorationAdded, null, null)
|
||||
}
|
||||
|
||||
const decorationAdded = (decoration: decoration) => {
|
||||
@@ -600,7 +600,7 @@ const decorationAdded = (decoration: decoration) => {
|
||||
|
||||
|
||||
const deleteDecoration = () => ajax(
|
||||
'/ajax/deleteDecoration',
|
||||
'/floorplan/deleteDecoration',
|
||||
getDecorationDataById(Floorplan.selectedDecorationId),
|
||||
'post', decorationDeleted, null, null)
|
||||
|
||||
@@ -616,7 +616,7 @@ const setRoomBackground = (roomToLoad: room) => {
|
||||
const height = Floorplan.floorplanDiv.height()
|
||||
|
||||
if(roomToLoad.background_image) {
|
||||
Floorplan.floorplanDiv.css("background-image", `url(images/rooms/${roomToLoad?.background_image})`)
|
||||
Floorplan.floorplanDiv.css("background-image", `url(/images/rooms/${roomToLoad?.background_image})`)
|
||||
Floorplan.floorplanDiv.css("background-size", `${width}px ${height}px`)
|
||||
}
|
||||
}
|
||||
@@ -735,7 +735,7 @@ const addTable = (tableNumber: number) => {
|
||||
venue_id: 1
|
||||
};
|
||||
|
||||
ajax('/ajax/createTable', newTable, 'post', tableAdded, tableNotAdded, null)
|
||||
ajax('/floorplan/createTable', newTable, 'post', tableAdded, tableNotAdded, null)
|
||||
}
|
||||
|
||||
const tableAdded = (table: floorplan_table) => {
|
||||
@@ -763,7 +763,7 @@ const deleteTable = (tableNumber: number) => {
|
||||
return false
|
||||
}
|
||||
|
||||
ajax(`/ajax/deleteTable`, tableToDelete, 'post', tableDeleted, null, null);
|
||||
ajax(`/floorplan/deleteTable`, tableToDelete, 'post', tableDeleted, null, null);
|
||||
}
|
||||
|
||||
const tableDeleted = (deletedTable: floorplan_table) => {
|
||||
@@ -782,7 +782,7 @@ const mergeTables = (table1: floorplan_table, table2: floorplan_table ) => {
|
||||
posAlert(lang('error_self_merge'))
|
||||
return false;
|
||||
}
|
||||
ajax('/ajax/mergeTables', [table1, table2], 'post', tablesMerged, null, null)
|
||||
ajax('/floorplan/mergeTables', [table1, table2], 'post', tablesMerged, null, null)
|
||||
}
|
||||
|
||||
const tablesMerged = (tables: Record<'child'|'parent'|'merged', floorplan_table>) => {
|
||||
@@ -795,7 +795,7 @@ const tablesMerged = (tables: Record<'child'|'parent'|'merged', floorplan_table>
|
||||
tableGroup.draggable(true)
|
||||
}
|
||||
|
||||
const unmergeTable = () => ajax(`/ajax/unmergeTable/${Floorplan.selectedTableNumber}`, null, 'get', tablesUnmerged, null, null)
|
||||
const unmergeTable = () => ajax(`/floorplan/unmergeTable/${Floorplan.selectedTableNumber}`, null, 'get', tablesUnmerged, null, null)
|
||||
|
||||
const tablesUnmerged = (tables: Record<'child'|'parent', floorplan_table>) => {
|
||||
const parentTable = tables['parent']
|
||||
@@ -815,7 +815,7 @@ const transferTables = (origin: floorplan_table, destination: floorplan_table) =
|
||||
return
|
||||
}
|
||||
|
||||
ajax(`/ajax/transferTable/${origin.table_number}/${destination.table_number}`, null, 'get', tableTransferred, null, null)
|
||||
ajax(`/floorplan/transferTable/${origin.table_number}/${destination.table_number}`, null, 'get', tableTransferred, null, null)
|
||||
}
|
||||
|
||||
const tableTransferred = (tables: Record<"origin"|"destination", floorplan_table>) => {
|
||||
|
||||
@@ -303,7 +303,7 @@ const itemButtonClicked = (e: JQuery.TriggeredEvent) => {
|
||||
const gridButtonClicked = (e: JQuery.TriggeredEvent) => {
|
||||
const button = $(e.target).closest('.posButton')
|
||||
const grid : number = button.data('grid')
|
||||
ajax(`/orderScreen/getGridHtml/${grid}`, null, null,gridHtmlGenerated, null, null)
|
||||
ajax(`/order/getGridHtml/${grid}`, null, null,gridHtmlGenerated, null, null)
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ const changeCoverNumberPromptSubmitted = (value: string) => updateCoverNumbers(N
|
||||
const updateCoverNumbers = (covers: number) => {
|
||||
let newTable = Object.assign({}, OrderScreen.table)
|
||||
newTable.default_covers = covers
|
||||
ajax('/orderScreen/updateCovers', newTable, 'post', coverNumbersUpdated, null, null)
|
||||
ajax('/order/updateCovers', newTable, 'post', coverNumbersUpdated, null, null)
|
||||
}
|
||||
|
||||
const coverNumbersUpdated = (newTable: floorplan_table) => {
|
||||
@@ -600,5 +600,5 @@ const generateCoverSelector = () => {
|
||||
|
||||
$(() => {
|
||||
OrderScreen.table = $('#pageContainer').data('table') || null
|
||||
ajax('/orderScreen/getOrderScreenData/1', null, 'get', setupOrderScreen, null, null)
|
||||
ajax('/order/getOrderScreenData/1', null, 'get', setupOrderScreen, null, null)
|
||||
})
|
||||
Reference in New Issue
Block a user