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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
<!DOCTYPE html> <?php require_once 'Prog_Subject_SQL.php'; ?> <?php if (isset($_POST['btn_save'])) { SaveRecord($_POST); echo '<script>location.href = "Prog_Subject_List.php"</script>'; } if (isset($_GET['ps_id'])) { $PS_Data = getDataFromID(); if (isset($_POST['btn_save'])) { UpdateRecord(); } } ?> <html> <head> <?php require_once '../include/head.php'; ?> <?php require_once '../include/checkuser.php'; ?> <?php require_once '../include/Nav_bar.php'; ?> <script> $(function() { $("#commentForm").validate(); $("#select_type").change(function() { var v = $(this).val(); if (v == "") { $("#ig_tbody").attr("style", "display: none;"); $("#package_tbody").attr("style", "display: none;"); clearAll(); return; } if (v == 0) { $("#ig_tbody").attr("style", ""); $("#package_tbody").attr("style", "display: none;"); clearDivInput(v); return; } if (v == 1) { $("#ig_tbody").attr("style", "display: none;"); $("#package_tbody").attr("style", ""); clearDivInput(v); return; } }); }); function clearAll() { $("input").each(function() { $(this).val(""); }); } function clearDivInput(e) { if (e == 0) { $("#package_tbody input").each(function() { $(this).val(""); }); } else { $("#ig_tbody input").each(function() { $(this).val(""); }); } } function setAllDisabledfalse() { setAllDisabled("false"); $("button[name='btn_save']").attr("style",""); $("button[name='btn_edit']").attr("style","display : none"); $("h3").html("Edit Programme Subject") } function setAllDisabled(e) { e = (e == "true")?true:false; $("select").each(function() { $(this).attr("disabled", e); }) $("input").each(function() { $(this).attr("disabled", e); }) } </script> <?php if (isset($_GET['view'])) { ?> <script> $(function() { setAllDisabled("true"); $("button[name='btn_save']").attr("style","display: none"); $("h3").html("View Programme Subject") }) </script> <?php } ?> </head> <body> <!-- line between nav bar and content --> <div class="text-right"> <ul class="breadcrumb"> <li class="active"><a href="Prog_Subject_List.php">Programme Subject List</a> <span class="divider">></span></li> <li class="active">Programme Subject From</li> </ul> </div>
<div class="container-fluid pathways-container"> <h3>Add Programme Subject</h3> <form action="" method="post" autocomplete="off" id="commentForm"> <table> <tr> <td style="width: 200px;text-align: right;padding-bottom: 10px;padding-right: 15px">Programme </td> <td> <select name="programme"> <option></option> <?php foreach (ProgrammeList() as $a) { ?> <option <?= isset($PS_Data) ? ($PS_Data['program_id'] == $a['program_id'] ? "selected" : "") : "" ?> value="<?= $a['program_id'] ?>"><?= $a['program_code'] ?></option> <?php } ?> </select> </td> </tr>
<tr style="height: 15px;"></tr>
<tr> <td style="text-align: right;padding-bottom: 10px;padding-right: 15px">Subject </td> <td> <select name="code"> <option></option> <?php foreach (SubjectList() as $a) { ?> <option <?= isset($PS_Data) ? ($PS_Data['subject_id'] == $a['subject_id'] ? "selected" : "") : "" ?> value="<?= $a['subject_id'] ?>"><?= $a['sub_code'] ?></option> <?php } ?> </select> </td> </tr>
<tr style="height: 15px;"></tr>
<tr> <td style="text-align: right;padding-bottom: 10px;padding-right: 15px">Group,Individual / Package </td> <td> <?php echo isset($PS_Data) ? "<script>$(function(){ $('#select_type').val(" . setSelected() . ");$('#select_type').change(); })</script>" : ''; ?> <select id="select_type" class="required" name="type"> <option></option> <option value="0">Group / Individual</option> <option value="1">Pakcage</option> </select> </td> </tr>
<tbody id="package_tbody" style="display: none;"> <tr style="height: 15px;"></tr> <tr> <td style="text-align: right;padding-bottom: 10px;padding-right: 15px">Primary package price </td> <td><input type="text" class="required" name="price1" value="<?= isset($PS_Data) ? $PS_Data['primary_package_price'] : "" ?>"/></td> <td style="width: 200px;text-align: right;padding-bottom: 10px;padding-right: 15px">Secondary package price </td> <td><input type="text" class="required" name="price2" value="<?= isset($PS_Data) ? $PS_Data['secondary_package_price'] : "" ?>"/></td> </tr> </tbody>
<tbody id="ig_tbody" style="display: none;"> <tr style="height: 15px;"></tr> <tr> <td style="text-align: right;padding-bottom: 10px;padding-right: 15px">Primary individual price </td> <td><input type="text" class="required" name="price3" value="<?= isset($PS_Data) ? $PS_Data['primary_individual_price'] : "" ?>"/></td> <td style="width: 200px;text-align: right;padding-bottom: 10px;padding-right: 15px">Primary group price </td> <td><input type="text" class="required" name="price4" value="<?= isset($PS_Data) ? $PS_Data['primary_group_price'] : "" ?>"/></td> </tr>
<tr style="height: 15px;"></tr>
<tr> <td style="text-align: right;padding-bottom: 10px;padding-right: 15px">Secondary individual price </td> <td><input type="text" class="required" name="price5" value="<?= isset($PS_Data) ? $PS_Data['sip'] : "" ?>"/></td> <td style="width: 200px;text-align: right;padding-bottom: 10px;padding-right: 15px">Secondary group price </td> <td><input type="text" class="required" name="price6" value="<?= isset($PS_Data) ? $PS_Data['secondary_group_price'] : "" ?>"/></td> </tr> </tbody> </table> <button class="btn btn-danger" type="button" onclick="history.back()">Back</button> <button class="btn btn-danger" type="button" name="btn_edit" onclick="setAllDisabledfalse()">Edit</button> <button class="btn btn-danger" type="submit" name="btn_save" >Save</button> </form> </div> <!-- /container --> </body> </html>
|