nus-mtp/cs-modify

View on GitHub
templates/moduleMountingFixed.html

Summary

Maintainability
Test Coverage
$def with (currentAY, fullMountingPlan)

$ title_string = 'Fixed Module Mounting In ' + currentAY
$var title:$title_string
$ home = ['/', 'Home']
$ fixedMounting = ['#', title_string]
$var hierarchy = [home, fixedMounting]

<script type="text/javascript" src="static/javascripts/fixedAndTentaMounting.js"></script>

<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <h1 class="text-center"><b>Module Mountings for <u>$currentAY</u></b></h1>
            <p class="text-center">Shows the <b>fixed</b> module mountings for the current AY.</p>
            <br>
            <div class="row" id="options">
                <div class="col-md-12 text-center">
                    <form class="navForm" action="/modules" method="post">
                        <input class="btn btn-primary" type="submit" value="Go To Module Information" data-toggle="tooltip" data-placement="bottom" title="See all modules that exist in the system">
                    </form>
                    <form class="navForm" action="/moduleMountingTentative" method="post">
                        <input class="btn btn-primary" type="submit" value="Go To Module Mountings for Other AYs" data-toggle="tooltip" data-placement="bottom" title="See tentative module mountings for other AYs">
                    </form>
                </div>
                <div class="col-md-2"></div>
                <div class="col-md-8 text-center toggle-columns-display">
                    <form>
                        <label class="checkbox-inline toggle-columns-display-checkbox">
                          <input type="checkbox" onclick="toggleQuotaDisplay('#fixed-mounting-table');">
                          Display Quota
                        </label>
                        <label class="checkbox-inline toggle-columns-display-checkbox">
                          <input type="checkbox" onclick="toggleNumStudentsDisplay('#fixed-mounting-table');">
                          Display Number of Students Taking
                        </label>
                    </form>
                </div>
                <div class="col-md-2"></div>
            </div>
            <br>
            <div class="row loading-div text-center">
                <img src="static/images/loading.gif">
                <h3>Loading data, please wait...</h3>
            </div>
            <table class="table table-bordered table-hover text-center dataTable display" id="fixed-mounting-table">
                <thead>
                    <tr>
                        <th>Code</th>
                        <th>Name</th>
                        <th>Mounted In Sem 1</th>
                        <th class="quota-column" onclick="replaceNilQuotasWithNumbers('#fixed-mounting-table');">Sem 1 Quota</th>
                        <th># of Students Taking (Sem 1)</th>
                        <th>Mounted In Sem 2</th>
                        <th class="quota-column" onclick="replaceNilQuotasWithNumbers('#fixed-mounting-table');">Sem 2 Quota</th>
                        <th># of Students Taking (Sem 2)</th>
                    </tr>
                </thead>
                <tbody>
                    $for subplan in fullMountingPlan:
                        $ moduleCode = subplan[0]
                        $ moduleName = subplan[1]
                        $ sem1Mounting = subplan[2]
                        $ sem2Mounting = subplan[3]
                        $ sem1Quota = subplan[4]
                        $ sem2Quota = subplan[5]
                        $ sem1NumStudents = subplan[6]
                        $ sem2NumStudents = subplan[7]

                        <tr>
                            <td class="text-center">
                                <a href="/viewModule?code=$moduleCode" target="_blank" data-toggle="tooltip" title="View general info for $moduleCode">$moduleCode</a>
                            </td>
                            <td>$moduleName</td>

                        $if sem1Mounting == 1:
                            <td>
                                <span style="visibility:hidden;">1</span><!--for sorting purpose-->
                                <a class="table-mounting-icon" href="/individualModuleInfo?code=$moduleCode&aysem=$currentAY+Sem+1" target="_blank">
                                    <span class="glyphicon glyphicon-ok" data-toggle="tooltip" data-placement="bottom" data-html="true" title="Mounted<br>(Click to go to module AY-Sem view)"></span>
                                </a>
                            </td>
                        $elif sem1Mounting == -1:
                            <td>
                                <span style="visibility:hidden;">2</span><!--for sorting purpose-->
                                <a class="table-mounting-icon" href="/individualModuleInfo?code=$moduleCode&aysem=$currentAY+Sem+1" target="_blank">
                                    <span class="glyphicon glyphicon-minus" data-toggle="tooltip" data-placement="bottom" data-html="true"
                                    title="Not Mounted<br>(Click to go to module AY-Sem view)"></span>
                                </a>
                            </td>
                        $if True:           
                            <td>
                                $sem1Quota
                            </td>
                            <td>
                                $sem1NumStudents
                                $if ((sem1Quota == '?') and sem1NumStudents > 0) or ((sem1Quota != '-' and sem1Quota != '?') and sem1NumStudents > sem1Quota):
                                    <span class="glyphicon glyphicon-info-sign oversub-warning" data-toggle="tooltip" data-placement="bottom" data-html="true" 
                                    title="Oversubscribed!<br>(Demand > Supply)"></span> 
                                $elif (sem1Quota == '-' and sem1NumStudents > 0):
                                    <span class="glyphicon glyphicon-info-sign unmounted-warning" data-toggle="tooltip" data-placement="bottom" data-html="true" 
                                    title="Oversubscribed!<br>(Unmounted but still has demand)"></span> 
                            </td>

                        $if sem2Mounting == 1:
                            <td>
                                <span style="visibility:hidden;">1</span><!--for sorting purpose-->
                                <a class="table-mounting-icon" href="/individualModuleInfo?code=$moduleCode&aysem=$currentAY+Sem+2" target="_blank">
                                    <span class="glyphicon glyphicon-ok" data-toggle="tooltip" data-placement="bottom" data-html="true"
                                    title="Mounted<br>(Click to go to module AY-Sem view)"></span>
                                </a>
                            </td>
                        $elif sem2Mounting == -1:
                            <td>
                                <span style="visibility:hidden;">2</span><!--for sorting purpose-->
                                <a class="table-mounting-icon" href="/individualModuleInfo?code=$moduleCode&aysem=$currentAY+Sem+2" target="_blank">
                                    <span class="glyphicon glyphicon-minus" data-toggle="tooltip" data-placement="bottom" data-html="true"
                                    title="Not Mounted<br>(Click to go to module AY-Sem view)"></span>
                                </a>
                            </td>
                        $if True:
                            <td>
                                $sem2Quota
                            </td>
                            <td>
                                $sem2NumStudents
                                $if ((sem2Quota == '?') and sem2NumStudents > 0) or ((sem2Quota != '-' and sem2Quota != '?') and sem2NumStudents > sem2Quota):
                                    <span class="glyphicon glyphicon-info-sign oversub-warning" data-toggle="tooltip" data-placement="bottom" data-html="true" 
                                    title="Oversubscribed!<br>(Demand > Supply)"></span> 
                                $elif (sem2Quota == '-' and sem2NumStudents > 0):
                                    <span class="glyphicon glyphicon-info-sign unmounted-warning" data-toggle="tooltip" data-placement="bottom" data-html="true" 
                                    title="Oversubscribed!<br>(Unmounted but still has demand)"></span> 
                            </td>                        
                        </tr>
                </tbody>
            </table>
            <br>
            <br>
        </div>
    </div>
</div>