<?php
session_start();
if(isset($_SESSION['username'])){

?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <meta charset="utf-8" />
    <?php include('includes/styles.php'); ?>
    <title>Add District | <?php echo $church_name; ?></title>
   
</head>

<?php

?>
<style>
    ul.parsley-errors-list.filled {
        padding: 0;
        list-style: none;
        color: red;
        padding-right: 20px;
        position: relative;
        float: right;
        margin: 0;
    }


    span.select2.select2-container.select2-container--default {
        width: 100% !important;
    }


    ul#parsley-id-5, ul#parsley-id-9, ul#parsley-id-11, ul#parsley-id-15, ul#parsley-id-21, ul#parsley-id-23 {
        animation:signup-response 0.5s 1;
        -webkit-animation:signup-response 0.5s 1;
        animation-fill-mode: forwards;

        animation-delay:5s;
        -webkit-animation-delay:5s; /* Safari and Chrome */
        -webkit-animation-fill-mode: forwards;

    }

    @keyframes signup-response{
        from {opacity :1;}
        to {opacity :0;  height: 0px;}
    }

    @-webkit-keyframes signup-response{
        from {opacity :1;}
        to {opacity :0;  height: 0px;}
    }
</style>
<body class="fixed-header dashboard">
<?php include('includes/sidebar.php'); ?>


<div class="page-container ">
    <?php include('includes/header.php'); ?>
    <!-- END HEADER -->
    <!-- START PAGE CONTENT WRAPPER -->
    <div class="page-content-wrapper ">
        <!-- START PAGE CONTENT -->
        <div class="content ">
            <!-- START CONTAINER FLUID -->
            <div class=" container-fluid   container-fixed-lg">
                <!-- START BREADCRUMB -->
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="<?php echo $base_url; ?>">Home</a></li>
                    <li class="breadcrumb-item"><a href="<?php echo $base_url; ?>district">Districts</a></li>
                    <li class="breadcrumb-item active">Add District</li>
                </ol>
                <!-- END BREADCRUMB -->
                <div class="row m-t-50">
                    <div class="col-xl-12 col-lg-12">
                    <!-- <div class="alert alert-danger" role="alert">
                      <button aria-label="" class="close" data-dismiss="alert"></button>
                      <strong>Note: </strong>Create a teacher before creating a class
                    </div> -->
                        <!-- START card -->
                        <div class="card">
                            <div class="card-header ">
                                <div class="card-title">
                                </div>
                            </div>
                            <div class="card-body">
                                <form action="" class="" method="post" id="district-add">
                                    <h3 style="margin-bottom: 0" class="mw-80">Enter District Data Below</h3>
                                    <p class="mw-80 m-b-50">All fields marked <span style="color: red">*</span> must be filled
                                    
                                        <div class="form-group form-group-default required">
                                            <label>District Name</label>
                                            <input type="text" class="form-control" id="name" placeholder="Minna Central" required name="name">
                                        </div>


                                                                            
                                        

        
                                    <div class="row m-t-50">
                                        <div class="col-xl-6">
                                            <p class="small-text hint-text">Note: Please crosscheck all data provided before submitting to database </p>
                                        </div>
                                        <div class="col-xl-6">
                                            <input aria-label="" type="submit" value="Add District" name="add_district" id="submit" class="btn btn-primary pull-right btn-lg btn-block btn-animated from-left">
                                                
                                        </div>
                                    </div>


                                    <div id="success-msg"></div>

                                </form>
                            </div>
                        </div>
                        <!-- END card -->
                    </div>
                    


                </div>
                </div>
            </div>
            <!-- END CONTAINER FLUID -->
        </div>
        <!-- END PAGE CONTENT -->


        <?php include('includes/foot.php'); ?>
    </div>
    <!-- END PAGE CONTENT WRAPPER -->
</div>





<!-- END QUICKVIEW-->

<?php include('includes/footer.php'); ?>

<script>
    $('[data-toggle="tooltip"]').tooltip();
</script>


    
    <script>
        $('.dropify').dropify();
    </script>

<script>
        $('#district-add');
        $('#district-add').on('submit', function(event){
            event.preventDefault();
            if ($('#district-add').parsley().isValid()){
                $.ajax({
                    url: "<?php echo $base_url; ?>process-add-district.php",
                    method: "POST",
                    data: new FormData(this),
                    contentType: false,
                    processData: false,
                    beforeSend: function () {
                        $('#submit').attr('disabled', 'disabled');
                        $('#submit').val('Adding District, Please Wait...');

                    },

                    success:function (data) {
                        $('#district-add').parsley().reset();
                        $('#submit').attr('disabled', false);
                        $('#submit').val('Add District');
                        $('#success-msg').html(data);
                    }
                })
            }

        })
    </script>


<!-- <script>
document.getElementById('username').addEventListener("keyup", function() {
  this.value = document.getElementById('adm_no').value;
});
</script> -->


    <?php
}else{
    ?>
    
  <?php include('session.php'); ?>

    <?php

}

?>