Updates
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
let showLoginBox = () => showVirtualNumpad('Enter Login Code', 6, true, false, false, authenticate);
|
||||
let authenticate = (input) => {
|
||||
let login = ajaxSync('/ajax/authenticateClerk', input);
|
||||
if (login === 'success')
|
||||
redirect('/floorplan');
|
||||
if (login === 'success') {
|
||||
location.assign('/floorplan');
|
||||
}
|
||||
else
|
||||
showLoginBox();
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"dredgepos.authenticate.js","sourceRoot":"","sources":["../ts/dredgepos.authenticate.ts"],"names":[],"mappings":"AAAA,IAAI,YAAY,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;AAEnG,IAAK,YAAY,GAAG,CAAC,KAAc,EAAE,EAAE;IACnC,IAAI,KAAK,GAAG,QAAQ,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAA;IACtD,IAAG,KAAK,KAAK,SAAS;QAClB,QAAQ,CAAC,YAAY,CAAC,CAAA;;QAEtB,YAAY,EAAE,CAAA;AACtB,CAAC,CAAA;AAED,CAAC,CAAC,GAAG,EAAE;IACH,YAAY,EAAE,CAAA;AAClB,CAAC,CAAC,CAAA"}
|
||||
{"version":3,"file":"dredgepos.authenticate.js","sourceRoot":"","sources":["../ts/dredgepos.authenticate.ts"],"names":[],"mappings":"AAAA,IAAI,YAAY,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;AAEnG,IAAK,YAAY,GAAG,CAAC,KAAc,EAAE,EAAE;IACnC,IAAI,KAAK,GAAG,QAAQ,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAA;IACtD,IAAG,KAAK,KAAK,SAAS,EAAC;QACnB,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;KAChC;;QAEG,YAAY,EAAE,CAAA;AACtB,CAAC,CAAA;AAED,CAAC,CAAC,GAAG,EAAE;IACH,YAAY,EAAE,CAAA;AAClB,CAAC,CAAC,CAAA"}
|
||||
@@ -56,13 +56,16 @@ let ajaxSync = (endpoint, data, method = 'POST') => {
|
||||
return response;
|
||||
};
|
||||
/* Redirect to a specific URL */
|
||||
let redirect = (url) => {
|
||||
window.location.href = url;
|
||||
let redirect = (url) => location.assign(url);
|
||||
const resize = () => {
|
||||
$('#pageContainer').height(window.innerHeight + "px");
|
||||
};
|
||||
let setupCore = (languageVars) => {
|
||||
Application.languageVars = languageVars;
|
||||
const doc = $(document);
|
||||
doc.on('click', '#alertNo, #alertOk', hideAlerts);
|
||||
window.addEventListener('resize', resize);
|
||||
resize();
|
||||
setElementVisibilityByMode();
|
||||
};
|
||||
// @ts-ignore
|
||||
@@ -130,7 +133,7 @@ let setElementVisibilityByMode = () => {
|
||||
invisibleElements.each((index, elem) => {
|
||||
let element = $(elem);
|
||||
let inVisibleInModes = element.data('invisible-in-mode');
|
||||
let hideElement = inVisibleInModes.every(invisibleMode => {
|
||||
let hideElement = inVisibleInModes.some(invisibleMode => {
|
||||
return mode.includes(invisibleMode);
|
||||
});
|
||||
element.toggle(!hideElement);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -149,16 +149,21 @@ const createTableShape = (table) => {
|
||||
};
|
||||
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);
|
||||
});
|
||||
tableGroup.on('click', tableClicked);
|
||||
tableGroup.on('tap', tableClicked);
|
||||
tableGroup.on('dragend', tableGroupTransformed);
|
||||
tableShape.on('transformend', tableShapeTransformed);
|
||||
};
|
||||
const getTableShapeFromGroup = (group) => group.getChildren()[0];
|
||||
const getTableGroupFromShape = (shape) => shape.parent;
|
||||
const tableGroupTransformed = (e) => {
|
||||
saveTableTransformation(e.target);
|
||||
};
|
||||
const tableShapeTransformed = (e) => {
|
||||
let shape = e.target;
|
||||
let group = getTableGroupFromShape(shape);
|
||||
saveTableTransformation(group);
|
||||
};
|
||||
const saveTableTransformation = (tableGroup) => {
|
||||
const originalTable = getTableDataFromGroup(tableGroup);
|
||||
const tableShape = getTableShapeFromGroup(tableGroup);
|
||||
@@ -321,7 +326,8 @@ const selectTable = (tableShape) => {
|
||||
turnOnMode('tableSelected');
|
||||
};
|
||||
const updateCoverText = (table) => $('.selectedTableCovers').text(lang('covers', table.default_covers.toString()));
|
||||
const tableClicked = (tableShape) => {
|
||||
const tableClicked = (event) => {
|
||||
let tableShape = getTableShapeFromGroup(event.currentTarget);
|
||||
const table = getTableDataFromShape(tableShape);
|
||||
if (isInMode('merge')) {
|
||||
mergeTables(getTableDataFromTableNumber(Floorplan.selectedTableNumber), table);
|
||||
@@ -365,17 +371,13 @@ const createDecorationShape = (decoration, select) => {
|
||||
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);
|
||||
});
|
||||
decorationShape.on('click', decorationClicked);
|
||||
decorationShape.on('tap', decorationClicked);
|
||||
decorationShape.on('transformend', decorationTransformed);
|
||||
decorationShape.on('dragend', decorationTransformed);
|
||||
};
|
||||
const decorationClicked = (decorationShape) => {
|
||||
const decorationClicked = (event) => {
|
||||
let decorationShape = event.target;
|
||||
if (isInMode('edit')) {
|
||||
turnOffMode('tableSelected');
|
||||
if ((Floorplan.transformer.nodes().length > 0 && Floorplan.transformer.nodes()[0] != decorationShape) || Floorplan.transformer.nodes().length == 0) {
|
||||
@@ -398,7 +400,8 @@ const selectDecorationShape = (decorationShape) => {
|
||||
const getDecorationDataById = (id) => {
|
||||
return Floorplan.decorations.find(decoration => id == decoration.id);
|
||||
};
|
||||
const decorationTransformed = (decorationShape) => {
|
||||
const decorationTransformed = (event) => {
|
||||
let decorationShape = event.currentTarget;
|
||||
const oldDecorationData = getDecorationDataById(Number(decorationShape.id()));
|
||||
const newDecoration = {
|
||||
id: oldDecorationData.id,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -100,6 +100,9 @@ let setupVirtualKeyboard = (keyboardLayouts) => {
|
||||
$(document).on('click', '.virtualKeyboardButton', e => {
|
||||
virtualKeyboardInput($(e.target).data('value'));
|
||||
});
|
||||
$(document).on('click', '.forceFocus', (e) => {
|
||||
$('#virtualKeyboardInput').trigger('focus');
|
||||
});
|
||||
setKeyboardLayout('default');
|
||||
};
|
||||
let showVirtualKeyboard = (heading, maxlength = 32, isPassword = false, submitFunction = () => { hideVirtualKeyboard(); }) => {
|
||||
@@ -107,12 +110,16 @@ let showVirtualKeyboard = (heading, maxlength = 32, isPassword = false, submitFu
|
||||
let inputBox = $('#virtualKeyboardInput');
|
||||
keyboard.css('display', 'flex');
|
||||
$('#virtualKeyboardHeading').html(heading);
|
||||
$('.forceFocus').trigger('click');
|
||||
keyboard.data('value', '');
|
||||
inputBox.text('');
|
||||
inputBox.val('');
|
||||
keyboard.data('maxlength', maxlength);
|
||||
keyboard.data('password', isPassword);
|
||||
keyboard.data('submitfunction', submitFunction);
|
||||
inputBox.attr('autofocus', 'autofocus');
|
||||
inputBox.trigger('focus');
|
||||
inputBox.trigger('click');
|
||||
inputBox.trigger('select');
|
||||
$(document).on('keyup', e => {
|
||||
let key = e.key;
|
||||
if (key == 'Enter' && inputBox.val().toString().length > 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,8 +2,9 @@
|
||||
|
||||
let authenticate = (input : string) => {
|
||||
let login = ajaxSync('/ajax/authenticateClerk', input)
|
||||
if(login === 'success')
|
||||
redirect('/floorplan')
|
||||
if(login === 'success'){
|
||||
location.assign('/floorplan')
|
||||
}
|
||||
else
|
||||
showLoginBox()
|
||||
}
|
||||
|
||||
@@ -67,15 +67,20 @@
|
||||
}
|
||||
|
||||
/* Redirect to a specific URL */
|
||||
let redirect = (url: string) : void => {
|
||||
window.location.href = url
|
||||
}
|
||||
let redirect = (url: string) : void => location.assign(url)
|
||||
|
||||
|
||||
|
||||
const resize = () => {
|
||||
$('#pageContainer').height(window.innerHeight + "px");
|
||||
}
|
||||
|
||||
let setupCore = (languageVars: Record<string, string>) => {
|
||||
Application.languageVars = languageVars
|
||||
const doc = $(document)
|
||||
doc.on('click', '#alertNo, #alertOk', hideAlerts)
|
||||
window.addEventListener('resize', resize)
|
||||
resize()
|
||||
|
||||
setElementVisibilityByMode()
|
||||
}
|
||||
@@ -159,7 +164,7 @@
|
||||
invisibleElements.each((index, elem) => {
|
||||
let element = $(elem)
|
||||
let inVisibleInModes: PosModes = element.data('invisible-in-mode')
|
||||
let hideElement = inVisibleInModes.every(invisibleMode => {
|
||||
let hideElement = inVisibleInModes.some(invisibleMode => {
|
||||
return mode.includes(invisibleMode)
|
||||
})
|
||||
element.toggle(!hideElement)
|
||||
|
||||
@@ -212,18 +212,24 @@ const createTableShape = (table: table) => {
|
||||
const setupTableEvents = (tableGroup: Konva.Group) => {
|
||||
const tableShape = getTableShapeFromGroup(tableGroup)
|
||||
|
||||
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)
|
||||
})
|
||||
tableGroup.on('click', tableClicked)
|
||||
tableGroup.on('tap', tableClicked)
|
||||
tableGroup.on('dragend', tableGroupTransformed)
|
||||
tableShape.on('transformend', tableShapeTransformed)
|
||||
}
|
||||
|
||||
const getTableShapeFromGroup = (group: Konva.Group) => group.getChildren()[0] as Konva.Shape
|
||||
const getTableGroupFromShape = (shape: Konva.Shape) => shape.parent as Konva.Group
|
||||
|
||||
const tableGroupTransformed = (e: Konva.KonvaEventObject<any>) => {
|
||||
saveTableTransformation(e.target as Konva.Group)
|
||||
}
|
||||
const tableShapeTransformed = (e: Konva.KonvaEventObject<any>) => {
|
||||
let shape = e.target as Konva.Shape
|
||||
let group = getTableGroupFromShape(shape)
|
||||
saveTableTransformation(group)
|
||||
}
|
||||
|
||||
const saveTableTransformation = (tableGroup: Konva.Group) => {
|
||||
const originalTable = getTableDataFromGroup(tableGroup)
|
||||
const tableShape = getTableShapeFromGroup(tableGroup)
|
||||
@@ -425,7 +431,8 @@ const selectTable = (tableShape: Konva.Shape) => {
|
||||
|
||||
const updateCoverText = (table:table) => $('.selectedTableCovers').text(lang('covers', table.default_covers.toString()))
|
||||
|
||||
const tableClicked = (tableShape: Konva.Shape) => {
|
||||
const tableClicked = (event: Konva.KonvaEventObject<any>) => {
|
||||
let tableShape = getTableShapeFromGroup(event.currentTarget as Konva.Group)
|
||||
const table = getTableDataFromShape(tableShape)
|
||||
|
||||
if(isInMode('merge')) {
|
||||
@@ -481,20 +488,14 @@ const createDecorationShape = (decoration:decoration, select?: boolean) => {
|
||||
}
|
||||
|
||||
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)
|
||||
})
|
||||
decorationShape.on('click', decorationClicked)
|
||||
decorationShape.on('tap', decorationClicked)
|
||||
decorationShape.on('transformend', decorationTransformed)
|
||||
decorationShape.on('dragend', decorationTransformed)
|
||||
}
|
||||
|
||||
const decorationClicked = (decorationShape: Konva.Image) => {
|
||||
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) {
|
||||
@@ -519,8 +520,8 @@ const getDecorationDataById = (id: number) => {
|
||||
return Floorplan.decorations.find(decoration => id == decoration.id)
|
||||
}
|
||||
|
||||
const decorationTransformed = (decorationShape: Konva.Image) => {
|
||||
|
||||
const decorationTransformed = (event: Konva.KonvaEventObject<MouseEvent>|Konva.KonvaEventObject<TouchEvent|DragEvent|MouseEvent>) => {
|
||||
let decorationShape = event.currentTarget as Konva.Image
|
||||
const oldDecorationData = getDecorationDataById(Number(decorationShape.id()))
|
||||
const newDecoration: decoration = {
|
||||
id: oldDecorationData.id,
|
||||
|
||||
@@ -126,6 +126,9 @@ let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, al
|
||||
virtualKeyboardInput($(e.target).data('value'));
|
||||
})
|
||||
|
||||
$(document).on('click', '.forceFocus', (e) => {
|
||||
$('#virtualKeyboardInput').trigger('focus')
|
||||
})
|
||||
setKeyboardLayout('default')
|
||||
}
|
||||
|
||||
@@ -135,13 +138,17 @@ let showVirtualNumpad = (heading: string, maxlength = 4, isPassword: boolean, al
|
||||
|
||||
keyboard.css('display', 'flex')
|
||||
$('#virtualKeyboardHeading').html(heading)
|
||||
$('.forceFocus').trigger('click')
|
||||
|
||||
keyboard.data('value', '')
|
||||
inputBox.text('')
|
||||
inputBox.val('')
|
||||
keyboard.data('maxlength', maxlength)
|
||||
keyboard.data('password', isPassword)
|
||||
keyboard.data('submitfunction', submitFunction)
|
||||
inputBox.attr('autofocus', 'autofocus');
|
||||
inputBox.trigger('focus')
|
||||
inputBox.trigger('click')
|
||||
inputBox.trigger('select')
|
||||
$(document).on('keyup', e => {
|
||||
let key = e.key
|
||||
if (key == 'Enter' && inputBox.val().toString().length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user