https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/blue-sky.co.id/public_html/application/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/blue-sky.co.id/public_html/application/views/shipping.php
<br>
<style>
	.card {
		border: 1px solid black;
	}
	.table thead th {
		border-bottom: unset;
	}
	.table td, .table th {
		border-top: 1px solid black;
		border-bottom: 1px solid black;
	}
	@media (min-width: 768px) {
		#redeemPoint, #redeemVoucher {
			float: none;
		}
	}
	.btn-primary {
	    color: #ffffff;
	    background-color: <?= $primary_colortheme;?> !important;
	    border-color: <?= $primary_colortheme;?> !important;
	}
	.btn-primary:hover{
		color:#ffffff !important; 
	}
</style>  
<?php if (base_url() == 'https://www.demo1.tokodaku.com/' || 
		base_url() == 'https://www.demo2.tokodaku.com/' || 
		base_url() == 'https://www.demo3.tokodaku.com/' || 
		base_url() == 'https://www.demo4.tokodaku.com/' || 
		base_url() == 'https://www.demo5.tokodaku.com/'): ?> 
	<style>
		/*@media only screen and (min-device-width : 320px) and (max-device-width : 568px) {
			.myCart table, .myCart thead, .myCart tbody, .myCart th, .myCart td, .myCart tr {
			    display: ;
			} 
		}*/
		/*div#shipping_result{
			overflow-x: auto;
		}*/
	</style> 
	<script>
		$(document).ready(function(){  
			// window.matchMedia("(min-width: 401px) and (max-width: 600px)")
			// .addListener(function(e) {
			//   if (e.matches) {
			//     document.body.style.background = "red";
			//   }
			// });
			
			if (window.matchMedia('(min-width : 320px) and (max-width : 568px)').matches) {  
	        	$('div.myCart').removeClass('myCart');
				$("table tr td.hidden-xs-down, table tr th.hidden-xs-down").removeClass('hidden-xs-down');

				$("table.table").css({
					// 'max-width':$("div.container").width()+'px',
					// 'width':$("div.container").width()+'px',
					'max-width':'558px',
					'width':'558px',

				});
		    } 
		    
			// if (window.matchMedia('(max-device-width : 568px)').matches) { 
			// 	alert("<?= base_url(); ?>");
	  //       	$('div.myCart').removeClass('myCart');
			// 	$("table tr td.hidden-xs-down, table tr th.hidden-xs-down").removeClass('hidden-xs-down');

			// 	$("table.table").css({
			// 		// 'max-width':$("div.container").width()+'px',
			// 		// 'width':$("div.container").width()+'px',
			// 		'max-width':'558px',
			// 		'width':'558px',

			// 	});
		 //    } 

		}); 
		function remove_cart_shipping(rowid) {
	        $.ajax({
	            'url'       : '<?= base_url(); ?>' + 'ajax/ajax_remove_cart', 
	            'type'      : 'POST',   
	            'data'      : {
	                          'rowid' : rowid,
	                          '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
	                          },
	            'success'   : function(data) {
	                /*---success----*/
	                window.location.href='';

	            }
	        });
	    }
	</script>
<?php endif ?>
<div class="customer_info_box container">
<div class="row customer_info_box_head">
<div class="col-sm-12">	

	<?php
		$attributes = array(
			'name' => 'shipping_post',
			'id' => 'frm_shipping_post'
		);
	?>
	<?= form_open('payment/post_payment', $attributes); ?> 	

	<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>	
		<div class="row" style="padding-top: 30px;">
	  		<div class="col-sm-12" style="vertical-align: center; text-align: center;">
	  			<p style="font-size: 16px; vertical-align: center"><a href="<?= base_url('login'); ?>"><strong style="color:<?= $primary_colortheme;?>"><?= ucwords(lang('signin'));?></strong></a> <?= ucwords(lang('for_point'));?></p>
	  		</div>	   	
		</div>
	<?php endif; ?>		
	
	<div class="myCart">
		<h3>Pengiriman</h3>	

		<?php
			/* echo '<pre>';
			print_r($this->session->userdata('shipping_cart'));
			echo '</pre>'; */
		?>

		<?php if ($this->session->userdata('shipping_cart')): ?>	

			<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>	
			<div id="check_input_form">
				<div class="row" style="padding-top: 20px;">
					<div class="col-sm-2">
						<p><?= ucwords(lang('name'));?><sup>*</sup></p>
					</div>	
					<div class="col-sm-8">
						<input type="text" id="shippingName" name="name" required style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('fullname'));?>*">
					</div>	
				</div>	

				<div class="row" style="padding-top: 20px;">
					<div class="col-sm-2">
						<p><?= ucwords(lang('phone'));?><sup>*</sup></p>
					</div>	
					<div class="col-sm-8">
						<?php
							$data = array( 
								'name'        => 'phone',
								'class'       => 'form-control',
								'required'	  => 'required',	
								'type'		  => 'number',
								'id'		  => 'shippingPhone',
								'placeholder' => ucwords(lang('phone_number'))
							);
							echo form_input($data);
							echo '<span style="font-size:12px;">' . form_error('phone') . '</span>';
						?>
					</div>	
				</div>	

				<div class="row" style="padding-top: 20px;">
					<div class="col-sm-2">
						<p><?= lang('email'); ?><sup>*</sup></p>
					</div>	
					<div class="col-sm-8">
						<input type="text" id="email" name="email" required style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('emailadd'));?>*">
					</div>	
				</div>	

			<?php endif; ?>	

			<!-- <p><span id="addressMessage" style="color: red;"></span></p>  -->
			<div class="row" style="padding-top: 20px;">
				<div class="col-sm-2">
					<p><?= ucwords(lang('destination'));?><sup>*</sup></p>
				</div>	
				<div class="col-sm-8">
					<div class="row">
						<div class="col-sm-4">

<?php 

$free_shipping_type = 
$this->db->select('free_shipping_type')
->from('configuration')
->where('id_configuration',1)->get()->row()
->free_shipping_type;

$condition_freeshipping = false;

if($free_shipping_type == 'region') {
	$selected_region_province = 
	$this->db->select('*')
	->from('free_shipping_region')
	->where('configuration_id',1)
	->where('province_id',$shipping->shipping_id_province)
	->get();

	if($selected_region_province->num_rows() > 0){
		$condition_freeshipping = true; 
	}
}
 
  

// echo $shipping->shipping_id_province; exit();

 ?>

<select style="border-radius: 0;" required id="shipping_province" name="shipping_province" class="form-control">
	<option value=""><?= ucwords(lang('choose_province'))?></option>
	<?php foreach($shipping_provinces as $shipping_province) : ?>
		<option value="<?= $shipping_province->rajaongkir_province_id; ?>"
			<?php if($shipping_province->rajaongkir_province_id == $shipping->shipping_id_province) : ?>
				selected
			<?php endif; ?>	
			><?= ucwords($shipping_province->province); ?></option>
	<?php endforeach; ?>	
</select> 

						</div>	
						<div class="col-sm-4">
							<select style="border-radius: 0;" required id="shipping_district" name="shipping_district" class="form-control">
							<option value=""><?= ucwords(lang('choose_district'))?>...</option>	
							<?php if (isset($shipping_district_lists)) : ?>  
			                    <?php foreach($shipping_district_lists as $shipping_district) : ?>
			                        <option value="<?= $shipping_district->rajaongkir_id_district; ?>"
										<?php if($shipping_district->rajaongkir_id_district == $shipping->shipping_id_district) : ?>
											selected
										<?php endif; ?>	
			                        	><?= ucwords($shipping_district->district); ?></option>
			                    <?php endforeach; ?>
			                <?php endif; ?>
							</select>
						<?php echo '<span style="font-size:10px;">' . form_error('shipping_district') . '</span>'; ?>
						</div>	
						<div class="col-sm-4">
							<select style="border-radius: 0;" required id="shipping_subdistrict" name="shipping_subdistrict" class="form-control">
							<option value=""><?= ucwords(lang('choose_subdistrict'))?>...</option>	
							<?php if (isset($shipping_subdistrict_lists)) : ?>  
			                    <?php foreach($shipping_subdistrict_lists as $shipping_subdistrict) : ?>
			                        <option value="<?= $shipping_subdistrict->rajaongkir_id_subdistrict; ?>"
										<?php if($shipping_subdistrict->rajaongkir_id_subdistrict == $shipping->shipping_id_subdistrict) : ?>
											selected
										<?php endif; ?>	
			                        	><?= ucwords($shipping_subdistrict->subdistrict); ?></option>
			                    <?php endforeach; ?>
			                <?php endif; ?>
							</select> 
							<?php echo '<span style="font-size:10px;">' . form_error('shipping_subdistrict') . '</span>'; ?>
						</div>	
					</div>	
				</div>	
			</div>	

			<script>
			jQuery(document).ready(function() {

				jQuery('#shipping_province').change(function() {
					jQuery('#shipping_subdistrict').empty(); //to empty select box
			        var id_shipping_province = jQuery(this).val();
			        load_shipping_district_ajax(id_shipping_province);
			    });  

				jQuery('#shipping_district').change(function() {
					var id_shipping_district = jQuery(this).val();
					load_shipping_subdistrict_ajax(id_shipping_district);
				}); 

				jQuery('#shipping_subdistrict').change(function() {
					var id_shipping_province = jQuery('#shipping_province').val();
					var id_shipping_district = jQuery('#shipping_district').val();
					var id_shipping_subdistrict = jQuery(this).val();
					reload_shipping_result(id_shipping_province, id_shipping_district, id_shipping_subdistrict);
				}); 
			});	

			function formatIDR(angka, prefix){
				var number_string = angka.toString().replace(/[^,\d]/g, '').toString(),
				split   		= number_string.split(','),
				sisa     		= split[0].length % 3,
				rupiah     		= split[0].substr(0, sisa),
				ribuan     		= split[0].substr(sisa).match(/\d{3}/gi);
			 
				// tambahkan titik jika yang di input sudah menjadi angka ribuan
				if(ribuan){
					separator = sisa ? '.' : '';
					rupiah += separator + ribuan.join('.');
				}
			 
				rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;
				return prefix == undefined ? rupiah : (rupiah ? 'IDR ' + rupiah : '');
			}

		    function load_shipping_district_ajax(id_shipping_province) {
		        jQuery.ajax({
		            'url'       : '<?= base_url(); ?>' + 'ajax' + '/ajax_get_shipping_district',  
		            'type'      : 'POST', 
		            'data'      : {
						          'id_shipping_province' : id_shipping_province,
								  '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
								  },  
		            'success'   : function(data) {
		                 jQuery('#shipping_district').html(data).focus(); 
		            }
		        });
		    } 

			function load_shipping_subdistrict_ajax(id_shipping_district) {
				jQuery.ajax({
					'url'       : '<?= base_url(); ?>' + 'ajax' + '/ajax_get_shipping_subdistrict',
					'type'      : 'POST',
					'data'      : {
						           'id_shipping_district' : id_shipping_district,
								   '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
								  }, 
					'success'   : function(data) {
						jQuery('#shipping_subdistrict').html(data).focus();  
					}
				});
			}

			function reload_shipping_result(id_shipping_province, id_shipping_district, id_shipping_subdistrict) {

				<?php 
				if ($condition_freeshipping == true) {
				?>
				var condition_freeshipping = true;
				<?php 
				}else{
				 ?>
				var condition_freeshipping = false; 
				<?php }  ?>
				
				jQuery.ajax({
					'url'       : '<?= base_url(); ?>' + 'shipping' + '/ajax_reload_shipping_result',
					'type'      : 'POST',
					'data'      : {
								   'id_shipping_province' : id_shipping_province,
								   'condition_freeshipping' : condition_freeshipping,	
						           'id_shipping_district' : id_shipping_district,
						           'id_shipping_subdistrict' : id_shipping_subdistrict,
								   '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
								  }, 
					'success'   : function(data) {

						jQuery('#shipping_result').empty(); 
						// console.log(data); 
						jQuery('#shipping_result').html(data);  
						jQuery('#spinner<?= $count; ?>').hide();
					}
				});
			}
			</script>

				<div class="row" style="padding-top: 20px;">
					<div class="col-sm-2">
						<p><?= ucwords(lang('address'))?><sup>*</sup></p>
					</div>	
					<div class="col-sm-8">
						<textarea name="address" id="shipping_address" required style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('deliv_address'))?>*"><?= $shipping->shipping_address; ?></textarea>
					</div>	
				</div>	

				<div class="row" style="padding-top: 20px; display: none;">
					<div class="col-sm-2">
						<p><?= ucwords(lang('postcode'))?></p>
					</div>	
					<div class="col-sm-8">
						<input type="text" id="shipping_postcode" name="postcode" style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('postcode_enter'))?>..." value="<?= $shipping->shipping_postcode; ?>">
					</div>	
				</div>	
			</div>

				<br><br>	

			<div id="shipping_result">	

				<div class="table-responsive">
					<table class="table" style="border-top:1px solid #999999; border-bottom:1px solid #999999;  width: 100%;">
						<thead>  
							<tr>
								<th><?= ucwords(lang('product_name'))?></th>
								<th class="hidden-xs-down"><?= ucwords(lang('price'))?></th>
								<th class="hidden-xs-down"><?= ucwords(lang('quantity'))?></th>
								<th class="hidden-xs-down"><?= ucwords(lang('sent'))?></th>
								<th class="hidden-xs-down"><?= ucwords(lang('shipping_method'))?></th>
								<th class="hidden-xs-down">Sub Total</th>
								<th class="hidden-xs-down"></th>
							</tr>	
						</thead>

						<tbody>
								<?php $count = 0; ?>
								<?php $grand_total = 0; ?>
								<?php $total_shipping_fee = 0; ?>
								<?php foreach ($this->session->userdata('shipping_cart') as $rowid => $item): ?>
									<?php  
									error_reporting(0);
									// $fs_cek_product = $this->db->select('id')->from('flashsale_products')->where('product_id',$item['id'])->where('flashsale_id',$this->session->userdata('flashsale_id_active'))->get()->row()->id;
									$fs_cek_product = null;
									
									$query_cek_flashsale_product = $this->db->
									select('id')->from('flashsale_products')
									->where('product_id', $item['product_id'])
									->where('flashsale_id',$this->session->userdata('flashsale_id_active'))
									->where('product_details_id',$item['id'])->get();

									if ($query_cek_flashsale_product->num_rows()>0) { 

										$fs_cek_product = $query_cek_flashsale_product->row()->id;
									}

									$count++; 
									?>
									
									<tr>
										<td class="hidden-xs-down">
											<?php if ($fs_cek_product != null): ?>
												<small style="color: red;border: 1px solid red;padding: 3px;border-radius: 6px;">Flash Sale</small>
												<br>
											<?php endif ?>
											<?= strtoupper($item['name']); ?>
											<br>
											<?= get_attribute_name($item['attribute_detail_ids']); ?><br><span style="font-size: 12px;"><?= $item['sku']; ?></span>
										</td>
										<td class="hidden-xs-down">
											IDR <?= number_format($item['price']); ?><br>
											<?= $item['indent_message']; ?>	
										</td>

										<td style="width: 14%;" class="hidden-xs-down">
	<?php 
	if($fs_cek_product != null):
	?>
		<div class="count-input space-bottom" style="display: inline-block;">
	      	<input style="text-align: center;" readonly="readonly" class="quantity productQuantity<?= $count; ?>" type="text" name="quantity" value="<?= $item['qty']; ?>"/>
	    </div>

	<?php else: ?>

	<?php $css_btn_incr="margin-left:-9px;"; 
	if ($this->session->userdata('customer')):
		$css_btn_incr="margin-left:-17px;"; 	 
	?>
	<?php endif ?>												
	<div class="root_incr-btn count-input space-bottom" style="display: flex; justify-content: space-between;">
		<div class="div_incr-btn1" style="margin-top: 2px;  z-index:1;position: absolute;margin-left: 8px;">
			<a style="padding-bottom: 5px; padding-top: 2px;" class="incr-btn btnMin<?= $count; ?>" data-action="decrease" href="#">–</a>
		</div>
		<div class="div_incr-btn2" style="width: 100%;">
			<input style="width: 104%; text-align: center;" readonly="readonly" class="quantity productQuantity<?= $count; ?>" type="text" name="quantity" value="<?= $item['qty']; ?>"/>
		</div>
		<div class="div_incr-btn3" style="margin-top: 2px; <?= $css_btn_incr; ?>">
			<a style="padding-bottom: 5px; padding-top: 2px;" class="incr-btn btnAdd<?= $count; ?>" data-action="increase" href="#">&plus;</a>
		</div> 
		
    </div>
											<?php endif; ?>
											<p class="noStock<?= $count; ?>" style="color:red;"><?= $this->session->flashdata('no_stock' . $rowid); ?></p>
										</td>
										<td class="hidden-xs-down"><?= ucwords($item['warehouse_name']); ?><br>
											<span id="spinner<?= $count; ?>"><img width="40" src="<?= base_url('uploads/spinner.gif'); ?>"></span>
										</td>
										<td>
		<ul id="shippingNameBlock<?= $count; ?>" style="list-style: none; padding-left: 0;">

			<?php $count_shipping = 0; ?>

			<?php

			// echo "<pre>";
			// var_dump($item['shipping_method_ids']);
			// exit();

			?>
			<?php foreach ($item['shipping_method_ids'] as $shipping_id) : ?>

				<?php $count_shipping = $count_shipping + 1; ?>
				<?php if($shipping_id == 2): ?>
					<?php
						//get self delivery fee from configuration table
						$this->db->select('shopdelivery_fee')->from('configuration')->where('id_configuration', 1);
						$shopdelivery_fee = $this->db->get()->row()->shopdelivery_fee;
						$shipping_name = 'Express';
						// $shipping_name = '2 Hour Delivery';
						$total_shipping_fee = $shopdelivery_fee;
					?> 
				<?php else : ?>
					<?php 
						$shipping_info = calculate_shipping_fee($shipping_id, $item['warehouse_id'], $item['product_id'], $item['id'], $item['qty'], $shipping->shipping_id_subdistrict); 
						$shipping_name = $shipping_info['shipping_name'];
						$total_shipping_fee = $shipping_info['total_shipping_fee'];
						if($shipping_id == 1){
							$shipping_name = 'Same Day'; 
						}
						if($shipping_id == 3){
							$shipping_name = 'Regular'; 
						}
						if($shipping_id == 4){
							$shipping_name = 'Next Day'; 
						}
					?>
				<?php endif; ?>	

				<?php 
					$estimated_time = '';
					switch (strtolower(trim($shipping_name))) {
						case 'express':
							$estimated_time = '1-6h';
							break;

						case 'regular':
							$estimated_time = '1-3d';
							break;

						case 'next day':
							$estimated_time = '1d';
							break;

						case 'indent':
							$estimated_time = '1-3d';
							break;

						case 'same day':
							$estimated_time = '';
							break;
						
						default:
							# code...
							break;
					}
				?>

				<?php if($total_shipping_fee > 0 || isset($shipping_info['free_shipping_applied'])) : ?>
			
					<li>
						<input type="radio" class="shipping_method<?= $rowid; ?>" name="shipping_method<?= $rowid; ?>" value="<?= $shipping_id; ?>"

						<?php if($item['chosen_shipping_id'] == $shipping_id) : ?>
							<?php $active_shipping_fee = $total_shipping_fee; ?>
							checked	
						<?php endif; ?>	
						> <?= ucwords($shipping_name)." ".strtoupper($estimated_time); ?> 
 
							<?php if($condition_freeshipping == true) : ?>
								(Free)
							<?php else: ?>
								<?php if($total_shipping_fee == 0) : ?>
									(Free)
								<?php else : ?>
									<?php if($shipping_id == 5) : ?>
										(IDR <span id="shippingFee<?= $count_shipping; ?>"><?= number_format($total_shipping_fee); ?></span>)
										<!-- TBC -->
									<?php else : ?>
										(IDR <span id="shippingFee<?= $count_shipping; ?>"><?= number_format($total_shipping_fee); ?></span>)
									<?php endif; ?>	
								<?php endif; ?>
							<?php endif; ?>  

								

					</li>	

				<?php endif; ?>

			<?php endforeach; ?>

		</ul>
										</td>
										<td class="hidden-xs-down">
											IDR <span id="subTotal<?= $count; ?>"><?php echo number_format(($item['price'] * $item['qty'])); ?></span>
										</td>

										<?php 

										$real_rowid = null;
										foreach ($this->cart->contents() as $real_key) {
											if ((int)$real_key['id'] == (int)$item['id']) {
												$real_rowid = $real_key['rowid'];
											}
										}

										?>
							                
										<td class="hidden-xs-down" style="padding-left: 0px;">
											<a onclick="remove_cart_shipping('<?= $real_rowid; ?>');" title="Hapus" href="#">
												<i class="fa fa-trash"></i>
											</a>
										</td>
									</tr> 

									<!-- <?php /*$total_shipping_fee = $total_shipping_fee + $item['shipping_fee'];*/ ?> -->

									<?php $grand_total = $grand_total + $item['subtotal']; ?>

								<?php endforeach; ?>
								
							</form>
						</tbody>
					</table>
				</div>
				
				<div class="row">
					<div class="col-sm-6" style="padding-bottom: 15px;">
						<div class="row" style="margin-bottom: 15px;">

							<?php if ($data_point_rewards->active == 'yes'): ?>
								
								<?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?>
									<div class="col-sm-12">
										<p><?= ucwords(lang('you_have'))?> <?= $current_point; ?> <?= ucwords(lang('points'))?>. 1 <?= ucwords(lang('points'))?> <?= ucwords(lang('can_redeem'))?> IDR <?= $point_rewards->conversion;?></p>							
									</div>
								<?php endif; ?>	
								<div class="col-sm-6 col-6">
									<input class="form-control" type="number" id="point" placeholder="<?= strtoupper(lang('point_rewards'))?>"
									<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>
										readonly disabled
									<?php endif; ?>	
									>
									<p id="error_point" style="color: red"></p>
								</div>
								<div class="col-sm-6 col-6 buttonTukar">
									<a 
									<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>
										readonly disabled
									<?php endif; ?>

									class="btn btn-primary btn-buy" id="redeemPoint" style="color: white !important;width: 150px;float: none;"><?= strtoupper(lang('redeem'))?></a>
									<?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?>
										<span id="spinnerPoint" style="position: absolute;"><img width="40" src="<?= base_url('uploads/spinner.gif'); ?>"></span>
									<?php endif; ?>
								</div>					
							<?php endif ?>					
							
													
						</div>					
						<div class="row">
							<div class="col-sm-6 col-6">
								<input class="form-control" type="text" id="voucher" placeholder="VOUCHER"
								<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>
									readonly disabled
								<?php endif; ?>
								>
								<p id="error_voucher" style="color: red"></p>
							</div>
							<div class="col-sm-6 col-6 buttonTukar">
								<a 
								<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>
									readonly disabled
								<?php endif; ?>

								class="btn btn-primary btn-buy" id="redeemVoucher" style="color: white !important;width: 150px;float: none;"><?= strtoupper(lang('redeem'))?></a>
								<?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?>
									<span id="spinnerVoucher" style="position: absolute;"><img width="40" src="<?= base_url('uploads/spinner.gif'); ?>"></span>
								<?php endif; ?>
							</div>
							<?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?>
								<div class="col-sm-12">
									<p><a href="<?= base_url('login'); ?>" style="text-decoration: none; font-weight: bold; color:<?= $primary_colortheme;?>"><?= ucwords(lang('signin'))?></a> <?= ucwords(lang('for_point_bottom'));?></p>
								</div>
							<?php endif; ?>
						</div>


						<input type="hidden" id="voucherprice_input">
						<input type="hidden" id="pointrewards_input">
					</div>
					<div class="col-sm-6">
						<style type="text/css">
							.tk_line{
								float: right;
								width: 70%;
								border-top: 1px solid black;
							}
							@media screen and (max-width: 768px){
								.tk_line{
									width: 100%;
								}
							}
						</style>
						<div class="row" style="height: 25px;">
							
							<div class="col-md-8 col-sm-6 col-6 displayProducttotal" style="text-align: right;">
								<p><span><?= ucwords(lang('product_total'))?> :</span></p>
							</div>
							<div class="col-md-4 col-sm-6 col-6 displayProducttotal" style="text-align: right;">
								<p><span>IDR </span><span id="totalItemAmount"><?= number_format($grand_total); ?></span></p>
							</div>						
						</div>
						<div id="voucherBlock" class="row" style="height: 25px;">
							<div class="col-md-8 col-sm-6 col-6" style="text-align: right;">
								<p><span>Voucher <span id="voucherdiscount"></span>:</span></p>
							</div>
							<div class="col-md-4 col-sm-6 col-6" style="text-align: right;">
								<p><span>IDR </span><span id="voucherprice"><?= number_format(0); ?></span></p>
							</div>						
						</div>
						<div id="pointrewardBlock" class="row" style="height: 25px;">
							<div class="col-md-8 col-sm-6 col-6" style="text-align: right;">
								<p><span><?= ucwords(lang('point_rewards'))?> :</span></p>
							</div>
							<div class="col-md-4 col-sm-6 col-6" style="text-align: right;">
								<p><span>IDR </span><span id="pointrewards"><?= number_format(0); ?></span></p>
							</div>						
						</div>
						<div class="row" style="height: 25px;">
							<div class="col-md-8 col-sm-6 col-6 displayShipping" style="text-align: right;">
								<p><span><?= ucwords(lang('shipping_fee'));?> :</span></p>
							</div>
							<div class="col-md-4 col-sm-6 col-6" style="text-align: right;">
		<?php if($condition_freeshipping == true) : ?>
			<?= ucwords(lang('free'));?>
		<?php else: ?>
			<?php if($no_of_indent > 0 && $no_of_instock == 0) : ?>

				<?php if ($total_shipping_fee == 0): ?>
					<p><?= ucwords(lang('free'));?></p>
				<?php else: ?>
					<p>
						<!-- Tba -->
						<span>IDR </span><span id="totalShippingFee"><?= number_format($total_indent_shipping_fee); ?></span>
					</p> 
				<?php endif ?>


			<?php else : ?>
 
					
				<p><span>IDR </span><span id="totalShippingFee"><?= number_format($final_total_shipping_fee - $total_indent_shipping_fee); ?></span></p>
			 

				
			<?php endif; ?>

		<?php endif; ?>	 	
							</div>						
						</div>

						<div id="freeshippingBlock" class="row" style="height: 25px;">
							<div class="col-md-8 col-sm-6 col-6" style="text-align: right;">
								<p><span><?= ucwords(lang('free_ship'))?> :</span></p>
							</div>
							<div class="col-md-4 col-sm-6 col-6" style="text-align: right;">
								<?php if($free_shipping_fee >= 0): ?>
									<?php if (isset($min_transaction)): ?>
										<?php if ($grand_total >= $min_transaction): ?>
											<?php $free_shipping_fee = $free_shipping_fee; ?>
										<?php else: ?>
											<?php $free_shipping_fee = 0; ?>
										<?php endif; ?>
									<?php endif ?>
									<p><span>IDR -</span><span id="totalFreeShippingFee"><?= number_format($free_shipping_fee); ?></span></p>
								<?php endif; ?>
							</div>						
						</div>

						<?php 
							$finalshippingfee = 0;
							$calculate_finalshippingfee = $final_total_shipping_fee - $free_shipping_fee;
							if($calculate_finalshippingfee > 0){
								$finalshippingfee = $calculate_finalshippingfee;
							}
						?>
						
						<div class="row indentInformation" style="font-weight: bold;text-align: right;padding-top: 5px;height: 45px">
							<div class="col-md-8 col-sm-6 col-6">
								<p><?= ucwords(lang('downpayment'))?> :</p>
							</div>
							<div class="col-md-4 col-sm-6 col-6" style="text-align: right;font-weight: bold;">
								<p><span style="font-size:100%;">IDR <span id="indentRemaining"><?= number_format($total_downpayment); ?></span></p>
							</div>						
						</div> 
						<span id="firsttotal" style="display: none;"></span>
						<span id="finalshippingfee" style="display: none;"></span>
						<?php 
						$css_padding = '5px';
						if (
							base_url() == "https://www.demo2.tokodaku.com/" ||
							base_url() == "https://www.demo3.tokodaku.com/" 
						){
							$css_padding = '15px';
						} 
						?>
						<div class="row" style="
						font-weight: bold;
						text-align: right;
						padding-top: <?= $css_padding; ?>; 
						font-size:1.2rem">
							<div class="col-sm-12">
								<hr class="tk_line">
							</div>
							<div class="col-sm-12" style="display: flex;align-items: center;justify-content: space-between;">
								<div style="padding-right: 0;padding-left: 0; margin:0;" class="col-md-8 col-sm-6 col-6 displayHarga">
									<p><span><?= ucwords(lang('total_price'))?> :</span></p>
								</div>
								<div style="padding-right: 0;padding-left: 0; margin:0;" class="col-md-4 col-sm-6 col-6 displayHargaTotal" style="text-align: right;font-weight: bold;">
									<p>
										IDR <span id="grandTotal">
									
									<?php if($condition_freeshipping == true) : ?>

										<?php 
										$finalshippingfee = 0;
										$total_indent_shipping_fee = 0;
										 ?>

									<?php endif; ?>
		
										<?= number_format($grand_total + $finalshippingfee - $total_indent_shipping_fee - $total_indent_amount + $total_downpayment); ?>
										
											
										</span>
									</p>
								</div>
							</div>						
						</div>

						<p style="margin-top: 35px; margin-bottom: 50px; font-size: 15px; font-weight: bold;" class="p_lanjutPembayaran clearfix">
							<style>
								.btn-buy{
									width:250px;
									float: right;
									margin-right: 0px;
									margin-top: 0px;
								}
							</style>
							<button style="color: white !important;" id="lanjutPembayaran" name="lanjutPembayaran" type="submit" class="btn btn-primary buyButton btn-buy buttonLanjut"><?= ucwords(lang('payment'))?></button>
							<p class="p_please_wait" style="font-weight: bold;display: none;float: right;">
								Please wait..
								<img class="lanjutPembayaran_spinner" width="40" src="<?= base_url('uploads/spinner.gif'); ?>">
							</p>
						</p>

						<script>
							/* jQuery(document).on('click', '.buyButton', function(e){
								
								if (!jQuery('#completeAddress').val(e)) {
								    e.preventDefault();
								    jQuery('#addressMessage').html('Alamat kirim harus diisi');
								    jQuery('#completeAddress').focus();
								}

								if (!jQuery('#shipping_district').val(e)) {
								    e.preventDefault();
								    jQuery('#addressMessage').html('Mohon memilih Kota/Kabupaten');
								    jQuery('#shipping_district').focus();
								}

								if (!jQuery('#shipping_subdistrict').val(e)) {
								    e.preventDefault();
								    jQuery('#addressMessage').html('Mohon memilih Kecamatan');
								    jQuery('#shipping_subdistrict').focus();
								}
							});	*/

							/* jQuery('#lanjutPembayaran').click(function() {
								jQuery('#lanjutPembayaran').hide("fast");
								jQuery('.lanjutPembayaran_spinner').show("fast");
							}); */
						</script>
					</div>
				</div>
			</div>

			<script>
				jQuery(document).ready(function($) {
					jQuery("form#frm_shipping_post").submit(function(ev){
						var p_lanjutPembayaran = jQuery("p.p_lanjutPembayaran");
						var p_please_wait = jQuery("p.p_please_wait");

						p_lanjutPembayaran.css({
							"display":"none"
						});
						p_please_wait.css({
							"display":"initial"
						});
						var check_input_form = $("div#check_input_form");
						if (check_input_form.length>0) {
							var req_inp = $(this).find("input, select, textarea");
							var status_req = false;
							var msgs = '';

							jQuery.each(req_inp,function(idx,key){
								var this_inp_name = $(this).attr("placeholder");
								if ($(this).val() == "" || $(this).val() == null) { 
									msgs += this_inp_name+", "; 
									status_req = true;
								}
							});
							msgs = msgs.substr(0,msgs.length-2);
							if (status_req == true) {
								alert("Complete this "+msgs+" field"); 
								ev.preventDefault();
							}
						} 
					});
					

					<?php if($contain_indent_product == 'no') : ?>
						jQuery('.indentInformation').hide();
					<?php endif; ?>	

					//initially hide point reward and voucher block...
					jQuery('#pointrewardBlock').hide();
					jQuery('#voucherBlock').hide();

					<?php if($free_shipping_fee == 0): ?>
						jQuery('#freeshippingBlock').hide();		
					<?php endif; ?>		
				});
			</script>	

			<?php $count = 0; ?> 
			<?php foreach ($this->session->userdata('shipping_cart') as $rowid => $item): ?>
				<?php $count++; ?>
				<?php 

				$real_rowid = null;
				foreach ($this->cart->contents() as $real_key) {
					if ((int)$real_key['id'] == (int)$item['id']) {
						$real_rowid = $real_key['rowid'];
					}
				} 

				?>

				<script>

				jQuery(document).ready(function() {

					jQuery('#spinner<?= $count; ?>').hide();

					//dont use click, use .on to handle dynamic elements loaded by ajax
					<?php if($fs_cek_product == null): ?>
						jQuery(document).on('click', '.btnMin<?= $count; ?>', function(e){
							e.preventDefault();
							jQuery('.buyButton').attr('disabled', true);
							jQuery('.btnMin<?= $count; ?>').attr('disabled', true);
							jQuery('.btnAdd<?= $count; ?>').attr('disabled', true);
	                		jQuery('#spinner<?= $count; ?>').show();
	                		var qty = jQuery('.productQuantity<?= $count; ?>').val();
	                		qty--;
	                		if(qty == 0) {
	                			qty = 1;
	                		} 
	                		jQuery('.productQuantity<?= $count; ?>').val(qty);
	                		ajax_check_stock<?= $count; ?>(qty);
	                		ajax_change_shipping_fee<?= $count; ?>(qty);
	                		ajax_get_subtotal<?= $count; ?>(qty, function(){
	                			var province 	= jQuery('#shipping_province').val();
		                		var subdistrict = jQuery('#shipping_subdistrict').val();
		                		ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province);
	                		});
	                	}); 

	                	jQuery(document).on('click', '.btnAdd<?= $count; ?>', function(e){ 
	                		e.preventDefault();
	                		jQuery('.buyButton').attr('disabled', true);
	                		jQuery('.btnMin<?= $count; ?>').attr('disabled', true);
							jQuery('.btnAdd<?= $count; ?>').attr('disabled', true);
							jQuery('.shipping_method<?= $rowid; ?>').attr('disabled', true);
	                		jQuery('#spinner<?= $count; ?>').show();
	                		var qty = jQuery('.productQuantity<?= $count; ?>').val(); 
	                		qty++; 
	                		jQuery('.productQuantity<?= $count; ?>').val(qty);
	                		ajax_check_stock<?= $count; ?>(qty);
	                		ajax_change_shipping_fee<?= $count; ?>(qty);
	                		ajax_get_subtotal<?= $count; ?>(qty, function(){
	                			var province 	= jQuery('#shipping_province').val();
		                		var subdistrict = jQuery('#shipping_subdistrict').val();
		                		ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province);
	                		});
	                		
	                	});
					<?php endif; ?>

                	jQuery(document).on('click', '.shipping_method<?= $rowid; ?>', function(){ 
                		jQuery('.buyButton').attr('disabled', true);
                		jQuery('.btnMin<?= $count; ?>').attr('disabled', true);
						jQuery('.btnAdd<?= $count; ?>').attr('disabled', true);
						jQuery('.shipping_method<?= $rowid; ?>').attr('disabled', true);
                		jQuery('#spinner<?= $count; ?>').show();
                		var qty = jQuery('.productQuantity<?= $count; ?>').val();
                		//jQuery('.productQuantity<?= $count; ?>').val(qty);
                		ajax_get_subtotal<?= $count; ?>(qty, function(){
                			var province 	= jQuery('#shipping_province').val();
	                		var subdistrict = jQuery('#shipping_subdistrict').val();
	                		ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province);
                		});
                	}); 
				});
            	
        		function ajax_check_stock<?= $count; ?>(qty) {

					jQuery.ajax({
						'url'       : '<?= base_url(); ?>' + 'ajax/ajax_check_stock_shipping',
						'type'      : 'POST',
						'data'      : {
										  'this_rowid' : "<?= $rowid; ?>",
								          'qty' : qty,
								          'warehouse_id': <?= $item['warehouse_id']; ?>,
								          'item_id' : <?= $item['id']; ?>,
								          'product_id' : <?= $item['product_id']; ?>,
								          'is_backorder': '<?= $item['is_backorder']; ?>',
										  '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
									  }, 
						'success'   : function(data) {

							if (data) { 
								/*---if stock not enough----*/
								jQuery('.noStock<?= $count; ?>').html(data);  
								if (data.trim() != 'Not Enough Stock') {
									jQuery.ajax({
								        'url'       : '<?= base_url(); ?>' + 'ajax/ajax_get_cart', 
								        'type'      : 'POST',   
								        'data'      : {
								                      '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
								                      },
								        'success'   : function(data_cart) {
								            if(data_cart) {
								                /*---success----*/
								                var cart = JSON.parse(data_cart); 
								                if ($('div.shopping_bag_theme1').length>0) {
									                jQuery("div#cartToolTip").html(cart.cart_content);

								                    jQuery('#cartPopUp')
								                    .removeClass('toolbar-dropdown')
				                                    .addClass('showCart');

								                    setTimeout(function() {
								                      jQuery('#cartPopUp')
								                      .removeClass('showCart')
				                                      .addClass('toolbar-dropdown'); 
								                    }, 3000);
								                }
								                if ($('div.shopping_bag_theme2').length>0) {
								                	jQuery('#cart_body').html(cart.cart_content);
								                    jQuery('.cartCount').html(cart.cart_count);
								                    if(cart.cart_count == 0) {
								                        jQuery('#processCheckout').hide();
								                    } else {
								                        jQuery('#processCheckout').show();
								                    }
								                } 
								                if ($('div.shopping_bag_theme3').length>0) {
								                	jQuery('#cart_body').html(cart.cart_content);
								                    jQuery('.cartCount').html(cart.cart_count);
								                    if(cart.cart_count == 0) {
								                        jQuery('#processCheckout').hide();
								                    } else {
								                        jQuery('#processCheckout').show();
								                    }
								                }  
								                if ($('div.shopping_bag_theme4').length>0) {
								                	jQuery('nav.menu').html(cart.cart_content);
								                    // jQuery('nav.menu').addClass('slide-menu-tampil');
								                    
								                    // jQuery('a.cart-contents span.cart-number').html(cart.cart_count+" produk"); 

								                    // if(cart.cart_count == 0) {
								                    //     jQuery('#processCheckout').hide();
								                    // } else {
								                    //     jQuery('#processCheckout').show();
								                    // } 
								                } 
								                if ($('div.shopping_bag_theme5').length>0) {
								                	jQuery('.menu_cart_modal').html(cart.cart_content); 
								                    // jQuery('#cart_madal').modal('show'); 

								                    jQuery('span#spn_total_cart').html(cart.cart_count); 

								                    // if(cart.cart_count == 0) {
								                    //     jQuery('#processCheckout').hide();
								                    // } else {
								                    //     jQuery('#processCheckout').show();
								                    // } 
								                }

								            };
								        }
								    });
								}
							}
						}
					});
				}

				function ajax_change_shipping_fee<?= $count; ?>(qty) {

					//check selected shipping method
					var selected_shipping_method_id;
					selected_shipping_method_id = jQuery('input[name=shipping_method<?= $rowid; ?>]:checked').val();

					var province = jQuery('#shipping_province').val();

					var currentRequest1 = null;    

					currentRequest1 = jQuery.ajax({
						'url'       : '<?= base_url(); ?>' + 'ajax/ajax_change_shipping_fee',
						'type'      : 'POST',
						'data'      : {
									  // 'no_of_indent' : <?= $no_of_indent; ?>,
									  // 'no_of_instock' : <?= $no_of_instock; ?>,
									  // 'shipping_id' : <?= $shipping_id; ?>,
									  'province' : province,
							          'qty' : qty,
							          'price' : <?= $item['price']; ?>,
							          'rowid' : '<?= $rowid; ?>',
							          'shipping_method_ids': '<?= implode(",", $item["shipping_method_ids"]); ?>',
							          'selected_shipping_method_id' : selected_shipping_method_id,  
							          'warehouse_id': <?= $item['warehouse_id']; ?>,
							          'shipping_id_subdistrict' : <?= $shipping->shipping_id_subdistrict; ?>,
							          'sub_total': <?= $item['subtotal']; ?>,
							          'product_id' : <?= $item['product_id']; ?>,
							          'item_id' : <?= $item['id']; ?>,
									  '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
									  }, 
						beforeSend : function() {           
					        if(currentRequest1 != null) {
					            currentRequest1.abort();
					        }
					    },			  
						'success'   : function(data) { 
							if (data) { 
								jQuery('#shippingNameBlock<?= $count; ?>').html(data);
							};
						}
					});
				}

				function ajax_get_subtotal<?= $count; ?>(qty, grand_total) {

					//check selected shipping method
					var selected_shipping_method_id;
					selected_shipping_method_id = jQuery('input[name=shipping_method<?= $rowid; ?>]:checked').val();

					//check selected shipping method
					var currentRequest2 = null;    

					currentRequest2 = jQuery.ajax({
						'url'       : '<?= base_url(); ?>' + 'ajax/ajax_get_subtotal',
						'type'      : 'POST',
						'data'      : {
							          'qty' : qty,
							          'price' : <?= $item['price']; ?>,
							          'rowid' : '<?= $rowid; ?>',
							          'selected_shipping_method_id' : selected_shipping_method_id,  
							          'warehouse_id': <?= $item['warehouse_id']; ?>,
							          'shipping_id_subdistrict' : <?= $shipping->shipping_id_subdistrict; ?>,
							          'product_id' : <?= $item['product_id']; ?>,
							          'item_id' : <?= $item['id']; ?>,
									  '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
									  }, 
						beforeSend : function()    {           
					        if(currentRequest2 != null) {
					            currentRequest2.abort();
					        }
					    },			  
						'success'   : function(data) {
							if (data) {  
								jQuery('#subTotal<?= $count; ?>').html(data);
								grand_total();
							};
						}
					});
				}

				function ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province) {

					//check selected shipping method
					var currentRequest3 = null;    

					currentRequest3 = jQuery.ajax({
						'url'       : '<?= base_url(); ?>' + 'ajax/ajax_get_grandtotal',
						'type'      : 'POST',
						'data'      : {
										'using_ajax' : true,
										'province' : province,
										'subdistrict' : subdistrict,
									  	'<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
									  }, 
						beforeSend : function()    {           
					        if(currentRequest3 != null) {
					            currentRequest3.abort();
					        }
					    },			  
						'success'   : function(data) {
							if (data) { 
								var total = JSON.parse(data);
								var indent_remaining = total.indent_remaining.toString().replace('-',''); 

								jQuery('#totalItemAmount').html(total.total_item_amount);
								jQuery('#firsttotal').html(total.total_item_amount);
								jQuery('#totalShippingFee').html(total.total_shipping_fee);
								jQuery('#totalFreeShippingFee').html(total.total_free_shipping_fee);
								jQuery('#finalshippingfee').html(total.finalshippingfee);


								jQuery('#grandTotal').html(total.grand_total);
								jQuery('#indentRemaining').html(indent_remaining);
								jQuery('#indentShippingFee').html(total.indent_shipping_fee);

								jQuery('.buyButton').attr('disabled', false);
								jQuery('.btnMin<?= $count; ?>').attr('disabled', false);
								jQuery('.btnAdd<?= $count; ?>').attr('disabled', false);
								jQuery('.shipping_method<?= $rowid; ?>').attr('disabled', false);
								jQuery('#spinner<?= $count; ?>').hide();

								jQuery('#voucher').val('');
								jQuery('#voucherprice_input').val(0);
								jQuery('#point').val('');
								jQuery('#pointrewards_input').val(0);
								jQuery('#voucherdiscount').html('')
								jQuery('#voucherprice').html('0');
								jQuery('#pointrewards').html('0');
							};
						}
					});
				}
            </script>	

			<?php endforeach; ?>	

			<?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?>
				<script>
					jQuery(document).ready(function() {

						jQuery('#spinnerVoucher').hide();
						jQuery('#spinnerPoint').hide();

						jQuery("#redeemVoucher").click(function(){

							jQuery('#spinnerVoucher').show();
							var voucher = jQuery("#voucher").val();
							if(voucher == ''){
								jQuery('#error_voucher').html('Insert Voucher First !!!');
								jQuery('#spinnerVoucher').hide();
							}
							else{
								var pointprice = jQuery('#pointrewards_input').val();
								if(pointprice == ''){
									pointprice = 0;
								}
								else{
									pointprice = pointprice;
								}
								var id_customer = <?= $shipping->id_customers; ?>;
								var province 	= jQuery('#shipping_province').val();
								var subdistrict = jQuery('#shipping_subdistrict').val();
								jQuery('.buyButton').attr('disabled', true);
								ajax_set_voucher(voucher,pointprice,id_customer,province,subdistrict);
							}
						});

						jQuery("#redeemPoint").click(function(){

							jQuery('#spinnerPoint').show();
							var point = jQuery("#point").val();
							if(point == ''){
								jQuery('#error_point').html('Insert Point First !!!');
								jQuery('#spinnerPoint').hide();
							}
							else if(point < 0){
								jQuery('#error_point').html('Wrong Format Point !!!');
								jQuery('#spinnerPoint').hide();
							}
							else{
								var voucherprice = jQuery('#voucherprice_input').val();
								if(voucherprice == ''){
									voucherprice = 0;
								}
								else{
									voucherprice = voucherprice;
								}
								var id_customer = <?= $shipping->id_customers; ?>;
								var province 	= jQuery('#shipping_province').val();
								var subdistrict = jQuery('#shipping_subdistrict').val();
								jQuery('.buyButton').attr('disabled', true);
								ajax_set_point_rewards(voucherprice,point,id_customer,province,subdistrict);
							}
						});
					});
					function ajax_set_voucher(voucher,pointprice,id_customer,province,subdistrict) {
						jQuery.ajax({
							'url'       : '<?= base_url(); ?>' + 'ajax/ajax_set_voucher',
							'type'      : 'POST',
							'data'      : {
											'voucher' : voucher,
											'pointprice' : pointprice,
											'id_customer' : id_customer,
											'province' : province,
											'subdistrict' : subdistrict,
											'<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
										  }, 
							'success'   : function(data) {
								if (data) { 
									var total = JSON.parse(data);
									// jQuery('.indentInformation').show();
									if(total.voucherprice_input > 0){		
										jQuery('#voucherBlock').show();
									} 
									if(total.voucherprice_input == 0){
										jQuery('#error_voucher').html(total.alert)
									}else{
										jQuery('#error_voucher').html('') 
									}
									// jQuery('#freeshippingBlock').show();

									jQuery('#totalItemAmount').html(total.total_item_amount);
									jQuery('#voucherdiscount').html(total.voucher_discount)
									jQuery('#voucherprice').html(total.voucherprice);
									jQuery('#voucherprice_input').val(total.voucherprice_input);
									// jQuery('#firsttotal').html(total.firsttotal);
									// jQuery('#totalShippingFee').html(total.total_shipping_fee);
									// jQuery('#totalFreeShippingFee').html(total.total_free_shipping_fee);
									// jQuery('#finalshippingfee').html(total.finalshippingfee);
									// jQuery('#grandTotal').html(total.grand_total);
									// jQuery('#error_voucher').html(total.alert);

									// plus 
									var totalItemAmount = parseInt(jQuery("span#totalItemAmount").html().split(",").join(''));
									
									var totalShippingFee = parseInt(0);
									if(jQuery("span#totalShippingFee").html() != undefined){
										totalShippingFee = parseInt(jQuery("span#totalShippingFee").html().split(",").join(''));
									}
									// min
									var voucherprice = parseInt(jQuery("span#voucherprice").html().split(",").join('').replace("-",""));
									var pointrewards = parseInt(jQuery("span#pointrewards").html().split(",").join('').replace("-",""));
									var totalFreeShippingFee = parseInt(jQuery("span#totalFreeShippingFee").html().split(",").join('').replace("-","")); 

									var indent_remaining = parseInt(jQuery('#indentRemaining').html().split(",").join('').replace("-",""));

									var php_total_shipping_fee = <?= (int)$total_shipping_fee; ?>; 

									var grand_total = 
									(totalItemAmount+
									totalShippingFee)-
									(voucherprice+
									pointrewards+
									totalFreeShippingFee) - indent_remaining; 

									if (php_total_shipping_fee>0) {
										grand_total = 
										totalItemAmount-
										(voucherprice+
										pointrewards+
										totalFreeShippingFee) - indent_remaining;
									}

									jQuery('#grandTotal').html(
										formatIDR(grand_total)
									);
									jQuery('#spinnerVoucher').hide();
									jQuery('.buyButton').attr('disabled', false);
								};
							}
						});
					}
					
					function ajax_set_point_rewards(voucherprice,point,id_customer,province,subdistrict) { 
						jQuery.ajax({
							'url'       : '<?= base_url(); ?>' + 'ajax/ajax_set_point_rewards',
							'type'      : 'POST',
							'data'      : {
											'voucherprice' : voucherprice,
											'point' : point,
											'id_customer': id_customer,
											'province' : province,
											'subdistrict' : subdistrict,
											'<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
										  }, 
							'success'   : function(data) {
								if (data) { 
									var total = JSON.parse(data);	
									// jQuery('.indentInformation').show();
									if(total.pointrewards_input > 0){		
										jQuery('#pointrewardBlock').show();
									} 
									// jQuery('#voucherBlock').show();
									// jQuery('#freeshippingBlock').show();	
									

									jQuery('#totalItemAmount').html(total.total_item_amount); 
									jQuery('#pointrewards').html(total.pointrewards); 
									jQuery('#pointrewards_input').val(total.pointrewards_input);
 
									// jQuery('#firsttotal').html(total.firsttotal); 
									 
									// var first_total = jQuery('#firsttotal').html().split(',').join(''); 
									// var total_ShippingFee = jQuery('#totalShippingFee').html().split(',').join(''); 
									// var grand_t = parseInt(first_total) + parseInt(total_ShippingFee); 
									// jQuery('#grandTotal').html(
									// 	formatIDR(grand_t)
									// 	);

									// plus 
									var totalItemAmount = parseInt(jQuery("span#totalItemAmount").html().split(",").join(''));
									var totalShippingFee = parseInt(0);
									if(jQuery("span#totalShippingFee").html() != undefined){
										totalShippingFee = parseInt(jQuery("span#totalShippingFee").html().split(",").join(''));
									}

									// min
									var voucherprice = parseInt(jQuery("span#voucherprice").html().split(",").join('').replace("-",""));
									var pointrewards = parseInt(jQuery("span#pointrewards").html().split(",").join('').replace("-",""));
									var totalFreeShippingFee = parseInt(jQuery("span#totalFreeShippingFee").html().split(",").join('').replace("-",""));

								
									var indent_remaining = parseInt(jQuery('#indentRemaining').html().split(",").join('').replace("-",""));
									var php_total_shipping_fee = <?= (int)$total_shipping_fee; ?>;

									var grand_total = 
									(totalItemAmount+
									totalShippingFee)-
									(voucherprice+
									pointrewards+
									totalFreeShippingFee) - indent_remaining;

									if (php_total_shipping_fee>0) {
										grand_total = 
										totalItemAmount-
										(voucherprice+
										pointrewards+
										totalFreeShippingFee) - indent_remaining;
									}

									jQuery('#grandTotal').html(
										formatIDR(grand_total)
									);

									jQuery('#error_point').html(total.alert); 
									jQuery('#spinnerPoint').hide();
									jQuery('.buyButton').attr('disabled', false);
								};
							}
						});
					}
				</script>

			<?php endif; ?>

		<?php else : ?>
			<!--- cart no content-->
			<p>YOUR CART IS EMPTY.</p>
		<?php endif; ?>

	</div><!-- end myCart -->

</div>
</div>	
</div>

<?= form_close(); ?>

https://t.me/RX1948 - 2025