<?php require_once './utility/texteditor_utility.php';?>
<?php
$req = $_POST['List'];
if(empty($req)){
		$req ="Add";
}
$ctrl_name = BASE_URL."/members";
$page_name = BASE_URL."/members/".$req;
$num = $cnt;
?>
<style>
		.black_overlay{
			display: none;
			position:fixed;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index:1001;
			-moz-opacity: 0.7;
			opacity:.70;
			filter: alpha(opacity=70);
		}
		.white_content {
			display: none;
			position:fixed;
			top: 30%;
			left: 32%;
			width: 470px;
			height: 600px;
			z-index:1002;
			overflow: auto;
		}
</style>
<h1 class="page-header"><?php echo $_REQUEST["List"]?> Member</h1>          
<div class="bs-example table-responsive">
	<table align="center" width="100%" border="0">    	
    	 <?php if(!empty($error_msg)) {?>     
            <tr>
                <td align="center">  
                  <div class="col-lg-8 alert alert-danger" style="clear:right">
                    <?php echo $error_msg;?>
                 </div>             
                </td>
             </tr>   
			 
         <?php } ?> 
		 	<tr>
                <td align="center">  
                  <div style="clear:right" align="right">
                   <button value="AddRecord" type="button" name="AddButton" class="btn btn-primary" onclick="location.href='<?php echo BASE_URL?>/members/index'">Back to Members</button>
                 </div>             
                </td>
             </tr>   
        <tr>
        	<td align="center">       
             <div class="col-lg-12">
             <div class="well">
                  <form name="frm" id="frm" method="post" class="bs-example form-horizontal" enctype="multipart/form-data">
                  <input type="hidden" name="act" id="act" value="" />
				  <input type="hidden" name="List" value="<?php echo $_REQUEST['List']?>">
					<input type="hidden" name="member_id" id="member_id" value="<?php echo $userDetails->id?>" />
					<input type="hidden" name="oldfamilyno" id="oldfamilyno" value="<?php echo $userDetails->familyno?>" />
                    <fieldset>  
					<div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Family Number</label>
                        <div class="col-lg-8">
                          <input name="familyno" type="text" class="validate[required] form-control" id="familyno" value="<?php echo $userDetails->familyno?>" />
                        </div>
                      </div>      
					<div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Full Name</label>
                        <div class="col-lg-8">
                          <input name="fullname" type="text" class="validate[required] form-control" id="fullname" value="<?php echo $userDetails->fullname?>" />
                        </div>
                      </div>      
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Gender</label>
                        <div class="col-lg-5">
                          <select id="gender" name="gender" class="form-control">
                          	<option value="">[Gender]</option>
									<option value="Male" <?php if("Male"==$userDetails->gender){echo "selected";}?>>Male</option>
									<option value="Female" <?php if("Female"==$userDetails->female){echo "selected";}?>>Female</option>
                          </select>
                        </div>
                      </div>           
					 <div class="form-group">
                          <label class="col-lg-3 control-label" for="client_id">Blood Group</label>
                        <div class="col-lg-5">
                           <select id="bloodgroup" name="bloodgroup" class="form-control">
                          	<option value="">[Blood Group]</option>
                            <option value="A+" <?php if($userDetails->bloodgroup == 'A+') { echo "Selected"; } ?>>A+</option>
							<option value="B+" <?php if($userDetails->bloodgroup == 'B+') { echo "Selected"; } ?>>B+</option>
							<option value="A-" <?php if($userDetails->bloodgroup == 'A-') { echo "Selected"; } ?>>A-</option>
							<option value="B-" <?php if($userDetails->bloodgroup == 'B-') { echo "Selected"; } ?>>B-</option>
							<option value="AB+" <?php if($userDetails->bloodgroup == 'AB+') { echo "Selected"; } ?>>AB+</option>
							<option value="AB-" <?php if($userDetails->bloodgroup == 'AB-') { echo "Selected"; } ?>>AB-</option>
							<option value="O+" <?php if($userDetails->bloodgroup == 'O+') { echo "Selected"; } ?>>O+</option>
							<option value="O-" <?php if($userDetails->bloodgroup == 'O-') { echo "Selected"; } ?>>O-</option>
                          </select>           
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="startdate">Birth Date</label>
                        <div class="col-lg-5">
                        	<div class='input-group date' id='dob_dt'>
							<?php if($userDetails->dob=='0000-00-00'){$userDetails->dob='';}?>
                                <input type="text" placeholder="Birth Date" id="dob" name="dob" class="form-control"  value="<?php echo $userDetails->dob?>" data-format="YYYY-MM-DD"> 
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                            <script type="text/javascript">
								 $(function () {
									$('#dob_dt').datetimepicker({
										pickTime: false
									});
								});
							</script>
                         </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="startdate">Anniversary Date</label>
                        <div class="col-lg-5">
                        	<div class='input-group date' id='expdate'>
							<?php if($userDetails->expirydate=='0000-00-00'){$userDetails->expirydate='';}?>
                                <input type="text" placeholder="Anniversary Date" id="expirydate" name="expirydate" class="form-control"  value="<?php echo $userDetails->expirydate?>" data-format="YYYY-MM-DD"> 
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                            <script type="text/javascript">
								 $(function () {
									$('#expdate').datetimepicker({
										pickTime: false
									});
								});
							</script>
                         </div>
                      </div>
					  <!--<div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Gam</label>
                        <div class="col-lg-5">
                          <select id="nativeplace" name="nativeplace" class="form-control">
                          	<option value="">[Gam]</option>
							<?php
							
							foreach($gams as $gam){
								?>
									<option value="<?php echo $gam->name?>" <?php if($gam->name==$userDetails->nativeplace){echo "selected";}?>><?php echo $gam->name?></option>
								<?php
							}
							?>
                          </select>   
                        </div>
                      </div>-->
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Address1</label>
                        <div class="col-lg-8">
                          <input name="address1" type="text" class="validate[required] form-control" id="address1" value="<?php echo $userDetails->address1?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Address2</label>
                        <div class="col-lg-8">
                          <input name="address2" type="text" class="validate[required] form-control" id="address2" value="<?php echo $userDetails->address2?>" />
                        </div>
                      </div>
                      
                       <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Area</label>
                        <div class="col-lg-8">
                          <input name="area" type="text" class="validate[required] form-control" id="area" value="<?php echo $userDetails->area?>" />
                        </div>
                      </div>
					 
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">City</label>
                        <div class="col-lg-7">
                           <input name="city" type="text" class="validate[required] form-control" id="city" value="<?php echo $userDetails->city?>" /> 
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">State</label>
                        <div class="col-lg-8">
                          <input name="state" type="text" class="validate[required] form-control" id="state" value="<?php echo $userDetails->state?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Country</label>
                        <div class="col-lg-5">
                           <select id="country" name="country" class="form-control">
                          	<option value="">[Country]</option>
							<?php
							
							foreach($countries as $country){
								?>
									<option value="<?php echo $country->name?>" <?php if($country->name==$userDetails->country){echo "selected";}?>><?php echo $country->name?></option>
								<?php
							}
							?>
                          </select>           
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Zipcode</label>
                        <div class="col-lg-8">
                          <input name="zipcode" type="text" class="validate[required] form-control" id="zipcode" value="<?php echo $userDetails->zip?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Resedence Phone</label>
                        <div class="col-lg-8">
                          <input name="phone" type="text" class="validate[required] form-control" id="phone" value="<?php echo $userDetails->phone?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Mobile</label>
                        <div class="col-lg-8">
                          <input name="mobile" type="text" class="validate[required] form-control" id="mobile" value="<?php echo $userDetails->mobile?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Email</label>
                        <div class="col-lg-8">
                          <input name="email" type="text" class="validate[required] form-control" id="email" value="<?php echo $userDetails->email?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">User Name</label>
                        <div class="col-lg-8">
                          <input name="username" type="text" class="validate[required] form-control" id="username" value="<?php echo $userDetails->username?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Password</label>
                        <div class="col-lg-8">
                          <input name="password" type="password" class="validate[required] form-control" id="password" value="<?php echo $userDetails->password?>" />
						  <?php /*?><input type="hidden" name="oldpass" id="oldpass" value="<?php echo $userDetails->password?>" /><?php */?>
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Marital Status</label>
                        <div class="col-lg-5">
                          <select id="maritalstatus" name="maritalstatus" class="form-control">
                          	<option value="">[Marital Status]</option>
                            <option value="Married" <?php if($userDetails->maritalstatus == 'Married') { echo "Selected"; } ?>>Married</option>
							<option value="Unmarried" <?php if($userDetails->maritalstatus == 'Unmarried') { echo "Selected"; } ?>>Unmarried</option>
                            <option value="Divorce" <?php if($userDetails->maritalstatus == 'Divorce') { echo "Selected"; } ?>>Divorce</option>
                          </select>  
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">No. of Family Members</label>
                        <div class="col-lg-8">
                          <input name="nooffamilymembers" type="text" class="validate[required] form-control" id="nooffamilymembers" value="<?php echo $userDetails->nooffamilymembers?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Education</label>
                        <div class="col-lg-8">
                          <input name="education" type="text" class="validate[required] form-control" id="education" value="<?php echo $userDetails->education?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Occupation</label>
                        <div class="col-lg-5">
                          <select id="occupation" name="occupation" class="form-control">
                          	<option value="">[Occupation]</option>
                            <option value="Business" <?php if($userDetails->occupation == 'Business') { echo "Selected"; } ?>>Business</option>
							<option value="Job" <?php if($userDetails->occupation == 'Job') { echo "Selected"; } ?>>Job</option>
                          </select>  
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Name of Company</label>
                        <div class="col-lg-8">
                          <input name="bus_nameofcompany" type="text" class="validate[required] form-control" id="bus_nameofcompany" value="<?php echo $userDetails->bus_nameofcompany?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Nature of Business</label>
                        <div class="col-lg-8">
                          <input name="bus_nature" type="text" class="validate[required] form-control" id="bus_nature" value="<?php echo $userDetails->bus_nature?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Designation</label>
                        <div class="col-lg-8">
                          <input name="bus_designation" type="text" class="validate[required] form-control" id="bus_designation" value="<?php echo $userDetails->bus_designation?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Address1</label>
                        <div class="col-lg-8">
                          <input name="bus_address1" type="text" class="validate[required] form-control" id="bus_address1" value="<?php echo $userDetails->bus_address1?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Address2</label>
                        <div class="col-lg-8">
                          <input name="bus_address2" type="text" class="validate[required] form-control" id="bus_address2" value="<?php echo $userDetails->bus_address2?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business City</label>
                        <div class="col-lg-8">
                          <input name="bus_city" type="text" class="validate[required] form-control" id="bus_city" value="<?php echo $userDetails->bus_city?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business State</label>
                        <div class="col-lg-8">
                          <input name="bus_state" type="text" class="validate[required] form-control" id="bus_state" value="<?php echo $userDetails->bus_state?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Country</label>
                        <div class="col-lg-5">
                          <select id="bus_country" name="bus_country" class="form-control">
                          	<option value="">[Country]</option>
							<?php
							
							foreach($countries as $country){
								?>
									<option value="<?php echo $country->name?>" <?php if($country->name==$userDetails->bus_country){echo "selected";}?>><?php echo $country->name?></option>
								<?php
							}
							?>
                          </select>  
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Zip</label>
                        <div class="col-lg-8">
                          <input name="bus_zip" type="text" class="validate[required] form-control" id="bus_zip" value="<?php echo $userDetails->bus_zip?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Phone</label>
                        <div class="col-lg-8">
                          <input name="bus_phone" type="text" class="validate[required] form-control" id="bus_phone" value="<?php echo $userDetails->bus_phone?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Website</label>
                        <div class="col-lg-8">
                          <input name="bus_website" type="text" class="validate[required] form-control" id="bus_website" value="<?php echo $userDetails->bus_website?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Business Email</label>
                        <div class="col-lg-8">
                          <input name="bus_email" type="text" class="validate[required] form-control" id="bus_email" value="<?php echo $userDetails->bus_email?>" />
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Renewal Date</label>
                        <div class="col-lg-8">
                          <input name="renew_date" type="text" class="validate[required] form-control" id="renew_date" value="<?php echo $userDetails->renew_date?>" />
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">About business</label>
                        <div class="col-lg-8">
                          <textarea name="about_business" class="form-control" id="about_business"/><?php echo $userDetails->about_business?></textarea>
                        </div>
                      </div>
					  
					 
					  
					  
					 <?php /*?> <?php if($userDetails->approved!=1){?>
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="designer_email">Approved</label>
                        <div class="col-lg-8" align="left">
                          <input type="checkbox" name="approved" id="approved" value="1" <?php if($userDetails->approved==1){echo "checked";}?> />
                        </div>
                      </div>
					  <?php }?><?php */?>
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Image</label>
                        <div class="col-lg-8" align="left">
                          <input type="file" name="simage" id="simage" /> (Only <?php echo VALID_EXT_MEMBERS?>) 
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="page_content"></label>
                        <div class="col-lg-6">
                          <?php 
					  if(!empty($userDetails->simage)){
								 ?>
							 	<table align="center" border="0" cellpadding="3" cellspacing="3" width="100%">
                               	   <tr>	
                                   		<td width="133"><?php if(!empty($userDetails->simage)){?> <img src="<?php echo "../". UPLOADDIR_MEMBERS."/".$userDetails->simage?>?<?php echo date("YmdHis")?>" width="100" height="100" alt="<?php echo SEO_IMAGE_ALT; ?>" title="<?php echo SEO_IMAGE_TITLE; ?>"> <?php }?><input type="hidden" name="homebanner_image_old" value="<?php echo $userDetails->simage?>">
										</td>
                                   	   
                                   </tr>
                               </table>
                             <?php } ?>
                        </div>
                      </div>
					  
					  <div class="form-group">
                          <label class="col-lg-3 control-label" for="designer_email">Send SMS/Email?</label>
                        <div class="col-lg-8" align="left">
                         <input type="checkbox" name="send_sms" id="send_sms" value="Yes" <?php if($_REQUEST["List"] == "Add") { echo "Checked";}?>>
                        </div>
                      </div>
                  		<div class="form-group">
                          <label class="col-lg-3 control-label" for="designer_email">Status</label>
                        <div class="col-lg-8" align="left">
                          <select name="status" id="status" class="form-control" style="width:100px; text-align:left">
												  	<option value="1" <?php if($userDetails->status==1){echo "selected";}?>>Active</option>
													<option value="0" <?php if($userDetails->status==0){echo "selected";}?>>Inactive</option>
												  </select>
                        </div>
                      </div>
                      <div class="form-group">
                        <div class="col-lg-8 col-lg-offset-1">                    
                          <button class="btn btn-primary" name="Submit" type="submit" value="Submit">Submit</button>&nbsp; <button class="btn btn-primary" name="Cancel" type="button" value="Cancel" onclick="location.href='<?php echo BASE_URL?>/members/index'">Cancel</button>
                        </div>
                      </div>
                    </fieldset>
                  </form>
            </div>
          </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
$(document).ready(function() {
    $('#frm').bootstrapValidator({
        message: 'This value is not valid',
        fields: {
			
			familyno: {
                message: 'The Family Number is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Family Number is required and can\'t be empty'
                    }
                }
            },fullname: {
                message: 'The Name is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Name is required and can\'t be empty'
                    }
                }
            },username: {
                message: 'The User Name is not valid',
                validators: {
                    notEmpty: {
                        message: 'The User Name is required and can\'t be empty'
                    }
                }
            },password: {
                message: 'The Password is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Password is required and can\'t be empty'
                    }
                }
            }
        }
    });
});
</script>