-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.html
140 lines (129 loc) · 5.57 KB
/
update.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
<html>
<head>
<title>Update</title>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<style>
.card{
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin-top: 80px;
margin-right: 150px;
margin-left: 120px;
background-color: #FDDFD7;
}
body{
background-color: #F5F2F2;
}
#image{
padding-right: 35px;
padding-top: 5px;
}
</style>
</head>
<body>
<!--navbar-->
<nav class="navbar navbar-expand-lg navbar-light bg-danger" role="navigation" id="nav">
<div class="container-fluid">
<span class="navbar-brand mb-0 h1">Blood Bags</span>
<div class="d-flex">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav ">
<li class="nav-item">
<a class="nav-link" href="index.html"><font color="white">Home</a></font>
</li>
</ul>
</div>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
<section>
<div id="image">
<img src="images/2.png" align="right">
</div>
<div class="card mb-3" style="width: 20rem;">
<div class="card-body">
<h5 class="card-header">Enter Data</h5><br>
<form>
<p> <label> BLOOD BANK </label> <input type="text" id="name" required></p>
<label>USER ID </label> <input type="text" id="USERID" required> <br>
<label>O+ </label> <input type="text" id="o+" required> <br>
<label>B+ </label><input type="text" id="b+" required><br>
<label>AB+</label><input type="text" id="ab+" required><br>
<label>O- </label><input type="text" id="o-" required><br>
<label>B- </label> <input type="text" id="b-" required><br>
<label>AB-</label><input type="text" id="ab-" required> <br>
<label>A- </label> <input type="text" id="a-" required><br>
<label>A+ </label> <input type="text" id="a+" required> <br>
<button type="button" class="btn btn-primary" id="submit" onclick="submitclick()">ADD</button>
<button type="button" class="btn btn-primary" id="update">update</button>
</form>
</div>
</div>
</section>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-database.js"></script>
<script>
const firebaseConfig = {
apiKey: "AIzaSyDFmKiLjoVhxENC_CbR3d5gsZh_AWepgfE",
authDomain: "blood-bag-9f4bb.firebaseapp.com",
databaseURL: "https://blood-bag-9f4bb-default-rtdb.firebaseio.com/",
projectId: "blood-bag-9f4bb",
storageBucket: "blood-bag-9f4bb.appspot.com",
messagingSenderId: "581180260792",
appId: "1:581180260792:web:719380949b612bfc0b8f4d",
measurementId: "G-CLF42XWNQF"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
var userid= document.getElementById("USERID");
var opositive= document.getElementById("o+");
var onegative= document.getElementById("o-");
var bnegative= document.getElementById("b-");
var bpositive= document.getElementById("b+");
var abnegative= document.getElementById("ab-");
var abpositive= document.getElementById("ab+");
var anegative= document.getElementById("a-");
var apositive= document.getElementById("a+");
var bankname= document.getElementById("name");
var msgg= document.getElementById("name");
var updatebtn= document.getElementById("update");
function submitclick() {
firebase.database().ref('/users/' + msgg.value).set({
Bank: bankname.value,
opositive: opositive.value,
onegative: onegative.value,
bpositive: bpositive.value,
bnegative: bnegative.value,
abpositive: abpositive.value,
abnegative: abnegative.value,
apositive: apositive.value,
anegative: anegative.value
});
}
var database=firebase.database();
updatebtn.addEventListener('click',hello);
function hello(){
const newdata={
opositive: opositive.value,
onegative: onegative.value,
bpositive: bpositive.value,
bnegative: bnegative.value,
abpositive: abpositive.value,
abnegative: abnegative.value,
apositive: apositive.value,
anegative: anegative.value,
Bank: bankname.value,
}
const updates={};
updates['/users/'+ msgg.value]= newdata;
database.ref().update(updates);
}
</script>
</body>
</html>