<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<?php


 
     ?>


<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Add MEETING | EduPortal</title>

    <?php include('RootMe/css_links.php');?>
  
<script type="text/javascript">

function getSubCat(id){
  //alert(id);

    if (window.XMLHttpRequest) {
      // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    } else { // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4 && xmlhttp.status==200) {

        document.getElementById("subcatgory").innerHTML=xmlhttp.responseText;
       //alert(xmlhttp.responseText);

      }

    }
    xmlhttp.open("GET","get_exp_subcategory.php?id="+id,true);
    xmlhttp.send();
  }



   function checkboxes(){
  
var chk_arr =  document.getElementsByName("students[]");
var chklength = chk_arr.length;             
var students;
var count=0;
//alert(chk_arr);
  for(k=0;k< chklength;k++)
  {
      
      if(chk_arr[k].checked){
         var vl=chk_arr[k].value.split(",");
         students=students+","+vl[1];
        count++;  
        
    }

  } 
   // alert(students);
if(count>0){

  window.location="messages.php?students="+students;
}else {
  
  alert("Please choose any students from checkboxes...");

}
  
}
</script> 

  </head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
 
<!-- <script>
$(document).ready(function(){
  
    $("#div1").fadeOut();
    $("#div2").fadeOut("slow");
    $("#div3").fadeOut(3000);
 
});
</script> -->
  <style>
#snackbar {
  visibility: hidden;
  min-width: 250px;
  margin-left: -125px;
  background-color: #1E90FF;
  color: #fff;
  text-align: right;
  border-radius: 2px;
  padding: 16px;
  position: fixed;
  z-index: 1;
  left: 80%;
  bottom: 30px;
  font-size: 17px;
}

#snackbar.show {
  visibility: visible;
  -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
  animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@-webkit-keyframes fadein {
  from {bottom: 0; opacity: 0;} 
  to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
  from {bottom: 0; opacity: 0;}
  to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
  from {bottom: 30px; opacity: 1;} 
  to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
  from {bottom: 30px; opacity: 1;}
  to {bottom: 0; opacity: 0;}
}

</style>

<body class="nav-md">


<div class="container body">

<div class="main_container">

<div class="col-md-3 left_col">

<?php include('RootMe/sidebar.php');?>

<?php include('RootMe/header.php');?>


<!-- page content -->

<div class="right_col" role="main">

<div class="row" style="background-color: white;">


<section class="add_sub_agent" id="table_sub_agent">

<div class="container">

<div class="" style="margin-top:10px;">

<!-- page content -->

<div class="">

<div class="page-title">

<div class="title_left">
            
       <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
              
            Employe List View

            <br><br>
   

</div>
</div>
<a href="employe_signwork.php" id="subuser" class="btn btn-success" style="float: right;margin-top: -62px;">Add Employee Assgin Work </a>

<a href="#" class="btn btn-info pull-right" style="margin-top: -62px;margin-right: 216px;" onClick="checkboxes();"> Send SMS To Selected </a>

<div class="clearfix"></div>

<h3 style="margin-left: 15px;">Assign Work Employee List View</h3>



<div class="row">

<div class="col-md-12 col-sm-12 col-xs-12">

<div class="x_panel">

<div class="x_content">


<form action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php"
 method="post"

  enctype="multipart/form-data" class="form-horizontal form-label-left" >

<?php

$month;

if(!isset($_GET['sID'])){?>

<input type="hidden" name="action" value="add_signwork" />

<?php $month=date("m");}else {

$query="select * from eduportal_assignwork_employe where id =".$_GET['sID'];

$cvdata = $m->query($query);

$month=$cvdata[0]['month'];

?>

<input type="hidden" name="action" value="update_signwork" />

<input type="hidden" name="id"  value="<?php echo $_GET['sID'];?>">

<?php } ?>        


<br><br>

</form>

<!-- table Section Start -->

<!-- Popup Modal Code Section Start -->




<!-- Popup Modal Code Section End -->



<?php

$month;

if(!isset($_GET['sID'])){?>

<input type="hidden" name="action" value="add_signwork" />

<?php $month=date("m");}else {

 $branchID=$_SESSION['branch'];

 $sql = " select * from  eduportal_assignwork_employe where id='$sID' ";

$cvdata = $m->query($query);

$month=$cvdata[0]['month'];

?>

<input type="hidden" name="action" value="update_sigwork" />

<input type="hidden" name="id"  value="<?php echo $_GET['sID'];?>">

<?php } ?>  


<form class="form-style-7" action="listview_employe_signwork.php" method="Get">
      
              
              <div class="col-md-3 col-sm-12 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Employee</label>
                    <select name="emp_id" id="emp_id" class="form-control"  style="height:40px;">
                      <option value="All">All</option>
                              
                       <?php
                  $branchID=$_SESSION['branch'];
                $query="select * from edu_user_config where branch_id='$branchID' and status='0'";
                $WorkAssignList = $m->query($query);
                foreach($WorkAssignList as $WorkAssignListVal)
                { ?>

                   <option <?php if($_REQUEST['designation']==$WorkAssignListVal['user_id']){echo "selected";} ?>  value="<?php echo $WorkAssignListVal['user_id']; ?>"><?php echo $WorkAssignListVal['user_fname']; ?></option>


                <?php } ?>

                    </select>
                </div>
              </div>


               <div class="col-md-3 col-sm-12 col-xs-12" style="padding: 8px;">
                <label>Status</label>
                <select class="form-control" name="change_status">
                        <option value="All">All</option>
                        <option value="Completed">Completed</option>
                        <option value="Uncompleted">Uncompleted</option>

                 </select>
              </div>


              

              <div class="col-md-3 col-sm-12 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                <label class="required">Due Date</label>

                <input type="date" name="due_date" value="" class="form-control" >
                
                </div>
              </div>
 

              <div class="col-md-2 " style="padding:2px;">
    
        
                <div class="form-group ">
                   
                <button id="month"  type="submit" class="btn btn-primary" style="margin-top: 29px;">Search</button>


                
                </div>
              
        
              </div>
             
</form>      


<table id="datatable" class="table table-striped table-bordered"style="background-color: white;">

<thead>

<tr>

<th>S.No</th>

<th style="width:27%;">Title </th>

<th>Date </th>

<th>Assign Work</th>

<th>Status</th>

<th>Action</th>

<th width="5%">

<label class="container1"><input  type="checkbox" id="checkAll"/><span style="margin-top: -20%;border: 1px solid gray;" class="checkmark" ></span></label>

 </th>


</tr>

</thead>

<tbody>

<?php  $count=1;

 $branch_id=$_SESSION['branch'];
 
 $sql = " select * from eduportal_assignwork_employe where branch_id='$branch'";

  if(isset($_REQUEST['emp_id'])){

  if($_REQUEST['emp_id']=="All"){
      $sql;
    } else {
    $sql .= " AND employe = '" .$_REQUEST['emp_id']. "' ";

    }

  if($_REQUEST['change_status']=="All"){
      $sql;

    } else {

    $sql .= " AND status = '" .$_REQUEST['change_status']. "' ";

    } 

    $sql .= " AND due_date = '" .$_REQUEST['due_date']. "' ";

  }

   $CVs =  $m->query ($sql); 

$date= date("Y-m-d");

foreach($CVs as $CV){

$m->where("user_id", $CV['employe']);

$empName=$m->get("edu_user_config");

// print_r($sql);

?>


<tr>

<td style="text-align:center;"><?php echo $count; $count++;?></td>

<td style="width: 15%"><?php echo $CV['title'];?></td>

<td><?php echo date("d-M-Y",strtotime($CV['due_date']));?></td>

<td><?php echo $empName[0]['user_fname'];?></td>

<td><?php 

if ($CV['status']=='0') { ?>
  
  <a style="padding: 0px 5px; font-size:14px;"  href="#" style="cursor:pointer;"  class="btn btn-danger">Uncomplete </a>

<?php } else { ?>

<a style="padding: 0px 5px; font-size:14px;"  href="#" style="cursor:pointer;"  class="btn btn-success">Completed </a>

<?php } ?>

</td>


<td>

<a style="float: left;padding: 0px 5px; font-size:14px;" data-toggle="modal" data-target="#listView<?php echo $CV['employe'];?>" class="btn btn-info" > List View</a>




  <!-- Modal -->

  <div class="modal fade" id="listView<?php echo $CV['employe'];?>" role="dialog">

  
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">  Work Assign (<?php echo $empName[0]['user_fname'];?>)   </h4>
        </div>


        <div class="modal-body">

       
              <div class="col-md-6" style="float:left;" >
                    <div class="form-group" >
                      
                      <label>  Title </label>
                   
                      <input style="height:40px;padding-left:1%;" type="text"   value="<?php echo $CV['title']; ?>" required  class="form-control field" id="" />
                    </div>
           </div>

 
           <div class="col-md-6" style="float:left;">
                <div class="form-group" >
                  
                  <label>  Due Date </label>
                    <input style="height:40px;padding-left:1%;" type="date" name="again_paid_date"  value="<?php echo $CV['due_date']; ?>" required  class="form-control field" id="" />
                </div>
            </div>


            <div class="col-md-12">
                <div class="form-group" >
                  
                  <label>  Description </label>
                    <textarea class="form-control field" rows="6" ><?php echo $CV['discription'];?></textarea>
                    
                </div>
            </div>


            <div class="col-md-12">
            <a class="btn btn-success" target="_blank" href="https://aqibmajeed.com/EduPortal_V2/Production/Sign_Work/<?php echo $CV['attachment'];?>" download>Download file</a>
            </div>

      </div>
   

            <div class="modal-footer">

              <button type="submit" class="btn btn-primary" name="submit" >Save </button>
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


            </div>


          </div>

        </div>
      </div>
 
      <!-- ending -->




<a style="float: left;padding: 0px 5px; font-size:14px;"  data-toggle="modal" data-target="#changeStatus<?php echo $CV['employe'];?>" class="btn btn-warning" > Change Status</a>



<!-- Modal -->

  <div class="modal fade" id="changeStatus<?php echo $CV['employe'];?>" role="dialog">

  
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">  Change Work Status (<?php echo $empName[0]['user_fname'];?>)   </h4>
        </div>

        <form action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php"
 method="post">

        <input type="hidden" name="action" value="changeAssignWorkStatus">
        <input type="hidden" name="emp_id" value="<?php echo $CV['employe'];?>">
        <input type="hidden" name="id" value="<?php echo $CV['id'];?>">
        <div class="modal-body">

       
              <div class="col-md-12" style="float:left;" >
                    <div class="form-group" >
                      
                      <label>  Change Status </label>

                      <select class="form-control" name="change_status">

                        <option value="1">Completed</option>
                        <option value="0">Uncompleted</option>

                      </select>
                                         
                    </div>
           </div>

 
      </div>
    

            <div class="modal-footer">

              <button type="submit" class="btn btn-primary" name="submit" >Save </button>
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


            </div>

</form>
          </div>

        </div>
      </div>
 
      <!-- ending -->


<a style="padding: 0px 5px; font-size:14px;"  data-toggle="modal" data-target="#EditEmployeeWork<?php echo $CV['employe'];?>"  class="btn btn-success"> <i class="fa fa-pencil" aria-hidden="true"></i></a> 


<!-- Modal -->

  <div class="modal fade" id="EditEmployeeWork<?php echo $CV['employe'];?>" role="dialog">

  
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">  Update Work Assign (<?php echo $empName[0]['user_fname'];?>)   </h4>
        </div>

        <form action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php"
        method="post">

        <input type="hidden" name="action" value="UpdateAssignWork">
        <input type="hidden" name="emp_id" value="<?php echo $CV['employe'];?>">
        <input type="hidden" name="id" value="<?php echo $CV['id'];?>">
        <div class="modal-body">

       
              <div class="col-md-6" style="float:left;" >
                    <div class="form-group" >
                      
                      <label>  Title </label>
                   
                      <input style="height:40px;padding-left:1%;" type="text"   value="<?php echo $CV['title']; ?>" name="title"  class="form-control field" id="" />
                    </div>
           </div>

 
           <div class="col-md-6" style="float:left;">
                <div class="form-group" >
                  
                  <label>  Due Date </label>
                    <input style="height:40px;padding-left:1%;" type="date" name="due_date"  value="<?php echo $CV['due_date']; ?>"   class="form-control field" id="" />
                </div>
            </div>


            <div class="col-md-12">
                <div class="form-group" >
                  
                  <label>  Description </label>
                    <textarea class="form-control field" name="discription" rows="6" ><?php echo $CV['discription'];?></textarea>
                    
                </div>
            </div>
     

      </div>
   

            <div class="modal-footer">

              <button type="submit" class="btn btn-primary" name="submit" >Update </button>
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>


            </div>
            </form>

          </div>

        </div>
      </div>
 
      <!-- ending -->


<a href="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php?id=<?php echo $CV['id'];?>&emp_id=<?php echo $CV['employe'];?>&action=DeleteAssignWork" style="padding: 0px 5px; font-size:14px;" onClick="return confirm('Are you sure you want to delete this record ?');"  class="btn btn-danger"><i class="fa fa-remove"></i> </a>

</td>


<td style="padding: 2px;">
      <label class="container1">
  <input type="checkbox"  name="students[]" value="<?php echo $empName[0]['user_id'].",".$empName[0]['cell_no'];?>"><span style="border: 1px solid gray;" class="checkmark"></span>
      </label>

</td>

</tr>

<?php } ?>


</tbody>

</table>

<!-- table Section End -->


</div>
</div>
</div>
</div>


</div>
</div>
</div>

<div class="clearfix"></div>

</section>



</div>
</div>

</div>
</div>
</div>

<!-- /page content -->

<?php include('RootMe/js_linksscript.php');?>


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/css/bootstrap-select.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/js/bootstrap-select.min.js"></script>


<script src="autosearch_select/select2.min.js"></script>
<script src="https://cdn.ckeditor.com/4.12.1/standard/ckeditor.js"></script>

<script>

$('select').selectpicker();
  
</script>

</body>

</html>

<script>



function toastFunction() {

  var x = document.getElementById("snackbar");

  x.className = "show";

  setTimeout(function(){ x.className = x.className.replace("show", "");

   }, 3000);

}

$(document).ready(function () {
  $("#test").CreateMultiCheckBox({ width: '230px',
    defaultText : 'Select Below', height:'250px' });
});

  $("#checkAll").change(function () {

      $("input:checkbox").prop('checked', $(this).prop("checked"));
  });

</script>