</div>


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


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




<!--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>
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>
