<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title"><?php if($isEdit){ echo 'Edit Task';} else { echo 'Create Task'; }?></div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.php?page=home">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="index.php?page=manage_users">Users</a>&nbsp;<i class="fa fa-angle-right"></i></li><li class="active">Create Task</li>
                            </ol>
                        </div>
                    </div>
<div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header><?php if($isEdit){ echo 'Edit Task';} else { echo 'Create Task'; }?></header>                                    
                                </div>
                                <div class="card-body" id="bar-parent1">
                                	
                                	<?php if(isset($error) && $error!='') { ?> 
                                	<div class="alert alert-danger"><?php echo $error; ?></div>
                                	<?php } else if(isset($success) && $success!=''){ ?>                                		
                                		<div class="alert alert-success"><?php echo $success; ?></div>
                                	<?php } else if(isset($_REQUEST['success'])){ ?>                                		
                                		<div class="alert alert-success"><?php echo $_REQUEST['success']; ?></div>
                                	<?php } ?>
                                	                                	
                                    <form action="" id="form_staff_add" class="form-horizontal" method="post" enctype="multipart/form-data">
                                        <div class="form-body">
                                        	
                                        	<div class="form-group row">
                                                <label class="control-label col-md-3">Select Category</label>
                                                <div class="col-md-4">                                                    
                                                    <select name="category" id="category" class="form-control" >
                                                    	<option value="">--Select--</option>
										              <?php if(mysqli_num_rows($categoryRs)>0){
										              	while($categoryRec = mysqli_fetch_array($categoryRs)){ 
														$subcatRs = mysqli_query($con, "SELECT id, name FROM tbl_service_categories WHERE status = 'Active' AND parent_id = '".$categoryRec['id']."' ORDER BY name"); ?>
										              	<option value="<?php echo $categoryRec['id']; ?>" <?php if(isset($_POST['category']) && $_POST['category']==$categoryRec['id']) { echo 'selected="selected"'; } else if(isset($resEdit['category']) && $resEdit['category']==$categoryRec['id']){ echo 'selected="selected"'; } ?> ><?php echo $categoryRec['name']; ?></option>
                                                        <?php if(mysqli_num_rows($categoryRs)>0){
										              	while($subcatRec = mysqli_fetch_array($subcatRs)){ ?>
                                                        	<option value="<?php echo $subcatRec['id']; ?>" <?php if(isset($_POST['category']) && $_POST['category']==$subcatRec['id']) { echo 'selected="selected"'; } else if(isset($resEdit['category']) && $resEdit['category']==$subcatRec['id']){ echo 'selected="selected"'; } ?> ><?php echo '--'.$subcatRec['name']; ?></option>
                                                        <?php } } ?>
										              <?php } } ?>
										            </select>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group row">
                                            	
                                                <label class="control-label col-md-6 text-center"><b>Select task location</b></label>
                                           	</div>
                                        	<?php if($userRec['house_name']!=''){?>                                        	 
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Profile Address</label>
                                                <div class="col-md-4 row">  
                                                	<div class="col-1 mt-2">                                                  
                                                    	<input name="address_id" type="radio" id="address0" class="form-control col-1" value="0" <?php if(isset($_POST['address_id']) && $_POST['address_id']=='0') { echo 'checked'; } else if(isset($resEdit['address_id']) && $resEdit['address_id']=='0'){ echo 'checked';} else if($userRec['def_address']=='0'){ echo 'checked';} ?>/>
                                                    </div>
                                                    <div class="col-6">
                                                    	<?php echo $userRec['house_name']; ?></br>
                                                        <?php if($userRec['street']!=''){?> <?php echo $userRec['street']; ?></br><?php } ?>
                                                        <?php echo $userRec['place']; ?></br>
                                                        <?php echo getCityName($userRec['city']); ?>
                                                    </div>
                                                </div>
                                            </div>
                                            <?php } ?>
                                            
                                            <?php if(mysqli_num_rows($userAddressRs)>0){ 
											$cc = 1;
												while($userAddressRec = mysqli_fetch_array($userAddressRs)){ ?>
                                            	<div class="form-group row">
                                                    <label class="control-label col-md-3">Address<?php echo $cc+1;?></label>
                                                    <div class="col-md-4 row">  
                                                    	<div class="col-1 mt-2">                                                     
                                                        	<input name="address_id" type="radio" id="address<?php echo $cc;?>" class="form-control col-1" value="<?php echo $userAddressRec['id'];?>" <?php if(isset($_POST['address_id']) && $_POST['address_id']==$userAddressRec['id']) { echo 'checked'; } else if(isset($resEdit['address_id']) && $resEdit['address_id']==$userAddressRec['id']){ echo 'checked';} else if($userRec['def_address']==$userAddressRec['id']){ echo 'checked';} ?>/>
                                                        </div>
                                                        <div class="col-6">
                                                            <?php echo $userAddressRec['house_name']; ?></br>
                                                            <?php if($userAddressRec['street']!=''){?> <?php echo $userAddressRec['street']; ?></br><?php } ?>
                                                            <?php echo $userAddressRec['place']; ?></br>
                                                            <?php echo getCityName($userAddressRec['city']); ?>
                                                        </div>
                                                    </div>
                                                </div>                                            
                                            <?php $cc++; } } ?>
                                            
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Description</label>
                                                <div class="col-md-4">        
                                                	<textarea name="description" id="description" cols="30" rows="5"><?php if(isset($_POST['description'])) { echo htmlentities(($_POST['description']), ENT_QUOTES); } else if(isset($resEdit['description']) && $resEdit['description']!=''){ echo $resEdit['description'];} ?></textarea>                                            
                                                </div>
                                            </div>
                                            
                                            
                                            <div class="form-group row">
	                                            <label class="col-md-3 control-label">Task Date/Time</label>
	                                            <div class='col-md-4'>
                                                    <div class="form-group">
                                                        <div class='input-group date' id='datetimepicker1' data-date-format="dd-mm-yyyy H:i">
                                                            <input name="date_time" value="<?php if(isset($_POST['date_time']) && $_POST['date_time']!=''){ echo $_POST['date_time']; }?>" type='text' class="form-control" style="width:150px;" />
                                                            <span class="input-group-addon">
                                                                <span class="glyphicon glyphicon-calendar"></span>
                                                            </span>
                                                        </div>
                                                    </div>
                                                </div>
                                                <script type="text/javascript">
                                                    $(function () {
                                                        $('#datetimepicker1').datetimepicker();
                                                    });
                                                </script>
	                                        </div>
                                            
                                            
	                                        
	                                        
                                        </div>  
                                        
                                       
                                          
                                      	<div class="form-group">
                                            <div class="offset-md-3 col-md-9">
                                            	<?php if($isEdit){ ?>
                                            		<button type="submit" name="update" class="btn btn-info">Update</button>
                                            	<?php } else { ?>
                                            		<button type="submit" name="add" class="btn btn-info">Submit</button>
                                            	<?php } ?>     
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
	</div>
</div>
