EVOLUTION-NINJA
Edit File: preplannedbatches.php
<?php echo view('includes/header.php'); ?> <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/css/pre_planned_batches.css'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('public/assets/sweet_alert/sweet-alert.css'); ?>"> <script src="<?php echo base_url('public/assets/sweet_alert/sweet-alert.js'); ?>"></script> <script src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>"></script> <link rel="stylesheet" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>"> <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> <section class="preplannedbatches"> <div class="container"> <div class="col-lg-1"></div> <div class="col-lg-10 col-md-12 pre-planned-batches-div"> <!--- <div class="row preplanned_back"> <ul class=""> <li><a href="">Back</a></li> </ul> </div>--> <div class="row preplannedbatches_tabs"> <ul class="nav nav-pills"> <li><a class="chcartcolor">Cart</a></li> <li style="border-right:transparent;"><a class="chcolor">Enroll Now</a></li> </ul> </div><!--row----> <form id="user_registration_form"> <div class="row preplannedbatches_body"> <div class="tab-content"> <div id="batchtime" class="tab-pane fade in active"> <h3 class="tabs_headdings">List of selected Courses</h3> <img src="<?php echo base_url('public/assets/images/line1.png'); ?>" class="center-block"> <div class="row table-responsive"> <table class="table table-bordered list_table"> <thead class="thead-dark"> <tr> <th scope="col">#</th> <th scope="col">Course</th> <th scope="col">Course Title</th> <th scope="col">Price</th> <th scope="col">Batch/Faculty</th> <th scope="col">Session</th> <th>Action</th> </tr> </thead> <tbody id="course_tbody"> </tbody> </table> </div> <div class="row"> <!--<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6 row_tab_btn cart_back">--> <!-- <button type="button" class="submit_back">Back</button>--> <!--</div>--> <div class="col-lg-2"></div> <div class="col-lg-4 col-md-7 col-sm-7 row_tab_btn"> <a href="<?php echo site_url('Courses'); ?>"><button type="button" class="skip_bt"><i class="fa fa-angle-left" aria-hidden="true"></i> Add Course </button></a> <a data-toggle="pill" href="#enroll_now"><button type="button" class="submit_bt skip_bt" onclick="colorchange()">Enroll Now</button></a> </div> </div> </div><!--1----------------------------------------------> <div id="enroll_now" class="tab-pane fade"> <div class="row"> <div class="col-md-1"></div> <div class="col-md-8 col-sm-12" style="margin-left: 8%;"> <input class="form-control" id="course_price" name="course_price" type="hidden" value="" required> <input class="form-control" id="login_id" name="login_id" type="hidden" value="<?php session()->get('user_login_id'); ?>" required> <input class="form-control" id="trans_id" type="hidden" value="<?php echo isset($enrol_result) ? $enrol_result->mapping_id : 1; ?>" required> <div class="form-group"> <label class="control-label col-sm-4">Full Name <span style="color:red;"> *</span></label> <div class="col-sm-8"> <input class="form-control" id="full_name" minlength="3" pattern="^[a-zA-Z\s]*$" name="full_name" type="text" required=""> </div> </div> <!-- <div class="form-group"> <label class="control-label col-sm-4">Password</label> <div class="col-sm-8"> <input class="form-control" id="qualification" name="qualification" type="text"> </div> </div> --> <div class="form-group"> <label class="control-label col-sm-4">Email <span style="color:red;"> *</span></label> <div class="col-sm-8"> <input class="form-control" id="email" name="email" pattern="[A-Za-z0-9._%+-]{3,}@[a-zA-Z]{3,}([.]{1}[a-zA-Z]{2,}|[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,})" type="email" required="" readonly=""> </div> </div> <div class="form-group"> <label class="control-label col-sm-4">Phone <span style="color:red;"> *</span></label> <div class="col-sm-8"> <input class="form-control" id="user_phone" pattern="^[0-9]{10}$" name="phone_number" type="tel" required="" readonly=""> </div> </div> <div class="form-group"> <label class="control-label col-sm-4">Address </label> <div class="col-sm-8"> <textarea class="form-control" name="address" rows="2" id="address"></textarea> </div> </div> <div class="form-group"> <label class="control-label col-sm-4">Qualification</label> <div class="col-sm-8"> <input class="form-control" id="qualification" name="qualification" type="text"> </div> </div> <!-- <div class="form-group"> <label class="control-label col-sm-4">Current Occupation </label> <div class="col-sm-8"> <input class="form-control" id="current_occupation" name="current_occupation" type="text"> </div> </div> --> <div class="form-group"> <label class="control-label col-sm-4">Current Occupation <span style="color:red;"> *</span></label> <div class="col-sm-8"> <!-- <input class="form-control" id="current_occupation" name="current_occupation" type="text"> --> <select class="form-control" id="current_occupation" name="current_occupation" required=""> <option value="">Select</option> <option value="Student">Student</option> <option value="Working">Working</option> <option value="Internship">Internship</option> </select> </div> </div> <div class="form-group"> <label class="control-label col-sm-4">Present Location</label> <div class="col-sm-8"> <input class="form-control" id="present_location" name="present_location" type="text"> </div> </div> <!-- <div class="form-group"> <label class="control-label col-sm-4">Session Type</label> <div class="col-sm-8"> <label class="radio-inline"><input type="radio" id="radio1" name="session_type" value="live">Live</label> <label class="radio-inline"><input type="radio" id="radio2" name="session_type" value="recorded">Recorded</label> </div> </div> --> <div class="timings_field"></div> <div class="clr"></div> <!-- <div class="form-group"> <label class="control-label col-sm-4" style="padding-top: 7px;">Duration</label> <div class="col-sm-8"> <input class="form-control" id="" name="duration" value="45" type="text"> </div> </div> --> <div class="duration_field"></div> <div class="form-group"> <label class="control-label col-sm-4"></label> <div class="col-sm-8"> <label><input type="checkbox" name="terms_and_conditions" value="Yes" required=""> <a href="<?php echo site_url('terms-condition'); ?>" target="_blank">I agree to the terms & conditions</a></label> </div> </div> <div class="clr"></div> <div class="form-group"> <div class="col-lg-4 col-md-4 col-sm-4 col-xs-5 row_tab_btn"> <a><button type="button" onclick="back_to_cart();" class="submit_back" style="border-radius: 5px;">Back</button></a> </div> <div class="col-lg-2 col-md-2 col-sm-2"></div> <div class="col-lg-4 col-md-4 col-sm-4 col-xs-5 row_tab_btn"> <button type="submit" class="submit_bt skip_bt cartbt">Submit</button> </div> </div> </form> </div><!-- colsm8----> </div><!-- row----> </div><!--4----> </div><!-- tabcontent----> </div><!--row----> </div> <div class="col-lg-1"></div> </div><!-- container----> </section> <?php echo view('includes/footer.php'); ?> <script type="text/javascript"> $(document).ready(function() { history.pushState({ page: 1 }, "Title 1", "#no-back"); window.onhashchange = function(event) { window.location.hash = "no-back"; }; $(".chcolor").css("background-color", "#c0c0c0"); $(".chcartcolor").css("background-color", "#a6cf39"); ReadCart(); function ReadCart() { // var user_login_id = '<?php //echo $this->session->userdata('user_login_id'); ?>'; // var user_login_id = '<?php //echo $user_login_id; ?>'; var user_login_id = '<?= session('user_login_id') ?>'; if (user_login_id) { $.ajax({ type: 'get', url: '<?php echo site_url("get_user_db_cart_details") ?>', success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var table_fields = ''; var total = 0; var myVariable = []; var sl = 1; $.each(response.cart_result, function(key, val) { table_fields += '<tr>'; table_fields += '<th scope="row">' + sl + '</th>'; table_fields += '<td>'; table_fields += '<a href="<?php echo base_url('CoursesDetails'); ?>/' + val.course_id + '"><img src="<?php echo base_url('public/course_images/'); ?>/' + val.course_image + '" class="tab_course_img center-block"></a>'; table_fields += '</td>'; table_fields += '<td>' + val.course_title + '</td>'; table_fields += '<td><h4><i class="fa fa-inr" aria-hidden="true"></i> ' + val.course_price + '/-</h4></td>'; table_fields += '<td>'; $.each(val.faculty_batch, function(key_1, val_1) { if (val.selected_type == 'faculty') { table_fields += '<p>Faculty : ' + val_1.username + ''; table_fields += ', Time : ' + val_1.from_time + ' - ' + val_1.to_time + '</p>'; } else { /*table_fields += '<p>Batch Id : '+val_1.batch_name; table_fields += ', Time : '+val_1.from_time; table_fields += ', Faculty : '+val_1.username+'</p>';*/ if (val_1.from_time == 0) { table_fields += '<p>Batch Id : ' + val_1.batch_name; table_fields += ', Faculty : ' + val_1.username + '</p>'; } else { table_fields += '<p>Batch Id : ' + val_1.batch_name; table_fields += ', Time : ' + val_1.from_time; table_fields += ', Faculty : ' + val_1.username + '</p>'; } } }); table_fields += '</td>'; table_fields += '<td>'; $.each(val.faculty_batch, function(key_1, val_1) { if (val.selected_type == 'faculty') { table_fields += '<p>' + val_1.course_type + '</p>'; } else { table_fields += '<p>' + val_1.course_type + '</p>'; } }); table_fields += '</td>'; table_fields += '<td class="delete">'; table_fields += '<a class="delete_course" course_id="' + val.course_id + '" href="javascript:void(0);"><i class="fa fa-trash-o fa-lg" aria-hidden="true"></i></a>'; table_fields += '</td>'; table_fields += '</tr>'; myVariable.push(val.course_price); total += parseFloat(val.course_price); sl++; }); $("input[name=course_price]").val(total); $("#course_price").val(total); var commaSepValues = myVariable.join(','); table_fields += '<tr>'; table_fields += '<td colspan="3" style="text-align: right;">Total</td>'; table_fields += '<td colspan="4"><h4><i class="fa fa-inr" aria-hidden="true"></i> ' + total + '/-</h4></td>'; table_fields += '</tr>'; $("#course_tbody").html(table_fields); } else if (response.result == 2) { $("#course_tbody").empty(); } else { $("#course_tbody").empty(); 1441 + 1442 + 1081 + 1082 } } }); } } $(".list_table").on("click", ".delete_course", function() { var course_id = $(this).attr('course_id'); var test = $(this); var row = $(this).closest('tr'); swal({ title: "Are you sure?", text: "You will not be able to recover this course!", 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(); test.attr('disabled', 'disabled'); test.text("Deleting..."); $.ajax({ type: 'post', url: '<?php echo site_url("delete_course_from_cart") ?>', data: { course_id: course_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); ReadCart(); cart_count(); OnloadReadCookieData(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }); function OnloadReadCookieData() { if (user_login_id) { $.ajax({ type: 'get', url: '<?php echo site_url("read_cart_data_from_db") ?>', success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { ReadDBCart(response.cart_result); } else { $(".cart_div").empty(); } } }); } } function ReadDBCart(cart_result) { var cart_fields = ''; cart_fields += '<ul class="dropdown-menu submenu_one cart" id="main_cart">'; $.each(cart_result, function(key, val) { cart_fields += '<li><a href=""><span>' + val.course_title + '</span> <small class="pull-right"><i class="fa fa-inr" aria-hidden="true"></i> ' + val.course_price + '/-</small></a></li>'; }); cart_fields += '</ul>'; $(".cart_div").html(cart_fields); } var order_id = $("#trans_id").val(); var id = $("#trans_id").val(); var course_type = $("input[name=course_type]").val(); //CallSessionType(course_type); function CallSessionType(course_type) { var session_type = course_type; if (session_type == "live") { $("#radio1").prop("checked", true); var duration = ''; duration += '<div class="form-group">'; duration += '<label class="control-label col-sm-4" style="padding-top: 7px;">Duration</label>'; duration += '<div class="col-sm-8">'; duration += '<input class="form-control" id="" name="duration" value="45" type="text" readonly>'; duration += '</div>'; duration += '</div>'; $(".duration_field").html(duration); var button = ''; button += '<div class="col-sm-12" style="margin-bottom:10px;">'; button += '</div>'; var default_fields = ''; default_fields += '<div class="row land_owner_a">'; default_fields += '<label class="control-label col-sm-4">Available Timings</label>'; default_fields += '<div class="col-sm-3">'; default_fields += '<input id="from_timepicker00" type="text" class="form-control" name="from_time[]" placeholder="From Time" required />'; default_fields += '</div>'; default_fields += '<div class="col-sm-3">'; default_fields += '<input id="to_timepicker00" type="text" class="form-control" name="to_time[]" placeholder="To Time" required />'; default_fields += '</div>'; default_fields += '<div class="col-sm-2">'; default_fields += '<button type="button" class="btn btn-default center-block add_fields">Add</button>'; default_fields += '</div>'; $(".timings_field").html(button); $('.timings_field').append(default_fields); $('#from_timepicker00').timepicki(); $('#to_timepicker00').timepicki(); var i = 0; $('.add_fields').click(function(e) { var fields = ''; fields += '<div class="row land_owner_a">'; fields += '<label class="control-label col-sm-4"></label>'; fields += '<div class="col-sm-3">'; fields += '<input id="from_timepicker' + i + '" type="text" class="form-control" name="from_time[]" placeholder="From Time" required />'; fields += '</div>'; fields += '<div class="col-sm-3">'; fields += '<input id="to_timepicker' + i + '" type="text" class="form-control" name="to_time[]" placeholder="To Time" required />'; fields += '</div>'; fields += '<div class="form-group col-sm-2"><a href="javascript:void(0);" class="remove_fields"><span class="glyphicon glyphicon-remove"></span></a></div>'; fields += '</div">'; $('.timings_field').append(fields); $('#from_timepicker' + i).timepicki(); $('#to_timepicker' + i).timepicki(); $(".remove_fields").click(function() { $(this).closest('.row').remove(); }); i = i + 1; }); } else { $("#radio2").prop("checked", true); $(".timings_field").empty(); $(".duration_field").empty(); } } $("input[name=session_type]").change(function() { var session_type = $(this).val(); CallSessionType(session_type); }); UserDetails(); function UserDetails() { // alert("function working") // <?php if (isset($login_id)) : ?> // var login_id = '<?= $login_id ?>'; // console.log(login_id+"login chechking") // <?php endif; ?> // alert("function working") var login_id = '<?php $session = session(); echo $session->get('user_login_id'); ?>' $.ajax({ type: 'post', url: '<?php echo site_url("check_registered_user_email") ?>', data: { login_id: login_id }, success: function(response) { try { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#login_id").val(response.data.login_id); $("#user_phone").val(response.data.phone_number); $("#email").val(response.data.email); $("#full_name").val(response.data.full_name); $("#address").val(response.data.address); $("#qualification").val(response.data.qualification); $("#current_occupation").val(response.data.current_occupation); $("#present_location").val(response.data.present_location); } else { console.log("User not found."); } } catch (error) { console.error("Error parsing JSON:", error); } }, error: function(xhr, status, error) { console.error("AJAX request error:", status, error); } }); } $('#user_registration_form').submit(function(e) { e.preventDefault(); var cart_value = $("#course_tbody").text(); if (cart_value == "") { toastr["error"]("No course in your cart.Please select atleast one course"); } else { formdata = new FormData($(this)[0]); $(".reg_submit").attr('disabled', 'disabled'); $(".reg_submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("complete_user_registration") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); $('#user_registration_form')[0].reset(); $(".reg_submit").text("Submit"); $(".reg_submit").removeAttr('disabled'); $("#myModal").modal('hide'); var total_amount = $("#course_price").val(); alert(order_id); //window.location.href = "http://mannaconstructions.in/nparrots/payment/pgRedirect.php?ORDER_ID="+order_id+"&CUST_ID="+id+"&TXN_AMOUNT="+total_amount; // window.location.href = "http://mannaconstructions.in/nparrots/payment/pgRedirect.php?ORDER_ID="+order_id+"&CUST_ID="+id+"&TXN_AMOUNT="+total_amount; // window.location.href = '<?php echo site_url('payment'); ?>/' + order_id + '/' + total_amount; window.location.href = '<?php echo site_url('user-dashboard'); ?>/' + order_id + '/' + total_amount; } else if (response.result == 2) { toastr["error"](response.message); $(".reg_submit").text("Submit"); $(".reg_submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".reg_submit").text("Submit"); $(".reg_submit").removeAttr('disabled'); } } }); } }); }); function colorchange() { $(".chcolor").css("background-color", "#a6cf39"); $(".chcartcolor").css("background-color", "#c0c0c0"); } function back_to_cart() { window.location = "<?php echo site_url('cart-details'); ?>" } </script> <style> .skip_bt{ border-radius: 5px; } .preplannedbatches_tabs { padding-left: 33.5%; } .pre-planned-batches-div{ border-radius: 5px; /* background-color: #CAE288; */ } .submit_back { background: #a6cf39; color: white; border: 1px solid silver; width: 100%; box-shadow: 0px 1px 8px silver; padding: 9px; font-weight: 600; text-transform: uppercase; font-size: 16px; } .row_tab_btn { margin-left: 15%; } @media only screen and (min-width:320px) and (max-width:640px) { .preplannedbatches_tabs { padding-left: 0%; } .cart_back { margin-bottom: 10px; } .cart_back button { width: 94%; } } </style>