-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
345 lines (297 loc) · 12.6 KB
/
index.html
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ethiopian Preg Wheel</title>
<!-- <link rel="stylesheet" href="../../app/app.css"> -->
<link rel="stylesheet" href="resources/css/bootstrap.min.css">
<!-- <link rel="stylesheet" href="/resources/css/bootstrap-responsive.min.css"> -->
<script src="resources/js/jquery-1.9.1.js"></script>
<!-- // <script src="/resources/js/jquery-ui-1.10.3.custom.min.js"></script> -->
<script src="resources/js/bootstrap.min.js"></script>
<script type="text/javascript" src="resources/jquery/jquery.calendars.js"></script>
<script type="text/javascript" src="resources/jquery/jquery.calendars.plus.js"></script>
<script type="text/javascript" src="resources/jquery/jquery.calendars.ethiopian.js"></script>
<script type="text/javascript" src="resources/jquery/jquery.calendars.picker.js"></script>
<script type="text/javascript">
var first = true;
var second = true;
$(function() {
var calendar;
$('[type="radio"]').change(function() {
if (first) {
calendar = $.calendars.instance('ethiopian');
first = false;
}
else if(second) second = false;
else if(!second){
calendar = $.calendars.instance($(this).val());
}
$('#default').text(calendar.local.dateFormat);
}).change();
var dateInputError = false;
$('#check').click(function() {
try {
if (dateInputError){
$("#dateInput").removeClass("error");
$("#errortext").text("");
};
var date = calendar.parseDate('', $('#input').val()); // var datecon = date;
var datecon = date.newDate().add(2,'w');
var date1st = date.newDate().add(12,'w'); // alert(date1st);
var date2nd = date.newDate().add(27,'w');
var date3rd = date.newDate().add(40,'w');
// console.log(current-date);
var unix1 = calendar.formatDate("@", datecon);
var unix2 = calendar.formatDate("@", date1st);
var unix3 = calendar.formatDate("@", date2nd);
var unix4 = calendar.formatDate("@", date3rd);
var unix0 = calendar.formatDate("@",date);
var date22 = calendar.today().formatDate("@");
var age = date22-unix0;
age = age/604800;
console.log("Weeks: " + age);
var weeks= Math.floor(age);
// console.log("Week: " + Math.floor(age));
var days =parseInt(7*(age-Math.floor(age)))
console.log("Days: " + days);
if (weeks != 1) {
weekStr = "weeks";
}
else {
weekStr = "week";
};
if (days != 1) {
dayStr = "days";
}
else {
dayStr = "day";
};
var ageString = weeks + " " + weekStr + ", " + days + " " + dayStr;
// alert(ageString);
// console.log("W weeks%7);
if(($('input:checked').val())== 'ethiopian'){
calendar2 = $.calendars.instance('');
// var unix0 = calendar.formatDate("@",date);
// // console.log("unix0 " + unix0);
// var date22 = calendar.today().formatDate("@");
// // var current = date22.format("@",date);
// // console.log("current " + date22);
// var age = date22-unix0;
// // console.log(age);
// // 146361600
// var weeks = age/604800;
// console.log(weeks);
$('#GAge').text(ageString);
$('#Eoutput0').text((calendar.formatDate("MM d, yyyy", datecon)));
$('#Eoutput1').text((calendar.formatDate("MM d, yyyy", date1st)));
$('#Eoutput2').text((calendar.formatDate("MM d, yyyy", date2nd)));
$('#Eoutput3').text((calendar.formatDate("MM d, yyyy", date3rd)));
$('#Goutput0').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix1))));
$('#Goutput1').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix2))));
$('#Goutput2').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix3))));
$('#Goutput3').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix4))));
}
else {
calendar2 = $.calendars.instance('ethiopian');
// console.log(weeks);
$('#GAge').text(ageString);
$('#Goutput0').text((calendar.formatDate("MM d, yyyy", datecon)));
$('#Goutput1').text((calendar.formatDate("MM d, yyyy", date1st)));
$('#Goutput2').text((calendar.formatDate("MM d, yyyy", date2nd)));
$('#Goutput3').text((calendar.formatDate("MM d, yyyy", date3rd)));
$('#Eoutput0').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix1))));
$('#Eoutput1').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix2))));
$('#Eoutput2').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix3))));
$('#Eoutput3').text((calendar2.formatDate("MM d, yyyy", calendar2.parseDate("@", unix4))));
}
}
catch (e) {
// alert(e);
dateInputError = true;
$("#dateInput").addClass("error");
$("#errortext").text("- " + e);
}
});
});
</script>
<script type="text/javascript">
// $(function() {
// // $.calendars.picker.setDefaults({renderer: $.calendars.picker.themeRollerRenderer}); // Requires jquery.calendars.picker.ext.js
// $('#popupDatepicker').calendarsPicker({calendar: $.calendars.instance('ethiopian')});
// $('#inlineDatepicker').calendarsPicker({calendar: $.calendars.instance('ethiopian'), onSelect: showDate});
// });
// function showDate(date) {
// alert('The date chosen is ' + date);
// }
</script>
<style>
body {
/*padding-top: 60px; */
/*60px to make the container go all the way to the bottom of the topbar */
}
</style>
<!-- <link rel="stylesheet" href="css/main.css"> -->
<!-- <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> -->
</head>
<!-- <header> -->
<!-- </header> -->
<body>
<!-- <div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="#">Ethiopian Med Tools</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><a href="/resources/index1.html">Home</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Trachoma Tracker<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/resources/views/index1.html">Data Entry Form</a></li>
<li><a href="/resources/views/guide.html">Guide to Trachoma</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li><a href="/resources/views/calendar.html">Ethiopian Pregnancy Wheel</a></li>
<li><a href="/resources/views/about.html">About & Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
-->
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Ethiopia Pregnancy Wheel</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><a href="about.html">About & Contact</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
<div class="container">
<!-- <h2>Ethiopian Pregnancy Wheel</h2> -->
<!-- <div class="row"> -->
<!-- <div class="span10"> -->
<!-- <div class="row">
<div class="span4">...</div>
<div class="span4">...</div>
</div> -->
<p>Input Calendar:
<!-- <select id="calendar"> -->
<!-- <option value="ethiopian">Ethiopian</option> -->
<!-- <option value="gregorian">Gregorian</option> -->
<!-- </select> -->
<br>
<label class="radio inline">
<input type="radio" name="optionsRadios" id="calendar" value="ethiopian" checked>
Ethiopian
</label>
<label class="radio inline">
<input type="radio" name="optionsRadios" id="optionsRadios2" value="gregorian">
Gregorian
</label>
<!-- <p>Enter LMP: <input type="text" id="input2" value="01/1/2009"> </p> -->
<div id="dateInput" class="control-group">
<label class="control-label" for="input">Enter LMP: </label>
<div class="controls">
<input type="text" id="input" value="07/22/2013">
<span class="help-inline"><span id="default"></span> <span id="errortext"></span> </span>
</div>
</div>
<!-- <p>Check and format: <input type="text" id="format" value="DD, MM d, yyyy"> -->
<p><br>
<button type="button" class="btn" id="check">Calculate</button></p>
<!-- <p>Result: <input type="text" id="Eoutput" size="40" readonly></p> -->
<div class="row">
<div class="span5">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th></th>
<th>Ethiopian Calendar</th>
<th>Gregorian</th>
<!-- <th>Username</th> -->
</tr>
</thead>
<tbody>
<tr>
<td>Conception Occurred: <br> <small>(2 weeks after LMP)</small></td>
<td><span id="Eoutput0"></span></td>
<td><span id="Goutput0"></span></td>
<!-- <td>@mdo</td> -->
</tr>
<tr>
<td>First Trimester Ends: <br> <small>(12 weeks)</small></td>
<td><span id="Eoutput1"></span></td>
<td><span id="Goutput1"></span></td>
<!-- <td>@fat</td> -->
</tr>
<tr>
<td>Second Trimester Ends: <br> <small>(27 weeks)</small> </td>
<td><span id="Eoutput2"></span></td>
<td><span id="Goutput2"></span></td>
<!-- <td>@twitter</td> -->
</tr>
<tr>
<td>Due Date: <br> <small>(40 weeks)</small> </td>
<td><span id="Eoutput3"></span></td>
<td><span id="Goutput3"></span></td>
<!-- <td>@twitter</td> -->
</tr>
<tr>
<td>Current Gestational Age: </td>
<td><span id="GAge"></span></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- <span id="Eoutput3test"> Hi</span> -->
<!-- <p>Due Date: <input type="text" id="output" size="40" readonly></p> -->
<!-- {{}} -->
<!-- <h3>New Patient Documentation</h3>
<p>Document a trachoma. <br> More helper text.</p>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputFirst">First Name</label>
<div class="controls">
<input type="text" id="inputFirst" placeholder="John">
</div>
</div>
</form>
-->
<hr>
<!-- </div> -->
<!-- </div> -->
</div>
<!-- <td-todos></td-todos> -->
<!-- <footer id="info">
<p>Footer</p>
</footer> -->
<!-- Scripts here. Don't remove this ↓ -->
<!-- // <script src="../../components/polymer/polymer.min.js"></script> -->
<!-- <link rel="import" href="elements/td-todos.html"> -->
</body>
<!-- <script src="http://code.angularjs.org/1.0.2/angular.min.js"></script> -->
<!-- <script src="js/angular-ui.min.js"></script> -->
<!-- <script src="js/app.js"></script> -->
</html>