diff --git a/Resources/Categories/book.json b/Resources/Categories/book.json deleted file mode 100644 index 251ad0b2..00000000 --- a/Resources/Categories/book.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"book","details":["publisher","writer"],"subCategories":[]} \ No newline at end of file diff --git a/Resources/Discounts/dis_fuckMavenCode.json b/Resources/Discounts/dis_fuckMavenCode.json index 324382cc..6a600431 100644 --- a/Resources/Discounts/dis_fuckMavenCode.json +++ b/Resources/Discounts/dis_fuckMavenCode.json @@ -1 +1 @@ -{"id":1,"code":"fuckMavenCode","startDate":{"year":2020,"month":6,"day":13},"endDate":{"year":2020,"month":6,"day":26},"maxDiscountAmount":60000,"discountPercent":40,"includedCustomers":{"sadeegh":9,"kure":8}} \ No newline at end of file +{"id":1,"code":"fuckMavenCode","startDate":{"year":2020,"month":6,"day":13},"endDate":{"year":2020,"month":6,"day":26},"maxDiscountAmount":60000,"discountPercent":30,"includedCustomers":{"sadeegh":9,"kure":8}} \ No newline at end of file diff --git a/Resources/GoodsInCarts/goodCart_40.json b/Resources/GoodsInCarts/goodCart_40.json new file mode 100644 index 00000000..2afb0834 --- /dev/null +++ b/Resources/GoodsInCarts/goodCart_40.json @@ -0,0 +1 @@ +{"goodInCartId":40,"goodId":6,"seller":"jafar","number":1} \ No newline at end of file diff --git a/Resources/GoodsInCarts/goodCart_46.json b/Resources/GoodsInCarts/goodCart_46.json new file mode 100644 index 00000000..02bf5fdb --- /dev/null +++ b/Resources/GoodsInCarts/goodCart_46.json @@ -0,0 +1 @@ +{"goodInCartId":46,"goodId":6,"seller":"jafar","number":1} \ No newline at end of file diff --git a/Resources/GoodsInCarts/goodCart_52.json b/Resources/GoodsInCarts/goodCart_52.json new file mode 100644 index 00000000..7e4ded13 --- /dev/null +++ b/Resources/GoodsInCarts/goodCart_52.json @@ -0,0 +1 @@ +{"goodInCartId":52,"goodId":6,"seller":"jafar","number":1} \ No newline at end of file diff --git a/Resources/GoodsInCarts/goodCart_58.json b/Resources/GoodsInCarts/goodCart_58.json new file mode 100644 index 00000000..a74fb8a1 --- /dev/null +++ b/Resources/GoodsInCarts/goodCart_58.json @@ -0,0 +1 @@ +{"goodInCartId":58,"goodId":6,"seller":"jafar","number":1} \ No newline at end of file diff --git a/Resources/GoodsInCarts/goodCart_64.json b/Resources/GoodsInCarts/goodCart_64.json new file mode 100644 index 00000000..3d65c0d7 --- /dev/null +++ b/Resources/GoodsInCarts/goodCart_64.json @@ -0,0 +1 @@ +{"goodInCartId":64,"goodId":1,"seller":"yasaman","number":2} \ No newline at end of file diff --git a/Resources/Orders/OrderForCustomers/order_24.json b/Resources/Orders/OrderForCustomers/order_24.json new file mode 100644 index 00000000..3474a8ff --- /dev/null +++ b/Resources/Orders/OrderForCustomers/order_24.json @@ -0,0 +1 @@ +{"goodsDetails":[40],"discountAmount":0,"address":"shiraz","phoneNumber":"09876543214","postCode":"65748493","name":"yasaman","orderId":24,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"RECEIVED"} \ No newline at end of file diff --git a/Resources/Orders/OrderForCustomers/order_26.json b/Resources/Orders/OrderForCustomers/order_26.json new file mode 100644 index 00000000..604ce4bc --- /dev/null +++ b/Resources/Orders/OrderForCustomers/order_26.json @@ -0,0 +1 @@ +{"goodsDetails":[46],"discountAmount":0,"address":"tehran","phoneNumber":"09876547321","postCode":"768594","name":"ghazal","orderId":26,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"RECEIVED"} \ No newline at end of file diff --git a/Resources/Orders/OrderForCustomers/order_28.json b/Resources/Orders/OrderForCustomers/order_28.json new file mode 100644 index 00000000..069c6d9b --- /dev/null +++ b/Resources/Orders/OrderForCustomers/order_28.json @@ -0,0 +1 @@ +{"goodsDetails":[52],"discountAmount":0,"address":"Iran","phoneNumber":"09876543210","postCode":"980796","name":"sadri","orderId":28,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"RECEIVED"} \ No newline at end of file diff --git a/Resources/Orders/OrderForCustomers/order_30.json b/Resources/Orders/OrderForCustomers/order_30.json new file mode 100644 index 00000000..bc7c14ab --- /dev/null +++ b/Resources/Orders/OrderForCustomers/order_30.json @@ -0,0 +1 @@ +{"goodsDetails":[58],"discountAmount":0,"address":"Iran","phoneNumber":"09876543214","postCode":"768594","name":"hi","orderId":30,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"RECEIVED"} \ No newline at end of file diff --git a/Resources/Orders/OrderForCustomers/order_32.json b/Resources/Orders/OrderForCustomers/order_32.json new file mode 100644 index 00000000..e77357a5 --- /dev/null +++ b/Resources/Orders/OrderForCustomers/order_32.json @@ -0,0 +1 @@ +{"goodsDetails":[64],"discountAmount":0,"address":"Iran","phoneNumber":"09876543214","postCode":"987654","name":"kabir","orderId":32,"date":{"year":2020,"month":6,"day":22},"price":600000,"orderStatus":"RECEIVED"} \ No newline at end of file diff --git a/Resources/Orders/OrderForSellers/order_25.json b/Resources/Orders/OrderForSellers/order_25.json new file mode 100644 index 00000000..60612a28 --- /dev/null +++ b/Resources/Orders/OrderForSellers/order_25.json @@ -0,0 +1 @@ +{"seller":"jafar","customerName":"kure","offDeduct":0,"numberPerGood":{"6":1},"orderId":25,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"SENT"} \ No newline at end of file diff --git a/Resources/Orders/OrderForSellers/order_27.json b/Resources/Orders/OrderForSellers/order_27.json new file mode 100644 index 00000000..e484c1f9 --- /dev/null +++ b/Resources/Orders/OrderForSellers/order_27.json @@ -0,0 +1 @@ +{"seller":"jafar","customerName":"kure","offDeduct":0,"numberPerGood":{"6":1},"orderId":27,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"SENT"} \ No newline at end of file diff --git a/Resources/Orders/OrderForSellers/order_29.json b/Resources/Orders/OrderForSellers/order_29.json new file mode 100644 index 00000000..5b021c03 --- /dev/null +++ b/Resources/Orders/OrderForSellers/order_29.json @@ -0,0 +1 @@ +{"seller":"jafar","customerName":"kure","offDeduct":0,"numberPerGood":{"6":1},"orderId":29,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"SENT"} \ No newline at end of file diff --git a/Resources/Orders/OrderForSellers/order_31.json b/Resources/Orders/OrderForSellers/order_31.json new file mode 100644 index 00000000..5a8f5c1b --- /dev/null +++ b/Resources/Orders/OrderForSellers/order_31.json @@ -0,0 +1 @@ +{"seller":"jafar","customerName":"kure","offDeduct":0,"numberPerGood":{"6":1},"orderId":31,"date":{"year":2020,"month":6,"day":22},"price":50000,"orderStatus":"SENT"} \ No newline at end of file diff --git a/Resources/Orders/OrderForSellers/order_33.json b/Resources/Orders/OrderForSellers/order_33.json new file mode 100644 index 00000000..a6d62370 --- /dev/null +++ b/Resources/Orders/OrderForSellers/order_33.json @@ -0,0 +1 @@ +{"seller":"yasaman","customerName":"kure","offDeduct":400000,"numberPerGood":{"1":2},"orderId":33,"date":{"year":2020,"month":6,"day":22},"price":600000,"orderStatus":"SENT"} \ No newline at end of file diff --git a/Resources/Products/product_1.json b/Resources/Products/product_1.json index 07250a51..6e40ab19 100644 --- a/Resources/Products/product_1.json +++ b/Resources/Products/product_1.json @@ -1 +1 @@ -{"goodId":1,"goodStatus":"CONFIRMED","name":"thinkpad E580","brand":"lenovo","averageRate":6.0,"subCategory":"laptop","sellerRelatedInfoAboutGoods":[1],"details":"nice laptop","comments":[1,2,4],"seenNumber":18,"modificationDate":{"year":2020,"month":5,"day":18},"categoryProperties":{"battery life":"18","cpu":"core i7","weight":"0.3","graphic":"2 GB","ram":"8 GB"}} \ No newline at end of file +{"goodId":1,"goodStatus":"NOTAVAILABLE","name":"thinkpad E580","brand":"lenovo","averageRate":6.0,"subCategory":"laptop","sellerRelatedInfoAboutGoods":[1],"details":"nice laptop","comments":[1,2,4],"seenNumber":18,"modificationDate":{"year":2020,"month":5,"day":18},"categoryProperties":{"battery life":"18","cpu":"core i7","weight":"0.3","graphic":"2 GB","ram":"8 GB"}} \ No newline at end of file diff --git a/Resources/Products/product_6.json b/Resources/Products/product_6.json index 68a43506..21ab4222 100644 --- a/Resources/Products/product_6.json +++ b/Resources/Products/product_6.json @@ -1 +1 @@ -{"goodId":6,"goodStatus":"CONFIRMED","name":"redmi note 8pro","brand":"xiaomi","averageRate":7.0,"subCategory":"mobile","sellerRelatedInfoAboutGoods":[6],"details":"a phone","comments":[3],"seenNumber":15,"modificationDate":{"year":2020,"month":5,"day":18},"categoryProperties":{"battery life":"15","size":"7","weight":"0.4","resolution":"1280"}} \ No newline at end of file +{"goodId":6,"goodStatus":"NOTAVAILABLE","name":"redmi note 8pro","brand":"xiaomi","averageRate":7.0,"subCategory":"mobile","sellerRelatedInfoAboutGoods":[6],"details":"a phone","comments":[3],"seenNumber":15,"modificationDate":{"year":2020,"month":5,"day":18},"categoryProperties":{"battery life":"15","size":"7","weight":"0.4","resolution":"1280"}} \ No newline at end of file diff --git a/Resources/ProductsInfo/productInfo_1_yasaman.json b/Resources/ProductsInfo/productInfo_1_yasaman.json index 726d257b..97ff4646 100644 --- a/Resources/ProductsInfo/productInfo_1_yasaman.json +++ b/Resources/ProductsInfo/productInfo_1_yasaman.json @@ -1 +1 @@ -{"sellerRelatedInfoAboutGoodId":1,"seller":"yasaman","price":500000,"availableNumber":12} \ No newline at end of file +{"sellerRelatedInfoAboutGoodId":1,"seller":"yasaman","price":500000,"availableNumber":0} \ No newline at end of file diff --git a/Resources/ProductsInfo/productInfo_6_jafar.json b/Resources/ProductsInfo/productInfo_6_jafar.json index a4cda100..5fd7d1be 100644 --- a/Resources/ProductsInfo/productInfo_6_jafar.json +++ b/Resources/ProductsInfo/productInfo_6_jafar.json @@ -1 +1 @@ -{"sellerRelatedInfoAboutGoodId":6,"seller":"jafar","price":50000,"availableNumber":1} \ No newline at end of file +{"sellerRelatedInfoAboutGoodId":6,"seller":"jafar","price":50000,"availableNumber":0} \ No newline at end of file diff --git a/Resources/Users/Customers/kure.json b/Resources/Users/Customers/kure.json index b67b1394..7f1d3db3 100644 --- a/Resources/Users/Customers/kure.json +++ b/Resources/Users/Customers/kure.json @@ -1 +1 @@ -{"discountCodesIds":[1,2],"previousOrders":[1,7,9,11,13,15,17,20,22],"credit":107510000,"username":"kure","firstName":"ghahreman","lastName":"kure","email":"kure@gmail.com","phoneNumber":"09980000000","password":"Kure1"} \ No newline at end of file +{"discountCodesIds":[1,2,3],"previousOrders":[1,7,9,11,13,15,17,20,22,24,26,28,30,32],"credit":106710000,"username":"kure","firstName":"ghahreman","lastName":"kure","email":"kure@gmail.com","phoneNumber":"09980000000","password":"Kure1"} \ No newline at end of file diff --git a/Resources/Users/Managers/yas.json b/Resources/Users/Managers/yas.json new file mode 100644 index 00000000..a74b4072 --- /dev/null +++ b/Resources/Users/Managers/yas.json @@ -0,0 +1 @@ +{"username":"yas","firstName":"yasi","lastName":"zolfi","email":"yas@gmail.com","phoneNumber":"09876543241","password":"Yas1"} \ No newline at end of file diff --git a/Resources/Users/Sellers/jafar.json b/Resources/Users/Sellers/jafar.json index 6fa5e8d2..a207d199 100644 --- a/Resources/Users/Sellers/jafar.json +++ b/Resources/Users/Sellers/jafar.json @@ -1 +1 @@ -{"company":2,"previousSellsIds":[4,6,8],"activeGoodsIds":[2,6,16,32],"activeOffsIds":[],"username":"jafar","firstName":"mehdi","lastName":"jafar","email":"jafar@gmail.com","phoneNumber":"09360000000","password":"Jafar1"} \ No newline at end of file +{"company":2,"previousSellsIds":[4,6,8,25,27,29,31],"activeGoodsIds":[2,6,16,32],"activeOffsIds":[],"username":"jafar","firstName":"mehdi","lastName":"jafar","email":"jafar@gmail.com","phoneNumber":"09360000000","password":"Jafar1"} \ No newline at end of file diff --git a/Resources/Users/Sellers/yasaman.json b/Resources/Users/Sellers/yasaman.json index 6df48cf6..e7a51d8d 100644 --- a/Resources/Users/Sellers/yasaman.json +++ b/Resources/Users/Sellers/yasaman.json @@ -1 +1 @@ -{"company":1,"previousSellsIds":[2,10,12,14,16,18,21,23],"activeGoodsIds":[1,2,7,24],"activeOffsIds":[2,3,4],"username":"yasaman","firstName":"yasaman","lastName":"zolfi","email":"yasamanzolfi@gmail.com","phoneNumber":"09120000000","password":"Yasaman1"} \ No newline at end of file +{"company":1,"previousSellsIds":[2,10,12,14,16,18,21,23,33],"activeGoodsIds":[1,2,7,24],"activeOffsIds":[2,3,4],"username":"yasaman","firstName":"yasaman","lastName":"zolfi","email":"yasamanzolfi@gmail.com","phoneNumber":"09120000000","password":"Yasaman1"} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 07caf39e..5544e10d 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,14 @@ win + + + org.openjfx + javafx-media + 11 + + + diff --git a/src/main/java/ApProject_OnlineShop/GUI/ErrorPageFxController.java b/src/main/java/ApProject_OnlineShop/GUI/ErrorPageFxController.java index 48f4fa1f..dec501f5 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/ErrorPageFxController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/ErrorPageFxController.java @@ -36,6 +36,7 @@ public void initialize(URL location, ResourceBundle resources) { } public static void showPage(String errorTitle, String errorContent) { + playErrorMusic(); ErrorPageFxController.errorTitle = errorTitle; ErrorPageFxController.errorContent = errorContent; window = new Stage(); diff --git a/src/main/java/ApProject_OnlineShop/GUI/FxmlController.java b/src/main/java/ApProject_OnlineShop/GUI/FxmlController.java index 192effa0..bae44025 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/FxmlController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/FxmlController.java @@ -1,19 +1,28 @@ package ApProject_OnlineShop.GUI; -import ApProject_OnlineShop.Main; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; import javafx.stage.Stage; +import javafx.scene.media.AudioClip; import java.io.IOException; +import java.net.URL; +import java.nio.file.Paths; import java.util.Optional; +import java.util.concurrent.TimeUnit; + +import static javafx.scene.media.AudioClip.INDEFINITE; public class FxmlController { + private static boolean isMainLayoutPlay; + private static boolean isAccountAreaPlay; + private static boolean isAllProductPlay; public void setScene(String address, String title) { + playButtonMusic(); Stage stage = StageController.getStage(); Parent rootParent = null; try { @@ -35,4 +44,74 @@ public Optional showAlert(Alert.AlertType alertType, String title, S return alert.showAndWait(); } + public static void playButtonMusic() { + String resource2 = Paths.get("src/main/resources/musics/buttonsEffects/Keyboard_Button_1-fesliyanstudios.com.mp3").toUri().toString(); + realPlay(resource2); + } + + public static void playErrorMusic() { + String resource2 = Paths.get("src/main/resources/musics/buttonsEffects/Error-sound.mp3").toUri().toString(); + realPlay(resource2); + } + + public static void playSuccessMusic() { + String resource2 = Paths.get("src/main/resources/musics/buttonsEffects/Success-sound-effect (mp3cut.net).mp3").toUri().toString(); + realPlay(resource2); + } + + private static void realPlay(String url) { + AudioClip audioClip = new AudioClip(url); + audioClip.setVolume(0.2); + audioClip.play(); + try { + TimeUnit.MILLISECONDS.sleep(150); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + private static void playMusicForMainLayout(boolean show) { + AudioClip audioClip = new AudioClip(Paths.get("src/main/resources/musics/mainLayout.mp3").toUri().toString()); + audioClip.setVolume(0.05); + audioClip.setCycleCount(INDEFINITE); + if (show) { + audioClip.play(); + } else { + audioClip.stop(); + } + } + + private static void playMusicForAllProducts(boolean show) { + AudioClip audioClip = new AudioClip(Paths.get("src/main/resources/musics/allProducts.mp3").toUri().toString()); + audioClip.setVolume(0.05); + audioClip.setCycleCount(INDEFINITE); + if (show) { + audioClip.play(); + } else { + audioClip.stop(); + } + } + + private static void playMusicForAccountArea(boolean show) { + AudioClip audioClip = new AudioClip(Paths.get("src/main/resources/musics/accountArea.mp3").toUri().toString()); + audioClip.setVolume(0.05); + audioClip.setCycleCount(INDEFINITE); + if (show) { + audioClip.play(); + } else { + audioClip.stop(); + } + } + + public static void playMusicBackGround(boolean mainLayout, boolean allProducts, boolean accountArea) { + if (mainLayout == isMainLayoutPlay && allProducts == isAllProductPlay && accountArea == isAccountAreaPlay) + return; + playMusicForMainLayout(mainLayout); + playMusicForAccountArea(accountArea); + playMusicForAllProducts(allProducts); + isMainLayoutPlay = mainLayout; + isAccountAreaPlay = accountArea; + isAllProductPlay = allProducts; + } + } diff --git a/src/main/java/ApProject_OnlineShop/GUI/StageController.java b/src/main/java/ApProject_OnlineShop/GUI/StageController.java index d65abbbc..9613164b 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/StageController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/StageController.java @@ -40,8 +40,6 @@ public StageController() { Parent root = null; try { root = FXMLLoader.load(Objects.requireNonNull(getClass().getClassLoader().getResource("mainMenuLayout.fxml"))); -// ProductPage.setProductId(6); -// root = FXMLLoader.load(Objects.requireNonNull(getClass().getClassLoader().getResource("productPage.fxml"))); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/ApProject_OnlineShop/GUI/SuccessPageFxController.java b/src/main/java/ApProject_OnlineShop/GUI/SuccessPageFxController.java index 97cc68a8..af8349ed 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/SuccessPageFxController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/SuccessPageFxController.java @@ -36,6 +36,7 @@ public void initialize(URL location, ResourceBundle resources) { } public static void showPage(String successTitle, String successContent) { + playSuccessMusic(); SuccessPageFxController.successTitle = successTitle; SuccessPageFxController.successContent = successContent; window = new Stage(); diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/AccountAreaForCustomerController.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/AccountAreaForCustomerController.java index 89783aca..8a577d9f 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/AccountAreaForCustomerController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/AccountAreaForCustomerController.java @@ -35,6 +35,7 @@ public class AccountAreaForCustomerController extends FxmlController implements @Override public void initialize(URL url, ResourceBundle resourceBundle) { + playMusicBackGround(false, false, true); ArrayList personalInfo = MainController.getInstance().getAccountAreaForCustomerController().getUserPersonalInfo(); userName.setText(personalInfo.get(0)); name.setText(personalInfo.get(1)); @@ -49,6 +50,7 @@ public void viewDiscountCode() { } public void viewSortedDiscountCode(int sort) { + playButtonMusic(); GridPane root = style.makeGridPane(); Label topic = new Label("Discount codes"); topic.setFont(Font.font("Times New Roman", 26)); @@ -103,6 +105,7 @@ public void viewSortedDiscountCode(int sort) { } public void viewSingleDiscountCode(String summeryOfDiscountCode) { + playButtonMusic(); int index = summeryOfDiscountCode.indexOf(" "); String code = summeryOfDiscountCode.substring("discount code:".length(), index); List discountCodeDetails = Shop.getInstance().findDiscountCode(code).getAllDetails(); diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/RateProductsController.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/RateProductsController.java index 952a3332..ca915c26 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/RateProductsController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/RateProductsController.java @@ -37,6 +37,15 @@ public void initialize(URL location, ResourceBundle resources) { List productIds = MainController.getInstance().getAccountAreaForCustomerController().getBoughtProducts(); int num = 0; int row = 0; + if (productIds.size() % 3 == 0) { + if (((productIds.size() / 3) + 0) * 250 > 577) { + root.setPrefHeight(((productIds.size() / 3) + 0) * 250); + } + } else { + if (((productIds.size() / 3) + 1) * 250 > 577) { + root.setPrefHeight(((productIds.size() / 3) + 1) * 250); + } + } for (Long productId : productIds) { VBox vbox; if (MainController.getInstance().getAccountAreaForSellerController().isInOff(productId)) { @@ -56,9 +65,6 @@ public void initialize(URL location, ResourceBundle resources) { if (num % 3 == 0) row++; } - if (productIds.size()/3 * 250 > 577) { - root.setPrefHeight(productIds.size() * 250); - } } private void rateProduct(long productId2) { diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/ViewOrders.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/ViewOrders.java index 4a8b2b69..bb231036 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/ViewOrders.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForCustomer/ViewOrders.java @@ -29,6 +29,7 @@ public ViewOrders(AccountAreaForCustomerController controller) { } public void viewSortedOrders(int sort) { + playButtonMusic(); GridPane root = style.makeGridPane(); Label topic = new Label("All Orders"); topic.setFont(Font.font("Times New Roman", 26)); @@ -80,6 +81,7 @@ public void viewSortedOrders(int sort) { } public void viewSingleOrder(String orderString) { + playButtonMusic(); int index = orderString.indexOf(" "); String code = orderString.substring("order ID: ".length(), index); long orderId = Long.parseLong(code); diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/AccountAreaForManagerFxController.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/AccountAreaForManagerFxController.java index 58e91720..9c0f3015 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/AccountAreaForManagerFxController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/AccountAreaForManagerFxController.java @@ -72,6 +72,7 @@ public void onCreateNewDiscountPressed() { @Override public void initialize(URL location, ResourceBundle resources) { + playMusicBackGround(false, false, true); ArrayList personalInfo = MainController.getInstance().getAccountAreaForManagerController().getUserPersonalInfo(); userName.setText(personalInfo.get(0)); name.setText(personalInfo.get(1)); diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/ManageAllProductsPageController.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/ManageAllProductsPageController.java index 93d11c08..dc1d5f6d 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/ManageAllProductsPageController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForManager/ManageAllProductsPageController.java @@ -81,7 +81,12 @@ private void updatePage() { List productIds = Shop.getInstance().getAllGoods().stream().map(Good::getGoodId).collect(Collectors.toList()); int num = 0; int row = 0; - int size1 = productIds.size() * 250 / 3; + int size1 ; + if (productIds.size() % 3 == 0) { + size1 = productIds.size() * 250 / 3; + } else { + size1 = ((productIds.size() / 3) + 1) * 250; + } if (size1 > 577) { root.setPrefHeight(size1); } diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/AccountAreaForSellerController.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/AccountAreaForSellerController.java index ab377551..6c7f41d4 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/AccountAreaForSellerController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/AccountAreaForSellerController.java @@ -28,6 +28,7 @@ public class AccountAreaForSellerController extends FxmlController implements In @Override public void initialize(URL url, ResourceBundle resourceBundle) { + playMusicBackGround(false, false, true); ArrayList personalInfo = MainController.getInstance().getAccountAreaForSellerController().getUserPersonalInfo(); userName.setText(personalInfo.get(0)); name.setText(personalInfo.get(1)); diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ManageProduct.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ManageProduct.java index f51ef2eb..4b2176c6 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ManageProduct.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ManageProduct.java @@ -29,6 +29,15 @@ public void initialize(URL location, ResourceBundle resources) { List productIds = MainController.getInstance().getAccountAreaForSellerController().viewProducts(sortSelected); int num = 0; int row = 0; + int size1; + if (productIds.size() % 3 == 0) { + size1 = productIds.size() * 250 / 3; + } else { + size1 = ((productIds.size() / 3) + 1) * 250; + } + if (size1 > 577) { + root.setPrefHeight(size1); + } for (Long productId : productIds) { if (MainController.getInstance().getAccountAreaForSellerController().isInOff(productId)) { VBox vbox = new ProductBriefSummery().offProductBriefSummery(productId); @@ -47,10 +56,6 @@ public void initialize(URL location, ResourceBundle resources) { if (num % 3 == 0) row++; } - int size1 = productIds.size() * 250 / 3; - if (size1 > 577) { - root.setPrefHeight(size1); - } } private void showProduct(Long productId) { diff --git a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ViewOrdersForSeller.java b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ViewOrdersForSeller.java index 7e69c506..a881611b 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ViewOrdersForSeller.java +++ b/src/main/java/ApProject_OnlineShop/GUI/accountArea/accountAreaForSeller/ViewOrdersForSeller.java @@ -20,6 +20,7 @@ public class ViewOrdersForSeller extends FxmlController { private Styles style = new Styles(); public void viewSortedOrders(int sort) { + playButtonMusic(); GridPane root = style.makeGridPane(); Label topic = new Label("Sales History"); topic.setFont(Font.font("Times New Roman", 26)); @@ -65,6 +66,7 @@ public void viewSortedOrders(int sort) { } public void viewSingleOrder(String orderString) { + playButtonMusic(); int index = orderString.indexOf(" "); String code = orderString.substring("order ID: ".length(), index); long orderId = Long.parseLong(code); diff --git a/src/main/java/ApProject_OnlineShop/GUI/mainMenu/MainMenuController.java b/src/main/java/ApProject_OnlineShop/GUI/mainMenu/MainMenuController.java index f2b6859b..213acdfc 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/mainMenu/MainMenuController.java +++ b/src/main/java/ApProject_OnlineShop/GUI/mainMenu/MainMenuController.java @@ -37,16 +37,16 @@ public class MainMenuController extends FxmlController implements Initializable public void accountAreaButtonPressed(ActionEvent actionEvent) { if (MainController.getInstance().getCurrentPerson() == null) { LoginController.setPathBack("mainMenuLayout.fxml", "main menu"); - LoginController.setPathAfterLogin(null,null); + LoginController.setPathAfterLogin(null, null); setScene("login.fxml", "Login or Register"); } else if (MainController.getInstance().getCurrentPerson() instanceof Customer) { - AccountAreaForCustomerController.setPathBack("mainMenuLayout.fxml","main menu"); + AccountAreaForCustomerController.setPathBack("mainMenuLayout.fxml", "main menu"); setScene("accountAreaForCustomer.fxml", "account area"); } else if (MainController.getInstance().getCurrentPerson() instanceof Seller) { - AccountAreaForSellerController.setPathBack("mainMenuLayout.fxml","main menu"); + AccountAreaForSellerController.setPathBack("mainMenuLayout.fxml", "main menu"); setScene("accountAreaForSeller.fxml", "account area"); } else if (MainController.getInstance().getCurrentPerson() instanceof Manager) { - AccountAreaForManagerFxController.setPathBack("mainMenuLayout.fxml","main menu"); + AccountAreaForManagerFxController.setPathBack("mainMenuLayout.fxml", "main menu"); setScene("accountAreaForManager.fxml", "account area"); } } @@ -70,6 +70,7 @@ public void cart() { @Override public void initialize(URL location, ResourceBundle resources) { + playMusicBackGround(true, false, false); if (MainController.getInstance().getCurrentPerson() instanceof Customer || MainController.getInstance().getCurrentPerson() == null) { ImageView imageView = new ImageView(new Image("/pictures/shoppingBag.png")); gridpane.add(imageView, 2, 0); diff --git a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/AllProductsPage.java b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/AllProductsPage.java index 2c0c185e..ffb1bad4 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/AllProductsPage.java +++ b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/AllProductsPage.java @@ -46,9 +46,11 @@ public class AllProductsPage extends FxmlController implements Initializable { public Label rateSort; public Label dateSort; public ImageView shoppingBag; + public GridPane mainGridPane; @Override public void initialize(URL url, ResourceBundle resourceBundle) { + playMusicBackGround(false, true, false); if (MainController.getInstance().getCurrentPerson() instanceof Manager || MainController.getInstance().getCurrentPerson() instanceof Seller) shoppingBag.setVisible(false); handleSorts(); @@ -180,6 +182,17 @@ public void setProducts() { if (num % 3 == 0) row++; } + if (MainController.getInstance().getAllProductsController().getGoods().size() == 0) + return; + if ((MainController.getInstance().getAllProductsController().getGoods().size() % 3 != 0)) { + if ((((MainController.getInstance().getAllProductsController().getGoods().size() / 3) + 1) * 250) > 1067) { + mainGridPane.setPrefHeight((((MainController.getInstance().getAllProductsController().getGoods().size() / 3) + 1) * 250) + 133); + } + } else { + if ((((MainController.getInstance().getAllProductsController().getGoods().size() / 3) + 0) * 250) > 1067) { + mainGridPane.setPrefHeight((((MainController.getInstance().getAllProductsController().getGoods().size() / 3) + 0) * 250) + 133); + } + } } public void handleSorts() { @@ -201,7 +214,7 @@ public void sort(int chosenSort) { private void showProduct(Long productId) { ProductPage.setProductId(productId); - ProductPage.setPathBack("allProducts.fxml","all products"); + ProductPage.setPathBack("allProducts.fxml", "all products"); setScene("productPage.fxml", "product page"); } @@ -308,16 +321,16 @@ public void onCart(MouseEvent mouseEvent) { public void onAccountArea(MouseEvent mouseEvent) { if (MainController.getInstance().getCurrentPerson() == null) { LoginController.setPathBack("allProducts.fxml", "All products"); - LoginController.setPathAfterLogin(null,null); + LoginController.setPathAfterLogin(null, null); setScene("login.fxml", "login"); } else if (MainController.getInstance().getCurrentPerson() instanceof Customer) { - AccountAreaForCustomerController.setPathBack("allProducts.fxml","all products"); + AccountAreaForCustomerController.setPathBack("allProducts.fxml", "all products"); setScene("accountAreaForCustomer.fxml", "account area"); } else if (MainController.getInstance().getCurrentPerson() instanceof Seller) { - AccountAreaForSellerController.setPathBack("allProducts.fxml","all products"); + AccountAreaForSellerController.setPathBack("allProducts.fxml", "all products"); setScene("accountAreaForSeller.fxml", "account area"); } else if (MainController.getInstance().getCurrentPerson() instanceof Manager) { - AccountAreaForManagerFxController.setPathBack("allProducts.fxml","all products"); + AccountAreaForManagerFxController.setPathBack("allProducts.fxml", "all products"); setScene("accountAreaForManager.fxml", "account area"); } } diff --git a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/Cart.java b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/Cart.java index a762e6b0..d5f8250e 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/Cart.java +++ b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/Cart.java @@ -4,6 +4,7 @@ import ApProject_OnlineShop.GUI.FxmlController; import ApProject_OnlineShop.GUI.loginRegister.LoginController; import ApProject_OnlineShop.controller.MainController; +import ApProject_OnlineShop.model.Shop; import ApProject_OnlineShop.model.persons.Customer; import javafx.fxml.Initializable; import javafx.geometry.Insets; @@ -12,14 +13,13 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; -import javafx.scene.layout.Border; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.control.Label; +import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; -import java.awt.*; import java.net.URL; import java.nio.file.Paths; import java.util.List; @@ -83,7 +83,6 @@ public void initialize(URL url, ResourceBundle resourceBundle) { numberBox.setStyle("-fx-border-color:#000000;-fx-border-width: 1; -fx-border-style: solid;"); Label plus = new Label(" +"); plus.setFont(Font.font("Times New Roman", 18)); -// plus.setStyle("-fx-font-weight: bold;"); plus.setCursor(Cursor.HAND); plus.setOnMouseClicked(e -> increaseProduct(productId)); numberBox.getChildren().add(plus); @@ -94,24 +93,42 @@ public void initialize(URL url, ResourceBundle resourceBundle) { Label minus = new Label("- "); minus.setFont(Font.font("Times New Roman", 22)); minus.setPadding(new Insets(0, 0, 4, 0)); -// minus.setStyle("-fx-font-weight: bold;"); minus.setCursor(Cursor.HAND); minus.setOnMouseClicked(e -> decreaseProduct(productId)); numberBox.getChildren().add(minus); hBox.getChildren().add(numberBox); HBox priceBox = new HBox(); - priceBox.setMinWidth(270); - priceBox.setAlignment(Pos.CENTER_RIGHT); + priceBox.setAlignment(Pos.CENTER); Label price = new Label(goodInfo.get(3) + " Rials"); - price.setFont(Font.font("Times New Roman", 16)); + price.setFont(Font.font("Times New Roman", 14)); price.setPadding(new Insets(0, 15, 0, 15)); priceBox.getChildren().add(price); hBox.getChildren().add(priceBox); + HBox totalPriceBox = new HBox(); + totalPriceBox.setAlignment(Pos.CENTER_RIGHT); + Label totalPrice = new Label(goodInfo.get(4) + " Rials"); + totalPrice.setFont(Font.font("Times New Roman", 14)); + totalPrice.setPadding(new Insets(0, 15, 0, 15)); + totalPriceBox.getChildren().add(totalPrice); + hBox.getChildren().add(totalPriceBox); textFieldVBox.getChildren().add(hBox); items.getChildren().add(productBox); } + if (productIds.size() > 0) { + HBox priceBox = new HBox(); + priceBox.setAlignment(Pos.CENTER); + Label text = new Label("total price is"); + text.setFont(Font.font("Times New Roman", 16)); + priceBox.getChildren().add(text); + Label finalPrice = new Label(" " + MainController.getInstance().getAccountAreaForCustomerController().finalPriceOfAList(Shop.getInstance().getCart()) + " Rials"); + finalPrice.setFont(Font.font("Times New Roman", 16)); + finalPrice.setTextFill(Color.RED); + HBox.setMargin(finalPrice, new Insets(8, 8, 8, 8)); + priceBox.getChildren().add(finalPrice); + items.getChildren().add(priceBox); + } if (150 * productIds.size() > 540) { - items.setPrefHeight(150 * productIds.size() + 1); + items.setPrefHeight(150 * productIds.size() + 50); } } @@ -142,18 +159,18 @@ public void increaseProduct(long productId) { } public void purchase() { - if (MainController.getInstance().getCurrentPerson()instanceof Customer){ + if (MainController.getInstance().getCurrentPerson() instanceof Customer) { setScene("purchasePage1.fxml", "purchase"); - }else if (MainController.getInstance().getCurrentPerson() == null){ - LoginController.setPathAfterLogin("purchasePage1.fxml","purchase"); + } else if (MainController.getInstance().getCurrentPerson() == null) { + LoginController.setPathAfterLogin("purchasePage1.fxml", "purchase"); LoginController.setPathBack("cart.fxml", "cart"); - setScene("login.fxml","login"); + setScene("login.fxml", "login"); } } public void showProduct(long productId) { ProductPage.setProductId(productId); - ProductPage.setPathBack("cart.fxml","cart"); + ProductPage.setPathBack("cart.fxml", "cart"); setScene("productPage.fxml", "productPage"); } diff --git a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CommentsPage.java b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CommentsPage.java index 5fc99231..6c3369dc 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CommentsPage.java +++ b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CommentsPage.java @@ -49,6 +49,10 @@ public void initialize(URL location, ResourceBundle resources) { cart.setVisible(false); } ArrayList comments = Shop.getInstance().findGoodById(goodId).getComments(); + int size1 = (comments.size() * (110)); + if (size1 > 577) { + vbox.setPrefWidth(size1 + 20); + } for (Comment comment : comments) { GridPane gridPane = new GridPane(); HBox writer = new HBox(); @@ -97,10 +101,6 @@ public void initialize(URL location, ResourceBundle resources) { "-fx-border-style: solid;" + "-fx-background-color: linear-gradient(to bottom right, #ffb3ff, #ffffff);"); } - int size1 = (comments.size() * (110)); - if (size1 > 577) { - vbox.setPrefWidth(size1 + 20); - } } public void backButton(ActionEvent actionEvent) { diff --git a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CompareProductPart1Controller.java b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CompareProductPart1Controller.java index 3402e1d0..2f8a6fe5 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CompareProductPart1Controller.java +++ b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/CompareProductPart1Controller.java @@ -34,6 +34,15 @@ public void initialize(URL location, ResourceBundle resources) { productIds.remove(Shop.getInstance().findGoodById(MainController.getInstance().getProductController().getGood().getGoodId())); int num = 0; int row = 0; + if (productIds.size() % 3 == 0) { + if (productIds.size() / 3 * 250 > 577) { + root.setPrefHeight(productIds.size() * 250 / 3); + } + } else { + if (((productIds.size() / 3) + 1) * 250 > 577) { + root.setPrefHeight(((productIds.size() / 3) + 1) * 250); + } + } for (Long productId : productIds) { VBox vbox; if (Shop.getInstance().getOffGoods().contains(Shop.getInstance().findGoodById(productId))) { @@ -53,9 +62,6 @@ public void initialize(URL location, ResourceBundle resources) { if (num % 3 == 0) row++; } - if (productIds.size() / 3 * 250 > 577) { - root.setPrefHeight(productIds.size() * 250); - } } private void compare(long productId2) { @@ -74,17 +80,17 @@ public void backButton(ActionEvent actionEvent) { public void goToAccountArea(MouseEvent mouseEvent) { if (MainController.getInstance().getCurrentPerson() == null) { - LoginController.setPathAfterLogin(null,null); + LoginController.setPathAfterLogin(null, null); LoginController.setPathBack("allProductsForCompareProduct.fxml", "All products"); setScene("login.fxml", "login"); } else if (MainController.getInstance().getCurrentPerson() instanceof Customer) { - AccountAreaForCustomerController.setPathBack("allProductsForCompareProduct.fxml","All products"); + AccountAreaForCustomerController.setPathBack("allProductsForCompareProduct.fxml", "All products"); setScene("accountAreaForCustomer.fxml", "account area"); } else if (MainController.getInstance().getCurrentPerson() instanceof Seller) { - AccountAreaForSellerController.setPathBack("allProductsForCompareProduct.fxml","All products"); + AccountAreaForSellerController.setPathBack("allProductsForCompareProduct.fxml", "All products"); setScene("accountAreaForSeller.fxml", "account area"); } else if (MainController.getInstance().getCurrentPerson() instanceof Manager) { - AccountAreaForManagerFxController.setPathBack("allProductsForCompareProduct.fxml","All products"); + AccountAreaForManagerFxController.setPathBack("allProductsForCompareProduct.fxml", "All products"); setScene("accountAreaForManager.fxml", "account area"); } } diff --git a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/ProductBriefSummery.java b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/ProductBriefSummery.java index f5c82aae..60ad5532 100644 --- a/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/ProductBriefSummery.java +++ b/src/main/java/ApProject_OnlineShop/GUI/productPageRelated/ProductBriefSummery.java @@ -3,6 +3,7 @@ import ApProject_OnlineShop.GUI.StageController; import ApProject_OnlineShop.controller.MainController; import ApProject_OnlineShop.model.Shop; +import ApProject_OnlineShop.model.productThings.Good; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; @@ -27,13 +28,24 @@ public VBox getProductForAllProductsPage(long productId) { VBox mainVBox = new VBox(); setStyleForVBox(mainVBox); mainVBox.setAlignment(Pos.CENTER); + if (Shop.getInstance().findGoodById(productId).getGoodStatus() != Good.GoodStatus.CONFIRMED) { + HBox box = new HBox(); + box.setMaxHeight(25); + box.setAlignment(Pos.CENTER); + Label available = new Label("not available"); + available.setTextFill(Color.RED); + box.getChildren().add(available); + mainVBox.getChildren().add(box); + } ImageView imageView = new ImageView(new Image(Paths.get("Resources/productImages/" + productId + ".jpg").toUri().toString())); + if (Shop.getInstance().findGoodById(productId).getGoodStatus() != Good.GoodStatus.CONFIRMED) + imageView.setOpacity(0.5); VBox image = new VBox(); image.getChildren().add(imageView); mainVBox.getChildren().add(image); image.setMaxSize(150, 150); - imageView.setFitHeight(150); - imageView.setFitWidth(150); + imageView.setFitHeight(130); + imageView.setFitWidth(130); VBox nameVBox = new VBox(); nameVBox.setAlignment(Pos.CENTER_LEFT); Label name = new Label(goodInfo.get(0)); @@ -80,17 +92,27 @@ public VBox offProductBriefSummery(long productId) { VBox mainVBox = new VBox(); setStyleForVBox(mainVBox); mainVBox.setAlignment(Pos.CENTER); - VBox leftDays = new VBox(); - leftDays.setMaxHeight(30); - leftDays.setMaxHeight(30); - leftDays.setAlignment(Pos.CENTER); + HBox offBox = new HBox(); + offBox.setMaxHeight(30); + Label percent = new Label("" + Shop.getInstance().findGoodById(productId).getThisGoodOff().getDiscountPercent() + "%"); + percent.setTextFill(Color.RED); + HBox.setMargin(percent, new Insets(0, 20, 0, 5)); + offBox.getChildren().add(percent); LocalDate date = Shop.getInstance().findGoodById(productId).getThisGoodOff().getEndDate(); Label days = new Label("" + ChronoUnit.DAYS.between(LocalDate.now(), date) + " days left"); days.setTextFill(Color.RED); days.setUnderline(true); - leftDays.getChildren().add(days); - mainVBox.getChildren().add(leftDays); + offBox.getChildren().add(days); + if (Shop.getInstance().findGoodById(productId).getGoodStatus() != Good.GoodStatus.CONFIRMED) { + Label available = new Label("not available"); + available.setTextFill(Color.RED); + HBox.setMargin(available, new Insets(0, 0, 0, 10)); + offBox.getChildren().add(available); + } + mainVBox.getChildren().add(offBox); ImageView imageView = new ImageView(new Image(Paths.get("Resources/productImages/" + productId + ".jpg").toUri().toString())); + if (Shop.getInstance().findGoodById(productId).getGoodStatus() != Good.GoodStatus.CONFIRMED) + imageView.setOpacity(0.5); VBox image = new VBox(); image.getChildren().add(imageView); mainVBox.getChildren().add(image); diff --git a/src/main/java/ApProject_OnlineShop/controller/accountArea/AccountAreaForCustomerController.java b/src/main/java/ApProject_OnlineShop/controller/accountArea/AccountAreaForCustomerController.java index 1bdc6d38..ba664e35 100644 --- a/src/main/java/ApProject_OnlineShop/controller/accountArea/AccountAreaForCustomerController.java +++ b/src/main/java/ApProject_OnlineShop/controller/accountArea/AccountAreaForCustomerController.java @@ -54,6 +54,7 @@ public List viewGoodInCartById(long productId) { goodInfo.add(good.getGood().getName() + " " + good.getGood().getBrand()); goodInfo.add(good.getSeller().getUsername()); goodInfo.add("" + good.getNumber()); + goodInfo.add("" + Shop.getInstance().getFinalPriceOfAGood(good.getGood(),good.getSeller())); goodInfo.add("" + good.getFinalPrice()); return goodInfo; } @@ -212,6 +213,7 @@ public void reduceAvailableNumberOfGoodsAfterPurchase() throws IOException, File break; } } + Database.getInstance().saveItem(good.getGood()); } } diff --git a/src/main/java/ApProject_OnlineShop/model/productThings/Good.java b/src/main/java/ApProject_OnlineShop/model/productThings/Good.java index b7ce0f20..ccc5cd35 100644 --- a/src/main/java/ApProject_OnlineShop/model/productThings/Good.java +++ b/src/main/java/ApProject_OnlineShop/model/productThings/Good.java @@ -186,13 +186,15 @@ public void addComment(Comment comment) { } public void reduceAvailableNumber(Seller seller, int reductionNumber) { + int goodNumber =0 ; for (SellerRelatedInfoAboutGood sellerInfo : getSellerRelatedInfoAboutGoods()) { if (sellerInfo.getSeller() == seller) { sellerInfo.setAvailableNumber(sellerInfo.getAvailableNumber() - reductionNumber); - if (sellerInfo.getAvailableNumber() == 0) - goodStatus = GoodStatus.NOTAVAILABLE; } + goodNumber += sellerInfo.getAvailableNumber(); } + if (goodNumber == 0) + goodStatus = GoodStatus.NOTAVAILABLE; } public boolean doesExistInSellerList(Seller seller) { diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index ba93ecc3..aed6743c 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -6,6 +6,7 @@ requires yagson; requires com.google.gson; requires java.desktop; + requires javafx.media; /* opens ApProject_OnlineShop; opens ApProject_OnlineShop.GUI; diff --git a/src/main/resources/allProducts.fxml b/src/main/resources/allProducts.fxml index bd9ec06d..f944f71a 100644 --- a/src/main/resources/allProducts.fxml +++ b/src/main/resources/allProducts.fxml @@ -9,14 +9,14 @@ - + - + @@ -96,7 +96,7 @@ - + @@ -288,7 +288,7 @@ - + diff --git a/src/main/resources/musics/accountArea.mp3 b/src/main/resources/musics/accountArea.mp3 new file mode 100644 index 00000000..7f535a0d Binary files /dev/null and b/src/main/resources/musics/accountArea.mp3 differ diff --git a/src/main/resources/musics/allProducts.mp3 b/src/main/resources/musics/allProducts.mp3 new file mode 100644 index 00000000..33d9d4b6 Binary files /dev/null and b/src/main/resources/musics/allProducts.mp3 differ diff --git a/src/main/resources/musics/buttonsEffects/Error-sound.mp3 b/src/main/resources/musics/buttonsEffects/Error-sound.mp3 new file mode 100644 index 00000000..ffe6e67b Binary files /dev/null and b/src/main/resources/musics/buttonsEffects/Error-sound.mp3 differ diff --git a/src/main/resources/musics/buttonsEffects/Keyboard_Button_1-fesliyanstudios.com.mp3 b/src/main/resources/musics/buttonsEffects/Keyboard_Button_1-fesliyanstudios.com.mp3 new file mode 100644 index 00000000..f5221bdf Binary files /dev/null and b/src/main/resources/musics/buttonsEffects/Keyboard_Button_1-fesliyanstudios.com.mp3 differ diff --git a/src/main/resources/musics/buttonsEffects/Success-sound-effect (mp3cut.net).mp3 b/src/main/resources/musics/buttonsEffects/Success-sound-effect (mp3cut.net).mp3 new file mode 100644 index 00000000..035ed49e Binary files /dev/null and b/src/main/resources/musics/buttonsEffects/Success-sound-effect (mp3cut.net).mp3 differ diff --git a/src/main/resources/musics/mainLayout.mp3 b/src/main/resources/musics/mainLayout.mp3 new file mode 100644 index 00000000..447ec8c0 Binary files /dev/null and b/src/main/resources/musics/mainLayout.mp3 differ diff --git a/target/classes/allProducts.fxml b/target/classes/allProducts.fxml index bd9ec06d..f944f71a 100644 --- a/target/classes/allProducts.fxml +++ b/target/classes/allProducts.fxml @@ -9,14 +9,14 @@ - + - + @@ -96,7 +96,7 @@ - + @@ -288,7 +288,7 @@ - +