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

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Admin : Add Assets</title>
    <?php include("headerlink.php")?>
</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 fw-bold text-uppercase">Assets</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">Inventory</li>
                                <li class="breadcrumb-item active">Assets</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 fw-bold text-white text-uppercase">Add Assets</h3>
                                </div>

                                <form action="assets_code.php" method="POST">
                                    <div class="card-body">

                                        <div class="row ">

                                            <div class="col-lg-6 col-sm-12">
                                                <div class="form-group">
                                                    <label for="exampleInputtitle">Title</label>
                                                    <input type="text" class="form-control"
                                                        placeholder="Enter Title here.." name="title">
                                                </div>
                                            </div>
                                            <div class="col-lg-6 col-sm-12">
                                                <div class="form-group">
                                                    <label for="exampleInputtitle">Discription</label>

                                                    <textarea name="discription"
                                                        placeholder="Enter your discription here..."
                                                        class="form-control" id="" rows="1"></textarea>
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-5 col-sm-12">
                                                    <div class="form-group">
                                                        <label for="exampleInputtitle">Date</label>
                                                        <input type="Date" class="form-control" placeholder="Date"
                                                            name="date">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6 col-sm-12">
                                                    <div class="form-group">
                                                        <label for="exampleInputtitle">Quantity</label>
                                                        <input type="text" class="form-control" placeholder="Quantity"
                                                            name="qty">
                                                    </div>
                                                </div>

                                                <div class="col-lg-1 col-sm-12" style="margin-top: 23px;">
                                                    <button class="btn  mt-2 text-white fw-bold"
                                                        style="background: #343a40;">Submit</button>
                                                </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 Assets</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>Sr No.</th>
                                                                <th>Discription</th>
                                                                <th>Date &amp; Time</th>
                                                                <th>Quantity</th>
                                                                <th>Date</th>
                                                                <th>Title</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php
                                                                include('connection.php');
                                                                $sql = "SELECT * FROM add_assets";
                                                                $query = mysqli_query($conn, $sql);
                                                                while ($row = mysqli_fetch_assoc($query)) {
                                                                ?>
                                                            <tr>
                                                                <td><?php echo $row['id'];?></td>
                                                                <td><?php echo $row['discription'];?></td>
                                                                <td><?php echo $row['datetime']?></td>
                                                                <td><?php echo $row['quantity']?></td>
                                                                <td><?php echo $row['date']?></td>
                                                                <td><?php echo $row['title']?></td>
                                                            </tr>
                                                            <?php }?>
                                                        </tbody>

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

                                    </div>
                                </div>

                            </div>

                        </div>

                    </div>

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

    <script src="https://code.jquery.com/jquery-3.6.0.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>

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

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

</html>