ok

Mini Shell

Direktori : /home2/selectio/public_html/thedentalpark.com/admin/
Upload File :
Current File : /home2/selectio/public_html/thedentalpark.com/admin/application-list.php

<?php  include "header.php";


if(isset($_GET['del_id']) && $_GET['del_id']!=''){
    
    $id = isset($_GET['del_id']) ? $_GET['del_id'] : '';
    $statement = $pdo->prepare("SELECT * FROM tbl_application_form WHERE id=?");
	$statement->execute(array($id));
	$edit_result = $statement->fetchAll(PDO::FETCH_ASSOC);
	$edit_count = $statement->rowCount();
	
	if($edit_count > 0){
	    
	    $statement = $pdo->prepare("DELETE FROM tbl_application_form WHERE id=?");
        $result=$statement->execute(array($id));
        if($result) {
            $_SESSION['application_success'] = 'Application Details Delete Successfully' ;
            header("Location:application-list.php");
                exit;
        } else {
             $_SESSION['application_error'] = 'Error Occured Not Delete';
             header("Location:application-list.php");
             exit;
        }
        
	
	}else{
	  $_SESSION['application_error'] = 'Application Details Not Delete';
     header("Location:application-list.php");
     exit;  
	}

}

?>

  
<div class="content-wrapper">
    
        <section class="content-header">
            <h1>Application List</h1>
            <ol class="breadcrumb">
                <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
                <li class="active">Application List</li>            
            </ol>             
        </section>

        <div class="clearfix"></div>


<section class="content">
    
    <div class="row">
        <div class="col-xs-12">
            
            <div class="row">
                <div class="col-xs-12">
                    <?php if(!empty($_SESSION['application_error'])) { ?>
                		<div class="callout callout-danger">
                			<p> <i class="icon fa fa-warning"></i> <?php echo $_SESSION['application_error']; ?></p>
                		</div>
            		<?php  unset($_SESSION['application_error']); }?>
            
            		<?php if(!empty($_SESSION['application_success'])){ ?>
                		<div class="callout callout-success">
                			<p> <i class="icon fa fa-check"></i> <?php echo $_SESSION['application_success']; ?></p>
                		</div>
            		<?php  unset($_SESSION['application_success']); } ?>
        		</div>
            </div>
            
            <div class="box box-primary">
                <div class="box-header">
                    <span class="btn btn-default btn-sm pull-right filter" style="margin-right: 5px;"> Show/Hide Filter</span>
                    <h3 class="box-title">Application List</h3>
                </div>
                <div class="box-body">
                    
                    
                <div class="row" id="filter">
                    
                    <div class="col-sm-3">
                        <div class="form-group">
                            <label class="control-label" for="college_id">College Name</label>
                           <select name="college_id" class="form-control select2" style="width:100%" id="college_id" required="required">
                                <option value="">Select College Name</option>
                                <?php $statement = $pdo->prepare("SELECT * FROM `tbl_college` where status=1");
                                    $statement->execute();
                                    $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); 
                                    foreach ($location_result as $result) { ?>
                                        <option value="<?=$result['id']?>"><?=$result['college_name']?></option>
                                <?php  }  ?>
                            </select>
                        </div>
                    </div>
                    
                    <div class="col-sm-3">
                        <div class="form-group">
                            <label class="control-label" for="course_id">Course Name</label>
                               <select name="course_id" class="form-control select2" style="width:100%" id="course_id">
                                    <option value="">Select Course Name</option>
                                    
                                </select>
                        </div>
                    </div>
                    
                    <div class="col-sm-3">
                        <div class="form-group">
                            <label class="control-label" for="specialization_id">Course Specialization Name</label>
                               <select name="specialization_id" class="form-control select2" style="width:100%" id="specialization_id">
                                <option value="">Choose Specialization</option>
                                
                                </select>
                        </div>
                    </div>
                    
                    <div class="col-sm-3">
                        <div class="form-group" style="margin-top:25px">
                            <input type="button" class="btn btn-warning btn-md" id="column_filter" value="Filter" />
                        </div>
                    </div>
                
                </div>


                <div class="clearfix"></div>


                    <div class="table-responsive">
                        <table id="StData" class="table table-striped table-bordered table-condensed table-hover" style="margin-bottom:5px;">
                            <thead>
                                <tr>
                                    <td colspan="10" class="p0"><input type="text" class="form-control b0" name="search_table" id="search_table"  placeholder="Search Here" style="width:100%;background-color: darkblue;color: white;"></td>
                                </tr>
                                <tr class="active">
                                    <th>S.No</th>
                                    <th>Application Id</th>
                                    <th style="min-width:150px;">Full Name</th>
                                    <th style="min-width:150px;">Mobile Number</th>
                                    <th style="min-width:200px;">Email Address</th>
                                    <th style="min-width:250px;">College Name</th>
                                    <th style="min-width:200px;">Course Details</th>
                                    <th style="min-width:150px;">Location Details</th>
                                    <th style="min-width:150px;">Applied Date</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td colspan="10" class="dataTables_empty"><center> Loading Pls Wait Data</center></td>
                                </tr>
                            </tbody>
                            
                        </table>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
    
</section>

<?php include "footer.php";?>
<script>
    $(document).ready(function(){
        $('#filter').hide();
        $('.filter').click(function(){
            $("#filter").slideToggle();
            return false;
        });
    });
</script>

<script type="text/javascript">
<?php
$columns = "0, 1, 2, 3, 4, 5, 6, 7, 8";
$data_table = " var search_table = $('#search_table').val();
                var college_id = $('#college_id').val();
                var course_id = $('#course_id').val();
                var specialization_id = $('#specialization_id').val();
                var table = $('#StData').DataTable({
    
                        'ajax' : { 
                            url: 'data-tables/application-data-table.php', 
                            data:{search:search_table, specialization_id:specialization_id,college_id,course_id}, 
                            type: 'POST'},
                            bFilter: true,
                            bDestroy: true,
                            searching: true,pageLength: 10,
                        'buttons': [
                        { extend: 'copyHtml5', 'footer': false, exportOptions: { columns: [ $columns ] } },
                        { extend: 'excelHtml5', 'footer': false, exportOptions: { columns: [ $columns ] } },
                        { extend: 'csvHtml5', 'footer': false, exportOptions: { columns: [ $columns ] } },
                        { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': false,
                        exportOptions: { columns: [ $columns ] } },
                        { extend: 'colvis', text: 'Columns'},
                        ]
    
                    });";

?>
    $(document).ready(function() {        
        get_data();
        function get_data(){
            <?=$data_table?>
        }
        
        
        $('#college_id').on('change',function(){
            var collegeId = $(this).val();
            
            if (collegeId) {
                
                $.ajax({
                    url: 'api/get-value.php',  
                    type: 'POST',  
                    data: { field_type:'get_course',college_id: collegeId },
                    success: function(response) {
                        var response = JSON.parse(response);
                    
                        $('#course_id').empty();
                        $('#course_id').append('<option value="">Select Course Name</option>');
                        if(response.status == 'success'){
                            $.each(response.courses, function(index, course) {
                                $('#course_id').append('<option value="' + course.id + '">' + course.course_name + '</option>');
                            });
                        }else{
                           alert(response.message); 
                        }
        
                        $('#course_id').select2();  // This re-initializes the select2 dropdown
                    },
                    error: function(xhr, status, error) {
                        console.error('Error fetching courses:', error);
                    }
                });
            } else {
                $('#course_id').empty();
                $('#course_id').append('<option value="">Select Course Name</option>');
            }
        });
        
        
        $("#college_id, #course_id").on('change',function(){
            var college_id = $("#college_id").val();
            var course_id = $("#course_id").val();
            
            if (college_id && course_id) {
               
                $.ajax({
                    url: 'api/get-values.php',  
                    type: 'POST',  
                    data: { field_type:'get_course_specialization',college_id,course_id },
                    success: function(response) {
                        var response = JSON.parse(response);
                    
                        $('#specialization_id').empty();
                        $('#specialization_id').append('<option value="">Choose Specialization</option>');
                        if(response.status == 'success'){
                            $.each(response.courses, function(index, special) {
                                $('#specialization_id').append('<option value="' + special.id + '" >' + special.specialization_name + '</option>');
                            });
                        }else{
                        //   alert(response.message); 
                        }
        
                        // $('#specialization_id').select2();  // This re-initializes the select2 dropdown
                    },
                    error: function(xhr, status, error) {
                        console.error('Error fetching courses:', error);
                    }
                });
            } else {
                $('#specialization_id').empty();
                $('#specialization_id').append('<option value="">Choose Specialization</option>');
            }
        }); 
        
        $('#search_table').keyup(function() {  
            get_data();
            document.getElementById("search_table").focus();
        });
        
        $('#column_filter').on('click',function() {
            get_data();
        });
        
        $("#StData").on('click', '.course_special_delete', function() {
            if (!confirm("Confirm Want to Delete This Course Specialization?")) {
                return false;
            }
        });


    });
  

    function get_data(){
            <?=$data_table?>
    }
</script>

Zerion Mini Shell 1.0