EVOLUTION-NINJA
Edit File: faculty_batch_list.php
<?php echo view('includes/faculty_header'); ?> <div id="page-wrapper"> <div class="row my_header"> <h3 style="padding-bottom:10px;border-bottom:2px dashed #ccc;margin-bottom:20px; font-weight: bold;">BATCH LIST</h3> <div class="col-md-12"> <div id="jaytab2" style="margin-top:6%;"> <div class="grid_div"></div> <table id="list2"> </table> <div id="pager2"></div> <div id="dialogSelectRow2" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div> </div> <!-- /#page-wrapper --> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('public/assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. <!-- We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('public/assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>" /> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <script type="text/javascript" src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>"></script> <script type="text/javascript"> $(document).ready(function() { jQuery("#list2").jqGrid({ url: "<?php echo site_url('get_faculty_batch_list') ?>", mtype: "get", datatype: "json", colNames: ['ID', 'Subject Name', 'Batch ID', 'Course Type', 'Batch Time', 'Batch Size', 'Batch Duration', 'Course Duration', 'Status', 'Action'], colModel: [{ name: 'batch_id', index: 'batch_id', width: 5, hidden: true, editable: false, key: true }, { name: 'sub_domain', index: 'sub_domain', editable: false, width: 180 }, { name: 'batch_name', index: 'batch_name', editable: false, width: 150 }, { name: 'course_type', index: 'course_type', editable: false, width: 150 }, { name: 'from_time', index: 'from_time', editable: false, width: 200 }, { name: 'batch_size', index: 'batch_size', editable: false, width: 90 }, { name: 'batch_from_to_date', index: 'batch_from_to_date', editable: false, width: 200 }, { name: 'batch_duration', index: 'batch_duration', editable: false, width: 120 }, { name: 'batch_approval_status', index: 'batch_approval_status', editable: false, width: 120 }, /* {name:'domain_name',index:'domain_name',editable:false, width:200}, {name:'sub_domain',index:'sub_domain',editable:false, width:200}, {name: 'passing_criteria', index: 'passing_criteria',editable:false, width:130}, {name: 'total_time', index: 'total_time',editable:false, width:100}, {name: 'number_of_questions', index: 'number_of_questions',editable:false, width:100}, {name: 'question_order', index: 'question_order',editable:false, width:130}, {name:'created_at', index:'created_at', width:100, formatter: 'date', formatoptions: { newformat: 'd/m/Y'}, searchoptions:{sopt:['eq']}},*/ { name: '', index: '', search: false, width: 80, editable: false, formatter: function(cellvalue, options, rowObject) { var retVal = ""; var retVal = '<a data-toggle="tooltip" title="Edit" class="" href="<?php echo site_url('edit-faculty-batch') ?>/' + rowObject.batch_id + '"><span class="glyphicon glyphicon-edit"></span></a> <a data-toggle="tooltip" title="Delete" class="delete" onclick="fun_del(' + rowObject.batch_id + ')"; href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; return retVal; } }, ], rowNum: 20, rowTotal: 2000, rowList: [20, 30], rownumbers: true, //rownumWidth: 60, pager: "#pager2", sortname: 'id', viewrecords: true, gridview: true, //autowidth: true, sortorder: "asc", shrinkToFit: true, loadonce: true, caption: "Faculty Batch List", }); $("#list2").jqGrid("setLabel", "rn", "SL"); $("#list2").jqGrid('filterToolbar', { searchOperators: false }); //for multisearch code,remove if not required $("#list2").jqGrid('navGrid', '#pager2', { edit: false, add: false, del: false, search: false, refreshstate: "current" }, {}, {}, {}, { sopt: ['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, closeAfterDelete: true, closeAfterEdit: true }, ); }); </script> <script type="text/javascript"> function edit(id) { alert(id); $("#myModal").modal('show'); $.ajax({ type: 'post', url: "<?php echo site_url('edit_faculty_batch_list'); ?>", data: { 'batch_id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { alert(response.message.domain_id); if (response.message.course_type == "Recorded") { $('input[value="Recorded"]').prop("checked", true); } else { $('input[value="Live"]').prop("checked", true); } $('#catagory option[value="' + response.message.domain_id + '"').attr('selected', 'selected'); } } }); } function fun_del(id) { var type = "post"; swal({ title: "Are you sure?", text: "You will not be able to recover this Batch!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type: type, url: "<?php echo site_url('delete_batch'); ?>", data: { 'batch_id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"]('Deleted Successfully'); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else if (response.result == 2) { toastr["error"]('User has been enrolled to this'); } else { toastr["error"]('Something Went Wrong..'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } </script> <?php echo view('includes/faculty_footer'); ?> <style type="text/css"> /* table td { font-size: 14px; } */ #jaytab3 { width: 100% !important; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color: #001a00; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 50%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 7px !important; /*background:steelblue !important;*/ color: white !important; } .ui-jqgrid-bdiv { height: auto !important; } .ui-widget-overlay { z-index: 0 !important; } /* .ui-widget-header { background: #1e7ad7 !important; } */ .ui-jqgrid-hdiv ui-state-default { /* width: 873px !important; */ cursor: default !important } ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fed22f; background: #ffe45c; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { font-weight: bold; color: black; } .ui-jqgrid { /*width: 988px !important;*/ overflow-x: scroll !important; } #jaytab2 { width: 100%; } @media only screen and (min-width:641px) and (max-width:991px) { /* .ui-jqgrid{ } */ #jaytab3 { margin-top: 0 !important; margin-left: 0 !important; /* overflow-x: hidden; */ width: 100% !important; padding-left: 0 !important; padding-right: 9px !important; } } @media only screen and (min-width:320px) and (max-width:641px) { /* .ui-jqgrid{ } */ } .ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0 !important; } .ui-jqdialog .ui-jqdialog-titlebar-close { padding: 0 !important; } </style>