-
Notifications
You must be signed in to change notification settings - Fork 1
/
dashboard.php
183 lines (175 loc) · 8.6 KB
/
dashboard.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
<?php
session_start();
if (!isset($_SESSION['user'])) {
header('Location: index.php');
die();
}
include_once 'class/User.php';
include_once 'class/Appointment.php';
$user = new User();
if (isset($_GET['logout'])) {
$user->signoutUser();
header('Location: index.php');
die();
}
$_user = $user->getCurrentUser();
$children = $user->getChildren();
$appointments = $user->getAppointments();
?>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Babysitting - Dashboard</title>
<link rel='stylesheet prefetch' href='css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='css/bootstrap-datepicker.min.css'>
<link rel="stylesheet" href="css/dashboard.css">
</head>
<body class="sidebar-is-reduced">
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a href="#" class="navbar-brand">Babysitting</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<div class="navbar-nav">
<a href="#" class="nav-item nav-link active">Home</a>
<a href="#" class="nav-item nav-link">About</a>
<a href="#" class="nav-item nav-link">Products</a>
</div>
<form class="form-inline ml-auto">
<input type="text" class="form-control mr-sm-2" placeholder="Search">
<button type="submit" class="btn btn-outline-light">Search</button>
</form>
<div class="navbar-nav">
<a href="dashboard.php?logout=1" class="nav-item nav-link">Logout</a>
</div>
</div>
</nav>
<div class="container first">
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="#overview" class="nav-link active" data-toggle="tab">Overview</a>
</li>
<li class="nav-item">
<a href="#appoint" class="nav-link" data-toggle="tab">Add an appointment</a>
</li>
<li class="nav-item">
<a href="#child" class="nav-link" data-toggle="tab">Add a child</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="overview">
<div class="container first">
<?php if (empty($appointments)) { ?>
<div class="jumbotron">
<h1 class="display-4">Welcome back, <?= $_user['name'] ?>!</h1>
<p class="lead">Looks like you have no appointment yet!</p>
<hr class="my-4">
<p>This is a place where you'll be seeing all your appointments and monitor them in one place, to order a babysitting service please <i>create an appointment.</i></p>
</div>
<?php
} else {
?>
<h2 class="h3">Your appointments</h2>
<div class="list-group col-md-8">
<?php
foreach ($appointments as $appointment) {
?>
<div class="list-group-item col-md-12">
<span class="col-md-4">
<?= $appointment['child'] ?>
</span>
<span class="col-md-5">
<i><?= $appointment['price'] ?>ugx</i>
</span>
<span class="col-md-5">
Created on: <b><?= date("d-m-Y", $appointment['created']) ?></b>
</span>
<span class="col-md-5">
Status: <i class=""><?= Appointment::getStatus($appointment['status']) ?></i>
</span>
</div>
<?php
}
?>
</div>
<?php
}
if(!empty($children)) {
?>
<h2 class="h3 first">Your Children</h2>
<div class="list-group col-md-8">
<?php
foreach ($children as $child) {
?>
<div class="list-group-item col-md-12">
<span class="col-md-4">
<?= $child['name'] ?>
</span>
<span class="col-md-5">
<i><?= $child['age'] ?> years old</i>
</span>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
<div class="tab-pane fade" id="appoint">
<div class="col-md-6 first">
<form class="form" method="POST" id="appointment">
<div class="form-group">
<select class="custom-select" name="child">
<?php foreach ($children as $child) {
?>
<option value="<?= $child['id'] ?>"><?= $child['name'] ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<select class="custom-select" name="service">
<option value="1">Morning service</option>
<option value="2">Day service</option>
<option value="3">Evening service</option>
<option value="4">Night service</option>
</select>
</div>
<div class="form-group">
<input type="text" name="hours" class="form-control" placeholder="How many hours?" value="" />
</div>
<div class="form-group">
<input type="submit" id="btnAppoint" class="btnSubmit" value="Add an appointment" />
</div>
</form>
</div>
</div>
<div class="tab-pane fade" id="child">
<div class="col-md-6 first">
<form class="form" method="POST" id="child-form">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Name of your child" value="" />
</div>
<div class="form-group">
<input type="text" name="age" class="form-control" placeholder="Age of your child" value="" />
</div>
<div class="form-group">
<input type="submit" id="btnChild" class="btnSubmit" value="Add a child" />
</div>
</form>
</div>
</div>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src='js/bootstrap.min.js'></script>
<script src='js/bootstrap-datepicker.min.js'></script>
<script src="js/dashboard.js"></script>
</body>
</html>