Improve Desktop Tables

This commit is contained in:
2026-04-09 11:49:14 -06:00
parent 0cc160a02c
commit 3ddc9fdf92
32 changed files with 592 additions and 9 deletions

View File

@@ -35,6 +35,12 @@ public class AdoptionController {
@FXML @FXML
private Button btnEdit; private Button btnEdit;
@FXML
private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private TableColumn<Adoption, Integer> colAdoptionId; private TableColumn<Adoption, Integer> colAdoptionId;
@@ -103,6 +109,14 @@ public class AdoptionController {
}); });
} }
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
tvAdoptions.getSortOrder().clear();
displayAdoptions();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -6,6 +6,8 @@ import javafx.fxml.FXML;
import javafx.scene.chart.*; import javafx.scene.chart.*;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import org.example.petshopdesktop.api.dto.analytics.DailySales; import org.example.petshopdesktop.api.dto.analytics.DailySales;
import org.example.petshopdesktop.api.dto.analytics.DashboardResponse; import org.example.petshopdesktop.api.dto.analytics.DashboardResponse;
import org.example.petshopdesktop.api.dto.analytics.TopProduct; import org.example.petshopdesktop.api.dto.analytics.TopProduct;
@@ -15,6 +17,7 @@ import org.example.petshopdesktop.api.endpoints.AnalyticsApi;
import org.example.petshopdesktop.api.endpoints.SaleApi; import org.example.petshopdesktop.api.endpoints.SaleApi;
import org.example.petshopdesktop.auth.UserSession; import org.example.petshopdesktop.auth.UserSession;
import org.example.petshopdesktop.util.ActivityLogger; import org.example.petshopdesktop.util.ActivityLogger;
import org.example.petshopdesktop.util.TableViewSupport;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@@ -32,6 +35,9 @@ public class AnalyticsController {
@FXML @FXML
private Button btnRefresh; private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private Label lblError; private Label lblError;
@@ -65,6 +71,9 @@ public class AnalyticsController {
@FXML @FXML
private BarChart<String, Number> chartEmployeePerformance; private BarChart<String, Number> chartEmployeePerformance;
@FXML
private TabPane tabPane;
private static final String SALES_COLOR = "#ff6b35"; private static final String SALES_COLOR = "#ff6b35";
private static final String REVENUE_COLOR = "#4ecdc4"; private static final String REVENUE_COLOR = "#4ecdc4";
private static final String QUANTITY_COLOR = "#ff9f1c"; private static final String QUANTITY_COLOR = "#ff9f1c";
@@ -79,6 +88,13 @@ public class AnalyticsController {
@FXML @FXML
public void initialize() { public void initialize() {
configureCharts(); configureCharts();
if (tabPane != null) {
tabPane.getSelectionModel().selectedItemProperty().addListener((obs, oldTab, newTab) -> {
if (oldTab != newTab && newTab != null) {
loadAnalyticsData();
}
});
}
loadAnalyticsData(); loadAnalyticsData();
} }
@@ -126,6 +142,9 @@ public class AnalyticsController {
private void loadAnalyticsData() { private void loadAnalyticsData() {
lblError.setVisible(false); lblError.setVisible(false);
if (lblStatus != null) {
lblStatus.setVisible(false);
}
new Thread(() -> { new Thread(() -> {
try { try {
DashboardResponse dashboard = AnalyticsApi.getInstance().getDashboard(30, 10); DashboardResponse dashboard = AnalyticsApi.getInstance().getDashboard(30, 10);
@@ -472,5 +491,6 @@ public class AnalyticsController {
@FXML @FXML
void handleRefresh(ActionEvent event) { void handleRefresh(ActionEvent event) {
loadAnalyticsData(); loadAnalyticsData();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
} }
} }

View File

@@ -40,6 +40,9 @@ public class AppointmentController {
@FXML private Button btnAdd; @FXML private Button btnAdd;
@FXML private Button btnEdit; @FXML private Button btnEdit;
@FXML private Button btnDelete; @FXML private Button btnDelete;
@FXML private Button btnRefresh;
@FXML private Label lblStatus;
@FXML private TextField txtSearch; @FXML private TextField txtSearch;
@@ -135,6 +138,14 @@ public class AppointmentController {
}).start(); }).start();
} }
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
tvAppointments.getSortOrder().clear();
loadAppointments();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event){ void btnAddClicked(ActionEvent event){
openDialog(null, "Add"); openDialog(null, "Add");

View File

@@ -35,6 +35,12 @@ public class InventoryController {
@FXML @FXML
private Button btnEdit; private Button btnEdit;
@FXML
private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private TableColumn<Inventory, Integer> colInventoryId; private TableColumn<Inventory, Integer> colInventoryId;
@@ -94,6 +100,14 @@ public class InventoryController {
} }
//Opens dialog in add mode //Opens dialog in add mode
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
tvInventory.getSortOrder().clear();
displayInventory();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -40,6 +40,12 @@ public class PetController {
@FXML @FXML
private Button btnEdit; private Button btnEdit;
@FXML
private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private TableColumn<Pet, Integer> colPetAge; private TableColumn<Pet, Integer> colPetAge;
@@ -82,6 +88,20 @@ public class PetController {
@FXML @FXML
private TextField txtSearch; private TextField txtSearch;
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
if (cbSpeciesFilter != null) {
cbSpeciesFilter.getSelectionModel().selectFirst();
}
if (cbStatusFilter != null) {
cbStatusFilter.getSelectionModel().selectFirst();
}
tvPets.getSortOrder().clear();
displayPets();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -44,6 +44,12 @@ public class ProductController {
@FXML @FXML
private Button btnEdit; private Button btnEdit;
@FXML
private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private TableColumn<ProductDTO, String> colProductCategory; private TableColumn<ProductDTO, String> colProductCategory;
@@ -156,6 +162,17 @@ public class ProductController {
* open a new dialog for adding a product * open a new dialog for adding a product
* @param event click event for button * @param event click event for button
*/ */
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
if (cbCategoryFilter != null) {
cbCategoryFilter.getSelectionModel().selectFirst();
}
tvProducts.getSortOrder().clear();
displayProduct();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -34,6 +34,12 @@ public class ProductSupplierController {
@FXML @FXML
private Button btnEdit; private Button btnEdit;
@FXML
private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private TableColumn<ProductSupplierDTO, Double> colCost; private TableColumn<ProductSupplierDTO, Double> colCost;
@@ -167,6 +173,14 @@ public class ProductSupplierController {
* open a new dialog for adding a productSupplier * open a new dialog for adding a productSupplier
* @param event click event for button * @param event click event for button
*/ */
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
tvProductSuppliers.getSortOrder().clear();
displayProductSupplier();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -5,14 +5,21 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import org.example.petshopdesktop.DTOs.PurchaseOrderDTO; import org.example.petshopdesktop.DTOs.PurchaseOrderDTO;
import org.example.petshopdesktop.api.dto.purchaseorder.PurchaseOrderResponse; import org.example.petshopdesktop.api.dto.purchaseorder.PurchaseOrderResponse;
import org.example.petshopdesktop.api.endpoints.PurchaseOrderApi; import org.example.petshopdesktop.api.endpoints.PurchaseOrderApi;
import org.example.petshopdesktop.controllers.dialogcontrollers.PurchaseOrderDetailsDialogController;
import org.example.petshopdesktop.util.ActivityLogger; import org.example.petshopdesktop.util.ActivityLogger;
import org.example.petshopdesktop.util.TableViewSupport; import org.example.petshopdesktop.util.TableViewSupport;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Comparator; import java.util.Comparator;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -21,6 +28,8 @@ public class PurchaseOrderController {
@FXML private Button btnRefresh; @FXML private Button btnRefresh;
@FXML private Label lblStatus;
@FXML @FXML
private TextField txtSearch; private TextField txtSearch;
@@ -51,6 +60,7 @@ public class PurchaseOrderController {
filtered = new FilteredList<>(purchaseOrders, p -> true); filtered = new FilteredList<>(purchaseOrders, p -> true);
TableViewSupport.bindSortedItems(tvPurchaseOrders, filtered); TableViewSupport.bindSortedItems(tvPurchaseOrders, filtered);
TableViewSupport.installDoubleClickAction(tvPurchaseOrders, this::openDetailsDialog);
if (txtSearch != null) { if (txtSearch != null) {
txtSearch.textProperty().addListener((obs, o, n) -> applyFilter(n)); txtSearch.textProperty().addListener((obs, o, n) -> applyFilter(n));
@@ -109,7 +119,34 @@ public class PurchaseOrderController {
@FXML @FXML
void btnRefresh() { void btnRefresh() {
if (txtSearch != null) {
txtSearch.clear();
}
TableViewSupport.clearSort(tvPurchaseOrders);
loadPurchaseOrders(); loadPurchaseOrders();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
private void openDetailsDialog(PurchaseOrderDTO selected) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/org/example/petshopdesktop/dialogviews/purchase-order-details-dialog-view.fxml"));
Stage dialog = new Stage();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setTitle("Purchase Order Details");
dialog.setScene(new Scene(loader.load()));
PurchaseOrderDetailsDialogController controller = loader.getController();
controller.displayPurchaseOrder(selected);
controller.setCloseAction(() -> dialog.close());
dialog.initOwner(tvPurchaseOrders.getScene().getWindow());
dialog.setResizable(false);
dialog.showAndWait();
} catch (IOException e) {
ActivityLogger.getInstance().logException(
"PurchaseOrderController.openDetailsDialog",
e,
"Opening purchase order details");
new Alert(Alert.AlertType.ERROR, "Unable to open purchase order details").showAndWait();
}
} }
private PurchaseOrderDTO mapToPurchaseOrderDTO(PurchaseOrderResponse response) { private PurchaseOrderDTO mapToPurchaseOrderDTO(PurchaseOrderResponse response) {

View File

@@ -51,6 +51,9 @@ public class SaleController {
@FXML @FXML
private Button btnRefresh; private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private Button btnRefund; private Button btnRefund;
@@ -292,7 +295,10 @@ public class SaleController {
@FXML @FXML
void btnRefresh(ActionEvent event) { void btnRefresh(ActionEvent event) {
refreshSales(true); txtSearch.clear();
TableViewSupport.clearSort(tvSales);
refreshSales(false);
TableViewSupport.flashStatus(lblStatus, "Refreshed");
} }
@FXML @FXML
@@ -425,10 +431,11 @@ public class SaleController {
@FXML @FXML
void btnRefund(ActionEvent event) { void btnRefund(ActionEvent event) {
openRefundDialog(); SaleLineItem selectedSale = tvSales.getSelectionModel().getSelectedItem();
openRefundDialog(selectedSale != null ? (long) selectedSale.getSaleId() : null);
} }
private void openRefundDialog() { private void openRefundDialog(Long saleId) {
try { try {
SaleLineItem selectedSale = tvSales.getSelectionModel().getSelectedItem(); SaleLineItem selectedSale = tvSales.getSelectionModel().getSelectedItem();
if (selectedSale != null && selectedSale.isRefund()) { if (selectedSale != null && selectedSale.isRefund()) {
@@ -444,8 +451,8 @@ public class SaleController {
dialog.setTitle("Process Refund"); dialog.setTitle("Process Refund");
dialog.setScene(new Scene(loader.load())); dialog.setScene(new Scene(loader.load()));
var controller = loader.<org.example.petshopdesktop.controllers.dialogcontrollers.RefundDialogController>getController(); var controller = loader.<org.example.petshopdesktop.controllers.dialogcontrollers.RefundDialogController>getController();
if (selectedSale != null) { if (saleId != null) {
controller.prefillSale((long) selectedSale.getSaleId()); controller.prefillSale(saleId);
} }
dialog.setMinWidth(860); dialog.setMinWidth(860);
dialog.setMinHeight(680); dialog.setMinHeight(680);
@@ -477,6 +484,8 @@ public class SaleController {
dialog.setTitle("Sale Details"); dialog.setTitle("Sale Details");
dialog.setScene(new Scene(loader.load())); dialog.setScene(new Scene(loader.load()));
var controller = (org.example.petshopdesktop.controllers.dialogcontrollers.SaleDetailDialogController) loader.getController(); var controller = (org.example.petshopdesktop.controllers.dialogcontrollers.SaleDetailDialogController) loader.getController();
controller.setSaleId((long) sale.getSaleId());
controller.setRefundAction(this::openRefundDialog);
controller.displaySaleDetails(mapToSaleDetail(sale)); controller.displaySaleDetails(mapToSaleDetail(sale));
dialog.setResizable(false); dialog.setResizable(false);
dialog.showAndWait(); dialog.showAndWait();
@@ -520,6 +529,7 @@ public class SaleController {
sale.getTotalAmount() != null ? sale.getTotalAmount().doubleValue() : 0.0, sale.getTotalAmount() != null ? sale.getTotalAmount().doubleValue() : 0.0,
sale.getPaymentMethod(), sale.getPaymentMethod(),
sale.getEmployeeName(), sale.getEmployeeName(),
Boolean.TRUE.equals(sale.getIsRefund()),
items items
); );
} }

View File

@@ -28,6 +28,9 @@ public class ServiceController {
@FXML private Button btnAdd; @FXML private Button btnAdd;
@FXML private Button btnDelete; @FXML private Button btnDelete;
@FXML private Button btnEdit; @FXML private Button btnEdit;
@FXML private Button btnRefresh;
@FXML private Label lblStatus;
@FXML private TableColumn<ServiceDTO, Integer> colServiceId; @FXML private TableColumn<ServiceDTO, Integer> colServiceId;
@FXML private TableColumn<ServiceDTO, String> colServiceName; @FXML private TableColumn<ServiceDTO, String> colServiceName;
@@ -131,6 +134,14 @@ public class ServiceController {
} }
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
tvServices.getSortOrder().clear();
displayServices();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -58,6 +58,12 @@ public class StaffAccountsController {
@FXML @FXML
private Label lblError; private Label lblError;
@FXML
private Label lblStatus;
@FXML
private Button btnRefresh;
@FXML @FXML
private Button btnCreateAccount; private Button btnCreateAccount;
@@ -107,7 +113,10 @@ public class StaffAccountsController {
@FXML @FXML
void btnRefreshClicked(ActionEvent event) { void btnRefreshClicked(ActionEvent event) {
txtSearch.clear();
TableViewSupport.clearSort(tvStaff);
refresh(); refresh();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
} }
@FXML @FXML

View File

@@ -37,6 +37,12 @@ public class SupplierController {
@FXML @FXML
private Button btnEdit; private Button btnEdit;
@FXML
private Button btnRefresh;
@FXML
private Label lblStatus;
@FXML @FXML
private TableColumn<Supplier, String> colContactPerson; private TableColumn<Supplier, String> colContactPerson;
@@ -170,6 +176,14 @@ public class SupplierController {
* open a new dialog for adding a supplier * open a new dialog for adding a supplier
* @param event click event for button * @param event click event for button
*/ */
@FXML
void btnRefresh(ActionEvent event) {
txtSearch.clear();
tvSuppliers.getSortOrder().clear();
displaySupplier();
TableViewSupport.flashStatus(lblStatus, "Refreshed");
}
@FXML @FXML
void btnAddClicked(ActionEvent event) { void btnAddClicked(ActionEvent event) {
mode = "Add"; mode = "Add";

View File

@@ -265,6 +265,7 @@ public class AdoptionDialogController {
if (adoption != null) { if (adoption != null) {
selectedAdoption = adoption; selectedAdoption = adoption;
lblAdoptionId.setText("ID: " + adoption.getAdoptionId()); lblAdoptionId.setText("ID: " + adoption.getAdoptionId());
ensureSelectedEmployeeOption(cbEmployee.getItems());
applySelectedPet(); applySelectedPet();
applySelectedCustomer(); applySelectedCustomer();
applySelectedEmployee(); applySelectedEmployee();

View File

@@ -19,7 +19,9 @@ import org.example.petshopdesktop.api.endpoints.ProductSupplierApi;
import org.example.petshopdesktop.util.ActivityLogger; import org.example.petshopdesktop.util.ActivityLogger;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
public class ProductSupplierDialogController { public class ProductSupplierDialogController {
@@ -49,6 +51,10 @@ public class ProductSupplierDialogController {
private int selectedProdId = -1; private int selectedProdId = -1;
private Long pendingSupplierId = null; private Long pendingSupplierId = null;
private Long pendingProductId = null; private Long pendingProductId = null;
private boolean updatingChoices = false;
private ObservableList<DropdownOption> baseSuppliers = FXCollections.observableArrayList();
private ObservableList<DropdownOption> baseProducts = FXCollections.observableArrayList();
private List<ProductSupplierResponse> relations = List.of();
/** /**
* add event listeners to buttons and set up combobox * add event listeners to buttons and set up combobox
@@ -115,20 +121,39 @@ public class ProductSupplierDialogController {
} }
}); });
cbProduct.valueProperty().addListener((obs, oldValue, newValue) -> {
if (updatingChoices) {
return;
}
filterSuppliersByProduct(newValue != null ? newValue.getId() : null);
});
cbSupplier.valueProperty().addListener((obs, oldValue, newValue) -> {
if (updatingChoices) {
return;
}
filterProductsBySupplier(newValue != null ? newValue.getId() : null);
});
new Thread(() -> { new Thread(() -> {
try { try {
var productSupplierLinks = ProductSupplierApi.getInstance().listProductSuppliers(null);
var suppliers = DropdownApi.getInstance().getSuppliers(); var suppliers = DropdownApi.getInstance().getSuppliers();
var products = DropdownApi.getInstance().getProducts(); var products = DropdownApi.getInstance().getProducts();
Platform.runLater(() -> { Platform.runLater(() -> {
relations = productSupplierLinks != null ? productSupplierLinks : List.of();
if (suppliers != null) { if (suppliers != null) {
cbSupplier.setItems(FXCollections.observableArrayList(suppliers)); baseSuppliers = FXCollections.observableArrayList(suppliers);
cbSupplier.setItems(FXCollections.observableArrayList(baseSuppliers));
applyPendingSupplierSelection(); applyPendingSupplierSelection();
} }
if (products != null) { if (products != null) {
cbProduct.setItems(FXCollections.observableArrayList(products)); baseProducts = FXCollections.observableArrayList(products);
cbProduct.setItems(FXCollections.observableArrayList(baseProducts));
applyPendingProductSelection(); applyPendingProductSelection();
} }
applyCurrentFilters();
}); });
} catch (Exception e) { } catch (Exception e) {
Platform.runLater(() -> { Platform.runLater(() -> {
@@ -271,7 +296,10 @@ public class ProductSupplierDialogController {
} }
DropdownOption product = findOptionById(cbProduct.getItems(), pendingProductId); DropdownOption product = findOptionById(cbProduct.getItems(), pendingProductId);
if (product != null) { if (product != null) {
updatingChoices = true;
cbProduct.getSelectionModel().select(product); cbProduct.getSelectionModel().select(product);
updatingChoices = false;
filterSuppliersByProduct(product.getId());
pendingProductId = null; pendingProductId = null;
} }
} }
@@ -282,11 +310,73 @@ public class ProductSupplierDialogController {
} }
DropdownOption supplier = findOptionById(cbSupplier.getItems(), pendingSupplierId); DropdownOption supplier = findOptionById(cbSupplier.getItems(), pendingSupplierId);
if (supplier != null) { if (supplier != null) {
updatingChoices = true;
cbSupplier.getSelectionModel().select(supplier); cbSupplier.getSelectionModel().select(supplier);
updatingChoices = false;
filterProductsBySupplier(supplier.getId());
pendingSupplierId = null; pendingSupplierId = null;
} }
} }
private void applyCurrentFilters() {
DropdownOption selectedProduct = cbProduct.getSelectionModel().getSelectedItem();
DropdownOption selectedSupplier = cbSupplier.getSelectionModel().getSelectedItem();
filterSuppliersByProduct(selectedProduct != null ? selectedProduct.getId() : null);
filterProductsBySupplier(selectedSupplier != null ? selectedSupplier.getId() : null);
}
private void filterSuppliersByProduct(Long productId) {
updatingChoices = true;
try {
if (productId == null) {
cbSupplier.setItems(FXCollections.observableArrayList(baseSuppliers));
return;
}
Set<Long> allowedSupplierIds = new HashSet<>();
for (ProductSupplierResponse relation : relations) {
if (relation.getProductId() != null && relation.getProductId().equals(productId) && relation.getSupplierId() != null) {
allowedSupplierIds.add(relation.getSupplierId());
}
}
ObservableList<DropdownOption> filtered = FXCollections.observableArrayList(
baseSuppliers.stream().filter(option -> option.getId() != null && allowedSupplierIds.contains(option.getId())).toList()
);
cbSupplier.setItems(filtered);
DropdownOption selectedSupplier = cbSupplier.getSelectionModel().getSelectedItem();
if (selectedSupplier != null && !allowedSupplierIds.contains(selectedSupplier.getId())) {
cbSupplier.getSelectionModel().clearSelection();
}
} finally {
updatingChoices = false;
}
}
private void filterProductsBySupplier(Long supplierId) {
updatingChoices = true;
try {
if (supplierId == null) {
cbProduct.setItems(FXCollections.observableArrayList(baseProducts));
return;
}
Set<Long> allowedProductIds = new HashSet<>();
for (ProductSupplierResponse relation : relations) {
if (relation.getSupplierId() != null && relation.getSupplierId().equals(supplierId) && relation.getProductId() != null) {
allowedProductIds.add(relation.getProductId());
}
}
ObservableList<DropdownOption> filtered = FXCollections.observableArrayList(
baseProducts.stream().filter(option -> option.getId() != null && allowedProductIds.contains(option.getId())).toList()
);
cbProduct.setItems(filtered);
DropdownOption selectedProduct = cbProduct.getSelectionModel().getSelectedItem();
if (selectedProduct != null && !allowedProductIds.contains(selectedProduct.getId())) {
cbProduct.getSelectionModel().clearSelection();
}
} finally {
updatingChoices = false;
}
}
private DropdownOption findOptionById(List<DropdownOption> options, Long id) { private DropdownOption findOptionById(List<DropdownOption> options, Long id) {
if (options == null || id == null) { if (options == null || id == null) {
return null; return null;

View File

@@ -0,0 +1,40 @@
package org.example.petshopdesktop.controllers.dialogcontrollers;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import org.example.petshopdesktop.DTOs.PurchaseOrderDTO;
public class PurchaseOrderDetailsDialogController {
@FXML private Label lblOrderId;
@FXML private Label lblSupplier;
@FXML private Label lblOrderDate;
@FXML private Label lblStatus;
private Runnable closeAction;
public void displayPurchaseOrder(PurchaseOrderDTO order) {
if (order == null) {
return;
}
lblOrderId.setText(String.valueOf(order.getPurchaseOrderId()));
lblSupplier.setText(order.getSupplierName() != null ? order.getSupplierName() : "");
lblOrderDate.setText(order.getOrderDate() != null ? order.getOrderDate() : "");
lblStatus.setText(order.getStatus() != null ? order.getStatus() : "");
}
public void setCloseAction(Runnable closeAction) {
this.closeAction = closeAction;
}
@FXML
void btnCloseClicked() {
if (closeAction != null) {
closeAction.run();
return;
}
Stage stage = (Stage) lblOrderId.getScene().getWindow();
stage.close();
}
}

View File

@@ -2,11 +2,19 @@ package org.example.petshopdesktop.controllers.dialogcontrollers;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.example.petshopdesktop.models.SaleDetail; import org.example.petshopdesktop.models.SaleDetail;
import org.example.petshopdesktop.controllers.dialogcontrollers.RefundDialogController;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Modality;
import org.example.petshopdesktop.util.ActivityLogger;
import java.util.function.Consumer;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@@ -19,6 +27,7 @@ public class SaleDetailDialogController {
@FXML private Label lblEmployee; @FXML private Label lblEmployee;
@FXML private Label lblPayment; @FXML private Label lblPayment;
@FXML private Label lblTotal; @FXML private Label lblTotal;
@FXML private Button btnRefund;
@FXML private TableView<SaleDetail.SaleDetailItem> tvItems; @FXML private TableView<SaleDetail.SaleDetailItem> tvItems;
@FXML private TableColumn<SaleDetail.SaleDetailItem, String> colProduct; @FXML private TableColumn<SaleDetail.SaleDetailItem, String> colProduct;
@FXML private TableColumn<SaleDetail.SaleDetailItem, Integer> colQuantity; @FXML private TableColumn<SaleDetail.SaleDetailItem, Integer> colQuantity;
@@ -27,6 +36,8 @@ public class SaleDetailDialogController {
private final NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.CANADA); private final NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.CANADA);
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
private Long saleId;
private Consumer<Long> refundAction;
@FXML @FXML
public void initialize() { public void initialize() {
@@ -38,12 +49,48 @@ public class SaleDetailDialogController {
} }
public void displaySaleDetails(SaleDetail sale) { public void displaySaleDetails(SaleDetail sale) {
saleId = (long) sale.getSaleId();
lblSaleId.setText(String.valueOf(sale.getSaleId())); lblSaleId.setText(String.valueOf(sale.getSaleId()));
lblSaleDate.setText(sale.getSaleDate() != null ? sale.getSaleDate().format(DATE_FORMATTER) : ""); lblSaleDate.setText(sale.getSaleDate() != null ? sale.getSaleDate().format(DATE_FORMATTER) : "");
lblEmployee.setText(sale.getEmployeeName() != null ? sale.getEmployeeName() : ""); lblEmployee.setText(sale.getEmployeeName() != null ? sale.getEmployeeName() : "");
lblPayment.setText(sale.getPaymentMethod() != null ? sale.getPaymentMethod() : ""); lblPayment.setText(sale.getPaymentMethod() != null ? sale.getPaymentMethod() : "");
lblTotal.setText(currency.format(sale.getTotalAmount())); lblTotal.setText(currency.format(sale.getTotalAmount()));
tvItems.setItems(sale.getItems()); tvItems.setItems(sale.getItems());
if (btnRefund != null) {
btnRefund.setDisable(sale.isRefund());
}
}
public void setSaleId(Long saleId) {
this.saleId = saleId;
}
public void setRefundAction(Consumer<Long> refundAction) {
this.refundAction = refundAction;
}
@FXML
void btnRefundClicked() {
if (saleId == null) {
return;
}
if (refundAction != null) {
refundAction.accept(saleId);
return;
}
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/org/example/petshopdesktop/dialogviews/refund-dialog-view.fxml"));
Stage dialog = new Stage();
dialog.initOwner(tvItems.getScene().getWindow());
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setTitle("Process Refund");
dialog.setScene(new Scene(loader.load()));
RefundDialogController controller = loader.getController();
controller.prefillSale(saleId);
dialog.showAndWait();
} catch (Exception e) {
ActivityLogger.getInstance().logException("SaleDetailDialogController.btnRefundClicked", e, "Opening refund dialog");
}
} }
@FXML @FXML

View File

@@ -9,14 +9,16 @@ public class SaleDetail {
private final double totalAmount; private final double totalAmount;
private final String paymentMethod; private final String paymentMethod;
private final String employeeName; private final String employeeName;
private final boolean refund;
private final ObservableList<SaleDetailItem> items; private final ObservableList<SaleDetailItem> items;
public SaleDetail(int saleId, LocalDateTime saleDate, double totalAmount, String paymentMethod, String employeeName, ObservableList<SaleDetailItem> items) { public SaleDetail(int saleId, LocalDateTime saleDate, double totalAmount, String paymentMethod, String employeeName, boolean refund, ObservableList<SaleDetailItem> items) {
this.saleId = saleId; this.saleId = saleId;
this.saleDate = saleDate; this.saleDate = saleDate;
this.totalAmount = totalAmount; this.totalAmount = totalAmount;
this.paymentMethod = paymentMethod; this.paymentMethod = paymentMethod;
this.employeeName = employeeName; this.employeeName = employeeName;
this.refund = refund;
this.items = items; this.items = items;
} }
@@ -40,6 +42,10 @@ public class SaleDetail {
return employeeName; return employeeName;
} }
public boolean isRefund() {
return refund;
}
public ObservableList<SaleDetailItem> getItems() { public ObservableList<SaleDetailItem> getItems() {
return items; return items;
} }

View File

@@ -2,9 +2,12 @@ package org.example.petshopdesktop.util;
import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList; import javafx.collections.transformation.SortedList;
import javafx.animation.PauseTransition;
import javafx.scene.control.Label;
import javafx.scene.control.TableRow; import javafx.scene.control.TableRow;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.input.MouseButton; import javafx.scene.input.MouseButton;
import javafx.util.Duration;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -19,6 +22,25 @@ public final class TableViewSupport {
tableView.setItems(sortedItems); tableView.setItems(sortedItems);
} }
public static void clearSort(TableView<?> tableView) {
tableView.getSortOrder().clear();
}
public static void flashStatus(Label label, String message) {
if (label == null) {
return;
}
label.setText(message);
label.setVisible(true);
label.setManaged(true);
PauseTransition delay = new PauseTransition(Duration.seconds(1.5));
delay.setOnFinished(event -> {
label.setVisible(false);
label.setManaged(false);
});
delay.playFromStart();
}
public static <T> void installDoubleClickAction(TableView<T> tableView, Consumer<T> action) { public static <T> void installDoubleClickAction(TableView<T> tableView, Consumer<T> action) {
tableView.setRowFactory(tv -> { tableView.setRowFactory(tv -> {
TableRow<T> row = new TableRow<>(); TableRow<T> row = new TableRow<>();

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox prefHeight="260.0" prefWidth="480.0" spacing="18.0" style="-fx-font-size: 14px;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.example.petshopdesktop.controllers.dialogcontrollers.PurchaseOrderDetailsDialogController">
<padding>
<Insets bottom="18.0" left="18.0" right="18.0" top="18.0" />
</padding>
<children>
<HBox alignment="CENTER_LEFT" spacing="12.0" style="-fx-background-color: #4ECDC4; -fx-background-radius: 12;">
<padding>
<Insets bottom="14.0" left="16.0" right="16.0" top="14.0" />
</padding>
<children>
<Label text="Purchase Order Details" textFill="WHITE">
<font>
<Font name="System Bold" size="22.0" />
</font>
</Label>
<Region HBox.hgrow="ALWAYS" />
<Button mnemonicParsing="false" onAction="#btnCloseClicked" style="-fx-background-color: white; -fx-text-fill: #2c3e50; -fx-background-radius: 8;" text="Close" />
</children>
</HBox>
<GridPane hgap="16.0" vgap="12.0" style="-fx-background-color: white; -fx-background-radius: 12; -fx-border-color: #e6e6e6; -fx-border-radius: 12; -fx-border-width: 1;">
<padding>
<Insets bottom="16.0" left="16.0" right="16.0" top="16.0" />
</padding>
<children>
<Label text="Order ID" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Label fx:id="lblOrderId" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Label text="Supplier" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<Label fx:id="lblSupplier" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Order Date" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<Label fx:id="lblOrderDate" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="Status" GridPane.columnIndex="0" GridPane.rowIndex="3" />
<Label fx:id="lblStatus" GridPane.columnIndex="1" GridPane.rowIndex="3" />
</children>
</GridPane>
</children>
</VBox>

View File

@@ -27,6 +27,7 @@
</font> </font>
</Label> </Label>
<Region HBox.hgrow="ALWAYS" /> <Region HBox.hgrow="ALWAYS" />
<Button fx:id="btnRefund" mnemonicParsing="false" onAction="#btnRefundClicked" style="-fx-background-color: white; -fx-text-fill: #2c3e50; -fx-background-radius: 8;" text="Refund" />
<Button mnemonicParsing="false" onAction="#btnCloseClicked" style="-fx-background-color: white; -fx-text-fill: #2c3e50; -fx-background-radius: 8;" text="Close" /> <Button mnemonicParsing="false" onAction="#btnCloseClicked" style="-fx-background-color: white; -fx-text-fill: #2c3e50; -fx-background-radius: 8;" text="Close" />
</children> </children>
</HBox> </HBox>

View File

@@ -51,6 +51,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -65,6 +73,12 @@
</TextField> </TextField>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvAdoptions" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvAdoptions" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colAdoptionId" prefWidth="60.0" text="ID" /> <TableColumn fx:id="colAdoptionId" prefWidth="60.0" text="ID" />

View File

@@ -10,6 +10,7 @@
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?> <?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?> <?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
@@ -25,6 +26,7 @@
<Font name="System Bold" size="24.0" /> <Font name="System Bold" size="24.0" />
</font> </font>
</Label> </Label>
<Region HBox.hgrow="ALWAYS" />
<Button fx:id="btnRefresh" onAction="#handleRefresh" style="-fx-background-color: #4ECDC4; -fx-text-fill: white; -fx-background-radius: 5; -fx-cursor: hand;" text="Refresh"> <Button fx:id="btnRefresh" onAction="#handleRefresh" style="-fx-background-color: #4ECDC4; -fx-text-fill: white; -fx-background-radius: 5; -fx-cursor: hand;" text="Refresh">
<font> <font>
<Font size="13.0" /> <Font size="13.0" />
@@ -35,13 +37,19 @@
</Button> </Button>
</HBox> </HBox>
<Label fx:id="lblStatus" textFill="#64748b" visible="false">
<font>
<Font size="13.0" />
</font>
</Label>
<Label fx:id="lblError" textFill="#FF6B6B" visible="false"> <Label fx:id="lblError" textFill="#FF6B6B" visible="false">
<font> <font>
<Font size="13.0" /> <Font size="13.0" />
</font> </font>
</Label> </Label>
<TabPane styleClass="analytics-tabs" VBox.vgrow="ALWAYS"> <TabPane fx:id="tabPane" styleClass="analytics-tabs" VBox.vgrow="ALWAYS">
<Tab text="Overview" closable="false"> <Tab text="Overview" closable="false">
<VBox spacing="15.0"> <VBox spacing="15.0">
<padding> <padding>

View File

@@ -51,6 +51,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -65,6 +73,12 @@
</TextField> </TextField>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvAppointments" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvAppointments" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colAppointmentId" prefWidth="53.14288330078125" text="ID" /> <TableColumn fx:id="colAppointmentId" prefWidth="53.14288330078125" text="ID" />

View File

@@ -51,6 +51,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -65,6 +73,12 @@
</TextField> </TextField>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvInventory" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvInventory" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colInventoryId" prefWidth="94.28570556640625" text="ID" /> <TableColumn fx:id="colInventoryId" prefWidth="94.28570556640625" text="ID" />

View File

@@ -53,6 +53,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -69,6 +77,12 @@
<ComboBox fx:id="cbStatusFilter" prefWidth="150.0" promptText="Status" /> <ComboBox fx:id="cbStatusFilter" prefWidth="150.0" promptText="Status" />
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvPets" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvPets" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colPetId" prefWidth="55.0" text="ID" /> <TableColumn fx:id="colPetId" prefWidth="55.0" text="ID" />

View File

@@ -51,6 +51,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -65,6 +73,12 @@
</TextField> </TextField>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvProductSuppliers" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvProductSuppliers" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colProductId" prefWidth="91.4285888671875" text="Product ID" /> <TableColumn fx:id="colProductId" prefWidth="91.4285888671875" text="Product ID" />

View File

@@ -52,6 +52,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -67,6 +75,12 @@
<ComboBox fx:id="cbCategoryFilter" prefWidth="180.0" promptText="Category" /> <ComboBox fx:id="cbCategoryFilter" prefWidth="180.0" promptText="Category" />
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvProducts" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvProducts" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colProductId" prefWidth="55.0" text="ID" /> <TableColumn fx:id="colProductId" prefWidth="55.0" text="ID" />

View File

@@ -55,6 +55,12 @@
</HBox> </HBox>
<!-- TABLE --> <!-- TABLE -->
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvPurchaseOrders" <TableView fx:id="tvPurchaseOrders"
style="-fx-background-color:white; -fx-background-radius:12;" style="-fx-background-color:white; -fx-background-radius:12;"
VBox.vgrow="ALWAYS"> VBox.vgrow="ALWAYS">

View File

@@ -89,6 +89,11 @@
</Button> </Button>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvCart" prefHeight="170.0" style="-fx-background-color: white; -fx-background-radius: 10;" VBox.vgrow="NEVER"> <TableView fx:id="tvCart" prefHeight="170.0" style="-fx-background-color: white; -fx-background-radius: 10;" VBox.vgrow="NEVER">
<columns> <columns>
<TableColumn fx:id="colCartProduct" prefWidth="310.0" text="Product" /> <TableColumn fx:id="colCartProduct" prefWidth="310.0" text="Product" />

View File

@@ -51,6 +51,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -65,6 +73,12 @@
</TextField> </TextField>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvServices" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvServices" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colServiceId" prefWidth="60.0" text="ID" /> <TableColumn fx:id="colServiceId" prefWidth="60.0" text="ID" />

View File

@@ -76,6 +76,12 @@
</columns> </columns>
</TableView> </TableView>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<Label fx:id="lblError" text="" textFill="#FF6B6B" wrapText="true" /> <Label fx:id="lblError" text="" textFill="#FF6B6B" wrapText="true" />
</children> </children>
</VBox> </VBox>

View File

@@ -51,6 +51,14 @@
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" /> <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding> </padding>
</Button> </Button>
<Button fx:id="btnRefresh" mnemonicParsing="false" onAction="#btnRefresh" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Refresh" textFill="WHITE">
<font>
<Font name="System Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
</padding>
</Button>
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;"> <HBox alignment="CENTER_LEFT" prefHeight="37.0" prefWidth="727.0" spacing="10.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-radius: 14;">
@@ -65,6 +73,12 @@
</TextField> </TextField>
</children> </children>
</HBox> </HBox>
<Label fx:id="lblStatus" text="" textFill="#64748b" visible="false" managed="false">
<font>
<Font size="13.0" />
</font>
</Label>
<TableView fx:id="tvSuppliers" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS"> <TableView fx:id="tvSuppliers" prefHeight="362.0" prefWidth="752.0" style="-fx-background-color: white; -fx-background-radius: 12;" VBox.vgrow="ALWAYS">
<columns> <columns>
<TableColumn fx:id="colSupplierId" prefWidth="60.0" text="ID" /> <TableColumn fx:id="colSupplierId" prefWidth="60.0" text="ID" />