<?php
$this->load->view("top");
$fieldType = $this->session->userdata('field_type');
$custId = $mres['customers_id'];
$custData = $this->db->query("Select * from wps_customers_address_book where customer_id = '$custId' and address_type = 'Ship' ")->row_array();

?>
<div class="clearfix"></div>
<section class="banner_category" style="background-image: url('<?php echo theme_url(); ?>images/listing-banner.jpg');">
  <div class="container">

    <h1 class="banner_title">My Account</h1>
  </div>
</section>
<div class="page_breadcrumbs">

  <div class="container">

    <ul>

      <li><a href="<?= site_url(); ?>" title="Home">Home</a>

      </li>

      <li>My Account</li>

    </ul>

  </div>

</div>



<section class="my_account_page">

  <div class="container">

    <div class="row">
      <div class="col-md-3">

        <?php $this->load->view('members/left'); ?>

      </div>


      <div class="col-md-9">

        <div class="right_side">

          <h1>My Account</h1>

          <div class="wps_right">
<?php if(is_array($custData) && !empty($custData)) { ?>

            <div class="account-details">
                
                
              <ul class="list-style">
                <li><b>Name</b>: <span> <?php echo $custData['first_name'] ;?></span></li>
                <li><b>Mobile Number</b>: <span> <?php echo $custData['mobile'] ;?></span></li>
                <li><b>Address</b>: <span> <?php echo $custData['address'] ;?></span></li>
                <li><b>Landmark</b>: <span><?php echo @$custData['landmark'] ;?></span></li>
                <li><b>City</b>: <span> <?php echo $custData['city'] ;?></span></li>
                <li><b>Pincode</b>: <span> <?php echo $custData['zipcode'] ;?></span></li>
                <li><b>State</b>: <span> <?php echo $custData['state'] ;?></span></li>
                <li><b>Country</b>: <span> <?php echo $custData['country'] ;?></span></li>
              </ul>
             <a href="<?php echo site_url();?>edit-profile"><button tabindex="" class="checkout_btn edit_save_btn" type="submit" name="submit">Edit Profile</button></a> 
              <div class="clearfix"></div>
            </div>
              <?php } else { ?>
               <div class="text-center mt10 thank-you">

                <h4 class="mb-70 thankyou-text">PLease Update your address</h4>

                <a href="<?= site_url('edit-profile'); ?>" class="checkout_btn" title="Continue Shopping">Edit Profile</a>

              </div>
              <?php } ?>


<!--
            <?php echo error_message();

            echo validation_message();

            if (is_array($orders) && !empty($orders)) {  ?>

              <div class="my_account">

                <div class="my_account my_order">

           
                  <?php foreach ($orders as $key => $val) {
                $orderDets = $this->order_model->get_order_detail($val['order_id']); ?>

                    <div class="order_item">

                      <div class="order_top">

                        <div class="row">

                          <div class="col-lg-5">

                            <a class="orderID" rel="noopener noreferrer" href="<?php echo site_url(); ?>members/order_details/<?php echo $val['order_id']; ?>"><?php echo $val['invoice_number']; ?></a>

                          </div>

                          <div class="col-lg-3 pull-right text-right">

                            <a class="need_btn" href="<?php echo site_url(); ?>members/order_details/<?php echo $val['order_id']; ?>" title="Track"><i class="fa fa-map-marker"></i> Track</a>

                          </div>

                        </div>

                      </div>

                      <div class="order_body">

                        <?php if (is_array($orderDets) && !empty($orderDets)) {

                          foreach ($orderDets as $o => $pageVal) {

                            $furl = get_db_field_value("wps_products", "friendly_url", "WHERE products_id = '" . $pageVal['products_id'] . "'");

                            $img = get_db_field_value("wps_products_media", "media", "WHERE products_id = '" . $pageVal['products_id'] . "'");



                            $productName = get_db_field_value("wps_products", "product_name", "WHERE products_id = '" . $pageVal['products_id'] . "'");

                        ?>

                            <div class="row">

                              <div class="col-lg-5 col-md-5 col-sm-5">

                                <div class="row">

                                  <div class="col-lg-4 col-md-4 col-sm-4">

                                    <a href="<?= $furl; ?>" title="<?php echo $productName; ?>" target="_blank">

                                      <img src="<?php echo get_image('products', $img, '112', '112', 'R'); ?>" alt="<?php echo $productName; ?>" title="<?php echo $productName; ?>">

                                    </a>

                                  </div>

                                  <div class="col-lg-8 col-md-8 col-sm-8">

                                    <div class="order_info">

                                      <a href="<?= $furl; ?>" title="<?php echo $productName; ?>" target="_blank"><?php echo $productName; ?></a>

                                    </div>

                                  </div>

                                </div>

                              </div>

                              <div class="col-lg-7 col-md-7 col-sm-7">

                                <div class="row">

                                  <div class="col-lg-3 col-md-3 col-sm-3">

                                    <div class="order_price"><?php echo display_price($pageVal['product_price'] * $pageVal['quantity']); ?></div>

                                  </div>

                                

                                </div>

                              </div>

                            </div>

                        <?php }
                        } ?>

                      </div>

                      <div class="order_foot">

                        <div class="row">

                          <div class="col-lg-6 col-md-6 col-sm-6">

                            <p>Ordered On <?php echo date('d M Y H:i A', strtotime($val['order_received_date'])); ?></p>

                          </div>

                          <div class="col-lg-6 col-md-6 col-sm-6">

                            <p class="text-right">Order Total <strong><?php echo display_price($val['total_amount']); ?></strong>

                            </p>

                          </div>

                        </div>

                      </div>

                    </div>

                  <?php } ?>



                </div>

              </div>

            <?php } else { ?>

              <div class="text-center mt10 thank-you">

                <h4 class="mb-70 thankyou-text">Sorry, No Orders Found!</h4>

                <a href="<?= site_url('products'); ?>" class="checkout_btn" title="Continue Shopping">Continue Shopping</a>

              </div>

            <?php } ?>
-->

          </div>

        </div>

      </div>



    </div>

  </div>

</section>



<?php $this->load->view("bottom"); ?>