"use strict"; var orders, ono = 0, staff = 0, lst = '', xT = null; //XXXX ckOrders(); function svgUp() { return ''; } function svgDn() { return ''; } function setPT() { var d = new Date(), t = d.getTime(); localStorage.setItem('pt', t); document.formProducts.submit(); } function ckPT() { var h, d = new Date(), tN = d.getTime(), tO = localStorage.getItem('pt'); h = (tN - tO) / 1000 / 60 / 60; if (h > 6) { // reload timer setPT(); } } //setPT(); //ckOrders(); //function ckOrdersN() { // var mon, arr0 = orders[0]; // if (arr0[0]['oid'] == 0) { // mon = JSON.parse(localStorage.my_orders_new); // arr0.unshift(mon); // // mon.unshift(arr0); // // orders = arr0.concat(mon); // localStorage.removeItem('my_orders_new'); // } else { // orders = JSON.parse(localStorage.my_orders_new); // } // strO(); //} function ckOrders() { try { orders = JSON.parse(localStorage.my_orders); } catch (err) { orders = []; newOrder(); } } function strO() { localStorage.setItem('my_orders', JSON.stringify(orders)); } function getStaff() { return [0, 'my_orders']; } function orderNow() { var i, tItem, tOrder = orders[0]; for (i = 1; i < tOrder.length; i++) { tItem = tOrder[i]; if (tItem['status'] == 0) { tItem['status'] = 1; if (tItem['iid'] > 0) { updateItem(i, 'status'); } } } strO(); updateOrder(); showItems(0); } function updateMeta(column, value) { tOrder = orders[0][0], tMeta = tOrder[0]; tMeta[column] = value; tMeta['update'].indexOf(column) === -1 ? tMeta['update'].push(column) : ''; strO(); } function updateItem(ino, column) { var i, tOrder = orders[0], tItem = tOrder[ino], iid = tItem['iid']; // if (iid > 0) { tItem['update'].indexOf(column) === -1 ? tItem['update'].push(column) : ''; // } } function updateOrder() { var i, j, k, tO, tM, oid, update, ui, uc, uv, status, // sql_new_order = [], sql_update_order = [], sql_new_items = [], sql_update_items = []; tO = orders[0]; tM = tO[0]; oid = tM['oid']; if (oid > 0) { if (tM['update'].length > 0) { for (j = 0; j < tM['update'].length; j++) { ui = tM['oid']; // id uc = tM['update'][j]; uv = tM[uc]; update = [ui, uc, uv]; sql_update_order.push(update); } } for (j = 1; j < tO.length; j++) { if (tO[j]['iid'] == 0) { tO[j]['oid'] = tM['oid']; sql_new_items.push(tO[j]); // } } else { if (tO[j]['update'].length > 0) { for (k = 0; k < tO[j]['update'].length; k++) { ui = tO[j]['iid']; // id uc = tO[j]['update'][k]; uv = tO[j][uc]; update = [ui, uc, uv]; sql_update_items.push(update); } } } } $('sql_oid').value = oid; $('sql_update_order').value = JSON.stringify(sql_update_order); $('sql_msg_no').value = usr.msg_no; $('sql_new_items').value = JSON.stringify(sql_new_items); $('sql_update_items').value = JSON.stringify(sql_update_items); // alert('formSub'); document.formUPO.submit(); } } function newOrder() { var no = [{ oid: 0, cid: uid, uid: 0, wid: 0, name: '', nickname: '', location: 0, note: '', wstat: 0, status: 0, updated: 0, update: [], deleted: 0, date: newDate() }]; orders.unshift(no); strO(); } function showMenus() { //'m' + var i, mid, disp, cks, pos, m = ''; for (i = 0; i < menus.length; i++) { mid = menus[i][0]; disp = menus[i][ln]; cks = checkSubM(mid); pos = cks[0]; if (cks[0] == 1) { mid = cks[1]; pos = 0; } mid = 'm' + mid; if (cks[0] > 0) { if (pos == 0) { m += '' + disp + ''; } else { m += '' + disp + ''; } } } // $('hideforlist').removeAttribute('class'); $('ephoto').innerHTML = ''; $('mItems').innerHTML = ''; $('mCats').innerHTML = m; $('mCats').className = 'topNav'; // $('topMenu').className = 'topMenu'; $('editDiv').className = 'disN'; $('topNav').className = 'disN'; $('tabEdit').className = 'disN'; $('savei').className = 'disN'; $('closei').innerHTML = 'close'; // $('topNav').innerHTML = '' + l[0] + ''; } function setName() { if ($('logoutDiv').className == 'disN') { $('logoutDiv').removeAttribute('class'); $('name_c').innerHTML = 'name'; $('email_c').innerHTML = 'email'; if (usr.email != '') { $('remove_c').innerHTML = 'remove'; } } else { $('logoutDiv').className = 'disN'; } } function addNote(x) { var i, note, exnote, noteA, t1, t2, ct = 0; exnote = $('note' + x).innerHTML; note = prompt(l[42], exnote); if (note != null) { note = note.match(/.{1,25}/g); note = note.join(' '); } $('note' + x).innerHTML = note; } function addName() { var p, uname, name = true; while (name) { p = prompt('e.g. Juan Garcia, Juan G, J Garcia', usr.name); if (p) { p = p.trim(); p = p.toLowerCase(); if (p == 'tanya218' || p == 'dany219' || p == 'caesar220' || p == 'john221') { uname = p.charAt(0).toUpperCase() + p.slice(1); uname = uname.substr(0, uname.length - 3) usr.email = uname + '@dirt1.xyz'; usr.staff = 3; usr.idioma = 2; usr.lang = 2; usr.uid = p.substr(-3, 3); usr.nickname = uname; usr.name = uname; localStorage.setItem('usr', JSON.stringify(usr)); name = false; location = 'staff.html'; // loadPage(); } else { if (p.split(' ').length < 2) { alert('need two names'); } else { name = false; usr.name = p; $('addName').innerHTML = p; showSnack('snackG', 'Welcome ' + p, 1000); localStorage.setItem('usr', JSON.stringify(usr)); if (usr.uid > 1) { updateUser('clients_name', p); } // getRate } } } else { name = false; } } strO(); // $('acct').value = 0; } //function showHistory() { // $('acct').value = 0; //} function closeFoto(x) { if (orders[0][0]['status'] == 6) { newOrder(); } $('foto').className = 'disN'; $('foto').innerHTML = ''; } function isPaid() { var tOrder = orders[ono], tMeta = tOrder[0]; tMeta['status'] = 5; tMeta['update'].indexOf('status') === -1 ? tMeta['update'].push('status') : ''; $('payNow').className = 'disN'; showSnack('snackG', 'PAID', 1000); showItems(); } //function saveOrder() { // tOrder[0].status = 5; // tOrder[0].date = newDate(); // newOrder(); // loadMenu(); //} function reOpen() { var p = confirm(l[78]); if (p) { tOrder.status = 0; strO(); goTab(-1); } } function setStat(z) { tOrder.status = z; strO(); goTab(2); } //function g b(x, y) { // if (x > 0) { // orders[0][0]['oid'] = x; // orders[0][0]['location'] = y; // strO(); // } else { // showSnack('snackR', 'Order Number Not Found', 0); // } // showItems(); //} function xOID() { var x = orders[0][0]; x.oid = Math.abs(x.oid); strO(); } function cancelOrder() { var agree = confirm(l[41]); if (agree) { tOrder[0].status = 6; strO(); goTab(2); } } function deleteOrder() { // var agree = confirm(l[125]); // if (agree) { // order.splice[ono, 1]; // strO(); // goTab(2); // } } function noPunter() { tOrder.cid = 0; tOrder.name = ''; tOrder.nickname = ''; loadMenu(); } function pay() { var agree = confirm(l[44]); if (agree) { tOrder.status = 5; strO(); goTab(2); } } function updateUser(x, y) { var upeep = getUpeep(); upeep.push([x, y, usr.uid, usr.uid]); localStorage.setItem('upeep', JSON.stringify(upeep)); } function addPhone() { var p = prompt('10 digit tel', usr.phone); if (p) { if (p.match(tmatch()) == null) { // alert(l[68]); alert('not found'); // >>> refine with spaces, count, letters, reopen the popup } else { usr.phone = p; localStorage.setItem('usr', JSON.stringify(usr)); sendCode(p); strO(); } } $('acct').value = 0; } function addEmail() { var p = prompt('log in'), un1, un2, uname; if (p) { p = p.toLowerCase(); if (p == 'tanya218' || p == 'dany219' || p == 'caesar220' || p == 'john221') { uname = p.charAt(0).toUpperCase() + p.slice(1); uname = uname.substr(0, uname.length - 3) usr.email = uname + '@dirt1.xyz'; usr.staff = 3; usr.idioma = 2; usr.lang = 2; usr.uid = p.substr(-3, 3); usr.nickname = uname; usr.name = uname; localStorage.setItem('usr', JSON.stringify(usr)); document.location = "/staff.html"; } else { alert("not found"); } } } // t 218 // d 219 // c 220 //if (p.match(pattern()) == null) { // alert(l[68]); // } else { // usr.email = p; // localStorage.setItem('usr', JSON.stringify(usr)); // strO(); // } // $('acct').value = 0; function sendMsg(x) { var str, p = prompt('Please, may I have . . .'); if (p) { $('msg').value = p; // checkMsg(x); showSnack('snackG', l[157] + '
' + l[158], 2000); } } function checkMsg(x) { var tOrder = orders[0], tMeta = tOrder[0], oid = tMeta['oid']; $('cid').value = usr.id; $('oid').value = tMeta['oid']; document.formMsg.send(); } function loadMsg(x) { var tOrder = orders[0], tMeta = tOrder[0], oid = tMeta['oid']; $('cid').value = usr.id; $('oid').value = tMeta['oid']; document.formMsg.send(); } // 1. tid = fid and done = 0 // 2. if p != '' -- t = 0 function unknown() { // var x = '
< // div id = "codesent" // class = "fR2 s12 i p5" > < /div> < // span id = "cancel" // onclick = "noCode()" // class = "greyLink cour mr20" > < /span> < // input type = "text" // onkeyup = "checkCode()" // name = "checkcode" // id = "checkcode" // class = "aC m2 f9 disL mr20 w100 s14" > // < // span id = "re-send" // onclick = "resendCode()" // class = "blueLink cour" > < /span> < / // div > '; } function logIN() { setCodeBox(); } function setCodeBox() { $('codeboxDiv').className = 'w100p aC'; //removeAttribute('class'); $('checkcode').placeholder = l[106]; $('codesent').innerHTML = 'login code sent to ' + usr.email; $('re-send').innerHTML = 're-send'; $('cancel').innerHTML = 'cancel'; $('loginDiv').innerHTML = ''; $('checkcode').value = ''; } function sendCode(x) { $('email').value = x; $('code').value = Math.floor(Math.random() * 9000) + 1000; //Math.sqrt(Math.PI * usr.code); $('name').value = "John"; //usr.name; $('from_email').value = 'john@ieprz.com'; $('from_name').value = 'no - reply'; $('loginDiv').innerHTML = svgLoad(); //$('loginDiv').className = 'disN'; //$('codeboxDiv').className = 'disN'; document.formLogin.submit(); } function resendCode() { var email = usr.email; var x = confirm(l[107]); if (x == true) { sendCode(email); } } function noCode() { usr.code = 0; localStorage.setItem('usr', JSON.stringify(usr)); $('loginDiv').className = 'disN'; } function ckName() { } function focusONO() { if (usr.name == '') { showSnack('snackG', l[69], 1200); // name please $('ckono').blur(); } else { showSnack('snackG', l[159], 1200); // 3 numbers $('ckono').className = 'ckono1'; } } function ckONO() { var cfm, to, ck0 = $('ckono'), ck1 = ck0.value, ck1 = ck1.trim(ck1), ck1 = ck1.replace(/\D/g, ''); ck0.removeAttribute("onfocus"); if (ck1.length == 3) { // ck0.className = 'ckonox'; cfm = l[162] + '\n\n' + ck1; if (confirm(cfm) == true) { showSnack('snackT', l[163], 2000); to = setTimeout(foid, 2000); function foid() { $('sql_cid').value = usr.uid; $('sql_get_oid').value = ck1; formOID.submit(); } } else { ck0.value = ''; ck0.disabled = false; ck0.focus(); } } else { ck0.value = ck1; // console.log('false'); } } // mod for demo function askServer() { var oid, n = usr.name; if (n == '') { showSnack('snackG', l[69], 1000); } else { oid = prompt(l[159]); if (oid != null) { ckONO(oid); } } } function noID() { var ck0 = $('ckono'), myTimeout = showSnack('snackR', 'wrong number', 2000); ck0.value = ''; ck0.disabled = false; } function uID() { return Math.random().toString(16).slice(2); } function subOne(ino) { var tOrder = orders[ono], tItem = tOrder[ino]; $('product' + ino).className = 'itemX'; $('lsub' + ino).className = 'disN'; tItem['status'] = 3; if (tItem['iid'] > 0) { updateItem(ino, 'status'); } strO(); showSnack('snackG', 'canceled', 1000); showItems(0); } //function showLineO(x) { // var lsub = $('lsub' + x).className; // showItems(); // if (lsub == 'disN') { // $('lsub' + x).className = 'w50 aC'; // $('ladd' + x).className = 'disN'; // } else { // $('ladd' + x).className = 'w50 aC'; // $('lsub' + x).className = 'disN'; // } //} function showLineO(i) { var tOrder = orders[ono], tItem = tOrder[i], oCK = tItem['ops'], opsE = $('opsE' + i), eTD = opsE.getElementsByTagName("td")[0], x = $('svu' + i).className, y = $('product' + i).className; if (y == 'itemX') { unSub(i); } else { //lll showItems(); console.log('else'); console.log(x) // showItems(0, i); if (x == 'disN') { $('edititem' + i).className = 'body1'; $('opsE' + i).className = 'p10'; $('ladd' + i).className = 'disN'; $('lsub' + i).className = 'lsub'; $('svu' + i).className = 'flr mt5'; $('svd' + i).className = 'disN'; $('opsD' + i).className = 'disN'; $('noteD' + i).className = 'disN'; $('blurb' + i).className = 'blurb'; $('noteE' + i).className = ''; $('details' + i).className = ''; } } } function showItems(z) { //-> 463 z = z || 0; var i, k, x, citem, wstat, istat, nstat, oclass, tItem, id, note, unq, qty, product, sproduct, dPrice, ckd, oMeta, opsD, opsDc, ops, opsE, statC, statA, cmbU, location, pid, spid, iid, priceD, min, minC, xClass, hm, cb0, cb1, cb2, cb3, statD, iitem, pbar, pstat, sve, drp, drpd, ladd, cat, soc, sos, sxc, sxs, s_drop1, s_drop2, s_name, s_id, sel, noteE, noteD, noteDc, closeNote, details, fotoC, closeOptions, oprice, foto, desc, plate, detailsC, fotoC, descC, opsI, blurb, blurbC, iNav, iNav1, iNav2, iNav3, tBdy, productC, delC, orderItems, totalItems, price, status, s_noteD, s_noteE, tMnote, tol, sel_from, keep_weird, ckO, ict, gT = 0, s_onC = 'disN', s_coC = 'disN', s_naC = 'disN', locNo = 0, dupe = sessionStorage.getItem('dupe'), locD = 'location', locClass = 'f3', onow = '', lastItem = 0, ict = 0, ict0 = 0, ict1 = 0, sOrder = [], align = 'aL', oItems = '', iNav, totalprice = 0, tOrder = orders[ono], tMeta = tOrder[0], ostat = tMeta.status, location = tMeta.location, nameD = tMeta.nickname, oid = tMeta.oid, vid = '00' + oid, statA = ['disN', 'fG1', 'fO1', 'fBr', 'disN'], // svgX = '< svg class="svgX" width="6" height="6">', svgA = svgAdd(), svgX = svgXX(), svgUu = svgUp(), svgDd = svgDn(), classA = ['f0', 'bgEF f9', 'bgG1 f9', 'linet']; // $('choosePunter').className = 'disN'; // $('choosePunter').innerHTML = ''; // window.scrollTo(0, 0); cb0 = z == 0 ? 'cbO' : 'cb-'; cb1 = z == 1 ? 'cbO' : 'cb-'; cb2 = z == 2 ? 'cbO' : 'cb-'; cb3 = z == 3 ? 'cbO' : 'cb-'; for (i = 1; i < tOrder.length; i++) { status = tOrder[i]['status']; if (status != 3) { if (tOrder[i]['pid'] > 0) { const car = { pid: tOrder[i]['pid'], item: tOrder[i]['item'] }; sOrder.push(car); if (status == 0) { ict0++; } else { ict1++; } ict++; gT += Number(tOrder[i]['price']); } } } // ict0 = 1; // ict1 = 0; // if (ict0 > 0 && ict1 > 0) { // if (ict0 < 2) { // // } // } sessionStorage.setItem('AZ', 0); nameD = nameD || tMeta.name; nameD = nameD || 'name'; s_id = '#' + vid.substr(-3); s_id += '' + svgX + ''; s_id += ''; s_name = '' + nameD + ''; noteDc = tMnote == '' ? 'disN' : 'noteDc'; iNav = ''; iNav += ''; iNav += ''; iNav += ''; if (oid == 0 || location == 0) { iNav += ''; //ask for order no // iNav += ''; //ask for order no } else { if (ict0 == 0) { // if (ict == 0) { iNav += ''; iNav += ''; iNav += '
'; iNav += '$' + gT.toLocaleString('en-US', { maximumFractionDigits: 0 }); iNav += ''; iNav += '' + l[151] + ''; iNav += '' + l[152] + ''; iNav += '' + l[139] + '' + oid; //pay now // } else { // iNav += '' + l[140]; // } } } else { onow = ict0 > 0 && ict1 == 0 ? l[138] : l[137]; //add to order place order iNav += '' + onow; } } //end mod iNav += '
'; orderItems = ''; totalItems = '
'; if (z > 0) { sOrder.sort(function (a, b) { if (a.item < b.item) return -1; if (a.item > b.item) return 1; }); if (z == 2) { var sList = sOrder.reduce((acc, o) => (acc[o.item] = (acc[o.item] || 0) + 1, acc), {}); for (const k in sList) { qty = `${sList[k]}`; totalItems += ''; } } totalItems += '
' + k + ' ×' + qty + '
'; totalItems = iNav + totalItems; $('oItems').innerHTML = totalItems; } // normal list if (z == 0 || z == 3) { for (i = 1; i < tOrder.length; i++) { tItem = tOrder[i]; iid = tItem.iid; if (tItem.pid > 0) { pid = tItem.pid; price = Number(tItem.price); totalprice += price; oprice = Number(tItem.oprice); product = tItem.item; note = tItem.note; istat = tItem.status; wstat = tItem.wstat; min = dateMin(tItem.date); hm = dHM(tItem.date); oclass = classA[istat]; iitem = getProduct(pid); cat = iitem[5]; soc = iitem[12]; sos = iitem[13]; sxc = iitem[14]; sxs = iitem[15]; foto = iitem[8]; blurb = iitem[2 + ln]; plate = iitem[9 + ln]; noteD = ''; opsD = ''; opsE = ''; statC = ''; statD = ''; xClass = 'disN'; minC = 'disN'; delC = 'disN'; productC = 'flL'; if (istat != 3) { if (cat == 1) { product += ' Martini'; } ops = getOps(pid, cat, soc, sos, sxc, sxs, i); // gt += price; opsI = tItem.ops; if (opsI != '') { for (k = 0; k < opsI.length; k++) { opsD += options[opsI[k]][ln] + ' '; } } if (istat == 5) { delC = 'delC'; } if (istat == 2) { minC = 'minC0'; if (min > 100) { minC = 'minC1'; }; } if (istat == 3 || istat == 4) { productC = 'itemX'; } // if (istat == 5) { // productC = 'fll f9'; // } // statD = '◉'; if (foto == '') { foto = 'no foto'; } else { foto = 'view'; } tBdy = 'body0'; ckO = ''; if (istat > 0) { tBdy = 'body1'; productC = 'op5 fll'; ckO = '✓'; opsDc = 'opsDcx'; // // if (ostat > 1) { // if (istat == 2 || istat == 5) { // if (ict0 > 0) { // tBdy = 'body1'; // productC = 'flL9'; // } // } // if (istat == 3) { // xClass = 'ckOn'; // min = ''; // minC = 'lm0'; // statD = '◉'; // } } min = min < 1 ? 1 : min; opsDc = opsD == '' ? 'disN' : 'opsDc'; noteD = note == '' ? '' : '-' + note; noteDc = note == '' ? 'disN' : 'ml10 i bgY1 f9 s14'; details = 'ordered by you @ 12: 22'; if (z == 0) { //sss orderItems += ''; orderItems += ''; orderItems += '' + product + '$' + price + ''; orderItems += '' + blurb + ''; orderItems += ' ' + ckO + '
' + opsD + '' + noteD + '
'; orderItems += '' + svgUu + ''; orderItems += '' + svgDd + ''; orderItems += ''; orderItems += '' + svgA + ''; orderItems += '' + svgX + ''; orderItems += ''; orderItems += ''; orderItems += '' + ops + ''; orderItems += ''; orderItems += '' + foto + '   ' + details + ''; orderItems += ''; } else { orderItems += ''; orderItems += '' + product; // orderItems += 'waiter'; orderItems += '' + price.toLocaleString('en-US', { maximumFractionDigits: 0 }) + ''; // orderItems += '' + hm + ''; orderItems += '' orderItems += ''; } } } } tol = 12 - tOrder.length; for (i = 1; i < tol; i++) { sel_from = 'disN'; keep_weird = 'disN'; if (tOrder.length == 1) { if (i == 2) { sel_from = ''; } if (i == 3) { keep_weird = 'weird'; } } orderItems += '  '; orderItems += '' + l[146] + ' '; } orderItems += z == 0 ? '' : 'total ' + gT.toLocaleString('en-US', { maximumFractionDigits: 0 }) + ''; orderItems += ''; orderItems += ''; $('oItems').innerHTML = iNav + orderItems; window.scrollTo(0, 0); } // if (oid > 0) $('s_no').innerHTML = '$' + gT.toLocaleString('en-US', { // maximumFractionDigits: 0 // }) } // logIN(); // orderID(); $('topNav').className = "topNav"; $('oItems').removeAttribute('class'); // $('s_tot').innerHTML = gt; //gt; z = z || 0; function goTab() { // var tOrder = orders[ono]; $('catNav').className = 'disN'; $('topNav').className = 'topNav'; $('mCats').className = 'disN'; $('oItems').className = ''; $('mItems').className = 'disN'; showItems(); scrollTo(0, 0); // $('hideforcats').removeAttribute('class'); // $('oItems').className = ''; // $('hideforus').removeAttribute('class'); // $('aboutus').className = 'disN'; } function setIndex(x) { $('mm1').className = 'tabOff'; $('mm2').className = 'tabOff'; $('mm3').className = 'tabOff'; $('mm' + x).className = 'tabOn'; $('mv1').className = 'disN'; $('mv2').className = 'disN'; $('mv3').className = 'disN'; $('mv' + x).removeAttribute('class'); } function setPrice(x) { var y = $('opt' + x).value; $('price').innerHTML = y; } function setPaid(x) { orders[0][0]['oid'] = x; strO(); newOrder(); showItems(); } function setCID(x) { usr.uid = x; localStorage.setItem('usr', JSON.stringify(usr)); } function setOID(x) { var i, tOrder = orders[0], tMeta = tOrder[0]; tMeta['oid'] = x; for (i = 1; i < tOrder.length; i++) { tOrder['oid'] = x; } strO(); showItems(); } function acctAction() { var y = $('acct'), x = y.value; y.value = 0; if (x == 1) { changeLang() } else if (x == 4) { addEmail(); } else if (x > 10) { showHistory(x - 10); } else if (x == 6) { location = 'staff.html'; } } function notPaid() { $('payNow').className = 'disN'; // $('payframe').className = 'payframe0'; showItems(); } function payRequest() { orders[0][0]['status'] = 6; updateMeta('status'); strO(); $('payNow').className = 'disN'; showHistory(0); } function payNow() { // alert('pay'); var totalprice = $('iTable').getAttribute('data-ototal'); $('payNow').className = 'payNow'; $('paidBtn').innerHTML = l[155]; $('paidBtnx').innerHTML = l[156]; setPeso('peso'); showCC(); // document.formPP.submit(); } function changeLang() { ln = ln == 1 ? 2 : 1; usr.lang = ln; localStorage.setItem('usr', JSON.stringify(usr)); l = getLang(ln); $('lang').innerHTML = ln == 2 ? 'english' : 'español'; loadPage(); goTab(1); } function lineReset() { var i, x = $("mItems"), y = x.getElementsByTagName("tbody"), svgD = svgDn(); for (i = 0; i < y.length; i++) { // $('i' + i).removeAttribute('class'); // $('u' + i).className = 'disN'; // $('ladd0' + i).innerHTML = svgD; $('price' + i).className = 'disN'; $('tr' + i).className = 'disN'; // $('ladd1' + i).className = 'disN'; // $('opsE' + i).className = 'disN'; $('noteE' + i).className = 'disN'; // $('add' + i).className = 'disN'; // $('view' + i).className = 'disN'; // $('opsE' + i).className = 'disN'; // $('detailsR' + i).className = 'disN'; // $('product' + i).className = 'fll'; $('opsE' + i).className = 'disN'; $('edititem' + i).removeAttribute('class'); $('blurb' + i).className = 'disN'; $('product' + i).className = 'mTitle1'; $('star' + i).className = 'stars'; } } function showLine(i) { var x = $('noteE' + i).className; // svgU = svgUp(); lineReset(); if (x == 'disN') { // $('i' + i).className = 'disN'; // $('u' + i).removeAttribute('class'); // $('ladd0' + i).innerHTML = svgU; // $('ladd0' + i).className = 'addp' // $('add' + i).className = 'addp'; // $('view' + i).className = 'viewp'; $('tr' + i).className = ''; $('opsE' + i).className = 'opsE'; // $('ladd1' + i).className = 'ladd0'; // $('opsD' + i).className = 'disN'; $('product' + i).className = 'mTitle2'; $('price' + i).className = 'lprice'; if ($('blurb' + i).innerHTML != '') { $('blurb' + i).className = 'blurb'; } // $('lqty').className = 'disN'; $('edititem' + i).className = 'lEdit1'; $('noteE' + i).className = 'note'; $('star' + i).className = 'disN'; $('note' + i).focus(); // ('ladd0' + i).className = 'disN'; // $('ladd1' + i).className = 'disN'; // $('tr' + i).className = 'bgF'; // // $('spc' + i).className = 'disN'; // // $('ladd1' + i).className = 'ladd0'; // $('lsub' + i).className = 'lsub'; // $('opsD' + i).className = 'disN'; // $('noteD' + i).className = 'disN'; // $('noteE' + i).className = 'aC'; // $('noteD' + i).className = 'disN'; // // $('spc' + i).className = 'disN'; // $('detailsR' + i).removeAttribute('class'); // $('product' + i).className = 'fRB fll mt5 mb5'; // $('edititem' + i).className = 'lEdit1'; // $('note' + i).focus(); } } function setProducts(x) { //iOpt = (x.split(',')); var i, j, item, star, pid, cat, price, foto, prclass, incat, rowbg, az, options, soc, sos, sxc, sxs, ops, note, details, lAdd0, lAdd1, blurb, descC, plate, fotoC, blurbC, detailsC, lqty, y = 0, wrap1 = '', wrap2 = '', rct = 0, menuItems = '', pclass = 'ml10 cour', tCat = getCat(x.substr(1)), svgU = svgUp(), svgD = svgDn(), svgA = svgAdd(); // products = JSON.parse(localStorage.products); $('mItems').className = 'mItems'; $('oItems').innerHTML = ''; // $('lqty').className = 'lqty'; $('topNav').className = 'topNav'; $('mCats').className = 'disN'; $('hideforcats').className = 'disN'; navMenu(x); wrap1 = ''; wrap2 = '
'; products.sort(sortProduct); for (i = 0; i < products.length; i++) { item = products[i]; // if (item[5].indexOf(',') >= 0) { // incat = item[5].split(','); // } else { // incat = [Number(item[5])]; // } incat = [Number(item[5])]; if (incat[0] == x.substr(1)) { pid = item[0]; cat = item[5]; price = parseInt(item[7]); foto = item[8]; star = ''; soc = item[12]; sos = item[13]; sxc = item[14]; sxs = item[15]; blurb = item[2 + ln]; plate = item[9 + ln]; // if (plate == '') { // } ops = getOps(pid, cat, soc, sos, sxc, sxs, y, 'M'); // if(item[14] > 0) { // star = '*'; // } fotoC = 'ldetails0'; if (foto == '') { fotoC = 'ldetailsX'; } detailsC = 'ldetails0'; if (details == '' && plate == '') { detailsC = 'ldetailsX'; } // details = '$' + price + ''; // if (blurb == '' && plate == '') { // details += ' details '; // } else { // details += ' details '; // } // if (foto == '') { // details += ' photo '; // } else { // details += ' photo '; // } menuItems += ''; menuItems += ''; menuItems += ''; // menuItems += ''; // menuItems += ''; if (foto == '') { menuItems += 'no foto'; } else { menuItems += 'view'; } // menuItems += 'view'; // triange △ menuItems += '' + svgU + ''; // ▲ menuItems += 'add'; menuItems += ''; menuItems += ''; menuItems += ''; menuItems += '' + item[ln] + ''; menuItems += '$' + price + '  '; menuItems += ''; menuItems += ''; menuItems += ''; menuItems += ''; menuItems += '' + blurb + ''; menuItems += '' + ops + ''; // menuItems += ''; menuItems += ''; menuItems += '★   ★   ★'; // menuItems += ''; menuItems += ''; y++; } } menuItems += ''; $('mItems').removeAttribute('class'); $('mItems').innerHTML = wrap1 + menuItems + wrap2; scrollTo(0, 0) } function ckFocus() { // if marker for showItems A else B // var x = $('oItems').innerHTML == '' ? 'other' : 'ilist'; // var x = $('oItems').innerHTML == '' ? 'other' : 'ilist'; } function loadPage() { var i, hval, ttxt, wbar; $('tRow').innerHTML = '
' + l[133] + '
' + l[134] + '
' + l[135] + '
'; wbar = ''; wbar += ''; wbar += ''; wbar += ''; wbar += ''; wbar += '
'; wbar += ''; wbar += ''; wbar += usr.name || l[100]; wbar += '' + l[23] + '
'; $('wbar').innerHTML = wbar; setLang(); showItems(); }; const handleVisibilityChange = function () { if (document.visibilityState === 'visible') {} else { updateOrder(); } } document.addEventListener("visibilitychange", handleVisibilityChange); //function focused() { //} // //function notFocused() { //} //window.addEventListener('blur', notFocused); //window.addEventListener('focus', focused); //updateOrder(); //console.log(offce); window.addEventListener('load', setPT); window.addEventListener('load', updateOrder); window.addEventListener('load', setData); window.addEventListener('load', loadPage); //window.addEventListener('load', goTab(-1));