<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
<head>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Rizwan </title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="<?php echo base_url();?>assets/images/favicon.png">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/css/style.css">
    <!-- Pick date -->
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.date.css">
     <link href="<?php echo base_url();?>assets/vendor/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
    <!-- Custom Stylesheet -->
     

</head>

<body>

    <!--*******************
        Preloader start
    ********************-->
        <div id="preloader">
        <div class="sk-three-bounce">
            <div class="sk-child sk-bounce1"></div>
            <div class="sk-child sk-bounce2"></div>
            <div class="sk-child sk-bounce3"></div>
        </div>
    </div>
    <!--*******************
        Preloader end
    ********************-->

    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

      <?php  $this->load->view('header'); ?>
        
        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">
            <!-- row -->
            <div class="container-fluid">
                    
                <div class="row page-titles mx-0">
                    <div class="col-sm-6 p-md-0">
                        <div class="welcome-text">
                            <h4>Employee</h4>
                        </div>
                    </div>
                    <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                            <li class="breadcrumb-item active"><a href="javascript:void(0);">Employees</a></li>
                            <li class="breadcrumb-item active"><a href="javascript:void(0);">Add Employees</a></li>
                        </ol>
                    </div>
                </div>
                
                <div class="row">


                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
           
                                <div class="col-xl-12 col-xxl-12 col-sm-12">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title">Edit Employees</h5>
                                    </div>
                                    <div class="card-body">
                       <?php echo form_open(base_url(''),array('class'=>"form-horizontal edit_empolyee", 'id'=>"edit_empolyee")); ?>   

                      <?php if($this->session->flashdata('empolyee_success')){ ?>
                            <div class="alert alert-success solid" style='text-align:center;'><?php echo $this->session->flashdata('empolyee_success'); ?></div>
                        <?php } ?>

                         <div id='empolyee_success' class='alert alert-success solid' style='display:none;'></div>
                <div class="row">
                    <input type="hidden" name="user_id" id="user_id" value="<?php echo $this->session->userdata('id');?>">
                     <div class="col-lg-6 col-md-6 col-sm-12">
                            <div class="form-group">
                               
                                <input type="hidden" name="created" id="created" value="<?php echo date('Y-m-d H:i:s'); ?>" class="form-control required">
                            </div>
                        </div>

                        <div class="col-lg-6 col-md-6 col-sm-12">
                            <div class="form-group">
                               
                                <input type="hidden" value="<?php echo date('Y-m-d H:i:s'); ?>" name="modified" id="modified" class="form-control required">
                            </div>
                        </div>

                        <input type="hidden" value="<?php echo $this->uri->segment(3); ?>" name="id" id="id" required="required">
                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Name</label>
                            <input type="text" name="fullname" id="fullname" required="required" value="<?php echo $get_emp[0]['fullname']; ?>" placeholder="Employee Name" class="form-control">
                        </div>
                    </div>

                 


                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Phone</label>
                            <input type="number" value="<?php echo $get_emp[0]['phone']; ?>" name="phone" id="phone" required="required" placeholder="Employee Phone" class="form-control">
                        </div>
                    </div>

                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">NIC</label>
                           <input type="number"  name="nic" id="nic" placeholder="NIC #" value="<?php echo $get_emp[0]['nic']; ?>" class="form-control">
                        </div>
                    </div>


                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Department</label>
                            <select name="depart" id="depart" class="form-control" tabindex="-98">
                            <option value="<?php echo $get_emp[0]['depart']; ?>"><?php echo depart($get_emp[0]['depart']); ?></option>
                               <?php foreach ($get_depart as $value) { ?>
                         <option value="<?php echo $value['id']; ?>"><?php echo $value['depart']; ?></option>
                        <?php } ?>
                                   </select>
                        </div>
                    </div>



                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Designation</label>
                           <input type="text" value="<?php echo $get_emp[0]['designation']; ?>" name="designation" required="required" id="designation" placeholder="Designation" class="form-control">
                        </div>
                    </div>

                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Employee Salary</label>
                                <input type="number" value="<?php echo $get_emp[0]['salary']; ?>" required="required" name="salary" id="salary" placeholder="Employee Salary" class="form-control">
                        </div>
                    </div>

                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Over Time</label>
                                <input type="text" name="over_time" id="over_time" value="<?php echo $get_emp[0]['over_time']; ?>" placeholder="Employee Over Time" class="form-control " onkeypress="return isNumberKey(event)">
                        </div>
                    </div>

                     <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Tea/Petrol</label>
                                <input type="text" name="allowance" id="allowance" value="<?php echo $get_emp[0]['allowance']; ?>" placeholder="Employee Tea/Petrol" class="form-control " onkeypress="return isNumberKey(event)">
                        </div>
                    </div>

                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Tap In</label>
                                <input type="text" name="tap_in" required="required" id="tap_in" value="<?php echo $get_emp[0]['tap_in']; ?>"  class="form-control">
                        </div>
                    </div>

                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Tap Out</label>
                                <input type="text" required="required" name="tap_out" id="tap_out" value="<?php echo $get_emp[0]['tap_out']; ?>" class="form-control">
                        </div>
                    </div>
                    
                    <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">E-mail</label>
                                <input type="email" name="email" id="email" value="<?php echo $get_emp[0]['email']; ?>" placeholder="Employee E-mail" class="form-control">
                        </div>
                    </div>


                       <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Address</label>
                           <textarea name="address" id="address" required="required" class="form-control" rows="3" id="comment"><?php echo $get_emp[0]['address']; ?></textarea>
                        </div>
                    </div>

                    

                     <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Comments</label>
                           <textarea name="comments"  id="comments" class="form-control" rows="3" id="comment"><?php echo $get_emp[0]['comments']; ?></textarea>
                        </div>
                    </div>


                    <div class="col-lg-6 col-md-6 col-sm-12">
                            <div class="form-group">
                                <label class="form-label">Images:</label>
                                    <input type="file" id="file" value="<?php echo $get_emp[0]['image']; ?>" name='file'>

                            </div>
                        </div> 
                        
                        
                         <div class="col-lg-6 col-md-6 col-sm-12">
                        <div class="form-group">
                            <label class="form-label">Status</label>
                            <select name="status" id="status" class="form-control" tabindex="-98">
                            <option value="<?php echo $get_emp[0]['status']; ?>"><?php echo $get_emp[0]['status']; ?></option>
                               
                         <option value="0">De-Active</option>
                         <option value="1">Active</option>
                      
                                   </select>
                        </div>
                    </div>
                  
                    
                </div>
            <?php form_close(); ?>
        </div>

    </div>
     <button type="submit" class="btn btn-primary">Submit <i class="icon-arrow-right14 position-right"></i></button>
</div>

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

                    
                </div>
            </div>
        </div>
        <!--**********************************
            Content body end
        ***********************************-->


        <!--**********************************
            Footer start
        ***********************************-->
        <div class="footer">
            <div class="copyright">
                <p>Copyright © Designed &amp; Developed by > 2020</p>
            </div>
        </div>
        <!--**********************************
            Footer end
        ***********************************-->

        <!--**********************************
           Support ticket button start
        ***********************************-->

        <!--**********************************
           Support ticket button end
        ***********************************-->


    </div>

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
       
<script type="text/javascript">

    function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : evt.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
   

var empolyee = $('#edit_empolyee');   
    
    empolyee.on('submit',function(e){

        e.preventDefault();
        
         var empolyeedata = empolyee.serialize();
         
          var fullname = $("input#fullname").val();
          var phone = $("input#phone").val();
           var nic = $("#nic").val();
           var depart = $("input#depart").val();
            var designation = $("input#designation").val();
            var salary = $("input#salary").val();

            var over_time = $("input#over_time").val();
            var allowance = $("input#allowance").val();

            

            var tap_in = $("input#tap_in").val();
            var tap_out = $("input#tap_out").val();
            var email = $("email").val();
            var address = $("input#address").val();
          
            var comments = $("input#comments").val();
            //var file = $("input#file").val();
            //var  images = $("input#images").val(); 
            var user_id = $("input#user_id").val();
            var created = $("input#created").val();
            var modified = $("input#modified").val();
            var id = $('#id').val();

            //var images = new FormData($("#images")[0]);
               //var formData = new FormData(this);
            $.ajax({
             url:'<?php echo base_url('Admin/updated_get_empolyee/'); ?>'+id,
             type:"post",
             data:new FormData(this),
             processData:false,
             contentType:false,
             cache:false,
             async:false,
             dataType:'json',
             success: function(data){
            
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#empolyee_success').show().html('Empolyee Updated Successfully').hide(3000);
                       setTimeout(function(){location.href="<?php echo base_url('Admin/empolyee'); ?>"} , 3000);
                    }else{
                        console.log('third'+data);          
                    }
             }
             });
       // }
    });


function delete_data(id) { 
        var id = id;
        if (confirm('Are you sure you want to Delete.?')) {
  
         $.ajax({
                type:'POST',
                url:'<?php echo base_url('Admin/delete_empolyee/'); ?>'+id,
                data:id,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    
                        console.log('second'+data.status);
                        //debugger;
                        $('#empolyee_danger').show().html('Empolyee Deleted Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Admin/empolyee'); ?>"} , 3000);
                    
                },
                error:function(data){console.log(data.responseText);}
            });
        } 

    }


    function btnExport_monthly()
{
    
    var tab_text="<table border='2px'><tr bgcolor='#ebebeb'>";
    var textRange; var j=0;
    tab = document.getElementById('example5'); // id of table

    for(j = 0 ; j < tab.rows.length ; j++) 
    {     
        tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
        //tab_text=tab_text+"</tr>";
    }

    tab_text=tab_text+"</table>";
    tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
    tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table
    tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params


    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE "); 

    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
    {
        txtArea2.document.open("txt/html","replace");
        txtArea2.document.write(tab_text);
        txtArea2.document.close();
        txtArea2.focus(); 
        sa=txtArea2.document.execCommand("SaveAs",true,"Generation_School_Report");
    }  
    else                 //other browser not tested on IE 11
        sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));  

    return (sa);
}
</script>
    <!--**********************************
        Main wrapper end
    ***********************************-->

    <!--**********************************
        Scripts
    ***********************************-->
    <!-- Required vendors -->
   
       <?php  $this->load->view('footer'); ?>
        
</body>

<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
</html>