Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes to front-end #8

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
341 changes: 227 additions & 114 deletions src/app.py

Large diffs are not rendered by default.

Binary file added src/static/browse.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
358 changes: 289 additions & 69 deletions src/static/style.css

Large diffs are not rendered by default.

Binary file added src/static/swap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 28 additions & 24 deletions src/templates/login.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
{% extends 'base.html' %}

{% block container %}
{% extends 'base.html' %} {% block container %}
<div id="login-signup">
<a href="{{ url_for('log_in') }}" class="active">Log In</a>
<a href="{{ url_for('sign_up') }}">Sign Up</a>
<a href="{{ url_for('log_in') }}" class="active">Log In</a>
<a href="{{ url_for('sign_up') }}">Sign Up</a>
</div>

<form method="POST" action="{{ url_for('log_in')}}" id="login-form">
<div id="form-user">
<label for="fusername">Username</label><br>
<input type="text" id="fusername" name="fusername" placeholder="Username" required/>
</div>
<div id="form-pass">
<label for="fusername">Password</label><br>
<input type="password" id="fpassword" name="fpassword" placeholder="Enter a Password" required/>
</div>
<div id="form-submit">
<input type="submit" value="Log In" />
</div>
<form method="POST" action="{{ url_for('log_in')}}" id="login-signup-form">
<div>
<label for="fusername">Username</label><br />
<input
type="text"
id="fusername"
name="fusername"
placeholder="Username"
required
/>
</div>
<div>
<label for="fusername">Password</label><br />
<input
type="password"
id="fpassword"
name="fpassword"
placeholder="Enter a Password"
required
/>
</div>
<div id="form-submit">
<input type="submit" value="Log In" />
</div>
</form>
{% if error %}
<p>{{error}}</p>
{% endif %}

<script>

</script>

{% endblock %}
{% endif %} {% endblock %}
72 changes: 36 additions & 36 deletions src/templates/offer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %} {% block container %}
<div class="item">
<div class="item-alt">
<div class="item-image">
<img
src="{{ founditem.image_url }}"
Expand All @@ -18,49 +18,49 @@
</div>
</div>
</div>
<div id="item-primary">
<p>Your Items</p>
</div>
<div id="listings">
{% if docs|length ==0%}
<div id="new-listing" onclick="window.location.href='/add'">
<img
src="https://cdn-icons-png.freepik.com/512/8333/8333955.png"
alt="Add Item"
width="30px"
height="30px"
/>
<input type="submit" value="NEW LISTING" />
</div>
{%endif%}

<div id="offer-items">
<div class="offer-header">Your Items</div>
<form
method="POST"
,
action="{{url_for('new_offer', item_id = founditem._id)}}"
id="offer-form"
>
{% for doc in docs %}
<div class="listing-alt">
<div class="listing-context-alt">
<div class="listing-image-alt">
<img
src="{{ doc.image_url }}"
alt="{{ doc.title }}"
referrerpolicy="no-referrer"
/>
</div>
<div class="details-alt">
<div class="details-primary">
<b>{{ doc.name }}</b>
<p>${{ doc.price }}</p>
<div id="listings">
{% if docs|length == 0 %}
<div id="new-listing" onclick="window.location.href='/add'">
<img
src="https://cdn-icons-png.freepik.com/512/8333/8333955.png"
alt="Add Item"
width="30px"
height="30px"
/>
<input type="submit" value="NEW LISTING" />
</div>
{%endif%} {% for doc in docs %}
<div class="listing-alt">
<div class="listing-context-alt">
<div class="listing-image-alt">
<img
src="{{ doc.image_url }}"
alt="{{ doc.title }}"
referrerpolicy="no-referrer"
/>
</div>
<div class="offer-details">
<div>
<p>{{ doc.name }}</p>
<p>${{ doc.price }}</p>
</div>
<div>
<input type="checkbox" value="{{doc._id}}" name="mycheckbox" />
</div>
</div>
<p>{{ doc.description }}</p>
</div>
Select
<input type="checkbox" , value="{{doc._id}}" , name="mycheckbox" />
</div>
{%endfor%}
<input type="submit" id="offer-submit" />
</div>
{%endfor%}
<input type="submit" />
</form>
</div>
{% endblock %}
102 changes: 89 additions & 13 deletions src/templates/recievedoffers.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,95 @@
{% extends 'base.html' %} {% block container %}
<div>
<a>Offers Recieved</a>
</div>
<div>
{% for doc in docs %}
<div class="listing-alt">
<a>Offered for item {{doc.offerforid}}</a>
<b>{{doc.status}}</b>

<div id="offers-sent">
{% if not offers %}
<!-- if no offers sent then have browse items button -->
<div id="browse">
<img
src="{{ url_for('static', filename='browse.jpg') }}"
alt="user profile image"
width="400px"
/>
<div id="browse-collection" onclick="window.location.href='/'">
<div>
<img
src="https://cdn-icons-png.freepik.com/512/8333/8333955.png"
alt="Add Item"
width="30px"
height="30px"
/>
<input type="submit" value="NO OFFERS FOUND. CLICK TO BROWSE." />
</div>
</div>
</div>
<div class="item-buttons">
<a href="{{url_for('rejectoffer', offer_id = doc._id)}}">Reject Offer</a>
<br />
<a href="{{url_for('acceptoffer', offer_id = doc._id)}}">Accept Offer</a>
{% else %} {% for offer in offers %}
<div class="offer-sent">
<div class="offer-header">
<div>Your Item</div>
<div>Their Item(s)</div>
</div>

<div class="offer-content">
<div class="item-wanted">
<div class="offer-image">
<img
src="{{ offer.offerforid.image_url }}"
alt="{{ offer.offerforid.name }}"
referrerpolicy="no-referrer"
/>
</div>
</div>

<div class="swap-icon">
<img
src="https://cdn-icons-png.freepik.com/512/10477/10477833.png"
alt="Add Item"
width="30px"
height="30px"
/>
</div>

<div class="items-offered">
<div class="items-transformed">
{% for item in offer.offereditems %}
<div class="offer-image-alt">
<img
src="{{ item.image_url }}"
alt="{{ item.name }}"
referrerpolicy="no-referrer"
/>
</div>
{% endfor %}
</div>
</div>
</div>

<div class="offer-details-alt">
<div>
<ul>
<li>{{offer.offerforid.name}}</li>
</ul>
</div>

<div>
<ul>
{% for item in offer.offereditems %}
<li>{{item.name}}</li>
{% endfor %}
</ul>
</div>
</div>

<div class="item-buttons">
<a href="{{url_for('rejectoffer', offer_id = offer._id)}}"
>Reject Offer</a
>
<br />
<a href="{{url_for('acceptoffer', offer_id = offer._id)}}"
>Accept Offer</a
>
</div>
</div>
{%endfor%}
{% endfor %} {% endif %}
</div>

{% endblock %}
99 changes: 88 additions & 11 deletions src/templates/sentoffers.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,94 @@
{% extends 'base.html' %} {% block container %}
<div>
<a>Offers Sent</a>
</div>
<div>
{% for doc in docs %}
<div class="listing-alt">
<a>Offered for item {{doc.offerforid}}</a>
<b>{{doc.status}}</b>

<div id="offers-sent">
{% if not offers %}
<!-- if no offers sent then have browse items button -->
<div id="browse">
<img
src="{{ url_for('static', filename='browse.jpg') }}"
alt="user profile image"
width="400px"
/>

<div id="browse-collection" onclick="window.location.href='/'">
<div>
<img
src="https://cdn-icons-png.freepik.com/512/8333/8333955.png"
alt="Add Item"
width="30px"
height="30px"
/>
<input type="submit" value="NO OFFERS FOUND. CLICK TO BROWSE." />
</div>
</div>
</div>
<div class="item-buttons">
<a href="{{url_for('deleteoffer', offer_id = doc._id)}}">Delete Offer</a>
{% else %} {% for offer in offers %}
<div class="offer-sent">
<div class="offer-header">
<div>Their Item</div>
<div>Your Item(s)</div>
</div>

<div class="offer-content">
<div class="item-wanted">
<div class="offer-image">
<img
src="{{ offer.offerforid.image_url }}"
alt="{{ offer.offerforid.name }}"
referrerpolicy="no-referrer"
/>
</div>
</div>

<div class="swap-icon">
<img
src="https://cdn-icons-png.freepik.com/512/10477/10477833.png"
alt="Add Item"
width="30px"
height="30px"
/>
</div>

<div class="items-offered">
<div class="items-transformed">
{% for item in offer.offereditems %}
<div class="offer-image-alt">
<img
src="{{ item.image_url }}"
alt="{{ item.name }}"
referrerpolicy="no-referrer"
/>
</div>
{% endfor %}
</div>
</div>
</div>

<div class="offer-details-alt">
<div>
<ul>
<li>{{offer.offerforid.name}}</li>
</ul>
</div>

<div>
<ul>
{% for item in offer.offereditems %}
<li>{{item.name}}</li>
{% endfor %}
</ul>
</div>
</div>

<div class="item-buttons-alt">
<a href="{{url_for('deleteoffer', offer_id = offer._id)}}">Edit Offer</a>
<br />
<a href="{{url_for('deleteoffer', offer_id = offer._id)}}"
>Delete Offer</a
>
</div>
</div>
{%endfor%}
{% endfor %} {% endif %}
</div>

{% endblock %}
Loading
Loading