<?php
include "config/init.php";

include "template/header.php";

//Main Header
include "template/main-header.php";

//Left side column. contains the logo and sidebar
include "template/main-sidebar.php";

if(isset($_POST['sendSms'])){
    $number = html_filter($dbc,$_POST['number']);
    $message = html_filter($dbc,$_POST['message']);
    if(!empty($number) AND !empty($message)){
        
        if(sendSMS($number,$message)){
            
            $result = "<p class='alert alert-success'>SMS sent successfully!!!</p>";
        } else{
            $result = "<p class='alert alert-danger'>Error sending message</p>";
        }
    } else{
        $result = "<p class='alert alert-danger'> All Fields Required</p>";
    }
}

?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            SMS Section
            
            <?php
            //var_dump(sendSMS("+233243056828","hello"));
            ?>
            
            
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">SMS Section</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
       <div class="row">
            <div class="col-md-4">
                <?php
                    if(isset($result)){echo $result;}
                ?>
                <div class="panel panel-default">
                    <div class="panel-heading">Quick SMS</div>
                    <div class="panel-body">
                        <form method="post" role="form">
                            <div class="form-group">
                                <label for="number">Phone Number</label>
                                <input type="text" name="number" id="number" class="form-control" required placeholder="+233240000000">
                            </div>
                            <div class="form-group">
                                <label for="message">Message</label>
                                <textarea class="form-control" name="message" id="message" required></textarea>
                            </div>
                            <button type="submit" class="btn btn-primary btn-block" name="sendSms">Send Now</button>
                        </form>
                    </div>
                </div>
            </div>
            <div class="col-md-8">
				<div class="col-md-12">
                    <div class="panel panel-default">
                        <!-- List of All Payout -->
                        <div class="panel-heading">This is a list of All Customers</div>
                        <div class="panel-body">
                            <table class="table table-striped" id="customer-list">
                                <thead>
                                <tr>
                                    <th>Time</th>
                                    <th>Country</th>
                                    <th>Phone</th>
                                    <th>Name</th>
                                    <th>Company</th>
                                    <th>Account Type</th>
                                    <th>Account KYC</th>
                                    <th>Status</th>
                                    <th>Action</th>
                                </tr>
                                </thead>
                            </table>
                            <hr>
                        </div>
                    </div>
                </div>
		   </div>
       </div>
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->

<?php include "template/footer.php"?>


