|
|
@@ -4,55 +4,30 @@
|
|
4
|
4
|
<head>
|
|
5
|
5
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
|
6
|
6
|
<script type="text/javascript" src="jquery-1.3.2.js"></script>
|
|
7
|
|
- <title>Reporting</title>
|
|
|
7
|
+ <script type="text/javascript" src="reporting.js"></script>
|
|
|
8
|
+ <link rel="stylesheet" type="text/css" href="main.css"/>
|
|
|
9
|
+ <title>DDDSample Reporting</title>
|
|
8
|
10
|
</head>
|
|
9
|
11
|
<body>
|
|
10
|
|
- <h1 id="apa">Reporting</h1>
|
|
11
|
|
- <div>
|
|
12
|
|
- <form action="" method="get" onsubmit="search(); return false;">
|
|
13
|
|
- Search:
|
|
14
|
|
- <input id="query" name="query" type="text"/>
|
|
15
|
|
- <input id="submit" name="submit" type="submit" value="Search"/>
|
|
16
|
|
- </form>
|
|
|
12
|
+ <img id="background" src="background.png" alt=""/>
|
|
|
13
|
+ <div id="content">
|
|
|
14
|
+ <div id="header">
|
|
|
15
|
+ <img src="dddsample.png" alt="dddsample"/>
|
|
|
16
|
+ </div>
|
|
|
17
|
+ <div id="form">
|
|
|
18
|
+ <form action="" method="get" onsubmit="search(); return false;">
|
|
|
19
|
+ Track cargo or voyage:
|
|
|
20
|
+ <input id="query" name="query" type="text" size="30" value="ABC"/>
|
|
|
21
|
+ <input id="submit" name="submit" type="submit" value="Track"/>
|
|
|
22
|
+ </form>
|
|
|
23
|
+ </div>
|
|
|
24
|
+ <div id="result"></div>
|
|
|
25
|
+ <div id="footer">
|
|
|
26
|
+ Created by <a href="http://www.citerus.se">Citerus</a> and <a href="http://www.domainlanguage.com">Domain Language</a>
|
|
|
27
|
+ </div>
|
|
17
|
28
|
</div>
|
|
18
|
|
- <div id="result"></div>
|
|
19
|
29
|
<script type="text/javascript">
|
|
20
|
30
|
$('#query').focus();
|
|
21
|
|
-
|
|
22
|
|
- function search() {
|
|
23
|
|
- $.ajax({
|
|
24
|
|
- url: "http://localhost:8080/reporting/rest/cargo/" + $("#query").val() + ".json",
|
|
25
|
|
- type: 'GET',
|
|
26
|
|
- contentType: 'application/json',
|
|
27
|
|
- success: function(response) {
|
|
28
|
|
- var json = eval('(' + response + ')');
|
|
29
|
|
- var cargo = json.cargoReport.cargo;
|
|
30
|
|
- $('#result').empty();
|
|
31
|
|
- var pdfUrl = "http://localhost:8080/reporting/rest/cargo/" + $("#query").val() + ".pdf"
|
|
32
|
|
- $('#result').
|
|
33
|
|
- append('<p><a href="' + pdfUrl + '">Download PDF</a></p>').
|
|
34
|
|
- append('<h2>Cargo ' + cargo.trackingId + '</h2>').
|
|
35
|
|
- append('<p>Destination: ' + cargo.finalDestination + ' (at ' + cargo.arrivalDeadline + ')</p>')
|
|
36
|
|
-
|
|
37
|
|
- if (cargo.currentLocation) {
|
|
38
|
|
- $('#result').append('<p>Status: ' + cargo.currentStatus + ' ' + cargo.currentLocation + '</p>');
|
|
39
|
|
- } else if (cargo.currentVoyage) {
|
|
40
|
|
- $('#result').append('<p>Status: ' + cargo.currentStatus + ' ' + cargo.currentVoyage + '</p>');
|
|
41
|
|
- }
|
|
42
|
|
-
|
|
43
|
|
- $('#result').append('<p>Updated on: ' + cargo.lastUpdatedOn + '</p>');
|
|
44
|
|
-
|
|
45
|
|
- for (var handling in json.cargoReport.handlings) {
|
|
46
|
|
- $('#result').append('<p>' + handling['location'] + '</p>');
|
|
47
|
|
- }
|
|
48
|
|
- },
|
|
49
|
|
- error: function(response) {
|
|
50
|
|
- if (response.status == 404) {
|
|
51
|
|
- $('#result').text('No cargo with tracking id ' + $("#query").val());
|
|
52
|
|
- }
|
|
53
|
|
- }
|
|
54
|
|
- });
|
|
55
|
|
- }
|
|
56
|
31
|
</script>
|
|
57
|
32
|
</body>
|
|
58
|
33
|
</html>
|