ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/home-news-add.php

<?php  include "header.php";?>
<div class="content-wrapper" style="background:white;">
        <div class="clearfix"></div>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-header">
                    <h3 class="box-title"><b>Add News & Updates: </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">

<!-- Content Section Starts Here -->

<div id="content-div">
                        <form action="" enctype="multipart/form-data" method="post" id="news_form" accept-charset="utf-8">
                                                                 
                        <div class="row">
                            
                            <div class="col-sm-4" hidden>
                                <div class="form-group">
                                <label class="control-label" for="departement_id">News Type</label>
                                <select name="news_type" class="form-control select2" style="width:100%" id="news_type">
                                <option value="4">NEWS & UPDATES</option>
                                </select>
                                </div>
                            </div>
                            
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="news_title">News Title</label>                                    
                                    <input type="text" name="news_title" id="news_title" class="form-control tip" required="required" placeholder="Enter News Title" />
                                </div>
                            </div>
                            
                            
                        
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="file">Choose Files</label>                                    
                                    <input type="file" name="photo"  id="photo" value="" class="form-control tip" required="required" />
                                
                                </div>
                                <span style="color: red;" id="photospan"></span>
                            </div>
                           
                            <div class="col-sm-4">
                                <div class="form-group">
                                <label class="control-label" for="departement_id">Status</label>
                                <select name="status" class="form-control select2" style="width:100%" id="status">
                                <option value="1">Active</option>
                                <option value="0">In-Active</option>
                                </select>
                                </div>
                            </div>
                            
                            <div class="col-md-8">
                                <div class="form-group">
                                    <label class="required" for="file">News Content</label>                                    
                                    <textarea type="text" name="news_content" id="news_content" class="form-control tip" rows="5" required="required" placeholder="Enter News Content"></textarea>
                                </div>
                            </div>
                            
                            <div class="row">
                                <div class="col-lg-12" style="padding: 0px;"><br> 
                                <div class="form-group" style="text-align:center;">
                                        <input type="submit" id="add_category" name="add_category" value="Add Home News"  class="btn btn-success" />
                                </div>
                                </div>
                            </div>
                            
 
                             
                             
                        </div>
                        </form>
</div>

<div id="loading-div" style="display: none;">
    <center> <img src="img/loading.gif" style="width: 250px;"><br><b class="blinking">Processing Please Wait...</b></center>
    <br><br><br><br>
</div>

<div class="form-group" style="text-align:center;">
    <a href="home-news-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
    <a href="home_news.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
 </div>

<!-- Content Section Endsss Here -->
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>


<script>
var photo = document.getElementById("photo");
photo.onchange = function() {
    console.log(photo);
    $('#photospan').text('');
    if(this.files[0].size > 5500000){
        $('#photospan').text('Photo Image Maximum 5 mb Allowed');
       alert("File is too big!");
       this.value = "";
    };
};

</script>

<script>
    $(document).ready(function(){

    $('#news_form').on('submit', function(e){
                e.preventDefault();
                $("#loading-div").show();
                $("#content-div").hide();
               $("#add_category").attr('disabled','disabled');
                console.log('News Form Submit Option Start...');
                var formData = new FormData(this);
                formData.append('type', 'news_add');
                                $.ajax({
                            url: 'apis/home-news-api.php',
                            type: 'post',
                            dataType: 'json',
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                          enctype: 'multipart/form-data',
                            success: function (response) {
                                console.log(response);
                                
                                if(response['status']==200){
                                                 //put success coode  
                                                 alert(response['message']);
                                                $("#loading-div").hide();
                                                $("#content-div").show();
                                                 $('#news_form').trigger("reset");
                                                $("#add_category").removeAttr('disabled');
                                    
                                }else{
                                    //put falied code
                                    $("#loading-div").hide();
                                    alert(response['message']);
                                   $("#add_category").removeAttr('disabled');
                                   $('#news_form').trigger("reset");
                                }
                                
                               
                            }
                        });
                
    });     
    
            });
</script>
<style>
    table,td,th{
        padding:5px;
    }
    th{
        border: 1px solid black;
    }
    td{
        border: 1px solid black;
        border-style: dashed;
    }
</style>
<?php include "footer.php";?>

Zerion Mini Shell 1.0