Commit 07c4abd6 authored by s7_spruge_k's avatar s7_spruge_k
Browse files

graphh

parent 3716e167
......@@ -8,10 +8,11 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.calendar.models.Calendar;
import com.example.calendar.models.Event;
import com.example.calendar.models.StatHelper;
import com.example.calendar.models.User;
import com.example.calendar.repo.CalendarRepo;
import com.example.calendar.repo.EventRepo;
......@@ -124,7 +125,7 @@ public class GraphController {
@GetMapping(value = "/choose-cal")
public String chooseCalGet(Model model)
public String chooseCalGet(Model model, StatHelper statHelper)
{
User currUser = findCurrentUser();
......@@ -154,5 +155,11 @@ public class GraphController {
return "chooseCal";
}
@PostMapping(value ="/choose-cal")
public String chooseCalPost(Model models, StatHelper statHelper)
{
System.out.println(statHelper);
return "redirect:/stat";
}
}
package com.example.calendar.models;
public class StatHelper {
private String chosenCalendar;
private String statMethod;
private String graphMethod;
public StatHelper() {}
public StatHelper(String chosenCalendar, String statMethod, String graphMethod) {
this.chosenCalendar = chosenCalendar;
this.statMethod = statMethod;
this.graphMethod = graphMethod;
}
public String getChosenCalendar() {
return chosenCalendar;
}
public void setChosenCalendar(String chosenCalendar) {
this.chosenCalendar = chosenCalendar;
}
public String getStatMethod() {
return statMethod;
}
public void setStatMethod(String statMethod) {
this.statMethod = statMethod;
}
public String getGraphMethod() {
return graphMethod;
}
public void setGraphMethod(String graphMethod) {
this.graphMethod = graphMethod;
}
@Override
public String toString() {
return "StatHelper [chosenCalendar=" + chosenCalendar + ", statMethod=" + statMethod + ", graphMethod="
+ graphMethod + "]";
}
}
......@@ -13,15 +13,19 @@
<div class="container w-50 ">
<br><br><br> <form action="#" th:action="@{/view-calendars}" th:object="${model}" method="post">
<br><br><br> <form action="#" th:action="@{/choose-cal}" th:object="${statHelper}" method="post">
<h2 class="form-signin-heading text-center">Your calendars</h2><br>
<div class="form-group">
<label for="chooseCalendarForm">Choose a calendar</label>
<select multiple class="form-control" id="calendarSelection" th:value="${calName}" name="calName">
<select multiple class="form-control" id="calendarSelection" th:value="${chosenCalendar}" name="calName">
</select>
</div>
<div class="form-group">
</div>
<br> <button class="btn btn-lg btn-primary btn-block" type="submit">Generate statistics!</button><br>
</form>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment