Po refreshi gridu se obnovi puvodni trideni a filtr nastaveny pred editaci/schvalenim zaznamu.

closes #271
master
Josef Rokos 9 years ago
parent ea2708f303
commit 093d359df7

@ -129,7 +129,7 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getMaterialPendingList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) and (rq.kind = :kind) order by rq.numser");
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) and (rq.kind = :kind) order by rq.numser desc");
q.setParameter("kind", Constants.REQ_TYPE_MATERIAL);
return q.list();
}
@ -139,7 +139,7 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getMaterialArchiveList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed = true) and (rq.kind = :kind) order by rq.numser");
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed = true) and (rq.kind = :kind) order by rq.numser desc");
q.setParameter("kind", Constants.REQ_TYPE_MATERIAL);
return q.list();
}
@ -149,7 +149,7 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getServicesPendingList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) and (rq.kind = :kind) order by rq.numser");
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) and (rq.kind = :kind) order by rq.numser desc");
q.setParameter("kind", Constants.REQ_TYPE_SERVICES);
return q.list();
}
@ -159,7 +159,7 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<Invoicing> getServicesArchiveList() {
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed = true) and (rq.kind = :kind) order by rq.numser");
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed = true) and (rq.kind = :kind) order by rq.numser desc");
q.setParameter("kind", Constants.REQ_TYPE_SERVICES);
return q.list();
}

@ -28,6 +28,7 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -146,6 +147,7 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
dataList = fullList;
dataBean = null;
selIndex = -1;
restoreSort();
} else {
doFilter();
dataBean = null;
@ -285,10 +287,7 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
BindUtils.postGlobalCommand(null, null, "reloadRelated", null);
if (sortHeader != null) {
sortHeader.setSortDirection("natural");
}
restoreUserView();
}
@GlobalCommand
@ -355,23 +354,14 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
}
@Command
@NotifyChange("dataBean")
public void onSort(@BindingParam("column") String column) {
if (sortCol == null || this.sortCol.equals(column))
this.sortDesc = !this.sortDesc;
this.sortCol = column;
selIndex = -1;
dataBean = null;
}
@Command
@NotifyChange({"dataBean", "canApprove"})
public void onSortHeader(@BindingParam("header") Listheader header) {
sortHeader = header;
selIndex = -1;
dataBean = null;
Collections.sort(dataList,
sortHeader.getSortDirection().equals("ascending") ? sortHeader.getSortDescending() : sortHeader.getSortAscending());
}
public int getSelIndex() {
@ -427,6 +417,27 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
this.fullFill = fullFill;
}
protected void restoreUserView() {
int sel = selIndex;
restoreFilter();
restoreSort();
selIndex = sel;
}
private void restoreSort() {
if (sortHeader != null) {
Collections.sort(dataList,
sortHeader.getSortDirection().equals("ascending") ? sortHeader.getSortAscending() : sortHeader.getSortDescending());
}
}
private void restoreFilter() {
if (filter) {
doFilter();
}
}
public boolean isRecordSelected()
{
return (dataBean != null);

@ -72,6 +72,7 @@ public class ApproveDialogVM {
BindUtils.postNotifyChange(null, null, grid, "dataBean");
BindUtils.postNotifyChange(null, null, grid, "canApprove");
BindUtils.postGlobalCommand(null, null, "reload", null);
grid.refresh();
window.detach();
} catch (ApproveException ex) {
Messagebox.show(StringUtils.localize(ex.getReason()), StringUtils.localize("Error"), Messagebox.OK,

@ -6,11 +6,6 @@ import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.GlobalCommand;
@ -18,6 +13,10 @@ import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class ReqListMyAll extends RequirementSubpage<Requirement>
{
@WireVariable
@ -55,10 +54,11 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
}
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "fullFill" })
@NotifyChange({ "dataList", "dataBean", "fullFill", "selIndex" })
public void reloadRelated()
{
this.reload();
restoreUserView();
}
@Override

@ -6,11 +6,6 @@ import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.GlobalCommand;
@ -18,6 +13,10 @@ import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class ReqListMyCenters extends RequirementSubpage<Requirement>
{
@WireVariable
@ -55,10 +54,11 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
}
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "fullFill" })
@NotifyChange({ "dataList", "dataBean", "fullFill", "selIndex" })
public void reloadRelated()
{
this.reload();
restoreUserView();
}
@Override

@ -6,11 +6,6 @@ import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.GlobalCommand;
@ -18,6 +13,10 @@ import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
{
@WireVariable
@ -55,10 +54,11 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
}
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "fullFill" })
@NotifyChange({ "dataList", "dataBean", "fullFill", "selIndex" })
public void reloadRelated()
{
this.reload();
restoreUserView();
}
@Override

@ -63,9 +63,10 @@ public class TripRequirementListAll extends RequirementSubpage<TripRequirement>
}
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "fullFill" })
@NotifyChange({ "dataList", "dataBean", "fullFill", "selIndex" })
public void reloadRelated() {
this.reload();
restoreUserView();
}
@Override

@ -63,6 +63,7 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
@NotifyChange({ "dataList", "dataBean", "fullFill" })
public void reloadRelated() {
this.reload();
restoreUserView();
}
@Override

@ -70,6 +70,7 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
@NotifyChange({ "dataList", "dataBean", "fullFill" })
public void reloadRelated() {
this.reload();
restoreUserView();
}
@Override

@ -78,9 +78,9 @@ public class TripBillListBase extends RequirementSubpage<TripBillApproval> {
}
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "fullFill" })
public void reloadRelated()
{
@NotifyChange({ "dataList", "dataBean", "fullFill", "selIndex" })
public void reloadRelated() {
this.reload();
restoreUserView();
}
}

@ -9,37 +9,44 @@
<listheader
label="${labels.InvoicingRequirementNumber}"
sort="czech(requirement.numser)"
onCreate="self.sort(false)"
onSort="@command('onSortHeader', header=self)"
width="130px" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(requirement.reqDate)"
onSort="@command('onSortHeader', header=self)"
width="150px" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="czech(requirement.centre.fullName)"
onSort="@command('onSortHeader', header=self)"
width="180px" />
<listheader
label="${labels.RequirementsGridWorkgroup}"
sort="czech(requirement.workgroup.fullName)"
onSort="@command('onSortHeader', header=self)"
width="180px" />
<listheader
label="${labels.InvoicingApplicant}"
sort="czech(requirement.ownedBy.fullName)"
onSort="@command('onSortHeader', header=self)"
width="180px" />
<listheader
label="${labels.InvoicingDescription}"
sort="czech(requirement.description)"
onSort="@command('onSortHeader', header=self)"
width="" />
<listheader
label="${labels.InvoicingRequirementPrice}"
sort="auto(requirement.sumTotal)"
onSort="@command('onSortHeader', header=self)"
align="right"
width="130px" />
<listheader
label="${labels.InvoicingInvoicedPrice}"
align="right"
sort="auto(totalInvoiced)"
onSort="@command('onSortHeader', header=self)"
width="130px" />
</listhead>
<auxhead

Loading…
Cancel
Save