2023-11-05 10:39:39 +01:00
|
|
|
package catering.order;
|
|
|
|
|
2023-11-19 13:00:21 +01:00
|
|
|
import jakarta.persistence.Entity;
|
|
|
|
import org.salespointframework.order.Order;
|
|
|
|
import org.salespointframework.payment.Cash;
|
|
|
|
import org.salespointframework.useraccount.UserAccount;
|
|
|
|
import org.springframework.stereotype.Component;
|
2023-11-05 10:39:39 +01:00
|
|
|
|
2023-11-05 11:36:39 +01:00
|
|
|
import java.time.LocalDateTime;
|
2023-11-05 15:36:46 +01:00
|
|
|
import java.time.format.DateTimeFormatter;
|
2023-11-05 10:39:39 +01:00
|
|
|
|
2023-11-19 13:00:21 +01:00
|
|
|
@Entity
|
|
|
|
public class CustomOrder extends Order {
|
|
|
|
private OrderType orderType = OrderType.SOMETHING_ELSE;
|
2023-11-05 11:36:39 +01:00
|
|
|
private LocalDateTime start;
|
|
|
|
private LocalDateTime finish;
|
2023-11-19 13:00:21 +01:00
|
|
|
private boolean invoiceAvailable = false;
|
|
|
|
private String formatterPattern = "dd.MM.yyy, HH:mm 'Uhr'";
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public CustomOrder(UserAccount.UserAccountIdentifier identifier, CustomCart cart) {
|
|
|
|
super(identifier, Cash.CASH);
|
|
|
|
this.orderType = cart.getOrderType();
|
|
|
|
this.start = cart.getStart();
|
|
|
|
this.finish = cart.getFinish();
|
|
|
|
this.formatterPattern = cart.getFormatterPattern();
|
2023-11-05 10:39:39 +01:00
|
|
|
}
|
|
|
|
|
2023-11-19 13:00:21 +01:00
|
|
|
public CustomOrder() {} // TODO: find out, why this is mandatory
|
2023-11-05 16:41:22 +01:00
|
|
|
|
2023-11-05 10:39:39 +01:00
|
|
|
public OrderType getOrderType() {
|
|
|
|
return orderType;
|
|
|
|
}
|
|
|
|
|
2023-11-05 11:36:39 +01:00
|
|
|
public LocalDateTime getStart() {
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
2023-11-05 15:36:46 +01:00
|
|
|
public String getFormattedStart() {
|
2023-11-19 13:00:21 +01:00
|
|
|
return start.format(DateTimeFormatter.ofPattern(formatterPattern));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStart(LocalDateTime start) {
|
|
|
|
this.start = start;
|
2023-11-05 15:36:46 +01:00
|
|
|
}
|
|
|
|
|
2023-11-05 11:36:39 +01:00
|
|
|
public LocalDateTime getFinish() {
|
|
|
|
return finish;
|
|
|
|
}
|
|
|
|
|
2023-11-05 15:36:46 +01:00
|
|
|
public String getFormattedFinish() {
|
2023-11-19 13:00:21 +01:00
|
|
|
return finish.format(DateTimeFormatter.ofPattern(formatterPattern));
|
2023-11-05 10:39:39 +01:00
|
|
|
}
|
|
|
|
|
2023-11-19 13:00:21 +01:00
|
|
|
public void setFinish(LocalDateTime finish) {
|
|
|
|
this.finish = finish;
|
2023-11-05 17:05:56 +01:00
|
|
|
}
|
|
|
|
|
2023-11-19 13:00:21 +01:00
|
|
|
public boolean isInvoiceAvailable() {
|
2023-11-05 10:39:39 +01:00
|
|
|
return invoiceAvailable;
|
|
|
|
}
|
|
|
|
|
2023-11-19 13:00:21 +01:00
|
|
|
public void setInvoiceAvailable(boolean available) {
|
|
|
|
this.invoiceAvailable = available;
|
2023-11-05 10:39:39 +01:00
|
|
|
}
|
|
|
|
}
|