Commit 29a17ac0 authored by Martina Therese R. Reyes's avatar Martina Therese R. Reyes

Merge branch 'xtine' of ssh://gitlab.discs.ateneo.edu:15316/matereyes00/boodle into mate_devbranch

parents ea530206 35191150
......@@ -5,11 +5,6 @@ body {
height: 100%;
font-size: 11pt;
color: #3d3838;
<<<<<<< HEAD
background-color: black;
=======
/* background-color: black; */
>>>>>>> 8f1f8c3028c012cf2653c3f58224f0a116945f2c
}
.carousel-item img {
......@@ -19,66 +14,66 @@ body {
/* nav bar */
nav {
background: black;
top: 0;
width: 100%;
transition: all 0.5s;
position: relative;
z-index: 1;
}
background: black;
top: 0;
width: 100%;
transition: all 0.5s;
position: relative;
z-index: 1;
}
.fixed-nav nav {
position: fixed;
box-shadow 0 5px black;
}
nav ul {
margin: 0;
padding:0;
list-style: none;
display: flex;
}
nav li {
flex: 1;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
li.logo {
max-width: 0;
overflow: hidden;
background: white;
transition: all .5s;
font-weight: 600;
font-size: 30px;
}
li.logo a {
color: black;
}
nav a {
text-decoration: none;
padding: 20px;
display: inline-block;
color: white;
transition: all 0.2s;
}
.fixed-nav nav {
position: fixed;
box-shadow 0 5px black;
}
/* nav bar end */
nav ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
.footer-basic{
background-color: black;
color: #f8edeb;
display: flex;
justify-content: center;
nav li {
flex: 1;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
li.logo {
max-width: 0;
overflow: hidden;
background: white;
transition: all .5s;
font-weight: 600;
font-size: 30px;
}
li.logo a {
color: black;
}
nav a {
text-decoration: none;
padding: 20px;
display: inline-block;
color: white;
transition: all 0.2s;
}
/* nav bar end */
.footer-basic {
background-color: black;
color: #f8edeb;
display: flex;
justify-content: center;
}
.copyright {
flex: 0 1 800px;
.copyright {
flex: 0 1 800px;
padding: 8px 24px;
}
......@@ -101,6 +96,7 @@ nav {
text-align: right;
font-size: 20px;
}
/* homepage happening now */
.title-container {
......@@ -108,16 +104,19 @@ nav {
padding: 8px 32px;
justify-content: center;
}
@media(max-width:480px){
.event-container{
display: flex;
flex-direction: column;
@media(max-width:480px) {
.event-container {
display: flex;
flex-direction: column;
}
.event{ flex: 1 1 auto; }
.event {
flex: 1 1 auto;
}
}
.event-container{
.event-container {
margin: 50px;
display: flex;
justify-content: center;
......@@ -135,67 +134,194 @@ nav {
.event img {
max-width: 100%;
object-fit:cover;
object-fit: cover;
}
.event-text {
padding: 16px;
text-align: center;
}
.event-text{ padding: 16px; text-align: center; }
.slick-prev:before {
color: black !important;
}
.slick-next:before {
color: black !important;
}
/* cards */
.cards {
list-style-type: none;
padding: 0;
display: flex;
flex-wrap: wrap;
}
.cards img {
float: left;
display: block;
margin: 10px 15px 10px 0;
object-fit: cover;
width:80px;
height:80px;
border-radius: 100%;
border: 2px dotted black;
shape-outside: circle(50%);
}
.cards li {
background-color: #f0f0f0;
border: 1px dotted #c3a9ff;
margin: 0 10px 20px 10px;
padding: 8px 16px;
border-radius: 5px;
flex: 1 1 480px;
display:flex;
align-items: center;
}
list-style-type: none;
padding: 0;
display: flex;
flex-wrap: wrap;
}
.cards img {
float: left;
display: block;
margin: 10px 15px 10px 0;
object-fit: cover;
width: 80px;
height: 80px;
border-radius: 100%;
border: 2px dotted black;
shape-outside: circle(50%);
}
.cards p {
.cards li {
background-color: #f0f0f0;
border: 1px dotted #c3a9ff;
margin: 0 10px 20px 10px;
padding: 8px 16px;
border-radius: 5px;
flex: 1 1 480px;
display: flex;
align-items: center;
}
}
.cards p {}
/* cards end */
/* cards end */
/* auction view */
/* auction view */
.product-info{
padding: 8px 16px;
}
/* auction view end */
.slick-prev:before {
color: black !important;
.product-info {
padding: 8px 16px;
}
/* auction view end */
/* inventory/store */
.store-container {
display: flex;
flex-direction: column;
}
.store-banner {
height: 180px;
position: relative;
text-align: center;
display: inline-block;
background: -moz-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.65)), color-stop(100%, rgba(0, 0, 0, 0)));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* IE10+ */
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a6000000', endColorstr='#00000000', GradientType=0);
/* IE6-9 */
}
.store-banner img {
width: 100%;
object-fit: cover;
max-height: 100%;
position: relative;
z-index: -1;
display: block;
}
.store-info {
position: absolute;
color: white;
border: 2px solid black;
bottom: 8px;
left: 4rem;
text-align: left !important;
min-width: 50%;
max-width: 100%;
z-index: +1;
}
.store-info img {
float: left;
display: block;
margin: 10px 15px 10px 0px;
object-fit: cover;
width: 100px;
height: 100px;
border-radius: 100%;
border: 2px dotted black;
}
.sort-by {
display: flex;
justify-content: flex-end;
padding: 2rem 4rem 0 4rem;
;
border: 1px solid black;
}
.store-item-container {
display: grid;
justify-content: center;
grid-gap: 1rem;
grid-template-columns: repeat(5, 1fr);
padding: 4rem;
}
@media(max-width:600px) {
.store-item-container {
grid-template-columns: repeat(2, 1fr);
}
}
.slick-next:before {
color: black !important;
@media(max-width:480px) {
.store-item-container {
grid-template-columns: 1fr;
}
}
.store-item {
background-color: skyblue;
border: 2px dotted black;
}
.store-item img {
max-width: 100%;
object-fit: cover;
}
.item-info {
padding: 1rem 1rem 0 1rem;
}
.item-btns {
display: flex;
justify-content: flex-end;
margin: 0 4px 4px 0;
}
.store-btns-container {
display: flex;
justify-content: center;
align-items: center;
}
/* item detail view / add, edit item */
.item-image-container,
.item-form-container {
border: 2px solid black;
padding: 1rem;
}
\ No newline at end of file
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}My Store{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<div class="container">
<h1>Add/Edit Item</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"> Add Item </button>
</form>
</div>
</div>
</div>
<!-- Form with fields:
[Item name]
[Item Description]
[Floor Price] -->
<!-- Image, if no image add image -->
{% endblock %}
\ No newline at end of file
......@@ -37,7 +37,7 @@
<li><a href="#">About</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">My Profile</a></li>
<li><a href="#">My Store</a></li>
<li><a href="/store">My Store</a></li>
</ul>
</nav>
......
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}Schedule Auction{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<div class="container"><button type="button">Save Auction</button>
</div>
<!-- Form fields:
[Auction Title]
Drop down: [Select time for Auction]
Set Auction timer:
Start:
Drop down: [Month] [Day] [Year] Time: [Hour] : [Minute]
End:
Drop down: [Month] [Day] [Year] Time: [Hour] : [Minute]
-->
{% endblock %}
\ No newline at end of file
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}My Store{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<div class="store-container">
<div class="store-banner"><img src="https://www.w3schools.com/howto/img_snow_wide.jpg">
<div class="store-info">
<img src="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png">
<h1>{{ current_store.storename }}</h1>
<p>@username</p>
<button class="edit-shop-btn" type="button">Edit Shop Info</button>
</div>
</div>
<div class="sort-by">
<label for="items">Sort items by: </label>
<select id="items" name="items">
<option value="">A-Z</option>
<option value="">Oldest</option>
<option value="">Newest</option>
<option value="">Price (Low-High)</option>
<option value="">Price (High-Low) </option>
</select>
</div>
<div class="store-item-container">
{% if store_items %}
{% for item in store_items %}
<div class="store-item">
<img src="https://www.kurin.com/wp-content/uploads/placeholder-square.jpg">
<div class="item-info">
<h4>{{ item.itemname }}</h4>
<p>{{item.itemspecs}} <span class="item-price">PHP {{item.floorprice}}</span></p>
</div>
<div class="item-btns"> <button>Auction</button> <button>Edit</button> <button>Delete</button>
</div>
</div>
{% endfor %}
{% else %}
<h4 text-align="center"> Your Inventory is empty. </h4>
{% endif %}
<!-- <div class="store-item">
<img src="https://www.kurin.com/wp-content/uploads/placeholder-square.jpg">
<div class="item-info">
<h4>Itemname</h4>
<p>Itemdescription <span class="item-price">PHP 500</span></p>
</div>
<div class="item-btns"> <button>Auction</button> <button>Edit</button> <button>Delete</button>
</div>
</div> -->
</div>
</div>
<div class="store-btns-container">
<button type="button"><a href="/startauction">Start Auction</a></button>
<button type="button"><a href="{% url 'additemid' current_store.storeid %}">Add Item</a></button>
</div>
]
</div>
{% endblock %}
\ No newline at end of file
{% extends 'boodlesite\templates\base.html' %}
{% load static %}
{% block title %}My Store{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<h2>This is a temp page to access storeid 1 (and not thru the navbar)</h2>
<p>Remove this page once nav bar is personalized that it accesses the logged in user's store</p>
<h1 text-align="center">Link to My Store: <a href="{% url 'storeid' current_store.storeid %}">{{ current_store.storename }}</a></h1>
{% endblock %}
\ No newline at end of file
from django import forms
from django.forms import (ModelForm,
TextInput, Textarea, widgets)
from django.utils.translation import gettext_lazy as _
from .models import *
from django.core.exceptions import ValidationError
......@@ -27,4 +28,16 @@ class PlaceBidForm(forms.ModelForm):
else:
highest_bid = auction_bids.latest('bidtime').amount
if form_amount <= highest_bid:
raise ValidationError('Please enter an amount higher than the current highest bid.')
\ No newline at end of file
raise ValidationError('Please enter an amount higher than the current highest bid.')
class AddItemForm(forms.ModelForm):
class Meta:
model = Item
fields = ['itemname','itemspecs','floorprice','storeid']
widgets = {'storeid': forms.HiddenInput()}
labels = {
'itemname': _('Item Name'),
'itemspecs': _('Item Description'),
'floorprice': _('Floor Price')
}
\ No newline at end of file
......@@ -151,7 +151,18 @@ class Item(models.Model):
itemspecs = models.CharField(max_length=700)
floorprice = models.DecimalField(max_digits=15, decimal_places=4)
sellprice = models.DecimalField(max_digits=15, decimal_places=4, blank=True, null=True)
storeid = models.ForeignKey('Store', models.DO_NOTHING, db_column='storeid')
class Meta:
managed = False
db_table = 'item'
class Store(models.Model):
storeid = models.AutoField(primary_key=True)
storename = models.CharField(max_length=255)
storedesc = models.CharField(max_length=700)
class Meta:
managed = False
db_table = 'store'
......@@ -5,6 +5,12 @@ from .views import *
urlpatterns = [
path('', homepage, name='index'),
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('store', tempstore, name='store'),
path('store/<int:pk>', mystore, name='storeid'),
path('additem', addItem, name='additem'),
path('additem/<int:pk>', addItem, name='additemid'),
path('startauction', startAuction, name='startauction'),
]
\ No newline at end of file
......@@ -4,7 +4,6 @@ from django.http import HttpResponse
from django.core.exceptions import ValidationError
from .models import *
from .forms import *
......@@ -16,7 +15,7 @@ def homepage(request):
# Filter by auctions happening right now
auctions_now = Auction.objects.filter(auctionstart__lt=datetime.now(),auctionend__gt=datetime.now())
for auction in auctions_now: #
for auction in auctions_now:
print(auction)
# Filter by auctions scheduled at most a week from now
......@@ -27,12 +26,13 @@ def homepage(request):
context = {
'auctions_now': auctions_now,
'auctions_soon': auctions_soon
'auctions_soon': auctions_soon,
}
return render(request, "boodlesite/templates/index.html",context)
def auction(request, pk):
# Current auction ID
auction = Auction.objects.get(pk=pk)
# Item for auction
......@@ -65,7 +65,7 @@ def auction(request, pk):
'item_floor_price': auction_item.floorprice,
'highest_bid': highest_bid,
'auction_end': auction.auctionend,
'form' : form
'form' : form,
}
if auction.auctionend < datetime.now():
......@@ -77,4 +77,62 @@ def auction(request, pk):
return render(request, "boodlesite/templates/auction.html",context)
def error404(request):
return render(request, "boodlesite/templates/error404/notstarted_error404.html")
\ No newline at end of file
return render(request, "boodlesite/templates/error404/notstarted_error404.html")
def tempstore(request): # temp view
#### Access to store 1 [ edit accordingly when it becomes accessible thru a user ] ####
current_store = Store.objects.get(storeid=1)
context = {
'current_store':current_store #### used for navbar, access to store 1
}
return render(request, "boodlesite/templates/tempstore.html", context)
def mystore(request, pk):
#### Access to store 1 [ edit accordingly when it becomes accessible thru a user ] ####
current_store = Store.objects.get(pk=pk)
store_items = Item.objects.filter(storeid=pk)
context = {
'current_store':current_store,
'store_items':store_items
}
return render(request, "boodlesite/templates/store.html", context)
def addItem(request, pk):
# Current Store, pk here is the storeid
current_store = Store.objects.get(pk=pk)
form = AddItemForm(initial={'storeid':current_store})
if request.method == 'POST':
form = AddItemForm(request.POST,initial={'storeid':current_store})
if form.is_valid():
form.save()
return redirect('storeid', pk=pk)
context = {
'form':form,
'current_store': current_store # access to store 1
}
return render(request, "boodlesite/templates/additem.html", context)
def startAuction(request):
#### Access to store 1 [ edit accordingly when it becomes accessible thru a user ] ####
current_store = Store.objects.get(storeid=1)
context = {
'current_store':current_store
}
return render(request, "boodlesite/templates/startauction.html", context)
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