Main page, partner list, partner editor
authorelgekko <vasary@elgekko.net>
Tue, 4 Apr 2023 21:05:35 +0000 (23:05 +0200)
committerelgekko <vasary@elgekko.net>
Tue, 4 Apr 2023 21:05:35 +0000 (23:05 +0200)
17 files changed:
lis-db/src/main/java/hu/user/lis/db/Partner.java [new file with mode: 0644]
lis-services/pom.xml
lis-services/src/main/java/hu/user/lis/services/data/PartnerService.java [new file with mode: 0644]
lis-services/src/main/java/hu/user/lis/services/data/PartnerServiceImpl.java [new file with mode: 0644]
lis-ui/pom.xml
lis-ui/src/main/java/hu/user/lis/ui/data/PartnersDataModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/IndexViewModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/PartnerEditorModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/PartnersViewModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/SupplierViewModel.java [moved from lis-ui/src/main/java/hu/user/lis/ui/view/Index.java with 94% similarity]
lis-ui/src/main/resources/web/fields/radiogroup.zul
lis-ui/src/main/resources/web/index.zul
lis-ui/src/main/resources/web/partner.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/partners.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/supplier-test.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/suppliers.zul
pom.xml

diff --git a/lis-db/src/main/java/hu/user/lis/db/Partner.java b/lis-db/src/main/java/hu/user/lis/db/Partner.java
new file mode 100644 (file)
index 0000000..6031731
--- /dev/null
@@ -0,0 +1,22 @@
+package hu.user.lis.db;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@Builder
+@AllArgsConstructor
+public class Partner {
+    String id;
+    String name;
+    String vatNr;
+    String address;
+    boolean active;
+
+    public static class PartnerBuilder {
+        private boolean active = true;
+    }
+}
index 25fa445cde65d5f45972cdeb8e5e611878e97b63..24159d94c9b6ce9e3d46f50e3e38475c1c8d8ed3 100644 (file)
@@ -28,7 +28,6 @@
             <groupId>hu.user</groupId>
             <artifactId>lis-db</artifactId>
             <version>0.0.1-SNAPSHOT</version>
-            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/PartnerService.java b/lis-services/src/main/java/hu/user/lis/services/data/PartnerService.java
new file mode 100644 (file)
index 0000000..5363fa3
--- /dev/null
@@ -0,0 +1,9 @@
+package hu.user.lis.services.data;
+
+import hu.user.lis.db.Partner;
+
+import java.util.List;
+
+public interface PartnerService {
+    List<Partner> getAll();
+}
diff --git a/lis-services/src/main/java/hu/user/lis/services/data/PartnerServiceImpl.java b/lis-services/src/main/java/hu/user/lis/services/data/PartnerServiceImpl.java
new file mode 100644 (file)
index 0000000..60ddcf3
--- /dev/null
@@ -0,0 +1,37 @@
+package hu.user.lis.services.data;
+
+import com.github.javafaker.Faker;
+import hu.user.lis.db.Partner;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class PartnerServiceImpl implements PartnerService {
+    private List<Partner> partners;
+
+    @Override
+    public List<Partner> getAll() {
+        if (partners == null) {
+            partners = generate();
+        }
+        return partners;
+    }
+
+    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 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().id(id).name(name).vatNr(vatNr).address(address).build();
+            result.add(partner);
+        }
+        return result;
+    }
+}
index fc8a7517a10581ca2d584ed5d258c985deadbbfd..b461fcbcbbc76b2aa6a4399e296ce458fc0b1f41 100644 (file)
@@ -50,7 +50,6 @@
             <artifactId>spring-beans</artifactId>
             <version>5.2.0.RELEASE</version>
         </dependency>
-        <!-- https://www.zkoss.org/wiki/ZK_Installation_Guide/Maven_Setup#ZK_EE -->
         <dependency>
             <groupId>org.zkoss.zkspringboot</groupId>
             <artifactId>zkspringboot-starter</artifactId>
             <artifactId>lis-services</artifactId>
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
-        <dependency>
-            <groupId>hu.user</groupId>
-            <artifactId>lis-services</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-            <scope>compile</scope>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-devtools</artifactId>
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/data/PartnersDataModel.java b/lis-ui/src/main/java/hu/user/lis/ui/data/PartnersDataModel.java
new file mode 100644 (file)
index 0000000..6de36e1
--- /dev/null
@@ -0,0 +1,103 @@
+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.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 PartnersDataModel extends CachedDataModel<Partner> {
+    private String partialName;
+    private String partialAddress;
+    private String partialVatNr;
+    private boolean listAll;
+    @Autowired
+    PartnerService partnerService;
+
+
+    private boolean canExecuteSearch() {
+        boolean result = listAll ||
+                StringUtils.isNotBlank(partialName) ||
+                StringUtils.isNotBlank(partialVatNr) ||
+                StringUtils.isNotBlank(partialAddress);
+        log.info("Can execute search: {}", result);
+        return result;
+    }
+
+    private boolean filter(Partner partner) {
+        if (listAll) {
+            return true;
+        }
+
+        boolean result = true;
+        if (StringUtils.isNotBlank(partialName)) {
+            if (!partner.getName().toLowerCase().startsWith(partialName.toLowerCase())) {
+                result = false;
+            }
+        }
+        if (StringUtils.isNotBlank(partialVatNr)) {
+            if (!partner.getVatNr().toLowerCase().startsWith(partialVatNr.toLowerCase())) {
+                result = false;
+            }
+        }
+        if (StringUtils.isNotBlank(partialAddress)) {
+            if (!partner.getAddress().toLowerCase().startsWith(partialAddress.toLowerCase())) {
+                result = false;
+            }
+        }
+        return result;
+    }
+
+    @Override
+    protected List<Partner> getResultSet(long offset, int limit, FieldComparator sortComparator) {
+        List<Partner> result = null;
+        if (canExecuteSearch()) {
+            result = partnerService.getAll().stream()
+                    .sorted(Comparator.comparing(Partner::getName))
+                    .filter(s -> filter(s))
+                    .collect(Collectors.toList());
+        }
+        return result;
+    }
+
+    @Override
+    public int getResultSetCount() {
+        int result = 0;
+        if (canExecuteSearch()) {
+            result = (int) partnerService.getAll().stream()
+                    .filter(s -> filter(s))
+                    .count();
+        }
+        return result;
+    }
+
+    public void search(String partialName, String partialVatNr, String partialAddress) {
+        log.info("Searching partner using filters: name LIKE {}, VAT number LIKE {}, Address LIKE {}",
+                partialName, partialVatNr, partialAddress);
+        listAll = false;
+        this.partialName = partialName;
+        this.partialVatNr = partialVatNr;
+        this.partialAddress = partialAddress;
+        super.reset();
+        BindUtils.postNotifyChange(null, null, this, "*");
+    }
+
+    public void listAll() {
+        log.info("List all partners");
+        listAll = true;
+        super.reset();
+        BindUtils.postNotifyChange(null, null, this, "*");
+    }
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/IndexViewModel.java b/lis-ui/src/main/java/hu/user/lis/ui/view/IndexViewModel.java
new file mode 100644 (file)
index 0000000..e252c7d
--- /dev/null
@@ -0,0 +1,32 @@
+package hu.user.lis.ui.view;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.boot.info.BuildProperties;
+import org.zkoss.bind.annotation.Command;
+import org.zkoss.bind.annotation.Init;
+import org.zkoss.zk.ui.select.annotation.VariableResolver;
+import org.zkoss.zk.ui.select.annotation.WireVariable;
+
+@Log4j2
+@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
+public class IndexViewModel {
+    @Getter
+    @WireVariable
+    BuildProperties buildProperties;
+
+    @Getter
+    @Setter
+    String searchPhrase;
+
+    @Init
+    public void init() {
+        log.info("Init");
+    }
+
+    @Command
+    public void search() {
+
+    }
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/PartnerEditorModel.java b/lis-ui/src/main/java/hu/user/lis/ui/view/PartnerEditorModel.java
new file mode 100644 (file)
index 0000000..20cb7db
--- /dev/null
@@ -0,0 +1,51 @@
+package hu.user.lis.ui.view;
+
+import hu.user.lis.db.Partner;
+import hu.user.lis.ui.data.FormDocument;
+import hu.user.lis.ui.form.FormValidator;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.zkoss.bind.annotation.BindingParam;
+import org.zkoss.bind.annotation.Command;
+import org.zkoss.bind.annotation.Init;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.Events;
+import org.zkoss.zk.ui.select.annotation.VariableResolver;
+import org.zkoss.zkplus.spring.DelegatingVariableResolver;
+import org.zkoss.zul.Window;
+
+@Log4j2
+@Getter
+@Setter
+@VariableResolver(DelegatingVariableResolver.class)
+public class PartnerEditorModel {
+    private FormDocument formDocument;
+    private boolean canEdit;
+    private Partner selectedPartner;
+    @Autowired
+    FormValidator formValidator;
+
+    @Init
+    public void init() {
+        log.info("Initialized");
+        //TODO atnevezni, mert forditva mukodik
+        setCanEdit(true);
+    }
+
+    public String getFieldStyle(String field, String baseStyle) {
+//             Object error = getFormDocument().get(field + FIELD_POSTFIX_ERROR);
+//             if (error != null && (boolean) error)
+//                     return baseStyle + " " + ERROR;
+//             else
+//                     return baseStyle;
+        return baseStyle;
+    }
+
+    @Command
+    public void onCloseWindow(@BindingParam("target") Window target, @BindingParam("select") boolean select) {
+        Event closeEvent = new Event("onClose", target, select ? selectedPartner : null);
+        Events.postEvent(closeEvent);
+    }
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/PartnersViewModel.java b/lis-ui/src/main/java/hu/user/lis/ui/view/PartnersViewModel.java
new file mode 100644 (file)
index 0000000..a88aad7
--- /dev/null
@@ -0,0 +1,82 @@
+package hu.user.lis.ui.view;
+
+import hu.user.lis.db.Partner;
+import hu.user.lis.ui.data.FormDocument;
+import hu.user.lis.ui.data.PartnersDataModel;
+import hu.user.lis.ui.form.FormValidator;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+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.VariableResolver;
+import org.zkoss.zk.ui.select.annotation.WireVariable;
+import org.zkoss.zkplus.spring.DelegatingVariableResolver;
+
+import java.util.Set;
+
+@Log4j2
+@Getter
+@Setter
+@VariableResolver(DelegatingVariableResolver.class)
+public class PartnersViewModel {
+    private FormDocument formDocument;
+    private boolean canEdit;
+    private String partialName;
+    private String partialVatNr;
+    private String partialAddress;
+    private Partner selectedPartner;
+    @WireVariable
+    PartnersDataModel partnersDataModel;
+    @Autowired
+    FormValidator formValidator;
+
+    @Init
+    public void init() {
+        log.info("Initialized");
+        //TODO atnevezni, mert forditva mukodik
+        setCanEdit(true);
+        partnersDataModel.listAll();
+    }
+
+    public String getFieldStyle(String field, String baseStyle) {
+//             Object error = getFormDocument().get(field + FIELD_POSTFIX_ERROR);
+//             if (error != null && (boolean) error)
+//                     return baseStyle + " " + ERROR;
+//             else
+//                     return baseStyle;
+        return baseStyle;
+    }
+
+    @Command
+    @NotifyChange("formDocument")
+    public void search() {
+        partnersDataModel.clearSelection();
+        formDocument = null;
+        partnersDataModel.search(partialName, partialVatNr, partialAddress);
+    }
+
+    @Command
+    @NotifyChange("formDocument")
+    public void onListSelection() {
+        formDocument = null;
+        selectedPartner = null;
+        Set<Partner> selections = partnersDataModel.getSelection();
+        if (selections.iterator().hasNext()) {
+            selectedPartner = selections.iterator().next();
+            formDocument = FormDocument.builder().build()
+                    .setData(selectedPartner);
+            log.info("Selected {}", formDocument);
+        }
+    }
+
+    @Command
+    public void onAddNew() {
+    }
+
+    @Command
+    public void onEdit() {
+    }
+}
similarity index 94%
rename from lis-ui/src/main/java/hu/user/lis/ui/view/Index.java
rename to lis-ui/src/main/java/hu/user/lis/ui/view/SupplierViewModel.java
index 2f9e99f807288df5e7c0787d7036c78f2ec0f955..beeb2ea36c40e9cdebc7d7c9ebdf1d8cbe6fb64b 100644 (file)
@@ -5,7 +5,6 @@ import hu.user.lis.ui.data.SuppliersSimpleDataModel;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.extern.log4j.Log4j2;
-import org.springframework.boot.info.BuildProperties;
 import org.zkoss.bind.BindContext;
 import org.zkoss.bind.BindUtils;
 import org.zkoss.bind.annotation.Command;
@@ -23,7 +22,7 @@ import java.util.Objects;
 
 @Log4j2
 @VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
-public class Index {
+public class SupplierViewModel {
     @Getter
     @Setter
     @WireVariable
@@ -33,9 +32,6 @@ public class Index {
     @Getter
     @Setter
     private String selectedSupplierId;
-    @Getter
-    @WireVariable
-    BuildProperties buildProperties;
 
     @Command
     public void onBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
index c69a74324bf031a5e9e7e5f9b7c20dc728dad53f..d145f8bbc65d1f222c81f0671ce90764781b5bfa 100644 (file)
@@ -1,13 +1,14 @@
 <div class="field">
-       <div class="row field-top">
-               <include src="/fields/field-label.zul" />
-       </div>  
-       <div class="row field-textbox field-top">
-               <radio label="${each}" forEach="${arg.values}" value="'${forEachStatus.index + 1}'" 
-                       checked="@bind(vm.formDocument[field]) @converter('hu.bitcity.converter.RadioCheckConverter')" 
-                       onCheck="@command('onRadioCheck', target=self) @global-command('autosave', source=self)"
-                       disabled="@load(vm.formDocument['ro'] || ro)" />
-               <textbox class="inline-textbox" value="@load(vm.formDocument[dataField]) @save(vm.formDocument[dataField], before='submit') @validator(vm.formValidator, parameters=validatorargs)" 
-                       disabled="@load(vm.formDocument['ro'] || ro)" onChange="@command('submit')" />
-       </div>  
+    <div class="row field-top">
+        <include src="/fields/field-label.zul"/>
+    </div>
+    <div class="row field-textbox field-top">
+        <radio label="${each}" forEach="${arg.values}" value="'${forEachStatus.index + 1}'"
+               checked="@bind(vm.formDocument[field]) @converter('hu.user.lis.ui.converter.RadioCheckConverter')"
+               onCheck="@command('onRadioCheck', target=self) @global-command('autosave', source=self)"
+               disabled="@load(vm.formDocument['ro'] || ro)"/>
+        <textbox class="inline-textbox"
+                 value="@load(vm.formDocument[dataField]) @save(vm.formDocument[dataField], before='submit') @validator(vm.formValidator, parameters=validatorargs)"
+                 disabled="@load(vm.formDocument['ro'] || ro)" onChange="@command('submit')"/>
+    </div>
 </div>
index d0a273fc626a99a7fe13cd5032fbc405bea41d3e..ec483d217859780bc393b9495241eddea6db5b0d 100644 (file)
@@ -1,73 +1,45 @@
-<?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.Index')"
-         style="height: 100%;width: 100%; display: flex; justify-content: center;">
-        <window title="@load(vm.buildProperties.version)" 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')"/>
+<?component name="partners" inline="true" macroURI="~./partners.zul"?>
+<zk>
+    <window vflex="true" viewModel="@id('vm') @init('hu.user.lis.ui.view.IndexViewModel')">
+        <caption>
+            <hlayout hflex="max">
+                <label value="LEADER INFORMATION SYSTEM"/>
+                <separator/>
+                <label value="@load(vm.buildProperties.version)"/>
+                <!--                <button iconSclass="z-icon-user"/>-->
+            </hlayout>
+        </caption>
+        <borderlayout>
+            <north border="none" hflex="true">
+                <hlayout valign="middle">
+                    <menubar autodrop="true" hflex="true">
+                        <menuitem id="partnersMenuItem" iconSclass="z-icon-group" label="Partnerek"
+                                  onClick="mainContent.setSelectedIndex(0)"/>
+                        <menuitem id="projectsMenuItem" iconSclass="z-icon-tasks" label="Projektek"
+                                  onClick="mainContent.setSelectedIndex(1)"/>
+                    </menubar>
+                    <hbox hflex="min" pack="right">
+                        <textbox value="@bind(vm.searchPhrase)" onOK="@command('search')"></textbox>
+                        <button iconSclass="z-icon-search"/>
+                    </hbox>
                 </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
+            </north>
+            <center border="none" hflex="true">
+                <tabbox id="mainContent" vflex="true" hflex="true" orient="top">
+                    <tabs visible="false">
+                        <tab id="tab0" label="Partnerek" selected="true"/>
+                        <tab id="tab1" label="Projektek"/>
+                    </tabs>
+                    <tabpanels>
+                        <tabpanel id="partnersTab">
+                            <partners/>
+                        </tabpanel>
+                        <tabpanel id="projectsTab" fulfill="self.linkedTab.onSelect, projectsMenuItem.onClick">
+                            <window title="Projektek"></window>
+                        </tabpanel>
+                    </tabpanels>
+                </tabbox>
+            </center>
+        </borderlayout>
+    </window>
+</zk>
diff --git a/lis-ui/src/main/resources/web/partner.zul b/lis-ui/src/main/resources/web/partner.zul
new file mode 100644 (file)
index 0000000..1bb9693
--- /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="text" class="hu.user.lis.ui.form.Field$Text" ?>
+<zk>
+    <window id="partnerPopup" title="Partner szerkesztés" width="60%" height="40%" closable="true"
+            viewModel="@id('vm') @init('hu.user.lis.ui.view.PartnerEditorModel')">
+        <borderlayout>
+            <center border="none" vflex="true">
+                <div class="container u-form-width u-max-form-width">
+                    <div class="row">
+                        <text class="twelve columns" label="Név" field="name"/>
+                    </div>
+                    <div class="row">
+                        <text class="twelve columns" label="Adószám" field="vatNr"/>
+                    </div>
+                    <div class="row">
+                        <text class="twelve columns" label="Cím" field="address"/>
+                    </div>
+                    <div class="row">
+                        <radiogroup model="@bind(vm.active)">
+                            <radio label="Aktív" value="true"/>
+                            <radio label="Inaktív" value="false"/>
+                        </radiogroup>
+                    </div>
+                </div>
+            </center>
+            <south flex="true" style="text-align: right; padding: 10px">
+                <hlayout>
+                    <button label="Bezár" onClick="@command('onCloseWindow', target=partnerPopup, select=false)"/>
+                    <button label="Mentés" onClick="@command('onCloseWindow', target=partnerPopup, select=true)"/>
+                </hlayout>
+            </south>
+        </borderlayout>
+    </window>
+</zk>
\ No newline at end of file
diff --git a/lis-ui/src/main/resources/web/partners.zul b/lis-ui/src/main/resources/web/partners.zul
new file mode 100644 (file)
index 0000000..aaa67fa
--- /dev/null
@@ -0,0 +1,45 @@
+<?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="Partnerek" vflex="true" viewModel="@id('vm') @init('hu.user.lis.ui.view.PartnersViewModel')">
+
+        <borderlayout>
+            <north flex="true">
+                <toolbar>
+                    <toolbarbutton label="Új partner" iconSclass="z-icon-plus" onClick="@command('onAddNew')"/>
+                    <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit" onClick="@command('onEdit')"
+                                   disabled="@load(empty vm.formDocument)"/>
+                </toolbar>
+            </north>
+            <center border="none" flex="true">
+                <listbox id="partnersList" vflex="true" model="@load(vm.partnersDataModel)" mold="paging"
+                         autopaging="true"
+                         pagingPosition="top" onSelect="@command('onListSelection')">
+                    <listhead>
+                        <listheader label="Név" align="left"/>
+                        <listheader label="Adószám" align="left"/>
+                        <listheader label="Cím" align="left"/>
+                        <listheader label="Aktív" align="left"/>
+                    </listhead>
+                    <template name="model">
+                        <listitem>
+                            <listcell label="@load(each.name)"/>
+                            <listcell label="@load(each.vatNr)"/>
+                            <listcell label="@load(each.address)"/>
+                            <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
new file mode 100644 (file)
index 0000000..23ccfeb
--- /dev/null
@@ -0,0 +1,73 @@
+<?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
index b01836e47aae20ec42ed972ea8468afa7ddcd4a3..78d74ea844d31356a153b3b19c03abc734cc32ee 100644 (file)
@@ -53,7 +53,7 @@
                     </listfoot>
                     <template name="model">
                         <listitem>
-                            <listcell label="@load(empty each.name ? each.template : each.name)"/>
+                            <listcell label="@load(each.name)"/>
                         </listitem>
                     </template>
                 </listbox>
@@ -74,8 +74,9 @@
             <south flex="true" style="text-align: right; padding: 10px">
                 <hlayout>
                     <button label="Bezár" onClick="@command('onCloseWindow', target=supplierPopup, select=false)"
+                    />
+                    <button label="Kiválaszt" onClick="@command('onCloseWindow', target=supplierPopup, select=true)"
                             disabled="@load(vm.selectedSupplier)"/>
-                    <button label="Kiválaszt" onClick="@command('onCloseWindow', target=supplierPopup, select=true)"/>
                 </hlayout>
             </south>
         </borderlayout>
diff --git a/pom.xml b/pom.xml
index 5134574ff845648a1b82c4bae6e5bbc9edb1d9ef..5c55112afe94637d0f1d6125a98c3913e50019c7 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,6 @@
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
         <version>2.2.4.RELEASE</version>
-        <!-- lookup parent from repository -->
         <relativePath/>
     </parent>
     <repositories>
             <version>2.19.0</version>
         </dependency>
         <!--        <dependency>-->
-        <!--            <groupId>org.springframework</groupId>-->
-        <!--            <artifactId>spring-context</artifactId>-->
-        <!--        </dependency>-->
-        <!--        <dependency>-->
         <!--            <groupId>org.springframework.boot</groupId>-->
         <!--            <artifactId>spring-boot-devtools</artifactId>-->
         <!--            <optional>true</optional>-->
         <!--        </dependency>-->
-
     </dependencies>
 </project>