<?php
include("access_cart.php");
include("include/admin.class.php");
include("include/conf.class.php");
$userinfo=$cartCore->get_user_info($CARTUSERNAME);
$cartCore->get_headder_customer();
$cartCore->view_welcome_customer($userinfo['FULL_NAME'],$userinfo['IMAGE']);
$cartCore->view_customer_sidebar($userinfo['USER_ID']);
$cartCore->view_credit($COMPANY_ID,$bk);

$check_value = isset($_POST['ACPT']) ? 1 : 0;
		if($check_value==1)
		{
	$cartAdminMain->process_customer_invoice($CARTUSERNAME,$_SESSION['GLOBAL_ID_FOR_TAX_SHIPPING'],$_SESSION['CURRENCY'],$_SESSION['ITEM_ID'],$_SESSION['QUANTITY_VALUE']);
}

?>
<link rel="stylesheet" href="css/font_awesome_animated.css">
<!-- iCheck -->
    <link href="../vendors/iCheck/skins/flat/green.css" rel="stylesheet">
 <!-- Switchery -->
    <link href="../vendors/switchery/dist/switchery.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="css/set1.css" />
    <script src="js/jquery2.1"></script>
    <script>
	$(document).ready(function () {
    $('#checkdisplay').change(function () {
        if (this.checked) {$('#todisplay').fadeIn('slow');
		$('#billing_country').prop('disabled', true);
		$('#shipping_name').prop('disabled', false);
		$('#shipping_email').prop('disabled', false);
		$('#shipping_telephone').prop('disabled', false);
		$('#shipping_textarea').prop('disabled', false);
		$('#shipping_country').prop('disabled', false);
		
		}
        else {
			$('#todisplay').fadeOut('slow');
			$('#billing_country').prop('disabled', false);
			$('#shipping_name').prop('disabled', true);
		$('#shipping_email').prop('disabled', true);
		$('#shipping_telephone').prop('disabled', true);
		$('#shipping_textarea').prop('disabled', true);
		$('#shipping_country').prop('disabled', true);
		}

    });
});
	</script>
    <script type="text/javascript">
function getPage(id) {
	$('#tax').html('<img src="images/LoaderIcon.gif" />');
	$('#first_total').html('<img src="images/LoaderIcon.gif" />');
	var currency=<?php echo json_encode($_SESSION['CURRENCY']); ?>;
	var total= <?php echo json_encode($cartAdminMain->get_customer_order_step01_total_calculation($_SESSION['ITEM_ID'],$_SESSION['QUANTITY_VALUE'])); ?>;
	var global_id= <?php echo json_encode($_SESSION['GLOBAL_ID_FOR_TAX_SHIPPING']); ?>;
	jQuery.ajax({
		url: "get_page_tax_shipping.php",
		data:{'country_id': id, 'global_id': global_id,'currencyid': currency,'total': total},
		type: "POST",
		dataType: "json",
		success:function(data)
		{
			$('#tax').html(data.tax);
			$('#shipping').html(data.shipping);
			$('#total_shipping_tax').html(data.total_shipping_tax);		
		}
	});
}
getPage(1);
</script>
   

        <!-- top navigation -->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <div class="nav toggle">
                <a id="menu_toggle"><i class="fa fa-bars"></i></a>
              </div>

              <ul class="nav navbar-nav navbar-right">
              
              
              <?=$cartCore->view_userprofile_customer($userinfo['USER_ID'],$userinfo['FULL_NAME'],$userinfo['IMAGE'],$COMPANY_ID,$bk)?>

                <li role="presentation" class="dropdown">
                  <a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-envelope-o"></i>
                    <span class="badge bg-green"><?=$cartAdminMain->getMessageCount($userinfo['USERNAME'])?></span>
                  </a>
                  <ul id="menu1" class="dropdown-menu list-unstyled msg_list" role="menu">
                  <?=$cartAdminMain->getUserMessage($userinfo['USERNAME'])?>
                    <li>
                      <div class="text-center">
                        <a href="message.php?pid=<?=$cartCore->md5_base64_encode($userinfo['USERNAME'])?>">
                          <strong>See All Alerts</strong>
                          <i class="fa fa-angle-right"></i>
                        </a>
                      </div>
                    </li>
                  </ul>
                </li>
              </ul>
            </nav>
          </div>
        </div>
        <!-- /top navigation -->
        
        <?php 
		if(isset($_SESSION['CHECKOUT']) && $_SESSION['CHECKOUT']=="CHECKOUT")
		{ 
		$customer_info=$cartCore->fetch_customer_details_by_user_id($userinfo['USER_ID']);
		
		?>

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <a href="../product/index.php?item_id=<?=$_SESSION['ONE_BACK_ID']?>"  class="btn btn-primary btn-lg"><i class="fa fa-shopping-cart faa-horizontal animated"></i>&nbsp;&nbsp; Continue Shopping</a>
              </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">

              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>CheckOut<small></small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">

<form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" action="form_wizards.php?bk=<?=$bk?>" method="post">
                    <!-- Smart Wizard -->
                    <div id="wizard" class="form_wizard wizard_horizontal"> 
                      <div id="step-1">
                        <div class="row">
             					<div class="col-md-6 col-xs-12">
                					<div class="x_panel">
                  						<div class="x_title">
                    						<h2>Your Order <small></small></h2>
                    						<div class="clearfix"></div>
                  						</div><!-- end order x_title -->
                                        
                                         <section class="content invoice">
                      <!-- title row -->
                      <div class="row">
                        <div class="col-xs-12 invoice-header">
                         
                        </div>
                        <!-- /.col -->
                      </div>
                      <!-- info row -->
                      <div class="row invoice-info">
                        <div class="col-sm-4 invoice-col">
                         
                        </div> 
                      </div>
                      <!-- /.row -->

                      <!-- Table row -->
                      <div class="row">
                        <div class="col-xs-12 table">
                          <table class="table table-striped">
                            <thead>
                              <tr>
                              <th>Product</th>
                              <th>Product Price</th>
                                <th>Qty</th>
                                <th>Subtotal</th>
                              </tr>
                            </thead>
                             <tbody>
                             <?=$cartAdminMain->get_customer_order_step01($_SESSION['ITEM_ID'],$_SESSION['QUANTITY_VALUE'],$_SESSION['CURRENCY']);?>
                            </tbody>
                          </table>
                          <div class="row">
                        <!-- accepted payments column -->
                        <div class="col-xs-6">
                          <p class="lead">Payment Methods:</p>
                         
                          <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
                           
                            <label>
                              <input type="radio" class="flat" checked name="PAYMENT_METHOD" value="pp"> Card Payment
                            </label>

                            <label>
                              <input type="radio" class="flat" name="PAYMENT_METHOD" value="pd"> Pay on Delivery
                            </label>

                            <label>
                              <input type="radio" class="flat" name="PAYMENT_METHOD" value="bi"> Bank Installment
                            </label>
                          </p>
                           <img src="images/visa.png" alt="Visa">
                          <img src="images/mastercard.png" alt="Mastercard">
                          <img src="images/american-express.png" alt="American Express">
                          <img src="images/paypal.png" alt="Paypal">
                          
                       <span class="input input--juro">
					<input class="input__field input__field--juro" type="text" id="input-28" name="PROMO_CODE"/>
					<label class="input__label input__label--juro" for="input-28">
						<span class="input__label-content input__label-content--juro">Enter Your Promotion Code here</span>
					</label>
				</span> 
                        </div>
                         
                        <!-- /.col -->
                        <div class="col-xs-6">
                          <div class="table-responsive">
                            <table class="table">
                              <tbody>
                               <tr>
                              <td>Shipping</td>
                              <td><div id="shipping">0</div></td>
                              </tr>
                              <tr>
                              <td>Tax</td>
                              <td><div id="tax">0</div></td>
                              </tr>
                                <tr style="font-size:large;">
                                  <th style="width:50%;">Total:</th>
                                  <td><div id="total_shipping_tax"><?=$_SESSION['CURRENCY'].' '.$cartAdminMain->get_customer_order_step01_total_calculation($_SESSION['ITEM_ID'],$_SESSION['QUANTITY_VALUE'])?></div></td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                            
                        </div>
                        <!-- /.col -->
                        
                      </div>
                      <!-- /.row -->
                          
                        </div>
                        <!-- /.col -->
                        
                       
                      </div>
                      <!-- /.row -->
                       
                                             
                     
                      <div align="right"> 
                      <div class="checkbox">
                            <label>
                              <input type="checkbox" class="flat" required="required" name="ACPT"> I’ve read and accept the <a href="#" data-toggle="modal" data-target="#myModal">terms & conditions *</a>

                            </label>
                          </div>
                          <br /> 
                      <button type="submit" class="btn btn-success btn-lg" name="SUBMITBTN"><i class="fa fa-money faa-pulse animated"></i>&nbsp;&nbsp;Pay Now</button></div>
                     
                    </section>      
                                        
                                    </div> <!-- end of step-1 x_panel -->
                                </div><!-- end of step1 left column -->
                                
                                
                                <div class="col-md-6 col-xs-12"> <!-- begin of right column -->
                					<div class="x_panel">
                  						 <div class="x_title">
                    						<h2>Billing Details <small></small></h2>
                    						<div class="clearfix"></div> 
                                         </div>
                                       <div class="x_content"> <!-- begin of right colum content -->
                                       
                   
                                            
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Full Name <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="BILLING_NAME" value="<?=$customer_info['FULL_NAME']?>" placeholder="both name(s) e.g Jon Doe" required type="text">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Email <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="email" id="email" name="BILLING_EMAIL" value="<?=$customer_info['EMAIL']?>" required class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Telephone <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="tel" id="telephone" name="BILLING_PHONE" value="<?=$customer_info['TELEPHONE']?>" required data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea">Address <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <textarea id="textarea" required name="BILLING_ADDRESS"  class="form-control col-md-7 col-xs-12"><?=$customer_info['ADDRESS']?></textarea>
                        </div>
                      </div>
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Country <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select required class="form-control col-md-7 col-xs-12" name="BILLING_COUNTRY" id="billing_country" onChange="getPage(this.value);">
                          <?=$cartAdminMain->get_country_by_selected_option($customer_info['COUNTRY']);?>
                          </select>
                        </div>
                      </div>
                                       
                                       </div> <!-- end of right colum content -->
                                    </div> 
                                    
                                </div><!-- end of steo 01 right column -->
                                
                                 <div class="col-md-6 col-xs-12"> <!-- begin of shiiping -->
                						<div class="x_panel">
                  						 	<div class="x_title">
                    							<h2>Shipping Details <small></small></h2>
                    							<div class="clearfix"></div> 
                                         	</div>
                                             
                                       			<div class="x_content">
                                                <label>
                              					<input type="checkbox" name="DIFFERENT_SHIPPING" class="js-switch" id="checkdisplay"/> Ship to a different address?
                            				    </label>
                                                   	<div id="todisplay" style="display:none;"> <!-- begining of shipping form -->
                                                    	 <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Full Name <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="shipping_name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="SHIPPING_NAME" placeholder="both name(s) e.g Jon Doe" required type="text" disabled="disabled">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Email <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="email" id="shipping_email" name="SHIPPING_EMAIL" required class="form-control col-md-7 col-xs-12" disabled="disabled">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Telephone <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="tel" id="shipping_telephone" name="SHIPPING_PHONE" required data-validate-length-range="8,20" class="form-control col-md-7 col-xs-12" disabled="disabled">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea">Address <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <textarea id="shipping_textarea" required name="SHIPPING_ADDRESS" class="form-control col-md-7 col-xs-12" disabled="disabled"></textarea>
                        </div>
                      </div>
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name" >Country <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select class="form-control col-md-7 col-xs-12" id="shipping_country" name="SHIPPING_COUNTRY" onChange="getPage(this.value);" disabled="disabled">
                          <?=$cartAdminMain->get_country_by_selected_option(NULL);?>
                          </select>
                        </div>
                      </div>
                                                    
                                                    
                                             		</div> <!-- end of shipping form -->
                                            	</div>
                                         </div>        
                                    	
                                    </div> <!-- end of shipping -->
                                
                                
                         </div> <!-- finish step1 first row -->  
                       
					
                      </div><!-- end step 01 -->
                      
                      
                      <div id="step-2">
                        <h2 class="StepTitle"></h2>
                      
                      </div>

                    </div>
                    <!-- End SmartWizard Content -->
             </form>

                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
        
         <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Terms and Condition</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
      
    </div>
  </div>
        
        <?php } ?>

        <!-- footer content --><?=$cartCore->get_footer();?>
        <!-- /footer content -->
      </div>
    </div>
    

    <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="../vendors/fastclick/lib/fastclick.js"></script>
      <!-- Switchery -->
    <script src="../vendors/switchery/dist/switchery.min.js"></script>
    <!-- NProgress -->
    <script src="../vendors/nprogress/nprogress.js"></script>
     <!-- validator -->
    <script src="../vendors/validator/validator.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
    <!-- iCheck -->
    <script src="../vendors/iCheck/icheck.min.js"></script>
    
    <script src="js/classie.js"></script>
		<script>
			(function() {
				// trim polyfill : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
				if (!String.prototype.trim) {
					(function() {
						// Make sure we trim BOM and NBSP
						var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
						String.prototype.trim = function() {
							return this.replace(rtrim, '');
						};
					})();
				}

				[].slice.call( document.querySelectorAll( 'input.input__field' ) ).forEach( function( inputEl ) {
					// in case the input is already filled..
					if( inputEl.value.trim() !== '' ) {
						classie.add( inputEl.parentNode, 'input--filled' );
					}

					// events:
					inputEl.addEventListener( 'focus', onInputFocus );
					inputEl.addEventListener( 'blur', onInputBlur );
				} );

				function onInputFocus( ev ) {
					classie.add( ev.target.parentNode, 'input--filled' );
				}

				function onInputBlur( ev ) {
					if( ev.target.value.trim() === '' ) {
						classie.remove( ev.target.parentNode, 'input--filled' );
					}
				}
			})();
		</script>

	
  </body>
</html>