added missing functionality

This commit is contained in:
2023-01-06 01:51:42 +01:00
parent 89ea9ca70e
commit 58fb02875a
5 changed files with 114 additions and 85 deletions

View File

@@ -1,6 +1,8 @@
package com.bib.essensbestellungsverwaltung;
/*
@author Malte Schulze Hobeling
*/
import java.util.List;
import java.util.Scanner;
public class ConsoleMain {
@@ -38,18 +40,14 @@ public class ConsoleMain {
System.out.print("Auswahl: ");
Scanner sc = new Scanner(System.in);
String selection = sc.nextLine();
switch (selection){
case "1":
switch (selection) {
case "1" -> {
currentUserId = ConsoleLib.loginPrompt();
isWorker = AccountMgr.isWorker(String.valueOf(currentUserId));
isParent = AccountMgr.isParent(String.valueOf(currentUserId));
break;
case "2":
ConsoleLib.showFood_planPrompt();
break;
case "3":
currentUserId = -2;
break;
}
case "2" -> ConsoleLib.showFood_planPrompt();
case "3" -> currentUserId = -2;
}
}
@@ -63,43 +61,31 @@ public class ConsoleMain {
System.out.println("6: Table");
System.out.println("7: Einen Essensplan erstellen");
System.out.println("8: Essensplan anzeigen");
System.out.println("9: Löschen");
System.out.println("10: Essen auswählen");
System.out.print("Auswahl: ");
Scanner sc = new Scanner(System.in);
String selection = sc.nextLine();
switch (selection){
case "0":
switch (selection) {
case "0" -> {
currentUserId = -1;
isWorker = false;
isParent = false;
break;
case "1":
ConsoleLib.createWorkerPrompt();
break;
case "2":
ConsoleLib.createParentPrompt();
break;
case "3":
ConsoleLib.createChildPrompt(String.valueOf(currentUserId));
break;
case "4":
ConsoleLib.matchParentChildPrompt(String.valueOf(currentUserId));
break;
case "5":
ConsoleLib.createFoodPrompt();
break;
case "6":
ConsoleLib.tablePrompt();
break;
case "7":
ConsoleLib.createFood_planPrompt();
break;
case "8":
ConsoleLib.showFood_planPrompt();
break;
default:
break;
}
case "1" -> ConsoleLib.createWorkerPrompt();
case "2" -> ConsoleLib.createParentPrompt();
case "3" -> ConsoleLib.createChildPrompt(String.valueOf(currentUserId));
case "4" -> ConsoleLib.matchParentChildPrompt(String.valueOf(currentUserId));
case "5" -> ConsoleLib.createFoodPrompt();
case "6" -> ConsoleLib.tablePrompt();
case "7" -> ConsoleLib.createFood_planPrompt();
case "8" -> ConsoleLib.showFood_planPrompt();
case "9" -> ConsoleLib.deletePrompt();
case "10" -> ConsoleLib.createFood_selectionPrompt();
default -> {
}
}
}
@@ -113,23 +99,17 @@ public class ConsoleMain {
System.out.print("Auswahl: ");
Scanner sc = new Scanner(System.in);
String selection = sc.nextLine();
switch (selection){
case "0":
switch (selection) {
case "0" -> {
currentUserId = -1;
isWorker = false;
isParent = false;
break;
case "3":
ConsoleLib.createChildPrompt(String.valueOf(currentUserId));
break;
case "4":
ConsoleLib.matchParentChildPrompt(String.valueOf(currentUserId));
break;
case "6":
ConsoleLib.tablePrompt();
break;
default:
break;
}
case "3" -> ConsoleLib.createChildPrompt(String.valueOf(currentUserId));
case "4" -> ConsoleLib.matchParentChildPrompt(String.valueOf(currentUserId));
case "6" -> ConsoleLib.tablePrompt();
default -> {
}
}
}