diff --git a/api/psqlserver/model/Food.py b/api/psqlserver/model/Food.py index 1c0fd723..c0cc1044 100644 --- a/api/psqlserver/model/Food.py +++ b/api/psqlserver/model/Food.py @@ -20,6 +20,7 @@ class FoodModel(BaseModel): discount_percent: int # Corrected data type to int food_url: str = None food_type_id: int = None + food_stock_quantity: int = None class DailyReport: @@ -47,11 +48,12 @@ def get_food_data(self): food_name=record[1], food_description=record[2], food_price=float(record[3]), - food_status=bool(record[4]), - food_rate=int(record[5]), - discount_percent=int(record[6]), - food_url=record[7], - food_type_id=record[8] + food_stock_quantity=int(record[4]), + food_status=bool(record[5]), + food_rate=int(record[6]), + discount_percent=int(record[7]), + food_url=record[8], + food_type_id=record[9] ) food_data.append(food.dict()) @@ -116,11 +118,12 @@ def search_food_by_name(self, food_name: str): food_name=record[1], food_description=record[2], food_price=float(record[3]), - food_status=bool(record[4]), - food_rate=int(record[5]), - discount_percent=int(record[6]), - food_url=record[7], - food_type_id=record[8] + food_stock_quantity=int(record[4]), + food_status=bool(record[5]), + food_rate=int(record[6]), + discount_percent=int(record[7]), + food_url=record[8], + food_type_id=record[9] ) food_data.append(food) print(food_data) @@ -258,6 +261,11 @@ def get_daily_sales(self): def wikipedia_summary(self, food_name: str): token = 'cwhc0nEvP6vBJCnYULFK5k-1qPGVgnt6KmCtEXv7pIZEMrnROoiRXYqwYUopCJMc1ubDEw.' bard = Bard(token=token) - content = bard.get_answer(f'{food_name} là gì trong ẩm thực. chỉ cần đưa ra thông tin, dưới 180 từ ?')['content'] + content = bard.get_answer(f'As a waiter of a restaurant, generate a description of {food_name} ' + 'in a non-scientific way. The description should be easy to understand for normal people. ' + 'The description must be written in Vietnamese with a language that is close to human language ' + 'as possible. Avoid descriptive and robotic descriptions. The description length must be limited ' + 'to 1 paragraph and must not exceed 30 words. Do not add recommendations in the last sentence.') + ['content'] return content \ No newline at end of file diff --git a/api/psqlserver/requirements.txt b/api/psqlserver/requirements.txt index 884e3671..c788bc57 100644 --- a/api/psqlserver/requirements.txt +++ b/api/psqlserver/requirements.txt @@ -5,4 +5,7 @@ fastapi protobuf==3.20 pymssql google-auth -Unidecode \ No newline at end of file +Unidecode +wikipedia +bardapi +pytz \ No newline at end of file diff --git a/init/full.sql b/init/full.sql index 1dfa95c0..0712ecea 100644 --- a/init/full.sql +++ b/init/full.sql @@ -52,7 +52,7 @@ GO use ffood; GO --- Create 14 tables +-- Create 16 tables create table FoodType ( food_type_id tinyint identity(1,1) not null primary key, food_type nvarchar(20) not null @@ -65,6 +65,7 @@ create table Food ( food_name nvarchar(500) not null, food_description nvarchar(2000) null, food_price money not null, + food_limit smallint not null, food_status bit not null, food_rate tinyint null, discount_percent tinyint not null, @@ -223,6 +224,22 @@ GO USE ffood GO +--Set status of food = 0 if limit = 0 +CREATE TRIGGER tr_UpdateFoodStatus +ON Food +AFTER UPDATE +AS +BEGIN + IF UPDATE(food_limit) + BEGIN + UPDATE Food + SET food_status = 0 + WHERE food_limit = 0; + END +END; + +GO + -- Inactivate food when delete CREATE TRIGGER tr_InactivateFood ON Food @@ -357,295 +374,295 @@ insert into FoodType (food_type) values (N'Đồ uống'); -- Ensure food_id starts from 1 dbcc checkident (Food, RESEED, 0); -- Noodle -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Phở', 40000, 1, 5, 0, 'https://www.allrecipes.com/thmb/SZjdgaXhmkrRNLoOvdxuAktwk3E=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/228443-authentic-pho-DDMFS-4x3-0523f6531ccf4dbeb4b5bde52e007b1e.jpg'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Bún bò Huế', 50000, 1, 5, 5, 'https://th.bing.com/th/id/OIP.SXfegdkWCvC_Hbc3A4eW4wHaE7?pid=ImgDet&rs=1'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Bún đậu mắm tôm', 45000, 1, 5, 0, 'https://img-global.cpcdn.com/recipes/2c630c584ca9709c/751x532cq70/bun-d%E1%BA%ADu-m%E1%BA%AFm-tom-recipe-main-photo.jpg'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Bún mắm', 40000, 0, 5, 30, 'https://th.bing.com/th/id/OIP.3p7EKLDnu_dS3comDM40oQHaE0?pid=ImgDet&rs=1'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Bún riêu', 40000, 1, 5, 0, 'https://th.bing.com/th/id/R.e41d43c5534281e211ae9a708a2b5517?rik=eec%2bt0%2fAUqttcQ&riu=http%3a%2f%2fseonkyounglongest.com%2fwp-content%2fuploads%2f2018%2f06%2fBun-Rieu-07.jpg&ehk=0iemq%2bdo28ouF67dFC5dFQTUvo%2biGdgK7hx4tsn%2bv%2bc%3d&risl=&pid=ImgRaw&r=0'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Bún thịt nướng', 35000, 1, 5, 5, 'https://th.bing.com/th/id/R.dd5289abf81592cb720dedc3bf6a598a?rik=L6zDZI0S1g2QyA&pid=ImgRaw&r=0'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Mì quảng', 50000, 1, 5, 0, 'https://beptruong.edu.vn/wp-content/uploads/2022/10/mi-quang-chay-voi-vi-thanh-dam.jpg'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Ramen', 63000, 0, 5, 0, 'https://www.justonecookbook.com/wp-content/uploads/2023/04/Spicy-Shoyu-Ramen-8055-I.jpg'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Hủ Tiếu', 37000, 1, 5, 10, 'https://vcdn1-giadinh.vnecdn.net/2023/05/15/Bc8Thnhphm18-1684125639-9811-1684125654.jpg?w=1200&h=0&q=100&dpr=1&fit=crop&s=i0OuvKxyIvG-1BRluganjQ'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Ravioli', 30000, 1, 5, 15, 'https://cdn11.bigcommerce.com/s-cjh14ahqln/product_images/uploaded_images/cheese-ravioli-2-web.jpg'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Spaghetti Bolognese', 58000, 1, 5, 15, 'https://supervalu.ie/image/var/files/real-food/recipes/Uploaded-2020/spaghetti-bolognese-recipe.jpg'); -insert into Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -values (1, N'Spaghetti Carbonara', 60000, 0, 5, 5, 'https://static01.nyt.com/images/2021/02/14/dining/carbonara-horizontal/carbonara-horizontal-threeByTwoMediumAt2X-v2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Phở', 40000, 100, 1, 5, 0, 'https://www.allrecipes.com/thmb/SZjdgaXhmkrRNLoOvdxuAktwk3E=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/228443-authentic-pho-DDMFS-4x3-0523f6531ccf4dbeb4b5bde52e007b1e.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Bún bò Huế', 50000, 40, 1, 5, 5, 'https://th.bing.com/th/id/OIP.SXfegdkWCvC_Hbc3A4eW4wHaE7?pid=ImgDet&rs=1'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Bún đậu mắm tôm', 45000, 50, 1, 5, 0, 'https://img-global.cpcdn.com/recipes/2c630c584ca9709c/751x532cq70/bun-d%E1%BA%ADu-m%E1%BA%AFm-tom-recipe-main-photo.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Bún mắm', 40000,70, 0, 5, 30, 'https://th.bing.com/th/id/OIP.3p7EKLDnu_dS3comDM40oQHaE0?pid=ImgDet&rs=1'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Bún riêu', 40000, 30, 1, 5, 0, 'https://th.bing.com/th/id/R.e41d43c5534281e211ae9a708a2b5517?rik=eec%2bt0%2fAUqttcQ&riu=http%3a%2f%2fseonkyounglongest.com%2fwp-content%2fuploads%2f2018%2f06%2fBun-Rieu-07.jpg&ehk=0iemq%2bdo28ouF67dFC5dFQTUvo%2biGdgK7hx4tsn%2bv%2bc%3d&risl=&pid=ImgRaw&r=0'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Bún thịt nướng', 35000, 50, 1, 5, 5, 'https://th.bing.com/th/id/R.dd5289abf81592cb720dedc3bf6a598a?rik=L6zDZI0S1g2QyA&pid=ImgRaw&r=0'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Mì quảng', 50000, 20, 1, 5, 0, 'https://beptruong.edu.vn/wp-content/uploads/2022/10/mi-quang-chay-voi-vi-thanh-dam.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Ramen', 63000, 100, 0, 5, 0, 'https://www.justonecookbook.com/wp-content/uploads/2023/04/Spicy-Shoyu-Ramen-8055-I.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Hủ Tiếu', 38000, 30, 1, 5, 10, 'https://vcdn1-giadinh.vnecdn.net/2023/05/15/Bc8Thnhphm18-1684125639-9811-1684125654.jpg?w=1200&h=0&q=100&dpr=1&fit=crop&s=i0OuvKxyIvG-1BRluganjQ'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Ravioli', 30000, 40, 1, 5, 15, 'https://cdn11.bigcommerce.com/s-cjh14ahqln/product_images/uploaded_images/cheese-ravioli-2-web.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Spaghetti Bolognese', 58000, 30, 1, 5, 15, 'https://supervalu.ie/image/var/files/real-food/recipes/Uploaded-2020/spaghetti-bolognese-recipe.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (1, N'Spaghetti Carbonara', 60000, 20, 0, 5, 5, 'https://static01.nyt.com/images/2021/02/14/dining/carbonara-horizontal/carbonara-horizontal-threeByTwoMediumAt2X-v2.jpg'); -- Banh - Banh Mi -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh bèo', 25000, 1, 5, 10, 'https://static.vinwonders.com/production/banh-beo-nha-trang-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh bột lọc', 25000, 1, 5, 0, 'https://th.bing.com/th/id/OIP.1W7a0ykWZ0Sk8ohsGHZk0QHaE8?pid=ImgDet&rs=1'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh căn', 35000, 1, 5, 15, 'https://cdn.vatgia.com/pictures/thumb/0x0/2021/03/1616756570-lwn.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh canh', 34000, 1, 5, 0, 'https://th.bing.com/th/id/OIG.UJ7hyP4iO5Y6Cqo7lU5N?pid=ImgGn'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh chưng', 40000, 0, 5, 20, 'https://www.cet.edu.vn/wp-content/uploads/2020/01/banh-chung.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh cuốn', 20000, 1, 5, 0, 'https://i.ytimg.com/vi/vR18wfdLtJE/maxresdefault.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh đúc', 34000, 1, 5, 5, 'https://i.ytimg.com/vi/-he2nZsGghA/maxresdefault.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh giò', 38000, 1, 5, 0, 'https://th.bing.com/th/id/R.b63b36f87a42ca49b9c3cf9cdbb98dd6?rik=W7iOEdgJi7vMhA&pid=ImgRaw&r=0'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh khọt', 40000, 0, 5, 30, 'https://th.bing.com/th/id/R.3710363219d01194ae36bb770a07ad3f?rik=L2f9%2bVTEPN9j9w&riu=http%3a%2f%2ffoodisafourletterword.com%2fwp-content%2fuploads%2f2020%2f12%2fVietnamese_Crispy_Savory_Shrimp_Pancakes_Recipe_Banh_Khot_top.jpg&ehk=XCD8GsPPzpMrhvD6HySuocNVMJ4fXCObJXtrs7Bde0c%3d&risl=&pid=ImgRaw&r=0'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh mì', 20000, 1, 5, 0, 'https://th.bing.com/th/id/R.9bd3f3d87a4571fe7a6300f26941058b?rik=ZmuwBpVNPPYIwQ&pid=ImgRaw&r=0'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh pía', 60000, 1, 5, 0, 'https://media.urbanistnetwork.com/saigoneer/article-images/2018/09/Sep17/lapia/BanhPia1b.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh tét', 66000, 1, 5, 15, 'https://img4.thuthuatphanmem.vn/uploads/2019/12/16/anh-dep-nhat-ve-banh-chung-truyen-thong-cua-nguoi-dan-toc_023616788.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh tráng nướng', 15000, 1, 5, 0, 'https://bizweb.dktcdn.net/100/393/897/files/banh-trang-nuong-bao-nhieu-calo.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Bánh xèo', 30000, 0, 5, 0, 'https://th.bing.com/th/id/R.517c2ff96732c3950f8e95a673c01f09?rik=%2fqn6R%2fZgswIjyg&pid=ImgRaw&r=0'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Carrot Cake', 48000, 1, 5, 20, 'https://images.squarespace-cdn.com/content/v1/5d7a597d2459d4207ae1a00a/1575826400580-43ATBE70CA4J66XS53T7/carrot_cake-3.jpg?format=1000w'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'French Toast', 45000, 1, 5, 0, 'https://www.simplyrecipes.com/thmb/b48moNCTtaUYEc1Qyxhe9V66XKc=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Simply-Recipes-French-Toast-Lead-Shot-3b-c3a68a576a9548f5bd43cce3d2d7f4b7.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Garlic Bread', 58000, 1, 5, 15, 'https://www.sorrentina.in/cdn/shop/articles/Garlic_Bread.webp?v=1684226216'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Lasagna', 45000, 1, 5, 0, 'https://static01.nyt.com/images/2023/08/31/multimedia/RS-Lasagna-hkjl/RS-Lasagna-hkjl-superJumbo.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Pancakes', 40000, 1, 5, 0, 'https://www.allrecipes.com/thmb/WqWggh6NwG-r8PoeA3OfW908FUY=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/21014-Good-old-Fashioned-Pancakes-mfs_001-1fa26bcdedc345f182537d95b6cf92d8.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Panna Cotta', 25000, 0, 5, 20, 'https://biancazapatka.com/wp-content/uploads/2022/12/panna-cotta-720x1008.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Red Velvet Cake', 44000, 1, 5, 0, 'https://www.allrecipes.com/thmb/gDJ1S6ETLfWGyyWw_4A_IGhvDYE=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/9295_red-velvet-cake_ddmfs_4x3_1129-a8ab17b825e3464a9a53ceeda54ff461.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (2, N'Strawberry Shortcake', 70000, 1, 5, 5, 'https://th.bing.com/th/id/OIG.3zJBFoevyz04wpkIIDZx?pid=ImgGn'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh bèo', 25000, 50, 1, 5, 10, 'https://static.vinwonders.com/production/banh-beo-nha-trang-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh bột lọc', 25000, 30, 1, 5, 0, 'https://th.bing.com/th/id/OIP.1W7a0ykWZ0Sk8ohsGHZk0QHaE8?pid=ImgDet&rs=1'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh căn', 35000, 30, 1, 5, 15, 'https://cdn.vatgia.com/pictures/thumb/0x0/2021/03/1616756570-lwn.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh canh', 34000, 30, 1, 5, 0, 'https://th.bing.com/th/id/OIG.UJ7hyP4iO5Y6Cqo7lU5N?pid=ImgGn'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh chưng', 40000, 10, 0, 5, 20, 'https://www.cet.edu.vn/wp-content/uploads/2020/01/banh-chung.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh cuốn', 20000, 20, 1, 5, 0, 'https://i.ytimg.com/vi/vR18wfdLtJE/maxresdefault.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh đúc', 34000, 10, 1, 5, 5, 'https://i.ytimg.com/vi/-he2nZsGghA/maxresdefault.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh giò', 38000, 20, 1, 5, 0, 'https://th.bing.com/th/id/R.b63b36f87a42ca49b9c3cf9cdbb98dd6?rik=W7iOEdgJi7vMhA&pid=ImgRaw&r=0'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh khọt', 40000, 0, 0, 5, 30, 'https://th.bing.com/th/id/R.3710363219d01194ae36bb770a07ad3f?rik=L2f9%2bVTEPN9j9w&riu=http%3a%2f%2ffoodisafourletterword.com%2fwp-content%2fuploads%2f2020%2f12%2fVietnamese_Crispy_Savory_Shrimp_Pancakes_Recipe_Banh_Khot_top.jpg&ehk=XCD8GsPPzpMrhvD6HySuocNVMJ4fXCObJXtrs7Bde0c%3d&risl=&pid=ImgRaw&r=0'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh mì', 20000, 30, 1, 5, 0, 'https://th.bing.com/th/id/R.9bd3f3d87a4571fe7a6300f26941058b?rik=ZmuwBpVNPPYIwQ&pid=ImgRaw&r=0'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh pía', 60000, 20, 1, 5, 0, 'https://media.urbanistnetwork.com/saigoneer/article-images/2018/09/Sep17/lapia/BanhPia1b.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh tét', 66000, 10, 1, 5, 15, 'https://img4.thuthuatphanmem.vn/uploads/2019/12/16/anh-dep-nhat-ve-banh-chung-truyen-thong-cua-nguoi-dan-toc_023616788.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh tráng nướng', 15000, 20, 1, 5, 0, 'https://bizweb.dktcdn.net/100/393/897/files/banh-trang-nuong-bao-nhieu-calo.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Bánh xèo', 30000, 30, 0, 5, 0, 'https://th.bing.com/th/id/R.517c2ff96732c3950f8e95a673c01f09?rik=%2fqn6R%2fZgswIjyg&pid=ImgRaw&r=0'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Carrot Cake', 48000, 20, 1, 5, 20, 'https://images.squarespace-cdn.com/content/v1/5d7a597d2459d4207ae1a00a/1575826400580-43ATBE70CA4J66XS53T7/carrot_cake-3.jpg?format=1000w'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'French Toast', 45000, 40, 1, 5, 0, 'https://www.simplyrecipes.com/thmb/b48moNCTtaUYEc1Qyxhe9V66XKc=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Simply-Recipes-French-Toast-Lead-Shot-3b-c3a68a576a9548f5bd43cce3d2d7f4b7.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Garlic Bread', 58000, 30, 1, 5, 15, 'https://www.sorrentina.in/cdn/shop/articles/Garlic_Bread.webp?v=1684226216'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Lasagna', 45000, 30, 1, 5, 0, 'https://static01.nyt.com/images/2023/08/31/multimedia/RS-Lasagna-hkjl/RS-Lasagna-hkjl-superJumbo.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Pancakes', 40000, 20, 1, 5, 0, 'https://www.allrecipes.com/thmb/WqWggh6NwG-r8PoeA3OfW908FUY=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/21014-Good-old-Fashioned-Pancakes-mfs_001-1fa26bcdedc345f182537d95b6cf92d8.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Panna Cotta', 25000, 35, 0, 5, 20, 'https://biancazapatka.com/wp-content/uploads/2022/12/panna-cotta-720x1008.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Red Velvet Cake', 44000, 20, 1, 5, 0, 'https://www.allrecipes.com/thmb/gDJ1S6ETLfWGyyWw_4A_IGhvDYE=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/9295_red-velvet-cake_ddmfs_4x3_1129-a8ab17b825e3464a9a53ceeda54ff461.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (2, N'Strawberry Shortcake', 70000, 28, 1, 5, 5, 'https://th.bing.com/th/id/OIG.3zJBFoevyz04wpkIIDZx?pid=ImgGn'); -- Sea Food -- Chèn các món ăn vào cơ sở dữ liệu với giá ngẫu nhiên tương ứng với thị trường ở Việt Nam -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Cá kho tộ', 80000, 1, 5, 0, 'https://bepmina.vn/wp-content/uploads/2023/07/cach-lam-ca-ba-sa-kho-to.jpeg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Sashimi', 120000, 1, 5, 0, 'https://images.immediate.co.uk/production/volatile/sites/30/2020/02/sashimi-c123df7.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Scallops', 150000, 0, 5, 15, 'https://www.onceuponachef.com/images/2022/03/how-to-cook-scallops-2-scaled.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Seaweed Salad', 50000, 1, 5, 20, 'https://valuemartgrocery.com/cdn/shop/products/Seaweed-Salad-Reshoot-6-scaledsquare_1024x1024.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Shrimp and Grits', 90000, 1, 5, 0, 'https://www.bowlofdelicious.com/wp-content/uploads/2018/08/Easy-Classic-Shrimp-and-Grits-square.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Lobster Bisque', 130000, 0, 5, 0, 'https://cafedelites.com/wp-content/uploads/2020/02/Lobster-Bisque-IMAGE-1jpg.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Lobster Roll Sandwich', 140000, 1, 5, 30, 'https://www.eatingwell.com/thmb/ZrNy9pvrIiCo_PVC5G6EH-jlP28=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/lobster-roll-ck-226594-4x3-1-b3aea3b5cd3e46b6820e2ca6a5c7b310.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Ceviche', 70000, 1, 5, 0, 'https://hips.hearstapps.com/hmg-prod/images/ceviche-index-64887642e188d.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Crab Cakes', 100000, 1, 5, 20, 'https://hips.hearstapps.com/hmg-prod/images/crab-cakes-index-64e7cee7d4dda.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Grilled Salmon', 110000, 0, 5, 0, 'https://www.acouplecooks.com/wp-content/uploads/2020/05/Grilled-Salmon-015-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Mussels', 60000, 1, 5, 0, 'https://www.healthyseasonalrecipes.com/wp-content/uploads/2023/01/simple-steamed-mussels-with-garlic-sq-041.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Oysters', 90000, 1, 5, 0, 'https://static.emerils.com/grilled%20oysters.jpeg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (3, N'Tuna Tartare', 120000, 1, 5, 15, 'https://pinchandswirl.com/wp-content/uploads/2022/12/Tuna-Tartare-sq.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Cá kho tộ', 80000, 10, 1, 5, 0, 'https://bepmina.vn/wp-content/uploads/2023/07/cach-lam-ca-ba-sa-kho-to.jpeg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Sashimi', 120000, 20, 1, 5, 0, 'https://images.immediate.co.uk/production/volatile/sites/30/2020/02/sashimi-c123df7.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Scallops', 150000, 10, 0, 5, 15, 'https://www.onceuponachef.com/images/2022/03/how-to-cook-scallops-2-scaled.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Seaweed Salad', 50000, 20, 1, 5, 20, 'https://valuemartgrocery.com/cdn/shop/products/Seaweed-Salad-Reshoot-6-scaledsquare_1024x1024.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Shrimp and Grits', 90000, 30, 1, 5, 0, 'https://www.bowlofdelicious.com/wp-content/uploads/2018/08/Easy-Classic-Shrimp-and-Grits-square.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Lobster Bisque', 130000, 5, 0, 5, 0, 'https://cafedelites.com/wp-content/uploads/2020/02/Lobster-Bisque-IMAGE-1jpg.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Lobster Roll Sandwich', 140000, 20, 1, 5, 30, 'https://www.eatingwell.com/thmb/ZrNy9pvrIiCo_PVC5G6EH-jlP28=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/lobster-roll-ck-226594-4x3-1-b3aea3b5cd3e46b6820e2ca6a5c7b310.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Ceviche', 70000, 20, 1, 5, 0, 'https://hips.hearstapps.com/hmg-prod/images/ceviche-index-64887642e188d.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Crab Cakes', 100000, 30, 1, 5, 20, 'https://hips.hearstapps.com/hmg-prod/images/crab-cakes-index-64e7cee7d4dda.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Grilled Salmon', 110000, 3, 0, 5, 0, 'https://www.acouplecooks.com/wp-content/uploads/2020/05/Grilled-Salmon-015-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Mussels', 60000, 20, 1, 5, 0, 'https://www.healthyseasonalrecipes.com/wp-content/uploads/2023/01/simple-steamed-mussels-with-garlic-sq-041.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Oysters', 90000, 50, 1, 5, 0, 'https://static.emerils.com/grilled%20oysters.jpeg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (3, N'Tuna Tartare', 120000, 30, 1, 5, 15, 'https://pinchandswirl.com/wp-content/uploads/2022/12/Tuna-Tartare-sq.jpg'); -- Mon an truyen thong -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Cao lầu', 55000, 1, 5, 0, 'https://img-global.cpcdn.com/recipes/2940d93145814c54/680x482cq70/cao-l%E1%BA%A7u-h%E1%BB%99i-an-fake-recipe-main-photo.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Cháo lòng', 40000, 0, 5, 20, 'https://diadiemlongkhanh.cdn.vccloud.vn/static/images/2022/06/08/ee1023df-7261-4b67-b939-9aef34e0d33e-image.jpeg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Com tấm', 30000, 1, 5, 0, 'https://i.ytimg.com/vi/6luZIIX5yCM/maxresdefault.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Gỏi cuốn', 35000, 1, 5, 15, 'https://www.cet.edu.vn/wp-content/uploads/2018/11/goi-cuon-tom-thit.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Nem chua', 25000, 1, 5, 0, 'https://statics.vinpearl.com/nem-chua-1_1628326267.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Xôi xéo', 20000, 1, 5, 30, 'https://statics.vinpearl.com/xoi-xeo-01%20(2)_1632322118.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (4, N'Canh Chua', 35000, 1, 5, 20, 'https://i-giadinh.vnecdn.net/2023/04/25/Thanh-pham-1-1-7239-1682395675.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Cao lầu', 55000, 20, 1, 5, 0, 'https://img-global.cpcdn.com/recipes/2940d93145814c54/680x482cq70/cao-l%E1%BA%A7u-h%E1%BB%99i-an-fake-recipe-main-photo.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Cháo lòng', 40000, 15, 0, 5, 20, 'https://diadiemlongkhanh.cdn.vccloud.vn/static/images/2022/06/08/ee1023df-7261-4b67-b939-9aef34e0d33e-image.jpeg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Com tấm', 30000, 50, 1, 5, 0, 'https://i.ytimg.com/vi/6luZIIX5yCM/maxresdefault.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Gỏi cuốn', 35000, 30, 1, 5, 15, 'https://www.cet.edu.vn/wp-content/uploads/2018/11/goi-cuon-tom-thit.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Nem chua', 25000, 20, 1, 5, 0, 'https://statics.vinpearl.com/nem-chua-1_1628326267.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Xôi xéo', 20000, 30, 1, 5, 30, 'https://statics.vinpearl.com/xoi-xeo-01%20(2)_1632322118.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (4, N'Canh Chua', 35000, 10, 1, 5, 20, 'https://i-giadinh.vnecdn.net/2023/04/25/Thanh-pham-1-1-7239-1682395675.jpg'); -- Mon an chau a -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Pad Thai', 60000, 1, 5, 15, 'https://static01.nyt.com/images/2022/03/23/dining/17padthairex1/merlin_203116326_32624565-ffae-482d-9a55-043cf31afb0b-mediumSquareAt3X.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Takoyaki', 55000, 0, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Takoyaki.jpg/640px-Takoyaki.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Bibimbap', 65000, 1, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/4/44/Dolsot-bibimbap.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Breakfast Burrito', 50000, 1, 5, 5, 'https://hips.hearstapps.com/hmg-prod/images/delish-breakfast-burrito-horizontaljpg-1541624805.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Chicken Curry', 70000, 1, 5, 0, 'https://www.foodandwine.com/thmb/8YAIANQTZnGpVWj2XgY0dYH1V4I=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/spicy-chicken-curry-FT-RECIPE0321-58f84fdf7b484e7f86894203eb7834e7.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Fried Rice', 48000, 1, 5, 30, 'https://www.seriouseats.com/thmb/BJjCEDw9OZe95hpZxmNcD3rJnHo=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/20230529-SEA-EggFriedRice-AmandaSuarez-hero-c8d95fbf69314b318bc279159f582882.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Gyoza', 55000, 1, 5, 0, 'https://assets.epicurious.com/photos/628ba0d3fa016bab2139efa2/1:1/w_4546'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Peking Duck', 90000, 1, 5, 15, 'https://cdn.i-scmp.com/sites/default/files/images/methode/2018/11/21/b681f60a-eca4-11e8-b0fe-c62dccd2d711_image_hires_192253.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Samosa', 35000, 0, 5, 0, 'https://www.indianhealthyrecipes.com/wp-content/uploads/2021/12/samosa-recipe.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Spring Rolls', 38000, 1, 5, 15, 'https://jackpurcellmeats.com.au/wp-content/uploads/2017/07/spring-rolls-01.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (5, N'Sushi', 70000, 1, 5, 0, 'https://media.post.rvohealth.io/wp-content/uploads/2021/09/sushi-sashimi-732x549-thumbnail-732x549.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Pad Thai', 60000, 30, 1, 5, 15, 'https://static01.nyt.com/images/2022/03/23/dining/17padthairex1/merlin_203116326_32624565-ffae-482d-9a55-043cf31afb0b-mediumSquareAt3X.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Takoyaki', 55000, 28, 0, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Takoyaki.jpg/640px-Takoyaki.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Bibimbap', 65000, 35, 1, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/4/44/Dolsot-bibimbap.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Breakfast Burrito', 50000, 20, 1, 5, 5, 'https://hips.hearstapps.com/hmg-prod/images/delish-breakfast-burrito-horizontaljpg-1541624805.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Chicken Curry', 70000, 30, 1, 5, 0, 'https://www.foodandwine.com/thmb/8YAIANQTZnGpVWj2XgY0dYH1V4I=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/spicy-chicken-curry-FT-RECIPE0321-58f84fdf7b484e7f86894203eb7834e7.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Fried Rice', 48000, 35, 1, 5, 30, 'https://www.seriouseats.com/thmb/BJjCEDw9OZe95hpZxmNcD3rJnHo=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/20230529-SEA-EggFriedRice-AmandaSuarez-hero-c8d95fbf69314b318bc279159f582882.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Gyoza', 55000, 30, 1, 5, 0, 'https://assets.epicurious.com/photos/628ba0d3fa016bab2139efa2/1:1/w_4546'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Peking Duck', 90000, 10, 1, 5, 15, 'https://cdn.i-scmp.com/sites/default/files/images/methode/2018/11/21/b681f60a-eca4-11e8-b0fe-c62dccd2d711_image_hires_192253.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Samosa', 35000, 3, 0, 5, 0, 'https://www.indianhealthyrecipes.com/wp-content/uploads/2021/12/samosa-recipe.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Spring Rolls', 38000, 30, 1, 5, 15, 'https://jackpurcellmeats.com.au/wp-content/uploads/2017/07/spring-rolls-01.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (5, N'Sushi', 70000, 25, 1, 5, 0, 'https://media.post.rvohealth.io/wp-content/uploads/2021/09/sushi-sashimi-732x549-thumbnail-732x549.jpg'); -- Mon Thit -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Beef Carpaccio', 65000, 1, 5, 5, 'https://www.seriouseats.com/thmb/VgVaMsNZog6fWU79Ottu-iw3CLc=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/SEA-italian-easy-beef-carpaccio-recipe-hero-01-e4153bc58c19429085be0e525888a37a.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Beef Tartare', 70000, 1, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/d/db/Classic_steak_tartare.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Chicken Quesadilla', 48000, 1, 5, 15, 'https://hips.hearstapps.com/hmg-prod/images/chicken-quesadilla-index-64515c8e98e28.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Chicken Wings', 55000, 0, 5, 0, 'https://images.immediate.co.uk/production/volatile/sites/30/2020/12/Air-Fryer-Chicken-Wings-d2c6fa4.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Pork Chop', 60000, 1, 5, 20, 'https://hips.hearstapps.com/del.h-cdn.co/assets/18/11/1600x1200/sd-aspect-1520972774-pork-chops-horizontal.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Prime Rib', 80000, 1, 5, 0, 'https://www.kingsford.com/wp-content/uploads/2023/05/PrimeRib-8_cc1_00000000_72-Desktop.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Pulled Pork Sandwich', 55000, 1, 5, 30, 'https://www.simplyrecipes.com/thmb/xl-Bn-Y1HByU2ZfYZlaoHRVm0MQ=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Simply-Recipes-Pulled-Pork-Sandwich-Lead-3b_vertical-94ec18fb8f264514b09a408359f5d7e8.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Steak', 70000, 1, 5, 0, 'https://www.skinnytaste.com/wp-content/uploads/2022/03/Air-Fryer-Steak-6.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Baby Back Ribs', 75000, 1, 5, 10, 'https://www.southernliving.com/thmb/sQ3jAjFAP-SPt_upe-Im4rxMKrQ=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/oven-baked-baby-back-ribs-beauty-332_preview-34579f7f15ed4548ae3bb5b2048aab60.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (6, N'Filet Mignon', 90000, 1, 5, 15, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2023/02/Filet-Mignon-main.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Beef Carpaccio', 65000, 25, 1, 5, 5, 'https://www.seriouseats.com/thmb/VgVaMsNZog6fWU79Ottu-iw3CLc=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/SEA-italian-easy-beef-carpaccio-recipe-hero-01-e4153bc58c19429085be0e525888a37a.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Beef Tartare', 70000, 20, 1, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/d/db/Classic_steak_tartare.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Chicken Quesadilla', 48000, 30, 1, 5, 15, 'https://hips.hearstapps.com/hmg-prod/images/chicken-quesadilla-index-64515c8e98e28.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Chicken Wings', 55000, 5, 1, 5, 0, 'https://images.immediate.co.uk/production/volatile/sites/30/2020/12/Air-Fryer-Chicken-Wings-d2c6fa4.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Pork Chop', 60000, 20, 1, 5, 20, 'https://hips.hearstapps.com/del.h-cdn.co/assets/18/11/1600x1200/sd-aspect-1520972774-pork-chops-horizontal.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Prime Rib', 80000, 30, 1, 5, 0, 'https://www.kingsford.com/wp-content/uploads/2023/05/PrimeRib-8_cc1_00000000_72-Desktop.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Pulled Pork Sandwich', 55000, 20, 1, 5, 30, 'https://www.simplyrecipes.com/thmb/xl-Bn-Y1HByU2ZfYZlaoHRVm0MQ=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Simply-Recipes-Pulled-Pork-Sandwich-Lead-3b_vertical-94ec18fb8f264514b09a408359f5d7e8.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Steak', 70000, 15, 1, 5, 0, 'https://www.skinnytaste.com/wp-content/uploads/2022/03/Air-Fryer-Steak-6.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Baby Back Ribs', 75000, 20, 1, 5, 10, 'https://www.southernliving.com/thmb/sQ3jAjFAP-SPt_upe-Im4rxMKrQ=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/oven-baked-baby-back-ribs-beauty-332_preview-34579f7f15ed4548ae3bb5b2048aab60.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (6, N'Filet Mignon', 90000, 20, 1, 5, 15, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2023/02/Filet-Mignon-main.jpg'); -- Mon an nhanh -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'French Fries', 25000, 1, 5, 10, 'https://static.toiimg.com/thumb/54659021.cms?imgsize=275086&width=800&height=800'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Hot Dog', 30000, 1, 5, 0, 'https://i.redd.it/uke6xn3ji5071.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Nachos', 35000, 1, 5, 0, 'https://www.simplyrecipes.com/thmb/xTCx1mKCjjPYgGasys_JGafuem0=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/__opt__aboutcom__coeus__resources__content_migration__simply_recipes__uploads__2019__04__Nachos-LEAD-3-e6dd6cbb61474c9889e1524b3796601e.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Pizza', 40000, 1, 5, 15, 'https://www.allrecipes.com/thmb/fFW1o307WSqFFYQ3-QXYVpnFj6E=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/48727-Mikes-homemade-pizza-DDMFS-beauty-4x3-BG-2974-a7a9842c14e34ca699f3b7d7143256cf.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Dumplings', 35000, 1, 5, 0, 'https://www.bhg.com/thmb/eQgTJ-Bl7DUSNIVQvfntHP3ZVOM=/2000x0/filters:no_upscale():strip_icc()/bhg-pork-and-shitake-steamed-dumplings-FmOg5-5J4gv94CccQYTVph-0ef0a4a8987244759154f9e5e1b1819e.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Fish and Chips', 45000, 1, 5, 5, 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Fish_and_chips_blackpool.jpg/800px-Fish_and_chips_blackpool.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Fried Calamari', 38000, 1, 5, 0, 'https://www.seriouseats.com/thmb/RLHQFr_lp9-HTIWBikzVwu4M17s=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/__opt__aboutcom__coeus__resources__content_migration__serious_eats__seriouseats.com__2020__11__20201125-fried-calamari-vicky-wasik-10-9cee3a081e96476b89e29b331d30be61.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Gnocchi', 32000, 0, 5, 0, 'https://www.marthastewart.com/thmb/AdbLwcdFLpcsvW1bah2OuLij55o=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/336461-gnocchi-with-tomato-sauce-hero-04-1fe29843b76a4f0ab2ebc226de2723a0.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Hamburger', 30000, 1, 5, 10, 'https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/M6HASPARCZHYNN4XTUYT7H6PTE.jpg&w=1440'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Huevos Rancheros', 35000, 1, 5, 0, 'https://i0.wp.com/www.aspicyperspective.com/wp-content/uploads/2018/04/best-huevos-rancheros-recipe-25.jpg?resize=800%2C675&ssl=1'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (7, N'Tacos', 38000, 1, 5, 15, 'https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/001_Tacos_de_carnitas%2C_carne_asada_y_al_pastor.jpg/1200px-001_Tacos_de_carnitas%2C_carne_asada_y_al_pastor.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'French Fries', 25000, 30, 1, 5, 10, 'https://static.toiimg.com/thumb/54659021.cms?imgsize=275086&width=800&height=800'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Hot Dog', 30000, 20, 1, 5, 0, 'https://i.redd.it/uke6xn3ji5071.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Nachos', 35000, 30, 1, 5, 0, 'https://www.simplyrecipes.com/thmb/xTCx1mKCjjPYgGasys_JGafuem0=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/__opt__aboutcom__coeus__resources__content_migration__simply_recipes__uploads__2019__04__Nachos-LEAD-3-e6dd6cbb61474c9889e1524b3796601e.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Pizza', 40000, 30, 1, 5, 15, 'https://www.allrecipes.com/thmb/fFW1o307WSqFFYQ3-QXYVpnFj6E=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/48727-Mikes-homemade-pizza-DDMFS-beauty-4x3-BG-2974-a7a9842c14e34ca699f3b7d7143256cf.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Dumplings', 35000, 20, 1, 5, 0, 'https://www.bhg.com/thmb/eQgTJ-Bl7DUSNIVQvfntHP3ZVOM=/2000x0/filters:no_upscale():strip_icc()/bhg-pork-and-shitake-steamed-dumplings-FmOg5-5J4gv94CccQYTVph-0ef0a4a8987244759154f9e5e1b1819e.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Fish and Chips', 45000, 30, 1, 5, 5, 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Fish_and_chips_blackpool.jpg/800px-Fish_and_chips_blackpool.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Fried Calamari', 38000, 20, 1, 5, 0, 'https://www.seriouseats.com/thmb/RLHQFr_lp9-HTIWBikzVwu4M17s=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/__opt__aboutcom__coeus__resources__content_migration__serious_eats__seriouseats.com__2020__11__20201125-fried-calamari-vicky-wasik-10-9cee3a081e96476b89e29b331d30be61.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Gnocchi', 32000, 3, 0, 5, 0, 'https://www.marthastewart.com/thmb/AdbLwcdFLpcsvW1bah2OuLij55o=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/336461-gnocchi-with-tomato-sauce-hero-04-1fe29843b76a4f0ab2ebc226de2723a0.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Hamburger', 30000, 20, 1, 5, 10, 'https://www.washingtonpost.com/wp-apps/imrs.php?src=https://arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/M6HASPARCZHYNN4XTUYT7H6PTE.jpg&w=1440'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Huevos Rancheros', 35000, 30, 1, 5, 0, 'https://i0.wp.com/www.aspicyperspective.com/wp-content/uploads/2018/04/best-huevos-rancheros-recipe-25.jpg?resize=800%2C675&ssl=1'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (7, N'Tacos', 38000, 50, 1, 5, 15, 'https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/001_Tacos_de_carnitas%2C_carne_asada_y_al_pastor.jpg/1200px-001_Tacos_de_carnitas%2C_carne_asada_y_al_pastor.jpg'); -- Mon an nhe -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Caprese Salad', 35000, 1, 5, 0, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2019/07/Caprese-Salad-main-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Greek Salad', 32000, 1, 5, 10, 'https://cdn.loveandlemons.com/wp-content/uploads/2019/07/greek-salad-2.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Guacamole', 28000, 1, 5, 0, 'https://www.giallozafferano.com/images/255-25549/Guacamole_1200x800.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Hummus', 25000, 0, 5, 0, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2022/08/Hummus-main-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Caesar Salad', 30000, 1, 5, 10, 'https://cdn.loveandlemons.com/wp-content/uploads/2019/12/caesar-salad-recipe.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Risotto', 38000, 1, 5, 0, 'https://www.allrecipes.com/thmb/854efwMYEwilYjKr0FiF4FkwBvM=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/85389-gourmet-mushroom-risotto-DDMFS-4x3-a8a80a8deb064c6a8f15452b808a0258.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Omelette', 26000, 1, 5, 0, 'https://realfood.tesco.com/media/images/1400x919-Tesco-5For15-13273-RainbowOmelette-b3f0c3cc-2f15-40a7-98b1-07af0609f99e-0-1400x919.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Onion Rings', 22000, 1, 5, 15, 'https://th.bing.com/th/id/OIG.tUsUxbWy2qtAgqLtbaxx?pid=ImgGn'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Poutine', 25000, 1, 5, 0, 'https://www.seasonsandsuppers.ca/wp-content/uploads/2014/01/new-poutine-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Club Sandwich', 35000, 1, 5, 0, 'https://www.foodandwine.com/thmb/tM060YA0Fd0UALCmPQ-5gGWyBqA=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Classic-Club-Sandwich-FT-RECIPE0523-99327c9c87214026b9419b949ee13a9c.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Beet Salad', 28000, 1, 5, 5, 'https://cdn.loveandlemons.com/wp-content/uploads/2021/11/beet-salad-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Cheese Plate', 32000, 0, 5, 5, 'https://www.barleyandsage.com/wp-content/uploads/2021/08/summer-cheeseboard-1200x1200-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Clam Chowder', 26000, 1, 5, 0, 'https://s23209.pcdn.co/wp-content/uploads/2019/10/Easy-Clam-ChowderIMG_1064.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Croque Madame', 32000, 0, 5, 5, 'https://hips.hearstapps.com/hmg-prod/images/190417-croque-monsieur-horizontal-476-1556565130.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Edamame', 18000, 1, 5, 0, 'https://peasandcrayons.com/wp-content/uploads/2018/02/quick-easy-spicy-sambal-edamame-recipe-2.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Eggs Benedict', 32000, 1, 5, 15, 'https://www.foodandwine.com/thmb/j6Ak6jECu0fdly1XFHsp4zZM8gQ=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Eggs-Benedict-FT-RECIPE0123-4f5f2f2544464dc89a667b5d960603b4.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Foie Gras', 75000, 1, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/8/82/Foie_gras_en_cocotte.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Grilled Cheese Sandwich', 25000, 1, 5, 20, 'https://static01.nyt.com/images/2023/02/28/multimedia/ep-air-fryer-grilled-cheese-vpmf/ep-air-fryer-grilled-cheese-vpmf-mediumSquareAt3X.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Ice Cream', 15000, 0, 5, 0, 'https://images.unsplash.com/photo-1497034825429-c343d7c6a68f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aWNlX2NyZWFtfGVufDB8fDB8fHww&w=1000&q=80'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Paella', 42000, 1, 5, 0, 'https://www.allrecipes.com/thmb/PdwNPwZiNXr9cw8W6WQacCl6i98=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/84137-easy-paella-DDMFS-4x3-08712e61e7dc453d94673f65f9eca7d2.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (8, N'Waffles', 18000, 0, 5, 15, 'https://www.allrecipes.com/thmb/imrP1HYi5pu7j1en1_TI-Kcnzt4=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/20513-classic-waffles-mfs-025-4x3-81c0f0ace44d480ca69dd5f2c949731a.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Caprese Salad', 35000, 20, 1, 5, 0, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2019/07/Caprese-Salad-main-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Greek Salad', 32000, 30, 1, 5, 10, 'https://cdn.loveandlemons.com/wp-content/uploads/2019/07/greek-salad-2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Guacamole', 28000, 35, 1, 5, 0, 'https://www.giallozafferano.com/images/255-25549/Guacamole_1200x800.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Hummus', 25000, 3, 0, 5, 0, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2022/08/Hummus-main-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Caesar Salad', 30000, 50, 1, 5, 10, 'https://cdn.loveandlemons.com/wp-content/uploads/2019/12/caesar-salad-recipe.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Risotto', 38000, 40, 1, 5, 0, 'https://www.allrecipes.com/thmb/854efwMYEwilYjKr0FiF4FkwBvM=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/85389-gourmet-mushroom-risotto-DDMFS-4x3-a8a80a8deb064c6a8f15452b808a0258.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Omelette', 26000, 30, 1, 5, 0, 'https://realfood.tesco.com/media/images/1400x919-Tesco-5For15-13273-RainbowOmelette-b3f0c3cc-2f15-40a7-98b1-07af0609f99e-0-1400x919.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Onion Rings', 22000, 20, 1, 5, 15, 'https://th.bing.com/th/id/OIG.tUsUxbWy2qtAgqLtbaxx?pid=ImgGn'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Poutine', 25000, 30, 1, 5, 0, 'https://www.seasonsandsuppers.ca/wp-content/uploads/2014/01/new-poutine-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Club Sandwich', 35000, 25, 1, 5, 0, 'https://www.foodandwine.com/thmb/tM060YA0Fd0UALCmPQ-5gGWyBqA=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Classic-Club-Sandwich-FT-RECIPE0523-99327c9c87214026b9419b949ee13a9c.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Beet Salad', 28000, 30, 1, 5, 5, 'https://cdn.loveandlemons.com/wp-content/uploads/2021/11/beet-salad-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Cheese Plate', 32000, 50, 0, 5, 5, 'https://www.barleyandsage.com/wp-content/uploads/2021/08/summer-cheeseboard-1200x1200-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Clam Chowder', 26000, 10, 1, 5, 0, 'https://s23209.pcdn.co/wp-content/uploads/2019/10/Easy-Clam-ChowderIMG_1064.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Croque Madame', 32000, 20, 0, 5, 5, 'https://hips.hearstapps.com/hmg-prod/images/190417-croque-monsieur-horizontal-476-1556565130.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Edamame', 18000, 30, 1, 5, 0, 'https://peasandcrayons.com/wp-content/uploads/2018/02/quick-easy-spicy-sambal-edamame-recipe-2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Eggs Benedict', 32000, 20, 1, 5, 15, 'https://www.foodandwine.com/thmb/j6Ak6jECu0fdly1XFHsp4zZM8gQ=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Eggs-Benedict-FT-RECIPE0123-4f5f2f2544464dc89a667b5d960603b4.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Foie Gras', 75000, 15, 1, 5, 0, 'https://upload.wikimedia.org/wikipedia/commons/8/82/Foie_gras_en_cocotte.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Grilled Cheese Sandwich', 25000, 20, 1, 5, 20, 'https://static01.nyt.com/images/2023/02/28/multimedia/ep-air-fryer-grilled-cheese-vpmf/ep-air-fryer-grilled-cheese-vpmf-mediumSquareAt3X.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Ice Cream', 15000, 50, 0, 5, 0, 'https://images.unsplash.com/photo-1497034825429-c343d7c6a68f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aWNlX2NyZWFtfGVufDB8fDB8fHww&w=1000&q=80'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Paella', 42000, 10, 1, 5, 0, 'https://www.allrecipes.com/thmb/PdwNPwZiNXr9cw8W6WQacCl6i98=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/84137-easy-paella-DDMFS-4x3-08712e61e7dc453d94673f65f9eca7d2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (8, N'Waffles', 18000, 20, 0, 5, 15, 'https://www.allrecipes.com/thmb/imrP1HYi5pu7j1en1_TI-Kcnzt4=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/20513-classic-waffles-mfs-025-4x3-81c0f0ace44d480ca69dd5f2c949731a.jpg'); -- Mon trang mieng -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Apple Pie', 45000, 1, 5, 10, 'https://www.inspiredtaste.net/wp-content/uploads/2022/11/Apple-Pie-Recipe-Video.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Baklava', 55000, 0, 5, 0, 'https://cleobuttera.com/wp-content/uploads/2018/03/lifted-baklava-720x540.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Beignets', 40000, 1, 5, 0, 'https://hips.hearstapps.com/hmg-prod/images/beignets-1656591291.png'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Bread Pudding', 38000, 0, 5, 10, 'https://www.livewellbakeoften.com/wp-content/uploads/2020/10/Bread-Pudding-10s-new.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Cannoli', 50000, 1, 5, 0, 'https://i0.wp.com/memoriediangelina.com/wp-content/uploads/2023/01/Cannoli-2.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Cheesecake', 48000, 1, 5, 0, 'https://www.allrecipes.com/thmb/DHosjm3NundSDP1q6wWEEECYwr8=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/8419-easy-sour-cream-cheesecake-DDMFS-beauty-4x3-BG-2747-44b427d330aa41aa876269b1249698a0.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Chocolate Cake', 46000, 0, 5, 5, 'https://ichef.bbci.co.uk/food/ic/food_16x9_832/recipes/easy_chocolate_cake_31070_16x9.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Chocolate Mousse', 42000, 1, 5, 0, 'https://bakerbynature.com/wp-content/uploads/2023/08/Easy-Chocolate-Mousse-Baker-by-Nature-12617-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Churros', 35000, 1, 5, 0, 'https://www.recipetineats.com/wp-content/uploads/2016/08/Churros_9-SQ.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Creme Brulee', 48000, 1, 5, 10, 'https://bellyfull.net/wp-content/uploads/2023/05/Creme-Brulee-blog-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Cupcakes', 40000, 0, 5, 0, 'https://www.bhg.com/thmb/iL-5Q6gGjmXkxCKqEovughTLQAo=/3000x0/filters:no_upscale():strip_icc()/how-to-bake-how-to-make-cupcakes-hero-01-12c03f3eff374d569b0565bff7d9e597.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Donuts', 35000, 1, 5, 0, 'https://cdn.britannica.com/38/230838-050-D0173E79/doughnuts-donuts.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Macarons', 42000, 1, 5, 0, 'https://www.southernliving.com/thmb/dnsycw_-mf35yKRkq3cBsThVzrY=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Southern-Living_Macarons_025-0e05e0cd226d44609f55ed8bc9cd3a3e.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Tiramisu', 49000, 1, 5, 5, 'https://static01.nyt.com/images/2017/04/05/dining/05COOKING-TIRAMISU1/05COOKING-TIRAMISU1-threeByTwoMediumAt2X-v2.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Bruschetta', 35000, 0, 5, 0, 'https://www.cookingclassy.com/wp-content/uploads/2019/07/bruschetta-2.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Deviled Eggs', 32000, 1, 5, 0, 'https://static01.nyt.com/images/2021/10/15/dining/aw-classic-deviled-eggs/aw-classic-deviled-eggs-articleLarge.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Escargots', 55000, 1, 5, 5, 'https://legallyhealthyblonde.com/wp-content/uploads/2022/09/escargot-featured.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Falafel', 38000, 0, 5, 0, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2019/07/Falafel-7.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'French Onion Soup', 42000, 1, 5, 10, 'https://www.onceuponachef.com/images/2019/02/french-onion-soup-1.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Frozen Yogurt', 30000, 1, 5, 0, 'https://th.bing.com/th/id/OIG.LFpbBY20Lcd.8a_h1B3J?pid=ImgGn'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Hot and Sour Soup', 36000, 1, 5, 0, 'https://cookwithdana.com/wp-content/uploads/2021/11/IMG_2866-scaled.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Macaroni and Cheese', 32000, 1, 5, 15, 'https://upload.wikimedia.org/wikipedia/commons/4/44/Original_Mac_n_Cheese_.jpg'); -INSERT INTO Food (food_type_id, food_name, food_price, food_status, food_rate, discount_percent, food_img_url) -VALUES (9, N'Miso Soup', 35000, 0, 5, 10, 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Miso_Soup_001.jpg/1200px-Miso_Soup_001.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Apple Pie', 45000, 20, 1, 5, 10, 'https://www.inspiredtaste.net/wp-content/uploads/2022/11/Apple-Pie-Recipe-Video.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Baklava', 55000, 3, 0, 5, 0, 'https://cleobuttera.com/wp-content/uploads/2018/03/lifted-baklava-720x540.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Beignets', 40000, 30, 1, 5, 0, 'https://hips.hearstapps.com/hmg-prod/images/beignets-1656591291.png'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Bread Pudding', 38000, 25, 0, 5, 10, 'https://www.livewellbakeoften.com/wp-content/uploads/2020/10/Bread-Pudding-10s-new.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Cannoli', 50000, 25, 1, 5, 0, 'https://i0.wp.com/memoriediangelina.com/wp-content/uploads/2023/01/Cannoli-2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Cheesecake', 48000, 30, 1, 5, 0, 'https://www.allrecipes.com/thmb/DHosjm3NundSDP1q6wWEEECYwr8=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/8419-easy-sour-cream-cheesecake-DDMFS-beauty-4x3-BG-2747-44b427d330aa41aa876269b1249698a0.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Chocolate Cake', 46000, 20, 0, 5, 5, 'https://ichef.bbci.co.uk/food/ic/food_16x9_832/recipes/easy_chocolate_cake_31070_16x9.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Chocolate Mousse', 42000, 50, 1, 5, 0, 'https://bakerbynature.com/wp-content/uploads/2023/08/Easy-Chocolate-Mousse-Baker-by-Nature-12617-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Churros', 35000, 40, 1, 5, 0, 'https://www.recipetineats.com/wp-content/uploads/2016/08/Churros_9-SQ.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Creme Brulee', 48000, 30, 1, 5, 10, 'https://bellyfull.net/wp-content/uploads/2023/05/Creme-Brulee-blog-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Cupcakes', 40000, 50, 0, 5, 0, 'https://www.bhg.com/thmb/iL-5Q6gGjmXkxCKqEovughTLQAo=/3000x0/filters:no_upscale():strip_icc()/how-to-bake-how-to-make-cupcakes-hero-01-12c03f3eff374d569b0565bff7d9e597.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Donuts', 35000, 1, 20, 5, 0, 'https://cdn.britannica.com/38/230838-050-D0173E79/doughnuts-donuts.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Macarons', 42000, 50, 1, 5, 0, 'https://www.southernliving.com/thmb/dnsycw_-mf35yKRkq3cBsThVzrY=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Southern-Living_Macarons_025-0e05e0cd226d44609f55ed8bc9cd3a3e.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Tiramisu', 49000, 30, 1, 5, 5, 'https://static01.nyt.com/images/2017/04/05/dining/05COOKING-TIRAMISU1/05COOKING-TIRAMISU1-threeByTwoMediumAt2X-v2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Bruschetta', 35000, 50, 0, 5, 0, 'https://www.cookingclassy.com/wp-content/uploads/2019/07/bruschetta-2.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Deviled Eggs', 32000, 50, 1, 5, 0, 'https://static01.nyt.com/images/2021/10/15/dining/aw-classic-deviled-eggs/aw-classic-deviled-eggs-articleLarge.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Escargots', 55000, 30, 1, 5, 5, 'https://legallyhealthyblonde.com/wp-content/uploads/2022/09/escargot-featured.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Falafel', 38000, 50, 0, 5, 0, 'https://i2.wp.com/www.downshiftology.com/wp-content/uploads/2019/07/Falafel-7.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'French Onion Soup', 42000, 30, 1, 5, 10, 'https://www.onceuponachef.com/images/2019/02/french-onion-soup-1.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Frozen Yogurt', 30000, 30, 1, 5, 0, 'https://th.bing.com/th/id/OIG.LFpbBY20Lcd.8a_h1B3J?pid=ImgGn'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Hot and Sour Soup', 36000, 20, 1, 5, 0, 'https://cookwithdana.com/wp-content/uploads/2021/11/IMG_2866-scaled.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Macaroni and Cheese', 32000, 9, 1, 5, 15, 'https://upload.wikimedia.org/wikipedia/commons/4/44/Original_Mac_n_Cheese_.jpg'); +insert into Food (food_type_id, food_name, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +VALUES (9, N'Miso Soup', 35000, 5, 0, 5, 10, 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Miso_Soup_001.jpg/1200px-Miso_Soup_001.jpg'); -- Drinks -insert into Food (food_type_id, food_name, food_description, food_price, food_status, food_rate, discount_percent, food_img_url) -values (10, N'Coca-Cola (330ml)', N'Coca-Cola là một loại nước ngọt có ga phổ biến trên toàn thế giới. Với hương vị đặc trưng, ngọt ngào và sảy ngon, Coca-Cola thường được phục vụ lạnh và kèm theo đá.', 12000, 1,5, 0, 'https://drive.google.com/uc?id=14_GTRoOdBs5zuU4VwnzftPsqtdEeW1xP'); -insert into Food (food_type_id, food_name, food_description, food_price, food_status, food_rate, discount_percent, food_img_url) -values (10, N'7 Up (330ml)', N'7 Up là một loại nước ngọt có ga với hương vị chanh mát lạnh. Được sản xuất từ các thành phần tự nhiên, 7 Up thường là lựa chọn tuyệt vời để giải khát trong những ngày nắng nóng.', 12000, 1,5, 0, 'https://drive.google.com/uc?id=1HxLmW1x2aNiZBmKYGps8hXksinGIl7rv'); -insert into Food (food_type_id, food_name, food_description, food_price, food_status, food_rate, discount_percent, food_img_url) -values (10, N'Trà đào', N'Trà Đào là một loại trà trái cây ngon mát, được làm từ trà đen pha chế cùng với hương vị tự nhiên và ngọt ngọt của đào. Một lựa chọn tuyệt vời để giải nhiệt và thư giãn trong ngày nắng nóng.', 20000, 1,4, 0, 'https://drive.google.com/uc?id=1RgBDS_wk1SmUfxMujGQSYMl-uOy8qob3'); -insert into Food (food_type_id, food_name, food_description, food_price, food_status, food_rate, discount_percent, food_img_url) -values (10, N'Trà chanh dây', N'Trà Chanh Dây là một loại trà trái cây tươi ngon, được làm từ trà xanh pha chế cùng với hương vị chua chua ngọt ngọt của chanh dây. Một lựa chọn sức khỏe và thưởng thức tuyệt vời cho mọi ngày.', 20000, 1,5, 0, 'https://drive.google.com/uc?id=1Cj22ZH1a79m9zz4oKmB-ZhMZuxd24qCx'); +insert into Food (food_type_id, food_name, food_description, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (10, N'Coca-Cola (330ml)', N'Coca-Cola là một loại nước ngọt có ga phổ biến trên toàn thế giới. Với hương vị đặc trưng, ngọt ngào và sảy ngon, Coca-Cola thường được phục vụ lạnh và kèm theo đá.', 12000, 500, 1,5, 0, 'https://drive.google.com/uc?id=14_GTRoOdBs5zuU4VwnzftPsqtdEeW1xP'); +insert into Food (food_type_id, food_name, food_description, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (10, N'7 Up (330ml)', N'7 Up là một loại nước ngọt có ga với hương vị chanh mát lạnh. Được sản xuất từ các thành phần tự nhiên, 7 Up thường là lựa chọn tuyệt vời để giải khát trong những ngày nắng nóng.', 12000, 200, 1,5, 0, 'https://drive.google.com/uc?id=1HxLmW1x2aNiZBmKYGps8hXksinGIl7rv'); +insert into Food (food_type_id, food_name, food_description, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (10, N'Trà đào', N'Trà Đào là một loại trà trái cây ngon mát, được làm từ trà đen pha chế cùng với hương vị tự nhiên và ngọt ngọt của đào. Một lựa chọn tuyệt vời để giải nhiệt và thư giãn trong ngày nắng nóng.', 20000, 300, 1,4, 0, 'https://drive.google.com/uc?id=1RgBDS_wk1SmUfxMujGQSYMl-uOy8qob3'); +insert into Food (food_type_id, food_name, food_description, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url) +values (10, N'Trà chanh dây', N'Trà Chanh Dây là một loại trà trái cây tươi ngon, được làm từ trà xanh pha chế cùng với hương vị chua chua ngọt ngọt của chanh dây. Một lựa chọn sức khỏe và thưởng thức tuyệt vời cho mọi ngày.', 20000, 200, 1, 5, 0, 'https://drive.google.com/uc?id=1Cj22ZH1a79m9zz4oKmB-ZhMZuxd24qCx'); -- Payment methods insert into PaymentMethod (payment_method) values (N'Thẻ tín dụng'); diff --git a/src/main/java/Controllers/AdminController.java b/src/main/java/Controllers/AdminController.java index 875e60fe..1dbae629 100644 --- a/src/main/java/Controllers/AdminController.java +++ b/src/main/java/Controllers/AdminController.java @@ -14,7 +14,6 @@ import DAOs.StaffDAO; import DAOs.VoucherDAO; import Models.Account; -import Models.Admin; import Models.Customer; import Models.Food; import Models.Order; @@ -29,28 +28,85 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpSession; +import java.io.BufferedReader; import java.io.IOException; -import java.io.PrintWriter; +import java.io.InputStreamReader; import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.URL; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; import java.util.List; +import org.json.JSONArray; +import org.json.JSONObject; public class AdminController extends HttpServlet { - + + // send request function + private String sendGetRequest(String apiURL) { + try { + URL url = new URL(apiURL); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + connection.setRequestMethod("GET"); + int responseCode = connection.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuilder response = new StringBuilder(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + // Parse the JSON array response + JSONArray jsonArray = new JSONArray(response.toString()); + + // Check if the array is not empty + if (jsonArray.length() > 0) { + // Get the first object from the array + JSONObject jsonObject = jsonArray.getJSONObject(0); + // Extract payment_time from the object + String paymentTime = jsonObject.getString("payment_time"); + return paymentTime; + } else { + // Handle empty JSON array (no elements found) + return null; + } + + + } else { + // Xử lý trường hợp không thành công khi gọi API + return null; + } + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + // get list of food, voucher, user, role, order in database private void doGetList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - FoodDAO foodDAO = new FoodDAO(); - List foodList = foodDAO.getAllList(); + CustomerDAO customerDAO = new CustomerDAO(); + FoodDAO foodDAO = new FoodDAO(); AccountDAO accountDAO = new AccountDAO(); + StaffDAO staffDAO = new StaffDAO(); + PromotionManagerDAO promotionManagerDAO = new PromotionManagerDAO(); + OrderDAO orderDAO = new OrderDAO(); + VoucherDAO voucherDAO = new VoucherDAO(); + + List foodList = foodDAO.getAllList(); List userAccountList = accountDAO.getAllUser(); - CustomerDAO customerDAO = new CustomerDAO(); List customerList = customerDAO.getAllCustomer(); + List accountList = accountDAO.getAllRole(); + List StaffList = staffDAO.getAllStaff(); + List PromotionManagerList = promotionManagerDAO.getAllPromotionManager(); + List voucherList = voucherDAO.getAllList(); List userList = new ArrayList<>(); for (Account account : userAccountList) { @@ -87,13 +143,6 @@ private void doGetList(HttpServletRequest request, HttpServletResponse response) } } - StaffDAO staffDAO = new StaffDAO(); - PromotionManagerDAO promotionManagerDAO = new PromotionManagerDAO(); - - List accountList = accountDAO.getAllRole(); - List StaffList = staffDAO.getAllStaff(); - List PromotionManagerList = promotionManagerDAO.getAllPromotionManager(); - List roleList = new ArrayList<>(); for (Account a : accountList) { if (a.getAccountType().equals("staff")) { @@ -119,33 +168,24 @@ private void doGetList(HttpServletRequest request, HttpServletResponse response) } } } - OrderDAO orderDAO = new OrderDAO(); + List orderList = orderDAO.getAllList(); - // Sorting orderList based on status in ascending order and ID in descending order -// Collections.sort(orderList, new Comparator() { -// @Override -// public int compare(Order o1, Order o2) { -// // Compare status in ascending order -// int statusComparison = Integer.compare(o1.getOrderStatusID(), o2.getOrderStatusID()); -// -// // If status is equal, sort by ID in descending order -// if (statusComparison == 0) { -// return Integer.compare(o2.getOrderID(), o1.getOrderID()); -// } -// -// // Else sort by status in ascending order -// return statusComparison; -// } -// }); - for (int i = 0; i < orderList.size(); i++){ + for (int i = 0; i < orderList.size(); i++) { String Orderfirstname = customerDAO.getCustomer(orderList.get(i).getCustomerID()).getFirstName(); String Orderlastname = customerDAO.getCustomer(orderList.get(i).getCustomerID()).getLastName(); + String payment_status = "Chưa thanh toán"; + // Tạo URL cho việc gọi API + String apiURL = "http://localhost:8001/check_order_payment/" + orderList.get(i).getOrderID(); + // Thực hiện HTTP request để lấy vnpay_payment_url + String payment_time = sendGetRequest(apiURL); + if (payment_time != null) { + payment_status = "Đã thanh toán"; + } + orderList.get(i).setPayment_status(payment_status); orderList.get(i).setFirstname(Orderfirstname); orderList.get(i).setLastname(Orderlastname); } - - VoucherDAO voucherDAO = new VoucherDAO(); - List voucherList = voucherDAO.getAllList(); + request.setAttribute("foodList", foodList); request.setAttribute("userList", userList); request.setAttribute("roleList", roleList); @@ -153,7 +193,8 @@ private void doGetList(HttpServletRequest request, HttpServletResponse response) request.setAttribute("voucherList", voucherList); request.getRequestDispatcher("/admin.jsp").forward(request, response); } - + + //add food private void doPostAddFood(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { byte foodTypeID = Byte.parseByte(request.getParameter("txtFoodTypeID")); @@ -162,10 +203,12 @@ private void doPostAddFood(HttpServletRequest request, HttpServletResponse respo BigDecimal foodPrice = BigDecimal.valueOf(Double.parseDouble(request.getParameter("txtFoodPrice"))); byte discountPercent = Byte.parseByte(request.getParameter("txtDiscountPercent")); byte foodRate = Byte.parseByte(request.getParameter("txtFoodRate")); + Short foodQuantity = Short.parseShort(request.getParameter("txtFoodQuantity")); byte foodStatus = Byte.parseByte(request.getParameter("txtFoodStatus")); String imageURL = (String) request.getAttribute("txtImageURL"); FoodDAO foodDAO = new FoodDAO(); Food food = new Food(foodName, foodDescription, foodPrice, foodStatus, foodRate, discountPercent, imageURL, foodTypeID); + food.setQuantity(foodQuantity); if (foodDAO.getFood(foodName) != null) { response.sendRedirect("/admin#failure_add_food_exist"); return; @@ -173,7 +216,7 @@ private void doPostAddFood(HttpServletRequest request, HttpServletResponse respo int result = foodDAO.add(food); HttpSession session = request.getSession(); session.setAttribute("tabID", 3); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/admin#success_add_food"); return; } else { @@ -181,7 +224,8 @@ private void doPostAddFood(HttpServletRequest request, HttpServletResponse respo return; } } - + + // update food private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { short foodID = Short.parseShort(request.getParameter("txtFoodID")); @@ -189,6 +233,7 @@ private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse re String foodName = request.getParameter("txtFoodName"); String foodDescription = (String) request.getParameter("txtFoodDescription"); BigDecimal foodPrice = BigDecimal.valueOf(Double.parseDouble(request.getParameter("txtFoodPrice"))); + Short foodQuantity = Short.parseShort(request.getParameter("txtFoodQuantity")); byte foodRate = Byte.parseByte(request.getParameter("txtFoodRate")); byte foodStatus = Byte.parseByte(request.getParameter("txtFoodStatus")); byte discountPercent = Byte.parseByte(request.getParameter("txtDiscountPercent")); @@ -196,10 +241,11 @@ private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse re FoodDAO foodDAO = new FoodDAO(); Food food = new Food(foodID, foodName, foodDescription, foodPrice, foodStatus, foodRate, discountPercent, imageURL, foodTypeID); + food.setQuantity(foodQuantity); int result = foodDAO.update(food); HttpSession session = request.getSession(); session.setAttribute("tabID", 3); - if (result == 1) { + if (result >=1) { response.sendRedirect("/admin#success_update_food"); return; } else { @@ -207,7 +253,8 @@ private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse re return; } } - + + // delete food private void doPostDeleteFood(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -227,15 +274,10 @@ private void doPostDeleteFood(HttpServletRequest request, HttpServletResponse re session.setAttribute("tabID", 3); // TODO implement a deletion status message after page reload // Redirect or forward to another page if necessary - if (result > 1) { - response.sendRedirect("/admin#success_delete_food"); - return; - } else { - response.sendRedirect("/admin#failure_delete_food"); - return; - } + response.sendRedirect("/admin#success_delete_food"); } - + + //add user private void doPostAddUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("txtAccountUsername"); @@ -261,11 +303,11 @@ private void doPostAddUser(HttpServletRequest request, HttpServletResponse respo CustomerDAO customerDAO = new CustomerDAO(); int result = customerDAO.add(newCustomer); - if (result == 1) { + if (result >= 1) { account.setCustomerID(customerDAO.getLatestCustomer().getCustomerID()); System.out.println(account.getCustomerID()); int result1 = accountDAO.add(account); - if (result == 1) { + if (result >=1) { response.sendRedirect("/admin#success_add_user"); return; } else { @@ -279,6 +321,7 @@ private void doPostAddUser(HttpServletRequest request, HttpServletResponse respo } + //update user private void doPostUpdateUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int userID = Integer.parseInt(request.getParameter("txtUserID")); @@ -300,15 +343,15 @@ private void doPostUpdateUser(HttpServletRequest request, HttpServletResponse re account.setAccountID(userID); Customer customer = new Customer(firstname, lastname, gender, phoneNumber, address); int result1 = 0; - if (customerID == 0){ + if (customerID == 0) { result1 = customerDAO.add(customer); account.setCustomerID(customerDAO.getLatestCustomer().getCustomerID()); } else { customer.setCustomerID(customerID); - result1 = customerDAO.update(customer); + result1 = customerDAO.update(customer); } - - if (result1 == 1) { + + if (result1 >= 1) { int result = accountDAO.update(account); int result2 = accountDAO.updateCustomerID(account); response.sendRedirect("/admin#success_update_user"); @@ -319,6 +362,7 @@ private void doPostUpdateUser(HttpServletRequest request, HttpServletResponse re } } + //delete user private void doPostDeleteUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -343,21 +387,14 @@ private void doPostDeleteUser(HttpServletRequest request, HttpServletResponse re // Delete each food item, and count deleted items AccountDAO accountDAO = new AccountDAO(); int result1 = accountDAO.deleteMultiple(userIDList); - int result2 = 0; - if (result1 == 1) { - CustomerDAO customerDAO = new CustomerDAO(); - result2 = customerDAO.deleteMultiple(customerIDList); - if (result2 > 1) { - response.sendRedirect("/admin#success_delete_user"); - } else { - response.sendRedirect("/admin#failure_delete_user"); - } - + if (result1 >= 1) { + response.sendRedirect("/admin#success_delete_user"); } else { response.sendRedirect("/admin#failure_delete_user"); } - } - + } + + //add role private void doPostAddRole(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("txtAccountUsername"); @@ -379,10 +416,10 @@ private void doPostAddRole(HttpServletRequest request, HttpServletResponse respo StaffDAO staffDAO = new StaffDAO(); int result = staffDAO.add(newstaff); - if (result == 1) { + if (result >= 1) { account.setStaffID(staffDAO.getNewStaff().getStaffID()); int result1 = accountDAO.add(account); - if (result1 == 1) { + if (result1 >= 1) { response.sendRedirect("/admin#success_add_role"); return; } else { @@ -398,10 +435,10 @@ private void doPostAddRole(HttpServletRequest request, HttpServletResponse respo PromotionManagerDAO promotionManagerDAO = new PromotionManagerDAO(); int result = promotionManagerDAO.add(newPromotionManager); - if (result == 1) { + if (result >= 1) { account.setProID(promotionManagerDAO.getNewPromotionManager().getProID()); int result1 = accountDAO.add(account); - if (result1 == 1) { + if (result1 >= 1) { response.sendRedirect("/admin#success_add_role"); return; } else { @@ -414,7 +451,8 @@ private void doPostAddRole(HttpServletRequest request, HttpServletResponse respo } } } - + + // update role private void doPostUpdateRole(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Integer accountID = Integer.parseInt(request.getParameter("txtAccountID")); @@ -435,10 +473,10 @@ private void doPostUpdateRole(HttpServletRequest request, HttpServletResponse re StaffDAO staffDAO = new StaffDAO(); int result = staffDAO.update(updatestaff); - if (result == 1) { + if (result >= 1) { account.setStaffID(roleID); int result1 = accountDAO.update(account); - if (result1 == 1) { + if (result1 >= 1) { response.sendRedirect("/admin#success_update_role"); return; } else { @@ -454,10 +492,10 @@ private void doPostUpdateRole(HttpServletRequest request, HttpServletResponse re PromotionManagerDAO promotionManagerDAO = new PromotionManagerDAO(); int result = promotionManagerDAO.update(newPromotionManager); - if (result == 1) { + if (result >= 1) { account.setProID(roleID); - int result1 = accountDAO.add(account); - if (result1 == 1) { + int result1 = accountDAO.update(account); + if (result1 >= 1) { response.sendRedirect("/admin#success_update_role"); return; } else { @@ -470,7 +508,8 @@ private void doPostUpdateRole(HttpServletRequest request, HttpServletResponse re } } } - + + // delete role private void doPostDeleteRole(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -486,20 +525,23 @@ private void doPostDeleteRole(HttpServletRequest request, HttpServletResponse re roleIDList.add(Byte.parseByte(roleIDs[i])); } -// // Convert the strings to numbers + // Convert the strings to numbers List accountIDList = new ArrayList<>(); for (int i = 0; i < accountIDs.length; i++) { accountIDList.add(Integer.parseInt(accountIDs[i])); } -// -// // Convert the strings to numbers + List StaffIDList = new ArrayList<>(); - for (int i = 0; i < temp1IDs.length; i++) { - StaffIDList.add(Byte.parseByte(temp1IDs[i])); - } List ProIDList = new ArrayList<>(); - for (int i = 0; i < temp2IDs.length; i++) { - ProIDList.add(Byte.parseByte(temp2IDs[i])); + if (!temp1IDs[0].equals("")) { + // Convert the strings to numbers + for (int i = 0; i < temp1IDs.length; i++) { + StaffIDList.add(Byte.parseByte(temp1IDs[i])); + } + } else { + for (int i = 0; i < temp2IDs.length; i++) { + ProIDList.add(Byte.parseByte(temp2IDs[i])); + } } // Delete each food item, and count deleted items @@ -508,7 +550,7 @@ private void doPostDeleteRole(HttpServletRequest request, HttpServletResponse re int result2 = 0; HttpSession session = request.getSession(); session.setAttribute("tabID", 5); - if (result1 == 1) { + if (result1 >= 1) { if (StaffIDList.size() != 0) { StaffDAO staffDAO = new StaffDAO(); result2 = staffDAO.deleteMultiple(StaffIDList); @@ -518,7 +560,7 @@ private void doPostDeleteRole(HttpServletRequest request, HttpServletResponse re result2 = proDAO.deleteMultiple(ProIDList); } - if (result2 > 1) { + if (result2 >= 1) { response.sendRedirect("/admin#success_delete_role"); } else { response.sendRedirect("/admin#failure_delete_role"); @@ -527,7 +569,8 @@ private void doPostDeleteRole(HttpServletRequest request, HttpServletResponse re response.sendRedirect("/admin#failure_delete_role"); } } - + + // add voucher private void doPostAddVoucher(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -551,7 +594,7 @@ private void doPostAddVoucher(HttpServletRequest request, HttpServletResponse re HttpSession session = request.getSession(); session.setAttribute("tabID", 2); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/admin#success_add_voucher"); return; } else { @@ -559,7 +602,8 @@ private void doPostAddVoucher(HttpServletRequest request, HttpServletResponse re return; } } - + + // update voucher private void doPostUpdateVoucher(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Byte voucherID = Byte.parseByte(request.getParameter("txtvoucher_id")); @@ -578,7 +622,7 @@ private void doPostUpdateVoucher(HttpServletRequest request, HttpServletResponse int result = voucherDAO.update(voucher); HttpSession session = request.getSession(); session.setAttribute("tabID", 2); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/admin#success_update_voucher"); return; } else { @@ -586,7 +630,8 @@ private void doPostUpdateVoucher(HttpServletRequest request, HttpServletResponse return; } } - + + // delete voucher private void doPostDeleteVoucher(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -606,7 +651,7 @@ private void doPostDeleteVoucher(HttpServletRequest request, HttpServletResponse session.setAttribute("tabID", 2); // TODO implement a deletion status message after page reload // Redirect or forward to another page if necessary - if (result > 1) { + if (result >= 1) { response.sendRedirect("/admin#success_delete_voucher"); return; } else { @@ -615,6 +660,7 @@ private void doPostDeleteVoucher(HttpServletRequest request, HttpServletResponse } } + // update order private void doPostUpdateOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int orderID = Integer.parseInt(request.getParameter("txtOrderID")); @@ -626,34 +672,33 @@ private void doPostUpdateOrder(HttpServletRequest request, HttpServletResponse r Double orderTotal = Double.parseDouble(request.getParameter("txtOrderTotal")); BigDecimal orderTotalPay = BigDecimal.valueOf(orderTotal); - + byte orderStatusID = 5; - if (status.equals("Chờ xác nhận")){ + if (status.equals("Chờ xác nhận")) { orderStatusID = 1; - } else if (status.equals("Đang chuẩn bị món")){ + } else if (status.equals("Đang chuẩn bị món")) { orderStatusID = 2; - } else if (status.equals("Đang giao")){ + } else if (status.equals("Đang giao")) { orderStatusID = 3; - } else if (status.equals("Đã giao")){ + } else if (status.equals("Đã giao")) { orderStatusID = 4; - } - + } + byte paymentMethodID = 3; - if (paymentmethod.equals("Thẻ tín dụng")){ + if (paymentmethod.equals("Thẻ tín dụng")) { paymentMethodID = 1; - } else if (paymentmethod.equals("Thẻ ghi nợ")){ + } else if (paymentmethod.equals("Thẻ ghi nợ")) { paymentMethodID = 2; } - + HttpSession session = request.getSession(); OrderDAO orderDAO = new OrderDAO(); Order order = new Order(orderID, orderStatusID, paymentMethodID, phonenumber, address, note, orderTotalPay); - - Order oldOrder = orderDAO.getOrder(orderID); - + + int result = orderDAO.updateForAdmin(order); session.setAttribute("tabID", 6); - if (result == 1) { + if (result >= 1) { OrderLogDAO logDAO = new OrderLogDAO(); LocalDateTime currentTime = LocalDateTime.now(); Timestamp logTime = Timestamp.valueOf(currentTime); @@ -661,17 +706,11 @@ private void doPostUpdateOrder(HttpServletRequest request, HttpServletResponse r OrderLog log = new OrderLog(orderID, "Cập nhật thông tin đơn hàng", logTime); log.setAdmin_id(adminID); logDAO.addAdminLog(log); - if (oldOrder.getOrderStatusID() != orderStatusID){ - OrderLog logStatusOrder = new OrderLog(orderID, "Cập nhật trạng thái đơn hàng: " + status, logTime); + if (orderStatusID == 5) { + OrderLog logStatusOrder = new OrderLog(orderID, "Hủy đơn hàng", logTime); logStatusOrder.setAdmin_id(adminID); logDAO.addAdminLog(logStatusOrder); } - - if (oldOrder.getOrderTotal() != orderTotalPay){ - OrderLog logTotalOrder = new OrderLog(orderID, "Cập nhật thanh toán đơn hàng: " + orderTotalPay, logTime); - logTotalOrder.setAdmin_id(adminID); - logDAO.addAdminLog(logTotalOrder); - } response.sendRedirect("/admin#success_update_order"); return; @@ -681,6 +720,7 @@ private void doPostUpdateOrder(HttpServletRequest request, HttpServletResponse r } } + // delete order private void doPostDeleteOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -697,18 +737,18 @@ private void doPostDeleteOrder(HttpServletRequest request, HttpServletResponse r HttpSession session = request.getSession(); OrderDAO dao = new OrderDAO(); int result = dao.deleteMultiple(orderIDList); - + session.setAttribute("tabID", 6); // TODO implement a deletion status message after page reload // Redirect or forward to another page if necessary - if (result > 1) { + if (result >= 1) { OrderLogDAO logDAO = new OrderLogDAO(); LocalDateTime currentTime = LocalDateTime.now(); byte adminID = (byte) session.getAttribute("adminID"); Timestamp logTime = Timestamp.valueOf(currentTime); - for (int i = 0; i < orderIDList.size(); i++) { + for (int i = 0; i < orderIDList.size(); i++) { OrderLog log = new OrderLog(orderIDList.get(i), "Xóa đơn hàng", logTime); - log.setAdmin_id(adminID); + log.setAdmin_id(adminID); logDAO.addAdminLog(log); } response.sendRedirect("/admin#success_delete_order"); @@ -719,6 +759,7 @@ private void doPostDeleteOrder(HttpServletRequest request, HttpServletResponse r } } + // update status of list of order to next status private void doPostNextOrder(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -735,18 +776,18 @@ private void doPostNextOrder(HttpServletRequest request, HttpServletResponse res HttpSession session = request.getSession(); OrderDAO dao = new OrderDAO(); int result = dao.changeStatusMultiple(orderIDList); - + session.setAttribute("tabID", 6); // TODO implement a deletion status message after page reload // Redirect or forward to another page if necessary - if (result > 1) { + if (result >= 1) { OrderLogDAO logDAO = new OrderLogDAO(); LocalDateTime currentTime = LocalDateTime.now(); byte adminID = (byte) session.getAttribute("adminID"); Timestamp logTime = Timestamp.valueOf(currentTime); - for (int i = 0; i < orderIDList.size(); i++) { + for (int i = 0; i < orderIDList.size(); i++) { OrderLog log = new OrderLog(orderIDList.get(i), "Cập nhật trạng thái đơn hàng", logTime); - log.setAdmin_id(adminID); + log.setAdmin_id(adminID); logDAO.addAdminLog(log); } response.sendRedirect("/admin#success_next_order"); @@ -757,26 +798,31 @@ private void doPostNextOrder(HttpServletRequest request, HttpServletResponse res } } + // get the history of an order private void doGetOrderHistory(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); - session.setAttribute("tabID", 7); - int orderID = Integer.parseInt(request.getParameter("txtOrderID")); - OrderLogDAO dao = new OrderLogDAO(); - StaffDAO staffDAO = new StaffDAO(); - AdminDAO adminDAO = new AdminDAO(); - List logList = new ArrayList<>(); - logList = dao.getAllListByOrderID(orderID); - for (int i = 0; i < logList.size(); i++){ - if (logList.get(i).getAdmin_id() != 0) { - logList.get(i).setFullname(adminDAO.getAdmin(logList.get(i).getAdmin_id()).getFullName()); - } if (logList.get(i).getStaff_id()!= 0) { - logList.get(i).setFullname(staffDAO.getStaff(logList.get(i).getStaff_id()).getFullName()); + session.setAttribute("tabID", 6); + String path = request.getRequestURI(); + if (path.startsWith("/admin/history/")) { + String[] s = path.split("/"); + int orderID = Integer.parseInt(s[s.length - 1]); + OrderLogDAO dao = new OrderLogDAO(); + StaffDAO staffDAO = new StaffDAO(); + AdminDAO adminDAO = new AdminDAO(); + List logList = new ArrayList<>(); + logList = dao.getAllListByOrderID(orderID); + for (int i = 0; i < logList.size(); i++) { + if (logList.get(i).getAdmin_id() != 0) { + logList.get(i).setFullname(adminDAO.getAdmin(logList.get(i).getAdmin_id()).getFullName()); + } + if (logList.get(i).getStaff_id() != 0) { + logList.get(i).setFullname(staffDAO.getStaff(logList.get(i).getStaff_id()).getFullName()); + } } - } - - session.setAttribute("logList", logList); - response.sendRedirect("/admin"); + session.setAttribute("logList", logList); + response.sendRedirect("/admin#history"); + } } // = 1) { response.sendRedirect("/promotionManager#success_delete_voucher"); } else { response.sendRedirect("/promotionManager#failure_delete_voucher"); @@ -92,7 +92,7 @@ private void doPostAddVoucher(HttpServletRequest request, HttpServletResponse re session.setAttribute("tabID", 2); int result = voucherDAO.add(voucher); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/promotionManager#success_add_voucher"); return; } else { @@ -119,7 +119,7 @@ private void doPostUpdateVoucher(HttpServletRequest request, HttpServletResponse int result = voucherDAO.update(voucher); HttpSession session = request.getSession(); session.setAttribute("tabID", 2); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/promotionManager#success_update_voucher"); return; } else { @@ -149,7 +149,7 @@ private void doPostDeleteVoucher(HttpServletRequest request, HttpServletResponse request.setAttribute("tabID", 3); HttpSession session = request.getSession(); session.setAttribute("tabID", 2); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/promotionManager#success_delete_voucher"); } else { response.sendRedirect("/promotionManager#failure_delete_voucher"); @@ -168,7 +168,7 @@ private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse re int result = foodDAO.updateDiscount(food); HttpSession session = request.getSession(); session.setAttribute("tabID", 1); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/promotionManager#success_update_food"); return; } else { diff --git a/src/main/java/Controllers/StaffController.java b/src/main/java/Controllers/StaffController.java index 5e236d79..ec91d3e7 100644 --- a/src/main/java/Controllers/StaffController.java +++ b/src/main/java/Controllers/StaffController.java @@ -5,9 +5,12 @@ package Controllers; import DAOs.AccountDAO; +import DAOs.AdminDAO; +import DAOs.CustomerDAO; import DAOs.FoodDAO; import DAOs.OrderDAO; import DAOs.OrderLogDAO; +import DAOs.StaffDAO; import DAOs.VoucherDAO; import Models.Account; import Models.Food; @@ -21,58 +24,93 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpSession; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.URL; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import org.json.JSONArray; +import org.json.JSONObject; public class StaffController extends HttpServlet { - /** - * Processes requests for both HTTP GET and POST - * methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - try ( PrintWriter out = response.getWriter()) { - /* TODO output your page here. You may use following sample code. */ - out.println(""); - out.println(""); - out.println(""); - out.println("Servlet StaffController"); - out.println(""); - out.println(""); - out.println("

Servlet StaffController at " + request.getContextPath() + "

"); - out.println(""); - out.println(""); + // send request function + private String sendGetRequest(String apiURL) { + try { + URL url = new URL(apiURL); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + connection.setRequestMethod("GET"); + int responseCode = connection.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuilder response = new StringBuilder(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + // Parse the JSON array response + JSONArray jsonArray = new JSONArray(response.toString()); + + // Check if the array is not empty + if (jsonArray.length() > 0) { + // Get the first object from the array + JSONObject jsonObject = jsonArray.getJSONObject(0); + // Extract payment_time from the object + String paymentTime = jsonObject.getString("payment_time"); + return paymentTime; + } else { + // Handle empty JSON array (no elements found) + return null; + } + + } else { + // Xử lý trường hợp không thành công khi gọi API + return null; + } + } catch (IOException e) { + e.printStackTrace(); + return null; } } - private void doGetFood(HttpServletRequest request, HttpServletResponse response) + protected void doGetList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + FoodDAO foodDAO = new FoodDAO(); + List foodList = foodDAO.getAllList(); - String path = request.getRequestURI(); - if (path.startsWith("/staff/food/delete")) { - String[] s = path.split("/"); - short foodID = Short.parseShort(s[s.length - 1]); - FoodDAO dao = new FoodDAO(); - int result = dao.delete(foodID); - request.setAttribute("tabID", 3); - if (result == 1) { - response.sendRedirect("/staff#success_delete_food"); - } else { - response.sendRedirect("/staff#failure_delete_food"); + CustomerDAO customerDAO = new CustomerDAO(); + OrderDAO orderDAO = new OrderDAO(); + List orderList = orderDAO.getAllList(); + + for (int i = 0; i < orderList.size(); i++) { + String Orderfirstname = customerDAO.getCustomer(orderList.get(i).getCustomerID()).getFirstName(); + String Orderlastname = customerDAO.getCustomer(orderList.get(i).getCustomerID()).getLastName(); + String payment_status = "Chưa thanh toán"; + // Tạo URL cho việc gọi API + String apiURL = "http://localhost:8001/check_order_payment/" + orderList.get(i).getOrderID(); + // Thực hiện HTTP request để lấy vnpay_payment_url + String payment_time = sendGetRequest(apiURL); + if (payment_time != null) { + payment_status = "Đã thanh toán"; } - - response.sendRedirect("/staff#failure_delete_food"); + orderList.get(i).setPayment_status(payment_status); + orderList.get(i).setFirstname(Orderfirstname); + orderList.get(i).setLastname(Orderlastname); } + + request.setAttribute("foodList", foodList); + request.setAttribute("orderList", orderList); + request.getRequestDispatcher("/staff.jsp").forward(request, response); + } private void doPostAddFood(HttpServletRequest request, HttpServletResponse response) @@ -82,6 +120,7 @@ private void doPostAddFood(HttpServletRequest request, HttpServletResponse respo String foodDescription = (String) request.getParameter("txtFoodDescription"); BigDecimal foodPrice = BigDecimal.valueOf(Double.parseDouble(request.getParameter("txtFoodPrice"))); byte discountPercent = Byte.parseByte(request.getParameter("txtDiscountPercent")); + Short foodQuantity = Short.parseShort(request.getParameter("txtFoodQuantity")); byte foodRate = Byte.parseByte(request.getParameter("txtFoodRate")); byte foodStatus = Byte.parseByte(request.getParameter("txtFoodStatus")); String imageURL = (String) request.getAttribute("txtImageURL"); @@ -90,13 +129,14 @@ private void doPostAddFood(HttpServletRequest request, HttpServletResponse respo session.setAttribute("tabID", 1); Food food = new Food(foodName, foodDescription, foodPrice, foodStatus, foodRate, discountPercent, imageURL, foodTypeID); + food.setQuantity(foodQuantity); if (foodDAO.getFood(foodName) != null) { response.sendRedirect("/staff#failure_add_food_exist"); } int result = foodDAO.add(food); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/staff#success_add_food"); return; } else { @@ -112,6 +152,7 @@ private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse re String foodName = request.getParameter("txtFoodName"); String foodDescription = (String) request.getParameter("txtFoodDescription"); BigDecimal foodPrice = BigDecimal.valueOf(Double.parseDouble(request.getParameter("txtFoodPrice"))); + Short foodQuantity = Short.parseShort(request.getParameter("txtFoodQuantity")); byte foodRate = Byte.parseByte(request.getParameter("txtFoodRate")); byte foodStatus = Byte.parseByte(request.getParameter("txtFoodStatus")); byte discountPercent = Byte.parseByte(request.getParameter("txtDiscountPercent")); @@ -119,10 +160,11 @@ private void doPostUpdateFood(HttpServletRequest request, HttpServletResponse re FoodDAO foodDAO = new FoodDAO(); Food food = new Food(foodID, foodName, foodDescription, foodPrice, foodStatus, foodRate, discountPercent, imageURL, foodTypeID); + food.setQuantity(foodQuantity); int result = foodDAO.update(food); HttpSession session = request.getSession(); session.setAttribute("tabID", 1); - if (result == 1) { + if (result >= 1) { response.sendRedirect("/staff#success_update_food"); return; } else { @@ -151,7 +193,7 @@ private void doPostDeleteFood(HttpServletRequest request, HttpServletResponse re // Redirect or forward to another page if necessary request.setAttribute("tabID", 3); - if (result > 1) { + if (result >= 1) { response.sendRedirect("/staff#success_delete_food"); } else { response.sendRedirect("/staff#failure_delete_food"); @@ -192,10 +234,10 @@ private void doPostUpdateOrder(HttpServletRequest request, HttpServletResponse r OrderDAO orderDAO = new OrderDAO(); Order order = new Order(orderID, orderStatusID, paymentMethodID, phonenumber, address, note, orderTotalPay); Order oldOrder = orderDAO.getOrder(orderID); - + int result = orderDAO.updateForAdmin(order); - - if (result == 1) { + + if (result >= 1) { LocalDateTime currentTime = LocalDateTime.now(); Timestamp logTime = Timestamp.valueOf(currentTime); byte staffID = (byte) session.getAttribute("staffID"); @@ -203,19 +245,19 @@ private void doPostUpdateOrder(HttpServletRequest request, HttpServletResponse r log.setStaff_id(staffID); OrderLogDAO logDAO = new OrderLogDAO(); logDAO.addStaffLog(log); - - if (oldOrder.getOrderStatusID() != orderStatusID){ + + if (oldOrder.getOrderStatusID() != orderStatusID) { OrderLog logStatusOrder = new OrderLog(orderID, "Cập nhật trạng thái đơn hàng: " + status, logTime); logStatusOrder.setStaff_id(staffID); logDAO.addStaffLog(logStatusOrder); } - - if (oldOrder.getOrderTotal() != orderTotalPay){ + + if (oldOrder.getOrderTotal() != orderTotalPay) { OrderLog logTotalOrder = new OrderLog(orderID, "Cập nhật thanh toán đơn hàng: " + orderTotalPay, logTime); logTotalOrder.setStaff_id(staffID); logDAO.addStaffLog(logTotalOrder); } - + response.sendRedirect("/staff#success_update_order"); return; } else { @@ -244,7 +286,7 @@ private void doPostNextOrder(HttpServletRequest request, HttpServletResponse res session.setAttribute("tabID", 2); // TODO implement a deletion status message after page reload // Redirect or forward to another page if necessary - if (result > 1) { + if (result >= 1) { OrderLogDAO logDAO = new OrderLogDAO(); LocalDateTime currentTime = LocalDateTime.now(); byte staffID = (byte) session.getAttribute("staffID"); @@ -276,18 +318,9 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path = request.getRequestURI(); if (path.endsWith("/staff")) { - FoodDAO foodDAO = new FoodDAO(); - List foodList = foodDAO.getAllList(); - - OrderDAO orderDAO = new OrderDAO(); - List orderList = orderDAO.getAllList(); - request.setAttribute("foodList", foodList); - request.setAttribute("orderList", orderList); - request.getRequestDispatcher("/staff.jsp").forward(request, response); + doGetList(request, response); } else if (path.endsWith("/staff/")) { response.sendRedirect("/staff"); - } else if (path.startsWith("/staff/food")) { - doGetFood(request, response); } else { // response.setContentType("text/css"); request.getRequestDispatcher("/staff.jsp").forward(request, response); diff --git a/src/main/java/DAOs/FoodDAO.java b/src/main/java/DAOs/FoodDAO.java index 2effa5ce..b8f607d3 100644 --- a/src/main/java/DAOs/FoodDAO.java +++ b/src/main/java/DAOs/FoodDAO.java @@ -38,21 +38,23 @@ public ResultSet getAll() { } public List getAllList() { - ResultSet foodRS = this.getAll(); + ResultSet rs = this.getAll(); List foodList = new ArrayList<>(); + Food food = null; try { - while (foodRS.next()) { - Food food = new Food( - foodRS.getShort("food_id"), - foodRS.getString("food_name"), - foodRS.getString("food_description"), - foodRS.getBigDecimal("food_price"), - foodRS.getByte("food_status"), - foodRS.getByte("food_rate"), - foodRS.getByte("discount_percent"), - foodRS.getString("food_img_url"), - foodRS.getByte("food_type_id"), - this.getFoodType(foodRS.getByte("food_type_id"))); + while (rs.next()) { + food = new Food( + rs.getShort("food_id"), + rs.getString("food_name"), + rs.getString("food_description"), + rs.getBigDecimal("food_price"), + rs.getShort("food_limit"), + rs.getByte("food_status"), + rs.getByte("food_rate"), + rs.getByte("discount_percent"), + rs.getString("food_img_url"), + rs.getByte("food_type_id"), + this.getFoodType(rs.getByte("food_type_id"))); foodList.add(food); } } catch (SQLException ex) { @@ -73,6 +75,7 @@ public Food getFood(short foodID) { rs.getString("food_name"), rs.getString("food_description"), rs.getBigDecimal("food_price"), + rs.getShort("food_limit"), rs.getByte("food_status"), rs.getByte("food_rate"), rs.getByte("discount_percent"), @@ -85,7 +88,7 @@ public Food getFood(short foodID) { } return food; } - + public Food getFood(String food_name) { Food food = null; try { @@ -98,6 +101,7 @@ public Food getFood(String food_name) { rs.getString("food_name"), rs.getString("food_description"), rs.getBigDecimal("food_price"), + rs.getShort("food_limit"), rs.getByte("food_status"), rs.getByte("food_rate"), rs.getByte("discount_percent"), @@ -112,19 +116,19 @@ public Food getFood(String food_name) { } public int add(Food food) { - String sql = "insert into Food (food_name, food_description, food_price, food_status, food_rate, discount_percent, food_img_url, food_type_id) values (?, ?, ?, ?, ?, ?, ?, ?)"; + String sql = "insert into Food (food_name, food_description, food_price, food_limit, food_status, food_rate, discount_percent, food_img_url, food_type_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"; int result = 0; - System.out.println("url: " + food.getImageURL()); try { PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, food.getFoodName()); ps.setString(2, food.getDescription()); ps.setBigDecimal(3, food.getFoodPrice()); - ps.setByte(4, food.getStatus()); - ps.setByte(5, food.getRate()); - ps.setByte(6, food.getDiscountPercent()); - ps.setString(7, food.getImageURL()); - ps.setByte(8, food.getFoodTypeID()); + ps.setShort(4, food.getQuantity()); + ps.setByte(5, food.getStatus()); + ps.setByte(6, food.getRate()); + ps.setByte(7, food.getDiscountPercent()); + ps.setString(8, food.getImageURL()); + ps.setByte(9, food.getFoodTypeID()); result = ps.executeUpdate(); } catch (SQLException ex) { Logger.getLogger(FoodDAO.class.getName()).log(Level.SEVERE, null, ex); @@ -178,26 +182,56 @@ public int deleteMultiple(List foodIDs) { } public int update(Food food) { - String sql = "update Food set food_name = ?, food_description = ?, food_price = ?, food_status = ?, food_rate = ?, discount_percent = ?, food_img_url = ?, food_type_id = ? where food_id = ?"; + String sql = "update Food set food_name = ?, food_description = ?, food_price = ?, food_limit = ?, food_status = ?, food_rate = ?, discount_percent = ?, food_img_url = ?, food_type_id = ? where food_id = ?"; int result = 0; try { PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, food.getFoodName()); - ps.setString(2, food.getDescription()); + ps.setString(2, food.getDescription()); ps.setBigDecimal(3, food.getFoodPrice()); - ps.setByte(4, food.getStatus()); - ps.setByte(5, food.getRate()); - ps.setByte(6, food.getDiscountPercent()); - ps.setString(7, food.getImageURL()); - ps.setByte(8, food.getFoodTypeID()); - ps.setShort(9, food.getFoodID()); + ps.setShort(4, food.getQuantity()); + ps.setByte(5, food.getStatus()); + ps.setByte(6, food.getRate()); + ps.setByte(7, food.getDiscountPercent()); + ps.setString(8, food.getImageURL()); + ps.setByte(9, food.getFoodTypeID()); + ps.setShort(10, food.getFoodID()); result = ps.executeUpdate(); } catch (SQLException ex) { Logger.getLogger(FoodDAO.class.getName()).log(Level.SEVERE, null, ex); } return result; } - + + public int updateQuantityOfFood(Short id, int quantity) { + String selectSql = "SELECT food_limit FROM Food WHERE food_id = ?"; + String updateSql = "UPDATE Food SET food_limit = ? WHERE food_id = ?"; + int result = 0; + + try { + // Get the current food_limit for the given food_id + PreparedStatement selectStatement = conn.prepareStatement(selectSql); + selectStatement.setShort(1, id); + ResultSet resultSet = selectStatement.executeQuery(); + + if (resultSet.next()) { + int currentLimit = resultSet.getShort("food_limit"); + int newLimit = (int) (currentLimit - quantity); + if (newLimit < 0){ + newLimit = 0; + } + // Update the food_limit with the new value + PreparedStatement updateStatement = conn.prepareStatement(updateSql); + updateStatement.setInt(1, newLimit); + updateStatement.setShort(2, id); + result = updateStatement.executeUpdate(); + } + } catch (SQLException ex) { + Logger.getLogger(FoodDAO.class.getName()).log(Level.SEVERE, null, ex); + } + return result; + } + public int updateDiscount(Food food) { String sql = "update Food set discount_percent = ? where food_id = ?"; int result = 0; @@ -243,23 +277,24 @@ public ResultSet searchByName(String txtSearch) { } public List searchByNameList(String txtSearch) { - ResultSet searchRS = searchByName(txtSearch); + ResultSet rs = searchByName(txtSearch); List list = new ArrayList<>(); String query = "select * from Food\n" + "where [food_name] like ?"; try { - while (searchRS.next()) { + while (rs.next()) { Food food = new Food( - searchRS.getShort("food_id"), - searchRS.getString("food_name"), - searchRS.getString("food_description"), - searchRS.getBigDecimal("food_price"), - searchRS.getByte("food_status"), - searchRS.getByte("food_rate"), - searchRS.getByte("discount_percent"), - searchRS.getString("food_img_url"), - searchRS.getByte("food_type_id"), - this.getFoodType(searchRS.getByte("food_type_id"))); + rs.getShort("food_id"), + rs.getString("food_name"), + rs.getString("food_description"), + rs.getBigDecimal("food_price"), + rs.getShort("food_limit"), + rs.getByte("food_status"), + rs.getByte("food_rate"), + rs.getByte("discount_percent"), + rs.getString("food_img_url"), + rs.getByte("food_type_id"), + this.getFoodType(rs.getByte("food_type_id"))); list.add(food); } } catch (SQLException ex) { @@ -282,11 +317,14 @@ public List getCateByCid(String cid) { rs.getString("food_name"), rs.getString("food_description"), rs.getBigDecimal("food_price"), + rs.getShort("food_limit"), rs.getByte("food_status"), rs.getByte("food_rate"), rs.getByte("discount_percent"), rs.getString("food_img_url"), - rs.getByte("food_type_id"))); + rs.getByte("food_type_id"), + this.getFoodType(rs.getByte("food_type_id")) + )); } } catch (Exception e) { } diff --git a/src/main/java/DAOs/OrderDAO.java b/src/main/java/DAOs/OrderDAO.java index 3ac14de9..a3b1dfdc 100644 --- a/src/main/java/DAOs/OrderDAO.java +++ b/src/main/java/DAOs/OrderDAO.java @@ -80,7 +80,8 @@ public Order getOrder(int orderID) { ps.setInt(1, orderID); rs = ps.executeQuery(); if (rs.next()) { - order = new Order(rs.getInt("order_id"), + order = new Order( + rs.getInt("order_id"), rs.getInt("cart_id"), rs.getInt("customer_id"), rs.getByte("order_status_id"), diff --git a/src/main/java/Models/Cart.java b/src/main/java/Models/Cart.java index 078d6946..c7744cab 100644 --- a/src/main/java/Models/Cart.java +++ b/src/main/java/Models/Cart.java @@ -6,6 +6,7 @@ import java.math.BigDecimal; import java.math.BigInteger; +import java.util.ArrayList; import java.util.List; /** @@ -91,17 +92,45 @@ private boolean checkExist(int id) { } public void addItem(CartItem newItem) { - if (checkExist(newItem.getFood().getFoodID())) { - CartItem olditem = getItemById(newItem.getFood().getFoodID()); - // Make sure the quantity does not exceed 10 - if (olditem.getFoodQuantity() + newItem.getFoodQuantity() <= 10) { - olditem.setFoodQuantity(olditem.getFoodQuantity() + newItem.getFoodQuantity()); - } else { - olditem.setFoodQuantity(10); - } + int stockQuantity = newItem.getFood().getQuantity(); + int quantity = newItem.getFoodQuantity(); + int maxQuantity = 10; + int minQuantity = 1; + + if (checkExist(newItem.getFood().getFoodID())) { + CartItem olditem = this.getItemById(newItem.getFood().getFoodID()); + int newQuantity = olditem.getFoodQuantity() + quantity; + + // Same as above + if (newQuantity >= minQuantity && newQuantity <= maxQuantity && stockQuantity >= maxQuantity) { + olditem.setFoodQuantity(newQuantity); + } else if (newQuantity >= minQuantity && newQuantity <= maxQuantity + && stockQuantity >= minQuantity && stockQuantity <= maxQuantity) { + olditem.setFoodQuantity(stockQuantity); + } else if (newQuantity >= minQuantity && newQuantity > maxQuantity) { + olditem.setFoodQuantity(maxQuantity); } else { - items.add(newItem); + olditem.setFoodQuantity(minQuantity); } + } else { + // Make sure the quantity does not exceed 10 and does not exceed the food's stock quantity + // The range of acceptable quantity is [1, 10]. Note that the stock quantity can limit the upper range + // There are 4 cases: + // Case 1: quantity is within the range, and stockQuantity is out of the range + // Case 2: quantity is within the range, but stockQuantity is within the range + // Case 3: quantity is out of the upper range + // Case 4: quantity is out of the lower range + if (quantity > maxQuantity) { + quantity = maxQuantity; + } else if (quantity > stockQuantity) { + quantity = stockQuantity; + } else if (quantity < minQuantity) { + quantity = minQuantity; + } + + newItem.setFoodQuantity(quantity); + items.add(newItem); + } } public void addItemCheckout(CartItem newItem) { diff --git a/src/main/java/Models/Food.java b/src/main/java/Models/Food.java index 889fedf6..342bcec4 100644 --- a/src/main/java/Models/Food.java +++ b/src/main/java/Models/Food.java @@ -13,6 +13,7 @@ public class Food { private String foodName; private String description; private BigDecimal foodPrice; + private Short quantity; private byte status; private byte rate; private byte discountPercent; @@ -70,6 +71,20 @@ public Food(short foodID, String foodName, String description, BigDecimal foodPr this.foodTypeID = foodTypeID; this.foodType = foodType; } + + public Food(short foodID, String foodName, String description, BigDecimal foodPrice, Short quantity, byte status, byte rate, byte discountPercent, String imageURL, byte foodTypeID, String foodType) { + this.foodID = foodID; + this.foodName = foodName; + this.description = description; + this.foodPrice = foodPrice; + this.quantity = quantity; + this.status = status; + this.rate = rate; + this.discountPercent = discountPercent; + this.imageURL = imageURL; + this.foodTypeID = foodTypeID; + this.foodType = foodType; + } public Food(short foodID, byte discountPercent) { this.foodID = foodID; @@ -167,4 +182,12 @@ public byte getRate() { public void setRate(byte rate) { this.rate = rate; } + + public Short getQuantity() { + return quantity; + } + + public void setQuantity(Short quantity) { + this.quantity = quantity; + } } diff --git a/src/main/java/Models/Order.java b/src/main/java/Models/Order.java index 583d3539..10460de2 100644 --- a/src/main/java/Models/Order.java +++ b/src/main/java/Models/Order.java @@ -24,6 +24,7 @@ public class Order { private String orderStatus; private byte paymentMethodID; private String paymentMethod; + private String payment_status; private int voucherID; private String contactPhone; private String deliveryAddress; @@ -283,7 +284,15 @@ public String getLastname() { public void setLastname(String lastname) { this.lastname = lastname; } - + + public String getPayment_status() { + return payment_status; + } + + public void setPayment_status(String payment_status) { + this.payment_status = payment_status; + } + // Method to hash an integer as a string using MD5 public String md5Hash(String input) { try { diff --git a/src/main/webapp/WEB-INF/jspf/admin/components/addFood.jspf b/src/main/webapp/WEB-INF/jspf/admin/components/addFood.jspf index a15d5f1b..086eccd3 100644 --- a/src/main/webapp/WEB-INF/jspf/admin/components/addFood.jspf +++ b/src/main/webapp/WEB-INF/jspf/admin/components/addFood.jspf @@ -29,7 +29,7 @@
- +
@@ -41,6 +41,11 @@
+ +
+ + +
+
+
+ +
+ +
diff --git a/src/main/webapp/WEB-INF/jspf/admin/components/updateOrder.jspf b/src/main/webapp/WEB-INF/jspf/admin/components/updateOrder.jspf index 7515e793..2269b37b 100644 --- a/src/main/webapp/WEB-INF/jspf/admin/components/updateOrder.jspf +++ b/src/main/webapp/WEB-INF/jspf/admin/components/updateOrder.jspf @@ -44,7 +44,7 @@
- +
- \ No newline at end of file + + + diff --git a/src/main/webapp/WEB-INF/jspf/admin/components/updateRole.jspf b/src/main/webapp/WEB-INF/jspf/admin/components/updateRole.jspf index 30db75e2..83788b8a 100644 --- a/src/main/webapp/WEB-INF/jspf/admin/components/updateRole.jspf +++ b/src/main/webapp/WEB-INF/jspf/admin/components/updateRole.jspf @@ -27,10 +27,7 @@
- +
diff --git a/src/main/webapp/WEB-INF/jspf/admin/foods.jspf b/src/main/webapp/WEB-INF/jspf/admin/foods.jspf index cf1c029d..610998f8 100644 --- a/src/main/webapp/WEB-INF/jspf/admin/foods.jspf +++ b/src/main/webapp/WEB-INF/jspf/admin/foods.jspf @@ -12,7 +12,7 @@ Thêm món +