summaryrefslogtreecommitdiff
path: root/aloha/template/allotter/apply.html
blob: 20fa2a1b195810f678461c624869c6496d5b1ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{% extends "base.html" %}

{% load range_filter %}

{% block title %} JAM 2012 Application form {% endblock %}
{% block scripts %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
    $("#check").click(function() {
        $("#checkButton").attr("disabled", !this.checked);
    });
});
</script>

<script>
$(document).ready(function(){
    $("select").change(function () {
        console.log("here we go")
            var $this = $(this);
            var prevVal = $this.data("prev");
            var otherSelects = $("select").not(this);
            if ($(this).val() !="0"){
                console.log("some shit would happen")
                otherSelects.find("option[value=" + $(this).val() + "]").attr('disabled', true);
            }
            if (prevVal) {
                    otherSelects.find("option[value=" + prevVal + "]").attr('disabled', false);
            }

            $this.data("prev", $this.val());
    });
});
</script>
{% endblock %}

{% block content %}

<p> Welcome to JAM 2012 allotment! </p>

<p>Read the following instructions carefully before continuing. </p>

<hr/>
Choose the options as per your preference

<h3>You are eligible for {{first_paper}} 

{% comment %}
Checking if there is second paper and displaying its name.
{% endcomment %}

{% if np == 2  %}

and {{second_paper}}

{% endif %}

</h3>

<h4>For the paper(s) in which you are in the merit list, the following
options are available to you. Please rank your choices.</h4>

<p> Preferences will be assigned to options in the ascending order. Make sure it's 
<b>None</b> for all options after your last option(so that it is not considered).</p>

<hr/>

{% comment %}
</h3>
Listing the options for first test paper.
{% endcomment %}

<h3>Options available for {{first_paper}}</h3>

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}

<form action="/allotter/{{user.username}}/submit/" method="post">
{% csrf_token %}

<table class="table table-bordered table-striped">
<thead>
<td><p>Programme Code </p></td>
<td><p>Programme Name </p></td>
<td><p>Insitute </p></td>
<td><p>Preference </p></td>
</thead>

<tbody>
{% for option in options_available_first %}     
    <tr> 
    <td><p> {{ option.opt_code }} </p></td>
    <td><p> {{option.opt_name }} </p></td>
    <td><p> {{option.opt_location }} </p></td>
    <td><select name="{{option.opt_code}}">
    {% for i in options_range %}
        <option value="{{i}}" selected="selected">Preference {{i}}</option>
    {% endfor %}
    <option value="0" selected="selected">None</option>
    </select>
    </td>
    </tr>                
{% endfor %}
</tbody>
</table>

{% if np == 2  %}

<h3>Options available for {{second_paper}} </h3>

<table class="table table-bordered table-striped">
<thead>
<td><p>Programme Code </p></td>
<td><p>Programme Name </p></td>
<td><p>Insitute </p></td>
<td><p>Preference </p></td>
</thead>

<tbody>
{% for option in options_available_second %}     
    <tr> 
    <td><p> {{option.opt_code }} </p></td>
    <td><p> {{option.opt_name }} </p></td>
    <td><p> {{option.opt_location }} </p></td>
    <td><select name="{{option.opt_code}}">
    {% for i in options_range %}
        <option value="{{i}}" selected="selected">Preference {{i}}</option>
    {% endfor %}
    <option value="0" selected="selected">None</option>
    </select>
    </td>
    </tr>                
{% endfor %}
</tbody>
</table>

{% endif %}


<div class="alert">

<p><input type="checkbox" name="check" id="check" /><label for="check">I am responsible for my own choices.</label> 
</p>
<input type="submit" name="save" value="Save" class="btn" id="checkButton" disabled="disabled" />
</div>
</form>
{% endblock content %}