-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupplyChain.html
128 lines (122 loc) · 3.85 KB
/
supplyChain.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
<!DOCTYPE html>
<html>
<head>
<title>Vaccine Supply Chain</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js" type="application/javascript"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCY-PZZ8Q5lV3py2-f-7ogkM5P_HRJ0r5k&libraries=places"></script>
<script src="session1.js"></script>
<script src="supplyChain.js"></script>
<style>
/* ... (CSS styles for tabs and content) ... */
body {
font-family: sans-serif;
}
.tab {
overflow: hidden;
border: 1px solid #ccc;
background-color: #244461;
}
.tab button {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
font-size: 17px;
}
.tab button:hover {
background-color: #3ea86b;
}
.tab button.active {
background-color: #3ea86b;
}
.tabcontent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
label {
display: block;
margin-bottom: 5px;
}
input {
width: 300px;
padding: 8px;
margin-bottom: 10px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
#map {
height: 400px;
width: 100%;
}
</style>
</head>
<body>
<h2>Vaccine Supply Chain</h2>
<h4 id="walletAddress"></h4>
<div class="tab">
<button class="tablinks" onclick="openTab(event, 'Manufacturer')" id="defaultOpen">Manufacturer</button>
<button class="tablinks" onclick="openTab(event, 'Distributor')">Distributor</button>
<button class="tablinks" onclick="openTab(event, 'Hospital')">Hospital</button>
</div>
<div id="Manufacturer" class="tabcontent">
<h3>Create Batch</h3>
<label for="batchId">Batch ID:</label>
<input type="number" id="batchId" />
<label for="vaccineCount">Vaccine Count:</label>
<input type="number" id="vaccineCount" />
<label for="desc">Description:</label>
<input type="string" id="desc" />
<button onclick="createVaccineBatch()">Create Vaccine Batch</button>
</div>
<div id="Distributor" class="tabcontent">
<h3>Update Location</h3>
<label for="batchIdLocation">Batch ID:</label>
<input type="number" id="batchIdLocation" />
<label for="latitude">Latitude:</label>
<input type="number" id="latitude" step="0.000001" />
<label for="longitude">Longitude:</label>
<input type="number" id="longitude" step="0.000001" />
<label for="locationName">Location Name:</label>
<input type="string" id="locationName" />
<button onclick="updateVaccineLocation()">Update Vaccine Location</button>
</div>
<div id="Hospital" class="tabcontent">
<h3>Location History</h3>
<label for="batchIdMap">Batch ID:</label>
<input type="number" id="batchIdMap" />
<button onclick="showOnMap()">Show on Map</button>
<div id="map"></div>
</div>
<script>
// ... (Contract details - address, ABI) ...
// Tab Functionality
function openTab(evt, tabName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
document.getElementById("defaultOpen").click();
</script>
</body>
</html>