Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Table #63

Merged
merged 6 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/org/chainoptim/desktop/AppModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.chainoptim.desktop.core.user.service.*;
import org.chainoptim.desktop.features.client.model.Client;
import org.chainoptim.desktop.features.client.model.ClientOrder;
import org.chainoptim.desktop.features.client.model.ClientShipment;
import org.chainoptim.desktop.features.client.service.*;
import org.chainoptim.desktop.features.factory.model.Factory;
import org.chainoptim.desktop.features.factory.model.FactoryInventoryItem;
Expand All @@ -48,6 +49,7 @@
import org.chainoptim.desktop.features.scanalysis.supply.service.SupplierPerformanceServiceImpl;
import org.chainoptim.desktop.features.supplier.model.Supplier;
import org.chainoptim.desktop.features.supplier.model.SupplierOrder;
import org.chainoptim.desktop.features.supplier.model.SupplierShipment;
import org.chainoptim.desktop.features.supplier.service.*;
import org.chainoptim.desktop.features.warehouse.model.Warehouse;
import org.chainoptim.desktop.features.warehouse.model.WarehouseInventoryItem;
Expand Down Expand Up @@ -152,6 +154,8 @@ protected void configure() {
bind(SupplierWriteService.class).to(SupplierWriteServiceImpl.class);
bind(SupplierOrdersService.class).to(SupplierOrdersServiceImpl.class);
bind(SupplierOrdersWriteService.class).to(SupplierOrdersWriteServiceImpl.class);
bind(SupplierShipmentsService.class).to(SupplierShipmentsServiceImpl.class);
bind(SupplierShipmentsWriteService.class).to(SupplierShipmentsWriteServiceImpl.class);

// - Components
bind(ComponentService.class).to(ComponentServiceImpl.class);
Expand All @@ -161,6 +165,8 @@ protected void configure() {
bind(ClientWriteService.class).to(ClientWriteServiceImpl.class);
bind(ClientOrdersService.class).to(ClientOrdersServiceImpl.class);
bind(ClientOrdersWriteService.class).to(ClientOrdersWriteServiceImpl.class);
bind(ClientShipmentsService.class).to(ClientShipmentsServiceImpl.class);
bind(ClientShipmentsWriteService.class).to(ClientShipmentsWriteServiceImpl.class);

// - SC Analysis
bind(ProductProductionGraphService.class).to(ProductProductionGraphServiceImpl.class);
Expand Down Expand Up @@ -214,12 +220,18 @@ protected void configure() {
bind(new TypeLiteral<CachingService<PaginatedResults<SupplierOrder>>>() {})
.to(new TypeLiteral<CachingServiceImpl<PaginatedResults<SupplierOrder>>>() {})
.in(Singleton.class);
bind(new TypeLiteral<CachingService<PaginatedResults<SupplierShipment>>>() {})
.to(new TypeLiteral<CachingServiceImpl<PaginatedResults<SupplierShipment>>>() {})
.in(Singleton.class);
bind(new TypeLiteral<CachingService<PaginatedResults<Client>>>() {})
.to(new TypeLiteral<CachingServiceImpl<PaginatedResults<Client>>>() {})
.in(Singleton.class);
bind(new TypeLiteral<CachingService<PaginatedResults<ClientOrder>>>() {})
.to(new TypeLiteral<CachingServiceImpl<PaginatedResults<ClientOrder>>>() {})
.in(Singleton.class);
bind(new TypeLiteral<CachingService<PaginatedResults<ClientShipment>>>() {})
.to(new TypeLiteral<CachingServiceImpl<PaginatedResults<ClientShipment>>>() {})
.in(Singleton.class);
bind(new TypeLiteral<CachingService<ResourceAllocationPlan>>() {})
.to(new TypeLiteral<CachingServiceImpl<ResourceAllocationPlan>>() {})
.in(Singleton.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ public NavigationServiceImpl(FXMLLoaderService fxmlLoaderService,
Map.entry("Create-Supplier", "/org/chainoptim/desktop/features/supplier/CreateSupplierView.fxml"),
Map.entry("Update-Supplier", "/org/chainoptim/desktop/features/supplier/UpdateSupplierView.fxml"),
Map.entry("Supplier-Orders", "/org/chainoptim/desktop/features/supplier/SupplierOrdersView.fxml"),
Map.entry("Supplier-Shipments", "/org/chainoptim/desktop/features/supplier/SupplierShipmentsView.fxml"),

Map.entry("Clients", "/org/chainoptim/desktop/features/client/ClientsView.fxml"),
Map.entry("Client", "/org/chainoptim/desktop/features/client/ClientView.fxml"),
Map.entry("Create-Client", "/org/chainoptim/desktop/features/client/CreateClientView.fxml"),
Map.entry("Update-Client", "/org/chainoptim/desktop/features/client/UpdateClientView.fxml"),
Map.entry("Client-Orders", "/org/chainoptim/desktop/features/client/ClientOrdersView.fxml"),
Map.entry("Client-Shipments", "/org/chainoptim/desktop/features/client/ClientShipmentsView.fxml"),

Map.entry("Create-Stage", "/org/chainoptim/desktop/features/client/CreateFactoryStageView.fxml"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class NotificationSettingsController implements DataReceiver<UserSettings
private ChangeListener<Boolean> emailOverallChangeListener;

// Constants
private static final List<Feature> notificationFeatures = List.of(Feature.SUPPLIER_ORDER, Feature.CLIENT_ORDER, Feature.FACTORY_INVENTORY, Feature.WAREHOUSE_INVENTORY);
private static final List<Feature> emailFeatures = List.of(Feature.SUPPLIER_ORDER, Feature.CLIENT_ORDER, Feature.FACTORY_INVENTORY, Feature.WAREHOUSE_INVENTORY);
private static final List<Feature> notificationFeatures = List.of(Feature.SUPPLIER_ORDER, Feature.SUPPLIER_SHIPMENT, Feature.CLIENT_ORDER, Feature.CLIENT_SHIPMENT, Feature.FACTORY_INVENTORY, Feature.WAREHOUSE_INVENTORY);
private static final List<Feature> emailFeatures = List.of(Feature.SUPPLIER_ORDER, Feature.SUPPLIER_SHIPMENT, Feature.CLIENT_ORDER, Feature.CLIENT_SHIPMENT, Feature.FACTORY_INVENTORY, Feature.WAREHOUSE_INVENTORY);
private static final String NOTIFICATIONS = "Notifications";
private static final String EMAILS = "Emails";

Expand Down Expand Up @@ -249,22 +249,28 @@ private void updateUI() {
// Utils
private boolean aggregateNotificationSettings() {
return userSettings.getNotificationSettings().isSupplierOrdersOn() &&
userSettings.getNotificationSettings().isSupplierShipmentsOn() &&
userSettings.getNotificationSettings().isClientOrdersOn() &&
userSettings.getNotificationSettings().isClientShipmentsOn() &&
userSettings.getNotificationSettings().isFactoryInventoryOn() &&
userSettings.getNotificationSettings().isWarehouseInventoryOn();
}

private boolean aggregateEmailSettings() {
return userSettings.getNotificationSettings().isEmailSupplierOrdersOn() &&
userSettings.getNotificationSettings().isEmailSupplierShipmentsOn() &&
userSettings.getNotificationSettings().isEmailClientOrdersOn() &&
userSettings.getNotificationSettings().isEmailClientShipmentsOn() &&
userSettings.getNotificationSettings().isEmailFactoryInventoryOn() &&
userSettings.getNotificationSettings().isEmailWarehouseInventoryOn();
}

private boolean getNotificationFeatureSetting(Feature feature) {
return switch (feature) {
case SUPPLIER_ORDER -> userSettings.getNotificationSettings().isSupplierOrdersOn();
case SUPPLIER_SHIPMENT -> userSettings.getNotificationSettings().isSupplierShipmentsOn();
case CLIENT_ORDER -> userSettings.getNotificationSettings().isClientOrdersOn();
case CLIENT_SHIPMENT -> userSettings.getNotificationSettings().isClientShipmentsOn();
case FACTORY_INVENTORY -> userSettings.getNotificationSettings().isFactoryInventoryOn();
case WAREHOUSE_INVENTORY -> userSettings.getNotificationSettings().isWarehouseInventoryOn();
default -> false;
Expand All @@ -274,7 +280,9 @@ private boolean getNotificationFeatureSetting(Feature feature) {
private boolean getEmailFeatureSetting(Feature feature) {
return switch (feature) {
case SUPPLIER_ORDER -> userSettings.getNotificationSettings().isEmailSupplierOrdersOn();
case SUPPLIER_SHIPMENT -> userSettings.getNotificationSettings().isEmailSupplierShipmentsOn();
case CLIENT_ORDER -> userSettings.getNotificationSettings().isEmailClientOrdersOn();
case CLIENT_SHIPMENT -> userSettings.getNotificationSettings().isEmailClientShipmentsOn();
case FACTORY_INVENTORY -> userSettings.getNotificationSettings().isEmailFactoryInventoryOn();
case WAREHOUSE_INVENTORY -> userSettings.getNotificationSettings().isEmailWarehouseInventoryOn();
default -> false;
Expand All @@ -284,7 +292,9 @@ private boolean getEmailFeatureSetting(Feature feature) {
private void setNotificationFeatureSetting(Feature feature, boolean isOn) {
switch (feature) {
case SUPPLIER_ORDER -> userSettings.getNotificationSettings().setSupplierOrdersOn(isOn);
case SUPPLIER_SHIPMENT -> userSettings.getNotificationSettings().setSupplierShipmentsOn(isOn);
case CLIENT_ORDER -> userSettings.getNotificationSettings().setClientOrdersOn(isOn);
case CLIENT_SHIPMENT -> userSettings.getNotificationSettings().setClientShipmentsOn(isOn);
case FACTORY_INVENTORY -> userSettings.getNotificationSettings().setFactoryInventoryOn(isOn);
case WAREHOUSE_INVENTORY -> userSettings.getNotificationSettings().setWarehouseInventoryOn(isOn);
default -> throw new IllegalStateException("Unexpected value: " + feature);
Expand All @@ -294,7 +304,9 @@ private void setNotificationFeatureSetting(Feature feature, boolean isOn) {
private void setEmailFeatureSetting(Feature feature, boolean isOn) {
switch (feature) {
case SUPPLIER_ORDER -> userSettings.getNotificationSettings().setEmailSupplierOrdersOn(isOn);
case SUPPLIER_SHIPMENT -> userSettings.getNotificationSettings().setEmailSupplierShipmentsOn(isOn);
case CLIENT_ORDER -> userSettings.getNotificationSettings().setEmailClientOrdersOn(isOn);
case CLIENT_SHIPMENT -> userSettings.getNotificationSettings().setEmailClientShipmentsOn(isOn);
case FACTORY_INVENTORY -> userSettings.getNotificationSettings().setEmailFactoryInventoryOn(isOn);
case WAREHOUSE_INVENTORY -> userSettings.getNotificationSettings().setEmailWarehouseInventoryOn(isOn);
default -> throw new IllegalStateException("Unexpected value: " + feature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
public class NotificationSettings {

private boolean supplierOrdersOn;
private boolean supplierShipmentsOn;
private boolean clientOrdersOn;
private boolean clientShipmentsOn;
private boolean factoryInventoryOn;
private boolean warehouseInventoryOn;
private boolean emailSupplierOrdersOn;
private boolean emailSupplierShipmentsOn;
private boolean emailClientOrdersOn;
private boolean emailClientShipmentsOn;
private boolean emailFactoryInventoryOn;
private boolean emailWarehouseInventoryOn;

public NotificationSettings deepCopy() {
return new NotificationSettings(
supplierOrdersOn, clientOrdersOn, factoryInventoryOn, warehouseInventoryOn,
emailSupplierOrdersOn, emailClientOrdersOn, emailFactoryInventoryOn, emailWarehouseInventoryOn);
supplierOrdersOn, supplierShipmentsOn, clientOrdersOn, clientShipmentsOn, factoryInventoryOn, warehouseInventoryOn,
emailSupplierOrdersOn, emailSupplierShipmentsOn, emailClientOrdersOn, emailClientShipmentsOn, emailFactoryInventoryOn, emailWarehouseInventoryOn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ public void setData(SearchData<Client> searchData) {
this.searchMode = searchData.getSearchMode();

searchParams.setItemsPerPage(20);
SearchOptions searchOptions = SearchOptionsConfiguration.getSearchOptions(Feature.SUPPLIER_ORDER);
SearchOptions searchOptions = SearchOptionsConfiguration.getSearchOptions(Feature.CLIENT_ORDER);

commonViewsLoader.loadFallbackManager(fallbackContainer);
tableToolbarController = commonViewsLoader.initializeTableToolbar(tableToolbarContainer);
tableToolbarController.initialize(new ListHeaderParams
(searchMode, searchParams,
"Client Orders", "/img/box-solid.png", Feature.SUPPLIER_ORDER,
"Client Orders", "/img/box-solid.png", Feature.CLIENT_ORDER,
searchOptions.getSortOptions(), searchOptions.getFilterOptions(),
() -> loadClientOrders(searchMode == SearchMode.SECONDARY ? client.getId() : null), null, null));
pageSelectorController = commonViewsLoader.loadPageSelector(pageSelectorContainer);
Expand Down
Loading
Loading