Skip to content

Commit 35b980e

Browse files
author
meer sawood
committed
fix : notification
1 parent cdf83f4 commit 35b980e

File tree

3 files changed

+207
-139
lines changed

3 files changed

+207
-139
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
env/
2-
venv/
2+
venv/
3+
4+
*.db

templates/base.html

+9
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,13 @@
130130
{% endblock %}
131131

132132
</body>
133+
134+
135+
<script type="text/javascript">
136+
function send_notification_clicked(email)
137+
{
138+
var element = document.getElementById("contactform");
139+
element.setAttribute("action", '/contactforblood/'+email);
140+
}
141+
</script>
133142
</html>

templates/index.html

+195-138
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,219 @@
1-
{% extends "base.html" %}
2-
3-
{% block content %}
1+
{% extends "base.html" %} {% block content %}
42

53
<div class="container-fluid">
6-
<center>
7-
<div class="card text-left mt-3" style="width: 35rem;">
8-
<div class="card-body">
9-
10-
<form class="form-group" action = "{{url_for('index')}}" method = "POST">
4+
<center>
5+
<div class="card text-left mt-3" style="width: 35rem">
6+
<div class="card-body">
7+
<form class="form-group" action="{{url_for('index')}}" method="POST">
118
<label for="sel"> Search by:</label>
12-
<select name="type" class="form-control" id="exampleFormControlSelect1" required>
9+
<select
10+
name="type"
11+
class="form-control"
12+
id="exampleFormControlSelect1"
13+
required
14+
>
1315
<option value="blood">blood group</option>
14-
<option value="donorname">donorname</option>
15-
</select><br>
16-
<input class="form-control mr-sm-2" type="search" name="search" placeholder="Search" aria-label="Search" required><br>
17-
<center><button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button></center>
18-
</form>
16+
<option value="donorname">donorname</option></select
17+
><br />
18+
<input
19+
class="form-control mr-sm-2"
20+
type="search"
21+
name="search"
22+
placeholder="Search"
23+
aria-label="Search"
24+
required
25+
/><br />
26+
<center>
27+
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">
28+
Search
29+
</button>
30+
</center>
31+
</form>
1932
</div>
2033
</div>
2134
</center>
2235
</div>
23-
<div class="container-fluid mb-2 mt-2">
24-
{% if search!=NULL %}
25-
<nav aria-label="breadcrumb">
26-
<ol class="breadcrumb">
27-
<li class="breadcrumb-item active" aria-current="page"> Search results:
36+
<div class="container-fluid mb-2 mt-2">
37+
{% if search!=NULL %}
38+
<nav aria-label="breadcrumb">
39+
<ol class="breadcrumb">
40+
<li class="breadcrumb-item active" aria-current="page">
41+
Search results:
2842
</li>
29-
</ol>
30-
</nav>
31-
32-
33-
34-
<center>
35-
{% for s in search %}
36-
<div class="card text-left" style="width: 70rem;">
37-
<div class="card-header"> {{s["name"]}} </div>
38-
<div class="card-body ml-3">
39-
<h5 class="card-title ml-3"> {{s['email']}} </h5>
40-
<h6 class="card-subtitle mb-2 ml-3 text-muted"> Blood Group: {{s['bg']}}</h6>
41-
<p class="card-text ml-3"> Address:
42-
{{s["addr"]}}
43-
{{ s["city"]}}
44-
{{s['pin']}}
45-
<br>
46-
47-
48-
{% if session['username'] == s['email']%}
49-
50-
<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover">
51-
<button class="btn btn-primary mt-2 content-justify-end" style="pointer-events: none;" type="button" disabled>contact for blood</button>
52-
</span>
53-
54-
{% elif session['logged_in'] == True %}
55-
56-
<button type="button" class="btn btn-primary mt-1 content-justify-end" data-toggle="modal" data-target="#exampleModalCenter">
57-
contact for blood
58-
</button>
59-
</p>
60-
61-
62-
{% endif %}</div>
63-
<br>
64-
{% endfor %}
43+
</ol>
44+
</nav>
45+
46+
<center>
47+
{% for s in search %}
48+
<div class="card text-left" style="width: 70rem">
49+
<div class="card-header">{{s["name"]}}</div>
50+
<div class="card-body ml-3">
51+
<h5 class="card-title ml-3">{{s['email']}}</h5>
52+
<h6 class="card-subtitle mb-2 ml-3 text-muted">
53+
Blood Group: {{s['bg']}}
54+
</h6>
55+
<p class="card-text ml-3">
56+
Address: {{s["addr"]}} {{ s["city"]}} {{s['pin']}}
57+
<br />
58+
59+
{% if session['username'] == s['email']%}
60+
61+
<span
62+
class="d-inline-block"
63+
data-toggle="popover"
64+
data-content="Disabled popover"
65+
>
66+
<button
67+
class="btn btn-primary mt-2 content-justify-end"
68+
style="pointer-events: none"
69+
type="button"
70+
disabled
71+
>
72+
contact for blood
73+
</button>
74+
</span>
75+
76+
{% elif session['logged_in'] == True %}
77+
78+
<button
79+
type="button"
80+
class="btn btn-primary mt-1 content-justify-end"
81+
data-toggle="modal"
82+
data-target="#exampleModalCenter"
83+
>
84+
contact for blood
85+
</button>
86+
</p>
6587

6688
{% endif %}
67-
68-
</div>
69-
</center>
70-
</div>
71-
<div class="container-fluid">
72-
<!-- Content here -->
73-
<nav aria-label="breadcrumb">
74-
<ol class="breadcrumb">
75-
<li class="breadcrumb-item active" aria-current="page">Registered donores:
76-
</li>
77-
</ol>
78-
</nav>
79-
80-
81-
82-
83-
84-
<center>
85-
{% for row in rows %}
86-
<div class="card text-left" style="width: 70rem;">
87-
<div class="card-header">
88-
{{row["name"]}}
89-
</div>
90-
<div class="card-body ml-3">
91-
<h5 class="card-title ml-3"> {{row['email']}}</h5>
92-
<h6 class="card-subtitle mb-2 ml-3 text-muted"> Blood Group: {{row['bg']}}</h6>
93-
<p class="card-text ml-3"> Address:
94-
{{row["addr"]}}
95-
{{ row["city"]}}
96-
{{row['pin']}}
97-
<br>
98-
{% if session['username'] == row['email']%}
99-
100-
<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover">
101-
<button class="btn btn-primary mt-2" style="pointer-events: none;" type="button" disabled>contact for blood</button>
102-
</span>
103-
104-
{% elif session['logged_in'] == True %}
105-
<button type="button" class="btn btn-primary mt-1" data-toggle="modal" data-target="#exampleModalCenter">
106-
contact for blood
107-
</button>
108-
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
109-
<div class="modal-dialog modal-dialog-centered" role="document">
110-
<div class="modal-content">
111-
<div class="modal-header">
112-
<h5 class="modal-title" id="exampleModalCenterTitle">contact for blood</h5>
113-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
114-
<span aria-hidden="true">&times;</span>
115-
</button>
116-
</div>
117-
<div class="modal-body">
118-
<form method="POST" action="{{url_for('contactforblood',emailid=row['email'])}}">
119-
<label for="name">Name</label>
120-
<input type ="text" name = "nm" class="form-control" required/>
121-
<label for="addr"> confirm your Address</label>
122-
<textarea name ="add" class="form-control" required></textarea>
123-
<button type="button" class="btn btn-secondary mt-1" data-dismiss="modal">Close</button>
124-
<button type="submit" class="btn btn-primary mt-1">send request</button>
12589
</div>
90+
<br />
91+
{% endfor %} {% endif %}
12692
</div>
127-
</div>
93+
</center>
12894
</div>
129-
130-
131-
{% endif %}
132-
133-
134-
135-
136-
137-
138-
139-
95+
<div class="container-fluid">
96+
<!-- Content here -->
97+
<nav aria-label="breadcrumb">
98+
<ol class="breadcrumb">
99+
<li class="breadcrumb-item active" aria-current="page">
100+
Registered donores:
101+
</li>
102+
</ol>
103+
</nav>
104+
105+
<center>
106+
{% for row in rows %}
107+
<div class="card text-left" style="width: 70rem">
108+
<div class="card-header">{{row["name"]}}</div>
109+
<div class="card-body ml-3">
110+
<h5 class="card-title ml-3">{{row['email']}}</h5>
111+
<h6 class="card-subtitle mb-2 ml-3 text-muted">
112+
Blood Group: {{row['bg']}}
113+
</h6>
114+
<p class="card-text ml-3">
115+
Address: {{row["addr"]}} {{ row["city"]}} {{row['pin']}}
116+
<br />
117+
{% if session['username'] == row['email']%}
118+
119+
<span
120+
class="d-inline-block"
121+
data-toggle="popover"
122+
data-content="Disabled popover"
123+
>
124+
<button
125+
class="btn btn-primary mt-2"
126+
style="pointer-events: none"
127+
type="button"
128+
disabled
129+
>
130+
contact for blood
131+
</button>
132+
</span>
133+
134+
{% elif session['logged_in'] == True %}
135+
<button
136+
type="button"
137+
class="btn btn-primary mt-1"
138+
onclick="send_notification_clicked('{{row['email']}}');"
139+
data-toggle="modal"
140+
data-target="#exampleModalCenter"
141+
142+
>
143+
contact for blood
144+
</button>
145+
</p>
146+
147+
<div
148+
class="modal fade"
149+
id="exampleModalCenter"
150+
tabindex="-1"
151+
role="dialog"
152+
aria-labelledby="exampleModalCenterTitle"
153+
aria-hidden="true"
154+
>
155+
<div class="modal-dialog modal-dialog-centered" role="document">
156+
<div class="modal-content">
157+
<div class="modal-header">
158+
<h5 class="modal-title" id="exampleModalCenterTitle">
159+
contact for blood
160+
</h5>
161+
<button
162+
type="button"
163+
class="close"
164+
data-dismiss="modal"
165+
aria-label="Close"
166+
>
167+
<span aria-hidden="true">&times;</span>
168+
</button>
169+
</div>
170+
<div class="modal-body">
171+
<form
172+
id="contactform"
173+
method="POST"
174+
action=""
175+
>
176+
<label for="name">Name</label>
177+
<input type="text" name="nm" class="form-control" required />
178+
<label for="addr"> confirm your Address</label>
179+
<textarea name="add" class="form-control" required></textarea>
180+
181+
<button
182+
class="btn btn-outline-success my-2 my-sm-0"
183+
type="submit"
184+
>
185+
Submit
186+
</button>
187+
<button
188+
type="button"
189+
class="btn btn-secondary mt-1"
190+
data-dismiss="modal"
191+
>
192+
Close
193+
</button>
194+
</form>
195+
</div>
140196
</div>
141197
</div>
142-
<br>
143-
{% endfor %}</center>
198+
</div>
199+
200+
{% endif %}
144201
</div>
202+
</div>
203+
<br />
204+
{% endfor %}
205+
</center>
206+
</div>
145207

146-
{% with messages = get_flashed_messages() %}
147-
{%if messages%}
148-
{%for mess in messages%}
149-
<div class="alert alert-success alert-dismissible fade show" role="alert">
150-
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
208+
{% with messages = get_flashed_messages() %} {%if messages%} {%for mess in
209+
messages%}
210+
<div class="alert alert-success alert-dismissible fade show" role="alert">
211+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
151212
<span aria-hidden="true">&times;</span>
152213
</button>
153-
{{mess}}
214+
{{mess}}
154215
</div>
155216

156-
{%endfor%}
157-
{%endif%}
158-
{% endwith %}
159-
217+
{%endfor%} {%endif%} {% endwith %} {% endblock %}
160218

161219

162-
{% endblock %}

0 commit comments

Comments
 (0)