ok

Mini Shell

Direktori : /home2/selectio/public_html/thedentalpark.com/admin/
Upload File :
Current File : /home2/selectio/public_html/thedentalpark.com/admin/specialization-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_course_specialization 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_course_specialization WHERE id=?");
        $result=$statement->execute(array($id));
        if($result) {
            $_SESSION['special_success_message'] = 'Course Specialization Details Delete Successfully' ;
            header("Location:specialization-list.php");
                exit;
        } else {
             $_SESSION['special_error_message'] = 'Error Occured Not Delete';
             header("Location: specialization-list.php");
             exit;
        }
        
	
	}else{
	  $_SESSION['special_error_message'] = 'Course Specialization Details Not Delete';
     header("Location: specialization-list.php");
     exit;  
	}

}

?>

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

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


<section class="content">
    
    <div class="row">
        <div class="col-xs-12">
             <?php if(!empty($_SESSION['special_error_message'])) { ?>
        		<div class="callout callout-danger">
        			<p><?php echo $_SESSION['special_error_message']; ?></p>
        		</div>
    		<?php  unset($_SESSION['special_error_message']); }?>
    
    		<?php if(!empty($_SESSION['special_success_message'])){ ?>
        		<div class="callout callout-success">
        			<p><?php echo $_SESSION['special_success_message']; ?></p>
        		</div>
    		<?php  unset($_SESSION['special_success_message']); } ?>
		</div>
    </div>
    
    <div class="row">
        <div class="col-xs-12">
            <div class="box box-primary">
                <div class="box-header">
                    <a  href="specialization-add.php" class="btn btn-success btn-sm pull-right"><i class="fa fa-plus-circle"></i> Add Course Specialization</a>
                    <span class="btn btn-default btn-sm pull-right filter" style="margin-right: 5px;"> Show/Hide Filter</span>
                    <h3 class="box-title">Course Specialization 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="status">Course Name</label>
                               <select name="course_id" class="form-control select2" style="width:100%" id="course_id">
                                    
                                </select>
                        </div>
                    </div>
                    
                    <div class="col-sm-3">
                        <div class="form-group">
                            <label class="control-label" for="status">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>
                                <option value="">All Status</option>
                            </select>
                        </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 style="width:100px;">Actions</th>
                                    <th>S.No</th>
                                    <th>College Name</th>
                                    <th>Course Name</th>
                                    <th>Course Specialization</th>
                                    <th>Status</th>
                                    <th>Created 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 status = $('#status').val();
                var table = $('#StData').DataTable({
    
                        'ajax' : { 
                            url: 'data-tables/course-specialization-data-table.php', 
                            data:{search:search_table, status:status,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>');
            }
        });
        
        $('#search_table').keyup(function() {  
            get_data();
            document.getElementById("search_table").focus();
        });
        
        $('#status, #college_id, #course_id').change(function() {
            get_data();
        });
        
        $("#StData").on('click', '.course_special_delete', function() {
            if (!confirm("Confirm Want to Delete This Course Specialization?")) {
                return false;
            }
        });


    });
    function DynamicInActive(id){
            var result = confirm("Confirm Want to In-Active This Course Specialization?");
            if (result) {
                    $.ajax({
                    type: 'POST',
                    url: 'api/delete.php',
                    data: {type:'dynamic_in_active',delete_id:id, table: 'tbl_course_specialization'},              
                    success: function(response) {
                        console.log(response); 
                        get_data();
                    }
                });
            }
    }
    function DynamicActive(id){
            var result = confirm("Confirm Want to Active This Course Specialization?");
            if (result) {
                $.ajax({
                    type: 'POST',
                    url: 'api/delete.php',
                    data: {type:'dynamic_active',delete_id:id, table:'tbl_course_specialization'},                  
                    success: function(response) {
                        console.log(response); 
                        get_data();
                    }
                });
            }
    }

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

Zerion Mini Shell 1.0