<style>
    .fontInput {
        font-size: 11px;
        font-family: arial;
    }

    .fontmulti {
        font-size: 11px;
        font-family: arial;
        color: blue;
        background-color: blue;
    }
</style>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper clearfix">

    <?php require('./layout/headerpage.php'); ?>

    <div class="container col-12 mb-4 pb-5">
        <div class="row">
            <div class="col-12">
                <div class="col-12">
                    <div class="card  mx-3">
                        <div class="timeline-header bg-primary py-2 pl-2">
                            <b class="text-light judul"><span class="bi bi-file-earmark-plus"></span> Tambah Rekening</b>
                        </div>
                        <div class="row col-md-12">
                            <div class="col-md-12">
                                <div class="card-body mt-4 px-1 mx-2">

                                    <div class="row">
                                        <div class="col-12 col-sm-6 col-md-12">
                                            <div class="info-box mb-3">
                                                <div class="info-box-content">
                                                    <div class="relative mb-0 pb-4">
                                                        <input name="judul" value="INPUT REKENING" style="background-color: gainsboro;" class="form-control-sm col-sm-2 fontInput small bg-default mt-3 text-center" disabled>
                                                    </div>

                                                    <div class="col-sm-12 invoice-col pt-0">
                                                        <form action="" method="post">

                                                            <div class="row mx-3 mt-1">
                                                                <div class="col-md-7">
                                                                    <div class="card-body mt-0 px-2 mx-1">

                                                                        <div class="row">
                                                                            <label class="col-sm-3 col-form-label">Nomor Rekening</label>
                                                                            <div class="col-sm-7">
                                                                                <input type="text" name="rekening" class="form-control form-control-sm fontInput" placeholder="Nomor Rekening">
                                                                            </div>
                                                                        </div>
                                                                        <div class="row">
                                                                            <label class="col-sm-3 col-form-label">Nama Rekening</label>
                                                                            <div class="col-sm-7">
                                                                                <input type="text" name="an" class="form-control form-control-sm fontInput" placeholder="Nama Rekening">
                                                                            </div>
                                                                        </div>
                                                                        <div class="row">
                                                                            <label class="col-sm-3 col-form-label">Bank</label>
                                                                            <div class="col-sm-7">
                                                                                <input type="text" name="bank" class="form-control form-control-sm fontInput" placeholder="Nama Bank">
                                                                            </div>
                                                                        </div>
                                                                        <div class="row">
                                                                            <label class="col-sm-3 col-form-label">WA Konfirmasi</label>
                                                                            <div class="col-sm-7">
                                                                                <input type="text" name="wa" class="form-control form-control-sm fontInput" placeholder="Nomor WA Konfirmasi">
                                                                            </div>
                                                                        </div>
                                                                        <div class="row">
                                                                            <label class="col-sm-3 col-form-label">Admin/Operator Sekolah</label>
                                                                            <div class="col-sm-7">
                                                                                <input type="text" name="operator" class="form-control form-control-sm fontInput" placeholder="Nama Admin/Operator untuk Konfirmasi">
                                                                            </div>
                                                                        </div>


                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="my-2 pl-3 py-2 mx-3">
                                                                <div class="row">
                                                                    <div class="col-auto">
                                                                        <a <?php echo $link->page('seting/rekening/index'); ?> class="btn btn-primary btn-xs float-right mx-2"><i class="bi-arrow-left-circle"></i> Cancel</a>
                                                                        <button type="submit" class="btn btn-primary btn-xs float-right" name="submitjns"><i class="bi-save"></i> Simpan</button>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </form>
                                                    </div>
                                                </div>
                                            </div>

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


<?php
if (isset($_POST['submitjns'])) {
    $rekening = htmlspecialchars($_POST['rekening']);
    $an = htmlspecialchars(trim($_POST['an']));
    $bank = htmlspecialchars(trim($_POST['bank']));
    $wa = htmlspecialchars(trim($_POST['wa']));
    $operator = htmlspecialchars(trim($_POST['operator']));

    $id = md5($rekening . $an . $bank);
    $crud = new crudData();
    $arrayjns = [
        'rekening' => $rekening,
        'an' => $an,
        'bank' => $bank,
        'wa' => $wa,
        'operator' => $operator,
        'id' => $id
    ];


    $crud->insertData('tb_rekening', $arrayjns);


    $direct = new toast();
    echo  $direct->redirect('toast', 'save', 'seting/rekening/index');
} else {
    echo '';
}

?>