MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.218.38.67
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/naturewoodfloor.in/../tmp/../kediapaper.com/../shsindia.com/crm/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/naturewoodfloor.in/../tmp/../kediapaper.com/../shsindia.com/crm/edit-shift.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(isset($_POST['add_shift'])) {
    date_default_timezone_set('Asia/Kolkata');
    $id=$_POST['id'];
    $shift_time = $_POST['shift_time'];
    $shift_end = $_POST['shift_end'];
    $shift_status = $_POST['shift_status'];
    $shift_hours = $_POST['shift_hours'];
    
    $sql = "UPDATE `tbl_shift` SET `shift_time`='$shift_time',`shift_end`='$shift_end',`shift_hours`='$shift_hours',`shift_status`='$shift_status' WHERE `shift_id`=$id";
    
    $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 ('','','Shift Update','Shift','".$_SESSION['user']['id']."','".$_SESSION['user']['user_type']."','$currentDate')");
    
    if($result){
        echo ("<script>
        window.alert('Successfully Update');
        window.location.href='manage-shifts.php';
        </script>");
        mysqli_close($db);
    } else {
        echo "Error";
    }
}
?>
<!DOCTYPE html>
<html lang="en">
    
<head>
    <?php include "top-links.php";?>
</head>

    <body>
        <!-- Begin page -->
        <div class="wrapper">

            <?php include "header.php";?>

            <?php include "sidebar.php";?>
            
              <div class="content-page">
                <div class="content">

                    <!-- Start Content-->
                    
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-12">
                                <div class="card">
                                    <div class="card-header">
                                        <h4 class="header-title mb-0"> Edit Shift</h4>
                                    </div>
                                    <div class="card-body">
                                        <?php
                                            $id=$_GET['id'];
                                            $sql = "SELECT * FROM `tbl_shift` WHERE shift_id=$id";
                                            $run = mysqli_query($db, $sql) or die("Query Not run");
                                            $data = mysqli_fetch_assoc($run);
                                        ?>
                                        <form action="<?php $_PHP_SELF?>" method="POST" enctype="multipart/form-data">
                                            <div id="basicwizard">
                                                <div class=" b-0 mb-0">
                                                    <div >
                                                        <div class="row">
                                                            <div class="col-md-6 mb-3">
                                                               <label class="" for="userName">Shift Start Time</label>
                                                                <div>
                                                                    <input type="time" class="form-control" id="userName" name="shift_time" value="<?= $data['shift_time'];?>">
                                                                    <input type="hidden" class="form-control" id="userName" name="id" value="<?= $id?>">
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6 mb-3">
                                                               <label class="" for="userName">Shift End Time</label>
                                                                <div>
                                                                    <input type="time" class="form-control" id="userName" name="shift_end" value="<?= $data['shift_end'];?>">
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6 mb-3">
                                                               <label class="" for="userName">Total Hours</label>
                                                                <div>
                                                                    <input type="text" class="form-control" id="userName" name="shift_hours" value="<?= $data['shift_hours'];?>">
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6 mb-3">
                                                                <label class="" for="shift_status">Shift Status</label>
                                                                <select class="form-select" id="example-select" name="shift_status">
                                                                    <option value="Active" <?php if ($data['shift_status'] == "Active") echo " selected"; ?>>Active</option>
                                                                    <option value="Inactive" <?php if ($data['shift_status'] == "Inactive") echo " selected"; ?>>Inactive</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <ul class="list-inline wizard mb-0">
                                                            <li class="next list-inline-item float-end">
                                                                <button class="btn btn-info" name="add_shift">Submit <i class="ri-arrow-right-line ms-1"></i></button>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div> 
                                            </div> 
                                        </form>
                                    </div> 
                                </div> 
                            </div>
                        </div> 
                    </div>
                    </div>
                    </div>
        </div>
        
        <?php include "footer.php";?>
        
    </body>

</html> 

MMCT - 2023