Invoice view functions
authorVásáry Dániel <vasary@elgekko.net>
Mon, 27 Nov 2023 20:58:55 +0000 (21:58 +0100)
committerVásáry Dániel <vasary@elgekko.net>
Mon, 27 Nov 2023 20:58:55 +0000 (21:58 +0100)
23 files changed:
lis-ui/src/main/java/hu/user/lis/ui/Constants.java
lis-ui/src/main/java/hu/user/lis/ui/editor/ProjectAttachEditorModel.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/editor/common/Editors.java
lis-ui/src/main/java/hu/user/lis/ui/editor/common/EntityEditorModel.java
lis-ui/src/main/java/hu/user/lis/ui/event/EventBus.java
lis-ui/src/main/java/hu/user/lis/ui/event/InvoicePaymentData.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/event/ProjectEditorData.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/ApproveInvoicesViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/AssignInvoicesViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/AssociatesViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/ImportInvoicesSuspendedViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/IndexViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/InvoicePaymentViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/InvoicesViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/PartnersViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/ProjectsViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/ServiceRecordsViewModel.java
lis-ui/src/main/java/hu/user/lis/ui/view/SpecialRoute.java [new file with mode: 0644]
lis-ui/src/main/java/hu/user/lis/ui/view/UIEventHandler.java [new file with mode: 0644]
lis-ui/src/main/resources/web/editor/project-attach.zul [new file with mode: 0644]
lis-ui/src/main/resources/web/invoices.zul
lis-ui/src/main/resources/web/projects.zul
logs/archived/sly-crm-app-2023-11-25.0.log [new file with mode: 0644]

index 5587187b1d73e19cf3c880bbbb271c7c0280330f..9f7c54a0929d8ec958e9aafc6c3b0443dd3dd707 100644 (file)
@@ -9,10 +9,12 @@ public class Constants {
     public static final String PROJECT_EDITOR_QUEUE = "PROJECT_EDITOR_QUEUE";
     public static final String PROCESS_EVENT_QUEUE = "PROJECT_EDITOR_QUEUE";
     public static final String SHOW_PROJECT_EDITOR = "SHOW_PROJECT_EDITOR";
+    public static final String SHOW_INVOICE_PAYMENT = "SHOW_INVOICE_PAYMENT";
     public static final String SHOW_PROJECTS_LIST = "SHOW_PROJECTS_LIST";
     public static final String SHOW_SERVICE_RECORDS_LIST = "SHOW_SERVICE_RECORDS_LIST";
     public static final String SET_SERVICE_RECORDS_LIST_DATA = "SET_SERVICE_RECORDS_LIST_DATA";
     public static final String SET_PROJECT_EDITOR_DATA = "SET_PROJECT_EDITOR_DATA";
+    public static final String SET_INVOICE_PAYMENT_DATA = "SET_INVOICE_PAYMENT_DATA";
     public static final String SET_PROJECTS_LIST_DATA = "SET_PROJECTS_LIST_DATA";
     public static final String REFRESH_INVOICE_IMPORT_TASKS = "REFRESH_INVOICE_IMPORT_TASKS";
     public static final String NAV_PARTNERS = "/partners";
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/editor/ProjectAttachEditorModel.java b/lis-ui/src/main/java/hu/user/lis/ui/editor/ProjectAttachEditorModel.java
new file mode 100644 (file)
index 0000000..a6286fc
--- /dev/null
@@ -0,0 +1,41 @@
+package hu.user.lis.ui.editor;
+
+import hu.user.lis.ui.view.ProjectsViewModel;
+import lombok.Getter;
+import lombok.extern.log4j.Log4j2;
+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.zul.Window;
+
+import java.util.Objects;
+
+
+@Getter
+@Log4j2
+public class ProjectAttachEditorModel extends ProjectsViewModel {
+
+    @Init
+    @Override
+    public void init() {
+        super.init();
+    }
+
+    @Override
+    protected String getNavigation() {
+        return null;
+    }
+
+    @Command
+    public void onCloseWindow(@BindingParam("target") Window target, @BindingParam("save") boolean save) {
+        if (save) {
+            if (Objects.nonNull(getSelectedEntity())) {
+                Events.postEvent(new Event("onClose", target, getSelectedEntity()));
+            }
+        } else {
+            Events.postEvent(new Event("onClose", target, null));
+        }
+    }
+}
index 0803e22f770cd1a0976fbc7af7a46aa195d834f6..f904d580ef261733586f0895acddb0f7013a4e99 100644 (file)
@@ -14,9 +14,11 @@ public class Editors {
     public static final String TREASURY = "~./editor/treasury-editor.zul";
     public static final String ASSOCIATE = "~./editor/associate-editor.zul";
     public static final String PARTNER = "~./editor/partner-editor.zul";
+    public static final String PROJECT_ATTACH = "~./editor/project-attach.zul";
     public static final String IMPORT_INVOICE_ASSIGN = "~./editor/import-invoice-assign-editor.zul";
     public static final String IMPORT_INVOICE_APPROVE = "~./editor/import-invoice-approve-editor.zul";
     public static final String PROJECT = "~./editor/project-editor.zul";
+    public static final String INVOICE_PAYMENT = "~./invoice-payment.zul";
     public static final String POPUP_EDITOR = "~./editor/popup-editor.zul";
 
     public static <E> void doEdit(String page, E entity, EditCompleted<E> editCompleted) {
index ed8b6662ab37ccaa38e823cc95a492fcec78c4b4..417fc2ca98f671b4abe81d48c4eb745609268d5b 100644 (file)
@@ -80,7 +80,7 @@ public abstract class EntityEditorModel<T extends Serializable> extends Abstract
         eventBus.registerForBinding(this);
         origDocument = (T) Executions.getCurrent().getArg().get("origDocument");
         formDocument = (T) Executions.getCurrent().getArg().get("formDocument");
-        if (Objects.nonNull(getFormValidator())) {
+        if (Objects.nonNull(getFormValidator()) && Objects.nonNull(getFormDocument())) {
             getFormValidator().validate(getFormDocument());
         }
     }
index 055c38164e99fadbb8961fd7182884d63567262b..5408ffb1a045de9ec240d856efc5c7b748d83279 100644 (file)
@@ -70,6 +70,10 @@ public class EventBus {
         getQueue().publish(new Event(Constants.SHOW_PROJECT_EDITOR, null, data));
     }
 
+    public void showInvoicePayment(Object data) {
+        getQueue().publish(new Event(Constants.SHOW_INVOICE_PAYMENT, null, data));
+    }
+
     public void showServiceRecordsList(Object data) {
         getQueue().publish(new Event(Constants.SHOW_SERVICE_RECORDS_LIST, null, data));
     }
@@ -78,8 +82,12 @@ public class EventBus {
         getQueue().publish(new Event(Constants.SET_SERVICE_RECORDS_LIST_DATA, null, data));
     }
 
-    public void setProjectEditorData(Long data) {
-        getQueue().publish(new Event(Constants.SET_PROJECT_EDITOR_DATA, null, data));
+    public void setProjectEditorData(Long id) {
+        getQueue().publish(new Event(Constants.SET_PROJECT_EDITOR_DATA, null, id));
+    }
+
+    public void setInvoicePaymentData(Long data) {
+        getQueue().publish(InvoicePaymentData.builder().id(data).build());
     }
 
     public void setProjectsListData(Object data) {
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/event/InvoicePaymentData.java b/lis-ui/src/main/java/hu/user/lis/ui/event/InvoicePaymentData.java
new file mode 100644 (file)
index 0000000..8ab058c
--- /dev/null
@@ -0,0 +1,20 @@
+package hu.user.lis.ui.event;
+
+import lombok.Builder;
+import lombok.Getter;
+import lombok.Setter;
+import org.zkoss.zk.ui.event.Event;
+
+import static hu.user.lis.ui.Constants.SET_INVOICE_PAYMENT_DATA;
+
+@Getter
+@Setter
+@Builder
+public class InvoicePaymentData extends Event {
+    private final Long id;
+
+    public InvoicePaymentData(Long id) {
+        super(SET_INVOICE_PAYMENT_DATA);
+        this.id = id;
+    }
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/event/ProjectEditorData.java b/lis-ui/src/main/java/hu/user/lis/ui/event/ProjectEditorData.java
new file mode 100644 (file)
index 0000000..261dc0a
--- /dev/null
@@ -0,0 +1,20 @@
+package hu.user.lis.ui.event;
+
+import lombok.Builder;
+import lombok.Getter;
+import lombok.Setter;
+import org.zkoss.zk.ui.event.Event;
+
+import static hu.user.lis.ui.Constants.SET_PROJECT_EDITOR_DATA;
+
+@Getter
+@Setter
+@Builder
+public class ProjectEditorData extends Event {
+    private final Long id;
+
+    public ProjectEditorData(Long id) {
+        super(SET_PROJECT_EDITOR_DATA);
+        this.id = id;
+    }
+}
index ebe3e196a168336987448efc47d6d40ee979053c..d70eb806f6867777abb508b0b2b6e13342dae284 100644 (file)
@@ -72,6 +72,7 @@ public class ApproveInvoicesViewModel extends EntityViewModel<JSONObject> implem
     @Command
     @NotifyChange("approveInvoicesDataModel")
     public void onRefresh() {
+        approveInvoicesDataModel.clearSelection();
         setSelectedEntity(null);
         approveInvoicesDataModel.refresh();
         BindUtils.postNotifyChange(this, "selectedEntity");
index ec73c91ea674e47795a989a239739c90e4ac1684..73aab0bd51bc899c521d791be139887a5c653fa4 100644 (file)
@@ -71,6 +71,7 @@ public class AssignInvoicesViewModel extends EntityViewModel<JSONObject> impleme
 
     @Command
     public void onRefresh() {
+        assignInvoicesDataModel.clearSelection();
         setSelectedEntity(null);
         assignInvoicesDataModel.refresh();
         BindUtils.postNotifyChange(this, "selectedEntity");
index 240fef7aea1fc78c9e533acefd0372fb9bb4a1db..8163e596cbee0421f4b6d98ca85030a8370617a3 100644 (file)
@@ -9,6 +9,7 @@ import hu.user.lis.ui.editor.common.Editors;
 import hu.user.lis.ui.view.common.FilterActiveViewModel;
 import lombok.Getter;
 import lombok.extern.log4j.Log4j2;
+import org.zkoss.bind.BindUtils;
 import org.zkoss.bind.annotation.Command;
 import org.zkoss.bind.annotation.Init;
 import org.zkoss.zk.ui.select.annotation.WireVariable;
@@ -53,6 +54,7 @@ public class AssociatesViewModel extends FilterActiveViewModel<Associate> {
         } else {
             associatesDataModel.search(isFilterShowActive(), isFilterShowInActive());
         }
+        BindUtils.postNotifyChange(this, "selectedEntity");
     }
 
     @Command
index 942f64aa352c6488307fa94a0c90e6d39bed47df..4c76dbd41d76d510caa30156f0962c596003f65f 100644 (file)
@@ -16,6 +16,7 @@ import hu.user.lis.ui.view.common.EntityViewModel;
 import hu.user.lis.workflow.invoice.service.WorkflowManagerService;
 import lombok.Getter;
 import lombok.extern.log4j.Log4j2;
+import org.zkoss.bind.BindUtils;
 import org.zkoss.bind.PropertyChangeEvent;
 import org.zkoss.bind.annotation.*;
 import org.zkoss.zk.ui.Component;
@@ -101,7 +102,9 @@ public class ImportInvoicesSuspendedViewModel extends EntityViewModel<Invoice> i
     @Command
     public void refresh() {
         invoicesDataModel.clearSelection();
+        setSelectedEntity(null);
         invoicesDataModel.search(invoiceFilter);
+        BindUtils.postNotifyChange(this, "selectedEntity");
     }
 
     @Command
index 2227fc506569faf2b1fe46766088b06e82c5e001..245a89f1bfda1d17712f777238636edcb4015096 100644 (file)
@@ -1,5 +1,6 @@
 package hu.user.lis.ui.view;
 
+import com.google.common.collect.ImmutableMap;
 import hu.user.lis.ui.Constants;
 import hu.user.lis.ui.auth.CurrentProfile;
 import hu.user.lis.ui.editor.common.Editors;
@@ -58,32 +59,32 @@ public class IndexViewModel implements EventListener<Event> {
 
     @WireVariable
     private EventBus eventBus;
-
     @WireVariable
     private BuildProperties buildProperties;
-
     @WireVariable
     private SessionSettings sessionSettings;
-
     @WireVariable
     private CurrentProfile currentProfile;
-
     @WireVariable
     private WorkflowManagerService workflowManagerService;
-
     private String searchPhrase;
-
     private String page;
-
+    private final Map<String, SpecialRoute> specialRoutes = ImmutableMap.of(
+            Constants.NAV_PROJECTS, this::showProjectEditor,
+            Constants.NAV_INVOICE_PAYMENT, this::showInvoicePayment
+    );
     private String importInvoiceMenuClassName;
-
     private String assignInvoiceMenuClassName;
-
     private String approveInvoiceMenuClassName;
-
     private String assignInvoicesLabel;
-
     private String approveInvoicesLabel;
+    private final Map<String, UIEventHandler> eventHandlers = ImmutableMap.of(
+            Constants.REFRESH_INVOICE_IMPORT_TASKS, this::updateImportInvoiceMenus,
+            Constants.SHOW_SERVICE_RECORDS_LIST, this::showServiceRecords,
+            Constants.SHOW_PROJECT_EDITOR, this::showProjectEditor,
+            Constants.SHOW_INVOICE_PAYMENT, this::showInvoicePayment,
+            Constants.SHOW_PROJECTS_LIST, this::showProjects
+    );
 
     @Init
     public void init() {
@@ -92,21 +93,31 @@ public class IndexViewModel implements EventListener<Event> {
         String path = sessionSettings.getCurrentPath();
         log.info("2. Current session is {} path {}", sessionSettings.getSessionId(), path);
         route(path);
-        updateImportInvoiceMenus();
+        updateImportInvoiceMenus(null);
     }
 
     private void route(String path) {
-        if (path.startsWith(Constants.NAV_PROJECTS + "/") && path.split("/").length > 2) {
-            String id = path.split("/")[2];
-            selectPage(Editors.PROJECT);
-            eventBus.setProjectEditorData(Long.parseLong(id));
+        if (Constants.NAV_ROOT.equals(path))
+            path = Constants.NAV_PARTNERS;
+
+        String[] pathTokens = path.split("/");
+        if (pathTokens.length > 2) {
+            Long id = Long.parseLong(pathTokens[2]);
+            specialRoutes.get(path).route(id);
         } else {
-            if (Constants.NAV_ROOT.equals(path))
-                path = Constants.NAV_PARTNERS;
             setPage("~." + path + ".zul");
         }
     }
 
+    public void showProjectEditor(Long id) {
+        selectPage(Editors.PROJECT);
+        eventBus.setProjectEditorData(id);
+    }
+
+    public void showInvoicePayment(Long id) {
+        selectPage(Editors.INVOICE_PAYMENT);
+        eventBus.setInvoicePaymentData(id);
+    }
 
     @Command
     public void selectPage(@BindingParam("page") String page) {
@@ -116,26 +127,33 @@ public class IndexViewModel implements EventListener<Event> {
 
     @Override
     public void onEvent(Event event) {
-        if (Constants.SHOW_SERVICE_RECORDS_LIST.equals(event.getName())) {
-            selectPage(SERVICE_RECORDS_LIST);
-            eventBus.setServiceRecordsListData(event.getData());
-        }
-        if (Constants.SHOW_PROJECT_EDITOR.equals(event.getName())) {
-            selectPage(Editors.PROJECT);
-            eventBus.setProjectEditorData((Long) event.getData());
-        }
-        if (Constants.SHOW_PROJECTS_LIST.equals(event.getName())) {
-            selectPage(PROJECTS_LIST);
-            if (event.getData() != null) {
-                eventBus.setProjectsListData(event.getData());
-            }
+        if (eventHandlers.containsKey(event.getName())) {
+            eventHandlers.get(event.getName()).handle(event);
         }
-        if (Constants.REFRESH_INVOICE_IMPORT_TASKS.equals(event.getName())) {
-            updateImportInvoiceMenus();
+    }
+
+    private void showServiceRecords(Event event) {
+        selectPage(SERVICE_RECORDS_LIST);
+        eventBus.setServiceRecordsListData(event.getData());
+    }
+
+    private void showProjectEditor(Event event) {
+        showProjectEditor((Long) event.getData());
+    }
+
+    private void showInvoicePayment(Event event) {
+        selectPage(Editors.INVOICE_PAYMENT);
+        eventBus.setInvoicePaymentData((Long) event.getData());
+    }
+
+    private void showProjects(Event event) {
+        selectPage(PROJECTS_LIST);
+        if (event.getData() != null) {
+            eventBus.setProjectsListData(event.getData());
         }
     }
 
-    private void updateImportInvoiceMenus() {
+    private void updateImportInvoiceMenus(Event event) {
         long assignInvoiceTaskCount = workflowManagerService.countAssignInvoiceTasks();
         long approveInvoiceTaskCount = workflowManagerService.countApproveInvoiceTasks();
         if (assignInvoiceTaskCount > 0) {
@@ -196,5 +214,4 @@ public class IndexViewModel implements EventListener<Event> {
         });
 
     }
-
 }
index fb882dd22ee4a3b7eaf48d5fb2847e16357725c0..be29ec0dcd2e5256e56952fc69d593ecaae668d4 100644 (file)
@@ -10,6 +10,7 @@ import hu.user.lis.ui.data.PaymentsDataModel;
 import hu.user.lis.ui.data.common.CachedSpringDataModel;
 import hu.user.lis.ui.editor.selector.EntitySelectorRouter;
 import hu.user.lis.ui.event.EventBus;
+import hu.user.lis.ui.event.InvoicePaymentData;
 import hu.user.lis.ui.view.common.EntityViewModel;
 import lombok.Getter;
 import lombok.Setter;
@@ -19,6 +20,8 @@ import org.zkoss.bind.annotation.BindingParam;
 import org.zkoss.bind.annotation.Command;
 import org.zkoss.bind.annotation.Init;
 import org.zkoss.bind.annotation.NotifyChange;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.EventListener;
 import org.zkoss.zk.ui.select.annotation.WireVariable;
 import org.zkoss.zk.ui.util.Notification;
 import org.zkoss.zul.ListModelList;
@@ -27,8 +30,10 @@ import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
 
+import static hu.user.lis.ui.Constants.SET_INVOICE_PAYMENT_DATA;
+
 @Log4j2
-public class InvoicePaymentViewModel extends EntityViewModel<Payment> {
+public class InvoicePaymentViewModel extends EntityViewModel<Payment> implements EventListener {
 
     @Getter
     private final ListModelList<Partner> partners = new ListModelList<>();
@@ -80,6 +85,7 @@ public class InvoicePaymentViewModel extends EntityViewModel<Payment> {
     @Override
     public void init() {
         super.init();
+        eventBus.register(this);
         setReadonlyForm(true);
 //        addColumns(ImmutableMap.of(
 //                "partner.name", ASCENDING,
@@ -179,6 +185,23 @@ public class InvoicePaymentViewModel extends EntityViewModel<Payment> {
             getFormDocument().setPaid(newPaymentDisabled);
             invoiceRepository.save(getFormDocument());
         }
+    }
 
+
+    @Override
+    public void onEvent(Event event) throws Exception {
+        if (SET_INVOICE_PAYMENT_DATA.equals(event.getName())) {
+            Optional<Invoice> opInvoice = invoiceRepository.findById(((InvoicePaymentData) event).getId());
+            opInvoice.ifPresent(invoice -> {
+                this.showEditor(invoice);
+                invoiceNumber = invoice.getHumanId();
+                filterPartner = null;
+                setPartnerRequired(false);
+                BindUtils.postNotifyChange(this, "partnerRequired");
+                BindUtils.postNotifyChange(this, "invoiceNumber");
+            });
+        }
     }
+
+
 }
index 816d6f0b029490852b1490ae83672874612aa093..ee1a8b2dd5f96b2f5ecfe6d0d7b6445c5e6156bd 100644 (file)
@@ -92,7 +92,9 @@ public class InvoicesViewModel extends EntityViewModel<Invoice> implements Event
     @Command
     public void refresh() {
         invoicesDataModel.clearSelection();
+        setSelectedEntity(null);
         invoicesDataModel.search(invoiceFilter);
+        BindUtils.postNotifyChange(this, "selectedEntity");
     }
 
     @Command
@@ -113,7 +115,6 @@ public class InvoicesViewModel extends EntityViewModel<Invoice> implements Event
 //           (this.equals(propertyEvent.getBase()) && propertyEvent.getProperty().startsWith("invoiceFilter")))
             if (invoiceFilter.equals(propertyEvent.getBase())) {
                 log.info("Refresh needed, {} changed", propertyEvent.getProperty());
-
                 refresh();
             }
         }
@@ -153,4 +154,20 @@ public class InvoicesViewModel extends EntityViewModel<Invoice> implements Event
         });
     }
 
+    @Command
+    public void onChangeProject() {
+        Editors.doEdit(Editors.PROJECT_ATTACH, getSelectedEntity().getProject(), null, modifiedEntity -> {
+            if (modifiedEntity != null) {
+                getSelectedEntity().setProject(modifiedEntity);
+                invoiceDataModel.save(getSelectedEntity());
+                refresh();
+            }
+        });
+
+    }
+
+    @Command
+    public void onInvoicePayment() {
+        eventBus.showInvoicePayment(getSelectedEntity().getId());
+    }
 }
index de0a98fdc231a8e6d07bc82e390ca4149818a424..97ca9975cb9421e3d7a46add983d150295209b02 100644 (file)
@@ -9,6 +9,7 @@ import hu.user.lis.ui.editor.common.Editors;
 import hu.user.lis.ui.view.common.FilterActiveViewModel;
 import lombok.Getter;
 import lombok.extern.log4j.Log4j2;
+import org.zkoss.bind.BindUtils;
 import org.zkoss.bind.annotation.Command;
 import org.zkoss.bind.annotation.Init;
 import org.zkoss.zk.ui.select.annotation.WireVariable;
@@ -46,11 +47,13 @@ public class PartnersViewModel extends FilterActiveViewModel<Partner> {
 
     protected void refresh() {
         partnersDataModel.clearSelection();
+        setSelectedEntity(null);
         if (isFilterShowBoth()) {
             partnersDataModel.search(true, true);
         } else {
             partnersDataModel.search(isFilterShowActive(), isFilterShowInActive());
         }
+        BindUtils.postNotifyChange(this, "selectedEntity");
     }
 
     @Command
index 7f5f90d8e1c745761fdd0925a8c831912cf20dfa..7ae3f6f5a4ae6841d4b7253c2fdfecaf65912be3 100644 (file)
@@ -9,6 +9,7 @@ import hu.user.lis.ui.event.EventBus;
 import hu.user.lis.ui.view.common.FilterActiveViewModel;
 import lombok.Getter;
 import lombok.extern.log4j.Log4j2;
+import org.zkoss.bind.BindUtils;
 import org.zkoss.bind.annotation.Command;
 import org.zkoss.bind.annotation.Destroy;
 import org.zkoss.bind.annotation.Init;
@@ -65,6 +66,7 @@ public class ProjectsViewModel extends FilterActiveViewModel<Project> implements
         } else {
             projectsDataModel.search(isFilterShowActive(), isFilterShowInActive());
         }
+        BindUtils.postNotifyChange(this, "selectedEntity");
     }
 
     @Command
index 87db3db51f52d0241227193483a012e894e82050..82dd620e5d8e6d44da089b024798b0c38d208635 100644 (file)
@@ -14,6 +14,7 @@ import hu.user.lis.ui.view.common.EntityViewModel;
 import lombok.Getter;
 import lombok.extern.log4j.Log4j2;
 import org.zkoss.bind.BindContext;
+import org.zkoss.bind.BindUtils;
 import org.zkoss.bind.PropertyChangeEvent;
 import org.zkoss.bind.annotation.*;
 import org.zkoss.zk.ui.Component;
@@ -91,6 +92,7 @@ public class ServiceRecordsViewModel extends EntityViewModel<ServiceRecord> impl
         } else {
             serviceRecordsDataModel.listAll();
         }
+        BindUtils.postNotifyChange(this, "selectedEntity");
     }
 
     @Command
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/SpecialRoute.java b/lis-ui/src/main/java/hu/user/lis/ui/view/SpecialRoute.java
new file mode 100644 (file)
index 0000000..1b30579
--- /dev/null
@@ -0,0 +1,5 @@
+package hu.user.lis.ui.view;
+
+public interface SpecialRoute {
+    void route(Long id);
+}
diff --git a/lis-ui/src/main/java/hu/user/lis/ui/view/UIEventHandler.java b/lis-ui/src/main/java/hu/user/lis/ui/view/UIEventHandler.java
new file mode 100644 (file)
index 0000000..9c419dd
--- /dev/null
@@ -0,0 +1,7 @@
+package hu.user.lis.ui.view;
+
+import org.zkoss.zk.ui.event.Event;
+
+public interface UIEventHandler {
+    void handle(Event event);
+}
diff --git a/lis-ui/src/main/resources/web/editor/project-attach.zul b/lis-ui/src/main/resources/web/editor/project-attach.zul
new file mode 100644 (file)
index 0000000..6e4fb72
--- /dev/null
@@ -0,0 +1,66 @@
+<zk>
+    <window id="projectAttachPopup" width="600px" height="400px"
+            viewModel="@id('vm') @init('hu.user.lis.ui.editor.ProjectAttachEditorModel')">
+        <caption label="Projektek"/>
+        <borderlayout>
+            <north flex="true">
+                <toolbar>
+                    <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 vflex="true" model="@load(vm.projectsDataModel)"
+                         autopaging="true" pagingPosition="top" multiple="false"
+                         onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')">
+                    <listhead sizable="true">
+                        <listheader label="Azonosító" sort="auto(humanId)" align="left"
+                                    sortDirection="@load(vm.cols['humanId'].sortDirection)"/>
+                        <listheader label="Ügyfél" sort="auto(partner.name)" align="left"
+                                    sortDirection="@load(vm.cols['partner.name'].sortDirection)"/>
+                        <listheader label="Státusz" sort="auto(projectStatus.name)" align="left"
+                                    sortDirection="@load(vm.cols['projectStatus.name'].sortDirection)"/>
+                        <listheader label="Megnevezés" sort="auto(name)" align="left"
+                                    sortDirection="@load(vm.cols['name'].sortDirection)"/>
+                        <listheader label="Kapcsolattartó" sort="auto(contactName)" align="left"
+                                    sortDirection="@load(vm.cols['contactName'].sortDirection)"/>
+                        <listheader label="Aktív" sort="auto(active)" align="left"
+                                    sortDirection="@load(vm.cols['active'].sortDirection)"/>
+                    </listhead>
+                    <template name="model">
+                        <listitem>
+                            <listcell label="@load(each.humanId)"/>
+                            <listcell label="@load(each.partner.name)"/>
+                            <listcell label="@load(each.projectStatus.name)"/>
+                            <listcell label="@load(each.name)"/>
+                            <listcell label="@load(each.contactName)"/>
+                            <listcell>
+                                <a iconSclass="z-icon-check" visible="@load(each.active)"/>
+                                <a iconSclass="z-icon-ban" visible="@load(!each.active)"/>
+                            </listcell>
+                        </listitem>
+                    </template>
+                </listbox>
+            </center>
+            <south border="none" flex="true" style="text-align: right; padding: 10px">
+                <hlayout>
+                    <button id="cancel" label="Bezár"
+                            onClick="@command('onCloseWindow', target=projectAttachPopup, save=false)"/>
+                    <button id="submit" label="Mentés"
+                            onClick="@command('onCloseWindow', target=projectAttachPopup, save=true)"
+                            disabled="@bind(empty vm.selectedEntity)"/>
+                    <!--                    <button iconSclass="z-icon-question-circle-o" disabled="false"-->
+                    <!--                            popup="formValidation, position=before_end"/>-->
+                    <!--                    <popup id="formValidation">-->
+                    <!--                        <html content="@load(vm.validationMessages)"/>-->
+                    <!--                    </popup>-->
+                </hlayout>
+            </south>
+        </borderlayout>
+
+    </window>
+</zk>
\ No newline at end of file
index 006990f8f72f74273d1a42bf256aca1c578727a9..8cb02bb709212a8559b8631fef22207fdf4a278e 100644 (file)
             <north hflex="true">
                 <vlayout>
                     <toolbar>
-                        <!--                    <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus" onClick="@command('onAdd')"/>-->
-                        <!--                    <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit" onClick="@command('onEdit')"-->
-                        <!--                                   disabled="@load(empty vm.selectedEntity)"/>-->
-                        <!--                    <toolbarbutton label="Törlés" iconSclass="z-icon-remove" onClick="@command('onDelete')"-->
-                        <!--                                   disabled="@load(empty vm.selectedEntity)"/>-->
                         <label value="Partner"/>
                         <separator orient="vertical"/>
                         <entity-selector entity="Partner" style="display: inline-block;" width="300px"/>
                         <!--                    <toolbarbutton iconSclass="z-icon-search" label="Szűrés"-->
                         <!--                                   onClick="@command('search')"/>-->
                     </toolbar>
+                    <toolbar>
+                        <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit" onClick="@command('onEdit')"
+                                       disabled="@load(empty vm.selectedEntity)"/>
+                        <toolbarbutton label="Projekt módosítás" iconSclass="z-icon-forward"
+                                       onClick="@command('onChangeProject')" disabled="@load(empty vm.selectedEntity)"/>
+                        <toolbarbutton label="Számla kiegyenlítés" iconSclass="z-icon-credit-card"
+                                       onClick="@command('onInvoicePayment')"
+                                       disabled="@load(empty vm.selectedEntity)"/>
+
+                        <!--                        <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus" onClick="@command('onAdd')"/>-->
+                        <!--                        <toolbarbutton label="Törlés" iconSclass="z-icon-remove" onClick="@command('onDelete')"-->
+                        <!--                                       disabled="@load(empty vm.selectedEntity)"/>-->
+                    </toolbar>
                 </vlayout>
             </north>
             <center border="none" hflex="true" vflex="true">
index 86288d77b1f8ed5e3a95ac7af0ef5b1827e61b3a..1a311e6b4bac0dbd32da3b27251e09df1e270152 100644 (file)
@@ -19,7 +19,7 @@
                 </toolbar>
             </north>
             <center border="none" flex="true">
-                <listbox id="partnersList" vflex="true" model="@load(vm.projectsDataModel)"
+                <listbox vflex="true" model="@load(vm.projectsDataModel)"
                          autopaging="true" pagingPosition="top" multiple="false"
                          onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')">
                     <listhead sizable="true">
diff --git a/logs/archived/sly-crm-app-2023-11-25.0.log b/logs/archived/sly-crm-app-2023-11-25.0.log
new file mode 100644 (file)
index 0000000..62d9abd
--- /dev/null
@@ -0,0 +1,3 @@
+2023-11-25 22:44:17,628 INFO org.hibernate.validator.internal.util.Version [background-preinit] HV000001: Hibernate Validator 6.2.5.Final
+2023-11-25 22:44:18,754 INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate [main] Bootstrapping Spring Data JPA repositories in DEFAULT mode.
+2023-11-25 22:44:18,879 INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate [main] Finished Spring Data repository scanning in 113 ms. Found 11 JPA repository interfaces.