<?php 
$this->load->view('site/templates/header');
$this->load->model('product_model');
$this->load->model('user_model');
//echo "<pre>";print_r($PublicProfile->row());
?>
<style>
#cboxContent{background:none !important;}

</style>
<div class="main">
  	<div class="content-wrap">
        <div id="header_menu" class="content-wrap-inner clear ">
            <div class="col col4">
                <h1><?php if($this->lang->line('user_purchases') != '') { echo stripslashes($this->lang->line('user_purchases')); } else echo 'Purchases'; ?></h1>
            </div>
           <ul class="col col8 col-last">
                <li class="col col2 selected">
                    <a href="purchase-review"> <?php if($this->lang->line('user_purchases') != '') { echo stripslashes($this->lang->line('user_purchases')); } else echo 'Purchases'; ?> </a>
                 </li>
                 
                <li class="col col2">
                     <a href="settings/my-account/<?=$this->session->userdata['shopsy_session_user_name']?>"> <?php if($this->lang->line('user_settings') != '') { echo stripslashes($this->lang->line('user_settings')); } else echo 'Settings'; ?></a>
                </li>
                
                 <li class="col col2">
                     <a href="settings/giftcards"> <?php if($this->lang->line('giftcard_cards') != '') { echo stripslashes($this->lang->line('giftcard_cards')); } else echo 'Gift Cards'; ?></a>
                </li>
                
                <!--<li class="col col2">
                    <a href="prototypes"><?php if($this->lang->line('user_prototypes') != '') { echo stripslashes($this->lang->line('user_prototypes')); } else echo 'Prototypes'; ?>  </a>
                </li>
                
                <li class="col col2col-last">
                     <a href="javascript:void(0);"><?php if($this->lang->line('user_cases') != '') { echo stripslashes($this->lang->line('user_cases')); } else echo 'Cases'; ?></a>
                </li>-->
                
                <li class="col col2">
                     <a href="public-profile"><?php if($this->lang->line('user_pub_profile') != '') { echo stripslashes($this->lang->line('user_pub_profile')); } else echo 'Public Profile'; ?></a>
                </li>
                <!--
                 <li class="col col2">
                     <a href="javascript:void(0);"><?php if($this->lang->line('user_apps') != '') { echo stripslashes($this->lang->line('user_apps')); } else echo 'Apps'; ?></a>
                </li>-->
            </ul>
        </div>
	</div>
</div>    
<!-- purchases and Review -->        
</header>
<!-- header_end -->
<!-- section_start -->
<div class="purchase_review">    	
     <div class="main">    
       	<div class="all-purchase-search">
        		<div class="top_list">
                <ul style="width:auto;" class="listtypename">
                    <li class="first_list1 <?php if(!$this->uri->segment(2) && !isset($_GET['query'])){echo 'first_list first_list_seleted';}?>">
                        <a class="top_first_line" href="purchase-review"><?php if($this->lang->line('user_all_purchases') != '') { echo stripslashes($this->lang->line('user_all_purchases')); } else echo 'All Purchases'; ?> <?php if(!$this->uri->segment(2) && !isset($_GET['query'])){echo count($purchaseProducts);} ?></a>
                    </li>
                    <?php if(isset($_GET['query'])){?>
                    <li class="first_list1 <?php if(isset($_GET['query'])){echo 'first_list first_list_seleted';}?>">
                        <a class="top_first_line" ><?php if($this->lang->line('search_result') != '') { echo stripslashes($this->lang->line('search_result')); } else echo 'Search Results'; ?> <?php if(isset($_GET['query'])){ echo count($purchaseProducts);} ?></a>
                    </li>
                    <?php } ?>
                    <li class="first_list2 <?php if($this->uri->segment(2)=='canceled'){echo 'first_list first_list_seleted';}?>">
                        <a class="top_first_line" href="purchases/canceled">canceled <?php if($this->uri->segment(2)=='canceled'){ echo count($purchaseProducts); }?></a>
                    </li>
                    <!--<li class="first_list2 <?php if($this->uri->segment(2)=='processing'){echo 'first_list first_list_seleted';}?>">
                        <a class="top_first_line" href="purchases/processing">Processing <?php if($this->uri->segment(2)=='processing'){ echo count($purchaseProducts); }?></a>
                    </li>
                    <li class="first_list3 <?php if($this->uri->segment(2)=='received'){echo 'first_list first_list_seleted';}?>">
                        <a class="top_first_line" href="purchases/received">Received <?php if($this->uri->segment(2)=='received'){ echo count($purchaseProducts); }?></a>
                    </li>
                    <li class="first_list4 <?php if($this->uri->segment(2)=='canceled'){echo 'first_list first_list_seleted';}?>">
                        <a class="top_first_line" href="purchases/canceled">Canceled <?php if($this->uri->segment(2)=='canceled'){ echo count($purchaseProducts); }?></a>
                    </li>-->
                </ul>
      			</div>
                    
                    <div class="purchase-search">
                        <div class="review-search-bar">
                        <form method="get" action="purchase-review">
                        	<input type="text" placeholder="<?php if($this->lang->line('user_search_ur_purch') != '') { echo stripslashes($this->lang->line('user_search_ur_purch')); } else echo 'Search your purchase'; ?>" name="query" id="query" value="<?php echo $this->input->get('query'); ?>" />
                        </form>
                        </div>
                    </div>
                </div>
		<section style="background:#EFEFEB">
<?php if($userPurchase->num_rows()==0) {?>
			<div id="bowse-items"class="col10">
            <?php 
					$user_browse_awesome = str_replace("{SITENAME}",$siteTitle,$this->lang->line('user_browse_awesome'));
				?>  
            
            
       		<h3><b><?php if($this->lang->line('user_no_purch_no_prob') != '') { echo stripslashes($this->lang->line('user_no_purch_no_prob')); } else echo 'No Purchases? No Problem'; ?>!</b> <?php if($this->lang->line('user_browse_awesome') != '') { echo stripslashes($user_browse_awesome); } else echo 'Browse '.stripslashes($siteTitle).' for awesome items.'; ?></h3>
           	<ul class="browse-links">
             		<?php $count=0; foreach ($this->data['mainCategories']->result() as $row){ 
							if ($row->cat_name != '' && $row->image != ''){ 
							$commentData = $this->category_model->get_all_counts($row->id,''); 
							if($commentData[0]['disp']>0){ $count++;
                     ?>
                      <li>
                        <a href="category-list/<?php echo $row->id;?>-<?php echo $row->seourl;?>">
                            <div class="browse-image-tag">
                            <img src="images/category/<?php echo $row->image; ?>" width="130" height="130" alt="<?php echo $row->cat_name;?>">
                            <h4><?php echo $row->cat_name;?></h4>
                            </div>
                        </a>
                      </li>
                    <?php 
							if($count==5){break;}
							}
						}						
                    }
                    ?>
                </ul>	
       
       		</div>
<?php } else if($userPurchase->num_rows()>0) { ?> 
        	<div class="property_page">
            <?php foreach($purchaseProducts as $Purchase) { ?>
            	<div class="container" style="margin:0">                
                <div class="property_right">
                    <div class="property_header">
                    	<p> <?php if($this->lang->line('user_purch_from') != '') { echo stripslashes($this->lang->line('user_purch_from')); } else echo 'Purchase from'; ?></p>
                        <a class="names-it" href="shop-section/<?php echo $Purchase->shopname; ?>"><span class="newimages"></span><?php echo $Purchase->shopname; ?></a>
                        <P>on <?php $datestring ="%M %d,%Y "; $time = $Purchase->inserttime; echo mdate($datestring,$time); ?></P>
                    </div> 
                <div class="property-section">
                <?php if($Purchase->thumbnail!=''){ $profile_pic='users/thumb/'.$Purchase->thumbnail; } else { $profile_pic='default_avat.png';}?>
                    <div class="property_section_top">
                        <img src="images/<?php echo $profile_pic; ?>" />
                       
                        <div class="order_side">
                        <div class="order_side-left">
                        <span class="order_text"><?php if($this->lang->line('user_ord_no') != '') { echo stripslashes($this->lang->line('user_ord_no')); } else echo 'Order Number'; ?>:</span> <label class="order_text-number"><?php echo $Purchase->dealCodeNumber; ?></label>
                        </div>
                        <div class="order_side-right">
                        <span class="trans_text"><?php if($this->lang->line('user_txn_time') != '') { echo stripslashes($this->lang->line('user_txn_time')); } else echo 'Transaction Time'; ?></span><label class="tranr_text-number"><?php echo mdate("%Y-%m-%d %h-%m-%s",$Purchase->inserttime); ?></label>
                        <?php if($purchasestatus!='Canceled'){ ?>
                        <span class="amt_text">Status<label class="amt_text-number"><?php echo $Purchase->status; ?></label></span>
                        <?php } ?>
                        </div>
                        </div>
                    </div>
                </div>
                </div>    
                <div class="property_left">
                	
                    <h4 ><?php if($this->lang->line('user_from') != '') { echo stripslashes($this->lang->line('user_from')); } else echo 'From'; ?> <?php echo $Purchase->ship_from; ?> <a class="hover_content" href="#"><?php if($this->lang->line('user_to') != '') { echo stripslashes($this->lang->line('user_to')); } else echo 'to'; ?> <?php echo $Purchase->shippingcountry; ?><div class="hover_lin">
                    <span><?php echo $Purchase->shippingcity; ?></span>
                    <span><?php echo $Purchase->shippingstate; ?></span>
                    <span><?php echo $Purchase->shippingcountry; ?></span>
                    <span class="blak-arrow"></span>
                </div></a></h4>
                    
                    </h4>
                    <div class="button_prev">
                    <?php if($purchasestatus=='Canceled'){ ?>
                    	<a class="button_view" href="delete-order/<?php echo $Purchase->dealCodeNumber; ?>"><?php if($this->lang->line('user_delete') != '') { echo stripslashes($this->lang->line('user_delete')); } else echo 'Delete this order'; ?></a>
                    <?php } ?>
                    <?php if($purchasestatus!='Canceled'){ ?>
                    <a class="button_view reg-popupnxt" onclick="contacttheshop('<?php echo $this->session->userdata('shopsy_session_user_id'); ?>','<?php echo $Purchase->dealCodeNumber; ?>');" href="javascript:void(0);"><?php if($this->lang->line('user_cont_shop') != '') { echo stripslashes($this->lang->line('user_cont_shop')); } else echo 'Contact the Shop'; ?></a>
                    
                    <a class="button_view2" href="view-order/<?php echo $Purchase->user_id; ?>/<?php echo $Purchase->dealCodeNumber; ?>" target="_blank"><?php if($this->lang->line('user_view_receipt') != '') { echo stripslashes($this->lang->line('user_view_receipt')); } else echo 'View Receipt'; ?></a>
                    <?php } ?>
                    <a class="button_view2" href="discussion/<?php echo $Purchase->dealCodeNumber; ?>"><?php if($this->lang->line('user_view_discussion') != '') { echo stripslashes($this->lang->line('user_view_discussion')); } else echo 'View Discussion'; ?></a>
                    </div>
                </div>                          		     
            	</div>
            <?php } ?>
        	</div>
<?php } ?>        
		</section> 
	</div> 
</div>

<div style='display:none'>

  <div id='inline_nxt' style='background:#fff;'>  
	<div class="conversation">
    <div class="conversation_container">
    <h2 class="conversation_headline"><?php if($this->lang->line('user_new_conver') != '') { echo stripslashes($this->lang->line('user_new_conver')); } else echo 'New conversation with Vanessa Painter from DesignMeJewelry'; ?> </h2>
    
    <div class="conversation_thumb">
    <img width="75" height="75" src="images/default_avat.png">
    </div>
    <div class="conversation_right">
    <input class="conversation-subject" type="text" name="subject" placeholder="<?php if($this->lang->line('user_subject') != '') { echo stripslashes($this->lang->line('user_subject')); } else echo 'Subject'; ?>" value="<?php if($this->lang->line('prod_reorder') != '') { echo stripslashes($this->lang->line('prod_reorder')); } else echo 'Re: Order'; ?> #<?php echo $Purchase->dealCodeNumber; ?> on Apr 18, 2014">
    <textarea class="conversation-textarea" rows="11" name="message_text" placeholder="<?php if($this->lang->line('user_msg_txt') != '') { echo stripslashes($this->lang->line('user_msg_txt')); } else echo 'Message text'; ?>"></textarea>
    <input class="subscribe_btn" type="button" value="<?php if($this->lang->line('user_send') != '') { echo stripslashes($this->lang->line('user_send')); } else echo 'send'; ?>" style="height: auto; padding: 7px 10px; margin: 10px 0 7px 20px; font-weight: bold;">
  	</div> 
    </div>
    </div></div>
  
</div>


<?php 
     $this->load->view('site/templates/footer');
?>


