diff --git a/src/main/java/org/launchcode/controllers/SpaDayController.java b/src/main/java/org/launchcode/controllers/SpaDayController.java
index 207770d6..03b3c3cf 100644
--- a/src/main/java/org/launchcode/controllers/SpaDayController.java
+++ b/src/main/java/org/launchcode/controllers/SpaDayController.java
@@ -1,5 +1,7 @@
package org.launchcode.controllers;
+import org.launchcode.models.Client;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@@ -9,59 +11,17 @@
@Controller
public class SpaDayController {
- public boolean checkSkinType(String skinType, String facialType) {
- if (skinType.equals("oily")) {
- return facialType.equals("Microdermabrasion") || facialType.equals("Rejuvenating");
- }
- else if (skinType.equals("combination")) {
- return facialType.equals("Microdermabrasion") || facialType.equals("Rejuvenating") || facialType.equals("Enzyme Peel");
- }
- else if (skinType.equals("dry")) {
- return facialType.equals("Rejuvenating") || facialType.equals("Hydrofacial");
- }
- else {
- return true;
- }
- }
-
- @GetMapping(value="")
- @ResponseBody
+ @GetMapping
public String customerForm () {
- String html = "
";
- return html;
+ return "serviceSelection";
}
- @PostMapping(value="")
- public String spaMenu(@RequestParam String name, @RequestParam String skintype, @RequestParam String manipedi, Model model) {
-
- ArrayList facials = new ArrayList<>();
- facials.add("Microdermabrasion");
- facials.add("Hydrofacial");
- facials.add("Rejuvenating");
- facials.add("Enzyme Peel");
+ @PostMapping
+ public String spaMenu(@RequestParam String skintype, @RequestParam String manipedi, Model model) {
- ArrayList appropriateFacials = new ArrayList<>();
- for (int i = 0; i < facials.size(); i ++) {
- if (checkSkinType(skintype,facials.get(i))) {
- appropriateFacials.add(facials.get(i));
- }
- }
+ Client newClient = new Client(skintype, manipedi);
+ newClient.setAppropriateFacials(skintype);
+ model.addAttribute("client" , newClient);
return "menu";
}
diff --git a/src/main/java/org/launchcode/models/Client.java b/src/main/java/org/launchcode/models/Client.java
new file mode 100644
index 00000000..d7082877
--- /dev/null
+++ b/src/main/java/org/launchcode/models/Client.java
@@ -0,0 +1,82 @@
+package org.launchcode.models;
+
+import java.util.ArrayList;
+
+public class Client {
+
+ private String skinType;
+ private String nailService;
+ private ArrayList appropriateFacials = new ArrayList<>();
+
+ public Client(String skinType, String nailService) {
+ this.skinType = skinType;
+ this.nailService = nailService;
+ }
+
+ public String getSkinType() {
+ return skinType;
+ }
+
+ public void setSkinType(String skinType) {
+ this.skinType = skinType;
+ }
+
+ public String getNailService() {
+ return nailService;
+ }
+
+ public void setNailService(String nailService) {
+ this.nailService = nailService;
+ }
+
+ public ArrayList getAppropriateFacials() {
+ return appropriateFacials;
+ }
+
+ private boolean checkSkinType(String skinType, String facialType) {
+ if (skinType.equals("oily")) {
+ if (facialType.equals("Microdermabrasion") || facialType.equals("Rejuvenating")) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else if (skinType.equals("combination")) {
+ if (facialType.equals("Microdermabrasion") || facialType.equals("Rejuvenating") || facialType.equals("Enzyme Peel")) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else if (skinType.equals("normal")) {
+ return true;
+ }
+ else if (skinType.equals("dry")) {
+ if (facialType.equals("Rejuvenating") || facialType.equals("Hydrofacial")) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
+ }
+
+ public void setAppropriateFacials(String skinType) {
+ ArrayList facials = new ArrayList();
+ facials.add("Microdermabrasion");
+ facials.add("Hydrofacial");
+ facials.add("Rejuvenating");
+ facials.add("Enzyme Peel");
+
+ for (int i = 0; i < facials.size(); i ++) {
+ if (checkSkinType(skinType,facials.get(i))) {
+ appropriateFacials.add(facials.get(i));
+ }
+ }
+ }
+}
diff --git a/src/main/resources/templates/menu.html b/src/main/resources/templates/menu.html
index b94b513f..f6cefa1f 100644
--- a/src/main/resources/templates/menu.html
+++ b/src/main/resources/templates/menu.html
@@ -8,8 +8,31 @@
My Super Fancy Spa