Professional Documents
Culture Documents
Frontend Py
Frontend Py
for i in data:
fid = i[0]
src = i[6]
title = i[1]
descrip=i[5]
price = i[3]
rat=""
for i in range (i[4]):
rat+='?'
html = f'''<div class="row section white content-img">
<div class="">
<div class="col s12 m6 14">
<div class="img-cover">
<img class="food-img z-depth-4"
src="{src}">
</div>
</div>
<div class="col s12 m6 18">
<div class="data-cover">
<h3 class="palanquin food-title
black-text">(title)</h3>
<h6 clas="grey-text food-text
kalam"><b>{descrip}</b></h6>
<h4 class="price black-text aclonica">Rs.
{price}</h4>
<h5 class="food-rat">
{rat}
</h5>
<button id='{fid}'
onclick="add_cart (this.id)" data-target="modal3" class="btn-large
orange waves-effect waves-light center modal-trigger"><i
class="material-icons right">add</i> Add to Cart</button>
</div>
</div>
</div>
</div>'''
ihtml += html
eel.f(id, ihtml)
# Creating orders page
def append_orders():
cursor=db_info['cursor']
cursor execute("USE restaurant_app")
# Checking if user is logged in or not.
if user ['user_logged_in'] == True:
ihtml = ""
#Checking if user has any present orders.
if user['user_orders' == [];
ihtml = '''
<h5 class="container red-text Autour-One center">Your cart is empty!! <br> Please
add your favourite
items. </h5>
'''
eel.f("order-content", ihtml)
else:
cursor.execute (sql)
res=cursor.fetchall()
for j in res:
food_img = j[6]
food_desc =j[5]
food_price =j[3]
rat=""
for i in range (j[4]):
rat+='*'
ihtml+= f'''
<div class="row section white content-img">
<div class="">
<div class="col s12 m4 14">
<img class="food-img z-depth-4"
src="{food_img}">
</div>
<div class="col s12 m8 18">
<h3 class="palanquin food-title
black-text">{food_name}</h3>
<h6 class="grey-text food-text
kalam">{food_desc}</h6>
<h4 class="price black-text
aclonica">Rs.food_price}</h4>
<h5 class="food-rat">
{rat}
</h5>
<button id='{order_id}'
onclick="remove_cart (this.id)" data-target="modal3" class="btn-large orange waves-
effect waves-light
center modal-trigger"><i class="material-icons right">close</i>Remove from
Cart</button>
</div>
</div>
</div>
'''
eel.f("order-content", ihtml)
#Error message if user is not logged in.
else
ihtml='''