<!------model form open----->
	<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                        <h4 class="modal-title">New Task</h4>
                                    </div>
                                    <div class="modal-body">
									
<?php
//INSERT NEW TASK - ADMIN LOGIN
if(isset($_REQUEST['AddNewTaskEXE']))
{
	$temp_id=$_REQUEST['temp_id'];
	$branchid=$_REQUEST['branchid'];
	$create_date=$_REQUEST['date'];
	
	$task=$_REQUEST['task'];
	$task = RemoveSpecialChar($task);
	
$SelectCount="SELECT COUNT(*) AS numCount FROM task_mng WHERE tempid='$temp_id'";
$ExeCount=mysqli_query($db_conn,$SelectCount);
$FetchCount=mysqli_fetch_array($ExeCount);
if($FetchCount['numCount']==0)
{
	$insRecords="INSERT INTO task_mng (tempid,branchid,task,start_date,status,completed_date,completed_by,followup_remarks) 
	VALUES 
	('$temp_id','$branchid','$task','$create_date','pending','$create_date','nil','nil')";
	mysqli_query($db_conn,$insRecords);
}
	
	$_SESSION['sucMessage']="Task Created Successfully";
	echo "<script>window.location='landing';</script>";
}
?>

<form role="form" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>">
										
<?php function GeraHash($qtd){ $Caracteres = '123456789ABCDEFGHJKLMNPQRSTUVWXYZ'; 
$QuantidadeCaracteres = strlen($Caracteres); $QuantidadeCaracteres--; $Hash=NULL; 
for($x=1;$x<=$qtd;$x++){ $Posicao = rand(0,$QuantidadeCaracteres); $Hash .= substr($Caracteres,$Posicao,1); } 
return $Hash; } $randum_number=GeraHash(6);
date_default_timezone_set("Asia/Kolkata");
$temp_date=date("dmy");
$temp_time=date("gis"); 
$tempID="".$randum_number."/".$temp_date."/".$temp_time."";?>

<input type="hidden" name="temp_id" value="<?=$tempID?>">

					<div class="form-group">
					<label>Date</label>
					<input type="date" class="form-control" disabled name="date" value="<?=date("Y-m-d");?>"/>
					<input type="hidden" name="date" value="<?=date("Y-m-d");?>"/>
					</div>
											
                    <div class="form-group">
                                                <label>Branch</label>
                                                <select class="form-control" required="" name="branchid">
												<option value="" hidden="">Select</option>
												<?php
$selectBranchdetails="SELECT id,name FROM admin_branch ORDER BY name ASC";
$fetchBranchDteails=mysqli_query($db_conn,$selectBranchdetails);
while($resultBranchDetails=mysqli_fetch_array($fetchBranchDteails)){
												?>
<option value="<?=$resultBranchDetails['id'];?>"><?=$resultBranchDetails['name'];?></option>
<?php }?>
												</select>
                                            </div>
                                            <div class="form-group">
                                                <label>Task Remarks</label>
                                                <textarea class="form-control" rows="10" onkeypress="restrictSpecialChars(event)" required="" name="task"></textarea>
                                            </div>
                                            
                                   <button type="submit" name="AddNewTaskEXE" class="btn btn-success">Submit</button>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
						<!------model form close----->