Merge branch 'AttachmentsToChat'
This commit is contained in:
@@ -21,6 +21,7 @@ public class AppointmentDTO {
|
||||
private SimpleStringProperty appointmentDate;
|
||||
private SimpleStringProperty appointmentTime;
|
||||
private SimpleStringProperty appointmentStatus;
|
||||
private SimpleStringProperty storeName;
|
||||
|
||||
public AppointmentDTO(int appointmentId,
|
||||
int customerId, String customerName,
|
||||
@@ -30,7 +31,8 @@ public class AppointmentDTO {
|
||||
String employeeName,
|
||||
String appointmentDate,
|
||||
String appointmentTime,
|
||||
String appointmentStatus) {
|
||||
String appointmentStatus,
|
||||
String storeName) {
|
||||
|
||||
this.appointmentId = new SimpleIntegerProperty(appointmentId);
|
||||
this.customerId = new SimpleIntegerProperty(customerId);
|
||||
@@ -44,6 +46,7 @@ public class AppointmentDTO {
|
||||
this.appointmentDate = new SimpleStringProperty(appointmentDate);
|
||||
this.appointmentTime = new SimpleStringProperty(appointmentTime);
|
||||
this.appointmentStatus = new SimpleStringProperty(appointmentStatus);
|
||||
this.storeName = new SimpleStringProperty(storeName != null ? storeName : "");
|
||||
}
|
||||
|
||||
public int getAppointmentId() { return appointmentId.get(); }
|
||||
@@ -62,4 +65,5 @@ public class AppointmentDTO {
|
||||
public String getAppointmentDate() { return appointmentDate.get(); }
|
||||
public String getAppointmentTime() { return appointmentTime.get(); }
|
||||
public String getAppointmentStatus() { return appointmentStatus.get(); }
|
||||
public String getStoreName() { return storeName.get(); }
|
||||
}
|
||||
|
||||
@@ -8,18 +8,21 @@ public class PurchaseOrderDTO {
|
||||
private StringProperty supplierName;
|
||||
private StringProperty orderDate;
|
||||
private StringProperty status;
|
||||
private StringProperty storeName;
|
||||
|
||||
public PurchaseOrderDTO(long id, String supplierName,
|
||||
String orderDate, String status) {
|
||||
String orderDate, String status, String storeName) {
|
||||
|
||||
this.purchaseOrderId = new SimpleLongProperty(id);
|
||||
this.supplierName = new SimpleStringProperty(supplierName);
|
||||
this.orderDate = new SimpleStringProperty(orderDate);
|
||||
this.status = new SimpleStringProperty(status);
|
||||
this.storeName = new SimpleStringProperty(storeName != null ? storeName : "");
|
||||
}
|
||||
|
||||
public long getPurchaseOrderId() { return purchaseOrderId.get(); }
|
||||
public String getSupplierName() { return supplierName.get(); }
|
||||
public String getOrderDate() { return orderDate.get(); }
|
||||
public String getStatus() { return status.get(); }
|
||||
public String getStoreName() { return storeName.get(); }
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public class AdoptionResponse {
|
||||
private LocalDate adoptionDate;
|
||||
private java.math.BigDecimal adoptionFee;
|
||||
private String adoptionStatus;
|
||||
private String sourceStoreName;
|
||||
|
||||
public AdoptionResponse() {
|
||||
}
|
||||
@@ -96,4 +97,12 @@ public class AdoptionResponse {
|
||||
public void setAdoptionStatus(String adoptionStatus) {
|
||||
this.adoptionStatus = adoptionStatus;
|
||||
}
|
||||
|
||||
public String getSourceStoreName() {
|
||||
return sourceStoreName;
|
||||
}
|
||||
|
||||
public void setSourceStoreName(String sourceStoreName) {
|
||||
this.sourceStoreName = sourceStoreName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.time.LocalDate;
|
||||
public class PurchaseOrderResponse {
|
||||
private Long purchaseOrderId;
|
||||
private String supplierName;
|
||||
private String storeName;
|
||||
private LocalDate orderDate;
|
||||
private LocalDate expectedDeliveryDate;
|
||||
private String orderStatus;
|
||||
@@ -30,6 +31,14 @@ public class PurchaseOrderResponse {
|
||||
this.supplierName = supplierName;
|
||||
}
|
||||
|
||||
public String getStoreName() {
|
||||
return storeName;
|
||||
}
|
||||
|
||||
public void setStoreName(String storeName) {
|
||||
this.storeName = storeName;
|
||||
}
|
||||
|
||||
public LocalDate getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
|
||||
@@ -23,11 +23,14 @@ public class AdoptionApi {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<AdoptionResponse> listAdoptions(String query) throws Exception {
|
||||
public List<AdoptionResponse> listAdoptions(String query, Long storeId) throws Exception {
|
||||
String path = "/api/v1/adoptions?page=0&size=1000";
|
||||
if (query != null && !query.isEmpty()) {
|
||||
path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8);
|
||||
}
|
||||
if (storeId != null) {
|
||||
path += "&storeId=" + storeId;
|
||||
}
|
||||
String response = apiClient.getRawResponse(path);
|
||||
PageResponse<AdoptionResponse> pageResponse = apiClient.getObjectMapper().readValue(
|
||||
response,
|
||||
|
||||
@@ -23,11 +23,14 @@ public class AppointmentApi {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<AppointmentResponse> listAppointments(String query) throws Exception {
|
||||
public List<AppointmentResponse> listAppointments(String query, Long storeId) throws Exception {
|
||||
String path = "/api/v1/appointments?page=0&size=1000";
|
||||
if (query != null && !query.isEmpty()) {
|
||||
path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8);
|
||||
}
|
||||
if (storeId != null) {
|
||||
path += "&storeId=" + storeId;
|
||||
}
|
||||
String response = apiClient.getRawResponse(path);
|
||||
PageResponse<AppointmentResponse> pageResponse = apiClient.getObjectMapper().readValue(
|
||||
response,
|
||||
|
||||
@@ -22,11 +22,14 @@ public class InventoryApi {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<InventoryResponse> listInventory(String query) throws Exception {
|
||||
public List<InventoryResponse> listInventory(String query, Long storeId) throws Exception {
|
||||
String path = "/api/v1/inventory?page=0&size=1000";
|
||||
if (query != null && !query.isEmpty()) {
|
||||
path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8);
|
||||
}
|
||||
if (storeId != null) {
|
||||
path += "&storeId=" + storeId;
|
||||
}
|
||||
String response = apiClient.getRawResponse(path);
|
||||
PageResponse<InventoryResponse> pageResponse = apiClient.getObjectMapper().readValue(
|
||||
response,
|
||||
|
||||
@@ -21,11 +21,14 @@ public class PurchaseOrderApi {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<PurchaseOrderResponse> listPurchaseOrders(String query) throws Exception {
|
||||
public List<PurchaseOrderResponse> listPurchaseOrders(String query, Long storeId) throws Exception {
|
||||
String path = "/api/v1/purchase-orders?page=0&size=1000";
|
||||
if (query != null && !query.isEmpty()) {
|
||||
path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8);
|
||||
}
|
||||
if (storeId != null) {
|
||||
path += "&storeId=" + storeId;
|
||||
}
|
||||
String response = apiClient.getRawResponse(path);
|
||||
PageResponse<PurchaseOrderResponse> pageResponse = apiClient.getObjectMapper().readValue(
|
||||
response,
|
||||
|
||||
@@ -22,11 +22,14 @@ public class SaleApi {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<SaleResponse> listSales(int page, int size, String query) throws Exception {
|
||||
public List<SaleResponse> listSales(int page, int size, String query, Long storeId) throws Exception {
|
||||
String path = "/api/v1/sales?page=" + page + "&size=" + size;
|
||||
if (query != null && !query.isEmpty()) {
|
||||
path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8);
|
||||
}
|
||||
if (storeId != null) {
|
||||
path += "&storeId=" + storeId;
|
||||
}
|
||||
String response = apiClient.getRawResponse(path);
|
||||
PageResponse<SaleResponse> pageResponse = apiClient.getObjectMapper().readValue(
|
||||
response,
|
||||
@@ -38,7 +41,7 @@ public class SaleApi {
|
||||
return pageResponse.getContent();
|
||||
}
|
||||
|
||||
public List<SaleResponse> listAllSales(String query) throws Exception {
|
||||
public List<SaleResponse> listAllSales(String query, Long storeId) throws Exception {
|
||||
int page = 0;
|
||||
int size = 250;
|
||||
List<SaleResponse> allSales = new java.util.ArrayList<>();
|
||||
@@ -48,6 +51,9 @@ public class SaleApi {
|
||||
if (query != null && !query.isEmpty()) {
|
||||
path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8);
|
||||
}
|
||||
if (storeId != null) {
|
||||
path += "&storeId=" + storeId;
|
||||
}
|
||||
|
||||
String response = apiClient.getRawResponse(path);
|
||||
PageResponse<SaleResponse> pageResponse = apiClient.getObjectMapper().readValue(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.example.petshopdesktop.controllers;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import org.example.petshopdesktop.auth.UserSession;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -62,6 +63,9 @@ public class AdoptionController {
|
||||
@FXML
|
||||
private TableColumn<Adoption, String> colAdoptionStatus;
|
||||
|
||||
@FXML
|
||||
private TableColumn<Adoption, String> colStoreName;
|
||||
|
||||
@FXML
|
||||
private TableView<Adoption> tvAdoptions;
|
||||
|
||||
@@ -85,6 +89,7 @@ public class AdoptionController {
|
||||
colAdoptionDate.setCellValueFactory(new PropertyValueFactory<>("adoptionDate"));
|
||||
colAdoptionFee.setCellValueFactory(new PropertyValueFactory<>("adoptionFee"));
|
||||
colAdoptionStatus.setCellValueFactory(new PropertyValueFactory<>("adoptionStatus"));
|
||||
colStoreName.setCellValueFactory(new PropertyValueFactory<>("storeName"));
|
||||
TableViewSupport.applyCurrencyColumn(colAdoptionFee);
|
||||
|
||||
displayAdoptions();
|
||||
@@ -184,7 +189,8 @@ public class AdoptionController {
|
||||
} else {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<AdoptionResponse> adoptions = AdoptionApi.getInstance().listAdoptions(filter);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<AdoptionResponse> adoptions = AdoptionApi.getInstance().listAdoptions(filter, storeId);
|
||||
List<Adoption> adoptionList = adoptions.stream()
|
||||
.map(this::mapToAdoption)
|
||||
.sorted(Comparator.comparing(Adoption::getAdoptionDate).reversed())
|
||||
@@ -210,7 +216,8 @@ public class AdoptionController {
|
||||
private void displayAdoptions() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<AdoptionResponse> adoptions = AdoptionApi.getInstance().listAdoptions(null);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<AdoptionResponse> adoptions = AdoptionApi.getInstance().listAdoptions(null, storeId);
|
||||
List<Adoption> adoptionList = adoptions.stream()
|
||||
.map(this::mapToAdoption)
|
||||
.sorted(Comparator.comparing(Adoption::getAdoptionDate).reversed())
|
||||
@@ -276,7 +283,8 @@ public class AdoptionController {
|
||||
response.getEmployeeName(),
|
||||
response.getAdoptionDate() != null ? response.getAdoptionDate().toString() : "",
|
||||
response.getAdoptionFee() != null ? response.getAdoptionFee().doubleValue() : 0.0,
|
||||
response.getAdoptionStatus()
|
||||
response.getAdoptionStatus(),
|
||||
response.getSourceStoreName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +327,8 @@ public class AnalyticsController {
|
||||
}
|
||||
|
||||
private DashboardResponse buildStaffFallbackDashboard() throws Exception {
|
||||
List<SaleResponse> sales = SaleApi.getInstance().listSales(0, Integer.MAX_VALUE, null);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<SaleResponse> sales = SaleApi.getInstance().listSales(0, Integer.MAX_VALUE, null, storeId);
|
||||
String employeeName = UserSession.getInstance().getEmployeeName();
|
||||
if (employeeName == null || employeeName.isBlank()) {
|
||||
employeeName = UserSession.getInstance().getUsername();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.example.petshopdesktop.controllers;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import org.example.petshopdesktop.auth.UserSession;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.transformation.FilteredList;
|
||||
@@ -36,6 +37,7 @@ public class AppointmentController {
|
||||
@FXML private TableColumn<AppointmentDTO,String> colCustomerName;
|
||||
@FXML private TableColumn<AppointmentDTO,String> colEmployeeName;
|
||||
@FXML private TableColumn<AppointmentDTO,String> colAppointmentStatus;
|
||||
@FXML private TableColumn<AppointmentDTO,String> colStoreName;
|
||||
|
||||
@FXML private Button btnAdd;
|
||||
@FXML private Button btnEdit;
|
||||
@@ -63,6 +65,7 @@ public class AppointmentController {
|
||||
colCustomerName.setCellValueFactory(new PropertyValueFactory<>("customerName"));
|
||||
colEmployeeName.setCellValueFactory(new PropertyValueFactory<>("employeeName"));
|
||||
colAppointmentStatus.setCellValueFactory(new PropertyValueFactory<>("appointmentStatus"));
|
||||
colStoreName.setCellValueFactory(new PropertyValueFactory<>("storeName"));
|
||||
|
||||
filtered = new FilteredList<>(appointments, a -> true);
|
||||
TableViewSupport.bindSortedItems(tvAppointments, filtered);
|
||||
@@ -92,7 +95,8 @@ public class AppointmentController {
|
||||
private void loadAppointments(){
|
||||
new Thread(() -> {
|
||||
try{
|
||||
List<AppointmentResponse> responses = AppointmentApi.getInstance().listAppointments(null);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<AppointmentResponse> responses = AppointmentApi.getInstance().listAppointments(null, storeId);
|
||||
List<AppointmentDTO> appointmentDTOs = responses.stream()
|
||||
.map(this::mapToAppointmentDTO)
|
||||
.sorted(Comparator.comparing((AppointmentDTO a) -> a.getAppointmentDate() + "T" + a.getAppointmentTime()).reversed())
|
||||
@@ -117,7 +121,8 @@ public class AppointmentController {
|
||||
String query = text == null || text.trim().isEmpty() ? null : text.trim();
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<AppointmentResponse> responses = AppointmentApi.getInstance().listAppointments(query);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<AppointmentResponse> responses = AppointmentApi.getInstance().listAppointments(query, storeId);
|
||||
List<AppointmentDTO> appointmentDTOs = responses.stream()
|
||||
.map(this::mapToAppointmentDTO)
|
||||
.sorted(Comparator.comparing((AppointmentDTO a) -> a.getAppointmentDate() + "T" + a.getAppointmentTime()).reversed())
|
||||
@@ -263,7 +268,8 @@ public class AppointmentController {
|
||||
response.getEmployeeName() != null ? response.getEmployeeName() : "",
|
||||
response.getAppointmentDate() != null ? response.getAppointmentDate().toString() : "",
|
||||
response.getAppointmentTime() != null ? response.getAppointmentTime().toString() : "",
|
||||
normalizeAppointmentStatus(response.getAppointmentStatus())
|
||||
normalizeAppointmentStatus(response.getAppointmentStatus()),
|
||||
response.getStoreName()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.stage.Modality;
|
||||
import org.example.petshopdesktop.auth.UserSession;
|
||||
import javafx.stage.Stage;
|
||||
import org.example.petshopdesktop.api.dto.inventory.InventoryResponse;
|
||||
import org.example.petshopdesktop.api.endpoints.InventoryApi;
|
||||
@@ -53,6 +54,9 @@ public class InventoryController {
|
||||
@FXML
|
||||
private TableColumn<Inventory, Integer> colQuantity;
|
||||
|
||||
@FXML
|
||||
private TableColumn<Inventory, String> colStoreName;
|
||||
|
||||
@FXML
|
||||
private TableView<Inventory> tvInventory;
|
||||
|
||||
@@ -75,6 +79,7 @@ public class InventoryController {
|
||||
colProductId.setCellValueFactory(new PropertyValueFactory<>("prodId"));
|
||||
colProductName.setCellValueFactory(new PropertyValueFactory<>("prodName"));
|
||||
colQuantity.setCellValueFactory(new PropertyValueFactory<>("quantity"));
|
||||
colStoreName.setCellValueFactory(new PropertyValueFactory<>("storeName"));
|
||||
|
||||
displayInventory();
|
||||
TableViewSupport.installDoubleClickAction(tvInventory, selected -> openDialog(selected, "Edit"));
|
||||
@@ -167,7 +172,8 @@ public class InventoryController {
|
||||
} else {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<InventoryResponse> inventories = InventoryApi.getInstance().listInventory(filter);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<InventoryResponse> inventories = InventoryApi.getInstance().listInventory(filter, storeId);
|
||||
List<Inventory> inventoryList = inventories.stream()
|
||||
.map(this::mapToInventory)
|
||||
.collect(Collectors.toList());
|
||||
@@ -192,7 +198,8 @@ public class InventoryController {
|
||||
private void displayInventory() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<InventoryResponse> inventories = InventoryApi.getInstance().listInventory(null);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<InventoryResponse> inventories = InventoryApi.getInstance().listInventory(null, storeId);
|
||||
List<Inventory> inventoryList = inventories.stream()
|
||||
.map(this::mapToInventory)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.example.petshopdesktop.controllers;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import org.example.petshopdesktop.auth.UserSession;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
@@ -228,7 +229,8 @@ public class PetController {
|
||||
} else {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<PetResponse> pets = PetApi.getInstance().listPets(filter, species, status);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<PetResponse> pets = PetApi.getInstance().listPets(filter, species, status, storeId);
|
||||
List<Pet> petList = pets.stream()
|
||||
.map(this::mapToPet)
|
||||
.collect(Collectors.toList());
|
||||
@@ -253,7 +255,8 @@ public class PetController {
|
||||
private void displayPets() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<PetResponse> pets = PetApi.getInstance().listPets(null, selectedSpecies(), selectedStatus());
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<PetResponse> pets = PetApi.getInstance().listPets(null, selectedSpecies(), selectedStatus(), storeId);
|
||||
List<Pet> petList = pets.stream()
|
||||
.map(this::mapToPet)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -10,6 +10,7 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import org.example.petshopdesktop.DTOs.PurchaseOrderDTO;
|
||||
import org.example.petshopdesktop.auth.UserSession;
|
||||
import org.example.petshopdesktop.api.dto.purchaseorder.PurchaseOrderResponse;
|
||||
import org.example.petshopdesktop.api.endpoints.PurchaseOrderApi;
|
||||
import org.example.petshopdesktop.controllers.dialogcontrollers.PurchaseOrderDetailsDialogController;
|
||||
@@ -39,6 +40,7 @@ public class PurchaseOrderController {
|
||||
@FXML private TableColumn<PurchaseOrderDTO,String> colSupplier;
|
||||
@FXML private TableColumn<PurchaseOrderDTO,String> colOrderDate;
|
||||
@FXML private TableColumn<PurchaseOrderDTO,String> colStatus;
|
||||
@FXML private TableColumn<PurchaseOrderDTO,String> colStoreName;
|
||||
|
||||
private final ObservableList<PurchaseOrderDTO> purchaseOrders = FXCollections.observableArrayList();
|
||||
private FilteredList<PurchaseOrderDTO> filtered;
|
||||
@@ -55,6 +57,7 @@ public class PurchaseOrderController {
|
||||
colOrderDate.setCellValueFactory(
|
||||
new PropertyValueFactory<>("orderDate"));
|
||||
|
||||
colStoreName.setCellValueFactory(new javafx.scene.control.cell.PropertyValueFactory<>("storeName"));
|
||||
colStatus.setCellValueFactory(
|
||||
new PropertyValueFactory<>("status"));
|
||||
|
||||
@@ -72,7 +75,8 @@ public class PurchaseOrderController {
|
||||
private void loadPurchaseOrders() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
List<PurchaseOrderResponse> responses = PurchaseOrderApi.getInstance().listPurchaseOrders(null);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<PurchaseOrderResponse> responses = PurchaseOrderApi.getInstance().listPurchaseOrders(null, storeId);
|
||||
List<PurchaseOrderDTO> dtos = responses.stream()
|
||||
.map(this::mapToPurchaseOrderDTO)
|
||||
.sorted(Comparator.comparing(PurchaseOrderDTO::getOrderDate).reversed())
|
||||
@@ -154,7 +158,8 @@ public class PurchaseOrderController {
|
||||
response.getPurchaseOrderId(),
|
||||
response.getSupplierName(),
|
||||
response.getOrderDate() != null ? response.getOrderDate().toString() : "",
|
||||
response.getOrderStatus()
|
||||
response.getOrderStatus(),
|
||||
response.getStoreName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,9 @@ public class SaleController {
|
||||
@FXML
|
||||
private TableColumn<SaleLineItem, String> colSalePaymentType;
|
||||
|
||||
@FXML
|
||||
private TableColumn<SaleLineItem, String> colStoreName;
|
||||
|
||||
@FXML
|
||||
private TableView<SaleLineItem> tvSales;
|
||||
|
||||
@@ -175,6 +178,7 @@ public class SaleController {
|
||||
colSaleUnitPrice.setCellValueFactory(new PropertyValueFactory<>("unitPrice"));
|
||||
colSaleTotal.setCellValueFactory(new PropertyValueFactory<>("total"));
|
||||
colSalePaymentType.setCellValueFactory(new PropertyValueFactory<>("paymentMethod"));
|
||||
colStoreName.setCellValueFactory(new PropertyValueFactory<>("storeName"));
|
||||
colSaleId.setMinWidth(50);
|
||||
colSaleDate.setMinWidth(150);
|
||||
colEmployeeName.setMinWidth(150);
|
||||
@@ -263,7 +267,8 @@ public class SaleController {
|
||||
Task<List<SaleLineItem>> task = new Task<List<SaleLineItem>>() {
|
||||
@Override
|
||||
protected List<SaleLineItem> call() throws Exception {
|
||||
List<SaleResponse> sales = SaleApi.getInstance().listAllSales(null);
|
||||
Long storeId = UserSession.getInstance().isAdmin() ? null : UserSession.getInstance().getStoreId();
|
||||
List<SaleResponse> sales = SaleApi.getInstance().listAllSales(null, storeId);
|
||||
sales.sort(Comparator.comparing(SaleResponse::getSaleDate, Comparator.nullsLast(Comparator.reverseOrder()))
|
||||
.thenComparing(SaleResponse::getSaleId, Comparator.nullsLast(Comparator.reverseOrder())));
|
||||
List<SaleLineItem> lineItems = new ArrayList<>();
|
||||
@@ -291,7 +296,8 @@ public class SaleController {
|
||||
unitPrice,
|
||||
lineTotal,
|
||||
sale.getPaymentMethod(),
|
||||
isRefund
|
||||
isRefund,
|
||||
sale.getStoreName()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -563,7 +569,7 @@ public class SaleController {
|
||||
|
||||
private void updateSalesColumnWidths(double tableWidth) {
|
||||
double available = Math.max(tableWidth - 28.0, 0.0);
|
||||
double baseWidth = 1125.0;
|
||||
double baseWidth = 1255.0;
|
||||
if (available <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -577,18 +583,20 @@ public class SaleController {
|
||||
colSaleUnitPrice.setPrefWidth(115.0);
|
||||
colSaleTotal.setPrefWidth(120.0);
|
||||
colSalePaymentType.setPrefWidth(110.0);
|
||||
colStoreName.setPrefWidth(130.0);
|
||||
return;
|
||||
}
|
||||
|
||||
double extra = available - baseWidth;
|
||||
colSaleId.setPrefWidth(60.0);
|
||||
colSaleDate.setPrefWidth(170.0 + extra * 0.18);
|
||||
colEmployeeName.setPrefWidth(160.0 + extra * 0.18);
|
||||
colServiceProduct.setPrefWidth(320.0 + extra * 0.42);
|
||||
colSaleDate.setPrefWidth(170.0 + extra * 0.16);
|
||||
colEmployeeName.setPrefWidth(160.0 + extra * 0.16);
|
||||
colServiceProduct.setPrefWidth(320.0 + extra * 0.38);
|
||||
colSaleQuantity.setPrefWidth(70.0);
|
||||
colSaleUnitPrice.setPrefWidth(115.0 + extra * 0.08);
|
||||
colSaleTotal.setPrefWidth(120.0 + extra * 0.08);
|
||||
colSalePaymentType.setPrefWidth(110.0 + extra * 0.06);
|
||||
colStoreName.setPrefWidth(130.0 + extra * 0.08);
|
||||
}
|
||||
|
||||
private void updateCartColumnWidths(double tableWidth) {
|
||||
|
||||
@@ -158,7 +158,7 @@ public class RefundDialogController {
|
||||
Task<LoadedSaleData> task = new Task<>() {
|
||||
@Override
|
||||
protected LoadedSaleData call() throws Exception {
|
||||
List<SaleResponse> allSales = SaleApi.getInstance().listAllSales(null);
|
||||
List<SaleResponse> allSales = SaleApi.getInstance().listAllSales(null, null);
|
||||
SaleResponse sale = SaleApi.getInstance().getSale(saleId);
|
||||
if (Boolean.TRUE.equals(sale.getIsRefund())) {
|
||||
throw new IllegalStateException("Select an original sale, not a refund record.");
|
||||
|
||||
@@ -15,8 +15,9 @@ public class Adoption {
|
||||
private SimpleStringProperty adoptionDate;
|
||||
private SimpleDoubleProperty adoptionFee;
|
||||
private SimpleStringProperty adoptionStatus;
|
||||
private SimpleStringProperty storeName;
|
||||
|
||||
public Adoption(int adoptionId, int petId, int customerId, int employeeId, String petName, String customerName, String employeeName, String adoptionDate, double adoptionFee, String adoptionStatus) {
|
||||
public Adoption(int adoptionId, int petId, int customerId, int employeeId, String petName, String customerName, String employeeName, String adoptionDate, double adoptionFee, String adoptionStatus, String storeName) {
|
||||
this.adoptionId = new SimpleIntegerProperty(adoptionId);
|
||||
this.petId = new SimpleIntegerProperty(petId);
|
||||
this.customerId = new SimpleIntegerProperty(customerId);
|
||||
@@ -27,6 +28,7 @@ public class Adoption {
|
||||
this.adoptionDate = new SimpleStringProperty(adoptionDate);
|
||||
this.adoptionFee = new SimpleDoubleProperty(adoptionFee);
|
||||
this.adoptionStatus = new SimpleStringProperty(adoptionStatus);
|
||||
this.storeName = new SimpleStringProperty(storeName != null ? storeName : "");
|
||||
}
|
||||
|
||||
public int getAdoptionId() { return adoptionId.get(); }
|
||||
@@ -88,4 +90,10 @@ public class Adoption {
|
||||
public void setAdoptionStatus(String adoptionStatus) { this.adoptionStatus.set(adoptionStatus); }
|
||||
|
||||
public SimpleStringProperty adoptionStatusProperty() { return adoptionStatus; }
|
||||
|
||||
public String getStoreName() { return storeName.get(); }
|
||||
|
||||
public void setStoreName(String storeName) { this.storeName.set(storeName); }
|
||||
|
||||
public SimpleStringProperty storeNameProperty() { return storeName; }
|
||||
}
|
||||
|
||||
@@ -10,8 +10,9 @@ public class SaleLineItem {
|
||||
private final double total;
|
||||
private final String paymentMethod;
|
||||
private final boolean isRefund;
|
||||
private final String storeName;
|
||||
|
||||
public SaleLineItem(int saleId, String saleDate, String employeeName, String itemName, int quantity, double unitPrice, double total, String paymentMethod, boolean isRefund) {
|
||||
public SaleLineItem(int saleId, String saleDate, String employeeName, String itemName, int quantity, double unitPrice, double total, String paymentMethod, boolean isRefund, String storeName) {
|
||||
this.saleId = saleId;
|
||||
this.saleDate = saleDate;
|
||||
this.employeeName = employeeName;
|
||||
@@ -21,6 +22,7 @@ public class SaleLineItem {
|
||||
this.total = total;
|
||||
this.paymentMethod = paymentMethod;
|
||||
this.isRefund = isRefund;
|
||||
this.storeName = storeName != null ? storeName : "";
|
||||
}
|
||||
|
||||
public int getSaleId() {
|
||||
@@ -58,4 +60,8 @@ public class SaleLineItem {
|
||||
public boolean isRefund() {
|
||||
return isRefund;
|
||||
}
|
||||
|
||||
public String getStoreName() {
|
||||
return storeName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<TableColumn fx:id="colAdoptionDate" prefWidth="190.85711669921875" text="Adoption Date" />
|
||||
<TableColumn fx:id="colAdoptionFee" prefWidth="91.4285888671875" text="Fee" />
|
||||
<TableColumn fx:id="colAdoptionStatus" prefWidth="120.0" text="Status" />
|
||||
<TableColumn fx:id="colStoreName" prefWidth="130.0" text="Store" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
<TableColumn fx:id="colAppointmentTime" prefWidth="89.7142333984375" text="Time" />
|
||||
<TableColumn fx:id="colCustomerName" prefWidth="140.0" text="Customer" />
|
||||
<TableColumn fx:id="colAppointmentStatus" prefWidth="98.28570556640625" text="Status" />
|
||||
<TableColumn fx:id="colStoreName" prefWidth="130.0" text="Store" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<TableColumn fx:id="colProductId" prefWidth="153.14285278320312" text="Product ID" />
|
||||
<TableColumn fx:id="colProductName" prefWidth="325.14288330078125" text="Product Name" />
|
||||
<TableColumn fx:id="colQuantity" prefWidth="179.42852783203125" text="Quantity" />
|
||||
<TableColumn fx:id="colStoreName" prefWidth="130.0" text="Store" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<TableColumn fx:id="colSupplier" text="Supplier" prefWidth="200"/>
|
||||
<TableColumn fx:id="colOrderDate" text="Order Date" prefWidth="150"/>
|
||||
<TableColumn fx:id="colStatus" text="Status" prefWidth="120"/>
|
||||
<TableColumn fx:id="colStoreName" text="Store" prefWidth="130"/>
|
||||
</columns>
|
||||
|
||||
</TableView>
|
||||
|
||||
@@ -186,6 +186,7 @@
|
||||
<TableColumn fx:id="colSaleUnitPrice" minWidth="100.0" prefWidth="115.0" text="Unit Price" />
|
||||
<TableColumn fx:id="colSaleTotal" minWidth="100.0" prefWidth="120.0" text="Total" />
|
||||
<TableColumn fx:id="colSalePaymentType" minWidth="95.0" prefWidth="110.0" text="Payment" />
|
||||
<TableColumn fx:id="colStoreName" minWidth="100.0" prefWidth="130.0" text="Store" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
|
||||
Reference in New Issue
Block a user