ItEr20S08CUProcuraPartesTraballoDadosAltaNoSistemaItEr19S13: Remove WorkReport
This commit is contained in:
parent
e2d074f453
commit
6038e312ac
5 changed files with 41 additions and 7 deletions
|
|
@ -14,16 +14,16 @@ import org.navalplanner.business.common.BaseEntity;
|
|||
public class WorkReport extends BaseEntity {
|
||||
|
||||
@NotNull
|
||||
Date date;
|
||||
private Date date;
|
||||
|
||||
String place;
|
||||
private String place;
|
||||
|
||||
@NotEmpty
|
||||
String responsible;
|
||||
private String responsible;
|
||||
|
||||
WorkReportType workReportType;
|
||||
private WorkReportType workReportType;
|
||||
|
||||
Set<WorkReportLine> workReportLines = new HashSet<WorkReportLine>();
|
||||
private Set<WorkReportLine> workReportLines = new HashSet<WorkReportLine>();
|
||||
|
||||
public static final String DATE = "date";
|
||||
|
||||
|
|
|
|||
|
|
@ -101,4 +101,11 @@ public interface IWorkReportModel {
|
|||
* @return
|
||||
*/
|
||||
WorkReportLine addWorkReportLine();
|
||||
|
||||
/**
|
||||
* Removes {@link WorkReport}
|
||||
*
|
||||
* @param workReport
|
||||
*/
|
||||
void remove(WorkReport workReport);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.zkoss.zul.Listhead;
|
|||
import org.zkoss.zul.Listheader;
|
||||
import org.zkoss.zul.Listitem;
|
||||
import org.zkoss.zul.ListitemRenderer;
|
||||
import org.zkoss.zul.Messagebox;
|
||||
import org.zkoss.zul.SimpleListModel;
|
||||
import org.zkoss.zul.Textbox;
|
||||
import org.zkoss.zul.api.Window;
|
||||
|
|
@ -79,6 +80,24 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
|||
|
||||
private final static int PAGING = 10;
|
||||
|
||||
/**
|
||||
* Delete {@link WorkReport}
|
||||
*
|
||||
* FIXME: Should show a {@link Messagebox} to confirm deletion. Popping up a
|
||||
* {@link Messagebox} from a page where there is also a {@link Listbox}
|
||||
* causes an unexpected error. Bug reported to ZK.
|
||||
*
|
||||
* ZK Bug Tracker URL:
|
||||
* http://sourceforge.net/tracker/?atid=785191&group_id=152762&func=browse
|
||||
* Bug ID: 2832573
|
||||
*
|
||||
* @param workReport
|
||||
*/
|
||||
public void showConfirmDelete(WorkReport workReport) {
|
||||
workReportModel.remove(workReport);
|
||||
Util.reloadBindings(listWindow);
|
||||
messagesForUser.showMessage(Level.INFO, "Parte de traballo eliminado");
|
||||
}
|
||||
|
||||
public List<WorkReport> getWorkReports() {
|
||||
return workReportModel.getWorkReports();
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ public class WorkReportModel implements IWorkReportModel {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public String getDistinguishedCode(OrderElement orderElement) throws InstanceNotFoundException {
|
||||
orderElementDAO.save(orderElement);
|
||||
return orderElementDAO.getDistinguishedCode(orderElement);
|
||||
}
|
||||
|
||||
|
|
@ -202,4 +201,13 @@ public class WorkReportModel implements IWorkReportModel {
|
|||
workReport.getWorkReportLines().add(workReportLine);
|
||||
return workReportLine;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void remove(WorkReport workReport) {
|
||||
try {
|
||||
workReportDAO.remove(workReport.getId());
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<label value="@{workReport.workReportType.name}" />
|
||||
<hbox>
|
||||
<button label="Editar" onClick="controller.goToEditForm(self.parent.parent.value);" />
|
||||
<button label="Eliminar" />
|
||||
<button label="Eliminar" onClick="controller.showConfirmDelete(self.parent.parent.value)" />
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue