/
home
/
obinna
/
html
/
mixchief_app
/
var
/
cache
/
prod
/
twig
/
d2
/
Upload File
HOME
<?php use Twig\Environment; use Twig\Error\LoaderError; use Twig\Error\RuntimeError; use Twig\Extension\SandboxExtension; use Twig\Markup; use Twig\Sandbox\SecurityError; use Twig\Sandbox\SecurityNotAllowedTagError; use Twig\Sandbox\SecurityNotAllowedFilterError; use Twig\Sandbox\SecurityNotAllowedFunctionError; use Twig\Source; use Twig\Template; /* Default/oldIndex.html */ class __TwigTemplate_96bda1cfd329ea67322de7701069052cd8821715ae0be7037d8c68d69fa35b5b extends Template { private $source; private $macros = []; public function __construct(Environment $env) { parent::__construct($env); $this->source = $this->getSourceContext(); $this->parent = false; $this->blocks = [ ]; } protected function doDisplay(array $context, array $blocks = []) { $macros = $this->macros; // line 1 echo "<!DOCTYPE html> <html> <head> \t<title>EPOS</title> \t<link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 5 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("css/bootstrap.min.css"), "html", null, true); echo "\"> \t<link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 6 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("css/style.css"), "html", null, true); echo "\"> \t<script src=\""; // line 7 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("js/jquery.js"), "html", null, true); echo "\"></script> \t<script src=\""; // line 8 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("js/bootstrap.js"), "html", null, true); echo "\"></script> \t<script src=\""; // line 9 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("js/login-register.js"), "html", null, true); echo "\"></script> \t<script type=\"text/javascript\"> \t\tvar total; \t\t// var discount; \t\tfunction calculateTotal(){ \t\t\ttotal = 0; \t\t\tvar inputs = document.querySelectorAll('#saleList input'); \t\t\tfor (var i = 0; i < inputs.length; i++) { \t\t\t\ttotal += parseFloat(inputs[i].getAttribute('data-price')); \t\t\t} \t\t\tdocument.getElementById('total').innerHTML = total; \t\t} \t\tfunction calculateDiscount(){ \t\t\tvar discount = 0; \t\t\tvar inputs = document.querySelectorAll('#saleList input'); \t\t\tfor (var i = 0; i < inputs.length; i++) { \t\t\t\tdiscount += parseFloat(inputs[i].getAttribute('data-discount')); \t\t\t} \t\t\tdocument.getElementById('confirmDiscount').innerHTML = discount; \t\t} \t\t//clear the order list \t\tfunction clearList(){ \t\t\tdocument.getElementById('saleList').innerHTML = \"\"; \t\t\tcalculateTotal(); \t\t\t\$('#pay').hide(); \t\t\t\$('#saveOrder').hide(); \t\t\t\$('#deleteButton').hide(); \t\t\t\$('#discountButton').hide(); \t\t\t\$('#clearButton').hide(); \t\t} \t\tfunction deleteItems(){ \t\t\t//select all checked checkboxes \t\t\t//then loop through all of them getting all their siblings \t\t\t//then removing them from list \t\t\tvar checked = document.querySelectorAll('input:checked'); \t\t\tfor(var key in checked){ \t\t\t\tvar nexts = checked[key].nextSibling; \t\t\t\tif (nexts) { \t\t\t\t\tsaleList.removeChild(checked[key]); \t\t\t\t\tsaleList.removeChild(nexts); \t\t\t\t\tcalculateTotal(); \t\t\t\t\t\$('#deleteButton').hide(); \t\t\t\t\t\$('#discountButton').hide(); \t\t\t\t\tif (document.querySelectorAll('input').length == 0) { \t\t\t\t\t\t\$('#pay').hide(); \t\t\t\t\t\t\$('#saveOrder').hide(); \t\t\t\t\t} \t\t\t\t} \t\t\t} \t\t} \t\t// var totalDiscount = 0; \t\tfunction discount(){ \t\t\tvar percent = prompt('Discount %: '); \t\t\tvar checked = document.querySelectorAll('input:checked'); \t\t\tfor(var key in checked){ \t\t\t\tvar nexts = checked[key].nextSibling; \t\t\t\tif (nexts) { \t\t\t\t\tvar price = parseFloat(checked[key].getAttribute('data-price')); \t\t\t\t\tvar discountPrice = (parseFloat(checked[key].getAttribute('data-price')) * percent)/100; \t\t\t\t\tvar newPrice = price - discountPrice; \t\t\t\t\t// totalDiscount += discountPrice; \t\t\t\t\tchecked[key].setAttribute('data-price', newPrice); \t\t\t\t\tchecked[key].setAttribute('data-discount', discountPrice); \t\t\t\t\tnexts.getElementsByTagName('span')[0].innerHTML = newPrice; \t\t\t\t} \t\t\t\tchecked[key].checked = false; \t\t\t\tcalculateTotal(); \t\t\t} \t\t\t\$('#discountButton').hide(); \t\t\t\$('#deleteButton').hide(); \t\t} \t\tvar all; \t\tfunction pay(){ \t\t\tvar all = document.querySelectorAll('ul>input'); \t\t\tvar output = \"<ul id='payList'>\"; \t\t\tfor (var i = 0; i < all.length; i++) { \t\t\t\t// console.log(inside); \t\t\t\toutput += \"<li>\" + all[i].getAttribute('data-name') + \"<span class='pull-right'>\" + all[i].getAttribute('data-price') + \"</li>\"; \t\t\t\t// console.log(inside); \t\t\t} \t\t\toutput += \"</ul>\"; \t\t\t\$('.loginBox').html(output); \t\t\tdocument.getElementById('confirmTotal').innerHTML = total; \t\t\t// document.getElementById('confirmDiscount').innerHTML = discount; \t\t\tcalculateDiscount(); \t\t\topenLoginModal(); \t\t} \t\t\$( document ).ajaxStart(function() { \t\t\t\$('#loginModal').modal('hide'); \t\t}); \t\t// \$( document ).ajaxComplete(function() { \t\t// \tclearList(); \t\t// }); \t\tfunction orderItems(status = 'completed'){ \t\t\tvar info = {}; \t\t\tvar data = []; \t\t\tvar list = document.querySelectorAll('input'); \t\t\t// iterate through all the elements in the order list \t\t\t// save the item name, price and id as values in an object \t\t\t// with name, price and id as keys respectively \t\t\t// then push the object into the 'data' array \t\t\tfor (var i = 0; i < list.length; i++) { \t\t\t\tvar item = {}; \t\t\t\titem['name'] = list[i].getAttribute('data-name'); \t\t\t\titem['price'] = list[i].getAttribute('data-price'); \t\t\t\titem['id'] = list[i].value; \t\t\t\tdata.push(item); \t\t\t} \t\t\tinfo['orders'] = data; \t\t\tinfo['status'] = status; \t\t\tinfo['savedOrderId'] = savedOrderId; \t\t\tinfo['total'] = parseFloat(document.getElementById('total').innerHTML); \t\t\tplaceOrder(info); \t\t\t// console.log(data); \t\t} \t\tvar modal = document.getElementById('myModal'); \t\twindow.onclick = function(event) { \t\t if (event.target == modal) { \t\t modal.style.display = \"none\"; \t\t } \t\t} \t\tfunction placeOrder(data){ \t\t\tvar orderUrl = \""; // line 145 echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("order"); echo "\"; \t\t\t\$.post( orderUrl, data, function( newData ) { \t\t\t\tconsole.log(newData); \t\t\t if(newData){ \t\t\t \$('#notify').show(); \t\t\t setTimeout(function(){ \t\t\t \t\$('#notify').hide() \t\t\t }, 1000); \t\t\t clearList(); \t\t\t } else { \t\t\t console.log(\"No go\"); \t\t\t } \t\t\t}); \t\t\tsavedOrderId = 0; \t\t\t// totalDiscount = 0; \t\t} \t\tfunction saveOrder(){ \t\t\tvar save = confirm('Save this order and print receipt?'); \t\t\tif (save) { \t\t\t\torderItems('pending'); \t\t\t} \t\t} \t\t// populate the order list with items in selected saved order \t\tvar savedOrderId = 0; \t\tfunction listSavedOrders(key){ \t\t\tconsole.log(savedOrders[key]); \t\t\tclearList(); \t\t\tfor (var i = 0; i < savedOrders[key].length; i++) { \t\t\t\tsales = \"<input type='checkbox' value='\" + savedOrders[key][i].item_id + \"' class='pull-left' data-price='\" + savedOrders[key][i].item_price + \"' data-name='\" + savedOrders[key][i].item_name + \"' data-discount='0'>\"; \t\t\t\tsales += \"<li>\" + savedOrders[key][i].item_name + \"<span class='pull-right listPrice'>\" + savedOrders[key][i].item_price + \"</span></li>\"; \t\t\t\t\$('#saleList').prepend(sales); \t\t\t} \t\t\t// console.log(sales); \t\t\t \t\t\tcalculateTotal(); \t\t\t\$('#pay').show(); \t\t\t\$('#saveOrder').show(); \t\t\t\$('#clearButton').show(); \t\t\t\$('#savedModal').modal('hide'); \t\t\tsavedOrderId = key; \t\t} \t\t// retrieve placed orders with status = 'pending' and list in modal \t\tvar savedOrders; \t\tfunction retrieveSavedOrders(){ \t\t\tvar savedOrderUrl = \""; // line 192 echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("retrievesavedorder"); echo "\"; \t\t\t\$.get(savedOrderUrl, function(data){ \t\t\t\tconsole.log(\"Yes\"); \t\t\t\tif (data) { \t\t\t\t\tvar saved = JSON.parse(data); \t\t\t\t\tsavedOrders = {}; \t\t\t\t\tfor(var key in saved){ \t\t\t\t\t\tif (savedOrders[saved[key].order_id]) { \t\t\t\t\t\t\tsavedOrders[saved[key].order_id].push(saved[key]); \t\t\t\t\t\t}else{ \t\t\t\t\t\t\tsavedOrders[saved[key].order_id] = [saved[key]]; \t\t\t\t\t\t} \t\t\t\t\t} \t\t\t\t\t// savedOrder = savedOrders; \t\t\t\t\tvar output = \"<table class='table'>\"; \t\t\t\t\toutput += \"<tr><th>Order ID</th><th>Amount</th><th>Date</th><th>Action</th></tr>\" \t\t\t\t\tfor (var key in savedOrders) { \t\t\t\t\t\tconsole.log(savedOrders[key]); \t\t\t\t\t\t// console.log(inside); \t\t\t\t\t\toutput += \"<tr>\"; \t\t\t\t\t\toutput += \"<td>\" + savedOrders[key][0].order_id + \"</td>\"; \t\t\t\t\t\toutput += \"<td>\" + savedOrders[key][0].amount + \"</td>\"; \t\t\t\t\t\toutput += \"<td>\" + savedOrders[key][0].order_date + \"</td>\"; \t\t\t\t\t\toutput += \"<td><button class='btn btn-default other' onclick='listSavedOrders(\" + key + \");'>Select</button></td>\"; \t\t\t\t\t\toutput += \"</tr>\"; \t\t\t\t\t\t// console.log(inside); \t\t\t\t\t} \t\t\t\t\toutput += \"</table>\"; \t\t\t\t} \t\t\t\t\$('.saved-orders').html(output); \t\t\t\topenSavedOrders(); \t\t\t\tconsole.log(output); \t\t\t}); \t\t} \t</script> </head> <body> <nav class=\"navbar navbar-inverse\"> \t<div class=\"container-fluid\"> \t\t<div class=\"navbar-header\"> \t\t\t<a class=\"navbar-brand\" href=\"#\">EPOS</a> \t\t</div> \t\t<ul class=\"nav navbar-nav\"> \t\t\t<li><a href=\"javascript: retrieveSavedOrders();\">Saved Orders</a></li> \t\t\t \t\t</ul> \t</div> </nav> <div class=\"wrapper\"> \t<div class=\"container-fluid\"> \t\t<div class=\"alert alert-success alert-dismissable text-center\" id=\"notify\"> \t\t \t<p>Order Placed Successfully</p> \t\t</div>\t \t\t<div class=\"row\"> \t\t\t<div class=\"col-sm-3\"> \t\t\t\t<div id=\"sale\"> \t\t\t\t\t<ul id=\"saleList\" class=\"list-group\"> \t\t\t\t\t</ul> \t\t\t\t\t \t\t\t\t\t \t\t\t\t</div> \t\t\t\t<div class=\"total\"> \t\t\t\t\t<p>Total: <span id=\"total\"></span></p> \t\t\t\t</div> \t\t\t\t<button id=\"pay\" style=\"display: none;\" class=\"btn btn-default\" onclick=\"pay();\">Pay</button> \t\t\t\t<button id=\"saveOrder\" style=\"display: none;\" class=\"btn btn-default\" onclick=\"saveOrder();\">Save Order</button> \t\t\t\t<button id=\"deleteButton\" style=\"display: none;\" class=\"btn btn-default\" onclick=\"deleteItems();\">Delete Item(s)</button> \t\t\t\t<button id=\"discountButton\" style=\"display: none;\" class=\"btn btn-default\" onclick=\"discount();\">Apply Discount</button> \t\t\t\t<button id=\"clearButton\" style=\"display: none;\" class=\"btn btn-default\" onclick=\"clearList();\">Clear List</button> \t\t\t</div> \t\t\t<div class=\"col-sm-7\"> \t\t\t\t<div class=\"row\" id=\"submenu\"> \t\t\t\t</div> \t\t\t\t<div class=\"row\" id=\"mains\"> \t\t\t\t\t \t\t\t\t</div> \t\t\t</div> \t\t\t<div class=\"col-sm-2\"> \t\t\t\t<div id=\"mainmenu\"> \t\t\t\t\t \t\t\t\t</div> \t\t\t</div> \t\t</div> \t\t<div class=\"modal fade login\" id=\"loginModal\"> \t\t <div class=\"modal-dialog login animated\"> \t\t <div class=\"modal-content\"> \t\t <div class=\"modal-header\"> <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button> <h4 class=\"modal-title\">Confirm Order</h4> </div> <div class=\"modal-body\"> <div class=\"box\"> <div class=\"content\"> <div class=\"error\"></div> <div class=\"form loginBox\"> </div> <p class=\"confirmTotal pull-right\">Total: <span id=\"confirmTotal\"></span></p> <p class=\"confirmTotal pull-right\">Discount: -<span id=\"confirmDiscount\">0.0</span></p> </div> </div> </div> <div class=\"modal-footer\"> <button class=\"btn btn-default\" onclick=\"orderItems();\">Submit</button> </div> \t\t </div> \t\t </div> \t\t</div> \t\t<div class=\"modal fade login\" id=\"savedModal\"> \t\t <div class=\"modal-dialog login animated\"> \t\t <div class=\"modal-content\"> \t\t <div class=\"modal-header\"> <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button> <h4 class=\"saved-modal-title\">Select Order</h4> </div> <div class=\"modal-body\"> <div class=\"box\"> <div class=\"content\"> <div class=\"error\"></div> <div class=\"form saved-orders\"> </div> </div> </div> </div> \t\t </div> \t\t </div> \t\t</div> \t\t<div id=\"myModal\" class=\"modal\"> \t\t <!-- Modal content --> \t\t <div class=\"modal-contents\"> \t\t \t\t </div> \t\t</div> \t</div> </div> <script> \tvar url = \""; // line 341 echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("homepage"); echo "\"; \t\$.get(url, function(data){ \t\tif (data) { \t\t\tconsole.log(data); \t\t\tvar rel = JSON.parse(data); \t\t\tcategory(rel); \t\t} \t\t// console.log(rel); \t}); \t// var data = \""; // line 351 echo twig_escape_filter($this->env, ($context["product"] ?? null), "html", null, true); echo "\"; \t// console.log(data); \t// data = JSON.parse(data); \t// category(data); \t\tvar cat = {}; \t\tvar group = {}; \t\tvar group_cat = {}; \t\tfunction createSub(element, cat){ \t\t\tvar output = \"\"; \t\t\tfor(var key in element){ \t\t\t\toutput += '<div class=\"col-sm-3 text-center pull-left\">'; \t\t\t\toutput += \"<button class='btn sub' data-price='\" + element[key].item_price + \"' data-category='\" + cat + \"' data-id='\" + element[key].item_id + \"'>\" + element[key].item_name + \"</button>\"; \t\t\t\toutput += \"</div>\"; \t\t\t} \t\t\treturn output; \t\t} \t\tfunction category(data){ \t\t\tvar arr = []; \t\t\t//Sort by categories \t\t\tfor(var key in data){ \t\t\t\tif(data[key].cat_name in cat){ \t\t\t\t\tcat[data[key].cat_name].push(data[key]); \t\t\t\t}else { \t\t\t\t\tcat[data[key].cat_name] = [data[key]]; \t\t\t\t} \t\t\t\t \t\t\t} \t\t\tvar sets = new Set(); \t\t\tfor(var key in cat){ \t\t\t\tsets.add(cat[key][0].group_name); \t\t\t} \t\t\tsets.forEach(function(element){ \t\t\t\tgroup_cat[element] = {}; \t\t\t}) \t\t\tfor(var key in cat){ \t\t\t\tfor(let item of sets){ \t\t\t\t\tif (cat[key][0].group_name == item) { \t\t\t\t\t\tgroup_cat[item][key] = cat[key]; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t} \t\t\t} \t\t\t \t\t\t// console.log(cat); \t\t\t// console.log(group_cat); \t\t\t// createButtonElement(cat); \t\t\tcreateMainElements(group_cat); \t\t\t// var cat = new \t\t} \t\t//this function receives an object and creates and returns a button \t\t//as a string for the main menu \t\tfunction createButtonElement(elements){ \t\t\tvar main = \"\"; \t\t\tfor(var key in elements){ \t\t\t\tmain += \"<div class='col-sm-3 text-center pull-left'>\"; \t\t\t\tmain += \"<button class='btn btn-default main' data-name='\" + key + \"'>\" + key.toUpperCase() + \"</button></div>\"; \t\t\t} \t\t\tmains.innerHTML = main; \t\t\t// return main; \t\t} \t\tfunction createMainElements(element){ \t\t\tvar main = \"\"; \t\t\tfor(var key in element){ \t\t\t\tmain += \"<button class='btn btn-default main' data-name='\" + key + \"'>\" + key.toUpperCase() + \"</button>\"; \t\t\t} \t\t\tmainmenu.innerHTML = main; \t\t} \t\t\$('#mains').on('click', 'button', function(){ \t\t\tvar sub = createSub(cat[\$(this).data('name')], \$(this).data('name')); \t\t\tsubmenu.innerHTML = sub; \t\t}); \t\t\$('#mainmenu').on('click', 'button', function(){ \t\t\tcreateButtonElement(group_cat[\$(this).data('name')]); \t\t\t// submenu.innerHTML = sub; \t\t}); \t\t// When an item is selected, list the item in the order section \t\t// calculate total by adding the prices of each item \t\t// Show the pay button and save order button \t\tvar sales = \"\"; \t\tvar count = 1; \t\t\$('#submenu').on('click', 'button', function(){ \t\t\tsales = \"<input class='pull-left' type='checkbox' value='\" + \$(this).data('id') + \"' data-price='\" + \$(this).data('price') + \"' data-name='\" + \$(this).html() + \"' data-discount='0'>\"; \t\t\tsales += \"<li class='list-group-item'><span class='list-item'>\" + \$(this).html() + \"</span><span class='pull-right listPrice'>\" + \$(this).data('price') + \"</span></li>\"; \t\t\t// console.log(sales); \t\t\t\$('#saleList').prepend(sales); \t\t\tcount++; \t\t\tcalculateTotal(); \t\t\t\$('#pay').show(); \t\t\t\$('#saveOrder').show(); \t\t\t\$('#clearButton').show(); \t\t}); \t\t\$('#saleList').on('click', 'li', function(){ \t\t\t\$(this).toggleClass('active'); \t\t\tconsole.log(document.querySelectorAll('li.active')); \t\t\t// alert('here'); \t\t}); \t\tfunction newOrder(){ \t\t} \t\tfunction showPayButton(){ \t\t\tif(document.querySelectorAll('input').length > 0) { \t\t\t \$('#pay').show(); \t\t\t\t\$('#saveOrder').show(); \t\t\t\t\$('#clearButton').show(); \t\t\t}else { \t\t\t\t\$('#pay').hide(); \t\t\t\t\$('#saveOrder').hide(); \t\t\t\t\$('#clearButton').hide(); \t\t\t} \t\t} \t\t//Event for when an item in sales list is checked \t\t//Show the delete button and the apply discount button \t\t\$(\"#saleList\").on('change', 'input', function() { \t\t\tif(this.checked) { \t\t\t \$('#deleteButton').show(); \t\t\t \$('#discountButton').show(); \t\t\t} \t\t}); \t\t\$(\"#saleList\").on('change', 'input', function() { \t\t\tif(document.querySelectorAll('input:checked').length == 0) { \t\t\t \$('#deleteButton').hide(); \t\t\t \$('#discountButton').hide(); \t\t\t} \t\t\tcalculateTotal(); \t\t}); \t\t// var order = new Order(); </script> </body> </html>"; } public function getTemplateName() { return "Default/oldIndex.html"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 413 => 351, 400 => 341, 248 => 192, 198 => 145, 59 => 9, 55 => 8, 51 => 7, 47 => 6, 43 => 5, 37 => 1,); } public function getSourceContext() { return new Source("", "Default/oldIndex.html", "/var/www/html/mixchief_app/templates/Default/oldIndex.html"); } }