-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathholiday.php
211 lines (181 loc) · 6.53 KB
/
holiday.php
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php
session_start();
if(!isset($_SESSION['id']))
{
header('Location: index.html');
}
include_once("./db.php");
$sid=$_SESSION["id"];
$res=$con->query("SELECT * FROM staff where `staffid` LIKE '$sid'")->fetch_assoc();
if($res["designation"]!=="HOD")
{
header('Location: home.php');
}
else
{
$dep=$res["dept"];
// $res=$con->query("SELECT date from holiday");
// $hol=array();
// while($row=$res->fetch_assoc())
// {
// array_push($hol,$row["date"]);
// }
}
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Holiday Entry</title>
<script src="./assets/jquery.min.js"></script>
<script src="./assets/Fomantic/dist/semantic.min.js"></script>
<link rel="icon" type="image/png" href="./images/KEC.png">
<?php include_once('./assets/notiflix.php'); ?>
<style>
</style>
</head>
<body id="root">
<?php
include_once('./navbar.php');
?>
<style>
body {
background: url("./images/bgpic.jpg");
}
</style>
<div class="ui raised segment" style="width:80%;margin:auto;margin-top:2%">
<form class="ui form" id="frm">
<div class="ui raised segment" style="width:96%;margin:auto;">
<div class="ui header" style="text-align:center;margin-top:1%;font-size:26px">Mark Holidays</div>
<div style="width:45%;margin:auto;">
<select name="holidays[]" multiple="" class="ui fluid dropdown" id="holidays" >
<option value="">Select the Dates from Calendar</option>
</select>
</div>
<div class="ui calendar" id="inline_calendar" style="width:45%;margin:auto;margin-top:1%;" onselect="func()">
</div>
<br>
<div style="width:90%;margin:auto">
<div class="two fields">
<div class="field" >
<label>Date Exemption Type</label>
<div class="ui search selection dropdown" id="type">
<input name="type" type="hidden">
<div class="default text">Exemption Type</div>
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" data-value="Holiday">Holiday</div>
<div class="item" data-value="Exam">Exam</div>
<div class="item" data-value="Suspension">Suspension</div>
</div>
</div>
</div>
<div class="field" >
<label>Year</label>
<select name="year[]" multiple="" class="ui fluid dropdown" id="year" >
<option value="">Choose Year</option>
<option value="2019">II</option>
<option value="2018">III</option>
<option value="2017">IV</option>
<?php
if($dep=='CSE')
{
echo "<option value='2020' >ME</option>";
}
?>
</select>
</div>
</div>
<br>
<div class="field">
<label>Comments</label>
<input placeholder="Comments" name="comment" type="text">
</div>
<br>
</div>
<center>
<button class="ui primary button" type="submit" >Mark as Holiday</button>
</center>
</div>
</form>
</div>
<script>
var arr=[];
// var ar=[];
// var dates=
<?php //echo json_encode($hol);?>;
// for (i of dates)
// {
// var r = i.split("-");
// ar.push({date:new Date(r[0], r[1] - 1, r[2]),message:"Holiday",class: 'green'});
// }
$(document).ready(function(){
$('#inline_calendar').calendar({
type: 'date',
// disabledDates: ar,
formatter: {
date: function (date, settings) {
if (!date) return '';
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
if(day<10)
{
day='0'+day;
}
if(month<10)
{
month='0'+month;
}
var dat=day + '/' + month + '/' + year;
arr.push(dat);
if(arr.indexOf(dat)!==-1)
{
$("#holidays").append("<option value='"+dat+"' selected>"+dat+"</option>");
}
return '';
}
},
disabledDaysOfWeek: [0],
inline:true
});
$('#type').dropdown({
allowAdditions: true
})
;
$('#holidays,#year').dropdown({
clearable: true,
sortSelect: true,
});
$("#frm").on("submit",function(e)
{
e.preventDefault();
if($("#holidays").val()=="")
{
Notiflix.Notify.Warning("Please Choose the Dates First !");
return ;
}
$.ajax({
url: "./AJAX/adModules.php",
data: $("#frm").serialize(),
type: "POST",
success: function(res) {
if(res=="success")
{
Notiflix.Notify.Success("Holidays Declared Successfully");
window.setTimeout(function() {
window.location.href = 'home.php';
}, 1200);
}
else
{
Notiflix.Notify.Warning("Please check the details");
}
}
});
return false;
});
});
</script>
</body>
</html>