<?php 
$db = new SQLite3('./api/user_message.db');
if(isset($_POST['submit'])){
$db->exec("INSERT INTO messages(message, userid, status, expire) VALUES('".$_POST['message']."', '".$_POST['userid']."', '".$_POST['status']."', '".$_POST['expire']."')");
header("Location: send_message.php");
}
include ('includes/header.php');
?>


<div class="content-wrapper">
    <div class="container-fluid">
        <div class="card mb-3">
            <div class="card-header">
                <i class="fa fa-comment"></i> Mensagem </div>
            <div class="card-body">
                <div class="alert alert-light" role="alert">
                    <div class="row">
                        <div class="col-12">
                            <h3>Editar mensagem</h3>
                        </div>
                        <div class="col-md-8">
                            <form method="post">
                                <div class="form-group ">
                                    <label class="control-label " for="message">
                                        Mensagem *
                                    </label>
                                    <div class="input-group">
                                        <input class="form-control" id="description" name="message" placeholder="Mensagem" value='' type="text"/>
                                    </div>

                                </div>
                                <div class="form-group ">
                                    <label class="control-label " for="userid">
                                        Usuario *
                                    </label>
                                    <div class="input-group">
                                        <input class="form-control" id="description" name="userid" placeholder="Usuario" value='' type="text"/>
                                    </div>

                                </div>
                                <div class="form-group ">
                                    <label class="control-label requiredField" for="status" >
                                        Status *
                                    </label>
                                    <select class="select form-control" id="select" name="status">
                                        <option value="ACTIVE">
                                            ATIVO
                                        </option>
                                        <option value="INACTIVE">
                                            INATIVO
                                        </option>
                                    </select>

                                </div>
                                <div class="form-group ">
                                    <label class="control-label " for="message">
                                        Expiração (2018-06-17 23:30:10): *
                                    </label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="expire" placeholder="YYYY-MM-DD" id="datetimepicker" value=''> 
                                    </div>

                                </div>
                                <div class="form-group">
                                    <div>
                                        <button class="btn btn-info " name="submit" type="submit">
                                            <i class="fa fa-check"></i> Aceitar
                                        </button>
                                    </div>

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

        </div>
    </div>
    <br><br><br>
<?php include ('includes/footer.php');?>
    <script>
$('#confirm-delete').on('show.bs.modal', function(e) {
    $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
    </script>
</body>

</html>