-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddExercise.html
More file actions
158 lines (143 loc) · 4.46 KB
/
Copy pathAddExercise.html
File metadata and controls
158 lines (143 loc) · 4.46 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
<!doctype html>
<html ng-app="addExerciseApp">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script>
<style>
body {
background-color: #F1F1F1;
width: 400px;
margin: auto;
}
.main_add_exercise {
background - color: #F1F1F1;
width: 100 %;
left: 0;
top: 0;
}
.title_div {
position: relative;
display: flex;
align-items: center;
background-color: white;
padding: 10px;
}
.cancel_text {
position: absolute;
left: 10;
}
.title_text {
display: flex;
margin: 0 auto;
align-self: center;
}
.sm_title_text {
text-align: center;
}
.note_text_area {
padding: 20px;
margin-top: 20px;
background-color: white;
border: 1px solid #E9E9E9;
}
.submit_area {
margin-top: 20px;
padding: 10px;
background-color: #41B2AA;
color: white;
text-align: center;
vertical-align: middle;
font-size: 150%;
position: fixed;
bottom: 0%;
right: 50;
width: 400px;
}
.activities {
margin-top: 15px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.activity {
width: 25%;
text-align: center;
}
.time_selector {
margin-top: 10px;
text-align: center;
}
select {
border: none;
}
</style>
<script>
angular.module('addExerciseApp', [])
.controller('AddExerciseController', function() {
var c = this;
c.data = [];
if (localStorage.exercises) {
c.data.exercises = JSON.parse(localStorage.getItem('exercises'));
} else {
c.data.exercises = [];
}
c.addExercise = function() {
var new_exercise = {};
new_exercise.activity = c.activity;
new_exercise.duration = c.duration;
new_exercise.date = new Date();
c.data.exercises.push(new_exercise);
// Put the object into storage
localStorage.setItem('exercises', JSON.stringify(c.data.exercises)); // this need to be removed if fulture platform is determined
window.location = 'Meal_Exercise.html';
};
c.back = function() {
window.location = 'Meal_Exercise.html';
};
});
</script>
<head>
<title>Add Exercise</title>
</head>
<body>
<div class="main_add_exercise" ng-controller="AddExerciseController as c">
<div class="title_div">
<div class="cancel_text" ng-click="c.back()"><img src = "images/remove.png" height = "15px" width = "15px"/></div>
<div class="title_text"><b>ADD EXERCISE</b></div>
</div>
<div class="note_text_area">
<div class="sm_title_text">
<b>ACTIVITY</b>
</div>
<div class="activities">
<div class="activity" ng-click="c.activity = 'Walking';">
<img src="images/walking.png" height="42" width="42"><br><label>Walking</label>
</div>
<div class="activity" ng-click="c.activity = 'Biking';">
<img src="images/biking.png" height="42" width="42"><br><label>Biking</label>
</div>
<div class="activity" ng-click="c.activity = 'Swimming';">
<img src="images/swimming.png" height="42" width="42"><br><label>Swimming</label>
</div>
<div class="activity" ng-click="c.activity = 'Running';">
<img src="images/running.png" height="42" width="42"><br><label>Running</label>
</div>
</div>
</div>
<div class="note_text_area">
<div class="sm_title_text">
<b>SELECT A TIME</b>
</div>
<div class="time_selector">
<select ng-model="c.duration">
<option value="15">15 minutes</option>
<option value="30">30 minutes</option>
<option value="45">45 minutes</option>
<option value="60">1 hour</option>
<select>
</div>
</div>
<div ng-click="c.addExercise()" class = "submit_area">
<span>Submit</span>
</div>
</div>
</body>
</html>