Commit 1aad80fe authored by Felizia Tiburcio's avatar Felizia Tiburcio

Merge xtine branch to felizia, refine frontend

parents 2d31dd55 35673d3f
...@@ -382,14 +382,6 @@ nav a { ...@@ -382,14 +382,6 @@ nav a {
padding: 4rem; padding: 4rem;
} }
/* item detail view / add, edit item */
.item-image-container,
.item-form-container {
border: 2px solid black;
padding: 1rem;
}
/* ?USER'S PROFILE */ /* ?USER'S PROFILE */
.profile-container { .profile-container {
display: flex; display: flex;
...@@ -438,3 +430,104 @@ nav a { ...@@ -438,3 +430,104 @@ nav a {
background-color: #F9BD82; background-color: #F9BD82;
} }
/* About Page*/
.about__container {
margin: 0 auto;
width: 90%;
}
.about__header{
text-align: center;
}
.about__blockone, .about__blocktwo, .about__blockthree {
display: flex;
justify-content: center;
padding: 2rem;
}
.block-explanation{
width: 70%;
border-radius: 20px;
border: 5px black solid;
padding: 20px;
margin: 10px;
}
.block-image, .row, .col {
text-align: center;
padding: 1rem;
}
.form-space, .button-space{
display: flex;
justify-content: center;
padding: 3rem;
}
/* Add Item */
.additem-container{
text-align: center;
}
/* item detail view / add, edit item */
.item-form-container {
padding: 1rem;
margin: 0 auto;
}
.storeform-header {
text-align: center;
}
/* girl help */
.help-header{
background-color: #4c9ed0;
border-radius: 7px 7px 5px 0px;
padding: 10px;
color: #fff;
text-align: center;
font-family: Archivo;
font-size: 20px;
}
.help-container{
width: 500px;
}
.help-container{
width: 800px;
margin: 100px auto;
background: #fff;
border-radius: 7px;
box-shadow: 1px 2px 4px rgba(0,0,0,.3);
}
.help-perq{
padding: 0px 20px 20px;
}
::-webkit-details-marker{
float: right;
margin-top: 3px;
}
.help-perq details{
background: #f6f6f6;
padding: 10px 20px;
border-radius: 7px;
margin-top: 20px;
font-family: Archivo;
font-size: 18px;
letter-spacing: 1px;
cursor: pointer;
}
.help-perq details summary{
outline: none;
}
.help-text {
font-size: 15px;
}
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}Boodle Homepage{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<div class="header-container">
<h1>About Boodle</h1>
</div>
<div class="about-container">
<!-- overview -->
<div class="about-block">
<div class="block-image">
<img src="../static/media/block_one_pic.jpg">
</div>
<div class="block-explanation">
<h2>What is Boodle?</h2>
<p>
Boodle aims to provide an online bidding platform for online users. Its services are tailored specifically to bidding services to make communication and purchasing facilitation easier between buyers and sellers. For buyers, the common practice of "paunahan" is made easy for sellers can track which user bid on what and prevents issues such as scamming by correctly identifying the user with the highest bid.
</p>
</div>
</div>
<!-- About the product -->
<div class="about-block">
<div class="block-explanation">
<h2>Mission-Vision</h2>
<p>
Our mission has been to improve current bidding platforms and to provide a space for auctioneers and consumers to interact freely.
Boodle aims to provide sellers with the appropriate tools to auction items and aims to provide buyers a reliable platform for placing
bids on auctioned items.
</p>
</div>
<div class="block-image">
<img src="../static/media/block_two_pic.jpg">
</div>
</div>
<!-- About the makers -->
<div class="about-block">
<div class="block-explanation">
<h2>Who are we?</h2>
<p> The developers are Computer Science students from Ateneo de Manila University. They consider themselves online shopaholics and so they
decided to create a platform for online auctions.
</p>
</div>
</div>
<div class="header-container">
<h1>Meet the Developers</h1>
</div>
<div class="about-developers">
<div class="developer">
<img src="../static/media/profile_pics/didz.jpg">
<div class="developer-info">
<h4>Carmina Atienza</h4>
<p>3 BS Computer Science</p>
</div>
</div>
<div class="developer">
<img src="../static/media/profile_pics/tin.jpg">
<div class="developer-info">
<h4>Christine Dela Rosa</h4>
<p>3 BS Computer Science</p>
</div>
</div>
<div class="developer">
<img src="../static/media/profile_pics/mate.jpg">
<div class="developer-info">
<h4>Martina Reyes</h4>
<p>3 BS Computer Science</p>
</div>
</div>
<div class="developer">
<img src="../static/media/profile_pics/felizia.jpg">
<div class="developer-info">
<h4>Felizia Tiburcio</h4>
<p>3 BS Computer Science</p>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
...@@ -9,32 +9,20 @@ ...@@ -9,32 +9,20 @@
{% block content %} {% block content %}
<div class="container"> <div class="additem-container">
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<div class="row">
<div class="col-lg-7 col-md-6">ITEM IMAGE CONTAINER <form action="" method="POST">
<div class="item-image-container"></div> {% csrf_token %}
</div>
<div class=" col-lg-5 col-md-6">ITEM FORM CONTAINER
<div class="item-form-container"> <div class="item-form-container">
<form action="" method="POST"> {{ form.as_p }}
{% csrf_token %}
{{ form.as_p }}
</div> </div>
<button type="submit" name="Add Item"> Add Item </button> <div class="button-space">
</form> <button type="button" class="btn btn-danger"><a href= "{% url 'storeid' request.user.id %}">Cancel</a></button>
</div> <button type="submit" class="btn btn-dark" name="Add Item"> Add Item </button>
</div> </div>
</div> </form>
<!-- Form with fields:
[Item name]
[Item Description]
[Floor Price] -->
<!-- Image, if no image add image -->
</div>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -57,11 +57,14 @@ ...@@ -57,11 +57,14 @@
<div class="col-lg-5 col-md-6 auction-right"> <div class="col-lg-5 col-md-6 auction-right">
<div class="product-info" > <div class="product-info" >
<h2>{{ item_name }} </h2> <div class="product-info-text">
<p>Sold by {{ auction_host.storename }}</p> <h2>{{ item_name }} </h2>
<p>Sold by <a href="{% url 'storeid' auction_host.storeid %}">{{ auction_host.storename }}</a></p>
<p>{{ item_specs }}</p> <p>{{ item_specs }}</p>
<h4>Starting at: ₱ {{item_floor_price | floatformat:2 }}</h4> <h4>Starting at: ₱ {{item_floor_price | floatformat:2 }}</h4>
</div>
</div> </div>
...@@ -78,7 +81,7 @@ ...@@ -78,7 +81,7 @@
{% if auction_bids %} {% if auction_bids %}
{% for bid in auction_bids %} {% for bid in auction_bids %}
<li><img src="https://minimaltoolkit.com/images/randomdata/female/64.jpg" alt=""> <li><img src="https://minimaltoolkit.com/images/randomdata/female/64.jpg" alt="">
<p>{{bid.userid.username}} offered ₱{{ bid.amount | floatformat:2}}</p> <p><a href="{% url 'profileid' bid.userid.id %}">{{bid.userid.username}}</a> offered ₱{{ bid.amount | floatformat:2}}</p>
<p> &nbsp | &nbsp </p> <p> &nbsp | &nbsp </p>
<p>{{bid.bidtime | timesince}} ago </p> <p>{{bid.bidtime | timesince}} ago </p>
......
...@@ -21,13 +21,6 @@ ...@@ -21,13 +21,6 @@
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
<style>
[class*="col"] {
/* background-color: pink; */
/* border: 2px dotted skyblue; */
}
</style>
</head> </head>
<body> <body>
...@@ -35,8 +28,8 @@ ...@@ -35,8 +28,8 @@
<nav id="main"> <nav id="main">
<ul> <ul>
<li><a href="/">Home</a></li> <li><a href="/">Home</a></li>
<li><a href="#">About</a></li> <li><a href="{% url 'about' %}">About</a></li>
<li><a href="#">Help</a></li> <li><a href="{% url 'help' %}">Help</a></li>
<li><a href="{% url 'profileid' request.user.id %}">My Profile</a></li> <li><a href="{% url 'profileid' request.user.id %}">My Profile</a></li>
<li><a href="{% url 'logout' %}">Logout</a></li> <li><a href="{% url 'logout' %}">Logout</a></li>
</ul> </ul>
...@@ -68,7 +61,13 @@ ...@@ -68,7 +61,13 @@
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="{% static 'slick/slick.min.js' %}"></script> <script type="text/javascript" src="{% static 'slick/slick.min.js' %}"></script>
<!-- <link rel="stylesheet" type="text/css" href="{% static ' build/jquery.datetimepicker.css' %}"/ >
<script src="{% static '/build/jquery.datetimepicker.full.min.js' %}"></script> -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.min.css" integrity="sha256-DOS9W6NR+NFe1fUhEE0PGKY/fubbUCnOfTje2JMDw3Y=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js" integrity="sha256-FEqEelWI3WouFOo2VWP/uJfs1y8KJ++FLh2Lbqc8SJk=" crossorigin="anonymous"></script>
</body> </body>
......
...@@ -13,18 +13,17 @@ ...@@ -13,18 +13,17 @@
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<div class=""> <div class="">
<div class="profile-form-container"> <div class="profile-form-container">
<div class="">EDIT PROFILE PICTURE
<div class="profile-image-container"></div>
</div>
<form action="" method="POST"> <form action="" method="POST">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<button class="profile-submit-button" type="submit" name="Add Item"> Save Changes </button> <div class="btn-group">
<button type="button" class="btn btn-danger"><a href= "{% url 'profileid' request.user.id %}">Cancel</a></button>
<button class="btn profile-btn" type="submit" name="Add Item"> Save Changes </button>
</div>
</form> </form>
</div> </div>
</div> </div>
<!--img goes here-->
</div> </div>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}Profile{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<div class="help-container">
<p class="help-header">FAQ</p>
<div class="help-perq">
<details>
<summary>Placing a Bid</summary>
<ul class="help-text">
<li>To place a bid, go to the homepage to check all on-going auctions </li>
<li>Find the desired auction and click on the title to go to the auction title</li>
<li>At the auction, click on the "Place Bid" button near the latest bids</li>
<li>A pop-up will appear, enter the a desired bidding value in the input box
<br> *Please note: only bids higher than the current highest bid will go through</li>
<li>Once you place the desired bid, click submit and the bid should appear in latest bid</li>
</ul>
</details>
<details>
<summary>Creating a Store</summary>
<ul class="help-text">
<li>Access your profile by clicking the link "My Profile" on the nav bar </li>
<li>Once accessed, below your profile picture is the button "Create Store"</li>
<li>Click this button and a pop up will appear where you input the desired store information</li>
<li>Once you click "Submit", the button will change into a link to access your store</li>
</ul>
</details>
<details>
<summary>Inventory Management</summary>
<ul class="help-text">
<li>To access your store, click the "My Store" button on the profile page</li>
<li>At the store page, you can view the current items in your inventory </li>
<li>Each item has the option to edit and delete an item below the item name</li>
<li>To add an item, click the "Add Item" button at the bottom of the page</li>
<li>Once selected, you will be redirected to a page where you can input the necessary information for an item</li>
<li>Once filled, select "Add Item" button and the item should appear on your store page</li>
</ul>
</details>
<details>
<summary>Starting an Auction</summary>
<ul class="help-text">
<li>To access your store, click the "My Store" button on the profile page</li>
<li>To start an auction, select the "Start Auction" button at the bottom of the page
<br> *Note: You must have an existing item to start an auction and you cannot create duplicate auctions for a single item</li>
<li>Once selected, you will be redirected to a page where you can input the necessary information for the auction</li>
<li>Once filled, select "Start Auction" button and the auction should appear on the homepage</li>
</ul>
</details>
<details>
<summary>Profile Management</summary>
<ul class="help-text">
<li>Access your profile by clicking the link "My Profile" on the nav bar</li>
<li>Below the profile picture, there will be a button "Edit Profile"</li>
<li>Clicking this button, the you will be redirected to change your username</li>
<li>After filling it up and selecting "Save Changes". The changes will appear on the profile.</li>
</ul>
</details>
</div>
</div>
{% endblock %}
\ No newline at end of file
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<p>Boodle was founded by a group of four talented software engineers, who are currently Computer Science students <p>Boodle was founded by a group of four talented software engineers, who are currently Computer Science students
in Ateneo de Manila University. They believed they could change the status quo in Ateneo de Manila University. They believed they could change the status quo
of the e-commerce world—and with Boodle, they did. </p> of the e-commerce world—and with Boodle, they did. </p>
<button id="btn-read-more">Read more</button> <button class="btn profile-btn"><a href="{% url 'about' %}">Read more</a></button>
</div> </div>
</div> </div>
</div> </div>
...@@ -87,9 +87,7 @@ ...@@ -87,9 +87,7 @@
{% if auctions_now %} {% if auctions_now %}
{% for auction in auctions_now %} {% for auction in auctions_now %}
<div class="event"> <div class="event">
<!-- <img src="../static/media/beast.jpg" alt=""> --> <img src="https://www.kurin.com/wp-content/uploads/placeholder-square.jpg">
<img src="http://via.placeholder.com/640x360" alt="">
<div class="event-text"> <div class="event-text">
<a href="{% url 'auctionid' auction.auctionid %}"> <a href="{% url 'auctionid' auction.auctionid %}">
<h4>{{ auction.title }}</h4> <h4>{{ auction.title }}</h4>
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
</div> </div>
</div> </div>
<!--Change auctions_now, auction to like favorites, favorite--> <!--Change auctions_now, auction to like favorites, favorite-->
<div class="header-container"> <div class="header-container">
<h2> Current Biddings</h2> <h2> Current Biddings</h2>
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
{% if auctions_of_user %} {% if auctions_of_user %}
{% for id in ids_of_auction %} {% for id in ids_of_auction %}
<div class="event"> <div class="event">
<img src="http://via.placeholder.com/640x360" alt=""> <img src="https://www.kurin.com/wp-content/uploads/placeholder-square.jpg">
<div class="event-text"> <div class="event-text">
<a href="{% url 'auctionid' id.auctionid %}"> <a href="{% url 'auctionid' id.auctionid %}">
<h3>{{ id.title }}</h3> <h3>{{ id.title }}</h3>
......
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}Profile{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<div class="profile-container">
<div class="username-section displayname profile-element">
<!-- <h2>This is {{ displayname }}'s profile</h2> -->
</div>
<div class="profile-image profile-element">
<img src="https://minimaltoolkit.com/images/randomdata/female/64.jpg" alt="profile-image">
</div>
<div class="username profile-element">
<h4> {{ username }}'s profile </h4>
</div>
<div class="btn-group profile-element">
<!--If a user owns a store, they can access the store-->
{% if store %}
<button type="button" class="btn profile-btn">
<a href= "{% url 'storeid' store %}" >
My Store
</a>
</button>
<!--If a user does not own a store, they can create a store-->
{% else %}
<button type="button" class="btn profile-btn" data-toggle="modal" data-target="#createStoreModal"
data-whatever="@mdo">Create Store</button>
{% endif %}
<button type="button" class="btn profile-btn">
<a href= "{% url 'editProfile' user %}" >
Edit Profile
</a></button>
</div>
</div>
<!-- Purchase History -->
<div>
<h2> Purchase History </h2>
{% if auctionsOfUser %}
{% for item in won_items %}
<div>
<h3>{{ item.itemname }}</h3>
<p >₱ {{item.sellprice}} </p>
{% for wonauc in won_auctions %}
{% if wonauc.itemid == item %}
<h4>Aution Ended at: {{ wonauc.auctionend }}</h4>
{% endif %}
{% endfor %}
<br>
{% endfor %}
{% endif %}
</div>
</div>
<!--Change auctions_now, auction to like favorites, favorite-->
<div class="header-container">
<h2> Current Biddings</h2>
</div>
<div class="event-container">
<<<<<<< HEAD
{% if auctions_of_user %}
{% for id in ids_of_auction %}
=======
{% if auctionsOfUser %}
{% for id in idsOfAuction %}
{% if id.auctionend > currentdate %}
>>>>>>> origin/xtine
<div class="event">
<img src="http://via.placeholder.com/640x360" alt="">
<div class="event-text">
<a href="{% url 'auctionid' id.auctionid %}">
<h3>{{ id.title }}</h3>
</a>
<p>{{ id.auctionend }}</p>
</div>
</div>
{% endif %}
{% endfor %}
{% else %}
<h4> {{displayname}} has no current biddings.</h4>
{% endif %}
</div>
</div>
<!-- modal -->
<div class="modal fade" id="createStoreModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create {{displayname}}'s Store</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="" method="POST">
<div class="form-group createstore">
{% csrf_token %}
{{ createStoreForm.as_p }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-secondary" name="Submit"> Submit </button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
...@@ -9,15 +9,34 @@ ...@@ -9,15 +9,34 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<form action="" method="POST"> <form action="" method="POST">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} <div class="form-space">
{{ form.as_p }}
<button type="submit" name="savesauction">Save Auction</button> </div>
<div class="button-space">
<button type="button" class="btn btn-danger"><a href= "{% url 'storeid' request.user.id %}">Cancel</a></button>
<button type="submit" class="btn btn-dark" name="savesauction">Save Auction</button>
</div>
</form> </form>
</div> </div>
<input id="datetimepicker" type="text">
<!-- <script>
$(function () {
$("#id_auctionstart").datetimepicker();
});
$(function () {
$("#id_auctionend").datetimepicker();
});
</script> -->
<!-- Form fields: <!-- Form fields:
[Auction Title] [Auction Title]
[Auction Description] [Auction Description]
......
...@@ -10,31 +10,19 @@ ...@@ -10,31 +10,19 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<div class = "storeform-header">
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<div class="row">
<div class="col-lg-7 col-md-6">ITEM IMAGE CONTAINER
<div class="item-image-container"></div>
</div>
<div class=" col-lg-5 col-md-6">ITEM FORM CONTAINER
<div class="item-form-container">
<form action="" method="POST">
{% csrf_token %}
{{ form.as_p }}
</div>
<button type="submit" name="Add Item"> Save Changes </button>
</form>
</div>
</div> </div>
<form action="" method="POST">
{% csrf_token %}
<div class="form-space">
{{ form.as_p }}
</div>
<div class="button-space">
<button type="button" class="btn btn-danger"><a href= "{% url 'storeid' request.user.id %}">Cancel</a></button>
<button type="submit" class="btn btn-dark" name="Add Item"> Save Changes </button>
</div>
</form>
</div> </div>
<!-- Form with fields:
[Item name]
[Item Description]
[Floor Price] -->
<!-- Image, if no image add image -->
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -62,9 +62,11 @@ class DeleteItemForm(forms.Form): ...@@ -62,9 +62,11 @@ class DeleteItemForm(forms.Form):
class StartAuctionForm(forms.ModelForm): class StartAuctionForm(forms.ModelForm):
# the widget is supposed to have a pop up but not showing, keeping here bc it separates date and time nicely # the widget is supposed to have a pop up but not showing, keeping here bc it separates date and time nicely
auctionstart = forms.SplitDateTimeField(widget=AdminSplitDateTime()) # auctionstart = forms.SplitDateTimeField(widget=AdminSplitDateTime())
auctionend = forms.SplitDateTimeField(widget=AdminSplitDateTime()) # auctionend = forms.SplitDateTimeField(widget=AdminSplitDateTime())
auctionstart = forms.DateTimeField(input_formats=['%d/%m/%Y %H:%M'])
auctionend = forms.DateTimeField(input_formats=['%d/%m/%Y %H:%M'])
class Meta: class Meta:
model = Auction model = Auction
...@@ -78,19 +80,13 @@ class StartAuctionForm(forms.ModelForm): ...@@ -78,19 +80,13 @@ class StartAuctionForm(forms.ModelForm):
'itemid': _('Item up for auction') 'itemid': _('Item up for auction')
} }
# datetime_format = ['%Y-%m-%d %H:%M']
# widgets = { 'auctionstart' : forms.AdminSplitDateTime()} #, 'auctionend' : forms.SplitDateTimeField()}
# vv fix later, is missing time widget
# widgets = { 'auctionstart' : forms.SelectDateWidget, 'auctionend':forms.SelectDateWidget}
# 'itemid': forms.HiddenInput()}
def clean(self): def clean(self):
super().clean() super().clean()
end_time = self.cleaned_data['auctionend'] print(self.cleaned_data)
start_time = self.cleaned_data['auctionstart'] end_time = self.cleaned_data.get('auctionend')
start_time = self.cleaned_data.get('auctionstart')
current_date = timezone.now() current_date = timezone.now()
auctioned_item = self.cleaned_data['itemid'] auctioned_item = self.cleaned_data['itemid']
auctions = Auction.objects.all() auctions = Auction.objects.all()
...@@ -98,7 +94,7 @@ class StartAuctionForm(forms.ModelForm): ...@@ -98,7 +94,7 @@ class StartAuctionForm(forms.ModelForm):
if start_time > end_time: if start_time > end_time:
raise ValidationError('Start date should be before end date.') raise ValidationError('Start date should be before end date.')
elif start_time < current_date or end_time < current_date: elif start_time < current_date or end_time < current_date:
raise ValidationError('Date cannot be in the past') raise ValidationError('Date cannot be in the past.')
else: else:
for auc in auctions: for auc in auctions:
if auc.itemid == auctioned_item: if auc.itemid == auctioned_item:
......
# Generated by Django 3.2.12 on 2022-05-18 09:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0004_delete_userfavorites'),
]
operations = [
migrations.DeleteModel(
name='Boodleuser',
),
]
...@@ -8,7 +8,6 @@ urlpatterns = [ ...@@ -8,7 +8,6 @@ urlpatterns = [
path('auction', auction, name='auction'), path('auction', auction, name='auction'),
path('auction/<int:pk>/',auction, name='auctionid'), path('auction/<int:pk>/',auction, name='auctionid'),
path('error404', error404, name='error404'), path('error404', error404, name='error404'),
# path('store', tempstore, name='store'), # this is tempstore
path('store/<int:pk>', mystore, name='storeid'), path('store/<int:pk>', mystore, name='storeid'),
path('additem', addItem, name='additem'), path('additem', addItem, name='additem'),
path('additem/<int:pk>', addItem, name='additemid'), path('additem/<int:pk>', addItem, name='additemid'),
...@@ -16,12 +15,12 @@ urlpatterns = [ ...@@ -16,12 +15,12 @@ urlpatterns = [
path('jsi18n', JavaScriptCatalog.as_view(), name='js-catlog'), path('jsi18n', JavaScriptCatalog.as_view(), name='js-catlog'),
path('startauction', startAuction, name='startauction'), path('startauction', startAuction, name='startauction'),
path('startauction/<int:pk>', startAuction, name='startauctionid'), path('startauction/<int:pk>', startAuction, name='startauctionid'),
# this is tempuser profile
# path('profile', tempProfile, name='profile'),
path('profile/<int:pk>', profile, name='profileid'), path('profile/<int:pk>', profile, name='profileid'),
path('editstore/<int:pk>', editStore, name='editstoreid'), path('editstore/<int:pk>', editStore, name='editstoreid'),
path('editProfile/<int:pk>', editProfile, name='editProfile'), path('editProfile/<int:pk>', editProfile, name='editProfile'),
path('login', loginPage, name='login'), path('login', loginPage, name='login'),
path('register', registerPage, name='register'), path('register', registerPage, name='register'),
path('logout', logoutUser, name='logout') path('logout', logoutUser, name='logout'),
path('help', help, name='help'),
path('about', about, name='about')
] ]
\ No newline at end of file
...@@ -146,6 +146,14 @@ def auction(request,pk): ...@@ -146,6 +146,14 @@ def auction(request,pk):
def error404(request): def error404(request):
return render(request, "boodlesite/templates/error404/notstarted_error404.html") return render(request, "boodlesite/templates/error404/notstarted_error404.html")
@login_required(login_url='login')
def about(request):
return render(request, "boodlesite/templates/about.html")
@login_required(login_url='login')
def help(request):
return render(request, "boodlesite/templates/help.html")
@login_required(login_url='login') @login_required(login_url='login')
def mystore(request, pk): def mystore(request, pk):
...@@ -156,6 +164,7 @@ def mystore(request, pk): ...@@ -156,6 +164,7 @@ def mystore(request, pk):
store_items = Item.objects.filter(storeid=pk) store_items = Item.objects.filter(storeid=pk)
all_auctions = Auction.objects.all() all_auctions = Auction.objects.all()
all_bids = AuctionBid.objects.all()
form = DeleteItemForm() form = DeleteItemForm()
...@@ -166,6 +175,11 @@ def mystore(request, pk): ...@@ -166,6 +175,11 @@ def mystore(request, pk):
current_item = Item.objects.get(itemid=item_id) current_item = Item.objects.get(itemid=item_id)
for auction in all_auctions: for auction in all_auctions:
if auction.itemid == current_item: if auction.itemid == current_item:
for bids in all_bids:
if bids.auctionid == auction:
AuctionBid.objects.filter(auctionid=auction.auctionid).delete()
Auction.objects.filter(itemid=item_id).delete() Auction.objects.filter(itemid=item_id).delete()
Item.objects.get(itemid=item_id).delete() Item.objects.get(itemid=item_id).delete()
...@@ -230,7 +244,7 @@ def startAuction(request, pk): ...@@ -230,7 +244,7 @@ def startAuction(request, pk):
current_store = Store.objects.get(pk=pk) current_store = Store.objects.get(pk=pk)
store_id = current_store.storeid store_id = current_store.storeid
# get items under this store # get items under this store
store_items = Item.objects.filter(storeid=pk) store_items = Item.objects.filter(storeid=store_id)
# Current userid, change as per ⭐ whoever is logged in # Current userid, change as per ⭐ whoever is logged in
user = AuthUser.objects.get(id=request.user.id) user = AuthUser.objects.get(id=request.user.id)
userid = user.id userid = user.id
...@@ -239,6 +253,7 @@ def startAuction(request, pk): ...@@ -239,6 +253,7 @@ def startAuction(request, pk):
all_auctions = Auction.objects.all() all_auctions = Auction.objects.all()
form = StartAuctionForm(initial={'auctionstart':datetime.now()}) form = StartAuctionForm(initial={'auctionstart':datetime.now()})
form.fields["itemid"].queryset = store_items
if request.method == 'POST': if request.method == 'POST':
form = StartAuctionForm(request.POST) form = StartAuctionForm(request.POST)
...@@ -286,6 +301,31 @@ def profile(request, pk): ...@@ -286,6 +301,31 @@ def profile(request, pk):
# get existing auctions for user's bids # get existing auctions for user's bids
auctions = Auction.objects.all() auctions = Auction.objects.all()
### Purchase History ###
# Get auctionstart < currentdate auctions
current_date = datetime.now()
won_itemids = []
won_auctions = []
for aucid in ids_of_auction:
tempAuction = Auction.objects.get(pk=aucid.auctionid)
auctionend = tempAuction.auctionend
# finished auction, auctionend
if auctionend < current_date:
bids = AuctionBid.objects.filter(auctionid=aucid).order_by('-bidtime')
highest_bidder = bids[0].boodleuserid
if highest_bidder.userid == current_user.userid:
itemid = aucid.itemid
itemid.sellprice = bids[0].amount
won_auctions.append(aucid)
won_itemids.append(itemid)
# 🔥Current Store, pk here is the storeid # 🔥Current Store, pk here is the storeid
current_user = AuthUser.objects.get(pk=pk) current_user = AuthUser.objects.get(pk=pk)
form = CreateStoreForm(initial={'userid':pk}) form = CreateStoreForm(initial={'userid':pk})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment