</div>


</main>
<!--end main wrapper-->

<?php
    $successMessage = $this->session->flashdata('successmessage');
    $warningmessage = $this->session->flashdata('warningmessage');
    $errormessage = $this->session->flashdata('errormessage');
?>
<?php if (!empty($successMessage) || !empty($warningmessage) || !empty($errormessage)): ?>
<div class="position-fixed top-0 end-0 p-3" style="z-index: 1080; max-width: 520px;">
    <?php if (!empty($successMessage)): ?>
        <div class="alert alert-success alert-dismissible fade show shadow-sm mb-2" role="alert" data-autoclose="true">
            <strong>Success.</strong> <?php echo htmlspecialchars($successMessage); ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>
    <?php if (!empty($warningmessage)): ?>
        <div class="alert alert-warning alert-dismissible fade show shadow-sm mb-2" role="alert" data-autoclose="true">
            <strong>Notice.</strong> <?php echo htmlspecialchars($warningmessage); ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>
    <?php if (!empty($errormessage)): ?>
        <div class="alert alert-danger alert-dismissible fade show shadow-sm mb-2" role="alert" data-autoclose="true">
            <strong>Error.</strong> <?php echo htmlspecialchars($errormessage); ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>
</div>
<?php endif; ?>


<!--start overlay-->
<div class="overlay btn-toggle"></div>
<!--end overlay-->









<!--bootstrap js-->
<script src="<?php echo base_url('assets/js/bootstrap.bundle.min.js'); ?>"></script>

<!--plugins-->
<script src="<?php echo base_url('assets/js/jquery.min.js'); ?>"></script>
<!--plugins-->
<script src="<?php echo base_url('assets/plugins/perfect-scrollbar/js/perfect-scrollbar.js'); ?>"></script>
<script src="<?php echo base_url('assets/plugins/metismenu/metisMenu.min.js'); ?>"></script>

<script src="<?php echo base_url('assets/js/index2.js'); ?>"></script>
<script src="<?php echo base_url('assets/js/main.js'); ?>"></script>

<!-- appax chart -->

<!-- moment js -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<!-- data rane picker -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>

<script>
(function () {
    try {
        var nodes = document.querySelectorAll('.alert[data-autoclose="true"]');
        if (!nodes || !nodes.length) return;
        setTimeout(function () {
            nodes.forEach(function (node) {
                try {
                    var a = bootstrap.Alert.getOrCreateInstance(node);
                    a.close();
                } catch (e) {
                    node.remove();
                }
            });
        }, 3500);
    } catch (e) {}
})();
</script>

<script>
var pathname = window.location.pathname;
console.log(pathname); //
if (pathname == "/cannabus/dashboard") {
    console.log("yes");
    var settings = {
        "url": "http://137.184.111.69/cannabus/dashboard/dashobaordinfo",
        "method": "GET",
        "timeout": 0,
    };

    $.ajax(settings).done(function(response) {
        console.log(response);
        const obj = JSON.parse(response);
        $("#totalbooking").text(obj.bookingcomplete);
        $("#totalsale").text(obj.totalsale);
        $("#totalproductsale").text(obj.noofsale);
        $("#retailsale").text(obj.reatailsale);





    });
}
</script>

<script>

  $("#promotion-form").submit(function(e){

    // getting all data from form

    var title = $("#title").val();
    var startdate = $("#startdate").val();
    var enddate = $("#enddate").val();
    var amount = $("#amount").val();
    var noofrides = $("#noofrides").val();
    var message = $("#message").val();

    // getting table body 

    var tableBody=$(".promotion-form-table-body");

    // checking if any field is null or not?

    if(title=="")
    {
      document.getElementById('title').style.border='2px solid red';
    }else{
      document.getElementById('title').style.border='2px solid #ccd0d5';
    }

    if(startdate=="")
    {
      document.getElementById('startdate').style.border='2px solid red';
    }else{
      document.getElementById('startdate').style.border='2px solid #ccd0d5';
    }

    if(enddate=="")
    {
      document.getElementById('enddate').style.border='2px solid red';
    }else{
      document.getElementById('enddate').style.border='2px solid #ccd0d5';
    }

    if(amount=="")
    {
      document.getElementById('amount').style.border='2px solid red';
    }else{
      document.getElementById('amount').style.border='2px solid #ccd0d5';
    }

    if(noofrides=="")
    {
      document.getElementById('noofrides').style.border='2px solid red';
    }else{
      document.getElementById('noofrides').style.border='2px solid #ccd0d5';
    }

    if(message=="")
    {
      document.getElementById('message').style.border='2px solid red';
    }else{
      document.getElementById('message').style.border='2px solid #ccd0d5';
    }

    // setting data into the table
    if(title!=="" && startdate!=="" && enddate!=="" && amount!=="" && noofrides!=="" && message!=="")
    {
      $('#promotion-form').submit();
    } else {
          e.preventDefault();
    }

  })


</script>

</body>


</html>