Skip to content

Commit

Permalink
Merge pull request #43 from Hi-TechMissile/main
Browse files Browse the repository at this point in the history
Profile UI Updates
  • Loading branch information
mittal-ishaan authored Dec 27, 2023
2 parents b268d09 + 7d3b82f commit 98e16ea
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
13 changes: 10 additions & 3 deletions home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,19 @@ def profile(request):
socialaccount_obj = SocialAccount.objects.filter(provider='google', user_id=request.user.id)
picture = "not available"
allocation = Allocation.objects.filter(email=student).last()
allocation_info = {}
#improve this alignment of text to be shown on the profile section
if allocation:
allocation_info_list = [allocation.student_id, allocation.caterer.name, str(allocation.high_tea)]
allocation_info = "Allocation ID: " + allocation.student_id + " Caterer: " + allocation.caterer.name + " High Tea: " + str(allocation.high_tea) + " Jain: " + str(allocation.jain)
else:
allocation_info = "Not allocated for this period"
allocation_info = {
"Allocation ID": allocation.student_id,
"Caterer": allocation.caterer.name,
"High Tea": "Yes" if allocation.high_tea else "No",
"Jain": "Yes" if allocation.jain else "No",
}
# allocation_info = "Allocation ID: " + allocation.student_id + " Caterer: " + allocation.caterer.name + " High Tea: " + str(allocation.high_tea) + " Jain: " + str(allocation.jain)
# else:
# allocation_info = "Not allocated for this period"
try:
if len(socialaccount_obj ):
picture = socialaccount_obj[0].extra_data['picture']
Expand Down
23 changes: 20 additions & 3 deletions templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,31 @@
<div class="row">
<div class="col-md-6">
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">User Profile</h5>
<div class="card-body" style="padding-left: 5%;">
<h5 class="card-title">Your Profile</h5>
<img class="img-fluid rounded-4" src="{{ picture }}" alt="User Image">
<h6 class="card-subtitle mt-2">{{ student.name }}</h6>
<span class="card-text">Roll Number: {{ student.roll_no }}</span><br>
<span class="card-text">Email: {{ user.email }}</span><br>
<span class="card-text">Department: {{ student.department }}</span><br>
<span class="card-text">{{allocation_info}}</span>
<hr>
{% if allocation_info|length > 0 %}
<h5>Your Allocation Details:</h5>
{% for key, value in allocation_info.items %}
<div style="display: flex; width: 50%; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; margin-bottom: 10px;">
<div style="flex: 1; background-color: #b4c4fa; padding-left: 7%; padding-top: 1%">
<!-- Content for the first div -->
<h6>{{ key }}</h6>
</div>
<div style="flex: 1; padding-top: 1%; padding-bottom: 1px; padding-left: 7%">
<!-- Content for the second div -->
{{ value }}
</div>
</div>
{% endfor %}
{% else %}
<h6>You have not been allotted a caterer for this period yet.</h6>
{% endif %}
<hr>
</div>
</div>
Expand Down

0 comments on commit 98e16ea

Please sign in to comment.