EVOLUTION-NINJA
Edit File: enrolled_institution_faculty_list.php
<?php echo view('includes/admin_header.php'); $url = $this->request->uri->getSegment(2); ?> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('public/assets/toastr/toastr.min.css'); ?>"> <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" href="<?php echo base_url('public/assets/website_assets/css/innerpage.css'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('public/assets/sweet_alert/sweet-alert.css'); ?>"> <script type="text/javascript" src="<?php echo base_url('public/assets/toastr/toastr.min.js'); ?>"></script> <script type="text/ecmascript" src="<?php echo base_url('public/assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/ecmascript" src="<?php echo base_url('public/assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <script src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <script src="<?php echo base_url('public/assets/sweet_alert/sweet-alert.js'); ?>"></script> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1 style="padding-bottom:10px;border-bottom:2px dashed #ccc;margin-bottom:20px;"> Faculty List <small></small> </h1> </section> <!-- Main content --> <!-- Button trigger modal --> <section class="content"> <div id="jaytab" style="margin-top:3%" class="grid"> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add Comment</h4> </div> <div class="modal-body"> <form id="add_comment" class="comment_form"> <input type="hidden" name="mapping_id" class="mapping_id"> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-12"> <label class="col-sm-4">Comment</label> <input type="hidden" name="faculty_id" class="faculty_id"> <textarea row="3" cols="40" name="comment" required="required"></textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> <div class="modal fade" id="approval_subjects" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content" style="width: 680px;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Added Subjects</h4> </div> <div class="modal-body"> <form id="approve_subjects"> <div class="row land_owner_a col-sm-12"> <div class="col-sm-4 sub_categories"> </div> <!-- row 1--> <div class="col-sm-4 session_type"> </div> <div class="col-sm-4 sub_timings"> </div> </div> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Approve</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> </section> </div> <!--- col-sm-8 --> <script type="text/javascript"> $(document).ready(function() { var institution_id = '<?php echo $url; ?>'; CallGrid(); function CallGrid(access_rights_global, access_result_global) { jQuery("#list2").jqGrid({ url: "<?php echo site_url('get_enrolled_institution_faculty_admin') ?>/" + institution_id, mtype: "get", datatype: "json", colNames: ['SI', 'Name', 'Email', 'Phone', 'Qualification', 'Registered Date', 'Status', 'Action'], colModel: [{ name: 'id', index: 'id', width: 10, hidden: true, editable: false, key: true }, { name: 'fullname', index: 'fullname', editable: false, width: 30 }, { name: 'email', index: 'email', editable: false, width: 50 }, { name: 'phone', index: 'phone', editable: false, width: 30 }, { name: 'qualification', index: 'qualification', editable: false, width: 30 }, { name: "created_at", index: "created_at", editable: false, width: 40 }, { name: 'approval_status', index: 'approval_status', editable: false, width: 35 }, { name: '', index: '', search: false, width: 20, editable: false, formatter: function(cellvalue, options, rowObject) { var retVal = ""; var retVal = ' <a data-toggle="tooltip" title="View" class="" href="<?php echo site_url('view-institution-faculty-details'); ?>/' + rowObject.login_id + '"><span class="glyphicon glyphicon-search"></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 List", }); $("#list2").jqGrid("setLabel", "rn", "SL"); $("#list2").jqGrid('filterToolbar', { searchOperators: false, stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); //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 }, ); } }); function fun_del(id) { var type = "post"; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('.delete' + id + '').text('Deleting..'); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type: type, url: "<?php echo site_url('delete_faculty_details'); ?>", data: { '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 { toastr["error"]('Something Went Wrong..'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_approve(id, mapping_id) { var type = "post"; $.ajax({ type: type, url: "<?php echo site_url('approve_faculty_subjects'); ?>", data: { 'id': id, 'mapping_id': mapping_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var fields = ''; fields += '<input type="hidden" name="id" value="' + id + '">'; fields += '<input type="hidden" name="mapping_id" value="' + mapping_id + '">'; fields += '<h4 style="margin-left: 8%;" class="timings">Course Details</h4>'; $.each(response.message.result, function(key, val) { fields += '<div class="form-group col-sm-12 col-md-12 checkbox">'; // fields += '<input type="checkbox" name="sub_domain_id[]" value="'+val.sub_domain_id+'" class="sub_domain_id"> ' +val.sub_domain+''; fields += '<label><input type="checkbox" name="sub_domain_id[]" value="' + val.sub_domain_id + '" class="sub_domain_id"> ' + val.sub_domain + '</label>' fields += '</div>'; }); var session_fields = ''; var time_fields = ''; time_fields += '<input type="hidden" name="id" value="' + id + '">'; time_fields += '<input type="hidden" name="mapping_id" value="' + mapping_id + '">'; time_fields += '<h4 style="margin-left: 8%;" class="timings">Course Timings</h4>'; if (response.message.course_type == 'fullday') { session_fields += '<h4 style="margin-left: 8%;" class="timings">Session Type</h4>'; session_fields += '<input type="hidden" name="available_type" value="fullday">'; session_fields += '<div class="form-group session_type_p">'; time_fields += '<p style=""> Fullday</p>'; session_fields += '</div>'; session_fields += '<input type="hidden" name="time_id[]" value="' + response.message.timings.time_id + '">'; var course_type = jQuery.parseJSON(response.message.timings.course_type); session_fields += '<div class="form-group col-sm-offset-2 col-sm-12 col-md-12 checkbox">'; $.each(course_type, function(x, y) { session_fields += '<label><input type="checkbox" name="course_type[]" value="' + y + '" class="sub_domain_id"> ' + y.charAt(0).toUpperCase() + y.slice(1).toLowerCase() + '</label>'; }); session_fields += '</div>'; } else if (response.message.course_type == 'recorded') { session_fields += '<h4 style="margin-left:10%;" class="timings">Session Type</h4>'; session_fields += '<div class="form-group session_type_p">'; session_fields += '<p style="">Recorded</p>'; session_fields += '</div>'; time_fields += '<input type="hidden" name="available_type" value="recorded">'; time_fields += '<div class="form-group col-sm-offset-2 col-sm-12 col-md-12 checkbox">'; time_fields += '<input type="hidden" name="time_id[]" value="' + response.message.timings.time_id + '">'; var course_type = jQuery.parseJSON(response.message.timings.course_type); $.each(course_type, function(x, y) { time_fields += '<label><input type="checkbox" name="course_type[]" value="' + y + '" class="sub_domain_id"> ' + y.charAt(0).toUpperCase() + y.slice(1).toLowerCase() + '</label>'; }); time_fields += '</div>'; } else { session_fields += '<h4 style="margin-left: 8%;" class="timings">Session Type</h4>'; session_fields += '<div class="form-group session_type_p">'; session_fields += '<p style="">Timings</p>'; session_fields += '</div>'; time_fields += '<input type="hidden" name="available_type" value="timings">'; $.each(response.message.timings, function(vx, vy) { time_fields += '<div class="form-group col-sm-12 col-md-12 checkbox">'; time_fields += '<input type="checkbox" name="course_type[]" value="' + vy.time_id + '" class="sub_domain_id"> ' + vy.from_time + ' To ' + vy.to_time; time_fields += '</div>'; }); } $('.sub_categories').html(fields); $('.sub_timings').html(time_fields); $('.session_type').html(session_fields); $("#approval_subjects").modal("show"); } else { toastr["error"](response.message); } } }); } $('#approve_subjects').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); var sub_domain = $('input[name="sub_domain_id[]"]:checked').map(function(_, el) { return $(el).val(); }).get(); var time_id = $('input[name="course_type[]"]:checked').map(function(_, el) { return $(el).val(); }).get(); if (sub_domain != "") { if (time_id != "") { swal({ title: "Are you sure?", text: "Do You Want to Approve!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, approve it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $(".submit").text("Approving.."); $.ajax({ type: 'post', url: '<?php echo site_url("approve_faculty") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); $(".submit").text("Approve"); $("#approval_subjects").modal("hide"); toastr["success"](response.message); $('#approval_subjects')[0].reset(); $(".submit").removeAttr('disabled'); } else { $("#approval_subjects").modal("hide"); toastr["error"](response.message); $(".submit").text("Approve"); $(".submit").removeAttr('disabled'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { toastr["error"]('Please select timings'); } } else { toastr["error"]('Please select subject'); } }); function fun_return(id, mapping_id) { var type = "post"; swal({ title: "Are you sure?", text: "Do You Want to Return!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Return it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('.faculty_id').val(id); $('.mapping_id').val(mapping_id); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $("#myModal").modal("show"); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('#add_comment').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("add_returned_comment") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#myModal").modal("hide"); toastr["success"](response.message); $('.comment_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { $("#myModal").modal("hide"); toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); </script> <?php echo view('includes/admin_footer') ?> <style type="text/css"> .session_type_p p { margin-left: 50px; margin-top: 20px; } #pager2_left { display: none !important; } #pager2_center { padding-left: 350px !important; } .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } #FrmGrid_list2 { 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: 43%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 27px !important; background: #1e7ad7 !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 { 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; } #jaytab { overflow-x: scroll; } @media only screen and (min-width:320px) and (max-width:640px) { #jaytab { width: auto !important; overflow-x: scroll !important; } .ui-jqgrid ui-widget ui-widget-content ui-corner-all { width: 900px !important; } .ui-jqgrid-view { width: 900px !important; } .ui-jqgrid-hdiv { width: 900px !important; } .ui-jqgrid-htable { width: 900px !important; } .ui-jqgrid-bdiv { width: 900px !important; } #list2 { width: 900px !important; } #pager2 { width: 900px !important; } } @media only screen and (min-width:641px) and (max-width:991px) { #jaytab { width: auto !important; overflow-x: scroll !important; } .ui-jqgrid ui-widget ui-widget-content ui-corner-all { width: 900px !important; } .ui-jqgrid-view { width: 900px !important; } .ui-jqgrid-hdiv { width: 900px !important; } .ui-jqgrid-htable { width: 900px !important; } .ui-jqgrid-bdiv { width: 900px !important; } #list2 { width: 900px !important; } #pager2 { width: 900px !important; } } </style>