-
Notifications
You must be signed in to change notification settings - Fork 0
/
weeklysum1
107 lines (100 loc) · 3.28 KB
/
weeklysum1
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Weekly Summary</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background-color: #f4f4f4;
text-align: center;
color: #333;
}
.container {
max-width: 600px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
margin: 20px;
}
h1 {
font-size: 2em;
margin-bottom: 20px;
}
.message {
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
}
.bad-message {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.good-message {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
color: white;
background-color: #4caf50;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h1>Weekly Summary</h1>
<!-- Date Range -->
<div>
<p id="date-range"></p>
</div>
<!-- Bad Message -->
<div class="message bad-message">
<h2>Reminder</h2>
<p>That's drug use 14 times this month; Please call for help ASAP! support Helpline: 01708 765200 .</p>
</div>
<!-- Good Message -->
<div class="message good-message">
<h2>Great Job!</h2>
<p>Great work on going to the gym work! Are you recoverying correctly?</p>
</div>
<!-- Button to Go Back or Perform an Action -->
<button onclick="window.location.href='index.html'">Go Back</button>
</div>
<script>
// Function to format dates as YYYY-MM-DD
function formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-indexed
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// Get current date and calculate the start and end of the week
const today = new Date();
const startOfWeek = new Date(today);
startOfWeek.setDate(today.getDate() - today.getDay() + 1); // Start of the week (Monday)
const endOfWeek = new Date(startOfWeek);
endOfWeek.setDate(startOfWeek.getDate() + 6); // End of the week (Sunday)
// Format and display the date range
document.getElementById('date-range').textContent = `Week of ${formatDate(startOfWeek)} to ${formatDate(endOfWeek)}`;
</script>
</body>
</html>