--- /dev/null
+package hu.user.lis.ui.converter;
+
+import hu.user.lis.db.Project;
+import org.zkoss.bind.BindContext;
+import org.zkoss.bind.Converter;
+import org.zkoss.zul.Bandbox;
+
+public class ProjectToInfoConverter implements Converter<String, Project, Bandbox> {
+
+ @Override
+ public String coerceToUi(Project project, Bandbox bandbox, BindContext bindContext) {
+ return project == null ? null : String.format("%s | %s | %s", project.getHumanId(), project.getName(), project.getPartner().getName());
+ }
+
+ @Override
+ public Project coerceToBean(String s, Bandbox bandbox, BindContext bindContext) {
+ return null;
+ }
+}
\ No newline at end of file
@Autowired
ProjectService projectService;
private String partialName;
+ private String partialPartnerName;
+ private String partialHumanId;
private boolean filter(Project project) {
- if (StringUtils.isBlank(partialName)) {
+ if (StringUtils.isBlank(partialHumanId) && StringUtils.isBlank(partialName) && StringUtils.isBlank(partialPartnerName)) {
return true;
- } else {
- if (project.getHumanId().toLowerCase().startsWith(partialName.toLowerCase())) {
+ }
+ if (StringUtils.isNotBlank(partialHumanId)) {
+ if (project.getHumanId().toLowerCase().contains(partialHumanId.toLowerCase())) {
+ return true;
+ }
+ }
+ if (StringUtils.isNotBlank(partialName)) {
+ if (project.getName().toLowerCase().contains(partialName.toLowerCase())) {
+ return true;
+ }
+ }
+ if (StringUtils.isNotBlank(partialPartnerName)) {
+ if (project.getPartner().getName().toLowerCase().contains(partialPartnerName.toLowerCase())) {
return true;
}
}
return result;
}
- public void search(String partialName) {
- log.info("Searching project using filter {}", partialName);
+ public void search(String partialName, String partialPartnerName, String partialHumanId) {
+ log.info("Searching projects using filter {} {} {}", partialHumanId, partialName, partialHumanId);
+ this.partialPartnerName = partialPartnerName;
+ this.partialHumanId = partialHumanId;
this.partialName = partialName;
super.reset();
BindUtils.postNotifyChange(null, null, this, "*");
}
+
+ public void getLimited() {
+ log.info("Searching projects using limit {}", SEARCH_LIMIT);
+ this.partialPartnerName = null;
+ this.partialHumanId = null;
+ this.partialName = null;
+ super.reset();
+ BindUtils.postNotifyChange(null, null, this, "*");
+ }
}
public void onProjectBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
InputEvent event = (InputEvent) ctx.getTriggerEvent();
log.info("onProjectBandChanging: {}", event.getValue());
- projectSelectorDataModel.search(event.getValue());
+ projectSelectorDataModel.search(event.getValue(), null, null);
}
@Command
public void onProjectBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
log.info("onProjectBandOpen: {}", event.isOpen());
- projectSelectorDataModel.search(null);
+ projectSelectorDataModel.getLimited();
}
@Command
public void onProjectFilterBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
InputEvent event = (InputEvent) ctx.getTriggerEvent();
log.info("onProjectFilterBandChanging: {}", event.getValue());
- projectSelectorDataModel.search(event.getValue());
+ projectSelectorDataModel.search(event.getValue(), null, null);
}
@Command
public void onProjectFilterBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
log.info("onProjectFilterBandOpen: {}", event.isOpen());
- projectSelectorDataModel.search(null);
+ projectSelectorDataModel.getLimited();
}
@Command
<zk xmlns:c="client">
<bandbox id="projectFilterBandBox" autodrop="true" iconSclass="z-icon-sort-down"
- value="@load(vm.filterProject) @converter('hu.user.lis.ui.converter.ProjectToNameConverter')"
+ value="@load(vm.filterProject) @converter('hu.user.lis.ui.converter.ProjectToInfoConverter')"
onChanging="@command('onProjectFilterBandChanging')" onOpen="@command('onProjectFilterBandOpen')"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ forward="onOK=submit.onClick, onCancel=cancel.onClick" width="400px">
<attribute c:name="_doKeyDown">
<![CDATA[
function (evt) {
onClick="projectFilterBandBox.close()"
onDoubleClick="projectFilterBandBox.close()">
<listhead visible="false">
- <listheader label="name" vflex="max"/>
+ <listheader label="Azonosító" vflex="max"/>
+ <listheader label="Név" vflex="max"/>
+ <listheader label="Partner név" vflex="max"/>
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.humanId)"/>
+ <listcell label="@load(each.name)"/>
+ <listcell label="@load(each.partner.name)"/>
</listitem>
</template>
</listbox>
<zk xmlns:c="client">
- <hlayout hflex="true">
- <bandbox id="projectBandBox" autodrop="true" iconSclass="z-icon-sort-down"
- value="@load(vm.formDocument.project) @converter('hu.user.lis.ui.converter.ProjectToNameConverter')"
+ <hlayout hflex="min">
+ <bandbox id="projectBandBox" autodrop="true" iconSclass="z-icon-sort-down" hflex="true"
+ value="@load(vm.formDocument.project) @converter('hu.user.lis.ui.converter.ProjectToInfoConverter')"
onChanging="@command('onProjectBandChanging')" onOpen="@command('onProjectBandOpen')"
forward="onOK=submit.onClick, onCancel=cancel.onClick">
<attribute c:name="_doKeyDown">
}
]]>
</attribute>
- <bandpopup>
- <listbox id="projectList" height="250px" width="450px"
+ <bandpopup width="500px">
+ <listbox id="projectList" height="250px" hflex="true"
model="@bind(vm.projectSelectorDataModel)"
selectedItem="@bind(vm.formDocument.project) @validator(vm)"
onClick="projectBandBox.close()"
onDoubleClick="projectBandBox.close()">
<listhead visible="false">
- <listheader label="name" vflex="max"/>
+ <listheader label="Azonosító"/>
+ <listheader label="Név"/>
+ <listheader label="Partner név"/>
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.humanId)"/>
+ <listcell label="@load(each.name)"/>
+ <listcell label="@load(each.partner.name)"/>
</listitem>
</template>
</listbox>
<?component name="associate-selector" inline="true" macroURI="~./associate-selector.zul"?>
<?component name="project-selector" inline="true" macroURI="~./project-selector.zul"?>
<zk>
- <window id="serviceRecordPopup" width="50%" height="400px" closable="true"
+ <window id="serviceRecordPopup" width="50%" height="450px" closable="true"
viewModel="@id('vm') @init('hu.user.lis.ui.editor.ServiceRecordEditorModel')">
<caption label="Munkalap szerkesztés"/>
<borderlayout>
<tab label="Munkalap"/>
</tabs>
<tabpanels>
- <tabpanel>
- <vlayout>
+ <tabpanel hflex="true">
+ <vlayout hflex="true">
+ <vlayout hflex="true">
+ <label value="Projekt"/>
+ <project-selector hflex="true"/>
+ </vlayout>
<hlayout>
- <vlayout>
- <label value="Projekt"/>
- <project-selector/>
- </vlayout>
<vlayout>
<label value="Munkatárs"/>
<associate-selector/>
autopaging="true" pagingPosition="top" onSelect="@command('onListSelection')"
onDoubleClick="@command('onEdit')">
<listhead sizable="true">
- <listheader label="Projekt" align="left"/>
+ <listheader label="Projekt azonosító" align="left"/>
+ <listheader label="Projekt név" align="left"/>
+ <listheader label="Partner név" align="left"/>
<listheader label="Munkatárs" align="left"/>
<listheader label="Munkanap" align="left"/>
<listheader label="Leírás" align="left"/>
<template name="model">
<listitem>
<listcell label="@load(each.project.humanId)"/>
+ <listcell label="@load(each.project.name)"/>
+ <listcell label="@load(each.project.partner.name)"/>
<listcell label="@load(each.associate.name)"/>
<listcell
label="@load(each.workDay) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>