<?php echo $header; ?>
<?php if ($success) { ?>
<div class="alert alert-success"><i class="fa fa-check-circle"></i> <?php echo $success; ?></div>
<?php } ?>
<?php if ($error_warning) { ?>
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?></div>
<?php } ?>
<div class="login-bg">
  <div class="container">
    <div id="content">
      <div class="account-bg">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#account" data-toggle="tab"><?php echo $text_profile; ?></a></li>
          <li><a href="#history" name="history" data-toggle="tab"><?php echo $text_story_orders; ?></a></li>
          <li><a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a></li>
        </ul>
        <div class="tab-content">
          <div class="tab-pane active" id="account">
            <form action="<?php echo $continue; ?>" method="post" enctype="multipart/form-data">
              <div class="form-group col-md-12 required">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-name"><?php echo $text_firstname; ?>*</label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="text" name="firstname" value="<?php echo $firstname; ?>" id="input-name" class="form-control input-grey ">
                </div>
                <div class="col-sm-6 account-error">
                  <?php if ($error_firstname) { ?>
                  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_firstname; ?></div>
                  <?php } ?>
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-md-12 required">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-name"><?php echo $text_lastname; ?>*</label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="text" name="lastname" value="<?php echo $lastname; ?>" id="input-name" class="form-control input-grey ">
                </div>
                <div class="col-sm-6 account-error">
                  <?php if ($error_firstname) { ?>
                  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_lastname; ?></div>
                  <?php } ?>
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-md-12 required">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-email"><?php echo $text_email; ?>*</label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="text" name="email" value="<?php echo $email; ?>" id="input-email" class="form-control input-grey">
                </div>
                <div class="col-sm-6  account-error">
                  <?php if ($error_email) { ?>
                  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_email; ?></div>
                  <?php } ?>
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-md-12 required">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-phone"><?php echo $text_telephone; ?>*</label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="text" name="telephone" value="<?php echo $telephone; ?>" id="input-phone" class="form-control input-grey">
                </div>
                <div class="col-sm-6  account-error">
                  <?php if ($error_telephone) { ?>
                  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_telephone; ?></div>
                  <?php } ?>
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-md-12">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-city"><?php echo $text_city; ?></label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="text" name="city" value="<?php echo $city; ?>" id="input-city" class="form-control input-grey">
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-md-12 address-bottom">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-address"><?php echo $text_address; ?></label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="text" name="address_1" value="<?php echo $address_1; ?>" id="input-address" class="form-control input-grey">
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="hr-account col-md-12">
                <hr>
              </div>
              <div class="password-title col-sm-12"><?php echo $text_change_password; ?></div>
              <div class="form-group col-md-12">
                <span class="col-sm-2 text-right account-left password-2">
                  <label class="control-label" for="input-name"><?php echo $text_new_password; ?></label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="password" name="password" value="<?php echo $user_password; ?>" id="input-password" class="form-control input-grey">
                </div>
                <div class="col-sm-6  account-error">
                  <?php if ($error_password) { ?>
                  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_password; ?></div>
                  <?php } ?>
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-md-12 form-group-last">
                <span class="col-sm-2 text-right account-left">
                  <label class="control-label" for="input-password2"><?php echo $text_confirm; ?></label>
                </span>
                <div class="col-sm-4 nopadding account-right">
                  <input type="password" name="confirm" value="<?php echo $confirm; ?>" id="input-password2" class="form-control input-grey">
                </div>
                <div class="col-sm-6 account-error">
                  <?php if ($error_confirm) { ?>
                  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_confirm; ?></div>
                  <?php } ?>
                </div>
                <div class="clearfix"></div>
              </div>

              <div class="form-group col-sm-8 col-md-6 col-lg-5 nopadding">
                <input type="submit" value="<?php echo $button_save; ?>" class="btn booking btn-orange pull-right booking-account">
              </div>
              <div class="clearfix"></div>
            </form>
          </div>
          <div class="tab-pane" id="history" >
            <div class="col-sm-12">
              <?php if ($orders) { ?>
              <div class="table-responsive">
                <table class="table table-order">
                  <thead>
                  <tr>
                    <td class="text-left"><?php echo $column_date_added; ?></td>
                    <td class="text-left"><?php echo $column_order_id; ?></td>
                    <td class="text-left"><?php echo $column_total; ?></td>
                    <td class="text-center"><?php echo $column_status; ?></td>
                    <td></td>
                  </tr>
                  </thead>
                  <tbody>
                  <?php foreach ($orders as $order) { ?>
                  <tr>
                    <td class="text-left"><?php echo $order['date_added']; ?></td>
                    <td class="text-left">#<?php echo $order['order_id']; ?></td>
                    <td class="text-left"><?php echo $order['total']; ?></td>
                    <td class="text-center"><?php echo $order['status']; ?></td>
                    <td class="text-right">
                      <a href="<?php echo $order['view']; ?>" data-toggle="tooltip" title="" class="btn btn-info order-view" data-original-title="<?php echo $button_view; ?>"><i class="fa fa-eye"></i></a>
                    </td>
                  </tr>
                  <?php } ?>
                  </tbody>
                </table>
              </div>
              <div class="row">
                <div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
                <div class="col-sm-6 text-right"><?php echo $results; ?></div>
              </div>
              <?php } else { ?>
              <p><?php echo $text_empty; ?></p>
              <?php } ?>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
    $(document).ready(function() {
    jQuery(function($) {
   var params = window
    .location
    .search
    .replace('?','')
    .split('&')
    .reduce(
        function(p,e){
            var a = e.split('=');
            p[ decodeURIComponent(a[0])] = decodeURIComponent(a[1]);
            return p;
        },
        {}
    );
        if(params['history']){
            $('a[href=\'#history\']').tab('show');
        }
    });
});


</script>
<?php echo $footer; ?> 