public function getperiod_name($_period = null)
 {
     $context = $this->env->mergeGlobals(array("period" => $_period));
     $blocks = array();
     ob_start();
     try {
         // line 34
         echo "    ";
         echo twig_period_title($this->env, isset($context["period"]) ? $context["period"] : null);
         echo "\n";
     } catch (Exception $e) {
         ob_end_clean();
         throw $e;
     }
     return '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     $context["cart"] = $this->getAttribute(isset($context["guest"]) ? $context["guest"] : null, "cart_get");
     // line 2
     echo "<div class=\"accordion-group\">\n    <div class=\"accordion-heading\">\n        <a class=\"accordion-toggle\" href=\"#checkout\" data-parent=\"#accordion1\" data-toggle=\"collapse\"><span class=\"awe-shopping-cart\"></span> ";
     // line 4
     echo gettext("Cart");
     echo " <span class=\"label label-warning pull-right\">";
     echo twig_escape_filter($this->env, twig_length_filter($this->env, $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "items")), "html", null, true);
     echo "</span></a>\n    </div>\n    ";
     // line 6
     if ($this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "items")) {
         // line 7
         echo "    <div id=\"checkout\" class=\"accordion-body collapse ";
         if ($this->getAttribute(isset($context["request"]) ? $context["request"] : null, "checkout") && (isset($context["client"]) ? $context["client"] : null)) {
             echo "in";
         }
         echo "\">\n        <div class=\"accordion-inner\" id=\"checkout-inner\">\n\n            <table class=\"table table-striped table-bordered table-condensed\">\n                <thead>\n                <tr>\n                    <th>";
         // line 13
         echo gettext("Product");
         echo "</th>\n                    <th>";
         // line 14
         echo gettext("Price");
         echo "</th>\n                    <th style=\"width: 3%; text-align: center\"></th>\n                </tr>\n                </thead>\n                <tbody>\n                ";
         // line 19
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "items"));
         foreach ($context['_seq'] as $context["i"] => $context["item"]) {
             // line 20
             echo "                <tr>\n                    <td>\n                        ";
             // line 22
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "title"), "html", null, true);
             echo "\n                        ";
             // line 23
             if ($this->getAttribute(isset($context["item"]) ? $context["item"] : null, "quantity") > 1) {
                 // line 24
                 echo "                        x ";
                 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "quantity"), "html", null, true);
                 echo "\n                        ";
             }
             // line 26
             echo "\n                        ";
             // line 27
             if ($this->getAttribute(isset($context["item"]) ? $context["item"] : null, "period")) {
                 // line 28
                 echo "                            (";
                 echo twig_period_title($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "period"));
                 echo ")\n                        ";
             }
             // line 30
             echo "                    </td>\n                    <td>\n                        ";
             // line 32
             if ($this->getAttribute(isset($context["item"]) ? $context["item"] : null, "discount_price")) {
                 // line 33
                 echo "                            <del>";
                 echo twig_money_convert($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "price") * $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "quantity"));
                 echo "</del>\n                            <strong class=\"text-success\">";
                 // line 34
                 echo twig_money_convert($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "price") * $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "quantity") - $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "discount_price"));
                 echo "</strong>\n                        ";
             } else {
                 // line 36
                 echo "                            ";
                 echo twig_money_convert($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "price") * $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "quantity"));
                 echo "\n                        ";
             }
             // line 38
             echo "                    </td>\n                    <td><button data-cart-item-id=\"";
             // line 39
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "id"), "html", null, true);
             echo "\" class=\"btn btn-inverse btn-mini remove-cart-item\" title=\"";
             echo gettext("Remove item");
             echo "\"><strong><i class=\"awe-remove\"></i></strong></button></td>\n                </tr>\n\n                ";
             // line 42
             if ($this->getAttribute(isset($context["request"]) ? $context["request"] : null, "show_custom_form_values")) {
                 // line 43
                 echo "                <tr>\n                    <td>\n                        ";
                 // line 45
                 if ($this->getAttribute(isset($context["item"]) ? $context["item"] : null, "form_id") && $this->getAttribute(isset($context["guest"]) ? $context["guest"] : null, "extension_is_on", array(0 => array("mod" => "formbuilder")), "method")) {
                     // line 46
                     echo "                        ";
                     $context["form"] = $this->getAttribute(isset($context["guest"]) ? $context["guest"] : null, "formbuilder_get", array(0 => array("id" => $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "form_id"))), "method");
                     // line 47
                     echo "                        ";
                     // line 48
                     echo "                        <div class=\"well\">\n                            <dl class=\"dl-horizontal\">\n                                ";
                     // line 50
                     $context['_parent'] = (array) $context;
                     $context['_seq'] = twig_ensure_traversable(isset($context["item"]) ? $context["item"] : null);
                     foreach ($context['_seq'] as $context["field"] => $context["value"]) {
                         // line 51
                         echo "                                    ";
                         $context['_parent'] = (array) $context;
                         $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["form"]) ? $context["form"] : null, "fields"));
                         foreach ($context['_seq'] as $context["_key"] => $context["form_field"]) {
                             // line 52
                             echo "                                        ";
                             if (!twig_test_empty(isset($context["value"]) ? $context["value"] : null)) {
                                 // line 53
                                 echo "                                            ";
                                 if ($this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "name") == (isset($context["field"]) ? $context["field"] : null)) {
                                     // line 54
                                     echo "                                            <dt>\n                                                ";
                                     // line 55
                                     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "label"), "html", null, true);
                                     echo "\n                                            </dt>\n                                            <dd>\n                                                ";
                                     // line 58
                                     if ($this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "type") == "checkbox") {
                                         // line 59
                                         echo "                                                    ";
                                         $context['_parent'] = (array) $context;
                                         $context['_seq'] = twig_ensure_traversable(isset($context["value"]) ? $context["value"] : null);
                                         foreach ($context['_seq'] as $context["_key"] => $context["selection"]) {
                                             // line 60
                                             echo "                                                        ";
                                             $context['_parent'] = (array) $context;
                                             $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "options"));
                                             foreach ($context['_seq'] as $context["field_key"] => $context["field_value"]) {
                                                 // line 61
                                                 echo "                                                            ";
                                                 if ((isset($context["field_value"]) ? $context["field_value"] : null) == (isset($context["selection"]) ? $context["selection"] : null)) {
                                                     // line 62
                                                     echo "                                                                ";
                                                     echo twig_escape_filter($this->env, isset($context["field_key"]) ? $context["field_key"] : null, "html", null, true);
                                                     echo "\n                                                            ";
                                                 }
                                                 // line 64
                                                 echo "                                                        ";
                                             }
                                             $_parent = $context['_parent'];
                                             unset($context['_seq'], $context['_iterated'], $context['field_key'], $context['field_value'], $context['_parent'], $context['loop']);
                                             $context = array_intersect_key($context, $_parent) + $_parent;
                                             // line 65
                                             echo "                                                    ";
                                         }
                                         $_parent = $context['_parent'];
                                         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['selection'], $context['_parent'], $context['loop']);
                                         $context = array_intersect_key($context, $_parent) + $_parent;
                                         // line 66
                                         echo "                                                ";
                                     } elseif ($this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "type") == "select" || $this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "type") == "radio") {
                                         // line 67
                                         echo "                                                    ";
                                         $context['_parent'] = (array) $context;
                                         $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["form_field"]) ? $context["form_field"] : null, "options"));
                                         foreach ($context['_seq'] as $context["field_key"] => $context["field_value"]) {
                                             // line 68
                                             echo "                                                        ";
                                             if ((isset($context["field_value"]) ? $context["field_value"] : null) == (isset($context["value"]) ? $context["value"] : null)) {
                                                 // line 69
                                                 echo "                                                            ";
                                                 echo twig_escape_filter($this->env, isset($context["field_key"]) ? $context["field_key"] : null, "html", null, true);
                                                 echo "\n                                                        ";
                                             }
                                             // line 71
                                             echo "                                                    ";
                                         }
                                         $_parent = $context['_parent'];
                                         unset($context['_seq'], $context['_iterated'], $context['field_key'], $context['field_value'], $context['_parent'], $context['loop']);
                                         $context = array_intersect_key($context, $_parent) + $_parent;
                                         // line 72
                                         echo "                                                ";
                                     } else {
                                         // line 73
                                         echo "                                                    ";
                                         echo twig_escape_filter($this->env, isset($context["value"]) ? $context["value"] : null, "html", null, true);
                                         echo "\n                                                ";
                                     }
                                     // line 75
                                     echo "                                            </dd>\n                                            ";
                                 }
                                 // line 77
                                 echo "                                        ";
                             }
                             // line 78
                             echo "                                    ";
                         }
                         $_parent = $context['_parent'];
                         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['form_field'], $context['_parent'], $context['loop']);
                         $context = array_intersect_key($context, $_parent) + $_parent;
                         // line 79
                         echo "                                ";
                     }
                     $_parent = $context['_parent'];
                     unset($context['_seq'], $context['_iterated'], $context['field'], $context['value'], $context['_parent'], $context['loop']);
                     $context = array_intersect_key($context, $_parent) + $_parent;
                     // line 80
                     echo "                            </dl>\n                        </div>\n                        ";
                 }
                 // line 83
                 echo "                    </td>\n                    <td></td>\n                </tr>\n                ";
             }
             // line 87
             echo "\n                ";
             // line 88
             if ($this->getAttribute(isset($context["item"]) ? $context["item"] : null, "setup_price") != 0) {
                 // line 89
                 echo "                <tr>\n                    <td>";
                 // line 90
                 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "title"), "html", null, true);
                 echo " ";
                 echo gettext("setup");
                 echo "</td>\n                    <td>\n                        ";
                 // line 92
                 if ($this->getAttribute(isset($context["item"]) ? $context["item"] : null, "discount_setup")) {
                     // line 93
                     echo "                        <del>";
                     echo twig_money_convert($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "setup_price"));
                     echo "</del>\n                        ";
                     // line 94
                     echo twig_money_convert($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "setup_price") - $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "discount_setup"));
                     echo "\n                        ";
                 } else {
                     // line 96
                     echo "                        ";
                     echo twig_money_convert($this->env, $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "setup_price"));
                     echo "</td>\n                    ";
                 }
                 // line 98
                 echo "                </tr>\n                ";
             }
             // line 100
             echo "                ";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['i'], $context['item'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 101
         echo "                </tbody>\n            </table>\n\n            <div class=\"row-fluid\">\n                <div class=\"span6\">\n                    ";
         // line 106
         if (!$this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "promocode")) {
             // line 107
             echo "                    <a href=\"#\" id=\"show-promo-field\">";
             echo gettext("Have coupon code?");
             echo "</a>\n                    ";
         }
         // line 109
         echo "\n                    <form action=\"guest/cart/apply_promo\" method=\"post\" class=\"well\" id=\"apply-promo\" data-api-reload=\"1\" ";
         // line 110
         if (!$this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "promocode")) {
             echo "style=\"display:none\"";
         }
         echo ">\n                        <div class=\"control-group\">\n                            <div class=\"form-controls\">\n                                <div class=\"input-append\">\n                                    <input class=\"span8\" type=\"text\" name=\"promocode\" id=\"promocode\" value=\"";
         // line 114
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["request"]) ? $context["request"] : null, "promocode", array(), "any", true, true) ? _twig_default_filter($this->getAttribute(isset($context["request"]) ? $context["request"] : null, "promocode"), $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "promocode")) : $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "promocode"), "html", null, true);
         echo "\" ";
         if ($this->getAttribute(isset($context["promo"]) ? $context["promo"] : null, "required")) {
             echo "required=\"required\"";
         }
         echo " placeholder=\"";
         echo gettext("Enter code");
         echo "\">\n                                    ";
         // line 115
         if ($this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "promocode")) {
             // line 116
             echo "                                    <button class=\"btn\" id=\"remove-promo\" href=\"";
             echo $this->env->getExtension('bb')->twig_bb_client_link_filter("api/guest/cart/remove_promo");
             echo "\" type=\"button\" data-api-reload=\"1\">";
             echo gettext("Remove");
             echo "</button>\n                                    ";
         } else {
             // line 118
             echo "                                    <button class=\"btn\" type=\"submit\">";
             echo gettext("Apply");
             echo "</button>\n                                    ";
         }
         // line 120
         echo "                                </div>\n                            </div>\n                        </div>\n                        ";
         // line 131
         echo "                    </form>\n                </div>\n\n                <div class=\"span6\">\n                    <table class=\"table table-bordered table-striped\">\n\n                        ";
         // line 137
         if ($this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "discount") > 0) {
             // line 138
             echo "                        <tr>\n                            <td><strong>";
             // line 139
             echo gettext("Subtotal:");
             echo "</strong></td>\n                            <td><strong>";
             // line 140
             echo twig_money_convert($this->env, $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "total") + $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "discount"));
             echo "</strong></td>\n                        </tr>\n                        <tr>\n                            <td><strong>";
             // line 143
             echo gettext("Discount:");
             echo "</strong></td>\n                            <td><strong>- ";
             // line 144
             echo twig_money_convert($this->env, $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "discount"));
             echo "</strong></td>\n                        </tr>\n                        ";
         }
         // line 147
         echo "\n                        ";
         // line 148
         $context["tax_amount"] = 0;
         // line 149
         echo "                        ";
         if ($this->getAttribute(isset($context["client"]) ? $context["client"] : null, "client_is_taxable")) {
             // line 150
             echo "                        ";
             $context["tax_rate"] = $this->getAttribute(isset($context["client"]) ? $context["client"] : null, "invoice_get_tax_rate");
             // line 151
             echo "                        ";
             $context["tax_amount"] = $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "total") * (isset($context["tax_rate"]) ? $context["tax_rate"] : null) / 100;
             // line 152
             echo "                        <tr>\n                            <td><strong>";
             // line 153
             echo gettext("VAT");
             echo " (";
             echo twig_escape_filter($this->env, isset($context["tax_rate"]) ? $context["tax_rate"] : null, "html", null, true);
             echo "%) :</strong></td>\n                            <td><strong>";
             // line 154
             echo twig_money_convert($this->env, isset($context["tax_amount"]) ? $context["tax_amount"] : null);
             echo "</strong></td>\n                        </tr>\n                        ";
         }
         // line 157
         echo "                        <tr>\n                            <td><strong>";
         // line 158
         echo gettext("Total:");
         echo "</strong></td>\n                            <td><strong>";
         // line 159
         echo twig_money_convert($this->env, $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "total") + (isset($context["tax_amount"]) ? $context["tax_amount"] : null));
         echo "</strong></td>\n                        </tr>\n\n                    </table>\n\n                    <form method=\"post\" action=\"client/cart/checkout\" class=\"form-horizontal\" id=\"checkout-form\" onsubmit=\"return false;\">\n                        <fieldset>\n                            ";
         // line 166
         $context["enough_in_balance"] = $this->getAttribute(isset($context["client"]) ? $context["client"] : null, "client_balance_get_total") >= $this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "total");
         // line 167
         echo "                            ";
         if ($this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "total") && !(isset($context["enough_in_balance"]) ? $context["enough_in_balance"] : null)) {
             // line 168
             echo "                            <div class=\"control-group\">\n                                ";
             // line 169
             $context['_parent'] = (array) $context;
             $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["guest"]) ? $context["guest"] : null, "invoice_gateways"));
             $context['loop'] = array('parent' => $context['_parent'], 'index0' => 0, 'index' => 1, 'first' => true);
             if (is_array($context['_seq']) || is_object($context['_seq']) && $context['_seq'] instanceof Countable) {
                 $length = count($context['_seq']);
                 $context['loop']['revindex0'] = $length - 1;
                 $context['loop']['revindex'] = $length;
                 $context['loop']['length'] = $length;
                 $context['loop']['last'] = 1 === $length;
             }
             foreach ($context['_seq'] as $context["_key"] => $context["gtw"]) {
                 // line 170
                 echo "                                ";
                 if (twig_in_filter($this->getAttribute($this->getAttribute(isset($context["cart"]) ? $context["cart"] : null, "currency"), "code"), $this->getAttribute(isset($context["gtw"]) ? $context["gtw"] : null, "accepted_currencies"))) {
                     // line 171
                     echo "                                <label class=\"radio\" for=\"";
                     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["gtw"]) ? $context["gtw"] : null, "id"), "html", null, true);
                     echo "\">\n                                    <input type=\"radio\" name=\"gateway_id\" id=";
                     // line 172
                     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["gtw"]) ? $context["gtw"] : null, "id"), "html", null, true);
                     echo " value=\"";
                     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["gtw"]) ? $context["gtw"] : null, "id"), "html", null, true);
                     echo "\" ";
                     echo $this->getAttribute(isset($context["loop"]) ? $context["loop"] : null, "first") ? "checked" : "";
                     echo "/>\n                                    ";
                     // line 173
                     echo gettext("Pay by");
                     echo " ";
                     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["gtw"]) ? $context["gtw"] : null, "title"), "html", null, true);
                     echo "\n                                </label>\n                                ";
                 }
                 // line 176
                 echo "                                ";
                 ++$context['loop']['index0'];
                 ++$context['loop']['index'];
                 $context['loop']['first'] = false;
                 if (isset($context['loop']['length'])) {
                     --$context['loop']['revindex0'];
                     --$context['loop']['revindex'];
                     $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                 }
             }
             $_parent = $context['_parent'];
             unset($context['_seq'], $context['_iterated'], $context['_key'], $context['gtw'], $context['_parent'], $context['loop']);
             $context = array_intersect_key($context, $_parent) + $_parent;
             // line 177
             echo "                            </div>\n                            ";
         }
         // line 179
         echo "                            <div class=\"control-group\">\n                                <div class=\"controls\">\n                                    ";
         // line 181
         if (isset($context["enough_in_balance"]) ? $context["enough_in_balance"] : null) {
             // line 182
             echo "                                        <p>";
             echo gettext("Total amount will be deducted from account balance");
             echo "</p>\n                                    ";
         }
         // line 184
         echo "                                    <button class=\"btn btn-primary btn-large\" type=\"submit\">";
         echo gettext("Checkout");
         echo "</button>\n                                </div>\n                            </div>\n                        </fieldset>\n                    </form>\n\n                </div>\n            </div>\n        </div>\n    </div>\n    ";
     }
     // line 195
     echo "</div>\n<script type=\"text/javascript\">\n    \$('#remove-promo').click(function(e){\n        e.preventDefault();\n        bb.post(\"guest/cart/remove_promo\", {}, function(r){\n                bb.msg(\"";
     // line 200
     echo gettext("Promo code was removed");
     echo "\");\n                location.reload(false);\n        });\n\n    });\n\n    \$('.remove-cart-item').click(function(e){\n        e.preventDefault();\n        var btn = \$(this);\n        if (confirm('";
     // line 209
     echo gettext("Are you sure you want to remove this item from cart?");
     echo "')){\n            var item_id = \$(btn).attr('data-cart-item-id');\n            bb.post(\"guest/cart/remove_item\", {id: item_id}, function(r){\n                bb.msg(\"";
     // line 212
     echo gettext("Item was removed from cart");
     echo "\");\n                location.reload(false);\n            });\n        }\n\n\n    });\n</script>";
 }