Projects list, project editor added partial implementation
authorelgekko <vasary@elgekko.net>
Mon, 17 Apr 2023 20:55:21 +0000 (22:55 +0200)
committerelgekko <vasary@elgekko.net>
Mon, 17 Apr 2023 20:55:21 +0000 (22:55 +0200)
26 files changed:
lis-app/pom.xml
lis-db/src/main/java/hu/user/lis/db/Currency.java [new file with mode: 0644]
lis-db/src/main/java/hu/user/lis/db/Invoice.java [new file with mode: 0644]
lis-db/src/main/java/hu/user/lis/db/Project.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/DataGeneratorService.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/InvoiceService.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/InvoiceServiceImpl.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/PartnerService.java
lis-services/src/main/java/hu/user/lis/services/data/PartnerServiceImpl.java
lis-services/src/main/java/hu/user/lis/services/data/ProjectService.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/ProjectServiceImpl.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/SupplierServiceImpl.java
lis-ui/src/main/java/hu/user/lis/ui/converter/PartnerToNameConverter.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/data/PartnersSelectorDataModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/data/ProjectsDataModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/PartnerEditorModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/PartnersViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/ProjectEditorModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/ProjectsViewModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/SupplierViewModel.java [deleted file]
lis-ui/src/main/resources/web/index.zul
lis-ui/src/main/resources/web/partner-selector.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/partners.zul
lis-ui/src/main/resources/web/project.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/projects.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/supplier-test.zul [deleted file]

index 24ffec744e926937a25d0c56293a0ae4c0ae0e63..d6c5c541e0e8f5e138865e85315d5f359a20d527 100644 (file)
@@ -4,7 +4,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>hu.user</groupId>
     <artifactId>lis-app</artifactId>
-    <version>0.0.2-SNAPSHOT</version>
+    <version>0.0.3-SNAPSHOT</version>
     <parent>
         <groupId>hu.user</groupId>
         <artifactId>lis</artifactId>
diff --git a/lis-db/src/main/java/hu/user/lis/db/Currency.java b/lis-db/src/main/java/hu/user/lis/db/Currency.java
new file mode 100644 (file)
index 0000000..ac32550
--- /dev/null
@@ -0,0 +1,5 @@
+package hu.user.lis.db;
+
+public enum Currency {
+    HUF, USD, EURO
+}
diff --git a/lis-db/src/main/java/hu/user/lis/db/Invoice.java b/lis-db/src/main/java/hu/user/lis/db/Invoice.java
new file mode 100644 (file)
index 0000000..851c605
--- /dev/null
@@ -0,0 +1,25 @@
+package hu.user.lis.db;
+
+import lombok.*;
+
+import java.time.LocalDate;
+
+@Getter
+@Setter
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class Invoice {
+    String id;
+    String projectId;
+    String title;
+    Partner partner;
+    boolean income;
+    Currency currency;
+    double netAmount;
+    double grossAmount;
+    double vatAmount;
+    LocalDate completionDate;
+    LocalDate createDate;
+    LocalDate paymentDeadline;
+}
diff --git a/lis-db/src/main/java/hu/user/lis/db/Project.java b/lis-db/src/main/java/hu/user/lis/db/Project.java
new file mode 100644 (file)
index 0000000..42817d3
--- /dev/null
@@ -0,0 +1,17 @@
+package hu.user.lis.db;
+
+import lombok.*;
+
+@Getter
+@Setter
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class Project {
+    String id;
+    String name;
+    String humanId;
+    String contactName;
+    Partner partner;
+    boolean active;
+}
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/DataGeneratorService.java b/lis-services/src/main/java/hu/user/lis/services/data/DataGeneratorService.java
new file mode 100644 (file)
index 0000000..a89356c
--- /dev/null
@@ -0,0 +1,14 @@
+package hu.user.lis.services.data;
+
+import com.github.javafaker.Faker;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DataGeneratorService {
+    private Faker faker = new Faker();
+
+    public Faker faker() {
+        return faker;
+    }
+
+}
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/InvoiceService.java b/lis-services/src/main/java/hu/user/lis/services/data/InvoiceService.java
new file mode 100644 (file)
index 0000000..06eff52
--- /dev/null
@@ -0,0 +1,18 @@
+package hu.user.lis.services.data;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import hu.user.lis.db.Invoice;
+
+import java.util.List;
+
+public interface InvoiceService {
+    List<Invoice> getAll();
+
+    Invoice createNew();
+
+    void add(Invoice entity);
+
+    Invoice copy(Invoice sourceEntity) throws JsonProcessingException;
+
+    void replace(Invoice targetEntity, Invoice replacementEntity);
+}
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/InvoiceServiceImpl.java b/lis-services/src/main/java/hu/user/lis/services/data/InvoiceServiceImpl.java
new file mode 100644 (file)
index 0000000..b7eaa50
--- /dev/null
@@ -0,0 +1,65 @@
+package hu.user.lis.services.data;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import hu.user.lis.db.Invoice;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class InvoiceServiceImpl implements InvoiceService {
+    private List<Invoice> entities;
+    @Autowired
+    DataGeneratorService dataGeneratorService;
+
+    @Autowired
+    ObjectMapper mapper;
+
+    @Override
+    public List<Invoice> getAll() {
+        if (entities == null) {
+            entities = generate();
+        }
+        return entities;
+    }
+
+    @Override
+    public Invoice createNew() {
+        String id = RandomStringUtils.random(8, "0123456789abcdef");
+        return Invoice.builder().id(id).build();
+    }
+
+    @Override
+    public void add(Invoice entity) {
+        entities.add(entity);
+    }
+
+    @Override
+    public Invoice copy(Invoice sourceEntity) throws JsonProcessingException {
+        ObjectMapper mapper = new ObjectMapper();
+        String json = mapper.writeValueAsString(sourceEntity);
+        return mapper.readValue(json, Invoice.class);
+    }
+
+    @Override
+    public void replace(Invoice targetEntity, Invoice replacementEntity) {
+        Invoice listEntity = entities.stream().filter(p -> p.getId().equals(targetEntity.getId())).findFirst().get();
+        entities.remove(listEntity);
+        entities.add(replacementEntity);
+    }
+
+    private List<Invoice> generate() {
+        List<Invoice> result = new ArrayList<>();
+        for (int i = 0; i < 100; i++) {
+            String id = RandomStringUtils.random(8, "0123456789abcdef");
+            String title = dataGeneratorService.faker().commerce().productName();
+            Invoice entity = Invoice.builder().id(id).title(title).build();
+            result.add(entity);
+        }
+        return result;
+    }
+}
index 48c801a24dd989e4536b7b4a5a2ff92efdfc317a..0f1b02ad97ebc05d637f534b4190f29ae4e78120 100644 (file)
@@ -10,9 +10,11 @@ public interface PartnerService {
 
     Partner createNew();
 
-    void add(Partner partner);
+    void add(Partner entity);
 
-    Partner copy(Partner selectedPartner) throws JsonProcessingException;
+    Partner copy(Partner sourceEntity) throws JsonProcessingException;
 
-    void replace(Partner selectedPartner, Partner editPartner);
+    void replace(Partner targetEntity, Partner replacementEntity);
+
+    Partner getRandom();
 }
index dc59f2bd32f56bf33d9b01fe2f3085a9480f75e6..ae99f3f95832144ac33a38e2a8dee8b6614339ec 100644 (file)
@@ -2,9 +2,10 @@ package hu.user.lis.services.data;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.github.javafaker.Faker;
+import com.github.javafaker.Address;
 import hu.user.lis.db.Partner;
 import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.RandomUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -13,17 +14,19 @@ import java.util.List;
 
 @Service
 public class PartnerServiceImpl implements PartnerService {
-    private List<Partner> partners;
+    private List<Partner> entities;
 
     @Autowired
     ObjectMapper mapper;
+    @Autowired
+    DataGeneratorService dataGeneratorService;
 
     @Override
     public List<Partner> getAll() {
-        if (partners == null) {
-            partners = generate();
+        if (entities == null) {
+            entities = generate();
         }
-        return partners;
+        return entities;
     }
 
     @Override
@@ -33,35 +36,42 @@ public class PartnerServiceImpl implements PartnerService {
     }
 
     @Override
-    public void add(Partner partner) {
-        partners.add(partner);
+    public void add(Partner entity) {
+        entities.add(entity);
     }
 
     @Override
-    public Partner copy(Partner selectedPartner) throws JsonProcessingException {
+    public Partner copy(Partner sourceEntity) throws JsonProcessingException {
         ObjectMapper mapper = new ObjectMapper();
-        String json = mapper.writeValueAsString(selectedPartner);
+        String json = mapper.writeValueAsString(sourceEntity);
         return mapper.readValue(json, Partner.class);
     }
 
     @Override
-    public void replace(Partner selectedPartner, Partner editPartner) {
-        Partner partnerInList = partners.stream().filter(p -> p.getId().equals(selectedPartner.getId())).findFirst().get();
-        partners.remove(partnerInList);
-        //partners.remove(selectedPartner);
-        partners.add(editPartner);
+    public void replace(Partner targetEntity, Partner replacementEntity) {
+        Partner listEntity = entities.stream().filter(p -> p.getId().equals(targetEntity.getId())).findFirst().get();
+        entities.remove(listEntity);
+        entities.add(replacementEntity);
+    }
+
+    @Override
+    public Partner getRandom() {
+        return getAll().get(RandomUtils.nextInt(0, entities.size()));
     }
 
     private List<Partner> generate() {
         List<Partner> result = new ArrayList<>();
-        Faker faker = new Faker();
         for (int i = 0; i < 100; i++) {
             String id = RandomStringUtils.random(8, "0123456789abcdef");
-            String name = faker.name().fullName();
+            String name = dataGeneratorService.faker().name().fullName();
             String vatNr = RandomStringUtils.random(12, "0123456789");
-            String address = String.format("%s %s, %s street %s", faker.address().zipCode(), faker.address().city(),
-                    faker.address().streetName(), faker.address().buildingNumber());
-            Partner partner = Partner.builder().active(true).id(id).name(name).vatNr(vatNr).address(address).build();
+            Address address = dataGeneratorService.faker().address();
+            String fullAddress = String.format("%s %s, %s street %s",
+                    address.zipCode(),
+                    address.city(),
+                    address.streetName(),
+                    address.buildingNumber());
+            Partner partner = Partner.builder().active(true).id(id).name(name).vatNr(vatNr).address(fullAddress).build();
             result.add(partner);
         }
         return result;
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/ProjectService.java b/lis-services/src/main/java/hu/user/lis/services/data/ProjectService.java
new file mode 100644 (file)
index 0000000..261ef91
--- /dev/null
@@ -0,0 +1,18 @@
+package hu.user.lis.services.data;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import hu.user.lis.db.Project;
+
+import java.util.List;
+
+public interface ProjectService {
+    List<Project> getAll();
+
+    Project createNew();
+
+    void add(Project entity);
+
+    Project copy(Project sourceEntity) throws JsonProcessingException;
+
+    void replace(Project targetEntity, Project replacementEntity);
+}
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/ProjectServiceImpl.java b/lis-services/src/main/java/hu/user/lis/services/data/ProjectServiceImpl.java
new file mode 100644 (file)
index 0000000..3850429
--- /dev/null
@@ -0,0 +1,78 @@
+package hu.user.lis.services.data;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import hu.user.lis.db.Partner;
+import hu.user.lis.db.Project;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class ProjectServiceImpl implements ProjectService {
+    private List<Project> entities;
+    @Autowired
+    ObjectMapper mapper;
+    @Autowired
+    DataGeneratorService dataGeneratorService;
+    @Autowired
+    PartnerService partnerService;
+
+    @Override
+    public List<Project> getAll() {
+        if (entities == null) {
+            entities = generate();
+        }
+        return entities;
+    }
+
+    @Override
+    public Project createNew() {
+        String id = RandomStringUtils.random(8, "0123456789abcdef");
+        String humanId = dataGeneratorService.faker().code().isbn13(true);
+        return Project.builder().id(id).humanId(humanId).active(true).build();
+    }
+
+    @Override
+    public void add(Project entity) {
+        entities.add(entity);
+    }
+
+    @Override
+    public Project copy(Project sourceEntity) throws JsonProcessingException {
+        ObjectMapper mapper = new ObjectMapper();
+        String json = mapper.writeValueAsString(sourceEntity);
+        return mapper.readValue(json, Project.class);
+    }
+
+    @Override
+    public void replace(Project targetEntity, Project replacementEntity) {
+        Project partnerInList = entities.stream().filter(p -> p.getId().equals(targetEntity.getId())).findFirst().get();
+        entities.remove(partnerInList);
+        entities.add(replacementEntity);
+    }
+
+    private List<Project> generate() {
+        List<Project> result = new ArrayList<>();
+        for (int i = 0; i < 100; i++) {
+            String id = RandomStringUtils.random(8, "0123456789abcdef");
+            String name = dataGeneratorService.faker().commerce().productName();
+            String humanId = dataGeneratorService.faker().code().isbn10(true);
+            String contactName = dataGeneratorService.faker().name().fullName();
+            Partner partner = partnerService.getRandom();
+            Project entity = Project.builder()
+                    .id(id)
+                    .active(true)
+                    .humanId(humanId)
+                    .name(name)
+                    .contactName(contactName)
+                    .partner(partner)
+                    .build();
+            result.add(entity);
+        }
+        return result;
+    }
+}
index 57880db87e2b248d9f35f7980f1cae0024f60e05..3913e1ca77b3912c1deeabf667145e1088565c0e 100644 (file)
@@ -1,8 +1,8 @@
 package hu.user.lis.services.data;
 
-import com.github.javafaker.Faker;
 import hu.user.lis.db.Supplier;
 import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -11,6 +11,8 @@ import java.util.List;
 @Service
 public class SupplierServiceImpl implements SupplierService {
     private List<Supplier> suppliers;
+    @Autowired
+    DataGeneratorService dataGeneratorService;
 
     @Override
     public List<Supplier> getAll() {
@@ -22,10 +24,9 @@ public class SupplierServiceImpl implements SupplierService {
 
     private List<Supplier> generate() {
         List<Supplier> result = new ArrayList<>();
-        Faker faker = new Faker();
         for (int i = 0; i < 100; i++) {
             String id = RandomStringUtils.random(8, "0123456789abcdef");
-            String name = faker.name().fullName();
+            String name = dataGeneratorService.faker().name().fullName();
             String zipCode = RandomStringUtils.random(4, "0123456789");
             Supplier supplier = Supplier.builder().id(id).name(name).zipCode(zipCode).build();
             result.add(supplier);
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/converter/PartnerToNameConverter.java b/lis-ui/src/main/java/hu/user/lis/ui/converter/PartnerToNameConverter.java
new file mode 100644 (file)
index 0000000..8422789
--- /dev/null
@@ -0,0 +1,19 @@
+package hu.user.lis.ui.converter;
+
+import hu.user.lis.db.Partner;
+import org.zkoss.bind.BindContext;
+import org.zkoss.bind.Converter;
+import org.zkoss.zul.Bandbox;
+
+public class PartnerToNameConverter implements Converter<String, Partner, Bandbox> {
+
+    @Override
+    public String coerceToUi(Partner partner, Bandbox bandbox, BindContext bindContext) {
+        return partner == null ? null : partner.getName();
+    }
+
+    @Override
+    public Partner coerceToBean(String s, Bandbox bandbox, BindContext bindContext) {
+        return null;
+    }
+}
\ No newline at end of file
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/data/PartnersSelectorDataModel.java b/lis-ui/src/main/java/hu/user/lis/ui/data/PartnersSelectorDataModel.java
new file mode 100644 (file)
index 0000000..6867013
--- /dev/null
@@ -0,0 +1,60 @@
+package hu.user.lis.ui.data;
+
+import hu.user.lis.db.Partner;
+import hu.user.lis.services.data.PartnerService;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.zkoss.bind.BindUtils;
+import org.zkoss.zul.FieldComparator;
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+@Log4j2
+public class PartnersSelectorDataModel extends CachedDataModel<Partner> {
+    static private final int SEARCH_LIMIT = 10;
+    private String partialName;
+    @Autowired
+    PartnerService partnerService;
+
+    private boolean filter(Partner partner) {
+        if (StringUtils.isBlank(partialName)) {
+            return true;
+        } else {
+            if (partner.getName().toLowerCase().startsWith(partialName.toLowerCase())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    protected List<Partner> getResultSet(long offset, int limit, FieldComparator sortComparator) {
+        List<Partner> result = partnerService.getAll().stream()
+                .sorted(Comparator.comparing(Partner::getName))
+                .filter(s -> filter(s))
+                .limit(SEARCH_LIMIT)
+                .collect(Collectors.toList());
+        return result;
+    }
+
+    @Override
+    public int getResultSetCount() {
+        int result = (int) partnerService.getAll().stream()
+                .filter(s -> filter(s))
+                .limit(SEARCH_LIMIT)
+                .count();
+        return result;
+    }
+
+    public void search(String partialName) {
+        log.info("Searching partner using filter {}", partialName);
+        this.partialName = partialName;
+        super.reset();
+        BindUtils.postNotifyChange(null, null, this, "*");
+    }
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/data/ProjectsDataModel.java b/lis-ui/src/main/java/hu/user/lis/ui/data/ProjectsDataModel.java
new file mode 100644 (file)
index 0000000..f75278c
--- /dev/null
@@ -0,0 +1,116 @@
+package hu.user.lis.ui.data;
+
+import hu.user.lis.db.Project;
+import hu.user.lis.services.data.ProjectService;
+import lombok.Getter;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import org.zkoss.bind.BindUtils;
+import org.zkoss.zul.FieldComparator;
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+@Log4j2
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class ProjectsDataModel extends CachedDataModel<Project> {
+    private String partialName;
+    private String partialHumanId;
+    private boolean listAll;
+
+    @Getter
+    @Autowired
+    ProjectService projectService;
+    private boolean filterShowInActive;
+    private boolean filterShowActive;
+
+
+    private boolean canExecuteSearch() {
+        boolean result = listAll || filterShowActive || filterShowInActive ||
+                StringUtils.isNotBlank(partialName) ||
+                StringUtils.isNotBlank(partialHumanId);
+        log.info("Can execute search: {}", result);
+        return result;
+    }
+
+    private boolean filter(Project entity) {
+        if (listAll) {
+            return true;
+        }
+        boolean result = true;
+        if (StringUtils.isNotBlank(partialName)) {
+            if (!entity.getName().toLowerCase().startsWith(partialName.toLowerCase())) {
+                result = false;
+            }
+        }
+        if (StringUtils.isNotBlank(partialHumanId)) {
+            if (!entity.getHumanId().toLowerCase().startsWith(partialHumanId.toLowerCase())) {
+                result = false;
+            }
+        }
+        if (!filterShowActive && entity.isActive()) {
+            result = false;
+        }
+        if (!filterShowInActive && !entity.isActive()) {
+            result = false;
+        }
+        return result;
+    }
+
+    @Override
+    protected List<Project> getResultSet(long offset, int limit, FieldComparator sortComparator) {
+        List<Project> result = null;
+        if (canExecuteSearch()) {
+            result = projectService.getAll().stream()
+                    .filter(s -> filter(s))
+                    .sorted(Comparator.comparing(Project::getName, String.CASE_INSENSITIVE_ORDER))
+                    .collect(Collectors.toList());
+        }
+        return result;
+    }
+
+    @Override
+    public int getResultSetCount() {
+        int result = 0;
+        if (canExecuteSearch()) {
+            result = (int) projectService.getAll().stream()
+                    .filter(s -> filter(s))
+                    .count();
+        }
+        return result;
+    }
+
+    public void search(String partialName, String partialHumanId) {
+        log.info("Searching partner using filters: name LIKE {}, VAT human ID LIKE {}",
+                partialName, partialHumanId);
+        listAll = false;
+        this.partialName = partialName;
+        this.partialHumanId = partialHumanId;
+        super.reset();
+        BindUtils.postNotifyChange(null, null, this, "*");
+    }
+
+
+    public void search(boolean filterShowActive, boolean filterShowInActive) {
+        log.info("Searching partner using filters: filterShowActive {}, filterShowInActive {}",
+                filterShowActive, filterShowInActive);
+        this.filterShowActive = filterShowActive;
+        this.filterShowInActive = filterShowInActive;
+        listAll = false;
+        super.reset();
+        BindUtils.postNotifyChange(null, null, this, "*");
+    }
+
+    public void listAll() {
+        log.info("List all partners");
+        listAll = true;
+        super.reset();
+        BindUtils.postNotifyChange(null, null, this, "*");
+    }
+}
index a884519e8529a32135d8f78cc9306d4bbc5302c0..1ee5dbd5299f2575920f8f6dfbaef0b164a39e76 100644 (file)
@@ -19,7 +19,6 @@ import org.zkoss.zul.Window;
 @Setter
 @VariableResolver(DelegatingVariableResolver.class)
 public class PartnerEditorModel {
-    private boolean canEdit;
     private Partner selectedPartner;
 
     @Init
index 966a3062508dc656a1c75304b084d8724d8ffcbe..c85abbe7a7d3d38723a26a1f8bb9d57ae9c317e6 100644 (file)
@@ -47,6 +47,8 @@ public class PartnersViewModel extends AsyncBaseModel {
     }
 
     private void refresh() {
+        partnersDataModel.clearSelection();
+        selectedPartner = null;
         if (filterShowBoth) {
             partnersDataModel.search(true, true);
         } else {
@@ -57,9 +59,6 @@ public class PartnersViewModel extends AsyncBaseModel {
     @Command
     @NotifyChange("selectedPartner")
     public void search() {
-        partnersDataModel.clearSelection();
-        selectedPartner = null;
-        //partnersDataModel.search(partialName, partialVatNr, partialAddress);
     }
 
     @Command
@@ -67,7 +66,7 @@ public class PartnersViewModel extends AsyncBaseModel {
     public void onListSelection() {
         selectedPartner = null;
         Set<Partner> selections = partnersDataModel.getSelection();
-        if (selections.iterator().hasNext()) {
+        if (selections.size() == 1) {
             selectedPartner = selections.iterator().next();
             log.info("Selected {}", selectedPartner);
         }
@@ -112,11 +111,12 @@ public class PartnersViewModel extends AsyncBaseModel {
         partnerWindow.addEventListener("onClose", e -> {
             if (e.getData() != null) {
                 log.info("Partner popup result {}", e.getData());
-                selectedPartner = (Partner) e.getData();
-                partnersDataModel.getPartnerService().replace(selectedPartner, editPartner);
+                Partner modifiedEntity = (Partner) e.getData();
                 partnersDataModel.clearSelection();
+                partnersDataModel.getPartnerService().replace(selectedPartner, modifiedEntity);
                 refresh();
-                partnersDataModel.addToSelection(editPartner);
+                partnersDataModel.addToSelection(modifiedEntity);
+                selectedPartner = modifiedEntity;
             }
         });
         partnerWindow.doModal();
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/ProjectEditorModel.java b/lis-ui/src/main/java/hu/user/lis/ui/view/ProjectEditorModel.java
new file mode 100644 (file)
index 0000000..4cfaf16
--- /dev/null
@@ -0,0 +1,82 @@
+package hu.user.lis.ui.view;
+
+import hu.user.lis.db.Partner;
+import hu.user.lis.db.Project;
+import hu.user.lis.ui.data.PartnersSelectorDataModel;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+import org.zkoss.bind.BindContext;
+import org.zkoss.bind.BindUtils;
+import org.zkoss.bind.annotation.*;
+import org.zkoss.zk.ui.Executions;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.Events;
+import org.zkoss.zk.ui.event.InputEvent;
+import org.zkoss.zk.ui.event.OpenEvent;
+import org.zkoss.zk.ui.select.annotation.VariableResolver;
+import org.zkoss.zk.ui.select.annotation.WireVariable;
+import org.zkoss.zkplus.spring.DelegatingVariableResolver;
+import org.zkoss.zul.Window;
+
+@Log4j2
+@Getter
+@Setter
+@VariableResolver(DelegatingVariableResolver.class)
+public class ProjectEditorModel {
+    private Project formDocument;
+    private Partner selectedPartner;
+    @WireVariable
+    PartnersSelectorDataModel partnersSelectorDataModel;
+
+    @Init
+    public void init() {
+        log.info("Initialized");
+        formDocument = (Project) Executions.getCurrent().getArg().get("formDocument");
+        selectedPartner = formDocument.getPartner();
+        partnersSelectorDataModel.clearSelection();
+    }
+
+    @Command
+    public void onCloseWindow(@BindingParam("target") Window target, @BindingParam("select") boolean select) {
+        Event closeEvent = new Event("onClose", target, select ? formDocument : null);
+        Events.postEvent(closeEvent);
+    }
+
+    @Command
+    public void onPartnerBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
+        InputEvent event = (InputEvent) ctx.getTriggerEvent();
+        log.info("onPartnerBandChanging: {}", event.getValue());
+        partnersSelectorDataModel.search(event.getValue());
+    }
+
+    @Command
+    public void onPartnerBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
+        OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
+        log.info("onPartnerBandOpen: {}", event.isOpen());
+        partnersSelectorDataModel.search(null);
+    }
+
+    @Command
+    public void onPopupPartners() {
+        String page = "~./suppliers.zul";
+        Window suppliersWindow = (Window) Executions.createComponents(page, null, null);
+        suppliersWindow.addEventListener("onClose", e -> {
+            log.info("Suppliers popup result {}", e.getData());
+            if (e.getData() != null) {
+                partnersSelectorDataModel.clearSelection();
+                //setSelectedSupplierId(((Supplier) e.getData()).getId());
+                BindUtils.postNotifyChange(null, null, this, "selectedSupplierId");
+            }
+        });
+
+        suppliersWindow.doModal();
+    }
+
+    @NotifyChange({"selectedPartner"})
+    public void setSelectedPartner(Partner selectedPartner) {
+        this.selectedPartner = selectedPartner;
+        formDocument.setPartner(selectedPartner);
+    }
+
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/ProjectsViewModel.java b/lis-ui/src/main/java/hu/user/lis/ui/view/ProjectsViewModel.java
new file mode 100644 (file)
index 0000000..80ac4fd
--- /dev/null
@@ -0,0 +1,152 @@
+package hu.user.lis.ui.view;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import hu.user.lis.db.Project;
+import hu.user.lis.ui.data.ProjectsDataModel;
+import lombok.Getter;
+import lombok.extern.log4j.Log4j2;
+import org.zkoss.bind.annotation.*;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.Executions;
+import org.zkoss.zk.ui.select.Selectors;
+import org.zkoss.zk.ui.select.annotation.VariableResolver;
+import org.zkoss.zk.ui.select.annotation.WireVariable;
+import org.zkoss.zkplus.spring.DelegatingVariableResolver;
+import org.zkoss.zul.Window;
+
+import java.util.Collections;
+import java.util.Set;
+
+@Log4j2
+@VariableResolver(DelegatingVariableResolver.class)
+public class ProjectsViewModel extends AsyncBaseModel {
+    @Getter
+    private Project selectedProject;
+    @WireVariable
+    @Getter
+    ProjectsDataModel projectsDataModel;
+    private boolean filterShowInActive;
+    private boolean filterShowActive;
+    private boolean filterShowBoth;
+
+    @AfterCompose
+    public void onAfterCompose(@ContextParam(ContextType.VIEW) Component view) {
+        Selectors.wireComponents(view, this, false);
+        Selectors.wireEventListeners(view, this);
+    }
+
+    @Init
+    public void init() {
+        log.info("Initialized");
+        setFilterShowActive(true);
+    }
+
+    private void refresh() {
+        projectsDataModel.clearSelection();
+        selectedProject = null;
+        if (filterShowBoth) {
+            projectsDataModel.search(true, true);
+        } else {
+            projectsDataModel.search(filterShowActive, filterShowInActive);
+        }
+    }
+
+    @Command
+    @NotifyChange("selectedProject")
+    public void search() {
+    }
+
+    @Command
+    @NotifyChange("selectedProject")
+    public void onListSelection() {
+        selectedProject = null;
+        Set<Project> selections = projectsDataModel.getSelection();
+        if (selections.size() == 1) {
+            selectedProject = selections.iterator().next();
+            log.info("Selected {}", selectedProject);
+        }
+    }
+
+    @Command
+    public void onAddNew() {
+        String page = "~./project.zul";
+        Project editEntity = projectsDataModel.getProjectService().createNew();
+        Window partnerWindow = (Window) Executions.createComponents(page, null,
+                Collections.singletonMap("formDocument", editEntity));
+        partnerWindow.addEventListener("onClose", e -> {
+            if (e.getData() != null) {
+                log.info("Partner popup result {}", e.getData());
+                projectsDataModel.getProjectService().add(editEntity);
+                projectsDataModel.clearSelection();
+                refresh();
+                projectsDataModel.addToSelection(editEntity);
+//                Optional<Listitem> listItem = partnersList.getItems().stream()
+//                        .filter(li -> ((Partner) li.getValue()).getId().equals(editPartner.getId()))
+//                        .findFirst();
+//                if (listItem.isPresent()) {
+//                    Clients.scrollIntoView(listItem.get());
+//                }
+//                registerTask(() -> {
+//                });
+            }
+        });
+        partnerWindow.doModal();
+    }
+
+    @Command
+    public void onEdit() throws JsonProcessingException {
+        String page = "~./project.zul";
+        Project editEntity = projectsDataModel.getProjectService().copy(selectedProject);
+        Window partnerWindow = (Window) Executions.createComponents(page, null,
+                Collections.singletonMap("formDocument", editEntity));
+        partnerWindow.addEventListener("onClose", e -> {
+            if (e.getData() != null) {
+                log.info("Project popup result {}", e.getData());
+                Project modifiedEntity = (Project) e.getData();
+                projectsDataModel.clearSelection();
+                projectsDataModel.getProjectService().replace(selectedProject, modifiedEntity);
+                refresh();
+                projectsDataModel.addToSelection(modifiedEntity);
+                selectedProject = modifiedEntity;
+            }
+        });
+        partnerWindow.doModal();
+    }
+
+
+    public boolean isFilterShowInActive() {
+        return filterShowInActive;
+    }
+
+    @NotifyChange({"filterShowActive", "filterShowInActive", "filterShowBoth"})
+    public void setFilterShowInActive(boolean filterShowInActive) {
+        this.filterShowBoth = false;
+        this.filterShowActive = false;
+        this.filterShowInActive = filterShowInActive;
+        refresh();
+    }
+
+    public boolean isFilterShowActive() {
+        return filterShowActive;
+    }
+
+    @NotifyChange({"filterShowActive", "filterShowInActive", "filterShowBoth"})
+    public void setFilterShowActive(boolean filterShowActive) {
+        this.filterShowBoth = false;
+        this.filterShowInActive = false;
+        this.filterShowActive = filterShowActive;
+        refresh();
+    }
+
+    public boolean isFilterShowBoth() {
+        return this.filterShowBoth;
+    }
+
+    @NotifyChange({"filterShowActive", "filterShowInActive", "filterShowBoth"})
+    public void setFilterShowBoth(boolean filterShowBoth) {
+        this.filterShowActive = false;
+        this.filterShowInActive = false;
+        this.filterShowBoth = filterShowBoth;
+        refresh();
+    }
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/SupplierViewModel.java b/lis-ui/src/main/java/hu/user/lis/ui/view/SupplierViewModel.java
deleted file mode 100644 (file)
index beeb2ea..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package hu.user.lis.ui.view;
-
-import hu.user.lis.db.Supplier;
-import hu.user.lis.ui.data.SuppliersSimpleDataModel;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.extern.log4j.Log4j2;
-import org.zkoss.bind.BindContext;
-import org.zkoss.bind.BindUtils;
-import org.zkoss.bind.annotation.Command;
-import org.zkoss.bind.annotation.ContextParam;
-import org.zkoss.bind.annotation.ContextType;
-import org.zkoss.bind.annotation.NotifyChange;
-import org.zkoss.zk.ui.Executions;
-import org.zkoss.zk.ui.event.InputEvent;
-import org.zkoss.zk.ui.event.OpenEvent;
-import org.zkoss.zk.ui.select.annotation.VariableResolver;
-import org.zkoss.zk.ui.select.annotation.WireVariable;
-import org.zkoss.zul.Window;
-
-import java.util.Objects;
-
-@Log4j2
-@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
-public class SupplierViewModel {
-    @Getter
-    @Setter
-    @WireVariable
-    private SuppliersSimpleDataModel suppliersSimpleDataModel;
-    @Getter
-    private Supplier selectedSupplier;
-    @Getter
-    @Setter
-    private String selectedSupplierId;
-
-    @Command
-    public void onBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
-        InputEvent event = (InputEvent) ctx.getTriggerEvent();
-        log.info("onBandChanging: {}", event.getValue());
-        suppliersSimpleDataModel.search(event.getValue());
-    }
-
-    @Command
-    public void onBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
-        OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
-        log.info("onBandOpen: {}", event.isOpen());
-        suppliersSimpleDataModel.search(null);
-    }
-
-    @Command
-    public void onPopupSuppliers() {
-        String page = "~./suppliers.zul";
-        Window suppliersWindow = (Window) Executions.createComponents(page, null, null);
-        suppliersWindow.addEventListener("onClose", e -> {
-            log.info("Suppliers popup result {}", e.getData());
-            if (e.getData() != null) {
-                suppliersSimpleDataModel.clearSelection();
-                setSelectedSupplierId(((Supplier) e.getData()).getId());
-                BindUtils.postNotifyChange(null, null, this, "selectedSupplierId");
-            }
-        });
-
-        suppliersWindow.doModal();
-    }
-
-    @NotifyChange({"selectedSupplierId", "selectedSupplier"})
-    public void setSelectedSupplier(Supplier selectedSupplier) {
-        this.selectedSupplier = selectedSupplier;
-        if (Objects.isNull(selectedSupplier)) {
-            setSelectedSupplierId(null);
-        } else {
-            setSelectedSupplierId(selectedSupplier.getId());
-        }
-    }
-}
index 16c6aa94a69c47fdd7a26466dc34cf15b0aa033f..43385bfe664e8c2a83b54dc5c68466a847a42028 100644 (file)
@@ -1,4 +1,5 @@
 <?component name="partners" inline="true" macroURI="~./partners.zul"?>
+<?component name="projects" inline="true" macroURI="~./projects.zul"?>
 <zk>
     <window vflex="true" viewModel="@id('vm') @init('hu.user.lis.ui.view.IndexViewModel')">
         <caption>
@@ -35,7 +36,7 @@
                             <partners/>
                         </tabpanel>
                         <tabpanel id="projectsTab" fulfill="self.linkedTab.onSelect, projectsMenuItem.onClick">
-                            <window title="Projektek"></window>
+                            <projects/>
                         </tabpanel>
                     </tabpanels>
                 </tabbox>
diff --git a/lis-ui/src/main/resources/web/partner-selector.zul b/lis-ui/src/main/resources/web/partner-selector.zul
new file mode 100644 (file)
index 0000000..9a758ac
--- /dev/null
@@ -0,0 +1,52 @@
+<zk xmlns:c="client">
+    <hlayout>
+        <bandbox id="bd" autodrop="true" iconSclass="z-icon-sort-down"
+                 value="@load(vm.selectedPartner) @converter('hu.user.lis.ui.converter.PartnerToNameConverter')"
+                 onChanging="@command('onPartnerBandChanging')" onOpen="@command('onPartnerBandOpen')"
+                 forward="onOK=submit.onClick, onCancel=cancel.onClick">
+            <attribute c:name="_doKeyDown">
+                <![CDATA[
+                            function (evt) {
+                                var keyCode = evt.keyCode;
+                                console.log(keyCode);
+                                if (keyCode == 13){
+                                    zk.$("$bd").close();
+                                    zk.$("$bd").focus();
+                                    return;
+                                }
+                                if (keyCode == 40){
+                                    if (!zk.$("$bd").isOpen()) {
+                                        zk.$("$bd").open();
+                                        zAu.send(new zk.Event(zk.Widget.$('$bd'), "onOpen", {'open': true}, {toServer:true}));
+                                    }
+                                    zk.$("$bd-list").focus();
+                                    return;
+                                }
+                                if (keyCode == 27){
+                                    zk.$("$bd").close()
+                                    zk.$("$bd").focus();
+                                    return;
+                                }
+                            }
+                        ]]>
+            </attribute>
+            <bandpopup>
+                <listbox id="bd-list" height="250px" width="450px"
+                         model="@bind(vm.partnersSelectorDataModel)"
+                         selectedItem="@bind(vm.selectedPartner)"
+                         onClick="bd.close()"
+                         onDoubleClick="bd.close()">
+                    <listhead visible="false">
+                        <listheader label="name" vflex="max"/>
+                    </listhead>
+                    <template name="model">
+                        <listitem>
+                            <listcell label="@load(each.name)"/>
+                        </listitem>
+                    </template>
+                </listbox>
+            </bandpopup>
+        </bandbox>
+        <button iconSclass="z-icon-search-plus" onClick="@command('onPopupPartners')"/>
+    </hlayout>
+</zk>
\ No newline at end of file
index d70f867cf86de580a21a57a50d7dd6514cc17f2c..ba031358847483f75e8b7205f01bbd13dd868229 100644 (file)
@@ -25,7 +25,7 @@
             </north>
             <center border="none" flex="true">
                 <listbox id="partnersList" vflex="true" model="@load(vm.partnersDataModel)"
-                         autopaging="true" pagingPosition="top"
+                         autopaging="true" pagingPosition="top" multiple="false"
                          onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')"
                          onAfterRender="@command('onAfterRenderPartners')">
                     <custom-attributes org.zkoss.zul.listbox.selectOnHighlight.disabled="true"/>
diff --git a/lis-ui/src/main/resources/web/project.zul b/lis-ui/src/main/resources/web/project.zul
new file mode 100644 (file)
index 0000000..df9f54d
--- /dev/null
@@ -0,0 +1,35 @@
+<?link rel="stylesheet" type="text/css" href="~./static/css/skeleton.css" ?>
+<?link rel="stylesheet" type="text/css" href="~./static/css/webclient.css" ?>
+<?component name="partner-selector" inline="true" macroURI="~./partner-selector.zul"?>
+<zk>
+    <window id="currentPopup" title="Projekt szerkesztés" width="60%" height="40%" closable="true"
+            viewModel="@id('vm') @init('hu.user.lis.ui.view.ProjectEditorModel')">
+        <borderlayout>
+            <center border="none" vflex="true" hflex="true">
+                <vlayout hflex="true">
+                    <label value="Azonosító"/>
+                    <textbox hflex="true" instant="true" value="@bind(vm.formDocument.humanId)" readonly="true"
+                             forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
+                    <label value="Név"/>
+                    <textbox hflex="true" instant="true" value="@bind(vm.formDocument.name)"
+                             forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
+                    <label value="Kapcsolattartó"/>
+                    <textbox hflex="true" instant="true" value="@bind(vm.formDocument.contactName)"
+                             forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
+                    <label value="Partner"/>
+                    <partner-selector/>
+                    <label value="Aktív"/>
+                    <checkbox mold="switch" checked="@bind(vm.formDocument.active)"/>
+                </vlayout>
+            </center>
+            <south flex="true" style="text-align: right; padding: 10px">
+                <hlayout>
+                    <button id="cancel" label="Bezár"
+                            onClick="@command('onCloseWindow', target=currentPopup, select=false)"/>
+                    <button id="submit" label="Mentés"
+                            onClick="@command('onCloseWindow', target=currentPopup, select=true)"/>
+                </hlayout>
+            </south>
+        </borderlayout>
+    </window>
+</zk>
\ No newline at end of file
diff --git a/lis-ui/src/main/resources/web/projects.zul b/lis-ui/src/main/resources/web/projects.zul
new file mode 100644 (file)
index 0000000..b348719
--- /dev/null
@@ -0,0 +1,55 @@
+<?link rel="stylesheet" type="text/css" href="~./static/css/skeleton.css" ?>
+<?link rel="stylesheet" type="text/css" href="~./static/css/webclient.css" ?>
+<zk>
+    <style>
+        .z-listitem-selected>.z-listcell>.z-listcell-content {
+        font-weight: bold;
+        }
+    </style>
+    <window title="Projektek" vflex="true" viewModel="@id('vm') @init('hu.user.lis.ui.view.ProjectsViewModel')">
+        <borderlayout>
+            <north flex="true">
+                <toolbar>
+                    <toolbarbutton label="Új projekt" iconSclass="z-icon-plus" onClick="@command('onAddNew')"/>
+                    <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit" onClick="@command('onEdit')"
+                                   disabled="@load(empty vm.selectedProject)"/>
+                    <separator orient="vertical"/>
+                    <toolbarbutton mode="toggle" iconSclass="z-icon-check" label="Aktív"
+                                   checked="@bind(vm.filterShowActive)"/>
+                    <toolbarbutton mode="toggle" iconSclass="z-icon-ban" label="Inaktív"
+                                   checked="@bind(vm.filterShowInActive)"/>
+                    <toolbarbutton mode="toggle" iconSclass="z-icon-adjust" label="Mind"
+                                   checked="@bind(vm.filterShowBoth)"/>
+                </toolbar>
+            </north>
+            <center border="none" flex="true">
+                <listbox id="partnersList" vflex="true" model="@load(vm.projectsDataModel)"
+                         autopaging="true" pagingPosition="top"
+                         onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')">
+                    <custom-attributes org.zkoss.zul.listbox.selectOnHighlight.disabled="true"/>
+
+                    <listhead>
+                        <listheader label="Azonosító" align="left"/>
+                        <listheader label="Név" align="left"/>
+                        <listheader label="Kapcsolattartó" align="left"/>
+                        <listheader label="Partner" align="left"/>
+                        <listheader label="Aktív" align="left"/>
+                    </listhead>
+                    <template name="model">
+                        <listitem>
+                            <listcell label="@load(each.humanId)"/>
+                            <listcell label="@load(each.name)"/>
+                            <listcell label="@load(each.contactName)"/>
+                            <listcell label="@load(each.partner.name)"/>
+                            <listcell>
+                                <a iconSclass="z-icon-check" visible="@load(each.active)"/>
+                                <a iconSclass="z-icon-ban" visible="@load(!each.active)"/>
+                            </listcell>
+                        </listitem>
+                    </template>
+                </listbox>
+            </center>
+        </borderlayout>
+
+    </window>
+</zk>
\ No newline at end of file
diff --git a/lis-ui/src/main/resources/web/supplier-test.zul b/lis-ui/src/main/resources/web/supplier-test.zul
deleted file mode 100644 (file)
index 23ccfeb..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?link rel="stylesheet" type="text/css" href="~./static/css/skeleton.css" ?>
-<zk xmlns:c="client">
-    <div viewModel="@id('vm') @init('hu.user.lis.ui.view.SupplierViewModel')"
-         style="height: 100%;width: 100%; display: flex; justify-content: center;">
-        <window title="Szállító" border="true"
-                style="height: 50%; width: 50%; position: relative; position: absolute; top: 50%; transform: translate(0, -50%);">
-            <vlayout>
-                <hlayout>
-                    <bandbox id="bd" autodrop="true" iconSclass="z-icon-sort-down"
-                             value="@load(vm.selectedSupplier) @converter('hu.user.lis.ui.converter.SupplierToNameConverter')"
-                             onChanging="@command('onBandChanging')" onOpen="@command('onBandOpen')">
-                        <attribute c:name="_doKeyDown">
-                            <![CDATA[
-                            function (evt) {
-                                var keyCode = evt.keyCode;
-                                console.log(keyCode);
-                                if (keyCode == 13){
-                                    zk.$("$bd").close();
-                                    zk.$("$bd").focus();
-                                    return;
-                                }
-                                if (keyCode == 40){
-                                    if (!zk.$("$bd").isOpen()) {
-                                        zk.$("$bd").open();
-                                        zAu.send(new zk.Event(zk.Widget.$('$bd'), "onOpen", {'open': true}, {toServer:true}));
-                                    }
-                                    zk.$("$bd-list").focus();
-                                    return;
-                                }
-                                if (keyCode == 27){
-                                    zk.$("$bd").close()
-                                    zk.$("$bd").focus();
-                                    return;
-                                }
-                            }
-                        ]]>
-                        </attribute>
-                        <bandpopup>
-                            <listbox id="bd-list" height="250px" width="450px"
-                                     model="@bind(vm.suppliersSimpleDataModel)"
-                                     selectedItem="@bind(vm.selectedSupplier)"
-                                     onClick="bd.close()"
-                                     onDoubleClick="bd.close()">
-                                <listhead visible="false">
-                                    <listheader label="id" vflex="min"/>
-                                    <listheader label="name" vflex="max"/>
-                                    <listheader label="zip" vflex="min"/>
-                                </listhead>
-                                <template name="model">
-                                    <listitem>
-                                        <listcell label="@load(each.id)"/>
-                                        <listcell label="@load(each.name)"/>
-                                        <listcell label="@load(each.zipCode)"/>
-                                    </listitem>
-                                </template>
-                            </listbox>
-                        </bandpopup>
-                    </bandbox>
-                    <button iconSclass="z-icon-search-plus" onClick="@command('onPopupSuppliers')"/>
-                </hlayout>
-
-                <hlayout>
-                    <label value="Kiválasztott azonosító: "/>
-                    <label value="@load(vm.selectedSupplierId)"/>
-                </hlayout>
-            </vlayout>
-        </window>
-        <!--        <combobox sclass="ten columns" model="@bind(m.supplierListModel)" selectedItem="@bind(m.selectedSupplier)"-->
-        <!--        autodrop="true" buttonVisible="true">-->
-        <!--        </combobox>-->
-
-    </div>
-</zk>
\ No newline at end of file