<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" class="no-js" ng-app="myapp" lang="{$SelCurrLanguage}">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>{$language.lblAccountinfo} - {$language.lblPurchaseDetails} : {$commonMetaTitle}</title>
    <meta name="viewport" content="width=device-width">
    <meta name="Description" content="{$commonMetaDescription}" />
    <meta name="Keywords" content="{$commonMetaKeywords}" />
    {include file='CommonStyles.tpl'  }
    <link href="{$view_styles}/myaccount.css" rel="stylesheet" type="text/css" media="screen" />
    {include file='CommonJavaScript.tpl'  }
    <script type="text/javascript">
      var orderCount = {$resOrders|@count};
      var lblRecordsFound	=	"{$language.lblRecordfound}"
      var lblPages	=	'{$language.lblPages}'
      	{literal}
      		$(document).ready(function(){
      			$('.panelmenu a[rel=purchases]').parent().addClass('active');
                  $('#smart-paginator').smartpaginator({ totalrecords: orderCount, recordsperpage: 5, 
      			onchange:function onChange(){ $('html, body').animate({scrollTop: $(".pane01").offset().top},500);},
      			datacontainer: 'myTable',dataelement: 'li.list', initval:0 , controlsalways:true,display:'single',recordsfoundlabel:lblRecordsFound,pageslabel:lblPages
               	});													
      	});	
      	{/literal}
    </script>													
  </head>
  <body ng-controller="SearchCtrl" class="{$languageDirection}">
    <div id="main">
        {* <!-- Begin : Header Pane--> *}
      {include file='CommonTop.tpl'} 														
      {*<!-- End : Header -->*}
      <div id="content-wrapper" ng-show="!query" class="pt-3 pb-4">
       {* <!-- Begin : Content Pane -->*}
        <div class="container">
          <div id="common_message" ></div>
          <div class="row">
            {include file='account/CommonAccountRightMenu.tpl'}
            <div class="col-lg-9 col-12 order-sec">
                <div class="py-2 bg-white border-bottom">
                    <h2 class="acc-title px-md-4 px-3 py-md-1 py-0 text-capitalize text-dark m-0">{$language.lblMyOrder}</h2>
                </div>
              {*<!-- Begin : Gift Block -->*}
              <div class="pane01 bg-white px-md-4 py-md-4 px-sm-3 py-3 px-0">
               {* <!-- Begin : Content Pane -->*}
                  {*<!-- Begin : First Row --> *}
                  {if $resOrders}
                  <ul class="clearfix  purchase" id="myTable">
                    
                    {foreach from=$resOrders item="order"}
					{assign var="purchasedCurrency" value=$order.purchasedCurrency}
                    {assign var="userCurrency" value=$order.userCurrencyID}
                    {assign var="excRate" value=$order.userCurrencyExcRate}
                 <li class="order-listing list mb-4">
                      <div class="table-head my-order-head clearfix px-md-3 px-2 py-2">
                          <div class="row my-1">
                        <div class="col-md-10 col-sm-10 col-8 date-sec">
                            <div class="row">
                                <div class="col-md-7 col-12 ">
                                    <div class="row">
                                        <div class="col-md-7 col-12">
                                            <span>{$language.lblOrderDate} : </span> 
                                            <span class="text-primary font-bold " >{assign var="orderPlacedDate" value=$order.orderCreatedDate} 
                                            <span> {$order.orderCreatedDate|date_format:$settingsDateFormat}
                                            {$order.orderCreatedDate|date_format:$settingsTimeFormat}</span>
                                            </span>
                                        </div>
                                        <div class="col-md-5 col-12">
                                            <span>{$language.lblOrderID} : </span>                                 
                                            <span class="text-primary font-bold"> {$order.orderNumber}</span>  
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-5 col-12 amount-paid">{$language.lblPaidAmount}: <span class="d-inline-block text-primary font-bold font-small">
{$order.orderTotalAmount|default:0|price_order:'':$purchasedCurrency:$userCurrency:$excRate} 
                                                              </span></div>
                            </div>
                        </div>
                        <div class=" col-sm-2 col-4 align-self-center">
                            <div class="clearfix">
                                  <div class="text-right">
                                    {html->anchor href="/user/invoice/id/{$order.masterOrderID}/type/{$order.orderType}/" class="view text-secondary" caption="{$language.lblViewDetails}"  title=$language.lblPurchaseDetails}
                                </div>
                            </div>
                        </div>
                        </div>
                      </div>
                        {assign var="keycount" value=0}
                        {foreach from=$order.items item="item" }
                       
                      {assign var="unserialize" value=$item.extra|unserialize}
                        {assign var="keycount" value=$keycount+1}
                        <div class="product-sec mx-md-4 mx-2 py-3 {if $keycount>2} hide-prdct{/if}">
                      <div class="row">
                        <div class="col-12 col-md-8 clearfix">
                            <div class="item-list clearfix">
                                <div class="img-tag d-md-block d-none border p-1 position-absolute">
                                    <img src="{$view_public_path}/uploads/catalog/product/small/{$item.imagePath}" class="img-fluid" />
                                </div>
                                <div class="product-list01">
                                    {html->anchor title=$unserialize.productOptionName|default:''|unescape:"html" content=$unserialize.productOptionName|default:''|unescape:"html" class="pdt-title d-md-block d-none pdt-details text-dark" tabindex="5" href=$unserialize.productURL|default:''}
                                    {html->anchor href="/user/invoice/id/{$order.masterOrderID}/type/{$order.orderType}/" class="d-md-none d-block position-relative mb-3 pdt-title text-dark" title=$unserialize.productOptionName|default:''|unescape:"html" content=$unserialize.productOptionName|default:''|unescape:"html"} 
                                    {if $unserialize.itemDetails.user.productTitle!=$unserialize.itemDetails.user.productOptionName}
                                    <span class="fade-text">
                                        {$unserialize.itemDetails.user.productOptionName}
                                    </span>
                                    {/if} 
                                    {if $item.sellAsBatch eq 'Yes'}
                                                <div class="font-small">{$language.lblSetof} {$item.qtyPerBatch} {$item.batchType}</div>
                                            {/if}
                                    <div class="quantity-sec d-md-block d-none mt-2">
                                        {$language.lblQty} :  {$item.orderItemQuantity}
                                    </div>
                                    <div class="col-12 col-md-5 d-md-none d-block">
                                        <div class="row price-sec-res p-3">
                                            <div class="col-6 quantity-sec " >
                                                {$language.lblQty} :  {$item.orderItemQuantity}
                                            </div>
                                            <div class="col-6 sub-total-mob">
                                                <p class="text-right m-0">{$language.lblTotal} :  <span class="font-bold text-primary">{$item.orderItemPrice|price_order:'':$purchasedCurrency:$userCurrency:$excRate}</span></p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-12 col-md-4 d-md-block d-none">
                            <div class="clearfix">
                                <div class="text-right rtl-text-left">
                                    <span class="price pb-1 d-block text-primary h4">
									{*{$order.orderTotalAmount|default:0|price:Full:$order.purchasedCurrency:$order.purchasedCurrency}*}
									{$item.orderItemPrice|price_order:'':$purchasedCurrency:$userCurrency:$excRate}
									</span>
                                    <p>{$language.lblOrderStatus} : <span class="bpfc">
                                      {$getDynOrderStatusByKey[$order.dynamicOrderStatus]}</span></p> 
                                </div>
                            </div>
                        </div>
                              </div>
                             </div> 
                        {/foreach}
                        {if $keycount>2}
                         {assign var="pdtcount" value=$keycount-2}
                        <div class="view-all-pro border-top text-center mx-md-4 mx-2 py-3">
                              <a href="javascript:void(0);" class="viewall text-secondary"><span class="more">{$language.lblViewMore} {$pdtcount}</span> <span class="less">{$language.lblViewLess}  {$pdtcount}</span> {$language.lblProducts}</a>
                              </div>
                        {/if}
                       
                      <div class="order-footer clearfix mx-md-4 mx-2 pt-sm-3 pt-0 pb-3 border-bottom border-top row">  
                        <div class="col-sm-4 status-bottom p-0">
                            <p class="mb-1">{$language.lblPaymentMethod} : <span class="font-bold text-primary">{$language.{$order.paySetGroupKey}}</span></p>
                            <p class="mb-1">{$language.lblShippingMethod} : <span class="font-bold text-primary">
                             {if $order.items.0.shippingMethod eq "One Day Delivery"}
                                        {$language.lblOneDayDelivery}
                                        {else if $order.items.0.shippingMethod eq "Free Shipping"}
                                        {$language.lbFreeShipping}
                                        {else if $order.items.0.shippingMethod eq "Flat Rate Shipping"}
                                        {$language.lblFlatRateShipping}
                                        {else if $order.items.0.shippingMethod eq "Same Day Delivery"}
                                        {$language.lblSameDayDelivery}
                                        {else if $order.items.0.shippingMethod eq "All For Free"}
                                        {$language.lblAllForFree}
                                        {else if $order.items.0.shippingMethod eq "Quick Delivery"}
                                        {$language.lblQuickDelivery}
                                        {else if $order.items.0.shippingMethod eq "Same Day Delivery"}
                                        {$language.lblSameDayDelivery}
                                        {else if $order.items.0.shippingMethod eq "Next Day Delivery"}
                                        {$language.lblNextDayDelivery}
                                        {else if $order.items.0.shippingMethod eq "Jihazi Delivery" || $order.items.0.shippingMethod eq "Jihazi Delivery Charge"}
                                       {* {$language.lblJihaziDelivery}*}
                                       {$language.lblMVSDelivery}
                                        {/if}
                           </span></p>
                            
                       </div>
                       <div class="col-sm-8 col-12 p-0 mt-sm-0 mt-2">
                           <div class="sub-total font-small text-uppercase mb-2 d-inline-block w-100 fade-text">
                            <div class="float-right">
                             {$language.lblSubtotalAmount} :     
                               <span class="text-primary font-bold">{$order.orderSubtotal|default:0|price_order:'':$purchasedCurrency:$userCurrency:$excRate} 
                               </span>
                            </div>
                           </div>
                           <div class="float-right">
                             {if $order.userID|default:0 > 0 && ($order.orderStatus=='Process' || $order.orderStatus=='Completed')}
                                {if $order.returnIDs neq ''}
                                    {html->anchor  href="/user/returndetails/id/{$order.masterOrderID}/rid/{$order.returnIDs|default:''}/"  class="btn btn-xs btn-outline-primary cancel-order" id="{$order.masterOrderID}" caption="{$language.lblViewCancelledRequests}"  title="{$language.lblViewCancelledRequests}"} 
                                {else}
                                  {if $order.returnAvailable}  
                                    {html->anchor  href="user/returnrequest/id/{$order.masterOrderID}/"  class="btn btn-xs btn-outline-primary btn-default cancel-order" id="{$order.masterOrderID}" caption="{$order.returnLabel}"  title="{$order.returnLabel}"}                                  
                                 {/if}
                                {/if}
                           {/if}
                           {html->anchor  class="btn btn-xs btn-secondary reorder-bt reordercart ml-1" id="{$order.masterOrderID}" caption="{$language.lblReorder}" title=$language.lblReorder}
                         </div>
                       </div>
                     </div>
                      
                    </li>
                      
                    {/foreach}
                  </ul>
                
                  <div id="smart-paginator"></div>
                  {else}
                  <div class="padding-top padding-bottom">
                  <div class="warning curve-6"> {$language.msgNoRecords}</div>
                      </div>
                  {/if} 
                  {*<!-- End : First Row -->*}
                 
              
               {* <!-- End : Content Pane -->*}
               
              </div>
              </div>
             {* <!-- End : Cart Block --> *}
           
             
          </div>
        </div>
        {*<!-- End : Content Pane --> *}
      </div>
    {*  <!-- Begin : Footer	Pane --> *}
      {include file='CommonBottom.tpl'  } 
      {*<!-- End : Footer Pane --> *}
    </div>
  {*  <!-- End : Outer Pane --> *}
    {html->messages_script id="common_message"}
    {include file='CommonJavaScriptBottom.tpl'  }
    {html->script_group_start name="{$compiled_js_path}/account.purchases.js"}
    {html->script src="{$common_frontend_js}/smartpaginator.js"}
    {html->script src="{$common_frontend_js}/purchases.page.js"}
    {html->script_group_end} 
       <script type="text/javascript">
           $(".viewall").click(function() {
                if ($(this).hasClass("active")) {
                  $(this).parents("li").find('.hide-prdct').slideUp();
                  $(this).removeClass("active");
                } else {
                  $(this).parents("li").find('.hide-prdct').slideDown();
                  $(this).addClass("active");
                }
           });

      </script>
  </body>
</html>
