Initial commit
BIN
wwwroot/images/8bit.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
wwwroot/images/bacon.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
wwwroot/images/balter.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
wwwroot/images/beetrootdip.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
wwwroot/images/bentspoke.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
wwwroot/images/boags.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
wwwroot/images/brooklyn.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
wwwroot/images/brouhaha.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
wwwroot/images/brulee.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
wwwroot/images/bruschetta.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
wwwroot/images/budvar.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
wwwroot/images/budweiser.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
wwwroot/images/burger.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
wwwroot/images/casablanca.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
wwwroot/images/chaffey.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
wwwroot/images/colonialhazy.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
wwwroot/images/cooperssession.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
wwwroot/images/corona.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
wwwroot/images/curry.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
wwwroot/images/cusquena.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
wwwroot/images/decorations/Pot Plant 1.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
wwwroot/images/decorations/Pot Plant 2.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
wwwroot/images/decorations/Pot Plant 3.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
wwwroot/images/decorations/Pot Plant 4 - Copy.tif
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
wwwroot/images/decorations/Pot Plant 4.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
wwwroot/images/decorations/planter-box.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
wwwroot/images/decorations/room_divider.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
wwwroot/images/elvis.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
wwwroot/images/estrella.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
wwwroot/images/fosters.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
wwwroot/images/frenchonion.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
wwwroot/images/galactopus.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
wwwroot/images/goat.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
wwwroot/images/guinness.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
wwwroot/images/hemingwayxpa.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
wwwroot/images/hopthief.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
wwwroot/images/hornet.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
wwwroot/images/hotdog.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
wwwroot/images/jedi.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
wwwroot/images/kaiju.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
wwwroot/images/kofta.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
wwwroot/images/kronenbourg.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
wwwroot/images/larry.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
wwwroot/images/matsos.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
wwwroot/images/mb.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
wwwroot/images/moduspale.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
wwwroot/images/moet.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
wwwroot/images/moosehead.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
wwwroot/images/nail.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
wwwroot/images/neopolitan.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
wwwroot/images/no.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
wwwroot/images/nomad.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
wwwroot/images/oysters.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
wwwroot/images/paradigm.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
wwwroot/images/pencarrow.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
wwwroot/images/perthlocal.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
wwwroot/images/pickledan.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
wwwroot/images/pineapple.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
wwwroot/images/pinkening.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
wwwroot/images/piratelife.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
wwwroot/images/pita.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
wwwroot/images/pudding.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
wwwroot/images/quilmes.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
wwwroot/images/ribs.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
wwwroot/images/rooms/PineWoodGrain.jpg
Normal file
|
After Width: | Height: | Size: 6.8 MiB |
BIN
wwwroot/images/rooms/barbackground.jpg
Normal file
|
After Width: | Height: | Size: 235 KiB |
BIN
wwwroot/images/rooms/barbackground.png
Normal file
|
After Width: | Height: | Size: 656 KiB |
BIN
wwwroot/images/rooms/courtyardbackground.jpg
Normal file
|
After Width: | Height: | Size: 310 KiB |
BIN
wwwroot/images/rooms/functionroom.jpg
Normal file
|
After Width: | Height: | Size: 152 KiB |
BIN
wwwroot/images/salsa.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
wwwroot/images/scallops.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
wwwroot/images/slipstream.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
wwwroot/images/sludgebeast.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
wwwroot/images/squab.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
wwwroot/images/steakblue.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
wwwroot/images/steakmedium.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
wwwroot/images/steakmidrare.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
wwwroot/images/steakmidwell.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
wwwroot/images/steakrare.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
wwwroot/images/steakwelldone.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
wwwroot/images/stonewood.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
wwwroot/images/taco.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
wwwroot/images/tapenade.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
wwwroot/images/tiramisu.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
wwwroot/images/tooheysold.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
wwwroot/images/tusker.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
wwwroot/images/viru.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
wwwroot/images/wellington.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
wwwroot/images/wholefish.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
wwwroot/images/windhoek.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
wwwroot/images/xxxxgold.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
wwwroot/images/zambezi.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
wwwroot/images/zulia.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
128
wwwroot/languages/english/keyboardLayout.json
Normal file
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"default": {
|
||||
"row1": [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"0",
|
||||
"-",
|
||||
"=",
|
||||
"Backspace[backspace]"
|
||||
],
|
||||
"row1_shift": [
|
||||
"!",
|
||||
"@",
|
||||
"#",
|
||||
"$",
|
||||
"%",
|
||||
"^",
|
||||
"&",
|
||||
"*",
|
||||
"(",
|
||||
")",
|
||||
"_",
|
||||
"+",
|
||||
"Backspace[backspace]"
|
||||
],
|
||||
"row2": [
|
||||
"",
|
||||
"q",
|
||||
"w",
|
||||
"e",
|
||||
"r",
|
||||
"t",
|
||||
"y",
|
||||
"u",
|
||||
"i",
|
||||
"o",
|
||||
"p",
|
||||
"[",
|
||||
"]",
|
||||
"\\"
|
||||
],
|
||||
"row2_shift": [
|
||||
"",
|
||||
"Q",
|
||||
"W",
|
||||
"E",
|
||||
"R",
|
||||
"T",
|
||||
"Y",
|
||||
"U",
|
||||
"I",
|
||||
"O",
|
||||
"P",
|
||||
"{",
|
||||
"}",
|
||||
"|"
|
||||
],
|
||||
"row3": [
|
||||
"Caps[capslock]",
|
||||
"a",
|
||||
"s",
|
||||
"d",
|
||||
"f",
|
||||
"g",
|
||||
"h",
|
||||
"j",
|
||||
"k",
|
||||
"l",
|
||||
";",
|
||||
"'",
|
||||
"Enter[submit]"
|
||||
],
|
||||
"row3_shift": [
|
||||
"Caps[capslock]",
|
||||
"A",
|
||||
"S",
|
||||
"D",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
":",
|
||||
"\"",
|
||||
"Enter"
|
||||
],
|
||||
"row4": [
|
||||
"Shift[shift]",
|
||||
"z",
|
||||
"x",
|
||||
"c",
|
||||
"v",
|
||||
"b",
|
||||
"n",
|
||||
"m",
|
||||
",",
|
||||
".",
|
||||
"/"
|
||||
],
|
||||
"row4_shift": [
|
||||
"Shift[shift]",
|
||||
"Z",
|
||||
"X",
|
||||
"C",
|
||||
"V",
|
||||
"B",
|
||||
"N",
|
||||
"M",
|
||||
"<",
|
||||
">",
|
||||
"?"
|
||||
],
|
||||
"row5": [
|
||||
"[space]space"
|
||||
],
|
||||
"row5_shift": [
|
||||
"[space] "
|
||||
]
|
||||
}
|
||||
}
|
||||
86
wwwroot/languages/english/main.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"lang_name":"English",
|
||||
"text_direction":"ltr",
|
||||
"currency_symbol":"$",
|
||||
"currency_symbol_side":"before",
|
||||
"currency_decimal_places":"2",
|
||||
"currency_thousands_separator":",",
|
||||
"currency_decimal":".",
|
||||
"default_alert_title":"Message",
|
||||
"alert_ok":"OK",
|
||||
"alert_yes":"Yes",
|
||||
"alert_no":"No",
|
||||
"enter_login_code":"Enter Login Code",
|
||||
"logged_in_as":"Logged in as [1]",
|
||||
"covers":"[1] Covers",
|
||||
"selected_cover":"Cover [1]",
|
||||
"activeTable":"Table [1]",
|
||||
"totalPrice":"Total Price: [1]",
|
||||
"selectedPrice":"([1] Selected)",
|
||||
"next_page":"Next Page",
|
||||
"prev_page":"Previous Page",
|
||||
"id_header":"Item Id",
|
||||
"qty_header":"Qty",
|
||||
"item_header":"Item",
|
||||
"individual_price_header":"Unit Price",
|
||||
"price_header":"Price",
|
||||
"total_price_header":"Total Price",
|
||||
"printgroup_header":"Course",
|
||||
"sortkey_header":"Key",
|
||||
"cover_header":"Cover",
|
||||
"department_header":"Department",
|
||||
"category_header":"Category",
|
||||
"type_header":"Item Type",
|
||||
"print_with":"Print with [1]",
|
||||
"functions_header":"Functions",
|
||||
"close_order_function":"Close Without Saving",
|
||||
"accumulate_function":"Accumulate Items",
|
||||
"void":"Void",
|
||||
"pay_function":"Pay",
|
||||
"print_function":"Save & Print",
|
||||
"freetext_button":"Keyboard",
|
||||
"numpad_button":"Numpad",
|
||||
"select_covers":"Cover #",
|
||||
"how_many_covers":"How many people are on this table?",
|
||||
"cover_zero":"For the Table",
|
||||
"freetext_no_order":"Please add an item before you can freetext.",
|
||||
"confirm":"Confirm",
|
||||
"edit_floorplan":"Edit Floorplan",
|
||||
"stop_edit_floorplan":"Save Floorplan",
|
||||
"logout":"Log Out",
|
||||
"merge_table":"Merge Table",
|
||||
"unmerge_table":"Unmerge Table",
|
||||
"order_table":"Place Order",
|
||||
"view_table":"View Table",
|
||||
"reserve_table":"Reserve Table",
|
||||
"unreserve_table":"Delete Reservation",
|
||||
"pay_table":"Pay",
|
||||
"pay_all":"Pay All",
|
||||
"add_table":"Add Table",
|
||||
"delete_table":"Delete Table",
|
||||
"change_shape":"Change Shape",
|
||||
"new_table_number":"New Table Number",
|
||||
"transfer_table":"Transfer to New Table",
|
||||
"add_decoration":"Add Decoration",
|
||||
"choose_decoration":"Choose a Decoration",
|
||||
"delete_decoration":"Delete Decoration",
|
||||
"enter_reservation_name":"Who is this table for?",
|
||||
"reserved_for":"Reserved for [1]",
|
||||
"reserved":"Reserved",
|
||||
"confirm_delete_reservation":"Are you sure you want to delete the reservation on table [1]?",
|
||||
"error_table_exists":"Table already exists in room \"[1]\"",
|
||||
"error_table_exists_merged":"Table already exists in room \"[1]\", it is merged with table [2].",
|
||||
"error_delete_existing_table":"Can't delete a table that's currently active.",
|
||||
"confirm_delete_table":"Are you sure you want to delete table [1]?",
|
||||
"orig_qty_header":"Original Qty",
|
||||
"selected_qty_header":"Selected Qty",
|
||||
"clerk_header":"Clerk",
|
||||
"orig_tprice_header":"Original Total Price",
|
||||
"has_split_header":"Has Split?",
|
||||
"for_cover_zero":"Shared Items",
|
||||
"whole_table":"Whole Table",
|
||||
"partial_table":"Partial Table",
|
||||
"paying_table":"Paying Table [1]",
|
||||
"msgbox_amount_select":"Enter Amount",
|
||||
"msgbox_qty_select":"How many would you like to select?"
|
||||
}
|
||||
14
wwwroot/scripts/js/dredgepos.authenticate.js
Normal file
@@ -0,0 +1,14 @@
|
||||
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');
|
||||
else
|
||||
showLoginBox();
|
||||
};
|
||||
$(() => {
|
||||
showLoginBox();
|
||||
});
|
||||
//# sourceMappingURL=dredgepos.authenticate.js.map
|
||||
1
wwwroot/scripts/js/dredgepos.authenticate.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dredgepos.authenticate.js","sourceRoot":"","sources":["../ts/dredgepos.authenticate.ts"],"names":[],"mappings":"AAAA,IAAI,YAAY,GAAG,GAAG,EAAE;IACpB,iBAAiB,CAAC,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;AAC9E,CAAC,CAAA;AAED,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"}
|
||||
96
wwwroot/scripts/js/dredgepos.core.js
Normal file
@@ -0,0 +1,96 @@
|
||||
let Application = {
|
||||
keyboard: null,
|
||||
mode: "default",
|
||||
languageVars: {}
|
||||
};
|
||||
/** Parses a language variable. */
|
||||
let lang = (key, replacements) => {
|
||||
let finalValue = Application.languageVars[key];
|
||||
if (!replacements)
|
||||
return finalValue;
|
||||
if (typeof replacements === 'string')
|
||||
replacements = [replacements];
|
||||
replacements.forEach((replacement, index) => {
|
||||
let correctIndex = index + 1;
|
||||
finalValue = finalValue.replace(`[${correctIndex}]`, replacement);
|
||||
});
|
||||
return finalValue;
|
||||
};
|
||||
/** Check if a variable is defined */
|
||||
let defined = (variable) => {
|
||||
return typeof variable !== 'undefined';
|
||||
};
|
||||
/** Call an Ajax function asynchronously */
|
||||
let ajax = (endpoint, data, method = 'POST', successFunction, errorFunction, beforeFunction) => {
|
||||
data = (data == null) ? data : JSON.stringify(data);
|
||||
return $.ajax({
|
||||
url: endpoint,
|
||||
method: method,
|
||||
data: data,
|
||||
success: (response) => {
|
||||
if (successFunction)
|
||||
successFunction(JSON.parse(response.data));
|
||||
},
|
||||
error: errorFunction,
|
||||
beforeSend: beforeFunction
|
||||
});
|
||||
};
|
||||
/*
|
||||
For the flow of the app, synchronous is commonly preferred
|
||||
though trying to keep it's usage as low as possible.
|
||||
*/
|
||||
let ajaxSync = (endpoint, data, method = 'POST') => {
|
||||
let response = JSON.parse($.ajax({
|
||||
url: endpoint,
|
||||
method: method,
|
||||
data: JSON.stringify(data),
|
||||
async: false,
|
||||
}).responseText);
|
||||
if (response.data) {
|
||||
response.data = JSON.parse(response.data);
|
||||
return response.data;
|
||||
}
|
||||
return response;
|
||||
};
|
||||
/* Redirect to a specific URL */
|
||||
let redirect = (url) => {
|
||||
window.location.href = url;
|
||||
};
|
||||
let setLanguageVariables = () => {
|
||||
Application.languageVars = ajaxSync('/ajax/languageVars', null, 'GET');
|
||||
};
|
||||
// @ts-ignore
|
||||
let alert = (message, title = 'Message') => {
|
||||
let alertBox = $('#alert');
|
||||
alertBox.css('display', 'flex');
|
||||
alertBox.data('value', '');
|
||||
$('#alertHeading').text(title);
|
||||
$('#alertMessage').text(message);
|
||||
$('#alertOk').css('display', 'flex');
|
||||
$('#alertYes').css('display', 'none');
|
||||
$('#alertNo').css('display', 'none');
|
||||
};
|
||||
// @ts-ignore
|
||||
let confirm = (message, data, title = 'Confirm', submitFunction = (data) => { hideAlerts(); }) => {
|
||||
let alert = $('#alert');
|
||||
$(document).on('click', '#alert #alertYes', () => {
|
||||
submitFunction(data);
|
||||
hideAlerts();
|
||||
$(document).off('click', '#alert #alertYes');
|
||||
});
|
||||
alert.css('display', 'flex');
|
||||
$('#alertHeading').html(title);
|
||||
$('#alertMessage').html(message);
|
||||
$('#alertOk').css('display', 'none');
|
||||
$('#alertYes').css('display', 'flex');
|
||||
$('#alertNo').css('display', 'flex');
|
||||
};
|
||||
let hideAlerts = () => {
|
||||
$('#alert').hide();
|
||||
};
|
||||
$(() => {
|
||||
let doc = $(document);
|
||||
setLanguageVariables();
|
||||
doc.on('click', '#alertNo, #alertOk', () => $('#alert').hide());
|
||||
});
|
||||
//# sourceMappingURL=dredgepos.core.js.map
|
||||
1
wwwroot/scripts/js/dredgepos.core.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dredgepos.core.js","sourceRoot":"","sources":["../ts/dredgepos.core.ts"],"names":[],"mappings":"AAAK,IAAI,WAAW,GAAsB;IAClC,QAAQ,EAAG,IAAI;IACf,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,EAAE;CACnB,CAAA;AAGD,kCAAkC;AACjC,IAAI,IAAI,GAAG,CAAC,GAAW,EAAE,YAAgC,EAAE,EAAE;IAC1D,IAAI,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAE9C,IAAG,CAAC,YAAY;QAAE,OAAO,UAAU,CAAA;IACnC,IAAG,OAAO,YAAY,KAAK,QAAQ;QAAE,YAAY,GA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C,OAAO,EAAE,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AACnE,CAAC,CAAC,CAAA"}
|
||||
784
wwwroot/scripts/js/dredgepos.floorplan.js
Normal file
@@ -0,0 +1,784 @@
|
||||
/// <reference path="./typings/konva.d.ts" />
|
||||
let stage;
|
||||
let transformer;
|
||||
let tableLayer;
|
||||
let editMode = false;
|
||||
let activeTables = [];
|
||||
let selectedTable;
|
||||
let selectedTableNumber;
|
||||
let currentRoom;
|
||||
let basis = 1280;
|
||||
let scale = 1;
|
||||
let newTable;
|
||||
let roomName;
|
||||
//Makes sure canvas always fits inside the div
|
||||
function getDimensions(parentDiv) {
|
||||
let tableMap = $('#tableMap');
|
||||
let outerWidth = parentDiv.outerWidth();
|
||||
let outerHeight = parentDiv.outerHeight();
|
||||
let width = outerWidth;
|
||||
let height = outerWidth;
|
||||
if (outerWidth >= outerHeight) {
|
||||
width = outerHeight;
|
||||
height = outerHeight;
|
||||
}
|
||||
tableMap.height(height);
|
||||
tableMap.width(width);
|
||||
scale = width / basis;
|
||||
return { width: width, height: height };
|
||||
}
|
||||
function setupTableMap() {
|
||||
let doc = $(document);
|
||||
activeTables = ajaxSync('/ajax/getActiveTables/1', null, 'GET');
|
||||
let dimensions = getDimensions($('#mapContainer'));
|
||||
roomName = 'Deck & Courtyard';
|
||||
stage = new Konva.Stage({
|
||||
container: 'tableMap',
|
||||
width: dimensions.width,
|
||||
height: dimensions.height,
|
||||
});
|
||||
$('body').on('click', '.editModeButton', () => { toggleEditMode(); });
|
||||
$('.roomButton').on('click', function () {
|
||||
roomName = $(this).text();
|
||||
loadRoom($(this).data('value'));
|
||||
});
|
||||
$('.transferTableButton').on('click', function () {
|
||||
transferModeOn();
|
||||
});
|
||||
$('.addDecoration').on('click', function () {
|
||||
$('#decorator').css('display', 'flex');
|
||||
});
|
||||
$('.deleteDecoration').on('click', function () {
|
||||
deleteDecoration(selectedDecoration);
|
||||
});
|
||||
$('.decoratorItem').on('click', function () {
|
||||
addDecoration(this);
|
||||
});
|
||||
$('.changeShapeButton').on('click', function () {
|
||||
changeTableShape(selectedTableNumber);
|
||||
});
|
||||
$('.reserveTableButton').on('click', function () {
|
||||
if ($(this).text() === lang('reserve_table')) {
|
||||
reserveTable();
|
||||
}
|
||||
else {
|
||||
unreserveTable();
|
||||
}
|
||||
});
|
||||
$('.addTableButton').on('click', function () {
|
||||
addTable();
|
||||
});
|
||||
$('.deleteTableButton').on('click', function () {
|
||||
deleteTable();
|
||||
});
|
||||
loadRoom(roomToLoad);
|
||||
}
|
||||
let updateTableShape = (tableData) => {
|
||||
return ajaxSync('/ajax/updateTableShape', tableData);
|
||||
};
|
||||
//Change the shape of a table in edit mode.
|
||||
function changeTableShape(tableNumber) {
|
||||
let tableData = getTableData(tableNumber);
|
||||
let tableShape = tableData['shape'];
|
||||
let tableWidth = tableData['width'];
|
||||
let tableHeight = tableData['height'];
|
||||
let tableRotation = tableData['rotation'];
|
||||
let order = ['square', 'rect', 'longrect', 'diamond', 'circle', 'ellipse', 'longellipse'];
|
||||
if (order.indexOf(tableShape) === -1)
|
||||
tableShape = 'square';
|
||||
//What the next shape is
|
||||
let currentIndex = order.indexOf(tableShape);
|
||||
let nextIndex = currentIndex + 1;
|
||||
if (nextIndex > (order.length) - 1)
|
||||
nextIndex = 0;
|
||||
let nextShape = order[nextIndex];
|
||||
switch (nextShape) {
|
||||
case 'square':
|
||||
case 'circle':
|
||||
tableHeight = tableWidth;
|
||||
tableRotation = 0;
|
||||
break;
|
||||
case 'diamond':
|
||||
tableHeight = tableWidth;
|
||||
tableRotation = 45;
|
||||
break;
|
||||
case 'rect':
|
||||
case 'ellipse':
|
||||
tableHeight = tableWidth * 2;
|
||||
tableRotation = 0;
|
||||
break;
|
||||
case 'longrect':
|
||||
case 'longellipse':
|
||||
tableRotation = 90;
|
||||
break;
|
||||
}
|
||||
let updateData = {
|
||||
table_number: tableNumber,
|
||||
shape: nextShape,
|
||||
height: tableHeight,
|
||||
width: tableWidth,
|
||||
rotation: tableRotation
|
||||
};
|
||||
tableData = updateTableShape(updateData);
|
||||
let tableGroup = stage.find('#' + tableNumber)[0];
|
||||
transformer.nodes([]);
|
||||
tableGroup.destroy();
|
||||
let newTable = createTableElement(tableData);
|
||||
tableLayer.add(newTable);
|
||||
stage.draw();
|
||||
selectTable(tableNumber);
|
||||
loadRoom(currentRoom, tableNumber);
|
||||
}
|
||||
let createTable = (tableData) => {
|
||||
return ajaxSync('/ajax/createTable', tableData);
|
||||
};
|
||||
let tableExists = (tableNumber) => {
|
||||
return ajaxSync(`/ajax/tableExists/${tableNumber}`);
|
||||
};
|
||||
function addTable(tableNumber) {
|
||||
if (!tableNumber) {
|
||||
showVirtualNumpad(lang('new_table_number'), 4, false, false, true, addTable);
|
||||
}
|
||||
else {
|
||||
let newTableInfo = {
|
||||
table_number: tableNumber,
|
||||
room_id: currentRoom,
|
||||
default_covers: 2,
|
||||
width: 200,
|
||||
height: 200,
|
||||
rotation: 0,
|
||||
pos_x: basis / 2,
|
||||
pos_y: basis / 2,
|
||||
shape: 'square',
|
||||
merged_children: '',
|
||||
previous_state: '',
|
||||
status: 0,
|
||||
reservation: 0,
|
||||
venue_id: 1
|
||||
};
|
||||
let newTableData = createTable(newTableInfo);
|
||||
if (!newTableData.table_number) {
|
||||
alert(newTableData);
|
||||
return false;
|
||||
}
|
||||
newTable = createTableElement(newTableData);
|
||||
tableLayer.add(newTable);
|
||||
tableLayer.draw();
|
||||
selectTable(tableNumber);
|
||||
}
|
||||
}
|
||||
function selectTable(tableNumber) {
|
||||
let table = stage.find('#' + tableNumber)[0];
|
||||
table.fire('click');
|
||||
}
|
||||
function deleteTable(tableNumber = 0) {
|
||||
if (!tableNumber) {
|
||||
confirm(lang('confirm_delete_table', selectedTableNumber), selectedTableNumber, 'Confirm', deleteTable);
|
||||
}
|
||||
else {
|
||||
if (tableIsOpen(selectedTableNumber)) {
|
||||
alert(lang('error_delete_existing_table'));
|
||||
}
|
||||
else {
|
||||
ajax(`/ajax/deleteTable/${selectedTableNumber}`, null, 'GET');
|
||||
let table = stage.find('#' + tableNumber)[0];
|
||||
transformer.nodes([]);
|
||||
table.destroy();
|
||||
tableLayer.draw();
|
||||
selectedTable = null;
|
||||
selectedTableNumber = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Rotate a shape around any point.
|
||||
// shape is a Konva shape
|
||||
// angleDegrees is the angle to rotate by, in degrees.
|
||||
// point is an object {x: posX, y: posY}
|
||||
function rotateAroundPoint(shape, angleDegrees, point) {
|
||||
let angleRadians = angleDegrees * Math.PI / 180;
|
||||
// they lied, I did have to use trigonometry
|
||||
const x = point.x +
|
||||
(shape.x() - point.x) * Math.cos(angleRadians) -
|
||||
(shape.y() - point.y) * Math.sin(angleRadians);
|
||||
const y = point.y +
|
||||
(shape.x() - point.x) * Math.sin(angleRadians) +
|
||||
(shape.y() - point.y) * Math.cos(angleRadians);
|
||||
shape.rotation(shape.rotation() + angleDegrees); // rotate the shape in place
|
||||
shape.x(x); // move the rotated shape in relation to the rotation point.
|
||||
shape.y(y);
|
||||
}
|
||||
function createDecoration(data, idToSelect = false) {
|
||||
let draggable = editMode;
|
||||
var decoration = new Image();
|
||||
decoration.onload = function () {
|
||||
var dec = new Konva.Image({
|
||||
id: data.decoration_id.toString(),
|
||||
x: data.decoration_pos_x * scale,
|
||||
y: data.decoration_pos_y * scale,
|
||||
image: decoration,
|
||||
offsetX: data.decoration_width * 0.5 * scale,
|
||||
offsetY: data.decoration_height * 0.5 * scale,
|
||||
rotation: data.decoration_rotation,
|
||||
width: data.decoration_width * scale,
|
||||
height: data.decoration_height * scale,
|
||||
draggable: draggable,
|
||||
});
|
||||
if (editMode && dec.id() === idToSelect) {
|
||||
transformer.nodes([dec]);
|
||||
transformer.moveToTop();
|
||||
}
|
||||
dec.on('click', function () {
|
||||
selectDecoration(this);
|
||||
});
|
||||
dec.on('tap', function () {
|
||||
selectDecoration(this);
|
||||
});
|
||||
dec.on('dragend', function () {
|
||||
saveDecTransformation(this);
|
||||
});
|
||||
dec.on('transformend', function () {
|
||||
saveDecTransformation(this);
|
||||
});
|
||||
// add the shape to the layer
|
||||
tableLayer.add(dec);
|
||||
tableLayer.draw();
|
||||
dec.moveToBottom();
|
||||
};
|
||||
decoration.src = 'images/decorations/' + data.decoration_image;
|
||||
return decoration;
|
||||
}
|
||||
var selectedDecoration = false;
|
||||
function selectDecoration(decoration) {
|
||||
if (editMode) {
|
||||
if ((transformer.nodes().length > 0 && transformer.nodes()[0] != decoration) || transformer.nodes().length == 0) {
|
||||
resetActiveTable();
|
||||
transformer.nodes([decoration]);
|
||||
decoration.moveToTop();
|
||||
transformer.moveToTop();
|
||||
selectedDecoration = decoration;
|
||||
toggleFloorplanControls();
|
||||
}
|
||||
else {
|
||||
transformer.nodes([]);
|
||||
selectedDecoration = false;
|
||||
$('.deleteDecoration').css('display', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
function createTableElement(data, selectTable = false) {
|
||||
// Create container group
|
||||
let draggable = editMode || newTable === data.table_number;
|
||||
let table = new Konva.Group({
|
||||
x: data.pos_x * scale,
|
||||
y: data.pos_y * scale,
|
||||
draggable: draggable,
|
||||
listening: true,
|
||||
id: data.table_number.toString()
|
||||
});
|
||||
let fillColor = 'gray';
|
||||
if (data.status === 'reserved') {
|
||||
fillColor = 'lightgreen';
|
||||
}
|
||||
if (activeTables.includes(data.table_number)) {
|
||||
fillColor = 'lightblue';
|
||||
}
|
||||
data.width = data.width * scale;
|
||||
data.height = data.height * scale;
|
||||
// Create background shape
|
||||
let shape;
|
||||
switch (data.shape) {
|
||||
case "circle": // fall-through
|
||||
case "ellipse": // fall-through
|
||||
case "longellipse":
|
||||
shape = new Konva.Ellipse({
|
||||
x: 0,
|
||||
y: 0,
|
||||
radiusX: data.width * 0.5,
|
||||
radiusY: data.height * 0.5,
|
||||
rotation: data.rotation,
|
||||
fill: fillColor,
|
||||
stroke: "black",
|
||||
strokeWidth: 4,
|
||||
draggable: false,
|
||||
listening: true
|
||||
});
|
||||
break;
|
||||
default:
|
||||
shape = new Konva.Rect({
|
||||
x: 0,
|
||||
y: 0,
|
||||
offsetX: data.width * 0.5,
|
||||
offsetY: data.height * 0.5,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
rotation: data.rotation,
|
||||
fill: fillColor,
|
||||
stroke: "black",
|
||||
strokeWidth: 4,
|
||||
draggable: false,
|
||||
listening: true
|
||||
});
|
||||
break;
|
||||
} // End switch
|
||||
// Create label
|
||||
let label = new Konva.Text({
|
||||
x: data.width * -0.5,
|
||||
y: data.height * -0.5,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
text: data.table_number.toString(),
|
||||
fontSize: 40 * scale,
|
||||
fill: "black",
|
||||
align: "center",
|
||||
verticalAlign: "middle",
|
||||
draggable: false,
|
||||
listening: false
|
||||
});
|
||||
tableNumber = data.tablenumber;
|
||||
table.add(shape, label);
|
||||
table.on('dblclick', function () {
|
||||
tableNumber = parseInt(getTableNumber(this));
|
||||
if (!editMode) {
|
||||
loadScreen('orderScreen', 'table=' + tableNumber);
|
||||
}
|
||||
});
|
||||
table.on('dbltap', function () {
|
||||
tableNumber = getTableNumber(this);
|
||||
loadScreen('orderScreen', 'table=' + tableNumber);
|
||||
});
|
||||
table.on('dragend', function () {
|
||||
saveTransformation(table);
|
||||
});
|
||||
innerShape = getTableShape(table);
|
||||
table.on('click', function () {
|
||||
selectTableShape(this);
|
||||
});
|
||||
table.on('tap', function () {
|
||||
selectTableShape(this);
|
||||
});
|
||||
innerShape.on('transformend', function () {
|
||||
saveTransformation(table);
|
||||
});
|
||||
// add the shape to the layer
|
||||
tableLayer.add(table);
|
||||
table.moveToTop();
|
||||
if (tableNumber === selectedTableNumber) {
|
||||
selectTable = table;
|
||||
}
|
||||
if (selectTable) {
|
||||
if (selectTable === tableNumber) {
|
||||
table.fire('click');
|
||||
}
|
||||
}
|
||||
return table;
|
||||
}
|
||||
function loadRoom(room, selectTable = 0, selectDecoration = false) {
|
||||
//if (room === currentRoom) return false
|
||||
ajax(`/ajax/getRoomData/${room}`, null, 'GET', (response) => {
|
||||
let floorplanDiv = $('#tableMap');
|
||||
let backgroundImage = response.background_image;
|
||||
floorplanDiv.css("background-image", `url(images/rooms/${backgroundImage})`);
|
||||
floorplanDiv.css("background-size", `${width}px ${height}px`);
|
||||
}, null, null);
|
||||
$('.roomButton').removeClass('active');
|
||||
let selector = ".roomButton:contains('" + roomName + "')";
|
||||
$(selector).addClass('active');
|
||||
currentRoom = room;
|
||||
resetActiveTable();
|
||||
stage.destroy();
|
||||
stage = new Konva.Stage({
|
||||
container: 'tableMap',
|
||||
width: width,
|
||||
height: height,
|
||||
});
|
||||
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],
|
||||
anchorSize: 40 * scale,
|
||||
ignoreStroke: true,
|
||||
centeredScaling: true
|
||||
});
|
||||
let tablesAndDecorations = ajaxSync(`/ajax/getTablesAndDecorations/${room}`, null, 'GET');
|
||||
let decorations = tablesAndDecorations['decorations'];
|
||||
let tables = tablesAndDecorations['tables'];
|
||||
tableLayer = new Konva.Layer();
|
||||
tableLayer.add(transformer);
|
||||
// Loop data and call the creation method for each decoration/table.
|
||||
decorations.forEach(itemData => {
|
||||
createDecoration(itemData, selectDecoration);
|
||||
});
|
||||
tables.forEach(itemData => {
|
||||
tableLayer.add(createTableElement(itemData, selectTable));
|
||||
});
|
||||
activeTables = getOpenTables();
|
||||
stage.add(tableLayer);
|
||||
}
|
||||
var mergeMode = false;
|
||||
var parentMergeTable;
|
||||
var childMergeTable;
|
||||
var tableTransferOrigin;
|
||||
var transferMode = false;
|
||||
function transferModeOn() {
|
||||
mergeModeOff();
|
||||
if (!transferMode) {
|
||||
tableTransferOrigin = selectedTableNumber;
|
||||
transferMode = true;
|
||||
$('.transferTableButton').addClass('active');
|
||||
$('.transferTableButton').text('Select a table to transfer items to');
|
||||
}
|
||||
else {
|
||||
transferModeOff();
|
||||
}
|
||||
}
|
||||
function transferModeOff() {
|
||||
transferMode = false;
|
||||
$('.transferTableButton').removeClass('active');
|
||||
$('.transferTableButton').text(lang('transfer_table'));
|
||||
}
|
||||
let getOpenTables = () => {
|
||||
return ajaxSync('/ajax/getActiveTables/1', null, 'GET');
|
||||
};
|
||||
let transferTableAjax = (origin, destination) => {
|
||||
ajax(`/ajax/transferTables/${origin}/${destination}`, null, 'GET');
|
||||
};
|
||||
function transferTables() {
|
||||
destination = selectedTableNumber;
|
||||
origin = tableTransferOrigin;
|
||||
if (destination !== origin) {
|
||||
transferTableAjax(origin, destination);
|
||||
activeTables = getOpenTables();
|
||||
transferModeOff();
|
||||
getTableShape(selectedTable).fill('lightblue');
|
||||
getTableShape(getTableGroup(origin)).fill('gray');
|
||||
}
|
||||
else {
|
||||
alert("Can't transfer a table to itself.");
|
||||
transferModeOff();
|
||||
}
|
||||
}
|
||||
function mergeModeOn() {
|
||||
transferModeOff();
|
||||
if (!mergeMode) {
|
||||
mergeMode = true;
|
||||
$('.mergeButton').addClass('active');
|
||||
$('.mergeButton').text('Select a table to merge with Table ' + selectedTableNumber);
|
||||
parentMergeTable = selectedTableNumber;
|
||||
}
|
||||
else {
|
||||
mergeModeOff();
|
||||
}
|
||||
}
|
||||
function mergeModeOff() {
|
||||
mergeMode = false;
|
||||
$('.mergeButton').removeClass('active');
|
||||
$('.mergeButton').text(lang('merge_table'));
|
||||
}
|
||||
let ajaxMergeTables = (parent, child) => {
|
||||
return ajaxSync(`/ajax/mergeTables/${parent}/${child}`, null, 'GET');
|
||||
};
|
||||
let ajaxUnmergeTable = (parent) => {
|
||||
return ajaxSync(`/ajax/unmergeTable/${parent}`, null, 'GET');
|
||||
};
|
||||
function mergeTables() {
|
||||
parentMergeTable = parseInt(parentMergeTable);
|
||||
childMergeTable = parseInt(childMergeTable);
|
||||
if (childMergeTable !== parentMergeTable) {
|
||||
let result = ajaxMergeTables(parentMergeTable, childMergeTable);
|
||||
mergeModeOff();
|
||||
loadRoom(currentRoom);
|
||||
newTable = getTableGroup(parentMergeTable);
|
||||
newTable.draggable(true);
|
||||
if (tableIsOpen(parentMergeTable)) {
|
||||
getTableShape(newTable).fill('lightblue');
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("Can't merge a table with itself!");
|
||||
mergeModeOff();
|
||||
}
|
||||
}
|
||||
//When a table is passed (a group of the shape plus the text), returns the number as string.
|
||||
function getTableNumber(tableGroup) {
|
||||
textItem = tableGroup.getChildren()[1];
|
||||
return textItem.getText();
|
||||
}
|
||||
function getTableGroup(tableNumber) {
|
||||
return stage.find('#' + tableNumber)[0];
|
||||
}
|
||||
function getTableShape(tableGroup) {
|
||||
return tableGroup.getChildren()[0];
|
||||
}
|
||||
function getReservation(id) {
|
||||
return ajaxSync('/ajax/getReservation', id);
|
||||
}
|
||||
//When a user selects a table.
|
||||
function selectTableShape(table) {
|
||||
let tableNumber = getTableNumber(table);
|
||||
let shape = getTableShape(table);
|
||||
let strokeColor = shape.stroke();
|
||||
selectedTable = table;
|
||||
selectedTableNumber = tableNumber;
|
||||
if (transferMode)
|
||||
transferTables();
|
||||
if (mergeMode) {
|
||||
childMergeTable = tableNumber;
|
||||
mergeTables();
|
||||
}
|
||||
else {
|
||||
//If table is not selected
|
||||
if (strokeColor !== "yellow") {
|
||||
let tableData = getTableData(selectedTableNumber);
|
||||
let coverNumberString = lang('covers', tableData.default_covers.toString());
|
||||
let tableString = '<b>' + lang('activeTable', selectedTableNumber.toString()) + '</b>';
|
||||
$('.reserveTableButton').text(lang('reserve_table'));
|
||||
if (tableData.status === 'reserved') {
|
||||
let reservation = getReservation(tableData.reservation_id);
|
||||
console.log(reservation);
|
||||
$('.reserveTableButton').text(lang('unreserve_table'));
|
||||
if (reservation.reservation_name) {
|
||||
reservationString = lang('reserved_for', reservation.reservation_name);
|
||||
}
|
||||
else {
|
||||
reservationString = lang('reserved');
|
||||
}
|
||||
tableString += '<small>' + reservationString + '</small>';
|
||||
}
|
||||
tableString += "<small> (" + coverNumberString + ")</small>";
|
||||
$('.currentTable').html(tableString);
|
||||
stage.find('Rect').forEach(function (rect, index) {
|
||||
rect.stroke("black");
|
||||
});
|
||||
stage.find('Ellipse').forEach(function (circ, index) {
|
||||
circ.stroke("black");
|
||||
});
|
||||
shape.stroke("yellow");
|
||||
toggleEditControls(true);
|
||||
if (editMode) {
|
||||
toggleFloorplanControls();
|
||||
$('.deleteDecoration').css('display', 'none');
|
||||
transformer.nodes([getTableShape(table)]);
|
||||
table.moveToTop();
|
||||
transformer.moveToTop();
|
||||
}
|
||||
tableLayer.draw();
|
||||
//If the table is already selected
|
||||
}
|
||||
else {
|
||||
resetActiveTable();
|
||||
transformer.nodes([]);
|
||||
tableLayer.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
let getTableData = (tableNumber) => {
|
||||
return ajaxSync('/ajax/getTableData', tableNumber);
|
||||
};
|
||||
let isTableMerged = (tableNumber) => {
|
||||
let mergeData = getTableData(tableNumber).merged_children;
|
||||
return mergeData !== "";
|
||||
};
|
||||
function resetActiveTable() {
|
||||
if (!transferMode) {
|
||||
if (selectedTable) {
|
||||
getTableShape(selectedTable).stroke('black');
|
||||
}
|
||||
selectedTable = null;
|
||||
selectedTableNumber = "";
|
||||
toggleFloorplanControls(false, editMode);
|
||||
toggleEditControls(false);
|
||||
}
|
||||
else {
|
||||
$('.editControls').css('display', 'none');
|
||||
}
|
||||
}
|
||||
function addDecoration(button) {
|
||||
let insertData = {
|
||||
decoration_room: currentRoom,
|
||||
basis: basis,
|
||||
decoration_image: $(button).data('image')
|
||||
};
|
||||
ajaxSync('/ajax/addDecoration', insertData);
|
||||
$('#decorator').css('display', 'none');
|
||||
selectedDecoration = false;
|
||||
loadRoom(currentRoom);
|
||||
}
|
||||
function deleteDecoration(decoration) {
|
||||
ajax('/ajax/deleteDecoration', decoration.id());
|
||||
$('.deleteDecoration').css('display', 'none');
|
||||
decoration.destroy();
|
||||
selectedDecoration = false;
|
||||
transformer.nodes([]);
|
||||
}
|
||||
function saveDecTransformation(decoration) {
|
||||
let newData = {
|
||||
decoration_id: decoration.id(),
|
||||
decoration_pos_x: decoration.x() / scale,
|
||||
decoration_pos_y: decoration.y() / scale,
|
||||
decoration_width: parseInt((decoration.scaleX() * decoration.width()) / scale),
|
||||
decoration_height: parseInt((decoration.scaleY() * decoration.height()) / scale),
|
||||
decoration_rotation: parseInt(decoration.rotation()),
|
||||
decoration_image: decodeURIComponent(decoration.image().src),
|
||||
decoration_room: currentRoom
|
||||
};
|
||||
if (editMode) {
|
||||
idToSelect = decoration.id();
|
||||
}
|
||||
ajax('/ajax/updateDecoration', newData);
|
||||
}
|
||||
//When a table has been resized, rotated etc.
|
||||
function saveTransformation(table) {
|
||||
tableNumber = getTableNumber(table);
|
||||
shape = getTableShape(table);
|
||||
newRotation = parseInt(shape.rotation());
|
||||
newWidth = parseInt(shape.scaleX() * shape.width() / scale);
|
||||
newHeight = parseInt((shape.scaleY() * shape.height()) / scale);
|
||||
newXPos = parseInt(table.x() / scale);
|
||||
newYPos = parseInt(table.y() / scale);
|
||||
updateData = {
|
||||
table_number: tableNumber,
|
||||
rotation: newRotation,
|
||||
width: newWidth,
|
||||
height: newHeight,
|
||||
pos_x: newXPos,
|
||||
pos_y: newYPos
|
||||
};
|
||||
transformTable(updateData);
|
||||
}
|
||||
let transformTable = (tableData) => {
|
||||
return ajax("/ajax/transformTable", tableData);
|
||||
};
|
||||
function unmergeTable() {
|
||||
ajaxUnmergeTable(selectedTableNumber);
|
||||
loadRoom(currentRoom);
|
||||
}
|
||||
function reserveTable(covers) {
|
||||
if (!covers) {
|
||||
showVirtualNumpad(lang('how_many_covers'), 2, false, false, true, reserveTable);
|
||||
}
|
||||
else {
|
||||
let table = getTableGroup(selectedTableNumber);
|
||||
let newReservation = ajaxSync('/ajax/newEmptyReservation', selectedTableNumber);
|
||||
table.fire('click');
|
||||
let tableShape = getTableShape(table);
|
||||
tableShape.fill('lightgreen');
|
||||
table.draw();
|
||||
table.fire('click');
|
||||
completeReservation(newReservation);
|
||||
}
|
||||
}
|
||||
function unreserveTable(input) {
|
||||
if (!input) {
|
||||
confirm(lang('confirm_delete_reservation', selectedTableNumber), selectedTableNumber, lang('confirm'), unreserveTable);
|
||||
}
|
||||
else {
|
||||
ajaxSync('/ajax/unreserveTable', input);
|
||||
hideAlerts();
|
||||
table = getTableGroup(input);
|
||||
table.fire('click');
|
||||
tableShape = getTableShape(table);
|
||||
tableShape.fill('gray');
|
||||
table.draw();
|
||||
table.fire('click');
|
||||
}
|
||||
}
|
||||
function completeReservation(resName) {
|
||||
if (!resName) {
|
||||
showVirtualKeyboard(lang('enter_reservation_name'));
|
||||
}
|
||||
else {
|
||||
//callPhpFunction('updateTableMapTable', [selectedTableNumber, 'reservation_name', resName]);
|
||||
loadRoom(currentRoom, selectedTableNumber);
|
||||
}
|
||||
}
|
||||
function toggleEditMode() {
|
||||
let editModeButton = $('.editModeButton');
|
||||
if (editMode === true) {
|
||||
editMode = false;
|
||||
loadRoom(currentRoom);
|
||||
editModeButton.removeClass('active');
|
||||
editModeButton.html(lang('edit_floorplan'));
|
||||
toggleFloorplanControls(false);
|
||||
if (selectedTable)
|
||||
selectedTable.fire('click');
|
||||
stage.find('Group').forEach(function (table, index) {
|
||||
table.draggable(false);
|
||||
});
|
||||
}
|
||||
else {
|
||||
editMode = true;
|
||||
stage.find('Group').forEach(function (table, index) {
|
||||
table.draggable(true);
|
||||
if (getTableShape(table).stroke() === "yellow") {
|
||||
table.moveToTop();
|
||||
transformer.nodes([getTableShape(table)]);
|
||||
transformer.moveToTop();
|
||||
}
|
||||
});
|
||||
stage.find('Image').forEach(function (img, index) {
|
||||
img.draggable(true);
|
||||
});
|
||||
toggleFloorplanControls();
|
||||
transformer.moveToTop();
|
||||
tableLayer.draw();
|
||||
editModeButton.addClass('active');
|
||||
editModeButton.html(lang('stop_edit_floorplan'));
|
||||
}
|
||||
}
|
||||
function toggleFloorplanControls(onOrOff = true, subControlsOnly = false) {
|
||||
if (onOrOff || subControlsOnly) {
|
||||
$('.floorplanControls').css('visibility', 'visible');
|
||||
}
|
||||
else {
|
||||
$('.floorplanControls').css('visibility', 'hidden');
|
||||
}
|
||||
if (selectedTable) {
|
||||
$('.changeShapeButton').css('visibility', 'visible');
|
||||
$('.deleteTableButton').css('visibility', 'visible');
|
||||
}
|
||||
else {
|
||||
$('.changeShapeButton').css('visibility', 'hidden');
|
||||
$('.deleteTableButton').css('visibility', 'hidden');
|
||||
}
|
||||
if (selectedDecoration) {
|
||||
$('.deleteDecoration').css('display', 'flex');
|
||||
}
|
||||
else {
|
||||
$('.deleteDecoration').css('display', 'none');
|
||||
}
|
||||
}
|
||||
let tableIsOpen = (tableNumber) => {
|
||||
return ajaxSync(`/ajax/tableIsOpen/${tableNumber}`, null, 'GET');
|
||||
};
|
||||
function toggleEditControls(onOrOff = true) {
|
||||
if (onOrOff) {
|
||||
$('.editControls').css("display", "flex");
|
||||
if (isTableMerged(selectedTableNumber)) {
|
||||
$('.mergeControls').css("visibility", "visible");
|
||||
$('.unmergeButton').css('display', 'flex');
|
||||
$('.mergeButton').css('display', 'flex');
|
||||
}
|
||||
else {
|
||||
$('.mergeControls').css("visibility", "visible");
|
||||
$('.mergeButton').css('display', 'flex');
|
||||
$('.unmergeButton').css('display', 'none');
|
||||
}
|
||||
if (tableIsOpen(selectedTableNumber)) {
|
||||
$('.payTableButton').css('display', 'flex');
|
||||
$('.viewTableButton').css('display', 'flex');
|
||||
$('.reserveTableButton').css('display', 'none');
|
||||
$('.transferTableButton').css('display', 'flex');
|
||||
}
|
||||
else {
|
||||
$('.payTableButton').css('display', 'none');
|
||||
$('.viewTableButton').css('display', 'none');
|
||||
$('.reserveTableButton').css('display', 'flex');
|
||||
$('.transferTableButton').css('display', 'none');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('.editControls').css("display", "none");
|
||||
$('.mergeControls').css("visibility", "hidden");
|
||||
$('.mergeButton').css("display", "none");
|
||||
$('.unmergeButton').css("display", "none");
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=dredgepos.floorplan.js.map
|
||||