034
This commit is contained in:
parent
19854e9d7e
commit
8f7a830182
BIN
db5.sqlite3
BIN
db5.sqlite3
Binary file not shown.
57
src/a3.nim
57
src/a3.nim
@ -242,6 +242,7 @@ import
|
|||||||
|
|
||||||
"/checkout" -> post:
|
"/checkout" -> post:
|
||||||
var
|
var
|
||||||
|
# res = Response()
|
||||||
email: string
|
email: string
|
||||||
password: string
|
password: string
|
||||||
db = newDatabase()
|
db = newDatabase()
|
||||||
@ -284,6 +285,7 @@ import
|
|||||||
|
|
||||||
var
|
var
|
||||||
country = cookies["c_country"]
|
country = cookies["c_country"]
|
||||||
|
# country = ctx.queryParams["c_country"]
|
||||||
firstName = cookies["c_fname"]
|
firstName = cookies["c_fname"]
|
||||||
lastName = cookies["c_lname"]
|
lastName = cookies["c_lname"]
|
||||||
address = cookies["c_address"]
|
address = cookies["c_address"]
|
||||||
@ -293,6 +295,7 @@ import
|
|||||||
phone = cookies["c_phone"]
|
phone = cookies["c_phone"]
|
||||||
password1: string
|
password1: string
|
||||||
|
|
||||||
|
# echo ctx.queryParams["c_country"]
|
||||||
echo cookies
|
echo cookies
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -342,7 +345,7 @@ import
|
|||||||
var product = db.getProductById(d.productId)
|
var product = db.getProductById(d.productId)
|
||||||
products.add(product)
|
products.add(product)
|
||||||
|
|
||||||
compileTemplateFile(getScriptDir() / "a3a" / "thankyou.nimja")
|
compileTemplateFile(getScriptDir() / "a3a" / "checkout.nimja")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if productName != "":
|
if productName != "":
|
||||||
@ -442,34 +445,34 @@ import
|
|||||||
|
|
||||||
compileTemplateFile(getScriptDir() / "a3a" / "shop-single.nimja")
|
compileTemplateFile(getScriptDir() / "a3a" / "shop-single.nimja")
|
||||||
|
|
||||||
"/thankyou" -> get:
|
# "/thankyou" -> get:
|
||||||
var
|
# var
|
||||||
email: string
|
# email: string
|
||||||
password: string
|
# password: string
|
||||||
products: seq[Products]
|
# products: seq[Products]
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
email = ctx.cookies["email"]
|
# email = ctx.cookies["email"]
|
||||||
password = ctx.cookies["password"]
|
# password = ctx.cookies["password"]
|
||||||
except:
|
# except:
|
||||||
email = ""
|
# email = ""
|
||||||
password = ""
|
# password = ""
|
||||||
|
|
||||||
if email == "":
|
# if email == "":
|
||||||
ctx.redirect("/login")
|
# ctx.redirect("/login")
|
||||||
else:
|
# else:
|
||||||
products = micsGetProducts(email, password)
|
# products = micsGetProducts(email, password)
|
||||||
|
|
||||||
ctx &= initCookie("c_country", "")
|
# ctx &= initCookie("c_country", "")
|
||||||
ctx &= initCookie("c_fname", "")
|
# ctx &= initCookie("c_fname", "")
|
||||||
ctx &= initCookie("c_lname", "")
|
# ctx &= initCookie("c_lname", "")
|
||||||
ctx &= initCookie("c_address", "")
|
# ctx &= initCookie("c_address", "")
|
||||||
ctx &= initCookie("c_state_country", "")
|
# ctx &= initCookie("c_state_country", "")
|
||||||
ctx &= initCookie("c_postal_zip", "")
|
# ctx &= initCookie("c_postal_zip", "")
|
||||||
ctx &= initCookie("c_email_address", "")
|
# ctx &= initCookie("c_email_address", "")
|
||||||
ctx &= initCookie("c_phone", "")
|
# ctx &= initCookie("c_phone", "")
|
||||||
|
|
||||||
compileTemplateFile(getScriptDir() / "a3a" / "thankyou.nimja")
|
# compileTemplateFile(getScriptDir() / "a3a" / "thankyou.nimja")
|
||||||
|
|
||||||
"/login" -> get:
|
"/login" -> get:
|
||||||
var
|
var
|
||||||
@ -512,8 +515,8 @@ import
|
|||||||
ctx &= initCookie("password", password)
|
ctx &= initCookie("password", password)
|
||||||
|
|
||||||
if quantity != 0:
|
if quantity != 0:
|
||||||
ctx.redirect("/checkout?prod=" & productName & "&quantity=" & $quantity)
|
# ctx.redirect("/checkout?prod=" & productName & "&quantity=" & $quantity)
|
||||||
# ctx.redirect(fmt"/checkout?prod={productName}&quantity={quantity}")
|
ctx.redirect(fmt"/checkout?prod={productName}&quantity={quantity}")
|
||||||
else:
|
else:
|
||||||
|
|
||||||
ctx.redirect("/")
|
ctx.redirect("/")
|
||||||
|
@ -77,11 +77,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if ch == "" %}
|
{# {% if ch == "" %}
|
||||||
<form action="/checkout" method="post" class="row">
|
<form action="/checkout" method="post" class="row">
|
||||||
{% else %}
|
{% else %}
|
||||||
<form action="/checkout?prod={{productName}}&quantity={{quantity}}" method="post" class="row">
|
<form action="/checkout?prod={{productName}}&quantity={{quantity}}" method="post" class="row">
|
||||||
{% endif %}
|
{% endif %} #}
|
||||||
|
<div class="row">
|
||||||
<div class="col-md-6 mb-5 mb-md-0">
|
<div class="col-md-6 mb-5 mb-md-0">
|
||||||
<h2 class="h3 mb-3 text-black">Billing Details</h2>
|
<h2 class="h3 mb-3 text-black">Billing Details</h2>
|
||||||
<div class="p-3 p-lg-5 border">
|
<div class="p-3 p-lg-5 border">
|
||||||
@ -345,7 +346,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
{# </form> #}
|
||||||
|
</div>
|
||||||
<!-- </form> -->
|
<!-- </form> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user