/
var
/
www
/
html
/
restaurants
/
var
/
cache
/
prod
/
twig
/
5e
/
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; /* Inventory/items.html.twig */ class __TwigTemplate_f12c64a9237891d8e141edd64647c9f450037317163dbd58b802943e3f5b654a extends Template { private $source; private $macros = []; public function __construct(Environment $env) { parent::__construct($env); $this->source = $this->getSourceContext(); $this->blocks = [ 'content' => [$this, 'block_content'], 'javascripts' => [$this, 'block_javascripts'], ]; } protected function doGetParent(array $context) { // line 1 return "claimed.html.twig"; } protected function doDisplay(array $context, array $blocks = []) { $macros = $this->macros; $this->parent = $this->loadTemplate("claimed.html.twig", "Inventory/items.html.twig", 1); $this->parent->display($context, array_merge($this->blocks, $blocks)); } // line 3 public function block_content($context, array $blocks = []) { $macros = $this->macros; // line 4 echo "\t<div class=\"content\"> \t\t<div class=\"row\"> \t\t\t<div class=\"col-sm-12 col-md-12 col-lg-12 col-xl-7\"> \t\t\t\t<div class=\"card\"> \t\t\t\t\t<div class=\"card-header\"> \t\t\t\t\t\t<h4 class=\"pull-left\">Food Menu</h4> \t\t\t\t\t\t<a href=\""; // line 10 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("category", ["place_slug" => twig_get_attribute($this->env, $this->source, ($context["place"] ?? null), "slug", [], "any", false, false, false, 10)]), "html", null, true); echo "\" class=\"btn btn-primary pull-right\">Add Categories</a> \t\t\t\t\t</div> \t\t\t\t\t<div class=\"card-body\"> \t\t\t\t\t\t<table class=\"table table-striped item-table\"> \t\t\t\t\t\t\t<thead> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<th>Name</th> \t\t\t\t\t\t\t\t\t<th>Price</th> \t\t\t\t\t\t\t\t\t<th>Category</th> \t\t\t\t\t\t\t\t\t<th>Actions</th> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t</thead> \t\t\t\t\t\t\t<tbody> \t\t\t\t\t\t\t\t"; // line 23 $context['_parent'] = $context; $context['_seq'] = twig_ensure_traversable(($context["items"] ?? null)); foreach ($context['_seq'] as $context["_key"] => $context["item"]) { // line 24 echo "\t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td><a href=\""; // line 25 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("editItem", ["id" => twig_get_attribute($this->env, $this->source, $context["item"], "id", [], "any", false, false, false, 25)]), "html", null, true); echo "\">"; echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "name", [], "any", false, false, false, 25), "html", null, true); echo "</a></td> \t\t\t\t\t\t\t\t\t\t<td>"; // line 26 echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "price", [], "any", false, false, false, 26), "html", null, true); echo "</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t"; // line 28 if (twig_get_attribute($this->env, $this->source, $context["item"], "category", [], "any", false, false, false, 28)) { // line 29 echo "\t\t\t\t\t\t\t\t\t\t\t\t"; ((twig_get_attribute($this->env, $this->source, $context["item"], "category", [], "any", false, false, false, 29)) ? (print (twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "category", [], "any", false, false, false, 29), "html", null, true))) : (print (""))); echo " \t\t\t\t\t\t\t\t\t\t\t"; } elseif (twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, // line 30 ($context["place"] ?? null), "category", [], "any", false, false, false, 30))) { // line 31 echo "\t\t\t\t\t\t\t\t\t\t\t\t<select data-itemid=\""; echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "id", [], "any", false, false, false, 31), "html", null, true); echo "\" class=\"form-control change-category\"> \t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"\">Select category</option> \t\t\t\t\t\t\t\t\t\t\t\t\t"; // line 33 $context['_parent'] = $context; $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["place"] ?? null), "category", [], "any", false, false, false, 33)); foreach ($context['_seq'] as $context["_key"] => $context["cat"]) { // line 34 echo "\t\t\t\t\t\t\t\t\t\t\t\t\t <option value=\""; echo twig_escape_filter($this->env, $context["cat"], "html", null, true); echo "\">"; echo twig_escape_filter($this->env, $context["cat"], "html", null, true); echo "</option> \t\t\t\t\t\t\t\t\t\t\t\t\t"; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['cat'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 36 echo "\t\t\t\t\t\t\t\t\t\t\t\t</select> \t\t\t\t\t\t\t\t\t\t\t"; } // line 38 echo "\t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td class=\"flex-big\">\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t<a data-name=\""; // line 40 echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "name", [], "any", false, false, false, 40), "html", null, true); echo "\" class=\"btn btn-danger action-icon delete-row\" href=\""; echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("deleteItem", ["id" => twig_get_attribute($this->env, $this->source, $context["item"], "id", [], "any", false, false, false, 40)]), "html", null, true); echo "\"><i class=\"fa fa-times\"></i></a> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t"; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 44 echo "\t\t\t\t\t\t\t</tbody> \t\t\t\t\t\t</table> \t\t\t\t\t\t<div class=\"navigation\"> "; // line 47 echo $this->extensions['Knp\Bundle\PaginatorBundle\Twig\Extension\PaginationExtension']->render($this->env, ($context["items"] ?? null)); echo " </div> \t\t\t\t\t</div> \t\t\t\t</div> \t\t\t</div> \t\t\t<div class=\"col-sm-12 col-lg-5 col-md-10 col-xs-12 new-item-add\"> \t\t\t\t<div class=\"card\"> \t\t\t\t\t<div class=\"card-header\"><h4>Enter New Food Item(s)</h4></div> \t\t\t\t\t<div class=\"card-body\"> \t\t\t\t\t\t<form action=\""; // line 56 echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("registerItem", ["place_slug" => twig_get_attribute($this->env, $this->source, ($context["place"] ?? null), "slug", [], "any", false, false, false, 56)]), "html", null, true); echo "\" method=\"POST\" enctype=\"multipart/form-data\" class=\"json-form\"> \t\t\t\t\t\t\t<div class=\"items\"> \t\t\t\t\t\t\t\t<div id=\"init\" class=\"item\"> \t\t\t\t\t\t\t\t\t<div class=\"form-group\"> \t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"name[]\" class=\"form-control\" placeholder=\"Food Name\" required> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t<div class=\"form-group\"> \t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"selling[]\" class=\"form-control\" placeholder=\"Price (minimum)\" required> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t<div class=\"form-group\"> \t\t\t\t\t\t\t\t\t\t<textarea name=\"description[]\" class=\"form-control\" placeholder=\"Description (optional)\" rows=\"2\"></textarea> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t"; // line 69 if ((twig_get_attribute($this->env, $this->source, ($context["place"] ?? null), "category", [], "any", false, false, false, 69) && twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["place"] ?? null), "category", [], "any", false, false, false, 69)))) { // line 70 echo "\t\t\t\t\t\t\t\t\t\t<div class=\"form-group\"> \t\t\t\t\t\t\t\t\t\t\t<select class=\"form-control ajaxSelect\" id=\"category-select\" name=\"category[]\"> \t\t\t\t\t\t\t\t\t\t\t\t<option value=\"\">Select Category</option> \t\t\t\t\t\t\t\t\t\t\t\t"; // line 73 $context['_parent'] = $context; $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["place"] ?? null), "category", [], "any", false, false, false, 73)); foreach ($context['_seq'] as $context["_key"] => $context["cat"]) { // line 74 echo "\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=\""; echo twig_escape_filter($this->env, $context["cat"], "html", null, true); echo "\">"; echo twig_escape_filter($this->env, twig_upper_filter($this->env, $context["cat"]), "html", null, true); echo "</option> \t\t\t\t\t\t\t\t\t\t\t\t"; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['cat'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 76 echo "\t\t\t\t\t\t\t\t\t\t\t</select> \t\t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t"; } // line 79 echo "\t\t\t\t\t\t\t\t\t<div class=\"form-group\"> \t\t\t\t\t\t\t\t\t\t<label for=\"image\">Add Image</label> \t\t\t\t\t\t\t\t\t\t<input type=\"file\" name=\"image[]\" class=\"form-control\" placeholder=\"Image\"> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t"; // line 88 echo "\t\t\t\t\t\t\t"; // line 108 echo "\t\t\t\t\t\t\t<input type=\"submit\" name=\"submit\" value=\"Save\" class=\"btn btn-success save-button\"> \t\t\t\t\t\t</form> \t\t\t\t\t\t<br> \t\t\t\t\t\t"; // line 112 echo "\t\t\t\t\t\t<button type=\"button\" id=\"add-item\" class=\"btn btn-primary pull-right\">Add More</button> \t\t\t\t\t</div> \t\t\t\t</div> \t\t\t</div> \t\t</div> \t</div> "; } // line 121 public function block_javascripts($context, array $blocks = []) { $macros = $this->macros; // line 122 echo "\t"; $this->displayParentBlock("javascripts", $context, $blocks); echo " \t<script> \t\tvar deleteButton = () => ` \t\t\t<div class=\"delete-button\" style=\"text-align: right;\"> \t\t\t\t<button type=\"button\" class=\"btn btn-danger delete-new-row\"><i class=\"fa fa-times\"></i></button> \t\t\t</div> \t\t`; \t\tvar itemTemplate = (function(){ \t\t\tvar item = document.getElementById('init').innerHTML; \t\t\treturn function(){ \t\t\t\tvar cover = document.createElement('DIV'); \t\t\t\tcover.className = 'item added'; \t\t\t\t// cover.innerHTML = '<hr>'; \t\t\t\tcover.innerHTML = item; \t\t\t\tcover.innerHTML += deleteButton(); \t\t\t\treturn cover; \t\t\t} \t\t}) \t\tvar cover = itemTemplate(); \t\t\$('#add-item').on('click', function(e){ \t\t\te.preventDefault(); \t\t\t// \$('.delete-new-row').hide(); \t\t\t\$('.items').append(cover()); \t\t\t\$('.ajaxSelect').select2(); \t\t\t// \$( \".item-name\" ).autocomplete({ \t\t\t// source: options \t\t\t// }); \t\t}); \t\t\$('.items').on('click', '.delete-new-row', function(e){ \t\t\te.preventDefault(); \t\t\tvar \$target = \$(e.currentTarget); \t\t\t\$target.closest('.added').fadeOut(300, function(){ \t\t\t\t\$(this).remove(); \t\t\t}) \t\t}); \t\tdocument.querySelectorAll('.change-category').forEach(select => { \t\t\tselect.addEventListener('change', function(e){ \t\t\t\tconst td = e.target.closest('td'); \t\t\t\tfetch(`/admin/food/category/\${e.target.dataset.itemid}`, {method: 'PATCH', body: JSON.stringify({category: e.target.value}), credentials: 'same-origin'}) \t\t\t\t.then(response => response.json()) \t\t\t\t.then(result => { \t\t\t\t\tif(result.category === e.target.value) { \t\t\t\t\t\tconst alert = document.querySelector('.alert'); \t\t\t\t\t\talert.textContent = 'Category updated successfully'; \t\t\t\t\t\talert.style.display = 'block'; \t\t\t\t\t\tsetTimeout(() => { \t\t\t\t\t\t\talert.textContent = ''; \t\t\t\t\t\t\talert.style.display = 'none' \t\t\t\t\t\t}, 1500) \t\t\t\t\t\ttd.textContent = e.target.value; \t\t\t\t\t} \t\t\t\t}) \t\t\t}); \t\t}); \t</script> \t"; } public function getTemplateName() { return "Inventory/items.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 233 => 122, 229 => 121, 218 => 112, 213 => 108, 211 => 88, 203 => 79, 198 => 76, 187 => 74, 183 => 73, 178 => 70, 176 => 69, 160 => 56, 148 => 47, 143 => 44, 131 => 40, 127 => 38, 123 => 36, 112 => 34, 108 => 33, 102 => 31, 100 => 30, 95 => 29, 93 => 28, 88 => 26, 82 => 25, 79 => 24, 75 => 23, 59 => 10, 51 => 4, 47 => 3, 36 => 1,); } public function getSourceContext() { return new Source("", "Inventory/items.html.twig", "/var/www/html/restaurants/templates/Inventory/items.html.twig"); } }