Create adoption sale
This commit is contained in:
@@ -9,6 +9,7 @@ public class AdoptionRequest {
|
||||
private Long sourceStoreId;
|
||||
private LocalDate adoptionDate;
|
||||
private String adoptionStatus;
|
||||
private String paymentMethod;
|
||||
|
||||
public AdoptionRequest() {
|
||||
}
|
||||
@@ -60,4 +61,12 @@ public class AdoptionRequest {
|
||||
public void setAdoptionStatus(String adoptionStatus) {
|
||||
this.adoptionStatus = adoptionStatus;
|
||||
}
|
||||
|
||||
public String getPaymentMethod() {
|
||||
return paymentMethod;
|
||||
}
|
||||
|
||||
public void setPaymentMethod(String paymentMethod) {
|
||||
this.paymentMethod = paymentMethod;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceDialog;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
@@ -57,6 +58,7 @@ public class AdoptionDialogController {
|
||||
|
||||
private String mode = null;
|
||||
private Adoption selectedAdoption = null;
|
||||
private String selectedPaymentMethod = null;
|
||||
|
||||
private ObservableList<String> statusList = FXCollections.observableArrayList(
|
||||
"Pending", "Completed", "Cancelled"
|
||||
@@ -66,6 +68,23 @@ public class AdoptionDialogController {
|
||||
void initialize() {
|
||||
|
||||
cbAdoptionStatus.setItems(statusList);
|
||||
cbAdoptionStatus.valueProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if ("Completed".equals(newVal) && !"Completed".equals(oldVal)) {
|
||||
ChoiceDialog<String> dialog = new ChoiceDialog<>("Cash", "Cash", "Credit Card", "Debit Card", "E-Transfer");
|
||||
dialog.setTitle("Payment Method");
|
||||
dialog.setHeaderText("Confirm payment received");
|
||||
dialog.setContentText("Select payment method:");
|
||||
dialog.showAndWait().ifPresentOrElse(
|
||||
method -> selectedPaymentMethod = method,
|
||||
() -> {
|
||||
selectedPaymentMethod = null;
|
||||
cbAdoptionStatus.setValue(oldVal);
|
||||
}
|
||||
);
|
||||
} else if (!"Completed".equals(newVal)) {
|
||||
selectedPaymentMethod = null;
|
||||
}
|
||||
});
|
||||
cbEmployee.setPromptText("Select an employee");
|
||||
|
||||
new Thread(() -> {
|
||||
@@ -203,6 +222,7 @@ public class AdoptionDialogController {
|
||||
request.setSourceStoreId(storeId);
|
||||
request.setAdoptionDate(dpAdoptionDate.getValue());
|
||||
request.setAdoptionStatus(cbAdoptionStatus.getValue());
|
||||
request.setPaymentMethod(selectedPaymentMethod);
|
||||
|
||||
if (mode.equals("Add")) {
|
||||
AdoptionApi.getInstance().createAdoption(request);
|
||||
|
||||
Reference in New Issue
Block a user