From 917aa8275fc8aae3e9e223a092ab4251df3444b5 Mon Sep 17 00:00:00 2001 From: arminribic Date: Tue, 14 May 2024 16:34:33 +0200 Subject: [PATCH] #10: Add Base for Delete Date Functionality --- .../hitec/nhplus/main/MainWindowController.java | 2 -- .../nhplus/nurse/LockedNurseController.java | 17 +++++++++++------ src/main/java/de/hitec/nhplus/nurse/Nurse.java | 6 +++++- .../de/hitec/nhplus/nurse/LockedNurseView.fxml | 5 +++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/hitec/nhplus/main/MainWindowController.java b/src/main/java/de/hitec/nhplus/main/MainWindowController.java index 7e887cf..af7b2f0 100644 --- a/src/main/java/de/hitec/nhplus/main/MainWindowController.java +++ b/src/main/java/de/hitec/nhplus/main/MainWindowController.java @@ -114,7 +114,6 @@ public class MainWindowController { } private void loadActiveNursePage() { - System.out.println("TODO: Active Nurse"); try { BorderPane activeNursePane = FXMLLoader.load( Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/nurse/AllNurseView.fxml")) @@ -130,7 +129,6 @@ public class MainWindowController { } private void loadLockedNursePage() { - System.out.println("TODO: Locked Nurse"); try { BorderPane lockedNursePane = FXMLLoader.load( Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/nurse/LockedNurseView.fxml")) diff --git a/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java b/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java index ecf3626..22fd6cd 100644 --- a/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java +++ b/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java @@ -2,18 +2,15 @@ package de.hitec.nhplus.nurse; import de.hitec.nhplus.datastorage.DaoFactory; import de.hitec.nhplus.nurse.database.NurseDao; -import javafx.application.Application; +import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.Button; -import javafx.scene.control.Tab; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.TextFieldTableCell; -import javafx.scene.layout.AnchorPane; -import javafx.stage.Stage; import java.sql.SQLException; @@ -31,6 +28,8 @@ public class LockedNurseController { @FXML public TableColumn columnSurName; @FXML + public TableColumn columnPhoneNumber; + @FXML public TableColumn columnDeleteDate; private final ObservableList nurses = FXCollections.observableArrayList(); @@ -47,8 +46,14 @@ public class LockedNurseController { this.columnSurName.setCellValueFactory(new PropertyValueFactory<>("surName")); this.columnSurName.setCellFactory(TextFieldTableCell.forTableColumn()); - this.columnDeleteDate.setCellValueFactory(new PropertyValueFactory<>("date")); - this.columnDeleteDate.setCellFactory(TextFieldTableCell.forTableColumn()); + this.columnPhoneNumber.setCellValueFactory(new PropertyValueFactory<>("phoneNumber")); + this.columnPhoneNumber.setCellFactory(TextFieldTableCell.forTableColumn()); + + this.columnDeleteDate.setCellValueFactory(cellData -> { + return new SimpleStringProperty(cellData.getValue().calculateDeleteDate()); + }); + //this.columnDeleteDate.setCellFactory(TextFieldTableCell.forTableColumn()); + this.tableView.setItems(this.nurses); } diff --git a/src/main/java/de/hitec/nhplus/nurse/Nurse.java b/src/main/java/de/hitec/nhplus/nurse/Nurse.java index 9b488af..6d76adc 100644 --- a/src/main/java/de/hitec/nhplus/nurse/Nurse.java +++ b/src/main/java/de/hitec/nhplus/nurse/Nurse.java @@ -17,7 +17,6 @@ public class Nurse extends Person { private final SimpleStringProperty phoneNumber; private final SimpleBooleanProperty locked; - /** * This constructor allows instantiating a {@link Nurse} object, * before it is stored in the database, by omitting the {@link Nurse#id ID} value. @@ -61,6 +60,11 @@ public class Nurse extends Person { this.locked = new SimpleBooleanProperty(isLocked); } + public String calculateDeleteDate() { + //TODO: Lese alle Behandlungen die Dieser Pfleger Durchgefürt hat & brechene mit ihnen das Datum + return "Comming soon"; + } + public void setPhoneNumber(String phoneNumber) { this.phoneNumber.set(phoneNumber); } diff --git a/src/main/resources/de/hitec/nhplus/nurse/LockedNurseView.fxml b/src/main/resources/de/hitec/nhplus/nurse/LockedNurseView.fxml index 002ca90..c62dd2a 100644 --- a/src/main/resources/de/hitec/nhplus/nurse/LockedNurseView.fxml +++ b/src/main/resources/de/hitec/nhplus/nurse/LockedNurseView.fxml @@ -29,6 +29,11 @@ minWidth="140.0" text="Vorname" /> +