Přidány sloupce pro vlastníky, střediska a komise.
Přidáno kontextové menu pro budoucí vytváření objednávek. refs #139
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
public class StringUtils
|
||||
@@ -91,4 +93,35 @@ public class StringUtils
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String addSeparator(String value, String separator, boolean toTail)
|
||||
{
|
||||
if ((value != null) && (separator != null))
|
||||
{
|
||||
if (!value.isEmpty() && !separator.isEmpty())
|
||||
{
|
||||
value = (toTail ? value + separator : separator + value);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String addSeparator(String value, String separator)
|
||||
{
|
||||
return StringUtils.addSeparator(value, separator, true);
|
||||
}
|
||||
|
||||
public static String join(List<String> list, String separator)
|
||||
{
|
||||
String result = "";
|
||||
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
{
|
||||
result = StringUtils.addSeparator(result, separator);
|
||||
result += list.get(i);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -134,14 +136,22 @@ public class User extends Member implements UserDetails, DataModel {
|
||||
this.authorities.remove(role);
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
String ret = "";
|
||||
if (lastName != null && !lastName.isEmpty()) {
|
||||
ret = lastName + " ";
|
||||
}
|
||||
ret = ret + (firstName == null ? "" : firstName);
|
||||
public String getFullName()
|
||||
{
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
return ret;
|
||||
if (this.lastName != null)
|
||||
{
|
||||
list.add(this.lastName);
|
||||
}
|
||||
|
||||
if (this.firstName != null)
|
||||
{
|
||||
list.add(this.firstName);
|
||||
}
|
||||
|
||||
String result = StringUtils.join(list, " ");
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
@@ -193,6 +203,28 @@ public class User extends Member implements UserDetails, DataModel {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEqualByUserForFilter(User value, User search)
|
||||
{
|
||||
if (search == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (value != null)
|
||||
{
|
||||
if (search.getFullName().isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
String valueS = value.getFullName();
|
||||
String searchS = search.getFullName();
|
||||
return (valueS.compareTo(searchS) == 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getFullName();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -103,8 +105,22 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullName() {
|
||||
return code + " " + name;
|
||||
public String getFullName()
|
||||
{
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
if (this.code != null)
|
||||
{
|
||||
list.add(this.code);
|
||||
}
|
||||
|
||||
if (this.name != null)
|
||||
{
|
||||
list.add(this.name);
|
||||
}
|
||||
|
||||
String result = StringUtils.join(list, " ");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,6 +152,28 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEqualByWorkgroupForFilter(Workgroup value, Workgroup search)
|
||||
{
|
||||
if (search == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (value != null)
|
||||
{
|
||||
if (search.getFullName().isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
String valueS = value.getFullName();
|
||||
String searchS = search.getFullName();
|
||||
return (valueS.compareTo(searchS) == 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getFullName();
|
||||
|
||||
@@ -4,6 +4,8 @@ import info.bukova.isspst.BigDecimalUtils;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
import info.bukova.isspst.data.JoinedItem;
|
||||
import info.bukova.isspst.data.MUnitEmb;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
@@ -17,6 +19,10 @@ public class JoinedItemFilter implements Filter<JoinedItem>
|
||||
public JoinedItemFilter(JoinedItem cond)
|
||||
{
|
||||
this.condition = cond;
|
||||
this.condition.setMunit(new MUnitEmb());
|
||||
this.condition.setWorkgroup(new Workgroup());
|
||||
this.condition.setCentre(new Workgroup());
|
||||
this.condition.setOwnedBy(new User());
|
||||
}
|
||||
|
||||
private static class JoinedItemMatcher extends TypeSafeMatcher<JoinedItem>
|
||||
@@ -44,8 +50,11 @@ public class JoinedItemFilter implements Filter<JoinedItem>
|
||||
boolean foundUnitPrice = BigDecimalUtils.isEqualByDecimalForFilter(item.getUnitPrice(), condition.getUnitPrice());
|
||||
boolean foundMUnit = MUnitEmb.isEqualMUnitEmbForFilter(item.getMunit(), condition.getMunit());
|
||||
boolean foundTotal = BigDecimalUtils.isEqualByDecimalForFilter(item.getTotal(), condition.getTotal());
|
||||
boolean foundWorkgroup = Workgroup.isEqualByWorkgroupForFilter(item.getWorkgroup(), condition.getWorkgroup());
|
||||
boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getCentre(), condition.getCentre());
|
||||
boolean foundOwner = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
||||
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
|
||||
return (foundCode && foundName && foundTextItem && foundDescription && foundQuantity && foundUnitPrice && foundMUnit && foundTotal && foundDescription);
|
||||
return (foundCode && foundName && foundTextItem && foundDescription && foundQuantity && foundUnitPrice && foundMUnit && foundTotal && foundWorkgroup && foundCenter && foundOwner && foundDescription);
|
||||
}
|
||||
|
||||
@Factory
|
||||
|
||||
@@ -11,6 +11,7 @@ import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PostFilter;
|
||||
@@ -33,12 +34,17 @@ public class ApprovedServiceImpl extends AbstractService<JoinedItem> implements
|
||||
public List<JoinedItem> getAll()
|
||||
{
|
||||
List<Workgroup> wgList = workgroupService.getUserCentres(userService.getCurrent());
|
||||
Query q = queryDao.getQuery("select item from RequirementItem item left join item.requirement rq join rq.centre c where rq.kind is not null and rq.state = :state and c in (:wgList)");
|
||||
Query q = queryDao
|
||||
.getQuery("select item from RequirementItem item left join item.requirement rq join rq.centre c where rq.kind is not null and rq.state = :state and c in (:wgList)");
|
||||
q.setParameterList("wgList", wgList);
|
||||
q.setParameter("state", RequirementState.APPROVED);
|
||||
List<JoinedItem> items = new ArrayList<JoinedItem>();
|
||||
|
||||
for (RequirementItem it : (List<RequirementItem>)q.list()) {
|
||||
for (RequirementItem it : (List<RequirementItem>) q.list())
|
||||
{
|
||||
// Kvůli lazy loadu načteme jakoukoli hodnotu objektu
|
||||
Hibernate.initialize(it.getRequirement().getOwnedBy());
|
||||
|
||||
items.add(new JoinedItem(it, it.getRequirement().getWorkgroup(), it.getRequirement().getCentre(), it.getRequirement().getOwnedBy()));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package info.bukova.isspst.ui.main.approved;
|
||||
|
||||
import info.bukova.isspst.data.JoinedItem;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.filters.JoinedItemFilter;
|
||||
import info.bukova.isspst.services.approved.ApprovedService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.BigDecimalConverter;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
@@ -16,6 +21,12 @@ public class ApprovedList extends ListViewModel<JoinedItem>
|
||||
@WireVariable
|
||||
protected ApprovedService approvedService;
|
||||
|
||||
@WireVariable
|
||||
protected WorkgroupService workgroupService;
|
||||
|
||||
@WireVariable
|
||||
protected UserService userService;
|
||||
|
||||
private BigDecimalConverter bigDecimalConverter;
|
||||
|
||||
@Init
|
||||
@@ -37,4 +48,25 @@ public class ApprovedList extends ListViewModel<JoinedItem>
|
||||
{
|
||||
return approvedService.getAll();
|
||||
}
|
||||
|
||||
public List<Workgroup> getWorkgroups()
|
||||
{
|
||||
Workgroup empty = new Workgroup();
|
||||
empty.setCode("");
|
||||
empty.setName("");
|
||||
List<Workgroup> list = new ArrayList<Workgroup>();
|
||||
list.add(empty);
|
||||
list.addAll(this.workgroupService.getWorkgroups());
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Workgroup> getCenters()
|
||||
{
|
||||
return this.workgroupService.getCentres();
|
||||
}
|
||||
|
||||
public List<User> getUsers()
|
||||
{
|
||||
return this.userService.getAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,8 @@ SelectGroup=Vybrat skupinu...
|
||||
RemoveItem=Smazat
|
||||
|
||||
Amount=Částka
|
||||
Owner=Vlastník
|
||||
CreateOrder=Vytvořit objednávku
|
||||
|
||||
WorkgroupFormUserIsCenterMember=Uživatel je členem střediska, jehož je komise členem!
|
||||
WorkgroupFormMemberIsCenterMember=Některý ze členů přidávané komise je členem tohoto střediska!
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 722 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -26,6 +26,7 @@
|
||||
multiple="true"
|
||||
checkmark="true"
|
||||
vflex="1"
|
||||
context="popupMenu"
|
||||
model="@load(vm.dataList)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader width="27" />
|
||||
@@ -61,7 +62,19 @@
|
||||
sort="auto(total)"
|
||||
label="${labels.RequirementItemTotal}" />
|
||||
<listheader
|
||||
hflex="20"
|
||||
hflex="7"
|
||||
sort="auto(workgroup.fullName)"
|
||||
label="${labels.RequirementsGridWorkgroup}" />
|
||||
<listheader
|
||||
hflex="7"
|
||||
sort="auto(centre.fullName)"
|
||||
label="${labels.RequirementsGridCenter}" />
|
||||
<listheader
|
||||
hflex="7"
|
||||
sort="auto(ownedBy.fullName)"
|
||||
label="${labels.Owner}" />
|
||||
<listheader
|
||||
hflex="15"
|
||||
sort="czech(description)"
|
||||
label="${labels.RequirementItemDescription}" />
|
||||
</listhead>
|
||||
@@ -112,19 +125,19 @@
|
||||
<auxheader>
|
||||
<!-- div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-img-left">
|
||||
<image src="/img/funnel.png" />
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.quantity)"
|
||||
instant="true"
|
||||
onChange="@command('doFilter')"
|
||||
sclass="find-grid-textbox-right" />
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.quantity)"
|
||||
instant="true"
|
||||
onChange="@command('doFilter')"
|
||||
sclass="find-grid-textbox-right" />
|
||||
</div>
|
||||
</div-->
|
||||
</div-->
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<!-- div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.munit.name)"
|
||||
@@ -135,35 +148,92 @@
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div-->
|
||||
</div>
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<!-- div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-img-left">
|
||||
<image src="/img/funnel.png" />
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.unitPrice)"
|
||||
instant="true"
|
||||
onChange="@command('doFilter')"
|
||||
sclass="find-grid-textbox-right" />
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.unitPrice)"
|
||||
instant="true"
|
||||
onChange="@command('doFilter')"
|
||||
sclass="find-grid-textbox-right" />
|
||||
</div>
|
||||
</div-->
|
||||
</div-->
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<!-- div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-img-left">
|
||||
<image src="/img/funnel.png" />
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.total)"
|
||||
instant="true"
|
||||
onChange="@command('doFilter')"
|
||||
sclass="find-grid-textbox-right" />
|
||||
<textbox
|
||||
value="@bind(vm.filterTemplate.total)"
|
||||
instant="true"
|
||||
onChange="@command('doFilter')"
|
||||
sclass="find-grid-textbox-right" />
|
||||
</div>
|
||||
</div-->
|
||||
</div-->
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<div zclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<combobox
|
||||
readonly="true"
|
||||
width="100%"
|
||||
selectedItem="@bind(vm.filterTemplate.workgroup)"
|
||||
model="@load(vm.workgroups)"
|
||||
onChange="@command('doFilter')">
|
||||
<template name="model">
|
||||
<comboitem label="@load(each.fullName)" />
|
||||
</template>
|
||||
</combobox>
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<div zclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<combobox
|
||||
readonly="true"
|
||||
width="100%"
|
||||
selectedItem="@bind(vm.filterTemplate.centre)"
|
||||
model="@load(vm.centers)"
|
||||
onChange="@command('doFilter')">
|
||||
<template name="model">
|
||||
<comboitem label="@load(each.fullName)" />
|
||||
</template>
|
||||
</combobox>
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<div zclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<combobox
|
||||
readonly="true"
|
||||
width="100%"
|
||||
selectedItem="@bind(vm.filterTemplate.ownedBy)"
|
||||
model="@load(vm.users)"
|
||||
onChange="@command('doFilter')">
|
||||
<template name="model">
|
||||
<comboitem label="@load(each.fullName)" />
|
||||
</template>
|
||||
</combobox>
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
<auxheader>
|
||||
<div sclass="find-grid-cell">
|
||||
@@ -190,9 +260,18 @@
|
||||
<listcell label="@load(each.munit.name)" />
|
||||
<listcell label="@load(each.unitPrice) @converter(vm.bigDecimalConverter)" />
|
||||
<listcell label="@load(each.total) @converter(vm.bigDecimalConverter)" />
|
||||
<listcell label="@load(each.workgroup.fullName)" />
|
||||
<listcell label="@load(each.centre.fullName)" />
|
||||
<listcell label="@load(each.ownedBy.fullName)" />
|
||||
<listcell label="@load(each.description)" />
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
</window>
|
||||
<menupopup id="popupMenu">
|
||||
<menuitem
|
||||
image="/img/autotruck-016.png"
|
||||
label="${labels.CreateOrder}..."
|
||||
onClick="" />
|
||||
</menupopup>
|
||||
</zk>
|
||||
Reference in New Issue
Block a user