<section class="content">
	<div class="user_add">		
		<form id="frm" method="post" action="" enctype="multipart/form-data">
			<div class="box">
				<div class="box-body">	
					<div class="row">					
					<div class="col-md-12">
						<div class="col-md-3 plpr">
							<div class="form-group">
								<label class="control-label">Customer Name *</label>
								<input type="text" class="form-control required" id="customer_name" name="customer_name" placeholder="Customer Name" value="<?php echo $user_details->customer_name;?>" autocomplete="off" />
							</div>
						</div>
						<div class="col-md-3 plpr">	
							<div class="form-group">
								<label class="control-label">Gender *</label>
								<?php $gender_array_config=$this->config->item('gender_array_config');?>
								<select class="form-control required" id="gender" name="gender">
									<option value="">-- select gender --</option>
									<?php foreach($gender_array_config as $key => $value){ if($value['status']==0){?>
									<option value="<?php echo $key;?>" <?php if($user_details->gender==$key){?> selected="selected"<?php } ?>><?php echo $value['name'];?></option>
									<?php } } ?>
								</select>
							</div>
						</div>
						<div class="col-md-3 plpr">	
							<div class="form-group">
								<label class="control-label">Date of Birth *</label>
								<input type="text" class="form-control required" id="Date1" name="date_of_birth" placeholder="<?php echo date('m/d/Y');?>" value="<?php echo date('m/d/Y',$user_details->date_of_birth);?>" autocomplete="off" />
							</div>
						</div>
						<div class="col-md-3 plpr">	
							<div class="form-group">
								<label class="control-label">Mobile Number</label>
								<input type="text" class="form-control required" id="mobile_number" name="mobile_number" placeholder="Enter mobile no." value="<?php echo $user_details->mobile_number;?>" autocomplete="off" />
							</div>
						</div>
						
						<div class="col-md-3 plpr">
						<div class="form-group">
							<label class="control-label">Email Address *</label>
							<input type="text" class="form-control email required" id="email" name="email" placeholder="Email Address" value="<?php echo $user_details->email;?>" autocomplete="off" />
						</div>
					</div>
					
						<div class="col-md-6 plpr">	
							<div class="form-group">
								<label class="control-label">Address *</label>
								<input type="text" class="form-control required" id="address" name="address" placeholder="Address" value="<?php echo $user_details->address;?>" autocomplete="off" />
							</div>
						</div>
						  	
						<div class="col-md-3 plpr">
							<div class="form-group">
								<label class="control-label">User Status *</label>
								<select class="form-control required" id="status" name="status">
									<option value="0" <?php if($user_details->status==0){?> selected="selected"<?php } ?>>Active</option>
									<option value="1" <?php if($user_details->status==1){?> selected="selected"<?php } ?>>Deactive</option>
								</select>
							</div>
						</div>
						 
 					</div>
				</div>
				
				<div class="col-md-12 plpr">
					<h4>Login Details - </h4>
					<div class="col-md-3 plpr">
						<div class="form-group">
							<label class="control-label">Login Id *</label>
							<input type="text" class="form-control required" id="login_id" name="login_id" placeholder="" value="<?php echo $user_details->login_id;?>" autocomplete="off" />
						</div>
					</div>	
					
					<div class="col-md-6 plpr">
						<div class="form-group">
							<label class="control-label">Password <small>(If you don't want to change password, please leave it blank.)</small></label>
							<input type="password" class="form-control" id="edit_password" name="edit_password" placeholder="" value="" autocomplete="off" />
						</div>
					</div> 
					
					<div class="col-md-3 plpr">
						<div class="form-group">
							<label class="control-label">Pet Name </label>
							<input type="text" class="form-control" id="pet_name" name="pet_name" placeholder="" value="<?php echo $user_details->pet_name;?>" autocomplete="off" />
						</div>
					</div> 
				</div>
				
				<div class="col-md-12 plpr">
					<h4>Manage Field Status - </h4>
					<div class="col-md-2 plpr">
						<div class="form-group">
							<label class="control-label">COT. Code Field Sts. *</label>
							<select class="form-control required" id="transfer_code_field_sts" name="transfer_code_field_sts">
								<option value="1" <?php if($user_details->transfer_code_field_sts==1){?> selected="selected"<?php } ?>>Active</option>
								<option value="0" <?php if($user_details->transfer_code_field_sts==0){?> selected="selected"<?php } ?>>Inactive</option>
							</select>
						</div>
					</div>	
					
					<div class="col-md-2 plpr">
						<div class="form-group">
							<label class="control-label">COT. Code Field Label</label>
							<input type="text" class="form-control" id="transfer_code_user_field_label" name="transfer_code_user_field_label" placeholder="" value="<?php echo $user_details->transfer_code_user_field_label;?>" autocomplete="off" />
						</div>
					</div> 
					
					<div class="col-md-2 plpr">
						<div class="form-group">
							<label class="control-label">TAX Code Field Sts. *</label>
							<select class="form-control required" id="vat_code_field_sts" name="vat_code_field_sts">
								<option value="1" <?php if($user_details->vat_code_field_sts==1){?> selected="selected"<?php } ?>>Active</option>
								<option value="0" <?php if($user_details->vat_code_field_sts==0){?> selected="selected"<?php } ?>>Inactive</option>
							</select>
						</div>
					</div>
					
					<div class="col-md-2 plpr">
						<div class="form-group">
							<label class="control-label">TAX Code Field Label</label>
							<input type="text" class="form-control" id="vat_code_user_field_label" name="vat_code_user_field_label" placeholder="" value="<?php echo $user_details->vat_code_user_field_label;?>" autocomplete="off" />
						</div>
					</div>
					
					<div class="col-md-2 plpr">
						<div class="form-group">
							<label class="control-label">IMF Code Field Sts. *</label>
							<select class="form-control required" id="imf_code_field_sts" name="imf_code_field_sts">
								<option value="1" <?php if($user_details->imf_code_field_sts==1){?> selected="selected"<?php } ?>>Active</option>
								<option value="0" <?php if($user_details->imf_code_field_sts==0){?> selected="selected"<?php } ?>>Inactive</option>
							</select>
						</div>
					</div>
					
					<div class="col-md-2 plpr">
						<div class="form-group">
							<label class="control-label">IMF Code Field Label</label>
							<input type="text" class="form-control" id="imf_code_user_field_label" name="imf_code_user_field_label" placeholder="" value="<?php echo $user_details->imf_code_user_field_label;?>" autocomplete="off" />
						</div>
					</div>
							
				</div>
				
					<div class="col-md-12 plpr">
						<h4>Bank Account Details - </h4>	
						<?php $ba=1;foreach($user_accounts_listing as $acc_details){?>
						<input type="hidden" name="accounts_arr[]" id="accounts_arr[]" value="<?php echo $acc_details->account_id;?>" />
						<div class="old_bank_details">
							<div class="col-md-2 plpr"> 
								<div class="form-group">
									<label class="control-label">Account No. *</label>
									<input type="text" class="form-control number required" id="bank_account_no_<?php echo $acc_details->account_id;?>" name="bank_account_no_<?php echo $acc_details->account_id;?>" placeholder="Account #" value="<?php echo $acc_details->account_no;?>" autocomplete="off" />
								</div>
							</div>
							<div class="col-md-2 plpr">
								<div class="form-group">
									<label class="control-label">Account Type *</label>
									<?php $amt_currencies_array_config=$this->config->item('amt_currencies_array_config');?>
									<select class="form-control required" id="bank_account_cur_<?php echo $acc_details->account_id;?>" name="bank_account_cur_<?php echo $acc_details->account_id;?>">
										<option value="">-- select account type --</option>
										<?php foreach($amt_currencies_array_config as $key => $value){ if($value['status']==0){?>
										<option value="<?php echo $key;?>" <?php if($acc_details->account_cur==$key){?> selected="selected"<?php } ?>><?php echo $value['name'];?></option>
										<?php } } ?>
									</select>
								</div>
							</div>
							<div class="col-md-2 plpr">
								<div class="form-group">
									<label class="control-label">Account Category *</label>
									<?php $bank_account_types_array_config=$this->config->item('bank_account_types_array_config');?>
									<select class="form-control required" id="bank_account_category_<?php echo $acc_details->account_id;?>" name="bank_account_category_<?php echo $acc_details->account_id;?>">
										<option value="">select acct. category</option>
										<?php foreach($bank_account_types_array_config as $key => $value){ if($value['status']==0){?>
										<option value="<?php echo $key;?>" <?php if($acc_details->account_category==$key){?> selected="selected"<?php } ?>><?php echo $value['name'];?></option>
										<?php } } ?>
									</select>
								</div>
							</div>
							<div class="col-md-1 plpr">
								<div class="form-group">
									<label class="control-label">Min Bal. *</label>
									<input type="text" class="form-control number required" id="bank_minimum_balance_<?php echo $acc_details->account_id;?>" name="bank_minimum_balance_<?php echo $acc_details->account_id;?>" placeholder="" value="<?php echo $acc_details->available_balance;?>" autocomplete="off" />
								</div>
							</div>
							<div class="col-md-2 plpr">
								<div class="form-group">
									<label class="control-label">COT Code *</label>
									<input type="text" class="form-control required" id="bank_transfer_code_<?php echo $acc_details->account_id;?>" name="bank_transfer_code_<?php echo $acc_details->account_id;?>" placeholder="" value="<?php echo $acc_details->transfer_code;?>" autocomplete="off" />
								</div>
							</div>
							<div class="col-md-1 plpr">
								<div class="form-group">
									<label class="control-label">Tax Code *</label>
									<input type="text" class="form-control required" id="bank_vat_code_<?php echo $acc_details->account_id;?>" name="bank_vat_code_<?php echo $acc_details->account_id;?>" placeholder="" value="<?php echo $acc_details->vat_code;?>" autocomplete="off" />
								</div>
							</div>
							<div class="col-md-1 plpr">
								<div class="form-group">
									<label class="control-label">IMF Code *</label>
									<input type="text" class="form-control required" id="bank_imf_code_<?php echo $acc_details->account_id;?>" name="bank_imf_code_<?php echo $acc_details->account_id;?>" placeholder="" value="<?php echo $acc_details->imf_code;?>" autocomplete="off" />
								</div>
							</div>
							<div class="col-md-1 plpr">
								<div class="form-group">
									<label class="control-label">Status *</label>
									<select class="form-control required" id="account_status_<?php echo $acc_details->account_id;?>" name="account_status_<?php echo $acc_details->account_id;?>">
										<option value="0" <?php if($acc_details->status==0){?> selected="selected"<?php } ?>>Active</option>
										<option value="1" <?php if($acc_details->status==1){?> selected="selected"<?php } ?>>Inactive</option>
									</select>
								</div> 
							</div>	
						</div>
						<?php $ba++; } ?>						
					</div>
					
					<div class="col-md-3 plpr">
						<div class="form-group">
							<label for="exampleInputEmail1">Photo </label>
							<input type="file" name="upload_doc" id="upload_doc" onchange="readURL(this);" class="" />
							<input type="hidden" name="old_image_name" id="old_image_name" value="<?php echo $user_details->user_image;?>" />
						</div>
						<div class="form-group">
							<img id="blah" src="<?php if(isset($user_details->user_image) && $user_details->user_image!=''){echo base_url().'assets/upload/photo/'.$user_details->user_image;}else{echo '#';}?>" alt="" class="img-responsive" />
						</div>		
					</div>
					
				</div>  
				<div class="box-footer">
					<button class="btn btn-primary" type="submit" style="padding:5px 30px">Update Now!</button>
					<button type="button" class="btn btn-default" data-toggle="modal" data-target="#add_accts_details_modal" style="padding:5px 15px; margin-left:10px;"><i class="fa fa-plus-circle" aria-hidden="true"></i> Add More Bank Account</button>
					<button type="button" class="btn btn-info" data-toggle="modal" data-target="#add_credit_amt_modal" style="padding:5px 15px; margin-left:10px;">Add Credit Amount</button>
				</div>
			</div>
		</form>
	</div>
	
</section>
<div class="modal fade" id="add_credit_amt_modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" style="display: inline-block;">Credit Amount</h4>
				<button type="button" class="close" data-dismiss="modal">&times;</button>
			  </div>
			<div class="modal-body">
				<form id="credit_frm" method="post" action="<?php echo base_url().$this->config->item('admin_directory_name').'/user_account/credit_amt_entry';?>">
				  <input type="hidden" id="h_credit_user_id" name="h_credit_user_id" value="<?php echo $user_details->user_id;?>" />
				  <input type="hidden" id="h_user_name" name="h_user_name" value="<?php echo $user_details->customer_name;?>" />
				  <input type="hidden" id="h_user_email" name="h_user_email" value="<?php echo $user_details->email;?>" />
				  <input type="hidden" id="h_user_encrypt_id" name="h_user_encrypt_id" value="<?php echo $user_details->user_encrypt_id;?>" />
				  <div class="form-group">
					<label for="txt_txn_date" class="col-form-label">Credit/Txn Date *</label>
					<input type="text" class="form-control required" id="Date2" name="txt_txn_date" placeholder="" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
					<label for="message-text" class="col-form-label">Account *</label>
					<select class="form-control required" id="txt_credit_amt_in_acc" name="txt_credit_amt_in_acc">
						<option value="">-- select account --</option>
						 <?php foreach($user_accounts_listing as $acc_details){?>
						<option value="<?php echo $acc_details->account_id.'|'.$acc_details->available_balance.'|'.$acc_details->account_cur.'|'.$acc_details->account_no;?>"><?php echo $acc_details->account_no.' &ndash; '.$this->config->item('bank_account_types_array_config')[$acc_details->account_category]['name'];?></option>
						<?php } ?>
					</select>
				  </div>
				  <div class="form-group">
					<label for="recipient-name" class="col-form-label">Credit Amount *</label>
					<input type="text" class="form-control number required" id="txt_credit_amt" name="txt_credit_amt" placeholder="" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
					<label for="recipient-name" class="col-form-label">Description *</label>
					<textarea class="form-control required" id="txt_credit_desc" name="txt_credit_desc" style="resize:none;" rows="3"></textarea>
				  </div>				  
				  <div class="form-group">
				  	<button type="submit" name="add_credits" id="add_credits" class="btn btn-primary">Submit Now!</button>
				  </div>
				</form>
			</div>
		</div>
	</div>
</div>
<div class="modal fade" id="add_accts_details_modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" style="display: inline-block;">Bank Account : : Add</h4>
				<button type="button" class="close" data-dismiss="modal">&times;</button>
			  </div>
			<div class="modal-body">
				<form id="add_frm" method="post" action="<?php echo base_url().$this->config->item('admin_directory_name').'/user_account/acct_entry';?>">
				  <input type="hidden" id="h_user_id" name="h_user_id" value="<?php echo $user_details->user_id;?>" />
				  <input type="hidden" id="h_user_encrypt_id" name="h_user_encrypt_id" value="<?php echo $user_details->user_encrypt_id;?>" />
				  <div class="form-group">
					<label for="recipient-name" class="col-form-label">Account No. *</label>
					<input type="text" class="form-control number required" id="bank_account_no" name="bank_account_no" placeholder="Account #" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
					<label for="message-text" class="col-form-label">Account Currency *</label>
					<select class="form-control required" id="bank_account_cur" name="bank_account_cur">
						<option value="">-- select account type --</option>
						<?php foreach($amt_currencies_array_config as $key => $value){ if($value['status']==0){?>
						<option value="<?php echo $key;?>"><?php echo $value['name'];?></option>
						<?php } } ?>
					</select>
				  </div>
				  <div class="form-group">
					<label for="message-text" class="col-form-label">Account Category *</label>
					<select class="form-control required" id="bank_account_category" name="bank_account_category">
						<option value="">-- select account category --</option>
						<?php foreach($bank_account_types_array_config as $key => $value){ if($value['status']==0){?>
						<option value="<?php echo $key;?>"><?php echo $value['name'];?></option>
						<?php } } ?>
					</select>
				  </div>
				  <div class="form-group">
					<label for="recipient-name" class="col-form-label">Minimum Balance Amount *</label>
					<input type="text" class="form-control number required" id="bank_minimum_balance" name="bank_minimum_balance" placeholder="" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
					<label for="recipient-name" class="col-form-label">Transfer Code *</label>
					<input type="text" class="form-control required" id="bank_transfer_code" name="bank_transfer_code" placeholder="" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
					<label for="bank_vat_code" class="col-form-label">Tax Code *</label>
					<input type="text" class="form-control required" id="bank_vat_code" name="bank_vat_code" placeholder="" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
					<label for="bank_vat_code" class="col-form-label">IMF Code *</label>
					<input type="text" class="form-control required" id="bank_imf_code" name="bank_imf_code" placeholder="" value="" autocomplete="off" />
				  </div>
				  <div class="form-group">
				  	<button type="submit" name="add_accts" id="add_accts" class="btn btn-primary">Submit Now!</button>
				  </div>
				</form>
			</div>
		</div>
	</div>
</div>
<script>
$(document).ready(function() {
	$('#add_frm').validate({
		ignore: [], 
		highlight: function(element) {
			$(element).closest('.form-group').removeClass('has-success').addClass('has-error'); 
		},
		success: function(element) {
			element.closest('.form-group').removeClass('has-error').addClass('has-success');
			element.remove();
		}
	}); 
	$('#credit_frm').validate({
		ignore: [], 
		highlight: function(element) {
			$(element).closest('.form-group').removeClass('has-success').addClass('has-error'); 
		},
		success: function(element) {
			element.closest('.form-group').removeClass('has-error').addClass('has-success');
			element.remove();
		}
	});
});
</script>