Added a possibility for the administrator to match manually to Suggested (PUBLISHED).
This commit is contained in:
parent
bedbefaa6b
commit
06a2afff12
src/main/java/se/su/dsv/scipro/admin/panels
@ -41,13 +41,15 @@ public class ManualMatchPanel extends Panel {
|
|||||||
private Form<Employee> matchForm;
|
private Form<Employee> matchForm;
|
||||||
private AutocompleteComponent<Employee> autocompleteSupervisorField;
|
private AutocompleteComponent<Employee> autocompleteSupervisorField;
|
||||||
private Long supervisorId;
|
private Long supervisorId;
|
||||||
public ManualMatchPanel(String id, IModel<Match> matchModel) {
|
private boolean confirmed;
|
||||||
|
public ManualMatchPanel(String id, IModel<Match> matchModel, final boolean confirmed__) {
|
||||||
super(id);
|
super(id);
|
||||||
supervisorId = matchModel.getObject().getSupervisor() != null ? matchModel.getObject().getSupervisor().getId() : 0L;
|
supervisorId = matchModel.getObject().getSupervisor() != null ? matchModel.getObject().getSupervisor().getId() : 0L;
|
||||||
setOutputMarkupPlaceholderTag(true);
|
setOutputMarkupPlaceholderTag(true);
|
||||||
currentFragment = createButtonFragment();
|
currentFragment = createButtonFragment();
|
||||||
alternateFragment = createMatchFragment(matchModel);
|
alternateFragment = createMatchFragment(matchModel);
|
||||||
add(currentFragment);
|
add(currentFragment);
|
||||||
|
confirmed = confirmed__;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Fragment createButtonFragment() {
|
private Fragment createButtonFragment() {
|
||||||
@ -95,7 +97,11 @@ public class ManualMatchPanel extends Panel {
|
|||||||
@Override
|
@Override
|
||||||
public void onSubmit() {
|
public void onSubmit() {
|
||||||
matchModel.getObject().setSupervisor(autocompleteSupervisorField.getModelObject());
|
matchModel.getObject().setSupervisor(autocompleteSupervisorField.getModelObject());
|
||||||
matchModel.getObject().setStatus(Status.CONFIRMED);
|
if(confirmed) {
|
||||||
|
matchModel.getObject().setStatus(Status.CONFIRMED);
|
||||||
|
} else {
|
||||||
|
matchModel.getObject().setStatus(Status.PUBLISHED);
|
||||||
|
}
|
||||||
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), null);
|
matchDao.changeStatus(SciProSession.get().getUser(), matchModel.getObject(), null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ public class ManualWatsonPanel extends Panel {
|
|||||||
public ManualWatsonPanel(String id, IModel<ProjectIdea> model) {
|
public ManualWatsonPanel(String id, IModel<ProjectIdea> model) {
|
||||||
super(id);
|
super(id);
|
||||||
if (model.getObject()!=null){
|
if (model.getObject()!=null){
|
||||||
add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match")));
|
add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match"), true));
|
||||||
add(new WatsonInfoPanel("watson", model.getObject().getMatch().getProjectIdea()));
|
add(new WatsonInfoPanel("watson", model.getObject().getMatch().getProjectIdea()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
<div wicket:id="removeAuthorPanel"></div>
|
<div wicket:id="removeAuthorPanel"></div>
|
||||||
<form wicket:id="form">
|
<form wicket:id="form">
|
||||||
|
|
||||||
<div class="prepend-top">If you want to match and confirm this
|
<div class="prepend-top">If you want to match (CONFIRM) this
|
||||||
idea to a supervisor or reviewer manually, you can do so.</div>
|
idea to a supervisor or reviewer manually, you can do so.</div>
|
||||||
<div wicket:id="manualMatchPanel"></div>
|
<div wicket:id="manualMatchPanel"></div>
|
||||||
|
<div class="prepend-top">If you want to suggest (PUBLISH) this
|
||||||
|
idea to a supervisor or reviewer manually, you can do so.</div>
|
||||||
|
<div wicket:id="manualSuggPanel"></div>
|
||||||
<div class="prepend-top">If this project idea is poorly
|
<div class="prepend-top">If this project idea is poorly
|
||||||
written, it should be refused, which means it will be sent back to the
|
written, it should be refused, which means it will be sent back to the
|
||||||
authors for rewriting.</div>
|
authors for rewriting.</div>
|
||||||
|
@ -19,14 +19,14 @@ public class ProjectIdeaActionPanel extends Panel {
|
|||||||
|
|
||||||
@SpringBean
|
@SpringBean
|
||||||
private MatchDao matchDao;
|
private MatchDao matchDao;
|
||||||
private ManualMatchPanel manualMatchPanel;
|
|
||||||
|
|
||||||
|
|
||||||
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) {
|
public ProjectIdeaActionPanel(String id, final IModel<Match> matchModel) {
|
||||||
super(id);
|
super(id);
|
||||||
add(new ProjectIdeaRemoveAuthorPanel("removeAuthorPanel", new Model(matchModel.getObject().getProjectIdea())).setVisible(matchModel.getObject().getProjectIdea().getAuthors().size()>1));
|
add(new ProjectIdeaRemoveAuthorPanel("removeAuthorPanel", new Model(matchModel.getObject().getProjectIdea())).setVisible(matchModel.getObject().getProjectIdea().getAuthors().size()>1));
|
||||||
Form<Match> form = new Form<Match>("form", matchModel);
|
Form<Match> form = new Form<Match>("form", matchModel);
|
||||||
form.add(manualMatchPanel = new ManualMatchPanel("manualMatchPanel", matchModel));
|
|
||||||
|
form.add(new ManualMatchPanel("manualMatchPanel", matchModel, true));
|
||||||
|
form.add(new ManualMatchPanel("manualSuggPanel", matchModel, false));
|
||||||
|
|
||||||
form.add(new Button("sendBackButton") {
|
form.add(new Button("sendBackButton") {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user