ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/mock_test-add.php |
<?php include "header.php";?> <style> .btn-success.hover, .btn-success:active, .btn-success:hover{ background-color: darkred; border-color: darkred; } .btn-success { background-color: darkviolet; border-color: #9400d3; /*border-radius: 20px;*/ } .btn-primary { background-color: chocolate; border-color: #d2691e; } .btn-warning { background-color: tomato; border-color: #ff6347; } </style> <div class="content-wrapper" style="background:white;"> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <div> <div class="box-header"> <h3 class="box-title"><b>Add Mock Test: </b></h3> </div> <div class="box-body"> <div class="col-lg-12"> <div id="loading-div" style="display: none;"> <img src="images/gif/successfull.gif" style="margin-left: 37%;width: 25%;padding-bottom: 5%;"> </div> <div id="content-div"> <form action="" id="add_mock_test_form" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Mock Test Type</label> <select name="types" id="mock_tests" class="form-control tip select2"> <option>--- Select Mock Test Type ---</option> <option value="1">TNPSC Group 1</option> <option value="2">TNPSC Group 2/2A</option> <option value="3">TNPSC Group 4</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Test Series</label> <select name="mock_test" id="mock_test" class="form-control tip select2"> </select> </div> </div> <div id="question_div"></div> </div> <div id="sections"></div> <div class="col-md-12" style="display: flex;justify-content: center;margin-top: 3%;"> <div class="form-group"> <!--<label class="required" for="file">Action</label><br>--> <input type="submit" id="add_question" name="add_question" value="Add Test" class="btn btn-success" /> </div> </div> </form> </div> <div class="form-group" style="text-align:center;"> <a href="mock_test-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="mock_test-details.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <script> $('#mock_test').on('change', function() { $("#question_div").empty(); var value = $("#mock_test").val(); // alert(value > 0); if(value > 0){ var questions = `<div class="col-md-12"> <div class="form-group"> <label class="required" for="file">Question</label> <textarea type="text" name="question[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (A) </label> <textarea type="text" name="option_a[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (B)</label> <textarea type="text" name="option_b[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (C)</label> <textarea type="text" name="option_c[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (d)</label> <textarea type="text" name="option_d[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-12"> <div class="form-group"> <label class="required" for="file">Correct Answer</label> <select name="answer[]" id="answer" class="form-control tip select2"> <option>--- Select Correct Answer ---</option> <option value="A">Option A</option> <option value="B">Option B</option> <option value="C">Option C</option> <option value="D">Option D</option> </select> </div> </div> <span id="add_row" OnClick="ajay()" class="btn btn-success" style="background: #6bc5fa;font-weight: 800;border: 1px solid beige;border-radius: 20px; margin-top: 2%;"> <i class="bi bi-plus"></i>Add Row </span> </div>`; $("#question_div").append(questions); } }); </script> <script> $("#mock_tests").change(function(){ $("#mock_test").empty(); var exam_type = $("#mock_tests").val(); $.ajax({ url: 'add-api/add-mock_test-form.php', type: 'post', dataType: 'json', data:{type:'get_test_series',exam_type:exam_type}, cache: false, success: function (response) { console.log(response); $("#mock_test").append(response); $("#mock_test").trigger("change"); } }); }); $(document).on('click', '.remove_class', function() { $(this).closest('.row').remove(); }); function ajay() { var row = `<div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="required" for="file">Question</label> <textarea type="text" name="question[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (A) </label> <textarea type="text" name="option_a[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (B)</label> <textarea type="text" name="option_b[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (C)</label> <textarea type="text" name="option_c[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Option (d)</label> <textarea type="text" name="option_d[]" class="form-control" cols="30" rows="6" required="required" ></textarea> </div> </div> <div class="col-md-12"> <div class="form-group"> <label class="required" for="file">Correct Answer</label> <select name="answer[]" id="answer" class="form-control tip select2"> <option>--- Select Correct Answer ---</option> <option value="A">Option A</option> <option value="B">Option B</option> <option value="C">Option C</option> <option value="D">Option D</option> </select> </div> </div> <span class="btn btn-success remove_class" style="background: red;font-weight: 800;border: 1px solid beige;border-radius: 20px; margin-top: 2%;"> <i class="bi bi-plus"></i>Delete Row </span> </div></div>`; $("#sections").append(row); } $('#add_mock_test_form').on('submit', function(e){ console.log("Click And Form Working"); e.preventDefault(); $('#loading-div').show(); $('#content-div').hide(); var formData = new FormData(this); formData.append('type', 'add_mock_test_form'); $.ajax({ url: 'add-api/add-mock_test-form.php', type: 'post', dataType: 'json', data: formData, cache: false, contentType: false, processData: false, enctype: 'multipart/form-data', success: function (response) { if(response['status']==200){ alert(response['message']); $("#add_shifts .close").click(); $('#add_mock_test_form').trigger("reset"); emp_datas(); $('#loading-div').hide(); $('#content-div').show(); }else{ alert(response['message']); $('#loading-div').hide(); $('#content-div').show(); } } }); }); </script> <?php include "footer.php";?>