ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/modal/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/modal/tab-sub-headings-create.php

<?php include "../config/config.php" ?>
<div class="modal-dialog modal-lg" role="document" id="add_modal" style="overflow-x: hidden; overflow-y: hidden;">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title mt-0" id="myLargeModalLabel">Create Tab - Sub Headings</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-top: -25px;"><i class="fa fa-times"></i></button>
            </div>
            
            <form id="add_form" method="post">
                
                
            <div id="content-div">
            
            
            <div class="modal-body" style="padding: 20px 40px 20px 40px;">
                
                    <div class="form-group">
                        <label>Tab - Sub Heading Name</label>
                        <input type="text" name="name" id="name" class="form-control" required>
                    </div>
                    
                    <div class="form-group">
                        <label>Category Name</label>
                        <select name="category" class="form-control select2" style="width:100%;" id="category" required>
                            <option value="">Select Category Name</option>
                        <?php 
                            $statement = $pdo->prepare("SELECT * FROM `tbl_category` WHERE status=1");
                            $statement->execute();
                            $result = $statement->fetchAll(PDO::FETCH_ASSOC);
                            foreach ($result as $data) {    ?>
                            <option value="<?=$data['id']?>"><?=$data['name']?></option>
                        <?php } ?>
                        </select>
                    </div>
                    
                    <div class="form-group">
                        <label>Tab - Headings Name</label>
                        <select name="headings" class="form-control select2" style="width:100%;" id="headings" required>
                            <option value="">All</option>
                        </select>
                    </div>
                    
                    
                    <div class="form-group">
                        <label>Status</label>
                        <select name="status" class="form-control select2" style="width:100%;" id="status" required>
                            <option value="1">Active</option>
                            <option value="0">In-Active</option>
                        </select>
                    </div>

            </div>
            
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">Submit</button>
            </div>
            
            
            </div>
            </form>
            
            
            
            <div id="loading-div" style="display: none; padding-bottom: 80px;">
                    <center> <img src="img/loading.gif" style="width: 250px;"><br><b class="blinking">Processing Please Wait...</b></center>
            </div>
            
            
            
        </div>
    </div>
<!--</div>-->

<script>
    $('#add_form').on('submit', function(e){
        console.log("Click And Form Working");
                e.preventDefault();
                $('#loading-div').show();
                $('#content-div').hide();
                var formData = new FormData(this);
                formData.append('type', 'sub_headings_add');
                            $.ajax({
                            url: 'apis/tab-sub-headings.php',
                            type: 'post',
                            dataType: 'json',
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            enctype: 'multipart/form-data',
                            success: function (response) {
                                if(response['status']==200){
                                     alert(response['message']);
                                     $("#add_modal .close").click();
                                     $('#add_form').trigger("reset");
                                     emp_datas();
                                     $('#loading-div').hide();
                                     $('#content-div').show();
                                }else{
                                    alert(response['message']);
                                    $('#loading-div').hide();
                                    $('#content-div').show();
                                }
                                
                               
                            }
                        });
                
    });
</script>
<script>
 $(document).ready(function() { 
$("#category").change(function () {
        get_headings();
    });
    
    
    function get_headings(){
         $('#headings').empty();
        var category = $('#category').val();
                                $.ajax({
                            url: 'api/get-tab-headings.php',
                            type: 'post',
                            dataType: 'json',
                            data: {type:'get_headings',category:category},
                            success: function (response) {
                                var m='<option value="">All</option>';
                                if(response['error']==false){
                                    for(var n=0;n<response['data'].length;n++){
                                        m+='<option value='+response['data'][n]['id']+'>'+response['data'][n]['name']+'</option>';
                                    }
                                }
                                $('#headings').append(m);  
                                
                               
                            }
                        });
    }
 });
</script>

Zerion Mini Shell 1.0