<?php
include 'classes/database.class.php';
include 'classes/admin.class.php';
// setcookie("gift_claimed", "yes", time() - 100000000);

// if (isset($_POST['claim_gift'])) {

//     $email = $_POST['email'];

//     $to = 'mannehills@gmail.com';
//     $subject = 'BuraSolutions Gift Claim';
//     // $message = 'Hi Jane, will you marry me?'; 
//     $from = $email;

//     // Sending email
//     if (mail($to, $subject, $message)) {
//         setcookie("gift_claimed", "yes", time() + 100000000);
//         echo '
//     <script>
//     window.location.href="./?gift_claimed";
//     </script>
//     ';
//     } else {
//         // setcookie("gift_claimed", "yes", time() + 100000000);
//         echo '
//     <script>
//     window.location.href="./?gift_not_claimed";
//     </script>
//     ';
//     }
// }



if (isset($_POST['submit'])) {
    $description = $_POST['description'];
    $fullname = $_POST['fullname'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];


    $to = 'mannehills@gmail.com';
    $subject = 'Purchase Form';

    $message = "
        Description: $description
        Full Name: $fullname 
        Phone: $phone
        Email: $email 
    "; 
    
    
    $from = $email;

    if (mail($to, $subject, $message)) {
        echo '
            <script>
            window.location.href="purchase-response?message_sent";
            </script>
            ';
    } else {
        echo '
            <script>
            window.location.href="purchase-response?message_not_sent";
            </script>
            ';
    }

}








?>
<!doctype html>
<html lang="zxx">


<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="keywords" content="" />
    <title>BuraSolutions - Products</title>
    <link href="http://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600&amp;display=swap" rel="stylesheet">
    <!-- Template CSS -->
    <link rel="stylesheet" href="assets/css/style-liberty.css?v=1">
    <link rel="stylesheet" href="assets/css/root.css">
    <!-- Bootstrap -->
    <!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous"> -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>


    <!-- Favicon -->
    <link href="assets/images/buralogo.png" rel="shortcut icon" />

    <style>
        #submit{
            background-color:#07172b;
            color:#fff;
            padding:10px 20px;
            border:none;
            border-radius:10px;
            margin-left:1.8rem;
        }

        #submit:hover{
            background-color: mediumseagreen;
        }
    </style>
</head>

<body>

    <!-- <?php
    if (!isset($_COOKIE['gift_claimed'])) {
    ?>
        <section class="gift-modal-background">
            <div class="box">
                <i class="fa fa-times-circle close-btn close-gift-modal-background"></i>
                <div class="image-container">
                    <img src="assets/images/gift2.svg" alt="" class="image">
                </div>
                <div class="title">Claim Gift!</div>
                <form action="" method="POST">
                    <div class="description">Enter your email address to claim now!</div>
                    <div class="field-container">
                        <input type="email" name="email" placeholder="Enter Email" class="field" required>
                    </div>
                    <div class="submit-btn-container">
                        <button class="submit-btn" name="claim_gift">Claim Now ></button>
                    </div>
                </form>
            </div>
        </section>
    <?php
    }
    ?> -->

    <body>
        <!-- New toolbar-->
        <style>
            * {
                box-sizing: border-box;
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
            }
        </style>

        <!--header-->
        <?php include 'header.php'; ?>
        <!--/header-->






        <!-- home page block grids -->


        <!-- home page block grids -->
        <?php
        $result = $db->setQuery("SELECT * FROM products;");
        $numrows = mysqli_num_rows($result);

        if ($numrows > 0) {
        ?>
            <section class="w3l-text-11 py-5" id="blogs">
                <div class="container py-lg-5 py-md-4 py-2">
                    <div class="header-section text-center mx-0 mb-md-5 mb-4">
                        <h6 class="title-subhny">Purchase products</h6>
                        <h3 class="title-w3l mt-2">Our Shop</h3>
                    </div>
                    <div class="row text11-content">
                        <?php
                        while ($row = mysqli_fetch_assoc($result)) {
                        ?>
                            <div class="col-md-4 item mt-lg-0 mb-5">
                                <div class="card">
                                    <div class="card-header p-0 position-relative border-0">
                                        <a href="product?i=<?php echo $row['product_id']; ?>">
                                            <img class="card-img-bottom d-block radius-image" src="product_images/<?php echo $row['image1']; ?>" alt="Card image cap">
                                        </a>
                                    </div>
                                    <div class="card-body p-0 blog-details">
                                        <h6 class="mt-4"><?php echo $row['date']; ?></h6>
                                        <a href="#admin" class="admin">- by BuraSolutions </a>
                                        <br>
                                        <a href="product?i=<?php echo $row['product_id']; ?>" class="blog-desc"><?php echo $admin->shortenLength($row['name'], 50, "..."); ?></a>

                                        <a href="product?i=<?php echo $row['product_id']; ?>" class="btn btn-style btn-primary mt-lg-4 mt-4">Purchase <span class="fa fa-arrow-right ml-2" aria-hidden="true"></span></a>
                                    </div>
                                </div>
                            </div>
                        <?php
                        }
                        ?>

                    </div>
                </div>
            </section>
        <?php
        }
        ?>
        <!-- //home page block grids -->


        <!-- PACKAGES -->
        <section class="w3l-text-11 py-5" id="blogs">
                <div class="container py-lg-5 py-md-4 py-2">
                    <div class="header-section text-center mx-0 mb-md-5 mb-4">
                        <h6 class="title-subhny">Packages</h6>
                        <h3 class="title-w3l mt-2">Our Packages</h3>
                    </div>
                    <div class="row text11-content">
                        <div class="col-md-4 item mt-lg-0 mb-5">
                            <div class="card">
                                <div class="card-header p-0 position-relative border-0">
                                    <a>
                                        <img src="assets\images\package1.jpg" alt="" style="width: 100%;" data-toggle="modal" data-target="#exampleModal">
                                    </a>
                                </div>
                                <div class="card-body p-0 blog-details">
                                    <h6 class="mt-4">28-06-2022</h6>
                                    <a class="admin">- by BuraSolutions </a>
                                    <br>
                                    <a data-toggle="modal" data-target="#exampleModal" class="blog-desc" style="margin-bottom: 2.5rem;">1.1KVA/12V Inverter and Battery Package</a>
                                    <a data-toggle="modal" data-target="#exampleModal" class="mt-lg-4 mt-4" id="purchase" style="background-color:#07172b; color:#fff; padding:20px 30px; border-radius:30px;">
                                        Purchase <span class="fa fa-arrow-right ml-2" aria-hidden="true"></span>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-4 item mt-lg-0 mb-5">
                            <div class="card">
                                <div class="card-header p-0 position-relative border-0">
                                    <a>
                                        <img src="assets\images\package3.jpg" alt="" style="width: 100%;" data-toggle="modal" data-target="#exampleModal2">
                                    </a>
                                </div>
                                <div class="card-body p-0 blog-details">
                                    <h6 class="mt-4">28-06-2022</h6>
                                    <a class="admin">- by BuraSolutions </a>
                                    <br>
                                    <a data-toggle="modal" data-target="#exampleModal2" class="blog-desc" style="margin-bottom: 2.5rem;">2.5KVA Inverter Power Backup Package</a>
                                    <a data-toggle="modal" data-target="#exampleModal2" class="mt-lg-4 mt-4" id="purchase" style="background-color:#07172b; color:#fff; padding:20px 30px; border-radius:30px;">
                                        Purchase <span class="fa fa-arrow-right ml-2" aria-hidden="true"></span>
                                    </a>                                
                                </div>
                            </div>
                        </div>

                        <div class="col-md-4 item mt-lg-0 mb-5">
                            <div class="card">
                                <div class="card-header p-0 position-relative border-0">
                                    <a>
                                        <img src="assets\images\package2.jpg" alt="" style="width: 100%;" data-toggle="modal" data-target="#exampleModal3">
                                    </a>
                                </div>
                                <div class="card-body p-0 blog-details">
                                    <h6 class="mt-4">28-06-2022</h6>
                                    <a class="admin">- by BuraSolutions </a>
                                    <br>
                                    <a data-toggle="modal" data-target="#exampleModal3" class="blog-desc" style="margin-bottom: 2.5rem;">2.5KVA Complete Solar Package</a>
                                    <a data-toggle="modal" data-target="#exampleModal3" class="mt-lg-4 mt-4" id="purchase" style="background-color:#07172b; color:#fff; padding:20px 30px; border-radius:30px;">
                                        Purchase <span class="fa fa-arrow-right ml-2" aria-hidden="true"></span>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-4 item mt-lg-0 mb-5">
                            <div class="card" style="margin-top:2rem;">
                                <div class="card-header p-0 position-relative border-0">
                                    <a>
                                        <img src="assets\images\package4.jpg" alt="" style="width: 100%;" data-toggle="modal" data-target="#exampleModal4">
                                    </a>
                                </div>
                                <div class="card-body p-0 blog-details">
                                    <h6 class="mt-4">28-06-2022</h6>
                                    <a class="admin">- by BuraSolutions </a>
                                    <br>
                                    <a data-toggle="modal" data-target="#exampleModal4" class="blog-desc" style="margin-bottom: 2.5rem;">5KVA Complete Solar Package</a>
                                    <a data-toggle="modal" data-target="#exampleModal4" class="mt-lg-4 mt-4" id="purchase" style="background-color:#07172b; color:#fff; padding:20px 30px; border-radius:30px;">
                                        Purchase <span class="fa fa-arrow-right ml-2" aria-hidden="true"></span>
                                    </a>                                
                                </div>
                            </div>
                        </div>

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


            <!-- BUY MODAL -->
            <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">1.1KVA/12V Inverter and Battery Package</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form action="" method="POST" class="purchase-form">
                                <label>Description</label>
                                <textarea name="description" rows="6" readonly>1.1KVA/12V Inverter + 12V/220Ah battery. 
Recommended loads: TV, 1 fan, bulbs, sockets, and other minor loads. Cost: 254,500NGN
N/B: This budget doesn't include cost for cables as it depends on your existing electrical wiring.
                                </textarea>
                                
                                <label>Fullname</label>
                                <input type="text" name="fullname">

                                <label>Phone</label>
                                <input type="text" name="phone">

                                <label>Email</label>
                                <input type="text" name="email">

                            </div>
                                <div class="modal-footer" style="display:flex; justify-content:left;">
                                    <input type="submit" name="submit" id="submit" value="Purchase Now">
                                </div>
                            </form>

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



            <div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">2.5KVA Inverter Power Backup Package</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form action="" method="POST" class="purchase-form">
                                <label>Description</label>
                                <textarea name="description" rows="6" readonly>2.5KVA/24V Inverter + 2*12V/220Ah battery. 
Recommended loads: Freezer, TV, fans, bulbs, sockets, and other minor loads. Cost: 430,000NGN
N/B: This budget doesn't include cables and other accessories.
                                </textarea>
                                
                                <label>Fullname</label>
                                <input type="text" name="fullname">

                                <label>Phone</label>
                                <input type="text" name="phone">

                                <label>Email</label>
                                <input type="text" name="email">

                            </div>
                                <div class="modal-footer" style="display:flex; justify-content:left;">
                                    <input type="submit" name="submit" id="submit" value="Purchase Now">
                                </div>
                            </form>

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



            <div class="modal fade" id="exampleModal3" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">2.5KVA Complete Solar Package</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form action="" method="POST" class="purchase-form">
                                <label>Description</label>
                                <textarea name="description" rows="8" readonly>2.5KVA/24V Inverter + 2 sets 12V/220Ah battery + 4 sets 300W solar panels + 24v/60A MPPT charge controller.
Recommended loads: 1 freezer, TV, fans, Bulbs, sound system, decoder,  sockets and other minor loads. Cost: 847,000NGN
Note: This budget doesn't include cost for cables as it depends on your existing electrical wiring.                               </textarea>
                                
                                <label>Fullname</label>
                                <input type="text" name="fullname">

                                <label>Phone</label>
                                <input type="text" name="phone">

                                <label>Email</label>
                                <input type="text" name="email">

                            </div>
                                <div class="modal-footer" style="display:flex; justify-content:left;">
                                    <input type="submit" name="submit" id="submit" value="Purchase Now">
                                </div>
                            </form>

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



            <div class="modal fade" id="exampleModal4" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">5KVA Complete Solar Package</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form action="" method="POST" class="purchase-form">
                                <label>Description</label>
                                <textarea name="description" rows="7" readonly>5KVA/48V Inverter + 4 sets 12V/220Ah battery + 8 sets 300W solar panels + 48V/60A MPPT charge controller.
Recommended loads: 1 dual inverter AC, 1 freezer, TV, fans, Bulbs, sockets and other minor loads. Cost: 2M
N/B: This budget doesn't include cost for cables as it depends on your existing electrical wiring.
                                </textarea>
                                
                                <label>Fullname</label>
                                <input type="text" name="fullname">

                                <label>Phone</label>
                                <input type="text" name="phone">

                                <label>Email</label>
                                <input type="text" name="email">

                            </div>
                                <div class="modal-footer" style="display:flex; justify-content:left;">
                                    <input type="submit" name="submit" id="submit" value="Purchase Now">
                                </div>
                            </form>

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














        <!-- footer-28 block -->
        <?php include 'footer.php'; ?>

        <!-- Template JavaScript -->
        <script src="assets/js/jquery-3.3.1.min.js"></script>
        <script src="assets/js/theme-change.js"></script>
        <!-- owlcarousel -->
        <!-- owl carousel -->
        <script src="assets/js/owl.carousel.js"></script>
        <!-- script for banner slider-->
        <script>
            $(document).ready(function() {
                $('.owl-one').owlCarousel({
                    loop: true,
                    margin: 0,
                    nav: true,
                    responsiveClass: true,
                    autoplay: true,
                    autoplayTimeout: 5000,
                    autoplaySpeed: 1000,
                    autoplayHoverPause: true,
                    responsive: {
                        0: {
                            items: 1
                        },
                        480: {
                            items: 1
                        },
                        667: {
                            items: 1
                        },
                        1000: {
                            items: 1
                        }
                    }
                })
            })
        </script>
        <!-- //script -->
        <!-- script for tesimonials carousel slider -->
        <script>
            $(document).ready(function() {
                $("#owl-demo2").owlCarousel({
                    loop: true,
                    nav: false,
                    margin: 50,
                    responsiveClass: true,
                    responsive: {
                        0: {
                            items: 1,
                            nav: false
                        },
                        736: {
                            items: 1,
                            nav: false
                        },
                        991: {
                            items: 2,
                            margin: 30,
                            nav: false
                        },
                        1080: {
                            items: 3,
                            nav: false
                        }
                    }
                })
            })
        </script>
        <!-- //script for tesimonials carousel slider -->
        <!-- owl carousel -->

        <!-- script for tesimonials carousel slider -->
        <script>
            $(document).ready(function() {
                $("#owl-demo2").owlCarousel({
                    loop: true,
                    margin: 20,
                    nav: false,
                    responsiveClass: true,
                    responsive: {
                        0: {
                            items: 1,
                            nav: false
                        },
                        1000: {
                            items: 1,
                            nav: false,
                            loop: false
                        }
                    }
                })
            })
        </script>
        <!-- //script for tesimonials carousel slider -->
        <!-- stats number counter-->
        <script src="assets/js/jquery.waypoints.min.js"></script>
        <script src="assets/js/jquery.countup.js"></script>
        <script>
            $('.counter').countUp();
        </script>
        <!-- //stats number counter -->
        <!--/MENU-JS-->
        <script>
            $(window).on("scroll", function() {
                var scroll = $(window).scrollTop();

                if (scroll >= 80) {
                    $("#site-header").addClass("nav-fixed");
                } else {
                    $("#site-header").removeClass("nav-fixed");
                }
            });

            //Main navigation Active Class Add Remove
            $(".navbar-toggler").on("click", function() {
                $("header").toggleClass("active");
            });
            $(document).on("ready", function() {
                if ($(window).width() > 991) {
                    $("header").removeClass("active");
                }
                $(window).on("resize", function() {
                    if ($(window).width() > 991) {
                        $("header").removeClass("active");
                    }
                });
            });
        </script>
        <!--//MENU-JS-->

        <script src="assets/js/bootstrap.min.js"></script>



        <div id="v-w3layouts"></div>
        <script>
            (function(v, d, o, ai) {
                ai = d.createElement('script');
                ai.defer = true;
                ai.async = true;
                ai.src = v.location.protocol + o;
                d.head.appendChild(ai);
            })(window, document, '../../../../../../../a.vdo.ai/core/v-w3layouts/vdo.ai.js');
        </script>

        <script>
            setTimeout(function() {
                $(".gift-modal-background").css("display", "flex");
            }, 5000)

            $(".close-gift-modal-background").click(function() {
                $(".gift-modal-background").hide()
            })
        </script>
    </body>



</html>