summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorViktoria Pundy <viktoria.pundy@aon.at>2018-06-03 12:48:46 +0200
committerTharre <tharre3@gmail.com>2018-06-13 18:45:36 +0200
commit6fc7c0033e7e48c4e1f717d21db70552460676c1 (patch)
tree1c5e5c25e940aaff50f94ed8efd413db4365beda /src/main
parent04b9248e78d9969fa880133f37d932cf50a5b73c (diff)
downloadsepm-groupproject-6fc7c0033e7e48c4e1f717d21db70552460676c1.tar.gz
sepm-groupproject-6fc7c0033e7e48c4e1f717d21db70552460676c1.tar.xz
sepm-groupproject-6fc7c0033e7e48c4e1f717d21db70552460676c1.zip
Added label for status of archived operation, added statistics {#27299]
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ArchiveOperationController.java41
-rw-r--r--src/main/resources/fxml/ArchiveOperation.fxml9
2 files changed, 30 insertions, 20 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ArchiveOperationController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ArchiveOperationController.java
index d66ad40..5e89b66 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ArchiveOperationController.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/ArchiveOperationController.java
@@ -31,9 +31,10 @@ import org.springframework.stereotype.Controller;
public class ArchiveOperationController {
@FXML private ImageView imvVehicleDetail;
+ @FXML private Label lblStatus;
@FXML private AnchorPane apMainDetails;
@FXML private Label lblOperations;
- @FXML private Label lblClosed;
+ @FXML private Label lblCompleted;
@FXML private Label lblCancelled;
@FXML private AnchorPane backApMain;
@FXML private AnchorPane backApDetails;
@@ -70,6 +71,15 @@ public class ArchiveOperationController {
list.clear();
try {
list.addAll(operationService.list(EnumSet.of(Status.CANCELLED, Status.COMPLETED)));
+ long cancelledAmount = 0;
+ long completedAmount = 0;
+ for (Operation operation : list) {
+ if (operation.status() == Status.CANCELLED) cancelledAmount++;
+ else completedAmount++;
+ }
+ lblCancelled.setText("storniert: " + cancelledAmount);
+ lblCompleted.setText("abgeschlossen: " + completedAmount);
+ lblOperations.setText("Einsätze: " + list.size());
} catch (ServiceException e) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Fehler");
@@ -97,7 +107,7 @@ public class ArchiveOperationController {
backApDetails.setVisible(true);
setOperation();
setDetailsVisible(true);
- imvVehicleDetail.setImage(new Image(("/images/Vehicle.png")));
+ imvVehicleDetail.setImage(new Image("/images/Vehicle.png"));
});
archiveOperationFlowPane.getChildren().add(opInAController.getRoot());
}
@@ -110,6 +120,8 @@ public class ArchiveOperationController {
}
}
+ private Operation detailOperation;
+
private List<Operation> sortSet(Set<Operation> operationsSet) {
Operation[] array = operationsSet.toArray(new Operation[operationsSet.size()]);
for (int i = array.length - 1; i > 0; i--) {
@@ -130,26 +142,27 @@ public class ArchiveOperationController {
return Arrays.asList(array);
}
- private Operation detailOperation;
-
private void setOperation() {
lblCodeHeader.setText(detailOperation.opCode());
- String date = "am ";
if (detailOperation.created() != null) {
LocalDateTime dateTime =
LocalDateTime.ofInstant(
Objects.requireNonNull(detailOperation.created()), ZoneOffset.UTC);
- date +=
- dateTime.getDayOfMonth()
+ lblDate.setText(
+ "am "
+ + dateTime.getDayOfMonth()
+ "."
+ dateTime.getMonth().getValue()
+ "."
- + dateTime.getYear();
- lblDate.setText(date);
+ + dateTime.getYear());
} else {
lblDate.setText("---");
}
-
+ lblStatus.setText(
+ "Status: "
+ + (detailOperation.status() == Status.CANCELLED
+ ? "storniert"
+ : "abgeschlossen"));
lblOpCode.setText(detailOperation.opCode());
Collection<String> elements =
detailOperation.vehicles().stream().map(Vehicle::name).collect(Collectors.toList());
@@ -175,14 +188,6 @@ public class ArchiveOperationController {
alert.setContentText("Die Element konnte nicht geladen werden!");
alert.showAndWait();
}
-
- /*for (Vehicle vehicle : detailOperation.vehicles()) {
- Button b = new Button();
- b.setPrefHeight(200);
- b.setPrefWidth(600 / 2);
- b.setText(vehicle.name());
- fpVehicles.getChildren().add(b);
- }*/
}
public void setListVisible(boolean b) {
diff --git a/src/main/resources/fxml/ArchiveOperation.fxml b/src/main/resources/fxml/ArchiveOperation.fxml
index 8db231e..c479de6 100644
--- a/src/main/resources/fxml/ArchiveOperation.fxml
+++ b/src/main/resources/fxml/ArchiveOperation.fxml
@@ -63,7 +63,7 @@
<Font size="15.0" />
</font>
</Label>
- <Label fx:id="lblVehicles" layoutX="58.0" layoutY="91.0" prefHeight="46.0" prefWidth="554.0" text="Label">
+ <Label fx:id="lblVehicles" layoutX="58.0" layoutY="91.0" prefHeight="46.0" prefWidth="540.0" text="Label">
<font>
<Font size="15.0" />
</font>
@@ -74,6 +74,11 @@
</font>
</Label>
<ImageView fx:id="imvVehicleDetail" fitHeight="34.0" fitWidth="34.0" layoutX="14.0" layoutY="97.0" pickOnBounds="true" preserveRatio="true" />
+ <Label fx:id="lblStatus" alignment="CENTER_RIGHT" layoutX="476.0" layoutY="91.0" prefHeight="27.0" prefWidth="322.0" text="Status: ">
+ <font>
+ <Font name="System Bold" size="15.0" />
+ </font>
+ </Label>
</children>
</AnchorPane>
</children>
@@ -109,7 +114,7 @@
<Font name="System Bold" size="20.0" />
</font>
</Label>
- <Label fx:id="lblClosed" text="abgeschlossen:" GridPane.rowIndex="1">
+ <Label fx:id="lblCompleted" text="abgeschlossen:" GridPane.rowIndex="1">
<font>
<Font size="15.0" />
</font>