Skip to content

Commit

Permalink
Stash
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbarba19 committed Jun 7, 2024
1 parent 5253f6e commit e9ada88
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
20 changes: 18 additions & 2 deletions app/femr/ui/controllers/SettingsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
import femr.common.dtos.CurrentUser;
import femr.common.dtos.ServiceResponse;
import femr.common.models.UserItem;
import femr.data.models.mysql.User;
import femr.ui.models.settings.EditViewModel;
import femr.ui.models.settings.IndexViewModelGet;
import femr.ui.views.html.settings.index;


import femr.ui.views.html.sessions.create;
import femr.util.stringhelpers.StringUtils;
import play.data.FormFactory;
import play.mvc.Controller;
import play.mvc.Result;
import play.data.Form;

import javax.xml.ws.Service;
import java.util.ArrayList;

import java.util.ArrayList;
Expand All @@ -40,7 +44,18 @@ public SettingsController(AssetsFinder assetsFinder,

public Result index() {
CurrentUser currentUser = sessionService.retrieveCurrentUserSession();
return ok(femr.ui.views.html.settings.index.render(currentUser, assetsFinder));
System.out.println("Test");
/*ServiceResponse<UserItem> userServiceResponse = userService.retrieveUser(currentUser.getId());
if (userServiceResponse.hasErrors()){
System.out.println("Test1333");
throw new RuntimeException();
}*/
System.out.println("Test1");
IndexViewModelGet viewModelGet = new IndexViewModelGet();
System.out.println("Test2");
Form<EditViewModel> editViewModelForm = formFactory.form(EditViewModel.class).bindFromRequest();
System.out.println("Test3");
return ok(femr.ui.views.html.settings.index.render(currentUser, viewModelGet, editViewModelForm, assetsFinder));
}

public Result update() {
Expand All @@ -49,9 +64,10 @@ public Result update() {
return unauthorized();
}

IndexViewModelGet viewModelGet = new IndexViewModelGet();
Form<EditViewModel> editViewModelForm = formFactory.form(EditViewModel.class).bindFromRequest();
if (editViewModelForm.hasErrors()) {
return badRequest(index.render(currentUser, assetsFinder));
return badRequest(index.render(currentUser, viewModelGet, editViewModelForm, assetsFinder));
}

EditViewModel viewModel = editViewModelForm.get();
Expand Down
7 changes: 4 additions & 3 deletions app/femr/ui/models/settings/IndexViewModelGet.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
package femr.ui.models.settings;

import femr.data.models.core.IUser;
import femr.common.models.UserItem;

public class IndexViewModelGet {
private IUser user;
private UserItem user;

public IUser getUser() {
public UserItem getUser() {
return user;
}

public void setUser(IUser user) {
public void setUser(UserItem user) {
this.user = user;
}
}
2 changes: 2 additions & 0 deletions app/femr/ui/views/settings/index.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@(currentUser: femr.common.dtos.CurrentUser,
viewModelGet: femr.ui.models.settings.IndexViewModelGet,
form: play.data.Form[femr.ui.models.settings.EditViewModel],
assets: AssetsFinder)

@import femr.ui.views.html.layouts.settings
Expand Down

0 comments on commit e9ada88

Please sign in to comment.