<?php
$admin = $_SESSION["admin_" . $dbname];
$spltype = $_SESSION["spltype_" . $dbname];
if ($spltype == "") {
    $bordcolr = "background-color: #4CAF50";
} else {
    $bordcolr = "background-color: #809FD9";
}
?>

<!-- FOR SAVE AND UPDATE ALERT --> 
<div id="submit" class="modal fade" style="cursor: not-allowed;pointer-events: none;">
    <br><br><br><br>
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header" style="<?php echo $bordcolr; ?>">
<!--            <div class="modal-header" style="background-color: #A2B229;">    -->
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="cursor: pointer; pointer-events: auto;width: 25px; height: 25px;">&times;</button>
                <h4 class="modal-title" ></h4>
            </div>
            <div class="modal-body">
                <?php if ($addflag == 1) { ?><br>
                    <b style="font-size: 18px; padding-left: 110px;">Record Added Successfully</b>
                <?php } else { ?><br>
                    <b style="font-size: 18px; padding-left: 110px;">Record Updated Successfully</b>
                <?php } ?>                
            </div>
            <div class="modal-footer">
                <?php if ($addflag == 1) { ?><br>
                    <button onclick="window.location.href = '<?php echo "$file?mode=last"; ?>'" class="btn btn-primary" style="cursor: pointer; pointer-events: auto;">OK</button>
                <?php } else { ?><br>
                    <button onclick="javascript:window.close()" class="btn btn-primary" style="cursor: pointer; pointer-events: auto;">OK</button>
                <?php } ?> 
            </div>
        </div>
    </div> 
</div>

<!-- FOR DELETE ALERT -->
<div id="delete" class="modal fade del" style="cursor: not-allowed; pointer-events: none; ">
    <br><br><br><br>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header" style="<?php echo $bordcolr; ?>">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="cursor: pointer; pointer-events: auto; width: 25px; height: 25px;">&times;</button>
                <h4 class="modal-title" ></h4>
            </div>
            <div class="modal-body">
                <br>
                <b style="font-size: 18px; padding-left: 110px;">Do You Want to Delete this Record ?</b>
            </div>
            <div class="modal-footer">
                <button onclick="window.location.href = '?delete&<?= $keyfld . "=" . $qvouch ?>'" style="cursor: pointer; pointer-events: auto;" data-toggle="modal" data-target=".delsuc" class="btn btn-primary">Yes</button>
                <button onclick="javascript:window.close()" class="btn " style="cursor: pointer; pointer-events: auto;">No</button>
            </div>            
        </div>
    </div> 
</div>
<!-- -->


<!-- Buttons-->
<style>
    .sbtn{
        background-color:#00834C;
    }
    .cbtn{
        background-color:#39CCCC;
    }
    .mybtn{
        width: 40px; height: 34px;
    }
</style>

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

    <a style=" background-color:#b38a6c; color:#ffffff; display: <? Echo $pdisabled ?>"  id="previous" title="Previous" class="btn mybtn btn-labeled btn-default btn-form" onClick="window.location.href = '<?= $file . "?mode=edit&$keyfld=$prevvouch" ?>'" >
        <span class="btn-label"><i class="glyphicon glyphicon-chevron-left"></i></span> </a>    

    <a style=" background-color:#f89693; color:#ffffff;display: <? Echo $ndisabled ?> " id="next" title="Next" class="btn mybtn btn-labeled btn-default btn-form" onClick="window.location.href = '<?= $file . "?mode=edit&$keyfld=$nextvouch" ?>'" >
        <span class="btn-label"><i class="glyphicon glyphicon-chevron-right"></i></span> </a>     

    <a style=" background-color:#B19CD9; color:#ffffff; display: <? Echo $searchdisabled ?>"  id="search" title="Search" class="btn mybtn btn-labeled btn-default btn-form" data-toggle="modal" data-target=".slacker-modal">
        <span class="btn-label"><i class="glyphicon glyphicon-search"></i></span> </a>

    <a style=" display: <? Echo $printdisabled ?>" id="print" title="Print this Record" class="btn mybtn btn-labeled btn-info btn-form" onclick="window.open('<?= $printfile ?>?vouchno=<?= $qvouch; ?>', 'popUponclickWindow', 'height=600,width=970,left=20,top=20, resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');">
        <span class="btn-label"><i class="glyphicon glyphicon-file"></i></span> </a>     

    <a style=" background-color:#C0CA33; display: <? Echo $adddisabled ?>" id="add" title="Add" class="btn mybtn btn-labeled btn-success btn-form" onclick="window.location.href = '<?= $file . "?mode=true" ?>'">
        <span class="btn-label"><i class="glyphicon glyphicon-plus"></i></span> </a>     
    <?php if ($admin == 1) { ?>   

        <a style=" display: <? Echo $editdisabled ?>"  id="edit" title="Edit this Record" class="btn mybtn btn-labeled btn-warning btn-form" >
            <span class="btn-label"><i class="glyphicon glyphicon-pencil"></i></span> </a>      

        <a style=" display: <? Echo $deletedisabled ?>"  id="delete" title="Delete this Record" class="btn mybtn btn-labeled btn-danger btn-form" data-toggle="modal" data-target="#delete">
            <span class="btn-label"><i class="glyphicon glyphicon-trash"></i></span> </a>
    <?php } ?>       

    <a style=" background-color:#CA195A; color:#ffffff; display: <? Echo $deletedisabled ?>" id="exit" name='exit' title="Close Form" class="btn mybtn btn-labeled btn-danger btn-form" onclick="window.location.href = 'default.php'" >
        <span class="btn-label"><i class="glyphicon glyphicon-off"></i></span> </a>     
    
    <button style=" display: <? Echo $savedisabled ?>" title="Save this Record" id="submit" type='submit' name='submit'  class="btn mybtn btn-labeled btn-primary btn-form sbtn" >
        <span class="btn-label"><i class="glyphicon glyphicon-ok"></i></span> </button>

    <a style="  display: <? Echo $canceldisabled ?>" id="cancel" name='exit' class="btn mybtn btn-labeled btn-danger btn-form cbtn" onclick="window.location.href = '<?= $file . "?mode=last" ?>'" >
        <span class="btn-label"><i class="glyphicon glyphicon-remove"></i></span> </a> 

    

</div>
<!--<script>
    $(document).ready(function () {
        $("#exit").click(function (e) {
            $("body").toggle();
            e.stopPropagation();
        });

        $(document).click(function (e) {
            if (!$(e.target).is('body, body *')) {
                $("body").hide();
            }
        });
    });
</script>-->