EVOLUTION-NINJA
Edit File: faculty_batch_form.php
<?php echo view('includes/faculty_header'); ?> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.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/css/timingfield.css'); ?>"/> <script type="text/javascript" src="<?php echo base_url('public/assets/js/timingfield.js'); ?>"></script> --> <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/website_assets/css/timepicki.css'); ?>" /> <script type="text/javascript" src="<?php echo base_url('public/assets/website_assets/js/timepicki.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> <div id="page-wrapper"> <div class="my_header"> <h3 style="padding-bottom:10px;border-bottom:2px dashed #468662;margin-bottom:20px; font-weight: bold;">ADD BATCH</h3> <a href="javascript:history.back()" class="btn btn-primary" style="float:right; margin-right: 50px;">Back</a> <div class="col-md-2"></div> <div class="col-md-8"> <form class="form-horizontal faculty_add_batch" id="faculty_add_batch"> <input type="hidden" class="form-control col-sm-8" name="faculty_login_id" value="<?php echo session()->get('faculty_login_id'); ?>"> <input type="hidden" class="form-control col-sm-8" name="login_id" value="<?php echo session()->get('faculty_institution_id'); ?>"> <input type="hidden" value="<?php echo $login_id; ?>" id="faculty_id" class="faculty_id" /> <div class="form-group"> <label class="control-label col-sm-4">Course Type</label> <div class="col-sm-8"> <input class="course_type" style="width: 21% !important;margin-top: 10px;" type="radio" value="Live" name="course_type" onclick="select_course_type('live');" required="">Live</label> <input class="course_type" style="width: 21% !important;margin-top: 10px;" type="radio" value="Recorded" name="course_type" onclick="select_course_type('recorded');" required="">Recorded</label> </div> </div> <div class="form-group"> <label class="control-label col-sm-4">Select Category</label> <div class="col-sm-8"> <select class="form-control" id="catagory" name="domain_id" required> <option value="">Select Category</option> <?php if ($domain) { foreach ($domain as $val) { ?> <option value="<?php echo $val->domain_id; ?>"><?php echo $val->domain_name; ?></option> <?php } } ?> </select> </div> </div> <div class="form-group sub_cate_div"> <label class="control-label col-sm-4">Select Sub Category</label> <div class="col-sm-8 "> <select class="form-control sub_category_list" id="sub_domain_id" name="sub_domain_id" required> </select> </div> </div> <div class="form-group fac_avail_timings" style="display: none;"> <label class="control-label col-sm-4">Available Timings</label> <div class="col-sm-8 "> <select class="form-control time_list" id="from_time" name="from_time" required> </select> </div> </div> <div class="form-group duration_div"> </div> <br> <div class="form-group timings_div" style="margin-bottom: 15px !important;"> <!-- <label class="control-label col-sm-4">Duration</label> <div class="col-sm-8"> <input type="text" class="form-control" name="duration"> </div> --> </div> <div class="form-group"> <label class="control-label col-sm-4">Batch Name</label> <div class="col-sm-8"> <input type="text" class="form-control" name="batch_name" value="<?php echo $batch; ?>" required readonly> </div> </div> <div class="form-group"> <label class="control-label col-sm-4">Batch Size</label> <div class="col-sm-8"> <!-- <input type="number" class="form-control" name="batch_size" min="1" required> --> <input class="batch_size" style="width: 21% !important;margin-top: 10px;" type="radio" value="Fixed" name="batch_type" onclick="select_batch_size('fixed');" required="">Fixed</label> <input class="batch_size" style="width: 21% !important;margin-top: 10px;" type="radio" value="Range" name="batch_type" onclick="select_batch_size('range');" required="">Range</label> <!-- <input type="number" class="form-control" name="batch_size" min="1" required> --> </div> </div> <div class="form-group fixed" style="display: none;"> <label class="control-label col-sm-4">No of participants</label> <div class="col-sm-8"> <input type="number" class="form-control" name="batch_fixed_size" min="1" placeholder="Enter Batch size like 10 etc."> </div> </div> <div class="form-group range" style="display: none;"> <label class="control-label col-sm-4">Range</label> <div class="col-sm-8"> <select type="text" class="form-control" name="batch_range_size"> <option value="">Select Range</option> <option value="1 - 1">1 - 1</option> <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> <option value="60">60</option> <option value="70">70</option> <option value="80">80</option> <option value="90">90</option> <option value="100">100</option> </select> </div> </div> <div class="form-group batch_from_date"> <label class="control-label col-sm-4">Start Date</label> <div class="col-sm-8"> <input type="" id="from_date" name="batch_from_date" class="form-control" required="" readonly /> </div> </div> <div class="form-group batch_to_date"> <label class="control-label col-sm-4">End Date</label> <div class="col-sm-8"> <input type="" id="to_date" name="batch_to_date" class="form-control" required="" readonly /> </div> </div> <div class="form-group" style="text-align:center;padding-top:30px;"> <!-- <button type="submit" class="btn btn-primary submit">Submit</button> --> <div class=" row view_faculty" style="margin-left:30%;"> <div class="col-sm-6"> <center><button type="submit" class="btn btn-primary submit">Submit</button></center> </div> <div class="col-sm-6"> <button type="button" id="cancel" class="btn btn-danger center-block cancel cancel_1" style="margin-right:50%;">Cancel</button> </div> </div> </div> </form> </div> </div> <div id="jaytab" style="margin-top:5%" 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> <!-- jQuery --> <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', 'Action', 'Subject Name', 'Batch ID', 'Course Type', 'Batch Time', 'Batch Size', 'Batch Duration', 'Course Duration', 'Status', 'Batch Status', 'Created By'], colModel: [ { name: 'batch_id', index: 'batch_id', width: 5, hidden: true, editable: false, key: true }, { 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; } }, { name: 'sub_domain', index: 'sub_domain', editable: false, width: 150 }, { 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: 180 }, { name: 'batch_size', index: 'batch_size', editable: false, width: 75 }, { 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: 100 }, { name: 'batch_status', index: 'batch_status', editable: false, width: 90 }, { name: 'created_by', index: 'created_by', editable: false, width: 100 }, /* {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']}},*/ ], 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, 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 }, ); }); </script> <script type="text/javascript"> $(document).ready(function() { var dateToday = new Date(); $('#from_date').datepicker({ dateFormat: 'dd-mm-yy', minDate: dateToday, //numberOfMonths: 2, onSelect: function(selected) { $("#to_date").datepicker("option", "minDate", selected) } }); $('#to_date').datepicker({ dateFormat: 'dd-mm-yy', onSelect: function(selected) { $("#from_date").datepicker("option", "maxDate", selected) } }); }); function select_course_type(str) { if (str == 'live') { $('.fac_avail_timings').show(); $('.duration_div').show(); } else { $('.fac_avail_timings').hide(); $('.duration_div').show(); } } function select_batch_size(str) { if (str == 'fixed') { $('.fixed').show(); $('.range').hide(); } else { $('.fixed').hide(); $('.range').show(); } } </script> <script type="text/javascript"> $(document).ready(function() { $('.fixed').hide(); $('.range').hide(); $("#catagory").change(function() { var domain_id = $("#catagory").val(); $.ajax({ url: "<?php echo site_url('get_sub_domain') ?>", type: "POST", data: { 'domain_id': domain_id }, async: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var content = ''; content += '<option value="0">Select</option>'; $.each(response.message, function(idx, vx) { content += '<option value="' + vx.sub_domain_id + '">' + vx.sub_domain + '</option>'; }); $('.sub_category_list').html(content); } else { $('.sub_category_list').empty(); } } }); }); $(document).on('change', '#sub_domain_id', function() { var sub_domain_id = $('#sub_domain_id').val(); var domain_id = $('#catagory').val(); var faculty_id = $('#faculty_id').val(); $.ajax({ url: "<?php echo site_url('get_not_enrolled_fac_timings') ?>", type: "POST", data: { 'id': faculty_id, 'sub_domain_id': sub_domain_id, 'domain_id': domain_id }, async: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var content = ''; content += '<option value="0">Select Time</option>'; $.each(response.message, function(idx, vx) { if (vx.available_type == 'timings') { content += '<option value="' + vx.from_time + ' - ' + vx.to_time + '">' + vx.from_time + ' - ' + vx.to_time + '</option>'; } else { content += '<option value="full_day">Full Day</option>'; } }); $('.time_list').html(content); $.ajax({ url: "<?php echo site_url('get_training_plan_duration') ?>", type: "POST", data: { 'faculty_id': faculty_id, 'sub_domain_id': sub_domain_id, 'domain_id': domain_id }, async: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var content = ''; //$.each(response.message,function(idx,vx){ content += '<label class="control-label col-sm-4">Duration(In hrs)</label>'; content += '<div class="col-sm-8">'; content += '<input type="text" class="form-control duration" name="batch_duration" value="' + response.message + '" readonly>'; content += '</div>'; //}); $('.duration_div').html(content); } else { } } }); } else { //alert(); //toastr["error"](response.message); toastr["error"](response.message); setInterval(function() { location.reload(); }, 1000); $('.course_form')[0].reset(); $('.duration_div').hide(); $('.fixed').hide(); $('.range').hide(); $('.fac_avail_timings').hide() //setInterval(function(){ location.reload(); }, 2000); } } }); }); $('.faculty_add_batch').submit(function(e) { e.preventDefault(); var duration = $(".duration").val(); if (duration != '00:00') { formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("faculty_add_batch") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); $('.faculty_add_batch')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $('.duration_div').hide(); $('.fixed').hide(); $('.range').hide(); $('.fac_avail_timings').hide() setInterval(function() { location.reload(); }, 1000); } else if (response.result == 2) { toastr["error"](response.message); setInterval(function() { location.reload(); }, 1000); $('.faculty_add_batch')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $('.duration_div').hide(); $('.fixed').hide(); $('.range').hide(); $('.fac_avail_timings').hide() } else if (response.result == 3) { toastr["error"](response.message); setInterval(function() { location.reload(); }, 1000); $('.course_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $('.duration_div').hide(); $('.fixed').hide(); $('.range').hide(); $('.fac_avail_timings').hide() } else { toastr["error"](response.message); setInterval(function() { location.reload(); }, 1000); $('.course_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $('.duration_div').hide(); $('.fixed').hide(); $('.range').hide(); $('.fac_avail_timings').hide() } } }); } else { toastr["error"]('Duration is not added by faculty in training plan!'); setInterval(function() { location.reload(); }, 1000); } }); }); </script> <script type="text/javascript"> 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(); } }); } const cancelButton = document.getElementById("cancel"); // Add a click event listener to the cancel button cancelButton.addEventListener("click", function() { // Clear the form data document.forms[0].reset(); }); </script> <?php echo view('includes/faculty_footer'); ?> <style> #page-wrapper{ background-image: url(public/assets/website_assets/images/banner.png); background-repeat: no-repeat; background-size: cover; } #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 { /* 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 .ui-jqgrid-bdiv { overflow-y: scroll; overflow-x: scroll ; } .ui-jqgrid-htable{ width: 100% !important; } #list2{ width: 100% !important; } */ .timepicker_wrap { top: 35px !important; } #ui-datepicker-div { z-index: 999 !important; } #jaytab { width: 100% !important; overflow-x: scroll !important; } @media only screen and (min-width:320px) and (max-width:640px) { #jaytab { width: 100% !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; } .ui-jqgrid { width: 100% !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; } } .faculty_add_batch{ margin-right: 25%; } @media only screen and (min-width:992px) and (max-width:1258px) { #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>