<!-- File: src/Template/Articles/index.ctp -->
<div id="page-wrapper">
    <div class="header">
        <h1 class="page-header">

        </h1>
        <ol class="breadcrumb">
            <li><a href="#">SMS & Email</a></li>
            <li class="active">Circular SMS</li>
        </ol>

    </div>
    <div id="page-inner">



        <div class="row">
            <div class="col-md-12">
                <!--   Kitchen Sink -->
                <div class="panel panel-default">
                    <div class="panel-heading d-flex justify-content-center">
                    Circular SMS
                    </div>
                    <div class="panel-body">
   <div class="app-title">
        <div >
          
        </div>
        <?php if (isset($_SESSION['mem_add']) && $_SESSION['mem_add'] != "") { ?>
        <div class="alert alert-success">
            <strong><?php echo $_SESSION['mem_add']; ?></strong>
        </div>
    <?php $_SESSION['mem_add'] = "";
    } ?>
        
      </div>
      <form method="post" action="<?php echo base_url(); ?>index.php/Demand/circular_sms" id="member_add_" enctype='multipart/form-data'>
<div class="row">
    <div class="col-sm-1"></div>
<div class="col-sm-3">
            <div>Division</div>
            <select name="division" id="division_id" class="form-control">
                <option value="">All</option>
                <?php foreach ($divisions as $div) { ?>
                    <option value="<?php echo $div['division']; ?>"><?php echo $div['division']; ?></option>
                <?php } ?>
            </select>
        </div>
        <div class="col-sm-4">
            <div>Section</div>
            <select name="section" id="section_id" class="form-control">
                <option value="">All</option>
                <?php foreach ($sections as $sec) { ?>
                    <option value="<?php echo $sec['section']; ?>"><?php echo $sec['section']; ?></option>
                <?php } ?>
            </select>
        </div>
        <div class="col-sm-3">
            <div>Members</div>
            <select name="mem_no" id="mem_no" class="form-control">
                <option value="">All</option>
                <?php foreach ($members as $mem) { ?>
                    <option value="<?php echo $mem['me_no']; ?>"><?php echo $mem['me_no']."-".$mem['mem_name']; ?></option>
                <?php } ?>
            </select>
        </div>
        </div><br><br>
        <div class="row">
            <div class="col-sm-4"></div>
        
<div class="col-sm-4">
            <div>Message</div>
            <textarea name="message" id="message_id" rows="5" class="form-control"></textarea>
        </div>
        </div>
        <br><br>
        <div class="row">
             <div class="col-sm-5"></div>
<div class="col-sm-2 mt-4"><button type="submit" class="btn btn-lg btn-primary ml-5">Submit</button></div>
</form>
</div>
</div>


</div>
</div>
 <script>
   $(document).ready(function() {
        $('.alert').fadeOut(3000);
   });
  $('#division_id').on('change', function() {
        var division = this.value;
        var section = $('#section_id').val();

        $.ajax({
            type: 'POST',
            url: "<?php echo base_url() ?>index.php/Member/getsection",
            data: {
                division: division
            },
            dataType: 'html',
            success: function(data) {

                $('#section_id').html(data);
            }
        });

    }); 

</script>