<?php include('./utility/texteditor_limited.php')?>
<form name="searchfrm" id="searchfrm" action="<?php echo $page_name?>" method="post" target="_parent" enctype="multipart/form-data">
<input type="hidden" name="family_id" id="family_id" value="<?php echo $userDetails->id?>" />
<input type="hidden" name="status" id="status" value="<?php echo $userDetails->status?>" />
<div style="padding-top:100px;">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left" class="breadcrumb"><a href="index.php">Home</a> &raquo; <?php if($userDetails->id==''){?>Add Family Member<?php }else{?>Edit Family Member<?php }?></td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td>
					<?php if($userDetails->id==''){?>
                    		<h3>Add Family Member</h3>
					       <?php }
						   else{?><h3>Edit Family Member</h3>
						   <?php }?></td>
                </tr>
              <tr>
                <td><br /><h3 style="color:red"><?php echo $error_msg;?></h3></td>
                </tr>
              <tr>
                <td>
                  <table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" class="table table-bordered table-striped">
                    
					<tr>
                      <td width="42%" align="right"><strong>Full Name</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_fullname" type="text" class="form-control" id="fam_fullname" style="width:300px; height:35px" value="<?php echo $userDetails->fam_fullname?>" />
						<div id="regno_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Gender</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<select id="fam_gender" name="fam_gender" class="form-control">
                          	<option value="">[Gender]</option>
									<option value="Male" <?php if("Male"==$userDetails->fam_gender){echo "selected";}?>>Male</option>
									<option value="Female" <?php if("Female"==$userDetails->fam_gender){echo "selected";}?>>Female</option>
                          </select>
						<div id="plno_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Blood Group</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<select id="fam_bloodgroup" name="fam_bloodgroup" class="form-control">
								<option value="">[Blood Group]</option>
								<option value="A+" <?php if($userDetails->fam_bloodgroup == 'A+') { echo "Selected"; } ?>>A+</option>
								<option value="B+" <?php if($userDetails->fam_bloodgroup == 'B+') { echo "Selected"; } ?>>B+</option>
								<option value="A-" <?php if($userDetails->fam_bloodgroup == 'A-') { echo "Selected"; } ?>>A-</option>
								<option value="B-" <?php if($userDetails->fam_bloodgroup == 'B-') { echo "Selected"; } ?>>B-</option>
								<option value="AB+" <?php if($userDetails->fam_bloodgroup == 'AB+') { echo "Selected"; } ?>>AB+</option>
								<option value="AB-" <?php if($userDetails->fam_bloodgroup == 'AB-') { echo "Selected"; } ?>>AB-</option>
								<option value="O+" <?php if($userDetails->fam_bloodgroup == 'O+') { echo "Selected"; } ?>>O+</option>
								<option value="O-" <?php if($userDetails->fam_bloodgroup == 'O-') { echo "Selected"; } ?>>O-</option>
                          	</select>      
						<div id="firstname_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Birth Date</strong></td>
                      <td width="58%" align="left">
					  	 <?php if($userDetails->fam_dob=="0" or $userDetails->fam_dob=="0000-00-00"){
					  		$userDetails->dob = "";
					  }?>
						<div class="col-lg-8" align="left" style="padding-left:0px">
					  	<div class='input-group date' id='dob_dt'>
					  		<input name="fam_dob" type="text" class="form-control" id="fam_dob" style="width:300px; height:35px" data-format="YYYY-MM-DD" placeholder="YYYY-MM-DD" value="<?php echo $userDetails->fam_dob?>" /><span class="input-group-addon" ><i class="fa fa-calender"></i>
                                </span>
						</div>
						</div>
					  <script type="text/javascript">
								 $(function () {
									$('#dob_dt').datetimepicker({
										pickTime: false
									});
									
								});
							</script>
                      </div>
					  </td>
                    </tr>
					
					<tr>
                      <td width="42%" align="right"><strong>Relation with Member</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_relationwithmember" type="text" class="form-control" id="fam_relationwithmember" style="width:300px; height:35px" value="<?php echo $userDetails->fam_relationwithmember?>" />
						<div id="regno_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Marital Status</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<select id="fam_maritalstatus" name="fam_maritalstatus" class="form-control">
								<option value="">[Marital Status]</option>
								<option value="Married" <?php if($userDetails->fam_maritalstatus == 'Married') { echo "Selected"; } ?>>Married</option>
								<option value="Unmarried" <?php if($userDetails->fam_maritalstatus == 'Unmarried') { echo "Selected"; } ?>>Unmarried</option>
							  </select> 
						<div id="regno_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Education</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_education" type="text" class="form-control" id="fam_education" style="width:300px; height:35px" value="<?php echo $userDetails->fam_education?>" />
						<div id="address1_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Occupation</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_occupation" type="text" class="form-control" id="fam_occupation" style="width:300px; height:35px" value="<?php echo $userDetails->fam_occupation?>" />
						<div id="address2_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Name of Company</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_nameofcompany" type="text" class="form-control" id="fam_nameofcompany" style="width:300px; height:35px" value="<?php echo $userDetails->fam_nameofcompany?>" />
						<div id="address3_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Designation</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_designation" type="text" class="form-control" id="fam_designation" style="width:300px; height:35px" value="<?php echo $userDetails->fam_designation?>" />
						<div id="address3_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Address1</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_address1" type="text" class="form-control" id="fam_address1" style="width:300px; height:35px" value="<?php echo $userDetails->fam_address1?>" />
						<div id="address3_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Address2</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_address2" type="text" class="form-control" id="fam_address2" style="width:300px; height:35px" value="<?php echo $userDetails->fam_address2?>" />
						<div id="address3_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business City</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_city" type="text" class="form-control" id="fam_city" style="width:300px; height:35px" value="<?php echo $userDetails->fam_city?>" />
						<div id="address3_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business State</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_state" type="text" class="form-control" id="fam_state" style="width:300px; height:35px" value="<?php echo $userDetails->fam_state?>" />
						<div id="address3_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Country</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<select id="fam_country" name="fam_country" class="form-control">
                          	<option value="">[Country]</option>
							<?php
							
							foreach($countries as $country){
								?>
									<option value="<?php echo $country->name?>" <?php if($country->name==$userDetails->fam_country){echo "selected";}?>><?php echo $country->name?></option>
								<?php
							}
							?>
                          </select>  
						<div id="country_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Zip</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_zip" type="text" class="form-control" id="fam_zip" style="width:300px; height:35px" value="<?php echo $userDetails->fam_zip?>" />
						<div id="zipcode_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Phone</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_phone" type="text" class="form-control" id="fam_phone" style="width:300px; height:35px" value="<?php echo $userDetails->fam_phone?>" />
						<div id="rphone_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Website</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_website" type="text" class="form-control" id="fam_website" style="width:300px; height:35px" value="<?php echo $userDetails->fam_website?>" />
						<div id="mobile_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					<tr>
                      <td width="42%" align="right"><strong>Business Email</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input name="fam_email" type="text" class="form-control" id="fam_email" style="width:300px; height:35px" value="<?php echo $userDetails->fam_email?>" />
						<div id="email_vmsg"></div>
                      </div>
					  </td>
                    </tr>
					
					<tr>
                      <td width="42%" align="right"><strong>Image</strong></td>
                      <td width="58%" align="left">
					  	<div class="form-group">
							<input type="file" name="fam_simage" id="fam_simage" /> <br />
						  (Only <?php echo VALID_EXT_MEMBERS?>)
						<div id="simage_vmsg"></div>
                      </div>
					   <?php 
					  if(!empty($userDetails->fam_simage)){
								 ?>
							 	<table align="center" border="0" cellpadding="3" cellspacing="3" width="100%">
                               	   <tr>	
                                   		<td width="133"><?php if(!empty($userDetails->fam_simage)){?> <img src="<?php echo  UPLOADDIR_MEMBERS."/".$userDetails->fam_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->fam_simage?>">
										</td>
                                   	   
                                   </tr>
                               </table>
                             <?php } ?>
					  </td>
                    </tr>
					
                    
                    <tr align="left">
                      <td align="right">&nbsp;</td>
                      <td><input type="submit" class="btn btn-primary" name="Submit" id="Submit" value="Submit" /></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              
              </table>
              </div>
</form>
<script type="text/javascript">
$(document).ready(function() {
    $('#searchfrm').bootstrapValidator({
        message: 'This value is not valid',
        fields: {
			fam_fullname: {
                message: 'The Full Name is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Full Name is required and can\'t be empty'
                    }
                }
            },mobile: {
                message: 'The Mobile is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Mobile is required and can\'t be empty'
                    }
                }
            },
            email: {
				message: 'The Email Address is not valid',
                validators: {
					notEmpty: {
                        message: 'The Email address is required and can\'t be empty'
                    },
                    emailAddress: {
                        message: 'The input is not a valid email address'
                    }
                }
            },password: {
                message: 'The Password is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Password is required and can\'t be empty'
                    }
                }
            }
        }
    });
});
</script>
