-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstaffconfirmDeparture.php
More file actions
107 lines (91 loc) · 3.14 KB
/
Copy pathstaffconfirmDeparture.php
File metadata and controls
107 lines (91 loc) · 3.14 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
<?php
include "headerIframeLib.php";
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
echo "<script>
window.parent.postMessage('formSubmitted', '*');
</script>";
exit;
}
?>
<!DOCTYPE html>
<html>
<head><title>Form</title>
<script>
$(function() {
$( "#startDate" ).datepicker({
appendText:"(yy-mm-dd)",
changeMonth:true,
changeYear:true,
yearRange:"c-0:c+1",
dateFormat:"yy-mm-dd"
});
$( "#endDate" ).datepicker({
appendText:"(yy-mm-dd)",
changeMonth:true,
changeYear:true,
yearRange:"c-0:c+1",
dateFormat:"yy-mm-dd"
});
$( ".dateElement" ).datepicker({
appendText:"(yy-mm-dd)",
changeMonth:true,
changeYear:true,
yearRange:"c-35:c+0",
dateFormat:"yy-mm-dd",
minDate: "+0d",
onSelect: function(dateText) {
var currentTime = new Date();
var hours = currentTime.getHours().toString().padStart(2, '0');
var minutes = currentTime.getMinutes().toString().padStart(2, '0');
var seconds = currentTime.getSeconds().toString().padStart(2, '0');
var timeString = hours + ':' + minutes+':00';
$(this).val(dateText + ' ' + timeString);
}
});
$( ".departureDateElement" ).datepicker({
appendText:"(yy-mm-dd)",
changeMonth:true,
changeYear:true,
yearRange:"c-0:c+1",
dateFormat:"yy-mm-dd",
//minDate: "+1d",
minDate: new Date(new Date().getTime() + 24 * 60 * 60 * 1000),
beforeShow: function(input, inst) {
// Temporarily remove the "readonly" attribute when the datepicker is shown
$(input).removeAttr('readonly');
},
onSelect: function(dateText, inst) {
// Reapply the "readonly" attribute once a date is selected
$(this).attr('readonly', 'readonly');
},
onClose: function(dateText, inst) {
// Reapply the "readonly" attribute once the datepicker is closed
$(this).attr('readonly', 'readonly');
}
});
$(".departureDateElement").click(function() {
// Clear the input value
$(this).val('');
// Remove the readonly attribute to allow manual editing if needed
$(this).attr('readonly', 'readonly');
});
});
// Disable manual input typing, make it readonly by default
$(".departureDateElement").attr('readonly', true);
$("#indiv").click(function(){
$("#impo").toggle();
});
</script>
</head>
<body>
<div id="overlay" style="background-color: orange;">
<h1>Confirm Departure date Time</h1>
</div>
<form method="POST">
<label>Date and Time: <input type="text" name="name" required class="dateElement"></label><br>
<input type="submit" value="Submit">
</form>
</body>
</html>