Skip to content

Commit

Permalink
Redid much of the trip front end and added internal navigation for ma…
Browse files Browse the repository at this point in the history
…tching views
  • Loading branch information
mike-zaharchenko17 committed Dec 13, 2023
1 parent bb624c6 commit 69d99e7
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 112 deletions.
91 changes: 61 additions & 30 deletions matching/templates/matching/list_matches.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,74 @@
{% load user_profile_custom_tags %}
{% load static %}
{% block content %}
<div class="container">
<h1>Your Matches:</h1>
{% if match_users %}
<div class="container">
<div class="row justify-content-start">
{% for match_user in match_users %}
<div class="col-md-3">
<div class="card my-3">
{% if match_user.image %}
<img class="card-img-top" src="{{ match_user.image }}" alt="image">
{% else %}
<img class="card-img-top" src="/media/default_avatar.png" alt="image">
{% endif %}
<div class="card-body">

<!-- Navigation -->
<div class="container mt-5">
<div class="row">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="{% url 'matching:show_potential_matches' utrip_id=utrip_id %}">
Fellow Travellers
</a>
</li>
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="{% url 'matching:show_pending_requests' utrip_id=utrip_id %}">
Match Requests
</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="{% url 'matching:show_matches' utrip_id=utrip_id %}"
aria-current="page"
tabindex="-1">
Matches
</a>
</li>
</ul>
</div>
</div>
<!-- End Navigation -->

<div class="container mt-5">
<h1>Your Matches:</h1>
{% if match_users %}
<div class="container">
<div class="row justify-content-start">
{% for match_user in match_users %}
<div class="col-md-3">
<div class="card my-3">
{% if match_user.image %}
<img class="card-img-top" src="{{ match_user.image }}" alt="image">
{% else %}
<img class="card-img-top" src="/media/default_avatar.png" alt="image">
{% endif %}

<div class="card-body">
<div class="card-title">
<h4><i>{{ match_user.user.first_name }} {{ match_user.user.last_name|slice:":1" }}.</i></h4>
<div>
<a href="{% url 'user_profile:detail_profile' id=match_user.user.id %}" class="btn btn-primary">View Profile </a>
</div>
<br>
<div>
<a href="{% url 'chat:threads_page' %}" class="btn btn-primary"> Chat With </a>
</div>
<br>
<div class="d-flex justify-content-between">
<a href="{% url 'user_profile:detail_profile' id=match_user.user.id %}" class="btn btn-outline-info">View Profile </a>
<a href="{% url 'chat:threads_page' %}" class="btn btn-outline-primary">Chat</a>
<form action="{% url 'matching:unmatch' utrip_id=utrip_id %}" method="post">
{% csrf_token %}
<input type="hidden" name="other_uid" value="{{ match_user.user.id }}">
<button type="submit" class="btn btn-rounded btn-danger">Unmatch</button>
<button type="submit" class="btn btn-rounded btn-outline-danger">Unmatch</button>
</form>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<h2>Oops! Sorry! No matches currently</h2>
{% endif %}
</div>

</div>
{% else %}
<h2>No matches yet! Try sending some requests out!</h2>
<img src="{% static 'home_default/site_images/sc-party-people-1.png'%}">
{% endif %}
</div>
{% endblock content %}
85 changes: 49 additions & 36 deletions matching/templates/matching/list_pending_requests.html
Original file line number Diff line number Diff line change
@@ -1,64 +1,77 @@
{% extends "home_default/base.html" %}
{% extends 'home_default/base.html' %}
{% load user_profile_custom_tags %}
{% load static %}
{% block content %}

<!-- Navigation -->
<div class="container mt-5">
<div class="row">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="{% url 'matching:show_potential_matches' utrip_id=utrip_id %}">
Fellow Travellers
</a>
</li>
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="{% url 'matching:show_pending_requests' utrip_id=utrip_id %}">
Match Requests
</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="{% url 'matching:show_matches' utrip_id=utrip_id %}"
aria-current="page"
tabindex="-1">
Matches
</a>
</li>
</ul>
</div>
</div>
<!-- End Navigation -->

{% if pending_matches %}

<div class="d-flex container mt-5">
<div class="row justify-content-start">
<h1>These users would like to travel with you</h1>
<div class="container mt-5">
<div class="row">
{% if pending_matches %}
{% for pending_match in pending_matches %}
<div class="col-md-3">
<div class="d-flex col-md-3">
<div class="card my-3">
{% if pending_match.image %}
<img class="card-img-top" src="{{ pending_match.image }}" alt="image">
<img class="card-img-top" src="{{ pending_match.image }}" alt="image">
{% else %}
<img class="card-img-top" src="/media/default_avatar.png" alt="image">
<img class="card-img-top" src="/media/default_avatar.png" alt="image">
{% endif %}
<div class="card-body">
<div class="card-title">
<h4>
<i>{{ pending_match.sender.first_name }} {{ pending_match.sender.last_name|slice:":1" }}.</i>
</h4>
</div>
<br>

<form action="{% url 'matching:react_request' utrip_id=utrip_id %}" method="post">
{% csrf_token %}
<input type="hidden" name="sender_utrip_id"
value="{{ pending_match.sender_user_trip.id }}">
<input type="hidden" name="sender_utrip_id" value="{{ pending_match.sender_user_trip.id }}">
<input type="hidden" name="sender_id" value="{{ pending_match.sender.id }}">

<div class="d-flex justify-content-between">
<button type="submit" name="pending_request" value="Rejected"
class="btn btn-rounded btn-danger">
Reject
</button>
<div>
<a href="{% url 'user_profile:detail_profile' id=pending_match.sender.id %}"
class="btn btn-primary">View Profile </a>
</div>
<button type="submit" name="pending_request" value="Matched"
class="btn btn-rounded btn-info">
Match
</button>
<button type="submit" name="pending_request" value="Rejected" class="btn btn-rounded btn-outline-danger">Reject</button>
<a href="{% url 'user_profile:detail_profile' id=pending_match.sender.id %}" class="btn btn-outline-info">View Profile</a>
<button type="submit" name="pending_request" value="Matched" class="btn btn-rounded btn-outline-success">Accept</button>
</div>
</form>
</div>
<br>
</div>
</div>
{% endfor %}
{% else %}
<div class="col">
<h1>When a traveller sends you a match request, you will see it here</h1>
<img src="{% static 'home_default/site_images/sc-party-people-1.png'%}">
</div>
{% endif %}
</div>
{% endfor %}
</div>


{% else %}
<div class="d-flex container mt-5">
<h1>When a traveller sends you a match request, you will see it here</h1>
</div>
{% endif %}


{% endblock content %}
114 changes: 68 additions & 46 deletions matching/templates/matching/list_potential_matches.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,82 @@
{% load static %}
{% block content %}

{% if matching_users %}
<div class="d-flex container">
<div class="row justify-content-start mt-5">
<h1>People Travelling to your Destination</h1>
{% for matching_user in matching_users %}
<div class="col-md-3">
<!-- Navigation -->
<div class="container mt-5">
<div class="row">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="{% url 'matching:show_potential_matches' utrip_id=utrip_id %}">
Fellow Travellers
</a>
</li>
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="{% url 'matching:show_pending_requests' utrip_id=utrip_id %}">
Match Requests
</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="{% url 'matching:show_matches' utrip_id=utrip_id %}"
aria-current="page"
tabindex="-1">
Matches
</a>
</li>
</ul>
</div>
</div>
<!-- End Navigation -->

<div class="container mt-5">
<div class="d-flex row">
{% if matching_users %}
{% for matching_user in matching_users %}
<div class="col-3">
<div class="card my-3">
{% if matching_user.image %}
{% if matching_user.image %}
<img class="card-img-top" src="{{ matching_user.image }}" alt="image">
{% else %}
{% else %}
<img class="card-img-top" src="/media/default_avatar.png" alt="image">
{% endif %}
<div class="card-body">
<h4><i>{{ matching_user.user.first_name }} {{ matching_user.user.last_name|slice:":1" }}.</i>
{% endif %}
<div class="card-body">
<div class="card-title">
<h4>
{{ matching_user.user.first_name }} {{ matching_user.user.last_name|slice:":1" }}.
</h4>
<form action="
{% if not matching_user.sent_match %}
{% url 'matching:send_request' utrip_id=utrip_id %}
{% else %}
{% url 'matching:cancel_request' utrip_id=utrip_id %}
{% endif %}"
method="post">
{% csrf_token %}
<input type="hidden" name="receiver_uid" value="{{ matching_user.user.id }}">
<input type="hidden" name="receiver_utrip_id"
value="{{ matching_user.receiver_utrip_id }}">
{% if not matching_user.sent_match %}
<div class="d-flex justify-content-between">
<div>
<a href="{% url 'user_profile:detail_profile' id=matching_user.user.id %}"
class="btn btn-outline-info">View Profile </a>
</div>
</div>
<form action="{% if not matching_user.sent_match %}
{% url 'matching:send_request' utrip_id=utrip_id %}
{% else %}
{% url 'matching:cancel_request' utrip_id=utrip_id %}
{% endif %}"
method="POST">
{% csrf_token %}
<input type="hidden" name="receiver_uid" value="{{ matching_user.user.id }}">
<input type="hidden" name="receiver_utrip_id" value="{{ matching_user.receiver_utrip_id }}">
{% if not matching_user.sent_match %}
<div class="d flex justify-content-between">
<a href="{% url 'user_profile:detail_profile' id=matching_user.user.id %}" class="btn btn-outline-info">View Profile</a>
<button type="submit" class="btn btn-outline-primary btn-rounded">Send Request</button>
{% else %}
<button type="submit" class="btn btn-rounded btn-outline-secondary">Cancel Request
</button>
{% endif %}
</div>
</form>
</div>
{% else %}
<button type="submit" class="btn btn-rounded btn-outline-secondary">Cancel Request</button>
{% endif %}
</form>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
{% else %}
<div class="d-flex container mt-5">
<h2>No fellow travellers yet! Try broadening your age range and check your match requests!</h2>
<img src="{% static 'home_default/site_images/sc-party-people-1.png'%}">
</div>
{% endif %}
</div>
</div>

{% else %}
<div class="d-flex container mt-5">
<h2>No potential matching user as per your matching preferences,
try softening the preferences a bit</h2>
<br>
<h4>Also, please check your pending requests, some might have already sent you a matching request.</h4>
</div>
{% endif %}


{% endblock content %}

0 comments on commit 69d99e7

Please sign in to comment.