ok
Direktori : /home2/selectio/www/tnpsctestbatch.com/admin/ |
Current File : /home2/selectio/www/tnpsctestbatch.com/admin/topic-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 New Topic: </b></h3> </div> <div class="box-body"> <div class="col-lg-12"> <div id="content-div"> <form action="" id="add_topic_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">Select Subject</label> <select name="subject_type" id="subject_type" onchange="subject()" class="form-control tip select2"> <option>--- Select Subject ---</option> <?php $subject_query = $pdo->prepare("SELECT * FROM tbl_subject WHERE status=1"); $subject_query->execute(); $result = $subject_query->fetchAll(PDO::FETCH_ASSOC); foreach($result as $subject){ ?> <option value="<?=$subject['id']?>"><?=$subject['subject_name']?></option> <?php } ?> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="file">Select Standard</label> <select name="standard_type" id="standard_type" class="form-control tip select2"> <option>--- First Select Subject ---</option> </select> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Syllabus/Topic</label> <input type="Text" name="syllabus[]" id="syllabus" value="" placeholder="Enter Syllabus" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Title</label> <input type="Text" name="topic[]" id="topic" value="" placeholder="Enter Topic" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Group</label> <input type="Text" name="group_topic[]" id="group_topic" value="" placeholder="Enter group_topic" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Off Page Description Content</label> <input type="Text" name="discription_content[]" id="discription_content" value="" placeholder="Enter Description Content" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Off Page Description Keyword</label> <input type="Text" name="discription_keyword[]" id="discription_keyword" value="" placeholder="Enter Description keyword" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Off Page Description Title</label> <input type="Text" name="discription_title[]" id="discription_title" value="" placeholder="Enter Description Title" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file"> On page Content</label> <input type="Text" name="topic_content[]" id="topic_content" value="" placeholder="Enter On Page Content" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <span id="add_row" class="btn btn-success" style="margin-top: 7%;background: #6bc5fa;font-weight: 800;border: 1px solid beige;border-radius: 20px;"> <i class="bi bi-plus"></i>Add Row </span> </div> </div> <div class="row"> <div id="add_topic_row"></div> </div> <div class="col-md-12" style="display: flex;justify-content: center;margin-top: 3%;"> <div class="form-group"> <input type="submit" id="add_topic" name="add_topic" value="Add Topic" class="btn btn-success" /> </div> </div> </form> </div> <div id="loading-div" style="display: none;"> <img src="images/gif/successfull.gif" style="margin-left: 37%;width: 25%;padding-bottom: 5%;"> </div> <div class="form-group" style="text-align:center;"> <a href="topic-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="topic-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> $(document).on('click', '.remove_class', function() { $(this).closest('.row').remove(); }); $('#add_row').on('click', function() { var row = `<div class="row"> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Topic</label> <input type="Text" name="topic[]" id="topic" value="" placeholder="Enter Topic" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Syllabus</label> <input type="Text" name="syllabus[]" id="syllabus" value="" placeholder="Enter Syllabus" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Group</label> <input type="Text" name="group_topic[]" id="group_topic" value="" placeholder="Enter group_topic" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Off Page Description Content</label> <input type="Text" name="discription_content[]" id="discription_content" value="" placeholder="Enter Description Content" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Off Page Description Keyword</label> <input type="Text" name="discription_keyword[]" id="discription_keyword" value="" placeholder="Enter Description keyword" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file">Off Page Description Title</label> <input type="Text" name="discription_title[]" id="discription_title" value="" placeholder="Enter Description Title" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="file"> On page Content</label> <input type="Text" name="topic_content[]" id="topic_content" value="" placeholder="Enter On Page Content" class="form-control tip" autocomplete="off" required="required" /> </div> </div> <div class="col-md-3"> <span class="remove_class btn btn-danger" style="font-weight: 800;border: 1px solid beige;border-radius: 20px;margin-top: 25px;">Delete Row</span> </div> </div>`; $("#add_topic_row").append(row); }); </script> <script> function subject(){ $("#standard_type").empty(); var subject = $("#subject_type").val(); $.ajax({ url:'api/select_standard.php', type:'POST', data:{type:'standard',subject:subject}, success:function(data) { $("#standard_type").append(data); } }); }; $('#add_topic_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_topic'); $.ajax({ url: 'add-api/add-topic-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(); $('#shift_add_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";?>