#7: (WIP) calculateDeleteDate
This commit is contained in:
parent
d2e41c06f2
commit
331c5697f1
4 changed files with 14 additions and 5 deletions
Binary file not shown.
|
@ -22,6 +22,7 @@ import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for all locked treatments.
|
* Controller for all locked treatments.
|
||||||
|
*
|
||||||
* @author Armin Ribic
|
* @author Armin Ribic
|
||||||
* @author Dorian Nemec
|
* @author Dorian Nemec
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +50,7 @@ public class LockedTreatmentController {
|
||||||
* This method allows initializing a {@link LockedNurseController} object
|
* This method allows initializing a {@link LockedNurseController} object
|
||||||
* that is called after the binding of all the fields.
|
* that is called after the binding of all the fields.
|
||||||
*/
|
*/
|
||||||
public void initialize(){
|
public void initialize() {
|
||||||
this.readAllAndShowInTableView();
|
this.readAllAndShowInTableView();
|
||||||
|
|
||||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||||
|
@ -67,8 +68,8 @@ public class LockedTreatmentController {
|
||||||
return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName());
|
return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty("coming soon")
|
this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty(DateConverter.convertLocalDateToString(cellData.getValue().calculateDeleteDate())));
|
||||||
);
|
|
||||||
|
|
||||||
this.tableView.setItems(this.treatments);
|
this.tableView.setItems(this.treatments);
|
||||||
}
|
}
|
||||||
|
@ -85,8 +86,7 @@ public class LockedTreatmentController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void unlockTreatment()
|
private void unlockTreatment() {
|
||||||
{
|
|
||||||
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||||
if (selectedItem == null) {
|
if (selectedItem == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package de.hitec.nhplus.treatment;
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
import de.hitec.nhplus.nurse.Nurse;
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
@ -10,6 +11,7 @@ import javafx.beans.property.SimpleStringProperty;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,4 +187,9 @@ public class Treatment {
|
||||||
.add("Remarks: " + this.getRemarks())
|
.add("Remarks: " + this.getRemarks())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalDate calculateDeleteDate() {
|
||||||
|
LocalDate delteDate = DateConverter.convertStringToLocalDate(getDate()).plusYears(10);
|
||||||
|
return delteDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -151,4 +152,5 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue