multitenant
Josef Rokos 10 years ago
commit 4881d69162

@ -3,6 +3,8 @@ package info.bukova.isspst.filters;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup;
import org.hamcrest.Description;
import org.hamcrest.Factory;
@ -40,9 +42,11 @@ public class RequirementFilter implements Filter<Requirement>
{
boolean foundNumser = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getReqDate(), condition.getReqDate());
boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getCentre(), condition.getCentre());
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
return foundNumser && foundReqDate && foundDescription && foundDeliveryDate;
boolean foundUser = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundDeliveryDate && foundUser);
}
@Factory

@ -4,7 +4,6 @@ import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
@ -21,15 +20,12 @@ public class ReqListMy extends RequirementSubpage<Requirement>
@WireVariable
protected RequirementService requirementService;
@WireVariable
protected UserService userService;
@WireVariable
protected WorkgroupService workgroupService;
public List<Workgroup> getCentres()
{
return workgroupService.getUserCentres(userService.getCurrent());
return workgroupService.getCentres();
}
@Init

@ -4,7 +4,6 @@ import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
@ -23,15 +22,12 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
@WireVariable
protected RequirementService requirementService;
@WireVariable
protected UserService userService;
@WireVariable
protected WorkgroupService workgroupService;
public List<Workgroup> getCentres()
{
return workgroupService.getUserCentres(userService.getCurrent());
return workgroupService.getCentres();
}
@Init

@ -4,7 +4,6 @@ import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
@ -23,9 +22,6 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
@WireVariable
protected RequirementService requirementService;
@WireVariable
protected UserService userService;
@WireVariable
protected WorkgroupService workgroupService;

@ -4,7 +4,6 @@ import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.RequirementFilter;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.requirement.RequirementSubpage;
@ -23,15 +22,12 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
@WireVariable
protected RequirementService requirementService;
@WireVariable
protected UserService userService;
@WireVariable
protected WorkgroupService workgroupService;
public List<Workgroup> getCentres()
{
return workgroupService.getUserCentres(userService.getCurrent());
return workgroupService.getCentres();
}
@Init

@ -1,17 +1,30 @@
package info.bukova.isspst.ui.requirement;
import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.User;
import info.bukova.isspst.services.requirement.RequirementBaseService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.ListViewModel;
import java.util.List;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class RequirementSubpage<T extends RequirementBase> extends ListViewModel<T> {
@WireVariable
protected UserService userService;
public List<User> getAllUsers()
{
return userService.getAll();
}
private BigDecimalConverter bigDecimalConverter;
public BigDecimalConverter getBigDecimalConverter()

@ -4,7 +4,6 @@ import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.TripRequirementFilter;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.ArrayList;
@ -21,10 +20,10 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
@WireVariable
private TripRequirementService tripRequirementService;
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
private List<Workgroup> myCentres;
@Init

@ -4,7 +4,6 @@ import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.TripRequirementFilter;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.ArrayList;
@ -21,11 +20,12 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
@WireVariable
private TripRequirementService tripRequirementService;
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
private List<Workgroup> myCentres;
private List<Workgroup> myWorkgroups;
@Init

@ -8,28 +8,28 @@
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="7%" />
hflex="7" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="czech(description)"
width="10%" />
sort="auto(centre)"
hflex="15" />
<listheader
label="${labels.RequirementsGridDeliveryDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.Amount}"
sort="auto(sumTotal)"
align="right"
width="10%" />
hflex="10" />
<listheader
label="${labels.RequirementsGridDescription}"
sort="czech(description)"
width="60%" />
hflex="20" />
</listhead>
<auxhead
sclass="category-center"
@ -66,10 +66,13 @@
<auxheader>
<div sclass="find-grid-cell">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
model="@load(vm.centres)"
readonly="true"
width="100%"
selectedItem="@bind(vm.filterTemplate.workgroup)">
selectedItem="@bind(vm.filterTemplate.centre)">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>

@ -10,28 +10,32 @@
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="7%" />
hflex="7" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="czech(description)"
width="10%" />
sort="auto(centre)"
hflex="15" />
<listheader
label="${labels.RequirementsGridDeliveryDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.Amount}"
sort="auto(sumTotal)"
align="right"
width="10%" />
hflex="10" />
<listheader
label="${labels.RequirementsGridDescription}"
sort="czech(description)"
width="60%" />
hflex="20" />
<listheader
sort="auto(ownedBy.fullName)"
label="${labels.ownedBy}"
hflex="15" />
</listhead>
<auxhead
sclass="category-center"
@ -68,10 +72,13 @@
<auxheader>
<div sclass="find-grid-cell">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
model="@load(vm.centres)"
readonly="true"
width="100%"
selectedItem="@bind(vm.filterTemplate.workgroup)">
selectedItem="@bind(vm.filterTemplate.centre)">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
@ -124,6 +131,27 @@
</div>
</div>
</auxheader>
<auxheader>
<div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%"
selectedItem="@bind(vm.filterTemplate.ownedBy)"
model="@load(vm.allUsers)"
readonly="true">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
@ -133,6 +161,7 @@
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.sumTotal) @converter(vm.bigDecimalConverter)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.ownedBy.fullName)" />
</listitem>
</template>
</listbox>

@ -10,28 +10,32 @@
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="7%" />
hflex="7" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="czech(description)"
width="10%" />
sort="auto(centre)"
hflex="15" />
<listheader
label="${labels.RequirementsGridDeliveryDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.Amount}"
sort="auto(sumTotal)"
align="right"
width="10%" />
hflex="10" />
<listheader
label="${labels.RequirementsGridDescription}"
sort="czech(description)"
width="60%" />
hflex="20" />
<listheader
sort="auto(ownedBy.fullName)"
label="${labels.ownedBy}"
hflex="15" />
</listhead>
<auxhead
sclass="category-center"
@ -68,10 +72,13 @@
<auxheader>
<div sclass="find-grid-cell">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
model="@load(vm.centres)"
readonly="true"
width="100%"
selectedItem="@bind(vm.filterTemplate.workgroup)">
selectedItem="@bind(vm.filterTemplate.centre)">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
@ -124,6 +131,27 @@
</div>
</div>
</auxheader>
<auxheader>
<div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%"
selectedItem="@bind(vm.filterTemplate.ownedBy)"
model="@load(vm.allUsers)"
readonly="true">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
@ -133,6 +161,7 @@
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.sumTotal) @converter(vm.bigDecimalConverter)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.ownedBy.fullName)" />
</listitem>
</template>
</listbox>

@ -10,28 +10,32 @@
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="7%" />
hflex="7" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="czech(description)"
width="10%" />
sort="auto(centre)"
hflex="15" />
<listheader
label="${labels.RequirementsGridDeliveryDate}"
sort="auto(reqDate)"
width="13%" />
hflex="13" />
<listheader
label="${labels.Amount}"
sort="auto(sumTotal)"
align="right"
width="10%" />
hflex="10" />
<listheader
label="${labels.RequirementsGridDescription}"
sort="czech(description)"
width="60%" />
hflex="20" />
<listheader
sort="auto(ownedBy.fullName)"
label="${labelsownedBy}"
hflex="15" />
</listhead>
<auxhead
sclass="category-center"
@ -68,10 +72,13 @@
<auxheader>
<div sclass="find-grid-cell">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
model="@load(vm.centres)"
readonly="true"
width="100%"
selectedItem="@bind(vm.filterTemplate.workgroup)">
selectedItem="@bind(vm.filterTemplate.centre)">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
@ -124,6 +131,27 @@
</div>
</div>
</auxheader>
<auxheader>
<div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<combobox
ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%"
selectedItem="@bind(vm.filterTemplate.ownedBy)"
model="@load(vm.allUsers)"
readonly="true">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
@ -133,6 +161,7 @@
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.sumTotal) @converter(vm.bigDecimalConverter)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.ownedBy.fullName)" />
</listitem>
</template>
</listbox>

Loading…
Cancel
Save