-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddNewChild.php
More file actions
149 lines (132 loc) · 6.39 KB
/
addNewChild.php
File metadata and controls
149 lines (132 loc) · 6.39 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
<?php
session_start();
if(!isset($_SESSION['user_id'])){
header('location: login.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Child</title>
<?php require ('includes/header.scripts.php'); ?>
</head>
<body>
<main class="main dashboard-main">
<?php require ('includes/user_header.php'); ?>
<div class="main-content">
<div class="container">
<section class="section-flex-col">
<div class="d-flex align-items-center justify-content-between">
<h1 class="text-primary">Add Child</h1>
</div>
<form id="addChildForm" enctype="multipart/form-data" method="post">
<div class="custom-card">
<div class="file-upload-container mb-3">
<div class="file-upload">
<input type="file" id="fileInput" name="photo" />
<img src="./assets/gallery-add.svg" />
<p>Upload photo</p>
</div>
<div class="file-uploaded">
<img id="uploadedImage" alt="profile picture" />
<div class="upload-btn-container">
<button class="btn btn-ghost btn-upload" id="updateImage" type="button">
<img src="./assets/gallery-add.svg" />
</button>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6 col-lg-4">
<div class="mb-3">
<label for="firstName" class="form-label">First Name</label>
<input type="text" class="form-control" id="firstName" name="firstName" required >
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="mb-3">
<label for="lastName" class="form-label">Last Name</label>
<input type="text" class="form-control" id="lastName" name="lastName" required >
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="mb-3">
<label for="dateOfBirth" class="form-label">Date of birth</label>
<input type="date" class="form-control" id="dateOfBirth" name="dateOfBirth" required >
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="mb-3">
<label for="gender" class="form-label">Gender</label>
<select id="gender" class="form-select" name="gender" required>
<option value="male" >Male</option>
<option value="female">Female</option>
</select>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="mb-3">
<label for="timezone" class="form-label">Select Time Zone:</label>
<select id="timezone" class="form-select" name="timezone" required></select>
<span class="text-info mt-2">SMS will be sent according to Timezone</span>
</div>
</div>
</div>
<div class="d-flex align-items-center gap-3 mt-4">
<button type="submit" class="btn btn-primary">Add Child</button>
<a href="children.php" class="btn btn-secondary">Cancel</a>
</div>
</div>
</form>
</section>
</div>
</div>
<footer class="footer">
<div>
<p class="mb-0">© 2024 <span class="text-primary">Medication.</span> All rights reserved.</p>
</div>
</footer>
</main>
<?php require ('includes/footer.php'); ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.34/moment-timezone-with-data.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const timeZoneSelect = document.getElementById('timezone');
const timeZones = moment.tz.names();
timeZones.forEach(timeZone => {
const option = document.createElement('option');
option.value = timeZone;
option.textContent = `(GMT${moment.tz(timeZone).format('Z')}) ${timeZone.replace('_', ' ')}`;
timeZoneSelect.appendChild(option);
});
});
document.getElementById('fileInput').addEventListener('change', function (event) {
handleFileUpload(event.target);
});
document.getElementById('updateImage').addEventListener('click', function () {
document.getElementById('fileInput').click();
});
document.getElementById('fileInput').addEventListener('change', function (event) {
handleFileUpload(event.target);
});
function handleFileUpload(input) {
const file = input.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function (e) {
const uploadedImage = document.getElementById('uploadedImage');
uploadedImage.src = e.target.result;
// Hide file-upload and show file-uploaded
document.querySelector('.file-upload').style.display = 'none';
document.querySelector('.file-uploaded').style.display = 'block';
};
reader.readAsDataURL(file);
}
}
</script>
</body>
</html>