-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
243 lines (221 loc) · 9.17 KB
/
Copy pathindex.html
File metadata and controls
243 lines (221 loc) · 9.17 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
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
<html>
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyAC3PHQD7MnucaVHESt32c8rj3dF5iF7eg",
authDomain: "remote-check-up-for-ceeri.firebaseapp.com",
databaseURL: "https://remote-check-up-for-ceeri.firebaseio.com",
storageBucket: "remote-check-up-for-ceeri.appspot.com",
};
var app = firebase.initializeApp(config);
var database = app.database;
var databaseRef = database().ref().child('Patients UID');
databaseRef.on('child_added', function(snapshot){
var patientList = snapshot.val();
patientList.key = snapshot.key;
addItem(patientList, "pats");
});
</script>
<head>
<title>Remote Checkup</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.blue-deep_purple.min.css" />
<script defer src="https://code.getmdl.io/1.1.3/material.min.js"></script>
<script src="jquery.elevatezoom.js" type="text/javascript"></script>
<script src="dialog-polyfill.js"></script>
<link rel="stylesheet" href="dialog-polyfill.css" type="text/css"/>
<script type='text/javascript'>
function addItem(patient){
var dataa = JSON.stringify(patient);
$('#pats').append(
"<div data-mydata='"+ dataa +"' class='pdetails mdl-cell mdl-cell--1-col mdl-button--raised mdl-button square-card mdl-card mdl-shadow--4dp mdl-js-ripple-effect'>"+
"<div class= 'mdl-typography--display-3-color-contrast mdl-typography--text-right'>"+
patient["Blood Group"]+
"</div>"+
"<div class='mdl-card__title-text mdl-typography--text-right'>"+
patient["Name"]+
"</div>"+
"<div class='mdl-card__supporting-text'>"+
patient["Illness"]+
"</div>"+
"<div class='mdl-card__supporting-text'>"+
patient["Date of Birth"]+
"</div>"+
"</div>"
);
};
var currentKey;
function updateDetails(patient){
currentKey = patient.key;
name = patient["Name"];
illness = patient["Illness"];
dob = patient["Date of Birth"];
bg = patient["Blood Group"];
im = patient["Images"];
for(var key in im)
{
$('#pdialog').html('<img src="' + im[key] + '">');
}
$('#pdialog').html(
'<h4 class="mdl-dialog__title">Details</h4>'+
'<div class="mdl-dialog__content">'+
'<div class= "mdl-typography--display-3-color-contrast mdl-typography--text-right">'+
bg+
'</div>'+
'<div class="mdl-card__title-text mdl-typography--text-right">'+
name+
'</div>'+
'<div class="mdl-card__supporting-text">'+
illness+
'</div>'+
'<div class="mdl-card__supporting-text">'+
dob+
'</div>'+
'<div class="mdl-card__supporting-text"><p>Duis eu nunc at nunc ultrices volutpat et et tellus. Nunc ultrices sollicitudin arcu, et lacinia lectus euismod nec. Curabitur luctus malesuada erat blandit auctor. Nunc interdum vehicula iaculis. Nunc dolor orci, tincidunt ac interdum a, malesuada sit amet nulla. In nibh nunc, tincidunt eu arcu at, fermentum facilisis mauris. Vestibulum rutrum pulvinar imperdiet. Sed sapien erat, molestie ut sem nec, luctus egestas eros. Ut interdum felis at auctor interdum. Curabitur eu mattis libero. Suspendisse non rhoncus ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed a metus vitae ante commodo tincidunt.</p>'+
'</div>'+
'<div id="img-grid" class="mdl-grid"></div>'+
'<form>'+
'<div class="mdl-textfield mdl-js-textfield">'+
'<textarea id="remarkt" class="mdl-textfield__input" type="text" rows= "5" id="sample5" placeholder="Write here, Doc!" ></textarea>'+
'</div>'+
'</form>'+
'</div>'+
'<div class="mdl-dialog__actions">'+
'<button type="button" class="mdl-button remarkb">Remark</button>'+
'<button type="button" class="mdl-button close">Cancel</button>'+
'</div>'
);
for(var key in im)
{
$('#img-grid').append('<div class= "demo-card-image mdl-cell mdl-cell-1-col mdl-card">1<img src="'+
im[key]+'"/></div>');
}
}
</script>
<style>
.square-card.mdl-card {
width: 220px;
height: 220px;
}
img{
max-width: 200px;
height:
}
.demo-card-image.mdl-card {
width: 256px;
height: 256px;
}
.no-padhead.mdl-layout__header-row{
padding-left: 10px;
padding: right: 10px;
}
</style>
</head>
<body>
<div class= "mdl-layout mdl-js-layout">
<header class="mdl-layout__header mdl-layout--fixed header">
<div class="no-padhead mdl-layout__header-row">
<h3><img src="Remote_Checkup_logo.png"/><h3>
</div>
</header>
<main id= 'pats' class="mdl-grid mdl-layout__content mdl-layout-spacer">
<div class="pdetails mdl-cell mdl-cell--1-col mdl-button--raised mdl-button square-card mdl-card mdl-shadow--4dp mdl-js-ripple-effect">
<div class= "mdl-typography--display-3-color-contrast mdl-typography--text-right">
AB+
</div>
<div class="mdl-card__title-text mdl-typography--text-right">
John Doe
</div>
<div class="mdl-card__supporting-text">
Skin Cancer
</div>
<div class="mdl-card__supporting-text">
17 April 2016
</div>
</div>
<dialog id='pdialog' style="width: 50%; max-height: 80%; overflow-y: scroll; position: center;" class="mdl-dialog">
<h4 class="mdl-dialog__title">Details</h4>
<div class="mdl-dialog__content">
<div class= "mdl-typography--display-3-color-contrast mdl-typography--text-right">
AB+
</div>
<div class="mdl-card__title-text mdl-typography--text-right">
John Doe
</div>
<div class="mdl-card__supporting-text">
Skin Cancer
</div>
<div class="mdl-card__supporting-text">
17 April 2016
</div>
<!-- <div class="mdl-grid">
<div class=" demo-card-image mdl-cell mdl-cell-1-col mdl-card">1
<img id="zoom_01" src="images/small/image1.png" data-zoom-image="images/large/image1.jpg"/>
</div>
</div> -->
<form>
<div class="mdl-textfield mdl-js-textfield">
<textarea class="mdl-textfield__input" type="text" rows= "3" id="sample5" ></textarea>
<label class="mdl-textfield__label" for="sample5">Your remarks go here, Doc!</label>
</div>
</form>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button remarkb">Remark</button>
<button type="button" class="mdl-button close">Cancel</button>
</div>
</dialog>
<!-- <script>
$("#zoom_01").elevateZoom();
</script> -->
<script>
var dialog = document.querySelector('dialog');
var showDialogButton = document.querySelector('#pdetails');
if (! dialog.showModal) {
dialogPolyfill.registerDialog(dialog);
}
// if(jQuery.type(data['Images']) === "string")
// {
// temp.append('<img src=' + data["Images"] + '>');
// }
// else {
// var images = data['Images'];
// for(var key in images)
// {
// temp.append('<img src=' + images[key] + '>');
// }
// }
$("#pats").on('click', '.pdetails', function () {
var patientList = JSON.parse($(this).attr('data-mydata'));
updateDetails(patientList);
dialog.showModal();
});
$("#pdialog").on('click', '.close', function () {
dialog.close();
});
$("#pdialog").on('click', '.remarkb', function(){
var remark = $("#remarkt").val();
writeUserData(name, bg, dob, illness, remark);
dialog.close();
});
function writeUserData(name, bg, dob, illness, remark){
var postData = {
Name: name,
'Date of Birth': dob,
'Blood Group': bg,
Illness: illness,
Remarks: remark
};
var updates = {};
updates['/Patients UID/' + currentKey + '/'] = postData;
return firebase.database().ref().update(updates);
};
</script>
</main>
</div>
</body>
</html>