-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd-edit-notice.php
More file actions
269 lines (183 loc) · 7.29 KB
/
add-edit-notice.php
File metadata and controls
269 lines (183 loc) · 7.29 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php include 'header.php'; ?>
<link rel="stylesheet" href="date/jquery-ui.css">
<script src="date/jquery-1.9.1.js"></script>
<script src="date/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#datepicker1" ).datepicker();
$( "#datepicker2" ).datepicker();
});
</script>
<style>
.btn33{
background-color:white;
border-radius:6px;
outline:none;
padding-top:5px;
padding-bottom:5px;
padding-left:15px;
padding-right:15px;
}
.btn33:hover{
background-color:#00aeef;
}
</style>
<script type="text/javascript" language="javascript" src="aj.js"></script>
<script>
function fill_val(ename,id,field,divName,ecode,dept,desination,sal){
//alert(desination);
document.getElementById(field).value=ename;
document.getElementById("notice_to_emp_h").value=id;
document.getElementById(divName).style.display='none';
}
function auto_sugg_emp(val,field,divName){
var v=document.getElementById(field).value;
suggest_emp(v,field,divName);
}
</script>
<tr>
<?php
if(!empty($_REQUEST['notice'])){
$sql="select * from tbl_notice where 1 and notice_id='$_REQUEST[notice]'";
$rec_notice=mysql_fetch_array(db_query($sql));
}
if(isset($_REQUEST['update'])){
$notice_to_emp_id="";
$notice_to_person="";
if($_REQUEST['notice_to']=='dept'){
$notice_to_person=$_REQUEST['notice_to_dpt'];
}else if($_REQUEST['notice_to']=='emp'){
$notice_to_person=$_REQUEST['notice_to_emp'];
}
if(empty($notice_to_emp_h)){
$notice_to_emp_id=$notice_to_emp_h2;
}else{
$notice_to_emp_id=$notice_to_emp_h;
}
$notice_date=date("Y-m-d",strtotime($notice_date));
$sql="update tbl_notice set notice_title='$notice_title',
notice_by='$notice_by',
notice_to='$notice_to_person',
notice_to_id='$notice_to_emp_id',
notice_date='$notice_date',
notice_msg='$notice_msg'
where notice_id='$_REQUEST[notice]'
";
$res=db_query($sql);
if($res>0){
header("location:manage-notice.php");
exit;
}
}
if(isset($_REQUEST['submit'])){
$notice_to_person="";
if($_REQUEST['notice_to']=='dept'){
$notice_to_person=$_REQUEST['notice_to_dpt'];
$notice_type="dept";
}else if($_REQUEST['notice_to']=='emp'){
$notice_to_person=$_REQUEST['notice_to_emp'];
$notice_type="emp";
}
if(empty($notice_to_emp_h)){
$notice_to_emp_id=$notice_to_emp_h2;
}else{
$notice_to_emp_id=$notice_to_emp_h;
}
$notice_date=date("Y-m-d",strtotime($notice_date));
$sql="insert into tbl_notice set notice_title='$notice_title',
notice_by='$notice_by',
notice_to='$notice_to_person',
notice_to_id='$notice_to_emp_id',
notice_date='$notice_date',
notice_type='$notice_type',
notice_msg='$notice_msg'
";
$res=db_query($sql);
if($res>0){
header("location:manage-notice.php");
exit;
}
}
?>
<td valign="top" width="17%" style="border-right: #284c93 solid 3px; height:505px;" >
<?php include 'left-menu.php'; ?>
</td>
<td valign="top" width="83%">
<p class="b xlarge mt10px ml10px">Notice-Board
<span class="fr mr10px b blue u" style="font-size:12px;"><a href="manage-notice.php">Go Back</a></span>
</p>
<p class="bdr0 ml10px m5px mr30px"></p>
<form action="" method="post" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0" width="50%" align="center" class="mt20px bdrAll">
<tr>
<td width="27%" height="40px" colspan="2" align="center" style="background-color:#284c93;color:#FFFFFF;font-size:14px;"><p class="p5px ml10px b">Notice Detail</p></td>
</tr>
<tr>
<td width="27%"><p class="p5px ml10px b"> Title</p></td>
<td width="71%"><p class="p5px ml35px"><input type="text" required name="notice_title" id="notice_title" style="height:25px; width:220px;" value="<?=$rec_notice['notice_title']?>" /></p></td>
</tr>
<tr>
<td width="27%"><p class="p5px ml10px b">Notice By</p></td>
<td width="71%"><p class="p5px ml35px">
<select name="notice_by" id="notice_by" style="padding:4px; width:124px;" required>
<option <?php if($rec_notice['notice_by']=='HR'){?> selected="selected" <?php }?> value="HR">H.R</option>
<option <?php if($rec_notice['notice_by']=='Director'){?> selected="selected" <?php }?>>Director</option>
</select></p></td>
</tr>
<tr>
<td width="27%"><p class="p5px ml10px b">Notice To</p></td>
<td width="71%"><p class="p5px ml10px">
<input type="radio" required name="notice_to" onclick="notcheck();" id="notice_to" <?php if(empty($rec_notice['notice_to_id'])){?> checked="checked" <?php }?> value="dept" />
<select name="notice_to_dpt" id="notice_to_dpt" title="Choose employee department" style="padding:4px; width:124px;" >
<option <?php if($rec_notice['notice_to']=='Marketing'){?> selected="selected" <?php }?>>Marketing</option>
<option <?php if($rec_notice['notice_to']=='Back Office'){?> selected="selected" <?php }?> >Back Office</option>
<option <?php if($rec_notice['notice_to']=='HR'){?> selected="selected" <?php }?> value="HR">H.R.</option>
<option <?php if($rec_notice['notice_to']=='Accounts'){?> selected="selected" <?php }?> >Accounts</option>
</select>
<input type="radio" required name="notice_to" onclick="check();" id="notice_to" <?php if(!empty($rec_notice['notice_to_id'])){?> checked="checked" <?php }?> value="emp" />
<input type="text" name="notice_to_emp" id="notice_to_emp" style="height:20px; width:120px;text-align:center;" autocomplete="off" onkeyup="auto_sugg_emp(this.value,'notice_to_emp','myDiv1');" placeholder=" Employee"
value="<?php if(!empty($rec_notice['notice_to_id'])){echo $rec_notice['notice_to'];}?>" />
<div id="myDiv1" style="display:none;background-color:#FFFFFF;margin-left:8px;margin-top:0px;padding-top:0px;vertical-align:baseline;width:290px;height:70px;overflow:scroll;font-size:12px;color:#0000CC;font-weight:bold;">
</div>
<input type="hidden" name="notice_to_emp_h" id="notice_to_emp_h" value="" />
<input type="hidden" name="notice_to_emp_h2" id="notice_to_emp_h2" value="<?=$rec_notice['notice_to_id']?>" />
</p></td>
</tr>
<tr>
<td width="27%"><p class="p5px ml10px b">Notice Date</p></td>
<td width="71%"><p class="p5px ml35px"><input type="text" required name="notice_date" id="datepicker1" style="height:25px; width:220px;" value="<?=$rec_notice['notice_date']?>" /></p></td>
</tr>
<tr>
<td width="36%"><p class="p5px ml10px b">Message</p></td>
<td width="62%"><p class="p5px ml35px">
<textarea class="" name="notice_msg" required id="notice_msg" rows="10" cols="40"><?=$rec_notice['notice_msg']?></textarea></p></td>
</tr>
<tr>
<td colspan="3"><p class="ac p5px"><span class="ml10px">
<?php if(!empty($_REQUEST['notice'])){ ?>
<input type="submit" name="update" value="Update" class="btn33" />
<?php }else{?>
<input type="submit" name="submit" value="Submit" class="btn33" />
<?php }?>
</span>
<span class="ml10px"><input type="reset" name="reset" value="Reset" class="btn33" /></span>
</p></td>
</tr>
</table>
</form>
<p> </p>
</td>
</tr>
</table>
<script>
function check(){
document.getElementById("notice_to_emp").setAttribute("required", "required");
}
function notcheck(){
document.getElementById("notice_to_emp").removeAttribute("required");
}
</script>
<?php include 'footer.php'; ?>
</body>
</html>