<div class="page-title-list" style="padding-bottom:3%;">
    <div class="userHeading_sec col-md-12 col-sm-12 col-xs-12 reset-padding">
        <div class="col-md-12 col-sm-12 col-xs-12 reset-padding">
            <?php if($this->session->flashdata('message_success') && !isset($data)){?>
                <div class="alert alert-success alert-dismissable">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <?=$this->session->flashdata('message_success')?>
                </div>
            <?php } ?>
            <?php if($this->session->flashdata('message_error') && !isset($data)){?>
                <div class="alert alert-danger alert-dismissable">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <?=$this->session->flashdata('message_error')?>
                </div>
            <?php } ?>
            <div class="col-md-12 reset-padding">
                <div class="col-md-8 col-sm-8 col-xs-12 reset-padding">
                    <h4 class="float-left pageTitle"><?php echo $title; ?></h4>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12 page-list">
            <form class="form-horizontal" method="get">
              <div class="box-body col-md-6">
                <div class="form-group">
                  <div class="col-sm-10 reset-padding">
                    <select class="form-control chosen DirectBookingMemberSearch" name="search_member">
                    	<option value=""><?php echo _l("Select Memeber",$this); ?></option>
                    	<?php
                    	if($members){
                    		foreach ($members as $member){
                    			$select = ($member_single) ? ($member_single->id==$member['id']) ? "selected" : '' : '';
                    			echo '<option '.$select.' value="'.$member['id'].'">'.$member['contact_number'].' '.$member['member_name'].'</option>';
                    		}
                    	} 
                    	?>
                    </select>
                  </div>
                </div>
              </div>
            </form>
          </div>
        </div>
       
       <?php if($member_single){
		       	if($member_single->image_url!=''){
		       		$image_url = base_url().$member_single->image_url;
		       	}else{
		       		$image_url = base_url().'upload/no-image.png';
		       	}
		       }else{
		       	$image_url = base_url().'upload/no-image.png';
		       }
       	?>
       	<div class="row">
        <div class="col-lg-4">
			<div class="card" style="width:100%">
				<img class="card-img-top" src="<?php echo $image_url;?>" alt="Card image"  style="width:100%">
				<div class="card-body">
				  <h4 class="card-title"><?php echo ($member_single) ? $member_single->member_name :''; ?></h4>
				  	 <ul class="list-inline" id="courses">
						<li class="list-inline-item">
							<i class="fa fa-folder-open-o"></i> <?php echo ($member_single) ? $member_single->member_number : ''; ?>
						</li>
						
					</ul>
					<!-- <p class="card-text">I am a professional student designer i love my work so hire me !!</p> -->

					<div class="address">								
						<ul class="w3-ul w3-small">
							<li> <i class="fa fa-phone" aria-hidden="true"></i>  <?php echo ($member_single) ? $member_single->contact_number : ''; ?> </li>
							<li> <i class="fa fa-building-o" aria-hidden="true"></i>  <?php echo ($member_single) ? $member_single->address : ''; ?> </li>
							<li><i class="fa fa-building-o" aria-hidden="true"></i> <?php echo ($member_single) ? $member_single->city : ''; ?> </li>
							<li><i class="fa fa-building-o" aria-hidden="true"></i> <?php echo ($member_single) ? $member_single->state : ''; ?> </li>
							<li><i class="fa fa-building-o" aria-hidden="true"></i> <?php echo ($member_single) ? GetCountryInfo($member_single->country).'-'.$member_single->zip : ''; ?> </li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div class="col-lg-8">
			<div class="col-md-12 page-list" style="margin-top:15px;">
	            <form class="form-horizontal register-form" method="post">
	              <div class="box-body col-md-12">
	              	<div class="form-group">
		                 <label class="col-sm-3 control-label"><?php echo _l("Payment Number",$this); ?></label>
		                 <div class="col-sm-9 control-label">
			                 <label class="pull-left"><?php echo ($payment_info) ? $payment_info->payment_number : GeneratePaymentNo();?></label>
			             </div>
		              </div>
		              <div class="form-group">
		                 <label class="col-sm-3 control-label"><?php echo _l("Member Name",$this); ?></label>
		                 <div class="col-sm-9 control-label">
			                 <label class="pull-left"><?php echo ($member_single) ? $member_single->member_name : '';?></label>
			             </div>
		              </div>
		              <div class="form-group">
		                 <label class="col-sm-3 control-label"><?php echo _l("Contact Number",$this); ?></label>
		                 <div class="col-sm-9 control-label">
			                 <label class="pull-left"><?php echo ($member_single) ? $member_single->contact_number : '';?></label>
			             </div>
		              </div>
		                <div class="form-group">
			                  <label class="col-sm-3 control-label"><?php echo _l("Payment Date",$this); ?></label>
			                  <div class="col-sm-9 control-label">
				                  <input type="text" name="payment_date" class="form-control datepicker" value="<?php echo ($payment_info) ? date_to_Display(strtotime($payment_info->payment_date)) : date('d-m-Y');?>">
				              </div>
		                </div>
		                <?php 
		                if($payment_info){
		                	$package_info = GetSingleInfo("package", "id", $payment_info->package_id);
		                	if($package_info->add_on==1){
		                		$disable = "disabled";
		                	}else{
		                		$disable = "";
		                	}
		                }else{
		                	$disable = "";
		                }
		                ?>
		                <div class="form-group">
			                  <label class="col-sm-3 control-label"><?php echo _l("Package",$this); ?><span class="text-red">*</span></label>
			                  	<div class="col-sm-9 control-label">
				                	<select class="form-control validate[required]" onchange="GetPackageInfo(this.value);" name="package" id="package_id">
					                  	<option value=""><?php echo _l("Select Package",$this);?></option>
					                  		<?php 
					                  		if ($packages){
					                  			foreach ($packages as $package){
					                  				$select = ($payment_info) ? ($payment_info->package_id==$package['id']) ? 'selected' : '' : '';
					                  				echo '<option '.$select.' value="'.$package['id'].'">'.$package['package_name'].'</option>';
					                  			}
					                  		}
					                  		?>
					                </select>
					        </div>
		               	</div>
		               	<div class="form-group">
		                  <label class="col-sm-3 control-label"><?php echo _l("No Of Members",$this); ?></label>
		                  <div class="col-sm-9">
			                  <input type="text" class="form-control validate[required,custom[integer]]" name="no_of_members" id="no_of_members" onkeyup="GetPackageCountMember(this.value);" value="<?php echo ($payment_info) ? $payment_info->no_of_members : '1';?>">
			              </div>
	                	</div>
		               	<div class="form-group">
		                  <label class="col-sm-3 control-label"><?php echo _l("No.Of Days / Hours",$this); ?></label>
		                  <div class="col-sm-9">
			                  <input type="hidden" class="form-control" name="no_of_days" id="no_of_days" value="<?php echo ($package_info) ? $package_info->nod : '';?>">
			                  <label class="no_of_days_label"  style="padding-top:7px;"><?php echo ($package_info) ? $package_info->nod : '';?></label>
			              </div>
	                	</div>
	                
	                <?php if($cpanel->vat==1){?>
	                <div class="form-group vat-display" style="<?php echo ($payment_info) ? ($payment_info->actual_amount!='') ? 'display:block' : 'display:none' : '';?>">
		                  <label class="col-sm-3 control-label"><?php echo _l("Amount",$this); ?></label>
		                  <div class="col-sm-3">
			                  <input type="hidden" class="form-control" name="actual_amount" id="actual_amount" value="<?php echo ($payment_info) ? $payment_info->actual_amount : '';?>">
			                  <label class="actual_amount_label" style="padding-top:7px;"><?php echo ($payment_info) ? PriceFormat($payment_info->actual_amount) : '';?></label>
			              </div>
			              <label class="col-sm-3 control-label display-vat-percentage"><?php echo ($payment_info) ? "VAT(".$payment_info->vat_percentage." %) : " : ''; ?></label>
		                  <div class="col-sm-3">
		                  	  <input type="hidden" class="form-control" name="vat_percentage" id="vat_percentage" value="<?php echo ($payment_info) ? $payment_info->vat_percentage : '';?>">
			                  <input type="hidden" class="form-control" name="vat_amount" id="vat_amount" value="<?php echo ($payment_info) ? $payment_info->vat_amount : '';?>">
			                  <label class="vat_amount_label" style="padding-top:7px;"><?php echo ($payment_info) ? PriceFormat($payment_info->vat_amount) : '';?></label>
			              </div>
	                </div>
	                <?php }else{ ?>
	                <input type="hidden" name="actual_amount" value="">
	                <input type="hidden" name="vat_percentage" value="">
	                <input type="hidden" name="vat_amount" value="">
	                <?php } ?>
	                <div class="form-group">
		                  <label class="col-sm-3 control-label"><?php echo _l("Total",$this); ?></label>
		                  <div class="col-sm-3">
			                  <input type="hidden" class="form-control" name="package_amount" id="package_amount" value="<?php echo ($payment_info) ? $payment_info->payment_amount : '';?>">
			                  <label class="package_amount_label" style="padding-top:7px;"><?php echo ($payment_info) ? PriceFormat($payment_info->payment_amount) : '';?></label>
			              </div>
	                </div>
	                <?php 
	                if($payment_info){
	                	$package_info = GetSingleInfo("package", "id", $payment_info->package_id);
	                	if($package_info){
	                		if($package_info->package_type==0){
	                			$display_class = 'hide';
	                		}else{
	                			$display_class = '';
	                		}
	                	}else{
	                		$display_class = '';
	                	}
	                }else{
	                	$display_class = '';
	                }
	                ?>
	                <div class="form-group hide-class <?php echo $display_class;?>">
		                  <label class="col-sm-3 control-label"><?php echo _l("Start Date",$this); ?></label>
		                  <div class="col-sm-9">
			                  <input type="text" class="form-control datepicker" name="start_date" id="start_date" value="<?php echo ($payment_info) ? date_to_Display(strtotime($payment_info->start_date)) : date('d-m-Y');?>">
			              </div>
	                </div>
	                <div class="form-group hide-class <?php echo $display_class;?>">
		                  <label class="col-sm-3 control-label"><?php echo _l("End Date",$this); ?></label>
		                  <div class="col-sm-9">
			                  <input type="text" class="form-control datepicker" name="expire_date" id="expire_date" value="<?php echo ($payment_info) ? date_to_Display(strtotime($payment_info->expire_date)) : '';?>">
			              </div>
	                </div>
	                
		              <div class="form-group">
			                  <label class="col-sm-3 control-label"><?php echo _l("Payment Method",$this); ?></label>
			                  <div class="col-sm-9 control-label">
				                  <select class="form-control" name="payment_mothod">
					                  		<?php 
					                  		if ($payments){
					                  			foreach ($payments as $payment){
					                  				$select = ($payment_info) ? ($payment_info->payment_type==$payment['id']) ? 'selected' : '' :'';
					                  				echo '<option '.$select.' value="'.$payment['id'].'">'.$payment['title'].'</option>';
					                  			}
					                  		}
					                  		?>
					                  </select>
				              </div>
		                </div>
		                
		                <div class="form-group">
		                  	<label class="col-sm-3 control-label"><?php echo _l("Remember Alert",$this);?></label>	
			                <div class="col-sm-9">
			                    <div class="col-md-6 radio-box radio-box-warning">
			                            <input style="height:18px !important;" id="published_yes" class="user_data" name="remember" <?php echo ($payment_info) ? ($payment_info->remember=='1') ? 'checked="checked"' : '' : 'checked="checked"'; ?> type="radio" value="1">
			                            <label for="published_yes"><?php echo _l("Yes",$this); ?></label>
			                        </div>
			                        <div class="col-md-6 radio-box radio-box-warning">
			                            <input style="height:18px !important;" id="published_no" class="user_data" name="remember" <?php echo ($payment_info) ? ($payment_info->remember=='0') ? 'checked="checked"' : '' : ''; ?> type="radio" value="0">
			                            <label for="published_no"><?php echo _l("No",$this); ?></label>
			                        </div>
			                  </div>
		                </div>
		                
		                
		                <div class="form-group">
		                	  <input type="hidden" name="member_id" value="<?php echo ($member_single) ? $member_single->id : ''; ?>">
		                	<?php if($payment_info){?>
		                	  	<input type="hidden" name="payment_id" value="<?php echo $payment_info->id; ?>">
		                		<input type="submit" <?php echo (GetPermission('is_edit')==0) ? 'disabled' : '';?> class="btn btn-success" name="update_payment" value="<?php echo _l("Update",$this);?>">
		                		<a class="btn btn-success" target="_balnk" href="<?php echo base_url().$lang.'/print-payment?id='.$payment_info->id; ?>"><?php echo _l("Print",$this); ?></a>
		                	<?php }else{ 
		                	$disable = ($member_single) ? '' : 'disabled';
		                		?>
		                		<input <?php echo $disable;?> type="submit" class="btn btn-success" name="save_payment" value="<?php echo _l("Pay",$this);?>">		                		
		                	<?php } ?>
			                  <a href="<?php echo base_url().$lang.'/payments'?>" class="btn btn-primary btn-border-square"><?php echo _l("Cancel",$this);?></a>
		                	</div>
		                	
	                </div>
	             </form>
	        </div>
		</div>
	</div>
</div>

