MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/matrix.imenso.co/admin/assignment_completed.php
<?php include 'admin_header.php';
error_reporting(0);
// include('../PHPExcel/Classes/PHPExcel/IOFactory.php');
if(isset($_POST['save']))
{
   if(isset($_POST['doc_no']))
    {
        $assignment_ids = $_POST['doc_no'];
        foreach($assignment_ids as $assignment_id)
        {
            
            $conn->query("UPDATE assignments SET user_id='".$_POST['operator_id']."',assignment_status_id=1 WHERE assignment_no=".$assignment_id."") ;  
        }
    }
}


?>
<div class="container" style="background: #fff;position:relative; margin-top:42px ">
    <div class="assignment-dashboard">
        <form action="download_excel.php" method="post" name="form" id="download_form">
            <input type="hidden" name="list[]" id="list" value="">
        </form>
        <?php //if(isset($_SESSION['file_error'])): ?>
            <!-- <div class="alert alert-danger" style="color: red; font-size: 14px;"> -->
              <?php
                  //echo $_SESSION['file_error'];
                  //unset($_SESSION['file_error']);
              ?>
            <!-- </div> -->
        <?php //endif ?> 
        <form action="" method="POST" >
            <div class="row">
                <div class="col-sm-8 border-right">
                    <h5 class="mt-3 mb-3">COMPLETED FOLDERS <span class="font-weight-light small text-info total_count">[0]</span><div class="pull-right">
                        <strong class="badge badge-secondary checked_count">0</strong> 
                        <a href="#" id="download_excel"><input class="btn btn-primary" type="submit" name="download" value="Download Xls" /></a>
                        </div></h5>
                     <input type="text" name="search" class="mb-3 assignment_complete"  placeholder="Search: [Folder Index/User]" id="search" style=" width: -webkit-fill-available; text-align: center;">
                    <div class="table-responsive" id="assignment_complete_table">
                        <table class="table table-striped table-sm table-bordered" >
                            <thead>
                                <tr>
                                    <th>Action</th>
                                    <th>
                                        <a href="javascript:;" class="column_sort_complete" id="assignment_no" data-order="desc"> Folder Index </a>

                                    </th>
                                    <th>
                                        <a href="javascript:;" class="column_sort_complete" id="no_of_record" data-order="desc"> Data Count</a>
                                    </th>
                                    <th>
                                        <a href="javascript:;" class="column_sort_complete" id="name" data-order="desc"> Completed By </a>
                                    </th>
                                    <th>
                                        <a href="javascript:;" class="column_sort_complete" id="assignment_date" data-order="desc"> Assigned Date </a>
                                    </th>
                                    <th> 
                                        <a href="javascript:;" class="column_sort_complete" id="submit_date" data-order="desc">Completed Date </a>
                                    </th>
                                    
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $total = 0 ;
                                $result = $conn->query("SELECT assignments.* , users.name FROM assignments inner join users on users.id = assignments.user_id WHERE assignments.assignment_status_id = 2 AND assignments.deleted=0 order by assignments.submit_date DESC");
                                while($row = $result->fetch_assoc()) {
                                $total = $total + $row['no_of_record'] ;
                                   
                                ?>
                                <tr>
                                    <td><input type="checkbox" class="chk_doc_no" name="doc_no[]" value="<?php echo $row['assignment_no'] ?>" file_count="<?php echo $row['no_of_record'] ?>"  /></td>
                                    <td><a href="show_doc.php?assignment_no=<?php echo $row['assignment_no'] ?>" target="_blank" > <?php echo $row['assignment_no'] ?></a> </td>
                                    <td> <?php echo $row['no_of_record'] ?></td>
                                    <td> <?php echo $row['name'] ?></td> 
                                    <td><?php echo date('m/d/Y ', strtotime($row['assignment_date'])) ?></td>
                                    <td><?php echo date('m/d/Y ', strtotime($row['submit_date'])) ?></td>
                                  
                                </tr>
                                <?php
                                }
                                ?> 
                            </tbody>
                            <!--<tfoot>-->
                                <!-- <tr> -->
                            <!--        <th>Action</th>-->
                            <!--        <th>Folder Index</th>-->
                            <!--        <th>Data Count</th>-->
                            <!--        <th>Completed By </th>-->
                            <!--        <th>Assigned Date</th>-->
                            <!--        <th>Completed Date</th>-->
                                
                            <!--    </tr> -->
                            <!--</tfoot>-->
                        </table>
                    </div>
                </div>
                <div class="col-sm-4">
                    <h5 class="mt-3 mb-3">RE-ASSIGN TO:</h5>
                    <?php
                    $sql = "SELECT users.* , sum(assignments.no_of_record) as no_of_pending FROM users inner join role_user on role_user.user_id = users.id left join assignments on assignments.user_id = users.id and assignments.assignment_status_id = 1  WHERE role_user.role_id IN ('2','3')  group by users.id";
                    $result = $conn->query($sql);
                    while($row = $result->fetch_assoc()) {
                        ?> 
                        <div class="card mb-3">
                            <div class="card-body">
                                <div class="card-text pull-left">
                                    <img src="../images/user.png" class="rounded-circle border mr-3" alt="Cinque Terre" width="36"> 
                                    <strong><?php echo $row["name"]; ?></strong> 
                                    <span class="badge badge-info "><?php echo  $row["no_of_pending"]; ?></span>
                                </div>
                                <div class="card-link pull-right" style="margin-top: 6px;">
                                    <input type="radio" class=""   name="operator_id" value="<?php echo $row["id"] ; ?>"  >
                              </div>
                            </div>
                        </div>
                        <?php
                    }
                    ?>
                    <div class="text-right">
                        <input class="btn btn-primary" type="submit" name="save" value="Assign" />
                    </div>
                    
                </div>
            </div>
        </form>
    </div>
</div>

<?php
?>
<script>
    $(document).ready(function(){
        
        $(".total_count").html("[<?php echo $total ?>]");
        $('input:radio[name="operator_id"]:visible:first').attr('checked','checked');
        
        
        $(".chk_doc_no").change(function() {
            var total = 0 ;
            $("input[name='doc_no[]']:checked").each(function () {
                total = total + parseInt($(this).attr("file_count"));
            });

            $(".checked_count").html(total); 
        });
        
    });

    $('#download_excel').on('click', function(e) {
        e.preventDefault(); // prevents a window.location change to the href

        var SlectedList = new Array();
        $("input.chk_doc_no:checked").each(function() {
            SlectedList.push($(this).val());
        }); 
        $("#list").val(SlectedList);
        if(SlectedList.length>0)
        {
            $('#download_form').submit();
        }
        
    });    
    
</script>
<?php 

$conn->close();


//include 'admin_footer.php';
?>