<div class="col-sm-10">
    <div class="row ">
        <div class="col-sm-12 " style="padding: 0">
            <div class="col-sm-12" >
                <h3>
                    Selected Grade Information
                        <!--<a href=""> <span class="pull-right" style="font-size: 18px">Create Quiz</span></a>-->
                </h3>
                <hr>
            </div>

            <div class="col-sm-12" >
                <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                    <div class="col-sm-4" style="padding:10px 0">Grade</div>
                    <div class="col-sm-4" style="padding:10px 0">Grade Number </div>
                    <div class="col-sm-4" style="padding:10px 0">Action</div>
                </div>

                <div class="col-sm-12"><br></div>

                <?php
//                if ($quiz_grades) {
//                    $top_number = 0;
//                    foreach ($quiz_grades as $v_grade) {
//                        $id = $v_grade->grade_id;
//                        $status = $v_grade->grade_status;
                        ?>
                        <div class="col-sm-12 gray text-center" >
                            <div class="col-sm-4" style="padding:10px 0"><?php //echo $v_grade->grade_name; ?></div>
                            <div class="col-sm-4" style="padding:10px 0">
                                <?php
//                                if ($top_number > $v_grade->grade_number) {
//                                    echo $v_grade->grade_number;
//                                    echo '-';
//                                    echo $top_number - 1;
//                                    $top_number = $v_grade->grade_number;
//                                } else {
//                                    echo $v_grade->grade_number . '-' . $v_grade->grade_total_number;
//                                    $top_number = $v_grade->grade_number;
//                                }
                                ?>
                            </div>

                            <div class="col-sm-4" style="padding:10px 0" id="actions<?php //echo $id; ?>">
                                <a href="<?php //echo base_url() . 'super-admin/quiz/' . $quiz_info->url . '/update-quiz-grade'; ?>"><i class="fa fa-edit" title="Edit"></i></a>
                                <span>&nbsp;&nbsp;</span>
                                <?php
//                                if ($status == 0) {
                                    ?>
                                    <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'super-admin/activate-grade/' . $id; ?>', 'Active', '<?php //echo $id; ?>')">
                                        <i class="fa  fa-user-plus" title="Active"></i>
                                    </a>&nbsp;&nbsp;
                                <?php // } else if ($status == 1) { ?>
                                    <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'super-admin/inactivate-grade/' . $id; ?>', 'Inactive', '<?php //echo $id; ?>')">
                                        <i class="fa  fa-user-times" title="Inactive"></i>
                                    </a>&nbsp;&nbsp;
                                <?php // } else if ($status == 2) { ?>
                                    <a href="#" onclick="return checkForAction('<?php //echo base_url() . 'super-admin/activate-grade/' . $id; ?>', 'Active', '<?php //echo $id; ?>')">
                                        <i class="fa  fa-user-plus" title="Active"></i>
                                    </a>&nbsp;&nbsp;
                                <?php //} ?>

                                <?php // if ($status != 2) { ?>
                                    <a  href="#" onclick="return checkForAction('<?php// echo base_url() . 'super-admin/archive-grade/' . $id; ?>', 'Delete', '<?php //echo $id; ?>')">
                                        <i class="fa fa-trash-o" title="Delete"></i>
                                    </a>&nbsp;&nbsp;
                                <?php // } ?>
                            </div>
                        </div>

                        <div class="col-sm-12"><br></div> 

                        <?php
//                    }
//                } else {
//                    echo 'You do not have any grade for this quiz.';
//                }
                ?>
            </div>
        </div><!-- /.row gray -->
    </div>
</div>

<script>
</script>
<script>

    function checkForAction(url, action, quizID) {
        swal({
            title: "",
            text: "Are you sure you want to " + action + " this grade?",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: '#DD6B55',
            confirmButtonText: 'Yes',
            cancelButtonText: "No",
            closeOnConfirm: true,
            closeOnCancel: true
        },
        function(isConfirm) {
            if (isConfirm) {
                var xmlhttp = create_xmlhttp();
                var serverPage = url;
                xmlhttp.open("GET", serverPage);
                xmlhttp.onreadystatechange = function()
                {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                    {
                        _("actions" + quizID).innerHTML = xmlhttp.responseText;
                    }
                };
                xmlhttp.send(null);
            } else {
                return;
            }
        });
    }

</script>