diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a0eeb2f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Users\\jaikumar singh\\AppData\\Local\\Programs\\Python\\Python39\\python.exe" +} \ No newline at end of file diff --git a/addNewProduct.JPG b/addNewProduct.JPG new file mode 100644 index 0000000..07ca167 Binary files /dev/null and b/addNewProduct.JPG differ diff --git a/backend/orders_dao.py b/backend/orders_dao.py index c088dd7..1d61c1c 100644 --- a/backend/orders_dao.py +++ b/backend/orders_dao.py @@ -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) @@ -30,6 +31,7 @@ def insert_order(connection, order): return order_id + def get_order_details(connection, order_id): cursor = connection.cursor() @@ -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") @@ -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)) @@ -98,4 +103,4 @@ def get_all_orders(connection): # 'total_price': 30 # } # ] - # })) \ No newline at end of file + # })) diff --git a/backend/server.py b/backend/server.py index 3545457..1fd6b51 100644 --- a/backend/server.py +++ b/backend/server.py @@ -11,6 +11,7 @@ connection = get_sql_connection() + @app.route('/getUOM', methods=['GET']) def get_uom(): response = uom_dao.get_uoms(connection) @@ -18,6 +19,7 @@ def get_uom(): response.headers.add('Access-Control-Allow-Origin', '*') return response + @app.route('/getProducts', methods=['GET']) def get_products(): response = products_dao.get_all_products(connection) @@ -25,6 +27,7 @@ def get_products(): response.headers.add('Access-Control-Allow-Origin', '*') return response + @app.route('/insertProduct', methods=['POST']) def insert_product(): request_payload = json.loads(request.form['data']) @@ -35,6 +38,7 @@ 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) @@ -42,6 +46,17 @@ def get_all_orders(): 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']) @@ -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) - diff --git a/backend/sql_connection.py b/backend/sql_connection.py index 890532a..805a615 100644 --- a/backend/sql_connection.py +++ b/backend/sql_connection.py @@ -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 diff --git a/homepage.JPG b/homepage.JPG index ef4c8a8..9f3506a 100644 Binary files a/homepage.JPG and b/homepage.JPG differ diff --git a/manageProductsPags.JPG b/manageProductsPags.JPG new file mode 100644 index 0000000..dccd42d Binary files /dev/null and b/manageProductsPags.JPG differ diff --git a/newOrderPage.JPG b/newOrderPage.JPG new file mode 100644 index 0000000..e6d3400 Binary files /dev/null and b/newOrderPage.JPG differ diff --git a/orderDetailsPage.JPG b/orderDetailsPage.JPG new file mode 100644 index 0000000..0f965e7 Binary files /dev/null and b/orderDetailsPage.JPG differ diff --git a/ui/css/custom.css b/ui/css/custom.css index 30ecaf6..e8c4739 100644 --- a/ui/css/custom.css +++ b/ui/css/custom.css @@ -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; } @@ -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 { diff --git a/ui/css/style.css b/ui/css/style.css index 24524d9..3cc6584 100644 --- a/ui/css/style.css +++ b/ui/css/style.css @@ -3,4 +3,4 @@ * bootstrap-notifications v1.0.3 (https://skywalkapps.github.io/bootstrap-notifications) * Copyright 2017 Martin Staněk * Licensed under MIT -*/.dropdown-container{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:200px;max-width:330px;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-container>.dropdown-menu{position:static;z-index:1000;float:none !important;padding:10px 0;margin:0;border:0;background:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;max-height:330px;overflow-y:auto}.dropdown-container>.dropdown-menu+.dropdown-menu{padding-top:0}.dropdown-menu>li>a{overflow:hidden;white-space:nowrap;word-wrap:normal;text-decoration:none;text-overflow:ellipsis;-o-text-overflow:ellipsis;-webkit-transition:none;-o-transition:none;transition:none}.dropdown-toggle{cursor:pointer}.dropdown-header{white-space:nowrap}.open>.dropdown-container>.dropdown-menu,.open>.dropdown-container{display:block}.dropdown-toolbar{padding-top:6px;padding-left:20px;padding-right:20px;padding-bottom:5px;background-color:#fff;border-bottom:1px solid rgba(0,0,0,0.15);border-radius:4px 4px 0 0}.dropdown-toolbar>.form-group{margin:5px -10px}.dropdown-toolbar .dropdown-toolbar-actions{float:right}.dropdown-toolbar .dropdown-toolbar-title{margin:0;font-size:14px}.dropdown-footer{padding:5px 20px;border-top:1px solid #ccc;border-top:1px solid rgba(0,0,0,0.15);border-radius:0 0 4px 4px}.anchor-block small{display:none}@media (min-width:992px){.anchor-block small{display:block;font-weight:normal;color:#777777}.dropdown-menu>li>a.anchor-block{padding-top:6px;padding-bottom:6px}}@media (min-width:992px){.dropdown.hoverable:hover>ul{display:block}}.dropdown-position-topright{top:auto;right:0;bottom:100%;left:auto;margin-bottom:2px}.dropdown-position-topleft{top:auto;right:auto;bottom:100%;left:0;margin-bottom:2px}.dropdown-position-bottomright{right:0;left:auto}.dropmenu-item-label{white-space:nowrap}.dropmenu-item-content{position:absolute;text-align:right;max-width:60px;right:20px;color:#777777;overflow:hidden;white-space:nowrap;word-wrap:normal;-o-text-overflow:ellipsis;text-overflow:ellipsis}small.dropmenu-item-content{line-height:20px}.dropdown-menu>li>a.dropmenu-item{position:relative;padding-right:66px}.dropdown-submenu .dropmenu-item-content{right:40px}.dropdown-menu>li.dropdown-submenu>a.dropmenu-item{padding-right:86px}.dropdown-inverse .dropdown-menu{background-color:rgba(0,0,0,0.8);border:1px solid rgba(0,0,0,0.9)}.dropdown-inverse .dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#2b2b2b}.dropdown-inverse .dropdown-menu>li>a{color:#cccccc}.dropdown-inverse .dropdown-menu>li>a:hover,.dropdown-inverse .dropdown-menu>li>a:focus{color:#fff;background-color:#262626}.dropdown-inverse .dropdown-menu>.active>a,.dropdown-inverse .dropdown-menu>.active>a:hover,.dropdown-inverse .dropdown-menu>.active>a:focus{color:#fff;background-color:#337ab7}.dropdown-inverse .dropdown-menu>.disabled>a,.dropdown-inverse .dropdown-menu>.disabled>a:hover,.dropdown-inverse .dropdown-menu>.disabled>a:focus{color:#777777}.dropdown-inverse .dropdown-header{color:#777777}.table>thead>tr>th.col-actions{padding-top:0;padding-bottom:0}.table>thead>tr>th.col-actions .dropdown-toggle{color:#777777}.notifications{list-style:none;padding:0}.notification{display:block;padding:9.6px 12px;border-width:0 0 1px 0;border-style:solid;border-color:#eeeeee;background-color:#fff;color:#333333;text-decoration:none}.notification:last-child{border-bottom:0}.notification:hover,.notification.active:hover{background-color:#f9f9f9;border-color:#eeeeee}.notification.active{background-color:#f4f4f4}a.notification:hover{text-decoration:none}.notification-title{font-size:15px;margin-bottom:0}.notification-desc{margin-bottom:0}.notification-meta{color:#777777}.dropdown-notifications>.dropdown-container,.dropdown-notifications>.dropdown-menu{width:450px;max-width:450px}.dropdown-notifications .dropdown-menu{padding:0}.dropdown-notifications .dropdown-toolbar,.dropdown-notifications .dropdown-footer{padding:9.6px 12px}.dropdown-notifications .dropdown-toolbar{background:#fff}.dropdown-notifications .dropdown-footer{background:#eeeeee}.notification-icon{margin-right:6.8775px}.notification-icon:after{position:absolute;content:attr(data-count);margin-left:-6.8775px;margin-top:-6.8775px;padding:0 4px;min-width:13.755px;height:13.755px;line-height:13.755px;background:red;border-radius:10px;color:#fff;text-align:center;vertical-align:middle;font-size:11.004px;font-weight:600;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}.notification .media-body{padding-top:5.6px}.btn-lg .notification-icon:after{margin-left:-8.253px;margin-top:-8.253px;min-width:16.506px;height:16.506px;line-height:16.506px;font-size:13.755px}.btn-xs .notification-icon:after{content:'';margin-left:-4.1265px;margin-top:-2.06325px;min-width:6.25227273px;height:6.25227273px;line-height:6.25227273px;padding:0}.btn-xs .notification-icon{margin-right:3.43875px} \ No newline at end of file +*/.dropdown-container{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:200px;max-width:330px;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-container>.dropdown-menu{position:static;z-index:1000;float:none !important;padding:10px 0;margin:0;border:0;background:transparent;border-radius:0;-webkit-box-shadow:none;box-shadow:none;max-height:330px;overflow-y:auto}.dropdown-container>.dropdown-menu+.dropdown-menu{padding-top:0}.dropdown-menu>li>a{overflow:hidden;white-space:nowrap;word-wrap:normal;text-decoration:none;text-overflow:ellipsis;-o-text-overflow:ellipsis;-webkit-transition:none;-o-transition:none;transition:none}.dropdown-toggle{cursor:pointer}.dropdown-header{white-space:nowrap}.open>.dropdown-container>.dropdown-menu,.open>.dropdown-container{display:block}.dropdown-toolbar{padding-top:6px;padding-left:20px;padding-right:20px;padding-bottom:5px;background-color:#fff;border-bottom:1px solid rgba(0,0,0,0.15);border-radius:4px 4px 0 0}.dropdown-toolbar>.form-group{margin:5px -10px}.dropdown-toolbar .dropdown-toolbar-actions{float:right}.dropdown-toolbar .dropdown-toolbar-title{margin:0;font-size:14px}.dropdown-footer{padding:5px 20px;border-top:1px solid #ccc;border-top:1px solid rgba(0,0,0,0.15);border-radius:0 0 4px 4px}.anchor-block small{display:none}@media (min-width:992px){.anchor-block small{display:block;font-weight:normal;color:#777777}.dropdown-menu>li>a.anchor-block{padding-top:6px;padding-bottom:6px}}@media (min-width:992px){.dropdown.hoverable:hover>ul{display:block}}.dropdown-position-topright{top:auto;right:0;bottom:100%;left:auto;margin-bottom:2px}.dropdown-position-topleft{top:auto;right:auto;bottom:100%;left:0;margin-bottom:2px}.dropdown-position-bottomright{right:0;left:auto}.dropmenu-item-label{white-space:nowrap}.dropmenu-item-content{position:absolute;text-align:right;max-width:60px;right:20px;color:#777777;overflow:hidden;white-space:nowrap;word-wrap:normal;-o-text-overflow:ellipsis;text-overflow:ellipsis}small.dropmenu-item-content{line-height:20px}.dropdown-menu>li>a.dropmenu-item{position:relative;padding-right:66px}.dropdown-submenu .dropmenu-item-content{right:40px}.dropdown-menu>li.dropdown-submenu>a.dropmenu-item{padding-right:86px}.dropdown-inverse .dropdown-menu{background-color:rgba(0,0,0,0.8);border:1px solid rgba(0,0,0,0.9)}.dropdown-inverse .dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#2b2b2b}.dropdown-inverse .dropdown-menu>li>a{color:#cccccc}.dropdown-inverse .dropdown-menu>li>a:hover,.dropdown-inverse .dropdown-menu>li>a:focus{color:#fff;background-color:#262626}.dropdown-inverse .dropdown-menu>.active>a,.dropdown-inverse .dropdown-menu>.active>a:hover,.dropdown-inverse .dropdown-menu>.active>a:focus{color:#fff;background-color:#337ab7}.dropdown-inverse .dropdown-menu>.disabled>a,.dropdown-inverse .dropdown-menu>.disabled>a:hover,.dropdown-inverse .dropdown-menu>.disabled>a:focus{color:#777777}.dropdown-inverse .dropdown-header{color:#777777}.table>thead>tr>th.col-actions{padding-top:0;padding-bottom:0}.table>thead>tr>th.col-actions .dropdown-toggle{color:#777777}.notifications{list-style:none;padding:0}.notification{display:block;padding:9.6px 12px;border-width:0 0 1px 0;border-style:solid;border-color:#eeeeee;background-color:#fff;color:#333333;text-decoration:none}.notification:last-child{border-bottom:0}.notification:hover,.notification.active:hover{background-color:#f9f9f9;border-color:#eeeeee}.notification.active{background-color:#f4f4f4}a.notification:hover{text-decoration:none}.notification-title{font-size:15px;margin-bottom:0}.notification-desc{margin-bottom:0}.notification-meta{color:#777777}.dropdown-notifications>.dropdown-container,.dropdown-notifications>.dropdown-menu{width:450px;max-width:450px}.dropdown-notifications .dropdown-menu{padding:0}.dropdown-notifications .dropdown-toolbar,.dropdown-notifications .dropdown-footer{padding:9.6px 12px}.dropdown-notifications .dropdown-toolbar{background:#fff}.dropdown-notifications .dropdown-footer{background:#eeeeee}.notification-icon{margin-right:6.8775px}.notification-icon:after{position:absolute;content:attr(data-count);margin-left:-6.8775px;margin-top:-6.8775px;padding:0 4px;min-width:13.755px;height:13.755px;line-height:13.755px;background:red;border-radius:10px;color:#fff;text-align:center;vertical-align:middle;font-size:11.004px;font-weight:600;font-family:Georgia, serif,"Helvetica Neue",Helvetica,Arial,sans-serif}.notification .media-body{padding-top:5.6px}.btn-lg .notification-icon:after{margin-left:-8.253px;margin-top:-8.253px;min-width:16.506px;height:16.506px;line-height:16.506px;font-size:13.755px}.btn-xs .notification-icon:after{content:'';margin-left:-4.1265px;margin-top:-2.06325px;min-width:6.25227273px;height:6.25227273px;line-height:6.25227273px;padding:0}.btn-xs .notification-icon{margin-right:3.43875px} \ No newline at end of file diff --git a/ui/images/bg.jpg b/ui/images/bg.jpg index c76664b..cc4437d 100644 Binary files a/ui/images/bg.jpg and b/ui/images/bg.jpg differ diff --git a/ui/index.html b/ui/index.html index e1368f1..347677f 100644 --- a/ui/index.html +++ b/ui/index.html @@ -1,99 +1,106 @@ - -
-