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

?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <meta charset="utf-8" />
    <?php include('../admin/includes/styles.php'); ?>
    <title>Member Quick Update | <?php echo $church_name; ?></title>
<?php
  $sql = "SELECT * FROM general_settings";
  $conn->query($sql);
  $result = $conn->fetchSingle();
  $curreg = ucwords($result->curreg);
  $curtype = $result->church_name;
?>
</head>
<style>
.text-uppercase {
        text-transform: uppercase !important;
        letter-spacing: 0 !important;
    }
    @media screen {
        #printSection {
            display: none;
        }

        .printspan, .bible{
            display: none !important;
        }

        .bibles{
            font-size: 72px;
        }

        .bank, .bankd, .copy {
            display: none;
        }
    }

    @media print {
        span {

        }

    @media print {

        body {
            color: black;
            font-style: normal;
            text-rendering: optimizeLegibility;
            height: auto;
            margin-left: 0;
        }
        .printspan{
            font-size: 14pt !important;
            margin-left: -60px !important;
            margin-right: 0 !important;
            padding-top: 10px;
        }
.col-lg-3{
    padding-right: 0 !important;
}
        .printscreen{
            display: none !important;
        }
        .biblescreen{
            display: none !important;
        }
    }
        .bible{
            font-size: 14pt !important;
            padding-top: 10px;
        }

        .bank{
            font-size: 12pt !important;
            padding-top: 20px;
        }

        .bankd{
            font-size: 12pt !important;
            padding-top: 5px;
        }

        .copy{
             font-size: 12pt !important;
            font-style: normal;
            font-style: italic;
             padding-top: 20px;
         }

        .bibles{
            font-size: xxx-large !important;
            padding-top: 10px;
            padding-bottom: 10px;
        }

        body, #main-container  *  {
            visibility:hidden;

        }
        #printSection, #printSection * {
            visibility:visible;
        }
        #printSection {
            position:absolute;
            left:0;
            top:0;
        }


    }

    #notify{
        animation:signup-response 0.5s 1;
        -webkit-animation:signup-response 0.5s 1;
        animation-fill-mode: forwards;

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

    }

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

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

</style>
<style>
    @media only screen and (min-width: 768px) {
        .modal .modal-dialog {
            width: 400px !important;
        }
    }

    .demo-card-scrollable {
        height: 100px;
    }
        .scrollable.scroll-content {
        height: 56px !important;
    }

    .table tbody tr td {
        padding: .75rem;
    }
    .dataTables_wrapper .row > div {
        flex-direction: column;
    }

    .table > tfoot > tr > td,
    .table > tfoot > tr > th{
    text-transform: uppercase;
    font-weight: 500;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    padding-top: 14px;
    padding-bottom: 14px;
    vertical-align: middle;
    color: #4b4b4b;
    border-top: none;}
</style>
<body class="fixed-header dashboard">
<?php include('includes/sidebar.php'); ?>
<!-- START PAGE-CONTAINER -->
<div class="page-container ">
    <?php include('includes/header.php'); ?>
    <!-- START PAGE CONTENT WRAPPER -->
    <div class="page-content-wrapper ">
        <!-- START PAGE CONTENT -->

        <div class="content sm-gutter">


            <!-- START CONTAINER FLUID -->
            <div class="container-fluid padding-25 sm-padding-10">
                 <?php
                                   $sql = "SELECT curreg FROM general_settings";
                                   $conn->query($sql);
                                   $constatus = $conn->fetchColumn(); 

                                   if($constatus == 'active'){
                                        ?>
                <!-- START ROW -->
               
                <div class="row m-t-20">
                    <section style="padding-bottom: 50px" class="col-lg-12 connectedSortable">
                        <a href="add-member"><button class="btn btn-outline-success pull-left btn-lg btn-animated from-left">
                                <span>Add Member</span>
                                <span class="hidden-block">
													<i class="pg-icon">user_add</i>
												</span></button> </a>
                    </section>



<div class="m-0 row ">
                <div class="col-lg-12 sm-no-padding">
                  <div class="card card-transparent">
                    <div class="card-body no-padding">
                      <div id="card-advance" class="card card-default" style="">
                        <div class="card-header  ">
                          <div class="card-title">
                          </div>
                          <div class="card-controls">
                            <ul>
                              <li><a href="#" class="card-collapse" data-toggle="collapse"><i class="card-icon card-icon-collapse"></i></a>
                              </li>
                              <li><a href="#" class="card-maximize" data-toggle="maximize"><i class="card-icon card-icon-maximize"></i></a>
                              </li>
                              <li><a href="#" class="card-close" data-toggle="close"><i class="card-icon card-icon-close"></i></a>
                              </li>
                            </ul>
                          </div>
                        </div>
                        <div class="card-body">
                          <p>Welcome to <strong><?php echo date('Y'); ?> <?php echo $curtype; ?> Conference</strong>. All conference registration officers are to please use the below quick edit method to update member's registration status swiftly. Firstly, input the eleven digits phone number of the member. Lastly, confirm the details before submiting</p>
                          <br>
                          <form action="" method="post" id="member-update">
                          <div class="row">
                          
                                    <div class="col-md-4">
                                    <div class="form-group form-group-default change_class_name required">
                                            <label>Member Phone Number</label>
                                            <input required type="tel" class="form-control"  id="phone" name="phone" placeholder="Enter User Phone Number Here" maxlength="11">
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                     <div class="form-group form-group-default required">
                                        <label>Amount</label>
                                        <input type="text" required oninput="myAmount()" autocomplete="off" id="postcontent" class="autonumeric form-control" placeholder="Enter Amount Donated" name="null" value="<?php echo $amount; ?>">
                                        </div>
                                        
                                        <textarea hidden id="demo" name="amount" rows="5" placeholder="Enter Amount Donated"><?php echo $amount; ?></textarea>
                                    </div>
                                    <div class="col-md-4">
                                    <div class="form-group form-group-default change_class_name disabled">
                                            <label>Conference Year</label>
                                            <input readonly type="text" class="form-control"  name="conyear" placeholder="Enter New Class Name" value="<?php echo date('Y'); ?>">
                                        </div>
                                    </div>
                                    

                                    <div class="col-sm-4" style="margin-top: 20px;">
                                    <input aria-label="" type="submit" value="Quick Update" name="promote" 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>
                    </div>
                  </div>
                </div>
              </div>

<div class="col-lg-12" id="phoneStatus"></div>



                  
                  



                        <!-- Display attendance details here -->

                        <div class="col-lg-12">
                        <div class="card card-info" id="display-details">

                        </div>
                    </div>
                
 <?php
                                    }else {
                                        ?> <div class="col-sm-12 ">
                                        <div class="col-sm-offset-1  text-center">
                                            <div class="four_zero_four_bg">
                                            </div>
                
                                            <div style="margin-top: 100px;" class="contant_box_404">
                                            <lottie-player src='<?php echo $regclose; ?>'  background='transparent'  speed='1'  style='width: 300px; height: 300px;margin: 20px auto;'  loop  autoplay></lottie-player>
                                                <h5>
                                                No Active Registration
                                                </h5>
                
                                                <p>Registration for <?php echo date('Y') ; ?> is now Closed!</p>
                
                
                
                
                                            </div>
                                        </div>
                                    </div>
                                    <?php
                                    }
                                    ?> 
                </div>
            </div>
            <!-- END CONTAINER FLUID -->
        </div>
        <!-- END PAGE CONTENT -->
        <?php include('../admin/includes/foot.php'); ?>
    </div>
    <!-- END PAGE CONTENT WRAPPER -->
</div>
<!-- END PAGE CONTAINER -->

<!-- END QUICKVIEW-->

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




<?php

?>


    

    <script>
    $('#member-update');
    $('#member-update').on('submit', function(event){
        event.preventDefault();
        if ($('#member-update').parsley().isValid()){
            $.ajax({
                url: "process-update-member.php",
                method: "POST",
                data: new FormData(this),
                contentType: false,
                processData: false,
                beforeSend: function () {
                    $('#submit').attr('disabled', 'disabled');
                    $('#submit').val('Updating Details, Please Wait...');

                },

                success:function (data) {
                    $('#member-update').parsley().reset();
                    $('#submit').attr('disabled', false);
                    $('#submit').val('Update Member');
                    $('#success-msg').html(data);
                }
            })
        }

    })
</script>
    <!--        Delete Teacher Modal End-->


    <?php



?>



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

                    },

                    success:function (data) {
                        $('#mark-add').parsley().reset();
                        $('#mark').attr('disabled', false);
                        $('#mark').val('Filter');
                        $('#display-details').html(data);
                    }
                })
            }

        })
    </script>


<script>
 

function myAmount() 
{
var x = document.getElementById("postcontent").value;
document.getElementById("demo").innerHTML = x.replace(/[.,]+/g, '');
}
</script>

<script>
    $(function (){
        $("#member").DataTable({
            "responsive": true, "lengthChange": false, "autowidth": true, "pageLength": 100, "deferRender": true
        }).buttons().container().appendTo('#member_wrapper .col-md-6:eq(0)');
    });


</script>

<script>
  function phoneAvailability(phoneInput){
        $.ajax({
         method:"POST",
         url: "php-script.php",
         data:{phone:phoneInput},
         success: function(data){
           $('#phoneStatus').html(data);
         }
       });
 }
</script>

<script>
  $(document).on('input','#phone',function(e){
    let phoneInput = $('#phone').val();
    let msg;
    if(phoneInput.length==0){
      msg="<span class='alert alert-danger' style='width: 100%;display: flex;margin-left: 5px;margin-right: 5px;' role='alert'><strong><i class='pg-icon'>spam </i></strong>&nbsp;<strong>Enter Phone Number</strong></span>";
    }else if((/^$|\s+/).test(phoneInput))
    {
     msg="<span class='alert alert-danger' style='width: 100%;display: flex;margin-left: 5px;margin-right: 5px;' role='alert'><strong><i class='pg-icon'>spam </i></strong>&nbsp;<strong>Phone Number Cannot Contain Spaces</strong></span>";
    }
    else if(phoneInput.length!=0 && (phoneInput.length <11 || phoneInput.length >11)){
      msg="<span class='alert alert-danger' style='width: 100%;display: flex;margin-left: 5px;margin-right: 5px;' role='alert'><strong><i class='pg-icon'>spam </i></strong>&nbsp;<strong>Phone Number Must Be Between 11 Characters</strong></span>";
    }else{
      phoneAvailability(phoneInput);
    }
    $('#phoneStatus').html(msg);
});
</script>
<?php
}else{
    ?>
    
    <script>
    const e = document.getElementById("notify");
    e.addEventListener("animationend", (ev) => {
        if (ev.type === "animationend") {
            e.style.display = "none";
        }
    }, false);
</script>


    
  <?php include('session.php'); ?>

    <?php

}

?>