
<div class="breadcrumb">
    <h1>Encryption List</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Encryption list</li>
    </ul>
</div>
<div class="separator-breadcrumb border-top"></div>
<form action="" method="post">
<div class="row">
    <div class="col-lg-12 col-md-12">
        <div class="card mb-5">
            <div class="card-body">
                <div class="row row-xs">
                    <div class="col-md-2  mt-3 mt-md-0">
                        <label for="log_id">Data Input</label>
                        <input type="text" class="form-control" name="encr_decr" id="encr_decr" required="true">
                    </div>
                    <div class="col-md-2 mt-3 mt-md-0">
                        <label for="">&nbsp;</label>
                        <button type="submit" class="btn btn-primary btn-block encrpt_decrypt" id="encrypt_data" data_encrypt = "encrypt">Encrypt</button>
                    </div>
                    <div class="col-md-2 mt-3 mt-md-0">
                        <label for="">&nbsp;</label>
                        <button type="submit" class="btn btn-primary btn-block encrpt_decrypt" id="decrypt_data" data_encrypt = "decrypt">Decrypt</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</form>

<div class="widget-body">
    <div class="portlet-body">
                        
    <?php echo (isset($successMsg) && $successMsg!='') ? "<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($successMsg)."</div>" : '' ; ?>
    <?php echo (isset($failedMsg) && $failedMsg!='') ? "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($failedMsg)."</div>" : '' ?>
   
    <div id="status_msg" style="display: none;"><div class="alert alert-success"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>
    <div id="alert_msg" style="display: none;"><div class="alert alert-danger"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>

    </div>
</div>

<div class="row mb-4">
    <div class="col-md-12 mb-4">
        <div class="card text-left">

            <div class="card-body">
                <div class="table-responsive">
                  <form id="listFrm" name="listFrm" action="" method="post">       
                    <input type="hidden" id="action" name="action" value="">
                    <!-- <table id="list" class="display table table-striped table-bordered" style="width:100%">
                        <thead>
                            <tr>
                                <th>Log Data</th>
                            </tr>
                        </thead>
                    </table> -->

                    <div id="list_data">
                    </div>
                  </form>
                </div>
            </div>
        </div>
    </div>
</div>



<script type="application/javascript">
   $(document).ready(function() {

    $('.encrpt_decrypt').click(function(e) {
        e.preventDefault();
        
        var encr_decr = $("#encr_decr").val();
        var encry = $(this).attr('data_encrypt');

        if(encr_decr === '')
        {
            $("#alert_msg").show();
            $("#alert_msg").html("<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>Please provide data input.</div>");
            return false;
        }
        
        $.ajax({
            url: "encryptionlist.php",
            type:'POST',
            data: {
                    act: 'load',
                    encr_decr: encr_decr,
                    encr_decr_type: encry
                },
            success: function(output_string){
             $("#list_data").html('');
             $("#list_data").append(output_string);
            }
        });
    });     
});
</script>
