|
|
|
@@ -38,31 +38,19 @@ public class AsiakasIkkuna extends Stage {
|
|
|
|
|
this.setTitle("Uusi asiakas");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TabPane tabPane = new TabPane();
|
|
|
|
|
tabPane.setSide(Side.LEFT);
|
|
|
|
|
int korkeus = 150;
|
|
|
|
|
tabPane.setTabMinWidth(korkeus);
|
|
|
|
|
tabPane.setTabMinWidth(korkeus);
|
|
|
|
|
tabPane.setTabMinHeight(35);
|
|
|
|
|
tabPane.setTabMaxHeight(35);
|
|
|
|
|
tabPane.setOnKeyPressed(e -> {
|
|
|
|
|
HBox hbTiedot = new HBox();
|
|
|
|
|
hbTiedot.setOnKeyPressed(e -> {
|
|
|
|
|
switch (e.getCode()) {
|
|
|
|
|
case ENTER: tallenna(); break;
|
|
|
|
|
case ESCAPE: close(); break;
|
|
|
|
|
default: break;
|
|
|
|
|
}});
|
|
|
|
|
|
|
|
|
|
Tab tabLounastiedot, tabPäivällistiedot, tabAsiakastiedot;
|
|
|
|
|
tabLounastiedot = new TabPohja("Kuljetustiedot");
|
|
|
|
|
tabPäivällistiedot = new TabPohja("Päivällistiedot");
|
|
|
|
|
tabAsiakastiedot = new TabPohja("Asiakastiedot");
|
|
|
|
|
tabPane.getTabs().addAll(tabLounastiedot, tabPäivällistiedot, tabAsiakastiedot);
|
|
|
|
|
|
|
|
|
|
GridPane lounasTiedot = new GridPane();
|
|
|
|
|
lounasTiedot.setPadding(new Insets(15));
|
|
|
|
|
lounasTiedot.setHgap(10);
|
|
|
|
|
lounasTiedot.setVgap(10);
|
|
|
|
|
tabLounastiedot.setContent(lounasTiedot);
|
|
|
|
|
|
|
|
|
|
lounasTiedot.addRow(lounasTiedot.getRowCount(), new Label("Lounaat per kuljetus"));
|
|
|
|
|
|
|
|
|
@@ -106,27 +94,16 @@ public class AsiakasIkkuna extends Stage {
|
|
|
|
|
tfSunnuntai = new IntegerSpinner();
|
|
|
|
|
lounasTiedot.addRow(lounasTiedot.getRowCount(), new Label("Sunnuntai"), tfSunnuntai);
|
|
|
|
|
|
|
|
|
|
Label ruokarajoitteet = new Label("Ruokarajoitteet");
|
|
|
|
|
tfRuokarajoitteet = new TextField();
|
|
|
|
|
lounasTiedot.addRow(lounasTiedot.getRowCount(), ruokarajoitteet, tfRuokarajoitteet);
|
|
|
|
|
|
|
|
|
|
Label avainTieto = new Label("Avaintieto");
|
|
|
|
|
tfAvainTieto = new TextField();
|
|
|
|
|
lounasTiedot.addRow(lounasTiedot.getRowCount(), avainTieto, tfAvainTieto);
|
|
|
|
|
|
|
|
|
|
Label lisätiedot = new Label("Kuljetuksen lisätiedot");
|
|
|
|
|
tfLisätiedot = new TextField();
|
|
|
|
|
tfLisätiedot.setPromptText("Näkyy raporteilla");
|
|
|
|
|
lounasTiedot.addRow(lounasTiedot.getRowCount(), lisätiedot, tfLisätiedot);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridPane päivällisTiedot = new GridPane();
|
|
|
|
|
päivällisTiedot.setPadding(new Insets(15));
|
|
|
|
|
päivällisTiedot.setHgap(10);
|
|
|
|
|
päivällisTiedot.setVgap(10);
|
|
|
|
|
tabPäivällistiedot.setContent(päivällisTiedot);
|
|
|
|
|
|
|
|
|
|
päivällisTiedot.addRow(päivällisTiedot.getRowCount(), new Label("Päivälliset per kuljetus"));
|
|
|
|
|
Button kopioiLounasPäivälliseen = new Button("Kopioi lounasmäärät");
|
|
|
|
|
kopioiLounasPäivälliseen.setOnAction(_->kopioiLounasmäärätPäivälliselle());
|
|
|
|
|
päivällisTiedot.addRow(päivällisTiedot.getRowCount(), new Label("Päivälliset per kuljetus"), kopioiLounasPäivälliseen);
|
|
|
|
|
|
|
|
|
|
tfDinnerSalaatit = new IntegerSpinner();
|
|
|
|
|
päivällisTiedot.addRow(päivällisTiedot.getRowCount(), new Label("Salaatit"), tfDinnerSalaatit);
|
|
|
|
@@ -160,11 +137,12 @@ public class AsiakasIkkuna extends Stage {
|
|
|
|
|
tfDinnerSunnuntai = new IntegerSpinner();
|
|
|
|
|
päivällisTiedot.addRow(päivällisTiedot.getRowCount(), new Label("Sunnuntai"), tfDinnerSunnuntai);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridPane asiakasTiedot = new GridPane();
|
|
|
|
|
asiakasTiedot.setPadding(new Insets(15));
|
|
|
|
|
asiakasTiedot.setHgap(10);
|
|
|
|
|
asiakasTiedot.setVgap(10);
|
|
|
|
|
tabAsiakastiedot.setContent(asiakasTiedot);
|
|
|
|
|
|
|
|
|
|
Label nimi = new Label("Asiakkaan etu- ja sukunimi");
|
|
|
|
|
nimi.setStyle("-fx-font-weight: bold;");
|
|
|
|
@@ -194,6 +172,22 @@ public class AsiakasIkkuna extends Stage {
|
|
|
|
|
tfYhteyshenkilönSähköposti = new TextField();
|
|
|
|
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), yhteyshenkilönSähköposti, tfYhteyshenkilönSähköposti);
|
|
|
|
|
|
|
|
|
|
Label ruokarajoitteet = new Label("Ruokarajoitteet");
|
|
|
|
|
tfRuokarajoitteet = new TextField();
|
|
|
|
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), ruokarajoitteet, tfRuokarajoitteet);
|
|
|
|
|
|
|
|
|
|
Label avainTieto = new Label("Avaintieto");
|
|
|
|
|
tfAvainTieto = new TextField();
|
|
|
|
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), avainTieto, tfAvainTieto);
|
|
|
|
|
|
|
|
|
|
Label lisätiedot = new Label("Kuljetuksen lisätiedot");
|
|
|
|
|
tfLisätiedot = new TextField();
|
|
|
|
|
tfLisätiedot.setPromptText("Näkyy raporteilla");
|
|
|
|
|
asiakasTiedot.addRow(asiakasTiedot.getRowCount(), lisätiedot, tfLisätiedot);
|
|
|
|
|
|
|
|
|
|
hbTiedot.getChildren().addAll(asiakasTiedot, lounasTiedot, päivällisTiedot);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HBox napit = new HBox();
|
|
|
|
|
Button peruuta = new Button("Peruuta");
|
|
|
|
|
peruuta.setFont(TabPohja.BUTTON_FONT);
|
|
|
|
@@ -208,7 +202,7 @@ public class AsiakasIkkuna extends Stage {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VBox root = new VBox();
|
|
|
|
|
root.getChildren().addAll(tabPane, napit);
|
|
|
|
|
root.getChildren().addAll(hbTiedot, napit);
|
|
|
|
|
this.setScene(new Scene(root));
|
|
|
|
|
this.getIcons().add(new Image(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("kuljetusruokalaatikko.jpg"))));
|
|
|
|
|
this.setAlwaysOnTop(true);
|
|
|
|
@@ -337,4 +331,17 @@ public class AsiakasIkkuna extends Stage {
|
|
|
|
|
}
|
|
|
|
|
this.setAlwaysOnTop(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void kopioiLounasmäärätPäivälliselle() {
|
|
|
|
|
tfDinnerMaanantai.getValueFactory().setValue(tfMaanantai.getValue());
|
|
|
|
|
tfDinnerTiistai.getValueFactory().setValue(tfTiistai.getValue());
|
|
|
|
|
tfDinnerKeskiviikko.getValueFactory().setValue(tfKeskiviikko.getValue());
|
|
|
|
|
tfDinnerTorstai.getValueFactory().setValue(tfTorstai.getValue());
|
|
|
|
|
tfDinnerPerjantai.getValueFactory().setValue(tfPerjantai.getValue());
|
|
|
|
|
tfDinnerLauantai.getValueFactory().setValue(tfLauantai.getValue());
|
|
|
|
|
tfDinnerSunnuntai.getValueFactory().setValue(tfSunnuntai.getValue());
|
|
|
|
|
tfDinnerSalaatit.getValueFactory().setValue(tfSalaatit.getValue());
|
|
|
|
|
tfDinnerPääruoat.getValueFactory().setValue(tfPääruoat.getValue());
|
|
|
|
|
tfDinnerJälkiruoat.getValueFactory().setValue(tfJälkiruoat.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|