4 Commits

Author SHA1 Message Date
dredgy
3f4d6b650e Merge pull request #15 from dredgy/make_order_screen_reactive
Fixed slight bug in void system
2022-09-14 11:51:11 +10:00
dredgy
2e213d95ad Merge pull request #14 from dredgy/modals
Added a simple close modal feature.
2022-08-22 14:23:21 +10:00
dredgy
89e9e0b7a7 Added a simple close modal feature. 2022-08-22 14:22:54 +10:00
dredgy
dd74054930 Merge pull request #13 from dredgy/make_order_screen_reactive
Make order screen reactive
2022-08-01 10:52:56 +10:00
2 changed files with 10 additions and 12 deletions

View File

@@ -13,10 +13,10 @@ let decoratorItem (imageName, imageUrl) =
let decoratorRow decoratorItems = div [_class "decoratorRow"] [yield! decoratorItems] let decoratorRow decoratorItems = div [_class "decoratorRow"] [yield! decoratorItems]
let decorator (decorationRows: XmlNode[]) = let decorator (decorationRows: XmlNode[]) =
div [_id "decorator"] [ div [_id "decorator"; _class "modal"] [
div [_id "decoratorHeader"] [ div [_id "decoratorHeader"] [
h2 [] [lang "choose_decoration"] h2 [] [lang "choose_decoration"]
a [_class "posButton hideDecorator"] [str "×"] a [_class "posButton hideModals"] [str "×"]
] ]
div [_id "decoratorContent"] [ div [_id "decoratorContent"] [
yield! decorationRows yield! decorationRows

View File

@@ -23,9 +23,7 @@ const lang = (key: string, replacements?: string[] | string) => {
} }
/** Check if a variable is defined */ /** Check if a variable is defined */
const defined = (variable: any) => { const defined = (variable: any) => typeof variable !== 'undefined'
return typeof variable !== 'undefined'
}
/** Call an Ajax function asynchronously */ /** Call an Ajax function asynchronously */
const ajax = (endpoint: string, data: any, method = 'POST', successFunction: Function, errorFunction: Function, beforeFunction: any) => { const ajax = (endpoint: string, data: any, method = 'POST', successFunction: Function, errorFunction: Function, beforeFunction: any) => {
@@ -69,18 +67,17 @@ const ajaxSync = (endpoint: string, data?: any, method = 'POST') => {
/* Redirect to a specific URL */ /* Redirect to a specific URL */
const redirect = (url: string): void => location.assign(url) const redirect = (url: string): void => location.assign(url)
const resize = () => { const resize = () => $('#pageContainer').height(window.innerHeight + "px");
$('#pageContainer').height(window.innerHeight + "px");
}
const setupCore = (languageVars: Record<string, string>) => { const setupCore = (languageVars: Record<string, string>) => {
Application.languageVars = languageVars Application.languageVars = languageVars
const doc = $(document) $(document)
doc.on('click', '#alertNo, #alertOk', hideAlerts) .on('click', '#alertNo, #alertOk', hideAlerts)
doc.on('click', '.toggle', toggle) .on('click', '.toggle', toggle)
.on('click', '.hideModals', hideModals)
window.addEventListener('resize', resize) window.addEventListener('resize', resize)
resize() resize()
setElementVisibilityByMode() setElementVisibilityByMode()
} }
@@ -117,6 +114,7 @@ const confirmation = (message: string, data: any, title = 'Confirm', submitFunct
const hideAlerts = () => $('#alert').hide() const hideAlerts = () => $('#alert').hide()
const hideModals = () => $('.modal').hide()
const turnOnMode = (mode: PosMode) => { const turnOnMode = (mode: PosMode) => {
Application.mode.push(mode) Application.mode.push(mode)