use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class BookingDetailsController method addRowFees.
private void addRowFees(final Pane content, final BookingBean be) {
final HBox box = new HBox();
// configure box
box.setSpacing(8);
box.setPadding(boxPadding);
box.setAlignment(Pos.CENTER);
box.setFillHeight(true);
// add cleaning fees
final TextField cleaningFeesTextField = new TextField();
Bindings.bindBidirectional(cleaningFeesTextField.textProperty(), be.cleaningFeesProperty(), new NumberStringConverter(decimalFormat));
cleaningFeesTextField.setPrefWidth(prefTextInputFieldWidth);
final TextFlow cleaningFeesTextFlow = new TextFlow(new Text("Cleaning Fees: "), cleaningFeesTextField, new Text(" €"));
box.getChildren().add(cleaningFeesTextFlow);
// add cleaning costs
final CleaningEntry ce = be.getCleaning();
if (ce != null) {
final TextField cleaningCostsTextField = new TextField();
Bindings.bindBidirectional(cleaningCostsTextField.textProperty(), ce.cleaningCostsProperty(), new NumberStringConverter(decimalFormat));
cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth);
final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "), cleaningCostsTextField, new Text(" €"));
box.getChildren().add(cleaningCostsTextFlow);
} else {
final TextField cleaningCostsTextField = new TextField("No Cleaning");
cleaningCostsTextField.setEditable(false);
cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth);
final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "), cleaningCostsTextField);
cleaningCostsTextField.getStyleClass().add("warning");
box.getChildren().add(cleaningCostsTextFlow);
}
// add service fees
final TextField serviceFeesTextField = new TextField();
Bindings.bindBidirectional(serviceFeesTextField.textProperty(), be.serviceFeeProperty(), new NumberStringConverter(decimalFormat));
serviceFeesTextField.setPrefWidth(prefTextInputFieldWidth);
final TextFlow serviceFeesAbsTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesTextField, new Text(" €"));
box.getChildren().add(serviceFeesAbsTextFlow);
// add service fees percent
final TextField serviceFeesPercentTextField = new TextField();
Bindings.bindBidirectional(serviceFeesPercentTextField.textProperty(), be.serviceFeesPercentProperty(), new NumberStringConverter(decimalFormat));
serviceFeesPercentTextField.setPrefWidth(prefTextInputFieldWidth);
final TextFlow serviceFeesPercentTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesPercentTextField, new Text(" %"));
box.getChildren().add(serviceFeesPercentTextFlow);
// add box to parent
content.getChildren().add(box);
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class CleaningPlanController method handleActionCopySelected.
@FXML
private void handleActionCopySelected(final ActionEvent event) {
final List<CleaningEntry> selection = content.getSelectionModel().getSelectedItems();
final StringBuilder sb = new StringBuilder();
final String roomNamePrefix = SettingsManager.getInstance().getRoomNamePrefix();
for (final Iterator<CleaningEntry> it = selection.iterator(); it.hasNext(); ) {
final CleaningEntry ce = it.next();
sb.append(CleaningPlanController.DATE_FORMATTER.format(ce.getDate()));
sb.append("\t");
sb.append(roomNamePrefix);
sb.append(ce.getRoom().getName());
if (ce.isShortTime()) {
sb.append("\t");
sb.append("bis 1600");
}
if (it.hasNext()) {
sb.append("\n");
}
}
final ClipboardContent content = new ClipboardContent();
content.putString(sb.toString());
Clipboard.getSystemClipboard().setContent(content);
final Tooltip t = new Tooltip("Content copied.");
t.setAutoHide(true);
t.setX(this.content.getScene().getWindow().getX() + this.content.getScene().getWindow().getWidth() - this.content.getScene().getWindow().getWidth() / 2);
t.setY(this.content.getScene().getWindow().getY() + this.content.getScene().getWindow().getHeight() - this.content.getScene().getWindow().getHeight() / 2);
t.show(this.content.getScene().getWindow());
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class UpcomingController method addEvents.
private void addEvents(final LocalDate date, final Collection<BookingEntry> upcomingBookings, final Collection<CleaningEntry> upcomingCleanings) {
final VBox box = new VBox(4);
if (date.equals(LocalDate.now())) {
box.getStyleClass().add("first-day");
} else if (date.equals(LocalDate.now().plusDays(1))) {
box.getStyleClass().add("second-day");
} else if (date.isAfter(LocalDate.now().plusDays(1))) {
box.getStyleClass().add("later");
}
if (upcomingBookings.stream().filter(b -> b.isCheckIn() || b.isCheckOut()).collect(Collectors.toList()).isEmpty() && upcomingCleanings.isEmpty()) {
final Text t0 = new Text(getDateString(date));
final Text t1 = new Text(" there are no events.");
t0.getStyleClass().add("emphasis");
final TextFlow tf = new TextFlow();
tf.getChildren().addAll(t0, t1);
box.getChildren().addAll(tf);
} else {
final List<CheckInOutDetails> checkInNotes = Collections.synchronizedList(new ArrayList<>());
final List<CheckInOutDetails> checkOutNotes = Collections.synchronizedList(new ArrayList<>());
upcomingBookings.forEach(b -> {
if (b.isCheckIn()) {
String note = "";
if (b.getElement().getCheckInNote() != null) {
note = b.getElement().getCheckInNote();
}
if (b.getElement().getSpecialRequestNote() != null) {
note = note + "\n" + b.getElement().getSpecialRequestNote();
}
checkInNotes.add(new CheckInOutDetails(b.getRoom().getName(), b.getElement().getBookingOrigin().getName(), note));
} else if (b.isCheckOut()) {
checkOutNotes.add(new CheckInOutDetails(b.getRoom().getName(), b.getElement().getBookingOrigin().getName(), b.getElement().getCheckOutNote()));
}
});
Collections.sort(checkInNotes);
Collections.sort(checkOutNotes);
addGeneralSummary(date, box, checkInNotes);
addCheckOutSummary(date, box, checkOutNotes);
addCheckOutNotes(date, box, checkOutNotes);
addCheckInSummary(date, box, checkInNotes);
addCheckInNotes(date, box, checkInNotes);
addCleaningSummary(date, box, upcomingCleanings);
addCleanings(date, box, upcomingCleanings);
}
this.box.getChildren().add(box);
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class CleaningEntryTest method testEqualsHashCode01.
@Test
public void testEqualsHashCode01() {
final CleaningEntry ce1 = new CleaningEntry(LocalDate.now(), TestUtils.getTestBooking("tt"), new Cleaning("testCleaning"), null);
final CleaningEntry ce2 = new CleaningEntry(LocalDate.now(), TestUtils.getTestBooking("tt"), new Cleaning("testCleaning"), null);
assertEquals(ce1.hashCode(), ce2.hashCode());
assertEquals(ce1, ce2);
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class UpcomingController method addCleanings.
private static void addCleanings(final LocalDate date, final VBox box, final Collection<CleaningEntry> upcomingBookings) {
for (final CleaningEntry c : upcomingBookings) {
final TextFlow tf = new TextFlow();
final Text t0 = new Text("Room " + c.getRoom() + ": ");
t0.getStyleClass().add("emphasis");
final Text t1 = new Text(c.getName());
tf.getChildren().addAll(t0, t1);
box.getChildren().add(tf);
}
}
Aggregations