Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
G1_ShoppingApp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tran15.Anh@live.uwe.ac.uk
G1_ShoppingApp
Commits
a7a2e580
Commit
a7a2e580
authored
1 week ago
by
Nguyen12.Minh@live.uwe.ac.uk
Browse files
Options
Downloads
Patches
Plain Diff
modified create shop and product
parent
d6a18c31
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#8909
failed
1 week ago
Stage: install
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/frontend/components/product/create_product.py
+2
-3
2 additions, 3 deletions
app/frontend/components/product/create_product.py
app/frontend/components/shop/create_shop.py
+1
-2
1 addition, 2 deletions
app/frontend/components/shop/create_shop.py
with
3 additions
and
5 deletions
app/frontend/components/product/create_product.py
+
2
−
3
View file @
a7a2e580
...
...
@@ -56,18 +56,17 @@ def create_product_frame(parent, switch_func, API_URL, token):
price_val
=
price_entry
.
get
().
strip
()
desc_val
=
desc_entry
.
get
().
strip
()
stock_val
=
stock_entry
.
get
().
strip
()
# shop_val = shop_id_entry.get().strip()
if
not
title_val
or
not
price_val
or
not
stock_val
:
messagebox
.
showerror
(
"
Error
"
,
"
Title, Price, and Stock are required
"
)
return
# In a real scenario, you would pass the shop_id from view_shop.
# For now, use a placeholder shop_id (e.g., 1)
data
=
{
"
name
"
:
title_val
,
"
price
"
:
price_val
,
"
description
"
:
desc_val
,
"
stock
"
:
stock_val
,
"
shop_id
"
:
1
# Replace with the actual shop id
#
"shop_id":
shop_val,
}
files
=
{}
if
os
.
path
.
isfile
(
image_path
.
get
()):
...
...
This diff is collapsed.
Click to expand it.
app/frontend/components/shop/create_shop.py
+
1
−
2
View file @
a7a2e580
...
...
@@ -31,7 +31,6 @@ def create_shop_frame(parent, switch_func, API_URL, token):
address_label
=
ctk
.
CTkLabel
(
frame
,
text
=
"
Address:
"
)
address_label
.
pack
(
pady
=
5
)
address_entry
=
ctk
.
CTkEntry
(
frame
,
width
=
300
)
address_entry
.
insert
(
0
,
"
123 Main St
"
)
address_entry
.
pack
(
pady
=
5
)
# Shop Image Upload
...
...
@@ -76,7 +75,7 @@ def create_shop_frame(parent, switch_func, API_URL, token):
if
resp
.
status_code
==
200
:
shop
=
resp
.
json
()
messagebox
.
showinfo
(
"
Success
"
,
"
Shop created successfully!
"
)
switch_func
(
"
view_shop
"
,
shop
)
# Pass the shop data to the view shop frame
switch_func
(
"
create_product
"
,
shop
)
# Pass the shop data to the view shop frame
else
:
messagebox
.
showerror
(
"
Error
"
,
f
"
Failed to create shop. Status:
{
resp
.
status_code
}
\n
{
resp
.
text
}
"
)
except
Exception
as
e
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment