Skip to content

Fonts , Background Changed and added Details functionality on Home Page. #4

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

Open
wants to merge 5 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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Users\\jaikumar singh\\AppData\\Local\\Programs\\Python\\Python39\\python.exe"
}
Binary file added addNewProduct.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions backend/orders_dao.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from datetime import datetime
from sql_connection import get_sql_connection


def insert_order(connection, order):
cursor = connection.cursor()

order_query = ("INSERT INTO orders "
"(customer_name, total, datetime)"
"VALUES (%s, %s, %s)")
"(customer_name, total, datetime)"
"VALUES (%s, %s, %s)")
order_data = (order['customer_name'], order['grand_total'], datetime.now())

cursor.execute(order_query, order_data)
Expand All @@ -30,6 +31,7 @@ def insert_order(connection, order):

return order_id


def get_order_details(connection, order_id):
cursor = connection.cursor()

Expand Down Expand Up @@ -57,6 +59,7 @@ def get_order_details(connection, order_id):

return records


def get_all_orders(connection):
cursor = connection.cursor()
query = ("SELECT * FROM orders")
Expand All @@ -74,10 +77,12 @@ def get_all_orders(connection):

# append order details in each order
for record in response:
record['order_details'] = get_order_details(connection, record['order_id'])
record['order_details'] = get_order_details(
connection, record['order_id'])

return response


if __name__ == '__main__':
connection = get_sql_connection()
print(get_all_orders(connection))
Expand All @@ -98,4 +103,4 @@ def get_all_orders(connection):
# 'total_price': 30
# }
# ]
# }))
# }))
21 changes: 19 additions & 2 deletions backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@

connection = get_sql_connection()


@app.route('/getUOM', methods=['GET'])
def get_uom():
response = uom_dao.get_uoms(connection)
response = jsonify(response)
response.headers.add('Access-Control-Allow-Origin', '*')
return response


@app.route('/getProducts', methods=['GET'])
def get_products():
response = products_dao.get_all_products(connection)
response = jsonify(response)
response.headers.add('Access-Control-Allow-Origin', '*')
return response


@app.route('/insertProduct', methods=['POST'])
def insert_product():
request_payload = json.loads(request.form['data'])
Expand All @@ -35,13 +38,25 @@ def insert_product():
response.headers.add('Access-Control-Allow-Origin', '*')
return response


@app.route('/getAllOrders', methods=['GET'])
def get_all_orders():
response = orders_dao.get_all_orders(connection)
response = jsonify(response)
response.headers.add('Access-Control-Allow-Origin', '*')
return response


@app.route('/getOrderDetails', methods=['GET', 'POST'])
def get_order_details():
order_id = int(request.args.get('orderid'))
response = orders_dao.get_order_details(
connection, order_id)
response = jsonify(response)
response.headers.add('Access-Control-Allow-Origin', '*')
return response


@app.route('/insertOrder', methods=['POST'])
def insert_order():
request_payload = json.loads(request.form['data'])
Expand All @@ -52,16 +67,18 @@ def insert_order():
response.headers.add('Access-Control-Allow-Origin', '*')
return response


@app.route('/deleteProduct', methods=['POST'])
def delete_product():
return_id = products_dao.delete_product(connection, request.form['product_id'])
return_id = products_dao.delete_product(
connection, request.form['product_id'])
response = jsonify({
'product_id': return_id
})
response.headers.add('Access-Control-Allow-Origin', '*')
return response


if __name__ == "__main__":
print("Starting Python Flask Server For Grocery Store Management System")
app.run(port=5000)

13 changes: 7 additions & 6 deletions backend/sql_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

__cnx = None

def get_sql_connection():
print("Opening mysql connection")
global __cnx

if __cnx is None:
__cnx = mysql.connector.connect(user='root', password='root', database='grocery_store')
def get_sql_connection():
print("Opening mysql connection")
global __cnx

return __cnx
if __cnx is None:
__cnx = mysql.connector.connect(
user='root', password='Mysql@0707', database='grocery_store')

return __cnx
Binary file modified homepage.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manageProductsPags.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added newOrderPage.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added orderDetailsPage.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion ui/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -2665,7 +2665,7 @@ button.close:focus {
}

*, .header.sidebar .logo h1, body, h1, h2, h3, h4, h5, h6 {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-family: Georgia, serif,-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
outline: none !important;
}

Expand Down Expand Up @@ -2753,6 +2753,7 @@ input:focus, textarea:focus {
width: 100%;
max-width: 100%;
margin-bottom: 21px

}

.table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
Expand Down
2 changes: 1 addition & 1 deletion ui/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified ui/images/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading