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

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Admin : Add Holiday</title>
    <?php include("headerlink.php")?>
    <link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.min.css">
</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">
      
        <div class="preloader flex-column justify-content-center align-items-center">
            <img class="animation__shake" src="dist/img/AdminLTELogo.png" alt="AdminLTELogo" height="60" width="60">
        </div>

        <?php include("navbar.php")?>

        <?php include("sidebar.php")?>

        <div class="content-wrapper">
            <div class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                        <div class="col-sm-6">
                            <h1 class="m-0 text-uppercase" style="font-weight:bold">Add Holiday</h1>
                        </div>
                        <div class="col-sm-6">
                            <ol class="breadcrumb float-sm-right">
                                <li class="breadcrumb-item"><a href="#">Home</a></li>
                                <li class="breadcrumb-item active">Add Holiday</li>

                            </ol>
                        </div>
                    </div>
                </div>
            </div>
            <section class="content">
                <div class="container-fluid">
                    <div class="row">

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

                            <div class="card shadow">
                                <div class="card-header" style="background: #343a40;">
                                    <h3 class="card-title  text-white fw-bold">Add Holiday</h3>
                                </div>

                                <form method="POST" action="holiday_code.php">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-lg-3  col-sm-12">
                                                <div class="form-group">
                                                    <label for="exampleInputtitle">Holiday From</label>
                                                    <input type="date" class="form-control" id="exampleInputtitle"
                                                        placeholder="Date" name="holiday_from">
                                                </div>
                                            </div>
                                            <div class="col-lg-3 col-sm-12">
                                                <div class="form-group">
                                                    <label for="exampleInputtitle">Holiday To</label>
                                                    <input type="date" class="form-control" id="exampleInputtitle"
                                                        placeholder="Date" name="holiday_to">
                                                </div>
                                            </div>
                                            <div class="col-lg-4 col-sm-12">
                                                <div class="form-group">
                                                    <label for="exampleInputtitle">Title</label>
                                                    <input type="text" class="form-control" id="exampleInputtitle"
                                                        placeholder="Occasion" name="title">
                                                </div>
                                            </div>

                                            <div class="col-lg-2 col-sm-12">
                                                <button class="btn btn-dark mt-4 fw-bold">Submit</button>
                                            </div>


                                        </div>
                                    </div>

                                </form>
                            </div>


                        </div>

                    </div>

                </div>
            </section>

            <section class="content">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-12">
                            <div class="card shadow">
                                <div class="card-header" style="background: #343a40;">
                                    <h3 class="card-title text-white text-bold text-uppercase">All
                                        Show Data </h3>
                                </div>

                                <div class="card-body">
                                    <div id="example2_wrapper" class="dataTables_wrapper dt-bootstrap4">
                                        <div class="row">
                                            <div class="col-sm-12 col-md-6"></div>
                                            <div class="col-sm-12 col-md-6"></div>
                                        </div>
                                        <div class="row">
                                            <div class="col-sm-12">
                                                <table class="table-responsive">
                                                    <table id="example2"
                                                        class="table table-bordered table-hover dataTable dtr-inline display"
                                                        aria-describedby="example2_info">
                                                        <thead>
                                                            <tr>
                                                                <th>Datetime</th>
                                                                <th>Title</th>
                                                                <th>From</th>
                                                                <th>To</th>

                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php 
                                                                include('connection.php');
                                                                $query = "SELECT * FROM add_holiday"; 
                                                                $result = mysqli_query($conn, $query);
                                                                while ($row = mysqli_fetch_assoc($result)) {
                                                                ?>
                                                            <tr>
                                                                <td><?php echo $row['datetime']?></td>
                                                                <td><?php echo $row['title']?></td>
                                                                <td><?php echo $row['holiday_to']?></td>
                                                                <td><?php echo $row['holiday_from']?></td>
                                                            </tr>
                                                            <?php }?>


                                                        </tbody>

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

                                    </div>
                                </div>

                            </div>

                        </div>

                    </div>

                </div>

            </section>


        </div>

        <?php include("footer.php")?>


    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
    <script>
    $(document).ready(function() {
        <?php if (isset($_GET['error'])) { ?>
        Swal.fire({
            title: 'Error',
            text: '<?php echo $_GET['error']; ?>',
            icon: 'error',
            confirmButtonText: 'OK',
            confirmButtonClass: 'btn btn-success btn-lg',
        });
        <?php } ?>
        <?php if (isset($_GET['success'])) { ?>
        Swal.fire({
            title: 'Success',
            text: '<?php echo $_GET['success']; ?>',
            icon: 'success',
            confirmButtonText: 'OK',
            confirmButtonClass: 'btn btn-success btn-lg',
        });
        <?php } ?>
    });
    </script>
    <script>
    var $j = jQuery.noConflict();
    $j(document).ready(function() {
        $j('#example2').DataTable();
    });
    </script>

    <?php include("footerlink.php")?>
</body>

</html>