Skip to content
Open
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
Binary file modified db.sqlite3
Binary file not shown.
10 changes: 5 additions & 5 deletions loginApp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

def showLogin(request):
# If the user is already logged in, they cannot navigate to the login/registration page
if 'user_id' in request.session:
return redirect('/home')
# if 'user_id' in request.session:
# return redirect('/home')
# form = RegisterForm()
# context = {
# 'regForm': form
Expand All @@ -18,8 +18,8 @@ def showLogin(request):

def showRegister(request):
# If the user is already logged in, they cannot navigate to the login/registration page
if 'user_id' in request.session:
return redirect('/home')
# if 'user_id' in request.session:
# return redirect('/home')
return render(request, 'register.html')

def register(request):
Expand Down Expand Up @@ -56,7 +56,7 @@ def login(request):
return redirect('/home')

messages.error(request, "Invalid email/password", extra_tags="login_email")
return redirect('/user')
return redirect('/user/login')


def editUser(request, userId):
Expand Down
14 changes: 14 additions & 0 deletions productsApp/migrations/0006_merge_20200529_0143.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 2.2.4 on 2020-05-29 01:43

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('productsApp', '0005_auto_20200528_1726'),
('productsApp', '0005_auto_20200528_2323'),
]

operations = [
]
76 changes: 48 additions & 28 deletions productsApp/templates/payment.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,39 @@
{% load static %}
<link rel="stylesheet" href="{% static 'style.css' %}">
<title>Order Page</title>
{% load static %}
<link rel="stylesheet" href="{% static 'productsApp/fonts/icomoon/style.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/magnific-popup.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/jquery-ui.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/owl.carousel.min.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/owl.theme.default.min.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/bootstrap-datepicker.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/fonts/flaticon/font/flaticon.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/aos.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/rangeslider.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/style.css' %}">

<script src="{% static 'productsApp/js/jquery-3.3.1.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery-migrate-3.0.1.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery-ui.js' %}"></script>
<script src="{% static 'productsApp/js/popper.min.js' %}"></script>
<script src="{% static 'productsApp/js/bootstrap.min.js' %}"></script>
<script src="{% static 'productsApp/js/owl.carousel.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery.stellar.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery.countdown.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery.magnific-popup.min.js' %}"></script>
<script src="{% static 'productsApp/js/bootstrap-datepicker.min.js' %}"></script>
<script src="{% static 'productsApp/js/aos.js' %}"></script>
<script src="{% static 'productsApp/js/rangeslider.min' %}"></script>
<script src="{% static 'productsApp/js/main.js' %}"></script>
</head>
</head>
<body class="bg-white text-dark">
<div class="col-8" style="margin: auto;">
<form action="/addUser" method="POST">
{% csrf_token %}
<div class="table" style="margin: auto">
<h1>Your Orders</h>
<table class="table table-dark">
<table class="table table-light">
<th>Products</th>
<th>Price</th>
<th>Quantity</th>
Expand All @@ -29,63 +54,58 @@ <h1>Your Orders</h>
</tr>
{% endfor %}
</div>
</form>
<div class="usertable">
<form action="/shoppingCart" method="POST">
<form action="/user/{{User.id}}/payment/process" method="POST">
{% csrf_token %}
<div class="Shipping Info">
<h1>Shipping information</h1>
<div class="labels">
<label>First Name</label>
<input type="text" name="firstName" class="col-sm-6 form-control">
<input type="text" name="shipping_firstName" class="col-sm-6 form-control">
<label>Last Name</label>
<input type="text" name="lastName" class="col-sm-6 form-control">
<input type="text" name="shipping_lastName" class="col-sm-6 form-control">
<label>Address</label>
<input type="text" name ="address" class="col-sm-6 form-control">
<input type="text" name ="shipping_address" class="col-sm-6 form-control">
<label>Adresss 2</label>
<input type="text" name ="address2" class="col-sm-6 form-control">
<input type="text" name ="shipping_address2" class="col-sm-6 form-control">
<label>City</label>
<input type="text" name="city" class="col-sm-6 form-control">
<input type="text" name="shipping_city" class="col-sm-6 form-control">
<label>State</label>
<input type="text" name="state" class="col-sm-6 form-control">
<input type="text" name="shipping_state" class="col-sm-6 form-control">
<label>Zipcode</label>
<input type="text" name ="zipcode" class="col-sm-6 form-control">
<input type="text" name ="shipping_zipcode" class="col-sm-6 form-control">
</div>
</div>
</form>
<form action="/payment" method="POST">
{% csrf_token %}
</div>
<div class="billingInfo">
<h1>Billing information:</h1>
<div class="labels">
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> Same As Shipping</label><br>
<label>First Name</label>
<input type="text" name="firsName" class="col-sm-6 form-control">
<input type="text" name="billing_firstName" class="col-sm-6 form-control">
<label>Last Name</label>
<input type="text" name="lastName" class="col-sm-6 form-control">
<input type="text" name="billing_lastName" class="col-sm-6 form-control">
<label>Address</label>
<input type="text" name ="address" class="col-sm-6 form-control">
<input type="text" name ="billing_address" class="col-sm-6 form-control">
<label>Adresss 2</label>
<input type="text" name ="address2" class="col-sm-6 form-control">
<input type="text" name ="billing_address2" class="col-sm-6 form-control">
<label>City</label>
<input type="text" name="city" class="col-sm-6 form-control">
<input type="text" name="billing_city" class="col-sm-6 form-control">
<label>State</label>
<input type="text" name="state" class="col-sm-6 form-control">
<input type="text" name="billing_state" class="col-sm-6 form-control">
<label>Zipcode</label>
<input type="text" name ="zipcode" class="col-sm-6 form-control">
<input type="text" name ="billing_zipcode" class="col-sm-6 form-control">
<label>Card</label>
<input type="text" name="city" class="col-sm-6 form-control">
<input type="text" name="card" class="col-sm-6 form-control">
<label>Security Code</label>
<input type="text" name="state" class="col-sm-6 form-control">
<input type="text" name="security_card" class="col-sm-6 form-control">
<label>Expiration Date</label>
<input type="month" name ="expDate" class="col-sm-6 form-control">
<button type="submit" class="btn btn-primary" name="add" value="user1">Pay</button>
<button type="submit" class="btn btn-primary" name="pay">Pay</button>
</div>
</div>
</form>

</div>
</div>
</body>
</html>
</html>
9 changes: 3 additions & 6 deletions productsApp/templates/productPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<body class="text-light bg-dark">
<div class="container">
<div class="col">
<form action="/addUser" method="POST">
{% csrf_token %}
<div class="pos-f-t">
<div class="pos-f-t">
<div class="collapse" id="navbarToggleExternalContent">
Expand All @@ -30,7 +28,7 @@ <h4 class="text-white">One Sotop Shop</h4>
</div>

<div class="product">
<img class="col"style="width: 15%;"src="{{product.image}}" alt="Logo">
<img class="col"style="width: 45%;"src="{{product.image}}" alt="Logo">
<label for="sort">Sort</label>
<select name="sort">
<option value="Price">Price</option>
Expand All @@ -42,16 +40,15 @@ <h4 class="text-white">One Sotop Shop</h4>
</select>
</table>
</div>
</div>
</form>
</div>
<form>
<div class="row">
<h1>{{product.name}}</h1>
<p>{{product.desc}}</p>
<div class="labels">
<select name="sort">
<option value="1">1</option>
<option value="2">2/option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
Expand Down
27 changes: 26 additions & 1 deletion productsApp/templates/wish_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,32 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<title>OneStopShop Wish List</title>

{% load static %}
<link rel="stylesheet" href="{% static 'productsApp/fonts/icomoon/style.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/magnific-popup.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/jquery-ui.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/owl.carousel.min.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/owl.theme.default.min.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/bootstrap-datepicker.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/fonts/flaticon/font/flaticon.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/aos.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/rangeslider.css' %}">
<link rel="stylesheet" href="{% static 'productsApp/css/style.css' %}">

<script src="{% static 'productsApp/js/jquery-3.3.1.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery-migrate-3.0.1.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery-ui.js' %}"></script>
<script src="{% static 'productsApp/js/popper.min.js' %}"></script>
<script src="{% static 'productsApp/js/bootstrap.min.js' %}"></script>
<script src="{% static 'productsApp/js/owl.carousel.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery.stellar.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery.countdown.min.js' %}"></script>
<script src="{% static 'productsApp/js/jquery.magnific-popup.min.js' %}"></script>
<script src="{% static 'productsApp/js/bootstrap-datepicker.min.js' %}"></script>
<script src="{% static 'productsApp/js/aos.js' %}"></script>
<script src="{% static 'productsApp/js/rangeslider.min' %}"></script>
<script src="{% static 'productsApp/js/main.js' %}"></script>
</head>
<body>
<div class="container">
Expand Down
2 changes: 1 addition & 1 deletion productsApp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
path('user/<int:userId>/wishList/add', views.addWishItem),
path('user/<int:userId>/wishList/<int:productId>/delete', views.deleteWishItem),
path('user/<int:userId>/wishList/<int:productId>/addToCart', views.addWishToCart),
path('<int:orderId>/receipt', views.showReceipt),
path('receipt', views.showReceipt),
]
53 changes: 35 additions & 18 deletions productsApp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ def deleteCartItem(request, userId, productId): # changed product_id to productI

def showPayment(request, userId): #productId
context = {
"User": User.objects.filter(id=userId),
"Product": Product.objects.filter(id=userId)
"User": User.objects.get(id=userId),
"Product": Product.objects.get(id=userId)
}
return render(request, "payment.html", context)# render payment page with all of the items from shopping cart


def processPayment(request, userId):

# errors = User.objects.tripValidator(request.POST)
Expand All @@ -95,20 +96,36 @@ def processPayment(request, userId):
# messages.error(request, value, extra_tags=key)
# return redirect(f"/dashboard/trip/new")
userid = request.session['user_id']
user = User.objects.filter(id = userid)[0]
pay = ShippingInfo.objects.create(
userID = user,
first_name = request.POST['destination'],
last_name = request.POST['startDate'],
address = request.POST['endDate'],
adress2 = request.POST['planTrip'],
city = request.POST['destination'],
state = request.POST['startDate'],
zipcode = request.POST['endDate'],
user = User.objects.filter(id = userId)[0]
ship = ShippingInfo.objects.create(
first_name = request.POST['shipping_firstName'],
last_name = request.POST['shipping_lastName'],
address = request.POST['shipping_address'],
address2 = request.POST['shipping_address2'],
city = request.POST['shipping_city'],
state = request.POST['shipping_state'],
zipcode = request.POST['shipping_zipcode'],
user = user
)
process = BillingInfo.objects.create(
first_name = request.POST['billing_firstName'],
last_name = request.POST['billing_lastName'],
address = request.POST['billing_address'],
address2 = request.POST['billing_address2'],
city = request.POST['billing_city'],
state = request.POST['billing_state'],
zipcode = request.POST['billing_zipcode']

)
return redirect("/dashboard")
# pay = PaymentInfo.objects.create(
# card_number = request.POST['creditCard'],
# security_code = request.POST['securityCode'],

# )
print(request.POST["expDate"])
return redirect("/receipt")


return HttpResponse('process payment') # process the payment and redirect to the receipt page


## Wish List
Expand All @@ -133,9 +150,9 @@ def addWishToCart(request, userId, productId): # replace ShoppingCart_id with us
##this cannot be right...

##Receipt
def showReceipt(request, order_id):
context={
"purchased_items": Order.objects.get(id=order_id)
}
def showReceipt(request):
# context={
# "purchased_items": Order.objects.get(id=order_id)
# }
return render(request, 'receipt.html')