Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categories product #15

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
34 changes: 34 additions & 0 deletions client_app/pages/components/BestDeals/Cate_product.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const Cate_product = ({prod}) => {
const category_name = localStorage.getItem("cate_name");
return (
<li className="col-xl-2 product-item max-width-xl-100 remove-divider">
<div className="product-item__outer h-100 w-100 prodcut-box-shadow">
<div className="product-item__inner bg-white p-3">
<div className="product-item__body pb-xl-2">
<div className="mb-2"><a href="../shop/product-categories-7-column-full-width.html" className="font-size-12 text-gray-5">{category_name}</a></div>
<h5 className="mb-1 product-item__title"><a href="../shop/single-product-fullwidth.html" className="text-blue font-weight-bold">{prod.Title}</a></h5>
<div className="mb-2">
<a href="../shop/single-product-fullwidth.html" className="d-block text-center"><img className="img-fluid" src={prod.image} alt="Image Description" /></a>
</div>
<div className="flex-center-between mb-1">
<div className="prodcut-price">
<div className="text-gray-100">৳ {prod.offer_price}</div>
</div>
<div className="d-none d-xl-block prodcut-add-cart">
<a href="../shop/single-product-fullwidth.html" className="btn-add-cart btn-primary transition-3d-hover"><i className="ec ec-add-to-cart"></i></a>
</div>
</div>
</div>
<div className="product-item__footer">
<div className="border-top pt-2 flex-center-between flex-wrap">
<a href="../shop/compare.html" className="text-gray-6 font-size-13"><i className="ec ec-compare mr-1 font-size-15"></i> Compare</a>
<a href="../shop/wishlist.html" className="text-gray-6 font-size-13"><i className="ec ec-favorites mr-1 font-size-15"></i> Add to Wishlist</a>
</div>
</div>
</div>
</div>
</li>
)
}

export default Cate_product
5,212 changes: 63 additions & 5,149 deletions client_app/pages/components/BestDeals/bestdeals.jsx

Large diffs are not rendered by default.

39 changes: 22 additions & 17 deletions client_app/pages/profile/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,15 @@ const ProfileEdit = () => {
const [lastname, setlastname] = useState('')
const [phone, setphone] = useState('')
const [home_address, sethome_address] = useState('')

const [response_msg, setResponse_msg] = useState()
let handleSubmit = () => {
if (user_details.firstname !== "" && firstname === "") {
setfirstname(user_details.firstname);
}
if (user_details.lastname !== "" && lastname === "") {
setlastname(user_details.lastname)
}
if (user_details.phone !== "" && phone === "") {
setphone(user_details.phone)
}
if (user_details.home_address !== "" && home_address === "") {
sethome_address(user_details.home_address)
}

const data = {
"firstname": firstname,
"lastname": lastname,
"phone": phone,
"home_address": home_address
}

let url = "http://localhost:8000/api/auth/" + userId + "/";
const header = {
headers: {
Expand All @@ -43,17 +30,35 @@ const ProfileEdit = () => {

axios.put(url, data, header)
.then(response => {
console.log(response)
setResponse_msg(response.data)
})
}

return (
<div>
<div className="container col-lg-11 order-lg-1 mt-3">
<div className="pb-11 mb-11">
<div className="border-bottom border-color-1 mb-5">
<h3 className="section-title text-center mb-0 pb-2 font-size-25">Profile Edit</h3>
</div>
{(() => {
if (response_msg != null) {
return (
<span style={
{
"backgroundColor":response_msg.type=="success"?"green":"red",
"fontSize":"20px",
"color":"white",
"padding":'4px',
"marginBottom":"15px",
}
}>{response_msg.text}</span>
)
}

return null;
})()}

<form onSubmit={handleSubmit} method="PUT" id="edit_profile">
<div className="row">
<div className="col-md-6">
Expand Down
2 changes: 1 addition & 1 deletion client_app/public/assets/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -10346,7 +10346,7 @@ button.bg-indigo:focus {
}
}

@media (min-width: 1480px) {
@media (min-width: 1280px) {
.d-wd-none {
display: none !important;
}
Expand Down
24 changes: 17 additions & 7 deletions server_app/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,25 @@ def update(self, request, *args, **kwargs):
data = request.data
get_firstname = data['firstname']
get_lastname = data['lastname']
user.firstname = get_firstname
user.lastname = get_lastname
get_phone = data['phone']
get_home_address = data['home_address']
user.phone = get_phone
user.home_address = get_home_address
user.save()
serializer = UserSerializer(user)
return Response(serializer.data)
if get_firstname!="":
user.firstname = get_firstname
if get_lastname!="":
user.lastname = get_lastname
if get_phone!="":
user.phone = get_phone
if get_home_address!="":
user.home_address = get_home_address
response_msg = {}
try:
user.save()
response_msg["text"] = "Your profile updated successfully!"
response_msg["type"]= "success"
except:
response_msg["text"] = "Something went wrong!Your profile didn't updated!"
response_msg["type"]= "error"
return Response(response_msg)



Binary file modified server_app/db.sqlite3
Binary file not shown.
25 changes: 5 additions & 20 deletions server_app/server_app/urls.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
"""server_app URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

Expand All @@ -22,12 +7,12 @@
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('accounts.urls')),
path('api/blog', include('blog.urls')),
path('api/blog/', include('blog.urls')),
path('api/data/', include('products.urls')),
path('api/promotional', include('featured_products.urls')),
path('api/site_details', include('site_details.urls')),
path('api/tracking_order', include('tracking_order.urls')),
path('api/vendor_catalog', include('vendor_catalog.urls')),
path('api/promotional/', include('featured_products.urls')),
path('api/site_details/', include('site_details.urls')),
path('api/tracking_order/', include('tracking_order.urls')),
path('api/vendor_catalog/', include('vendor_catalog.urls')),
]

urlpatterns+=static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)