-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheresept.html
138 lines (130 loc) · 4.64 KB
/
eresept.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>eresept Sykehusapotekene Sør øst</title>
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript' src="http://knockoutjs.com/downloads/knockout-3.0.0.js"></script>
<script type='text/javascript' src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
</head>
<body>
<div data-role="page" id="front">
<div data-role="header">
<h3>Sykehusapotekene HF </h3>
<a href="#bestillinger" data-role="button">Liste</a>
</div>
<div data-role="main" class="ui-content">
<h3>Hvor vil du hente ut din eresept?</h3>
<div class="ui-field-contain">
<label for="apotek">Velg sykehusapotek:</label>
<select id="apotek" data-bind="value: bestilling.apotek">
<option>Arendal</option>
<option>Bærum</option>
<option>Drammen</option>
<option>Elverum</option>
<option>Fredrikstad</option>
<option>Gjøvik</option>
<option>Hamar</option>
<option>Kongsvinger</option>
<option>Kristiansand</option>
<option>Lillehammer</option>
<option>Lørenskog</option>
<option>Moss</option>
<option>Radiumhospitalet</option>
<option>Rikshospitalet</option>
<option>Skien</option>
<option>Tønsberg</option>
<option>Ullevål</option>
</select>
</div>
<div class="ui-field-contain">
<label for="personnummer">Ditt fødselsnummer:</label>
<input id="personnummer" data-bind="value: bestilling.personnr" />
</div>
<div class="ui-field-contain">
<label for="navn">Hele ditt navn:</label>
<input id="navn" data-bind='value: bestilling.navn' />
</div>
<div class="ui-field-contain">
<label for="medisin">Medisin om kjent:</label>
<textarea id="medisin" data-bind="value: bestilling.medisin"></textarea>
</div>
<div class="ui-field-contain">
<label for="telefon">Ditt telefonnummer:</label>
<input id="telefon" data-bind="value: bestilling.telefon" />
</div>
<div class="ui-field-contain">
<label for="epost">Din e-postadresse:</label>
<input id="epost" data-bind="value: bestilling.epost" />
</div>
<h3>NB! TEST SIDE KUN!</h3>
<hr/>
<a href="#" onclick="javascript: sendData();" data-role="button">Send inn din bestilling</a>
</div>
</div>
<div data-role="page" id="bestillinger">
<div data-role="header">
<a href="#front" data-role="button">Hjem</a>
<h3>Bestillinger</h3>
</div>
<div data-role="content">
<table>
<thead>
<tr><th>Apotek</th><th>Navn</th></tr>
</thead>
<tbody data-bind="foreach: bestillinger">
<tr>
<td data-bind="text: apotek"></td>
<td data-bind="text: navn"></td>
</tr>
</tbody>
</table>
<a href="#" onclick="getData();" data-role="button">Oppdater</a>
</div>
</div>
<script type='text/javascript'>
var viewModels = {
bestilling: {
personnr: ko.observable(""),
navn: ko.observable(""),
medisin: ko.observable(""),
apotek: ko.observable(""),
telefon: ko.observable(""),
epost: ko.observable("")
},
bestillinger: ko.observableArray()
};
ko.applyBindings(viewModels);
function getData() {
$.ajax({
type: 'GET',
dataType: "json",
url: "http://it4se.com:1337/prescription/",
xhrFields: {
withCredentials: true
}
}).done(function(data) {
console.log("got data");
viewModels.bestillinger(data);
});
}
function sendData() {
$.ajax({
type: 'POST',
url: "http://it4se.com:1337/prescription/",
data: viewModels.bestilling,
xhrFields: {
withCredentials: true
}
}).done(function(msg) {
console.log("message: ", msg);
});
}
$("#bestillinger").on( "pageinit", function( event ) {
getData();
});
</script>
</body>
</html>