Merge branch 'matchHistory' into develop
This commit is contained in:
commit
15d0dcaa8d
src/main/java/se/su/dsv/scipro/admin/panels/match
@ -5,6 +5,8 @@
|
||||
<a href="#" wicket:id="actionLink">Actions</a>
|
||||
|
|
||||
<a href="#" wicket:id="watsonLink">Project idea details</a>
|
||||
|
|
||||
<a href="#" wicket:id="historyLink">Match history</a>
|
||||
<div class="prepend-top" wicket:id="mainPanel"></div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
|
@ -15,11 +15,8 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Panel watsonPanel;
|
||||
private Panel actionPanel;
|
||||
private Panel currentPanel;
|
||||
private AjaxFallbackLink<Void> watsonLink;
|
||||
private AjaxFallbackLink<Void> actionLink;
|
||||
private Panel watsonPanel, actionPanel, historyPanel, currentPanel;
|
||||
private AjaxFallbackLink<Void> watsonLink, actionLink, historyLink;
|
||||
|
||||
public AdminEditProjectIdeaPanel(String id, IModel<ProjectIdea> model, final Component feedbackPanel) {
|
||||
super(id, model);
|
||||
@ -29,10 +26,12 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
|
||||
watsonPanel = new ManualWatsonPanel("mainPanel", model, feedbackPanel);
|
||||
actionPanel = new ProjectIdeaActionPanel("mainPanel", model, feedbackPanel);
|
||||
historyPanel = new MatchHistoryPanel("mainPanel", model, feedbackPanel);
|
||||
currentPanel = actionPanel;
|
||||
currentPanel.setOutputMarkupId(true);
|
||||
watsonPanel.setOutputMarkupId(true);
|
||||
actionPanel.setOutputMarkupId(true);
|
||||
historyPanel.setOutputMarkupId(true);
|
||||
watsonLink = new AjaxFallbackLink<Void>("watsonLink") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -49,6 +48,7 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(actionLink);
|
||||
target.addComponent(historyLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
@ -73,6 +73,7 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
if (target != null) {
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(watsonLink);
|
||||
target.addComponent(historyLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
@ -80,6 +81,30 @@ public class AdminEditProjectIdeaPanel extends Panel {
|
||||
actionLink.setOutputMarkupId(true);
|
||||
add(actionLink);
|
||||
|
||||
historyLink = new AjaxFallbackLink<Void>("historyLink") {
|
||||
|
||||
private static final long serialVersionUID = -9010339024625408623L;
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return currentPanel != historyPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
currentPanel.replaceWith(historyPanel);
|
||||
currentPanel = historyPanel;
|
||||
if(target!=null){
|
||||
target.addComponent(currentPanel);
|
||||
target.addComponent(watsonLink);
|
||||
target.addComponent(actionLink);
|
||||
target.addComponent(this);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
historyLink.setOutputMarkupId(true);
|
||||
add(historyLink);
|
||||
add(currentPanel);
|
||||
} else {
|
||||
this.setVisible(false);
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<wicket:enclosure child="manual">
|
||||
<wicket:enclosure child="watson">
|
||||
<!--<div wicket:id="manual" class="append-bottom"></div>-->
|
||||
<div wicket:id="watson"></div>
|
||||
</wicket:enclosure>
|
||||
|
@ -17,7 +17,7 @@ public class ManualWatsonPanel extends Panel {
|
||||
public ManualWatsonPanel(String id, IModel<ProjectIdea> model, final Component feedBack) {
|
||||
super(id);
|
||||
if (model.getObject()!=null){
|
||||
add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match"), feedBack, Match.Status.CONFIRMED));
|
||||
//add(new ManualMatchPanel("manual", new PropertyModel<Match>(model, "match"), feedBack, Match.Status.CONFIRMED));
|
||||
add(new WatsonInfoPanel("watson", model.getObject().getMatch().getProjectIdea()));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div>
|
||||
<table class="rounded-corner">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rounded-left-top">Date</th><th>Status</th><th>Supervisor</th><th>Rejected by</th><th class="rounded-right-top">Comment by supervisor</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr wicket:id="historyList">
|
||||
<td wicket:id="date"></td>
|
||||
<td wicket:id="status"></td>
|
||||
<td wicket:id="supervisor"></td>
|
||||
<td wicket:id="rejectedBy"></td>
|
||||
<td wicket:id="comment"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="rounded-foot"> </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,50 @@
|
||||
package se.su.dsv.scipro.admin.panels.match;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.Component;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
|
||||
public class MatchHistoryPanel extends Panel {
|
||||
|
||||
@SpringBean
|
||||
private MatchDao matchDao;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MatchHistoryPanel(String id, IModel<ProjectIdea> model, final Component feedBack) {
|
||||
super(id);
|
||||
if (model.getObject()!=null){
|
||||
ProjectIdea pi = model.getObject();
|
||||
List<Match> matchObjects = matchDao.getMatchHistory(pi);
|
||||
ListView<Match> historyList = new ListView<Match>("historyList", matchObjects) {
|
||||
|
||||
private static final long serialVersionUID = 5246932667444626581L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<Match> item) {
|
||||
Match match = item.getModelObject();
|
||||
String supervisorName = match.getSupervisor() != null ? match.getSupervisor().getNameAsString() : "";
|
||||
String rejectedByName = match.getRejectedBy() != null ? match.getRejectedBy().getFullName() : "";
|
||||
String comment = match.getCommentForAdmin() != null ? match.getCommentForAdmin() : "";
|
||||
item.add(new Label("date", match.getDateCreated().toString()));
|
||||
item.add(new Label("status", match.getStatus().toString()));
|
||||
item.add(new Label("supervisor", supervisorName));
|
||||
item.add(new Label("rejectedBy", rejectedByName));
|
||||
item.add(new Label("comment", comment));
|
||||
add(item);
|
||||
}
|
||||
};
|
||||
add(historyList);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user