közösségi adószám
https://regex101.com/r/itexWd/1
https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s21.html
-^(HU)?[0-9]{8}$
\ No newline at end of file
+^(HU)?[0-9]{8}$
+
+##### Col reorder
+
+https://stackoverflow.com/questions/14021298/zk-reordering-in-listbox/14021556#14021556
\ No newline at end of file
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>lis-app</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.1.3-SNAPSHOT</version>
<parent>
<groupId>hu.user</groupId>
<artifactId>lis</artifactId>
jpa:
hibernate:
use-new-id-generator-mappings: false
- show-sql: false
+ show-sql: true
properties:
hibernate:
format_sql: true
INSERT INTO PROJECT
(ID, PROJECT_STATUS_ID, NAME, HUMAN_ID, CONTACT_NAME, PARTNER_ID, ACTIVE)
VALUES
- (1, 1, 'Halászat', '2023-01', 'Kovács', 1, 1);
+ (1, 1, 'Halászat', '2023-0001', 'Kovács', 1, 1);
-- //@UNDO
import org.springframework.stereotype.Service;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.Objects;
@Log4j2
@Service
-public class EntityDataService<T extends Serializable> {
+public class EntityDataService<T extends Serializable> extends EntityDataServiceBase {
@Autowired
ObjectMapper objectMapper;
return SerializationUtils.clone(sourceEntity);
}
-
- private boolean setFieldValue(T entity, Class clazz, String property, Object value) {
- boolean result = false;
- try {
- Field field = clazz.getDeclaredField(property);
- field.setAccessible(true);
- field.set(entity, value);
- result = true;
- } catch (Exception e) {
- log.error(e);
- }
- return result;
- }
-
public T clone(T sourceEntity, String property, Object value) {
T result = clone(sourceEntity);
- if (setFieldValue(result, result.getClass(), property, value)) {
- return result;
+ if (!setFieldValue(result, property, value)) {
+ result = null;
}
- if (setFieldValue(result, result.getClass().getSuperclass(), property, value)) {
- return result;
- }
- return null;
+ return result;
}
--- /dev/null
+package hu.user.lis.services.data;
+
+import lombok.extern.log4j.Log4j2;
+import org.springframework.stereotype.Service;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+@Log4j2
+@Service
+public class EntityDataServiceBase {
+
+ public boolean setFieldValue(Object entity, String property, Object value) {
+ boolean result = false;
+ Field field;
+ try {
+ boolean hasField = Arrays.stream(entity.getClass().getDeclaredFields()).anyMatch(f -> f.getName().equals(property));
+ if (hasField) {
+ field = entity.getClass().getDeclaredField(property);
+ } else {
+ field = entity.getClass().getSuperclass().getDeclaredField(property);
+ }
+ field.setAccessible(true);
+ field.set(entity, value);
+ result = true;
+ } catch (Exception e) {
+ log.error(e);
+ }
+ return result;
+ }
+
+ public Object getFieldValue(Object entity, String property) {
+ Object result = null;
+ Field field;
+ try {
+ boolean hasField = Arrays.stream(entity.getClass().getDeclaredFields()).anyMatch(f -> f.getName().equals(property));
+ if (hasField) {
+ field = entity.getClass().getDeclaredField(property);
+ } else {
+ field = entity.getClass().getSuperclass().getDeclaredField(property);
+ }
+ field.setAccessible(true);
+ result = field.get(entity);
+ } catch (Exception e) {
+ log.error(e);
+ }
+ return result;
+ }
+}
public class Constants {
public static final String BINDING_QUEUE = "$ZKBIND_DEFQUE$";
+ public static final String PROJECT_EDITOR_QUEUE = "PROJECT_EDITOR_QUEUE";
public static final String SHOW_PROJECT_EDITOR = "SHOW_PROJECT_EDITOR";
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_PROJECTS_LIST_DATA = "SET_PROJECTS_LIST_DATA";
- public static final String PROJECT_EDITOR_QUEUE = "PROJECT_EDITOR_QUEUE";
public static final String NAV_PARTNERS = "/partners";
public static final String NAV_PROJECTS = "/projects";
public static final String NAV_SERVICE_RECORDS = "/service-records";
public static final String NAV_SETTINGS = "/settings";
+ public static final String WIDGET_ENTITY_SELECTOR = "~./widget/entity-selector.zul";
+
+
}
package hu.user.lis.ui.converter;
import hu.user.lis.db.Associate;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.Converter;
-import org.zkoss.zul.Bandbox;
+import org.zkoss.zul.impl.XulElement;
-public class AssociateToNameConverter implements Converter<String, Associate, Bandbox> {
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class AssociateToNameConverter implements Converter<String, Associate, XulElement> {
@Override
- public String coerceToUi(Associate Associate, Bandbox bandbox, BindContext bindContext) {
+ public String coerceToUi(Associate Associate, XulElement bandbox, BindContext bindContext) {
return Associate == null ? null : Associate.getName();
}
@Override
- public Associate coerceToBean(String s, Bandbox bandbox, BindContext bindContext) {
+ public Associate coerceToBean(String s, XulElement bandbox, BindContext bindContext) {
return null;
}
}
\ No newline at end of file
import org.springframework.stereotype.Component;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.Converter;
-import org.zkoss.zul.Bandbox;
+import org.zkoss.zul.impl.XulElement;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PartnerToNameConverter implements Converter<String, Partner, Bandbox> {
+public class PartnerToNameConverter implements Converter<String, Partner, XulElement> {
@Override
- public String coerceToUi(Partner partner, Bandbox bandbox, BindContext bindContext) {
+ public String coerceToUi(Partner partner, XulElement bandbox, BindContext bindContext) {
return partner == null ? null : partner.getName();
}
@Override
- public Partner coerceToBean(String s, Bandbox bandbox, BindContext bindContext) {
+ public Partner coerceToBean(String s, XulElement bandbox, BindContext bindContext) {
return null;
}
}
\ No newline at end of file
package hu.user.lis.ui.converter;
import hu.user.lis.db.Project;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.Converter;
-import org.zkoss.zul.Bandbox;
+import org.zkoss.zul.impl.XulElement;
-public class ProjectToInfoConverter implements Converter<String, Project, Bandbox> {
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class ProjectToInfoConverter implements Converter<String, Project, XulElement> {
@Override
- public String coerceToUi(Project project, Bandbox bandbox, BindContext bindContext) {
- return project == null ? null : String.format("%s | %s | %s", project.getHumanId(), project.getName(), project.getPartner().getName());
+ public String coerceToUi(Project project, XulElement bandbox, BindContext bindContext) {
+ return project == null ? null : String.format("%s - %s - %s", project.getHumanId(), project.getName(), project.getPartner().getName());
}
@Override
- public Project coerceToBean(String s, Bandbox bandbox, BindContext bindContext) {
+ public Project coerceToBean(String s, XulElement bandbox, BindContext bindContext) {
return null;
}
}
\ No newline at end of file
package hu.user.lis.ui.data;
+import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
import org.zkoss.bind.BindUtils;
private int cacheEnd;
private int resultSetSize = -1;
private HashMap<Integer, T> cache = new HashMap<>();
+ @Setter
private FieldComparator sortComparator;
public CachedDataModel() {
+
setMultiple(false);
+
}
public void reset() {
package hu.user.lis.ui.data;
+import lombok.Getter;
+import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
+import org.zkoss.json.JSONObject;
import org.zkoss.zul.FieldComparator;
import java.util.Objects;
@Component
@Log4j2
public abstract class CachedSpringDataModel<T> extends CachedDataModel<T> {
+
+ @Getter
+ @Setter
+ JSONObject cols = new JSONObject();
+
+ public void addColumn(String name, String direction) {
+ JSONObject sort = new JSONObject();
+ sort.put("sortDirection", direction);
+ cols.put(name, sort);
+
+ if (!direction.equals(NATURAL)) {
+ setSortComparator(new FieldComparator(name, direction.equals(ASCENDING)));
+ }
+ }
+
protected Pageable createPageable(int page, int pageSize, FieldComparator sortComparator) {
Pageable pageable;
if (Objects.isNull(sortComparator)) {
log.info("{} {}", getClass().getSimpleName(), pageable);
return pageable;
}
-
}
ProjectStatusRepository projectStatusRepository;
private boolean activeOnly;
+ public ProjectStatusDataModel() {
+ listAll();
+ }
+
@Override
public List<ProjectStatus> getResultSet(int page, int pageSize, FieldComparator sortComparator) {
List<ProjectStatus> result;
});
}
- public void append() {
+ public void create() {
ProjectStatus entity = projectStatusService.createNew();
long currentCount = projectStatusRepository.count();
entity.setOrder((int) currentCount + 1);
projectStatusRepository.save(entity);
}
+ public void delete(ProjectStatus entity) {
+ projectStatusRepository.delete(entity);
+ List<ProjectStatus> projectStatuses = projectStatusRepository.findAll(Sort.by(Sort.Direction.ASC, "order"));
+ for (int i = 0; i < projectStatuses.size(); i++) {
+ projectStatuses.get(i).setOrder(i + 1);
+ }
+ projectStatusRepository.saveAll(projectStatuses);
+ }
+
public ProjectStatus getDefault() {
return projectStatusRepository.findByOrder(1);
}
import hu.user.lis.db.Project;
import hu.user.lis.db.ServiceRecord;
import hu.user.lis.db.repository.ServiceRecordRepository;
+import hu.user.lis.services.data.EntityDataService;
import hu.user.lis.services.data.ServiceRecordService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.FieldComparator;
-import javax.persistence.EntityNotFoundException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
ServiceRecordService serviceRecordService;
@Autowired
ServiceRecordRepository serviceRecordRepository;
+
+ @Autowired
+ EntityDataService<ServiceRecord> serviceRecordDataService;
+
private boolean listAll;
+
private Long filterProjectId;
+
private Long filterAssociateId;
+
private boolean groupByAssociate;
@Init
Map<Long, ServiceRecord> grouped = new HashMap<>();
List<ServiceRecord> allEntities = serviceRecordRepository.findByProjectId(filterProjectId);
allEntities.stream().forEach(s -> {
+ double cost = s.getWorkHours() * s.getAssociate().getMonthlyCost() / 160;
if (grouped.containsKey(s.getAssociate().getId())) {
ServiceRecord serviceRecord = grouped.get(s.getAssociate().getId());
- serviceRecord.setCost(serviceRecord.getCost() + s.getCost());
+ serviceRecord.setCost(serviceRecord.getCost() + cost);
serviceRecord.setWorkHours(serviceRecord.getWorkHours() + s.getWorkHours());
} else {
- ServiceRecord serviceRecord = serviceRecordRepository.findById(s.getId()).orElseThrow(EntityNotFoundException::new);
+ ServiceRecord serviceRecord = serviceRecordDataService.clone(s);
serviceRecord.setWorkDay(null);
+ serviceRecord.setId(0L);
+ serviceRecord.setCost(cost);
grouped.put(serviceRecord.getAssociate().getId(), serviceRecord);
}
});
return serviceRecordService.createNew();
}
- public void addNew(ServiceRecord entity) {
- serviceRecordRepository.save(entity);
- }
-
- public ServiceRecord copy(ServiceRecord entity) {
- return serviceRecordRepository.findById(entity.getId()).orElseThrow(EntityNotFoundException::new);
+ public ServiceRecord clone(ServiceRecord entity) {
+ return serviceRecordDataService.clone(entity);
}
-//
-// public ServiceRecord copy(ServiceRecord entity, String property, Object value) {
-// ServiceRecord result = copy(entity);
-// try {
-// Field field = result.getClass().getDeclaredField(property);
-// field.setAccessible(true);
-// field.set(result, value);
-// } catch (Exception e) {
-// log.catching(e);
-// }
-// return result;
-// }
public ServiceRecord save(ServiceRecord selectedEntity) {
return serviceRecordRepository.save(selectedEntity);
}
-
+ public void delete(ServiceRecord entity) {
+ serviceRecordRepository.delete(entity);
+ }
}
package hu.user.lis.ui.editor;
import hu.user.lis.db.Associate;
+import hu.user.lis.ui.editor.common.EntityEditorModel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import hu.user.lis.db.Currency;
import hu.user.lis.db.Invoice;
-import hu.user.lis.ui.data.PartnerSelectorDataModel;
+import hu.user.lis.db.Partner;
+import hu.user.lis.ui.editor.common.EntityEditorModel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
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.Init;
-import org.zkoss.zk.ui.event.InputEvent;
-import org.zkoss.zk.ui.event.OpenEvent;
+import org.zkoss.bind.annotation.*;
+import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.UploadEvent;
-import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox;
import java.util.Objects;
@Setter
public class InvoiceEditorModel extends EntityEditorModel<Invoice> {
- @WireVariable
- private PartnerSelectorDataModel partnerSelectorDataModel;
-
@Init
public void init() {
super.init();
- //partnerSelectorDataModel.clearSelection();
+ }
+
+ @AfterCompose
+ public void onAfterCompose(@ContextParam(ContextType.VIEW) Component view) {
+ getEntitySelectorRouter().setFormDocument(Partner.class, getFormDocument(), "partner");
}
@Command
public void onNetAmountChange() {
- if (Currency.HUF.equals(formDocument.getCurrency())) {
- formDocument.setGrossAmount(formDocument.getNetAmount() * 1.27);
- formDocument.setVatAmount(formDocument.getGrossAmount() - formDocument.getNetAmount());
- BindUtils.postNotifyChange(this.formDocument, "grossAmount", "vatAmount");
+ if (Currency.HUF.equals(getFormDocument().getCurrency())) {
+ getFormDocument().setGrossAmount(getFormDocument().getNetAmount() * 1.27);
+ getFormDocument().setVatAmount(getFormDocument().getGrossAmount() - getFormDocument().getNetAmount());
+ BindUtils.postNotifyChange(getFormDocument(), "grossAmount", "vatAmount");
validate();
}
}
- @Command
- public void onPartnerBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- InputEvent event = (InputEvent) ctx.getTriggerEvent();
- log.info("onPartnerBandChanging: {}", event.getValue());
- partnerSelectorDataModel.search(event.getValue());
- }
-
- @Command
- public void onPartnerBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
- log.info("onPartnerBandOpen: {}", event.isOpen());
- partnerSelectorDataModel.search(null);
- }
-
@Override
protected boolean canSave(Invoice entity) {
return entity.getNetAmount() > 0 &&
Messagebox.show("Csak PDF állomány feltöltése támogatott.", "Error", Messagebox.OK, Messagebox.ERROR);
return;
}
- formDocument.setFile(evt.getMedia().getByteData());
- BindUtils.postNotifyChange(this.formDocument, "file");
+ getFormDocument().setFile(evt.getMedia().getByteData());
+ BindUtils.postNotifyChange(getFormDocument(), "file");
validate();
}
@Command
public void onRemoveFile() {
- formDocument.setFile(null);
- BindUtils.postNotifyChange(this.formDocument, "file");
+ getFormDocument().setFile(null);
+ BindUtils.postNotifyChange(getFormDocument(), "file");
validate();
}
}
package hu.user.lis.ui.editor;
import hu.user.lis.db.Partner;
+import hu.user.lis.ui.editor.common.EntityEditorModel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import hu.user.lis.ui.Constants;
import hu.user.lis.ui.converter.ProjectStatusConverter;
import hu.user.lis.ui.data.*;
+import hu.user.lis.ui.editor.common.Editors;
+import hu.user.lis.ui.editor.common.EntityEditorModel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
-import org.zkoss.bind.BindContext;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.*;
+import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
-import org.zkoss.zk.ui.event.InputEvent;
-import org.zkoss.zk.ui.event.OpenEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Center;
@Setter
@WireVariable
AssociatesDataModel associatesDataModel;
+
@WireVariable
ProjectsDataModel projectsDataModel;
- @WireVariable
- private PartnerSelectorDataModel partnerSelectorDataModel;
+
@WireVariable
private InvoiceDataModel invoiceDataModel;
+
@WireVariable
private TreasuryDataModel treasuryDataModel;
+
@Getter
@Setter
@WireVariable
private ServiceRecordsDataModel serviceRecordsDataModel;
+
@Getter
@Setter
@WireVariable
private ProjectStatusDataModel projectStatusDataModel;
+
@Getter
@Setter
@WireVariable
private IncomeMarginsDataModel incomeMarginsDataModel;
+
@WireVariable
private ProjectAssociatesDataModel projectAssociatesDataModel;
+
@Getter
@Setter
@WireVariable
private ProjectStatusConverter projectStatusConverter;
+
private Map<Long, Boolean> origAssociates;
+
@Getter
@Setter
private Map<Long, Boolean> formAssociates;
+
@Getter
@Setter
private IncomingInvoice selectedIncomingInvoice;
+
@Getter
@Setter
private OutgoingInvoice selectedOutgoingInvoice;
+
@Getter
@Setter
private Treasury selectedTreasury;
+
@Getter
@Setter
private String partialAssociateName;
@Init
public void init() {
super.init();
- projectStatusDataModel.listAll();
}
- @Command
- public void onSelectedEntityChanged(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- Event event = (Event) ctx.getTriggerEvent();
- log.info("{}", event);
+ @AfterCompose
+ public void onAfterCompose(@ContextParam(ContextType.VIEW) Component view) {
}
@Override
private void initDetails() {
initAssociates();
- serviceRecordsDataModel.search(formDocument, true);
- incomeMarginsDataModel.recalculate(formDocument);
- entitySelectorRouter.setFormDocument(Partner.class, formDocument, "partner");
+ serviceRecordsDataModel.search(getFormDocument(), true);
+ getEntitySelectorRouter().setFormDocument(Partner.class, getFormDocument(), "partner");
+ incomeMarginsDataModel.recalculate(getFormDocument());
}
+
private void initDocuments(Object data) {
if (Objects.isNull(data)) {
- formDocument = projectsDataModel.createNew();
- log.info("Loading new entity {} to editor", formDocument.getId());
+ setFormDocument(projectsDataModel.createNew());
+ log.info("Loading new entity {} to editor", getFormDocument().getId());
} else {
Long id = (Long) data;
Clients.evalJavaScript(String.format("pushNav('/project/%d')", id));
log.info("Loading entity {} to editor", id);
- formDocument = projectsDataModel.getById(id);
- origDocument = projectsDataModel.clone(formDocument);
+ setFormDocument(projectsDataModel.getById(id));
+ setOrigDocument(projectsDataModel.clone(getFormDocument()));
}
BindUtils.postNotifyChange(this, "formDocument");
}
@Command
public void onEndEdit(@BindingParam("target") Window target, @BindingParam("save") boolean save) {
- if (save && saveEnabled) {
- projectsDataModel.save(formDocument);
+ if (save && isSaveEnabled()) {
+ projectsDataModel.save(getFormDocument());
if (isAssociatesChanged()) {
- projectAssociatesDataModel.updateAssociates(formDocument, formAssociates);
+ projectAssociatesDataModel.updateAssociates(getFormDocument(), formAssociates);
}
}
- eventBus.showProjectsList(ImmutableMap.of("formDocument", formDocument));
- }
-
- @Command
- public void onPartnerBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- InputEvent event = (InputEvent) ctx.getTriggerEvent();
- log.info("onPartnerBandChanging: {}", event.getValue());
- partnerSelectorDataModel.search(event.getValue());
- }
-
- @Command
- public void onPartnerBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
- log.info("onPartnerBandOpen: {}", event.isOpen());
- partnerSelectorDataModel.search(null);
+ eventBus.showProjectsList(ImmutableMap.of("formDocument", getFormDocument()));
}
-// @Command
-// public void onPopupPartners() {
-// String page = "~./suppliers.zul";
-// Window editorWindow = (Window) Executions.createComponents(page, null, null);
-// editorWindow.addEventListener("onClose", e -> {
-// log.info("Suppliers popup result {}", e.getData());
-// if (e.getData() != null) {
-// partnerSelectorDataModel.clearSelection();
-// //setSelectedSupplierId(((Supplier) e.getData()).getId());
-// BindUtils.postNotifyChange(this, "selectedSupplierId");
-// }
-// });
-// editorWindow.doModal();
-// editorWindow.setFocus(true);
-// }
-
@Override
protected boolean canSave(Project entity) {
return (StringUtils.isNotBlank(entity.getName()) &&
public void onAddIncoming() {
IncomingInvoice entity = invoiceDataModel.createNewIncomingInvoice();
Editors.doEdit(Editors.INCOMING_INVOICE, entity, modifiedEntity -> {
- formDocument.getIncomingInvoices().add(modifiedEntity);
+ getFormDocument().getIncomingInvoices().add(modifiedEntity);
selectedIncomingInvoice = modifiedEntity;
validate();
BindUtils.postNotifyChange(this, "selectedIncomingInvoice");
- BindUtils.postNotifyChange(this.formDocument, "incomingInvoices");
+ BindUtils.postNotifyChange(getFormDocument(), "incomingInvoices");
});
}
public void onEditIncoming() throws JsonProcessingException {
IncomingInvoice entity = invoiceDataModel.clone(selectedIncomingInvoice);
Editors.doEdit(Editors.INCOMING_INVOICE, entity, selectedIncomingInvoice, modifiedEntity -> {
- Set<IncomingInvoice> incomingInvoices = formDocument.getIncomingInvoices();
+ Set<IncomingInvoice> incomingInvoices = getFormDocument().getIncomingInvoices();
incomingInvoices.remove(selectedIncomingInvoice);
incomingInvoices.add(modifiedEntity);
selectedIncomingInvoice = modifiedEntity;
validate();
BindUtils.postNotifyChange(this, "selectedIncomingInvoice");
- BindUtils.postNotifyChange(this.formDocument, "incomingInvoices");
+ BindUtils.postNotifyChange(getFormDocument(), "incomingInvoices");
});
}
@Command
public void onRemoveIncoming() {
if (Objects.nonNull(selectedIncomingInvoice)) {
- formDocument.getIncomingInvoices().remove(selectedIncomingInvoice);
+ getFormDocument().getIncomingInvoices().remove(selectedIncomingInvoice);
selectedIncomingInvoice = null;
validate();
BindUtils.postNotifyChange(this, "selectedIncomingInvoice");
- BindUtils.postNotifyChange(this.formDocument, "incomingInvoices");
+ BindUtils.postNotifyChange(getFormDocument(), "incomingInvoices");
}
}
public void onAddOutgoing() {
OutgoingInvoice entity = invoiceDataModel.createNewOutgoingInvoice();
Editors.doEdit(Editors.OUTGOING_INVOICE, entity, modifiedEntity -> {
- formDocument.getOutgoingInvoices().add(modifiedEntity);
+ getFormDocument().getOutgoingInvoices().add(modifiedEntity);
selectedOutgoingInvoice = modifiedEntity;
validate();
BindUtils.postNotifyChange(this, "selectedOutgoingInvoice");
- BindUtils.postNotifyChange(this.formDocument, "outgoingInvoices");
+ BindUtils.postNotifyChange(getFormDocument(), "outgoingInvoices");
});
}
public void onEditOutgoing() throws JsonProcessingException {
OutgoingInvoice entity = invoiceDataModel.clone(selectedOutgoingInvoice);
Editors.doEdit(Editors.OUTGOING_INVOICE, entity, selectedOutgoingInvoice, modifiedEntity -> {
- Set<OutgoingInvoice> outgoingInvoices = formDocument.getOutgoingInvoices();
+ Set<OutgoingInvoice> outgoingInvoices = getFormDocument().getOutgoingInvoices();
outgoingInvoices.remove(selectedOutgoingInvoice);
outgoingInvoices.add(modifiedEntity);
selectedOutgoingInvoice = modifiedEntity;
validate();
BindUtils.postNotifyChange(this, "selectedOutgoingInvoice");
- BindUtils.postNotifyChange(this.formDocument, "outgoingInvoices");
+ BindUtils.postNotifyChange(getFormDocument(), "outgoingInvoices");
});
}
@Command
public void onRemoveOutgoing() {
if (Objects.nonNull(selectedOutgoingInvoice)) {
- formDocument.getOutgoingInvoices().remove(selectedOutgoingInvoice);
+ getFormDocument().getOutgoingInvoices().remove(selectedOutgoingInvoice);
selectedOutgoingInvoice = null;
validate();
BindUtils.postNotifyChange(this, "selectedOutgoingInvoice");
- BindUtils.postNotifyChange(this.formDocument, "outgoingInvoice");
+ BindUtils.postNotifyChange(getFormDocument(), "outgoingInvoice");
}
}
public void onAddTreasury() {
Treasury entity = treasuryDataModel.createNew();
Editors.doEdit(Editors.TREASURY, entity, modifiedEntity -> {
- formDocument.getTreasuries().add(modifiedEntity);
+ getFormDocument().getTreasuries().add(modifiedEntity);
selectedTreasury = modifiedEntity;
validate();
BindUtils.postNotifyChange(this, "selectedTreasury");
- BindUtils.postNotifyChange(this.formDocument, "treasuries");
+ BindUtils.postNotifyChange(getFormDocument(), "treasuries");
});
}
public void onEditTreasury() {
Treasury entity = treasuryDataModel.clone(selectedTreasury);
Editors.doEdit(Editors.TREASURY, entity, selectedTreasury, modifiedEntity -> {
- Set<Treasury> treasuries = formDocument.getTreasuries();
+ Set<Treasury> treasuries = getFormDocument().getTreasuries();
treasuries.remove(selectedTreasury);
treasuries.add(modifiedEntity);
selectedTreasury = modifiedEntity;
validate();
BindUtils.postNotifyChange(this, "selectedTreasury");
- BindUtils.postNotifyChange(this.formDocument, "treasuries");
+ BindUtils.postNotifyChange(getFormDocument(), "treasuries");
});
}
@Command
public void onRemoveTreasury() {
if (Objects.nonNull(selectedTreasury)) {
- formDocument.getTreasuries().remove(selectedTreasury);
+ getFormDocument().getTreasuries().remove(selectedTreasury);
selectedTreasury = null;
validate();
BindUtils.postNotifyChange(this, "selectedTreasury");
- BindUtils.postNotifyChange(this.formDocument, "treasuries");
+ BindUtils.postNotifyChange(getFormDocument(), "treasuries");
}
}
@Command
public void showServiceRecords(@BindingParam("associate") Associate associate) {
log.info("showServiceRecords");
- eventBus.showServiceRecordsList(ImmutableMap.of("filterAssociate", associate, "filterProject", formDocument));
+ eventBus.showServiceRecordsList(ImmutableMap.of("filterAssociate", associate, "filterProject", getFormDocument()));
}
@NotifyChange("formAssociates")
associatesDataModel.listAll();
formAssociates = new HashMap<>();
origAssociates = new HashMap<>();
- if (Objects.isNull(formDocument.getId())) {
+ if (Objects.isNull(getFormDocument().getId())) {
return;
}
- List<ProjectAssociate> projectAssociates = projectAssociatesDataModel.search(formDocument.getId());
+ List<ProjectAssociate> projectAssociates = projectAssociatesDataModel.search(getFormDocument().getId());
for (int i = 0; i < associatesDataModel.getSize(); i++) {
Associate associate = associatesDataModel.getElementAt(i);
boolean exists = projectAssociates.stream()
.anyMatch(
- pa -> pa.getProjectId().equals(formDocument.getId()) &&
+ pa -> pa.getProjectId().equals(getFormDocument().getId()) &&
pa.getAssociateId().equals(associate.getId())
);
if (exists) {
- log.info("{} is on project {}", associate.getName(), formDocument.getName());
+ log.info("{} is on project {}", associate.getName(), getFormDocument().getName());
}
formAssociates.put(associate.getId(), exists);
origAssociates.put(associate.getId(), exists);
package hu.user.lis.ui.editor;
+import hu.user.lis.db.Associate;
+import hu.user.lis.db.Project;
import hu.user.lis.db.ServiceRecord;
-import hu.user.lis.ui.data.AssociateSelectorDataModel;
-import hu.user.lis.ui.data.ProjectSelectorDataModel;
+import hu.user.lis.ui.editor.common.EntityEditorModel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
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.Init;
-import org.zkoss.zk.ui.Executions;
-import org.zkoss.zk.ui.event.InputEvent;
-import org.zkoss.zk.ui.event.OpenEvent;
+import org.zkoss.bind.annotation.*;
+import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.UploadEvent;
-import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Messagebox;
import java.util.Objects;
@Setter
public class ServiceRecordEditorModel extends EntityEditorModel<ServiceRecord> {
- @WireVariable
- private AssociateSelectorDataModel associateSelectorDataModel;
-
- @WireVariable
- private ProjectSelectorDataModel projectSelectorDataModel;
-
@Init
public void init() {
- log.info("Initialized");
- origDocument = (ServiceRecord) Executions.getCurrent().getArg().get("origDocument");
- formDocument = (ServiceRecord) Executions.getCurrent().getArg().get("formDocument");
- }
-
- @Command
- public void onProjectBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- InputEvent event = (InputEvent) ctx.getTriggerEvent();
- log.info("onProjectBandChanging: {}", event.getValue());
- projectSelectorDataModel.search(event.getValue());
- }
-
- @Command
- public void onProjectBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
- log.info("onProjectBandOpen: {}", event.isOpen());
- projectSelectorDataModel.search(null);
- }
-
- @Command
- public void onAssociateBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- InputEvent event = (InputEvent) ctx.getTriggerEvent();
- log.info("onAssociateBandChanging: {}", event.getValue());
- associateSelectorDataModel.search(event.getValue());
+ super.init();
}
- @Command
- public void onAssociateBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
- log.info("onAssociateBandOpen: {}", event.isOpen());
- associateSelectorDataModel.search(null);
+ @AfterCompose
+ public void onAfterCompose(@ContextParam(ContextType.VIEW) Component view) {
+ getEntitySelectorRouter().setFormDocument(Associate.class, getFormDocument(), "associate");
+ getEntitySelectorRouter().setFormDocument(Project.class, getFormDocument(), "project");
}
@Override
Messagebox.show("Csak PDF állomány feltöltése támogatott.", "Error", Messagebox.OK, Messagebox.ERROR);
return;
}
- formDocument.setFile(evt.getMedia().getByteData());
- BindUtils.postNotifyChange(this.formDocument, "file");
- validate(formDocument);
+ getFormDocument().setFile(evt.getMedia().getByteData());
+ BindUtils.postNotifyChange(getFormDocument(), "file");
+ validate();
}
@Command
public void onRemoveFile() {
- formDocument.setFile(null);
- BindUtils.postNotifyChange(this.formDocument, "file");
- validate(formDocument);
+ getFormDocument().setFile(null);
+ BindUtils.postNotifyChange(getFormDocument(), "file");
+ validate();
}
}
package hu.user.lis.ui.editor;
import hu.user.lis.db.Treasury;
+import hu.user.lis.ui.editor.common.EntityEditorModel;
import lombok.extern.log4j.Log4j2;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.BindUtils;
Messagebox.show("Csak PDF állomány feltöltése támogatott.", "Error", Messagebox.OK, Messagebox.ERROR);
return;
}
- formDocument.setFile(evt.getMedia().getByteData());
- BindUtils.postNotifyChange(this.formDocument, "file");
- validate(formDocument);
+ getFormDocument().setFile(evt.getMedia().getByteData());
+ BindUtils.postNotifyChange(getFormDocument(), "file");
+ validate();
}
@Command
public void onRemoveFile() {
- formDocument.setFile(null);
- BindUtils.postNotifyChange(this.formDocument, "file");
- validate(formDocument);
+ getFormDocument().setFile(null);
+ BindUtils.postNotifyChange(getFormDocument(), "file");
+ validate();
}
}
-package hu.user.lis.ui.editor;
+package hu.user.lis.ui.editor.common;
public interface EditCompleted<E> {
-package hu.user.lis.ui.editor;
+package hu.user.lis.ui.editor.common;
import com.google.common.collect.ImmutableMap;
import org.zkoss.zk.ui.Executions;
import java.util.Objects;
public class Editors {
- public static String INCOMING_INVOICE = "~./incoming-invoice-editor.zul";
- public static String OUTGOING_INVOICE = "~./outgoing-invoice-editor.zul";
+ public static final String SERVICE_RECORD = "~./editor/service-record-editor.zul";
+ public static final String INCOMING_INVOICE = "~./editor/incoming-invoice-editor.zul";
+ public static final String OUTGOING_INVOICE = "~./editor/outgoing-invoice-editor.zul";
+ 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 String TREASURY = "~./treasury-editor.zul";
- public static String ASSOCIATE = "~./associate-editor.zul";
- public static String PARTNER = "~./partner-editor.zul";
+ public static final String PROJECT = "~./editor/project-editor.zul";
public static <E> void doEdit(String page, E entity, EditCompleted<E> editCompleted) {
doEdit(page, entity, null, editCompleted);
-package hu.user.lis.ui.editor;
+package hu.user.lis.ui.editor.common;
import hu.user.lis.services.data.EntityDataService;
import hu.user.lis.ui.editor.selector.EntitySelectorRouter;
import hu.user.lis.ui.event.EventBus;
import lombok.Getter;
+import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.PropertyChangeEvent;
import org.zkoss.bind.ValidationContext;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
+import org.zkoss.bind.annotation.Destroy;
import org.zkoss.bind.validator.AbstractValidator;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
@WireVariable
protected EventBus eventBus;
+
@Getter
+ @Setter
T formDocument;
+
+ @Getter
+ @Setter
T origDocument;
+
@Getter
boolean saveEnabled;
+
@WireVariable
EntityDataService<T> entityDataService;
+
@Getter
@WireVariable
EntitySelectorRouter entitySelectorRouter;
}
}
+ @Destroy
+ public void onDestroy() {
+ eventBus.unregister(this);
+ }
}
--- /dev/null
+package hu.user.lis.ui.editor.selector;
+
+import hu.user.lis.db.Associate;
+import hu.user.lis.ui.converter.AssociateToNameConverter;
+import hu.user.lis.ui.data.AssociateSelectorDataModel;
+import hu.user.lis.ui.data.CachedSpringDataModel;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+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.Converter;
+import org.zkoss.zul.impl.XulElement;
+
+@Log4j2
+@Getter
+@Setter
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class AssociateSelectorModel extends EntitySelectorModel<Associate> {
+ @Autowired
+ AssociateToNameConverter associateToNameConverter;
+ @Autowired
+ AssociateSelectorDataModel associateSelectorDataModel;
+
+ @Override
+ public String selectorIdentifier() {
+ return Associate.class.getSimpleName();
+ }
+
+ @Override
+ public Converter<String, Associate, XulElement> getDisplayConverter() {
+ return associateToNameConverter;
+ }
+
+ @Override
+ public CachedSpringDataModel<Associate> getDataModel() {
+ return associateSelectorDataModel;
+ }
+
+ @Override
+ protected void search(String filter) {
+ associateSelectorDataModel.search(filter);
+ }
+
+ @Override
+ protected void reset() {
+ associateSelectorDataModel.search(null);
+ }
+}
package hu.user.lis.ui.editor.selector;
+import hu.user.lis.services.data.EntityDataServiceBase;
import hu.user.lis.ui.data.CachedSpringDataModel;
import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.Converter;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zk.ui.event.OpenEvent;
-import org.zkoss.zul.Bandbox;
-
-import java.lang.reflect.Field;
+import org.zkoss.zul.impl.XulElement;
@Log4j2
public abstract class EntitySelectorModel<T> {
+ @Autowired
+ EntityDataServiceBase entityDataServiceBase;
private T selectedEntity;
private Object formDocument;
private String member;
public abstract String selectorIdentifier();
- public abstract Converter<String, T, Bandbox> getDisplayConverter();
+ public abstract Converter<String, T, XulElement> getDisplayConverter();
public abstract CachedSpringDataModel<T> getDataModel();
public void setSelectedEntity(T selectedEntity) {
this.selectedEntity = selectedEntity;
- try {
- Field field = formDocument.getClass().getDeclaredField(member);
- field.setAccessible(true);
- field.set(formDocument, selectedEntity);
- BindUtils.postNotifyChange(formDocument, member);
- } catch (Exception e) {
- log.error(e);
- }
+ entityDataServiceBase.setFieldValue(formDocument, member, selectedEntity);
+ BindUtils.postNotifyChange(formDocument, member);
}
public void setFormDocument(Object formDocument, String member) {
this.formDocument = formDocument;
this.member = member;
- try {
- Field field = formDocument.getClass().getDeclaredField(member);
- field.setAccessible(true);
- selectedEntity = (T) field.get(formDocument);
- BindUtils.postNotifyChange(this, "selectedEntity");
- } catch (Exception e) {
- log.error(e);
- }
+ selectedEntity = (T) entityDataServiceBase.getFieldValue(formDocument, member);
+ BindUtils.postNotifyChange(this, "selectedEntity");
}
}
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.zkoss.bind.Converter;
-import org.zkoss.zul.Bandbox;
+import org.zkoss.zul.impl.XulElement;
@Log4j2
@Getter
}
@Override
- public Converter<String, Partner, Bandbox> getDisplayConverter() {
+ public Converter<String, Partner, XulElement> getDisplayConverter() {
return partnerToNameConverter;
}
--- /dev/null
+package hu.user.lis.ui.editor.selector;
+
+import hu.user.lis.db.Project;
+import hu.user.lis.ui.converter.ProjectToInfoConverter;
+import hu.user.lis.ui.data.CachedSpringDataModel;
+import hu.user.lis.ui.data.ProjectSelectorDataModel;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+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.Converter;
+import org.zkoss.zul.impl.XulElement;
+
+@Log4j2
+@Getter
+@Setter
+@Component
+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class ProjectSelectorModel extends EntitySelectorModel<Project> {
+ @Autowired
+ ProjectToInfoConverter projectToInfoConverter;
+ @Autowired
+ ProjectSelectorDataModel projectSelectorDataModel;
+
+ @Override
+ public String selectorIdentifier() {
+ return Project.class.getSimpleName();
+ }
+
+ @Override
+ public Converter<String, Project, XulElement> getDisplayConverter() {
+ return projectToInfoConverter;
+ }
+
+ @Override
+ public CachedSpringDataModel<Project> getDataModel() {
+ return projectSelectorDataModel;
+ }
+
+ @Override
+ protected void search(String filter) {
+ projectSelectorDataModel.search(filter);
+ }
+
+ @Override
+ protected void reset() {
+ projectSelectorDataModel.search(null);
+ }
+}
package hu.user.lis.ui.editor.widget;
+import hu.user.lis.ui.Constants;
import lombok.extern.log4j.Log4j2;
import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zul.Include;
@Log4j2
-public class EntitySelector extends Include {
+public class EntitySelector extends Include implements IdSpace {
public EntitySelector() {
- setSrc("~./entity-selector.zul");
+ setSrc(Constants.WIDGET_ENTITY_SELECTOR);
}
@Override
super.setDynamicProperty(name, value);
setAttribute(name, value, Component.SPACE_SCOPE);
log.info("Setting {} = {}", name, value);
-
}
}
@Log4j2
public class EventBus {
- public EventBus() {
-// EventQueue<Event> queue = EventQueues.lookup("$ZKBIND_DEFQUE$", EventQueues.SESSION, true);
-// queue.subscribe(event -> {
-// log.info("EVT: {}", event.getName());
-// });
-
-
- }
-
private EventQueue<Event> getQueue() {
return EventQueues.lookup(Constants.PROJECT_EDITOR_QUEUE, EventQueues.SESSION, true);
}
public void unregister(EventListener listener) {
try {
getQueue().unsubscribe(listener);
+ getBindingQueue().unsubscribe(listener);
} catch (Exception e) {
- log.warn("Not necessary to unregister");
+// log.warn("Not necessary to unregister");
}
}
import hu.user.lis.ui.Constants;
import hu.user.lis.ui.data.AssociatesDataModel;
import hu.user.lis.ui.data.CachedSpringDataModel;
-import hu.user.lis.ui.editor.Editors;
+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.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
-import org.zkoss.zk.ui.util.Clients;
+
+import static hu.user.lis.ui.data.CachedDataModel.ASCENDING;
+import static hu.user.lis.ui.data.CachedDataModel.NATURAL;
@Log4j2
public class AssociatesViewModel extends FilterActiveViewModel<Associate> {
AssociatesDataModel associatesDataModel;
@Override
- CachedSpringDataModel<Associate> getDataModel() {
+ protected CachedSpringDataModel<Associate> getDataModel() {
return associatesDataModel;
}
@Init
public void init() {
super.init();
- Clients.evalJavaScript("pushNav('/associates')");
+ addColumn("name", ASCENDING);
+ addColumn("login", NATURAL);
+ addColumn("active", NATURAL);
}
+
protected void refresh() {
associatesDataModel.clearSelection();
- selectedEntity = null;
- if (filterShowBoth) {
+ setSelectedEntity(null);
+ if (isFilterShowBoth()) {
associatesDataModel.search(true, true);
} else {
- associatesDataModel.search(filterShowActive, filterShowInActive);
+ associatesDataModel.search(isFilterShowActive(), isFilterShowInActive());
}
}
@Command
public void onEdit() {
- Associate entity = associatesDataModel.clone(selectedEntity);
- Editors.doEdit(Editors.ASSOCIATE, entity, selectedEntity, modifiedEntity -> {
+ Associate entity = associatesDataModel.clone(getSelectedEntity());
+ Editors.doEdit(Editors.ASSOCIATE, entity, getSelectedEntity(), modifiedEntity -> {
associatesDataModel.save(modifiedEntity);
refresh();
});
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;
import hu.user.lis.ui.event.EventBus;
import hu.user.lis.ui.session.SessionSettings;
import lombok.Getter;
public class IndexViewModel implements EventListener {
private static final String PARTNERS_LIST = "~./partners.zul";
private static final String PROJECTS_LIST = "~./projects.zul";
- private static final String PROJECT_EDITOR = "~./project-editor.zul";
private static final String ASSOCIATES_LIST = "~./associates.zul";
private static final String PROJECT_ASSOCIATES_LIST = "~./project-associates.zul";
private static final String SERVICE_RECORDS_LIST = "~./service-records.zul";
public static Map<String, String> NAVIGATION = ImmutableMap.of(
Constants.NAV_PARTNERS, PARTNERS_LIST,
Constants.NAV_PROJECTS, PROJECTS_LIST,
- Constants.NAV_PROJECT, PROJECT_EDITOR,
+ Constants.NAV_PROJECT, Editors.PROJECT,
Constants.NAV_ASSOCIATES, ASSOCIATES_LIST,
Constants.NAV_PROJECT_ASSOCIATES, PROJECT_ASSOCIATES_LIST,
Constants.NAV_SERVICE_RECORDS, SERVICE_RECORDS_LIST,
eventBus.register(this);
log.info("Current session is {}", sessionSettings.getSessionId());
String path = sessionSettings.getCurrentPath();
-
- //project editor
route(path);
-
-// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-// if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) {
-// }
log.info("Init {}", path);
}
private void route(String path) {
if (path.startsWith("/project/") && path.split("/").length > 2) {
String id = path.split("/")[2];
- selectPage(PROJECT_EDITOR);
-// eventBus.setProjectEditorData(Collections.singletonMap("id", id));
+ selectPage(Editors.PROJECT);
eventBus.setProjectEditorData(Long.parseLong(id));
} else {
if (NAVIGATION.containsKey(path)) {
eventBus.setServiceRecordsListData(event.getData());
}
if (Constants.SHOW_PROJECT_EDITOR.equals(event.getName())) {
- selectPage(PROJECT_EDITOR);
+ selectPage(Editors.PROJECT);
eventBus.setProjectEditorData((Long) event.getData());
}
if (Constants.SHOW_PROJECTS_LIST.equals(event.getName())) {
import hu.user.lis.ui.Constants;
import hu.user.lis.ui.data.CachedSpringDataModel;
import hu.user.lis.ui.data.PartnersDataModel;
-import hu.user.lis.ui.editor.Editors;
+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.annotation.Command;
import org.zkoss.bind.annotation.Init;
-import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
+import static hu.user.lis.ui.data.CachedDataModel.ASCENDING;
+import static hu.user.lis.ui.data.CachedDataModel.NATURAL;
+
@Log4j2
public class PartnersViewModel extends FilterActiveViewModel<Partner> {
@WireVariable
PartnersDataModel partnersDataModel;
@Override
- CachedSpringDataModel<Partner> getDataModel() {
+ protected CachedSpringDataModel<Partner> getDataModel() {
return partnersDataModel;
}
@Init
public void init() {
super.init();
+ addColumn("name", ASCENDING);
+ addColumn("vatNr", NATURAL);
+ addColumn("address", NATURAL);
+ addColumn("active", NATURAL);
}
protected void refresh() {
partnersDataModel.clearSelection();
- if (filterShowBoth) {
+ if (isFilterShowBoth()) {
partnersDataModel.search(true, true);
} else {
- partnersDataModel.search(filterShowActive, filterShowInActive);
+ partnersDataModel.search(isFilterShowActive(), isFilterShowInActive());
}
}
- @Command
- @NotifyChange("selectedPartner")
- public void search() {
- }
-
@Command
public void onAdd() {
Partner entity = partnersDataModel.createNew();
@Command
public void onEdit() {
- Partner entity = partnersDataModel.clone(selectedEntity);
- Editors.doEdit(Editors.PARTNER, entity, selectedEntity, modifiedEntity -> {
+ Partner entity = partnersDataModel.clone(getSelectedEntity());
+ Editors.doEdit(Editors.PARTNER, entity, getSelectedEntity(), modifiedEntity -> {
partnersDataModel.save(modifiedEntity);
refresh();
});
import hu.user.lis.ui.data.CachedSpringDataModel;
import hu.user.lis.ui.data.ProjectsDataModel;
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.annotation.Command;
import org.zkoss.bind.annotation.Destroy;
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 java.util.Map;
import java.util.Objects;
+import static hu.user.lis.ui.data.CachedDataModel.ASCENDING;
+import static hu.user.lis.ui.data.CachedDataModel.NATURAL;
+
@Log4j2
public class ProjectsViewModel extends FilterActiveViewModel<Project> implements EventListener {
EventBus eventBus;
@Override
- CachedSpringDataModel<Project> getDataModel() {
+ protected CachedSpringDataModel<Project> getDataModel() {
return projectsDataModel;
}
public void init() {
super.init();
eventBus.register(this);
+ addColumn("humanId", ASCENDING);
+ addColumn("partner.name", NATURAL);
+ addColumn("projectStatus.name", NATURAL);
+ addColumn("name", NATURAL);
+ addColumn("contactName", NATURAL);
+ addColumn("active", NATURAL);
}
protected void refresh() {
projectsDataModel.clearSelection();
- selectedEntity = null;
- if (filterShowBoth) {
+ setSelectedEntity(null);
+ if (isFilterShowBoth()) {
projectsDataModel.search(true, true);
} else {
- projectsDataModel.search(filterShowActive, filterShowInActive);
+ projectsDataModel.search(isFilterShowActive(), isFilterShowInActive());
}
}
- @Command
- @NotifyChange("selectedProject")
- public void search() {
- }
-
@Command
public void onAdd() {
eventBus.showProjectEditor(null);
@Command
public void onEdit() {
- if (Objects.nonNull(selectedEntity)) {
- Project editEntity = entityDataService.clone(selectedEntity);
+ if (Objects.nonNull(getSelectedEntity())) {
+ Project editEntity = getEntityDataService().clone(getSelectedEntity());
eventBus.showProjectEditor(editEntity.getId());
}
}
-
@Override
public void onEvent(Event event) {
if (Constants.SET_PROJECTS_LIST_DATA.equals(event.getName())) {
- log.info("Apply Project edit result");
- projectsDataModel.clearSelection();
Map<String, Project> args = (Map<String, Project>) event.getData();
Project formDocument = args.get("formDocument");
+ projectsDataModel.clearSelection();
refresh();
projectsDataModel.addToSelection(formDocument);
- selectedEntity = formDocument;
}
}
@Destroy
public void onDestroy() {
- log.info("Destroy {}");
eventBus.unregister(this);
}
package hu.user.lis.ui.view;
-import com.google.common.collect.ImmutableMap;
import hu.user.lis.db.Associate;
import hu.user.lis.db.Project;
import hu.user.lis.db.ServiceRecord;
import hu.user.lis.ui.Constants;
-import hu.user.lis.ui.data.AssociateSelectorDataModel;
import hu.user.lis.ui.data.CachedSpringDataModel;
-import hu.user.lis.ui.data.ProjectSelectorDataModel;
import hu.user.lis.ui.data.ServiceRecordsDataModel;
+import hu.user.lis.ui.editor.common.Editors;
+import hu.user.lis.ui.editor.selector.EntitySelectorRouter;
import hu.user.lis.ui.event.EventBus;
+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.Executions;
-import org.zkoss.zk.ui.event.*;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.EventListener;
+import org.zkoss.zk.ui.event.SortEvent;
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.Map;
import java.util.Objects;
+import static hu.user.lis.ui.data.CachedDataModel.ASCENDING;
+import static hu.user.lis.ui.data.CachedDataModel.NATURAL;
+
@Log4j2
@VariableResolver(DelegatingVariableResolver.class)
@Getter
ServiceRecordsDataModel serviceRecordsDataModel;
- @WireVariable
@Getter
- private AssociateSelectorDataModel associateSelectorDataModel;
-
@WireVariable
- @Getter
- private ProjectSelectorDataModel projectSelectorDataModel;
+ EntitySelectorRouter entitySelectorRouter;
@Getter
private Project filterProject;
private EventBus eventBus;
@Override
- CachedSpringDataModel<ServiceRecord> getDataModel() {
+ protected CachedSpringDataModel<ServiceRecord> getDataModel() {
return serviceRecordsDataModel;
}
public void init() {
super.init();
eventBus.register(this);
+ eventBus.registerForBinding(this);
+ addColumn("project.humanId", ASCENDING);
+ addColumn("project.name", NATURAL);
+ addColumn("project.partner.name", NATURAL);
+ addColumn("associate.name", NATURAL);
+ addColumn("workDay", NATURAL);
+ addColumn("description", NATURAL);
+ addColumn("workHours", NATURAL);
}
- @Command
- public void onProjectFilterBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- InputEvent event = (InputEvent) ctx.getTriggerEvent();
- log.info("onProjectFilterBandChanging: {}", event.getValue());
- projectSelectorDataModel.search(event.getValue());
- }
-
- @Command
- public void onProjectFilterBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
- log.info("onProjectFilterBandOpen: {}", event.isOpen());
- projectSelectorDataModel.search(null);
- }
-
- @Command
- public void onAssociateFilterBandChanging(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- InputEvent event = (InputEvent) ctx.getTriggerEvent();
- log.info("onAssociateFilterBandChanging: {}", event.getValue());
- associateSelectorDataModel.search(event.getValue());
- }
-
- @Command
- public void onAssociateFilterBandOpen(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
- OpenEvent event = (OpenEvent) ctx.getTriggerEvent();
- log.info("onAssociateFilterBandOpen: {}", event.isOpen());
- associateSelectorDataModel.search(null);
+ @AfterCompose
+ public void onAfterCompose(@ContextParam(ContextType.VIEW) Component view) {
+ entitySelectorRouter.setFormDocument(Associate.class, this, "filterAssociate");
+ entitySelectorRouter.setFormDocument(Project.class, this, "filterProject");
}
private void refresh() {
serviceRecordsDataModel.clearSelection();
- selectedEntity = null;
- serviceRecordsDataModel.listAll();
- }
-
- @Command
- @NotifyChange("selectedProject")
- public void search() {
+ setSelectedEntity(null);
+ if (Objects.nonNull(filterProject) || Objects.nonNull(filterAssociate)) {
+ serviceRecordsDataModel.search(filterProject, filterAssociate);
+ } else {
+ serviceRecordsDataModel.listAll();
+ }
}
@Command
public void onAdd() {
- String page = "~./service-record-editor.zul";
- ServiceRecord newEntity = serviceRecordsDataModel.createNew();
- Window editorWindow = (Window) Executions.createComponents(page, null,
- Collections.singletonMap("formDocument", newEntity));
- editorWindow.addEventListener("onClose", e -> {
- if (e.getData() != null) {
- log.info("Partner popup result {}", e.getData());
- serviceRecordsDataModel.addNew(newEntity);
- serviceRecordsDataModel.clearSelection();
- refresh();
- serviceRecordsDataModel.addToSelection(newEntity);
- selectedEntity = newEntity;
- }
+ ServiceRecord entity = serviceRecordsDataModel.createNew();
+ Editors.doEdit(Editors.SERVICE_RECORD, entity, modifiedEntity -> {
+ serviceRecordsDataModel.save(modifiedEntity);
+ refresh();
+ serviceRecordsDataModel.addToSelection(modifiedEntity);
});
- editorWindow.doModal();
- editorWindow.setFocus(true);
}
@Command
public void onEdit() {
- if (Objects.isNull(selectedEntity)) {
- return;
- }
- String page = "~./service-record-editor.zul";
- ServiceRecord editEntity = serviceRecordsDataModel.copy(selectedEntity);
- Map<String, Object> arg = ImmutableMap.of("origDocument", selectedEntity, "formDocument", editEntity);
- Window editorWindow = (Window) Executions.createComponents(page, null, arg);
- editorWindow.addEventListener("onClose", e -> {
- if (e.getData() != null) {
- log.info("Partner popup result {}", e.getData());
- ServiceRecord modifiedEntity = (ServiceRecord) e.getData();
- serviceRecordsDataModel.clearSelection();
- serviceRecordsDataModel.save(modifiedEntity);
- refresh();
- serviceRecordsDataModel.addToSelection(modifiedEntity);
- selectedEntity = modifiedEntity;
- }
+ ServiceRecord entity = serviceRecordsDataModel.clone(getSelectedEntity());
+ Editors.doEdit(Editors.SERVICE_RECORD, entity, getSelectedEntity(), modifiedEntity -> {
+ serviceRecordsDataModel.save(modifiedEntity);
+ refresh();
});
- editorWindow.doModal();
- editorWindow.setFocus(true);
- }
-
- public void setFilterProject(Project filterProject) {
- this.filterProject = filterProject;
- serviceRecordsDataModel.search(filterProject, filterAssociate);
- }
-
- public void setFilterAssociate(Associate filterAssociate) {
- this.filterAssociate = filterAssociate;
- serviceRecordsDataModel.search(filterProject, filterAssociate);
}
@Command
public void onClearFilters() {
filterAssociate = null;
filterProject = null;
+ entitySelectorRouter.setFormDocument(Associate.class, this, "filterAssociate");
+ entitySelectorRouter.setFormDocument(Project.class, this, "filterProject");
serviceRecordsDataModel.listAll();
}
Map<String, Object> data = (Map<String, Object>) evt.getData();
filterAssociate = (Associate) data.get("filterAssociate");
filterProject = (Project) data.get("filterProject");
+ entitySelectorRouter.setFormDocument(Associate.class, this, "filterAssociate");
+ entitySelectorRouter.setFormDocument(Project.class, this, "filterProject");
serviceRecordsDataModel.search(filterProject, filterAssociate);
- BindUtils.postNotifyChange(this, "filterProject", "filterAssociate");
+ }
+
+ if (evt instanceof PropertyChangeEvent) {
+ PropertyChangeEvent propertyEvent = (PropertyChangeEvent) evt;
+ if (Objects.nonNull(propertyEvent.getBase()) && propertyEvent.getBase().equals(this)) {
+ if ("filterProject".equals(propertyEvent.getProperty()) || "filterAssociate".equals(propertyEvent.getProperty())) {
+ serviceRecordsDataModel.search(filterProject, filterAssociate);
+ }
+ }
}
}
log.info("Destroy {}", getClass().getSimpleName());
eventBus.unregister(this);
}
+
+ @Command
+ public void onDelete() {
+ serviceRecordsDataModel.delete(getSelectedEntity());
+ refresh();
+ }
}
import hu.user.lis.db.ProjectStatus;
import hu.user.lis.ui.data.ProjectStatusDataModel;
+import hu.user.lis.ui.view.common.AsyncBaseModel;
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
import org.zkoss.bind.annotation.BindingParam;
@WireVariable
@Getter
ProjectStatusDataModel projectStatusDataModel;
+
@Getter
private ProjectStatus selectedProjectStatus;
log.info("Initialized");
}
-// @Command
-// @NotifyChange("selectedProjectStatus")
-// public void onListSelection() {
-// selectedProjectStatus = null;
-// Set<ProjectStatus> selections = projectStatusDataModel.getSelection();
-// if (selections.size() == 1) {
-// selectedProjectStatus = selections.iterator().next();
-// log.info("Selected {}", selectedProjectStatus);
-// }
-// }
-
@Command
public void onMoveUp() {
projectStatusDataModel.moveUp(selectedProjectStatus);
}
@Command
- public void onAppend() {
- projectStatusDataModel.append();
+ public void onCreate() {
+ projectStatusDataModel.create();
+ projectStatusDataModel.listAll();
+ }
+
+ @Command
+ public void onDelete() {
+ projectStatusDataModel.delete(selectedProjectStatus);
projectStatusDataModel.listAll();
}
+++ /dev/null
-package hu.user.lis.ui.view;
-
-import hu.user.lis.db.Supplier;
-import hu.user.lis.ui.data.FormDocument;
-import hu.user.lis.ui.data.SuppliersDataModel;
-import lombok.Getter;
-import lombok.Setter;
-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.bind.annotation.NotifyChange;
-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.zk.ui.select.annotation.WireVariable;
-import org.zkoss.zkplus.spring.DelegatingVariableResolver;
-import org.zkoss.zul.Window;
-
-import java.util.Set;
-
-@Log4j2
-@Getter
-@Setter
-@VariableResolver(DelegatingVariableResolver.class)
-public class SuppliersViewModel {
- private FormDocument formDocument;
- private boolean canEdit;
- private String partialName;
- private String partialZipCode;
-
- private Supplier selectedSupplier;
- @WireVariable
- SuppliersDataModel suppliersDataModel;
-
- @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
- @NotifyChange("formDocument")
- public void search() {
- suppliersDataModel.clearSelection();
- formDocument = null;
- suppliersDataModel.search(partialName, partialZipCode);
- }
-
- @Command
- @NotifyChange({"formDocument", "partialName", "partialZipCode"})
- public void listAll() {
- suppliersDataModel.clearSelection();
- formDocument = null;
- partialName = null;
- partialZipCode = null;
- suppliersDataModel.listAll();
- }
-
- @Command
- @NotifyChange("formDocument")
- public void onListSelection() {
- formDocument = null;
- selectedSupplier = null;
- Set<Supplier> selections = suppliersDataModel.getSelection();
- if (selections.iterator().hasNext()) {
- selectedSupplier = selections.iterator().next();
- formDocument = FormDocument.builder().build()
- .setData(selectedSupplier);
- log.info("Selected {}", formDocument);
- }
- }
-
- @Command
- public void onCloseWindow(@BindingParam("target") Window target, @BindingParam("select") boolean select) {
- Event closeEvent = new Event("onClose", target, select ? selectedSupplier : null);
- Events.postEvent(closeEvent);
- }
-}
-package hu.user.lis.ui.view;
+package hu.user.lis.ui.view.common;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Command;
-package hu.user.lis.ui.view;
+package hu.user.lis.ui.view.common;
import hu.user.lis.services.data.EntityDataService;
import hu.user.lis.ui.data.CachedSpringDataModel;
import lombok.Getter;
+import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.zkoss.bind.annotation.*;
+import org.zkoss.json.JSONObject;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.Selectors;
import org.zkoss.zk.ui.select.annotation.VariableResolver;
public abstract class EntityViewModel<T extends Serializable> {
@Getter
+ @Setter
T selectedEntity;
+
+ @Getter
@WireVariable
EntityDataService<T> entityDataService;
- abstract CachedSpringDataModel<T> getDataModel();
+ protected void addColumn(String name, String direction) {
+ getDataModel().addColumn(name, direction);
+ }
+
+ public JSONObject getCols() {
+ return getDataModel().getCols();
+ }
+
+ abstract protected CachedSpringDataModel<T> getDataModel();
@AfterCompose
public void onAfterCompose(@ContextParam(ContextType.VIEW) Component view) {
-package hu.user.lis.ui.view;
+package hu.user.lis.ui.view.common;
import lombok.extern.log4j.Log4j2;
import org.zkoss.bind.annotation.Init;
-package hu.user.lis.ui.view;
+package hu.user.lis.ui.view.common;
public interface UITask {
void execute();
<?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>
+ <!-- <style>-->
+ <!-- .z-listitem-selected>.z-listcell>.z-listcell-content {-->
+ <!-- font-weight: bold;-->
+ <!-- }-->
+ <!-- </style>-->
<window vflex="true" viewModel="@id('vm') @init('hu.user.lis.ui.view.AssociatesViewModel')">
<caption label="Munkatársak"/>
<borderlayout>
autopaging="true" mold="paging" pagingPosition="top" multiple="false"
onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')">
<listhead sizable="true">
- <listheader label="Név" sort="auto(name)" align="left"/>
- <listheader label="Login" sort="auto(login)" align="left"/>
- <listheader label="Aktív" sort="auto(active)" align="left"/>
+ <listheader label="Név" sort="auto(name)" align="left"
+ sortDirection="@load(vm.cols['name'].sortDirection)"/>
+ <listheader label="Login" sort="auto(login)" align="left"
+ sortDirection="@load(vm.cols['login'].sortDirection)"/>
+ <listheader label="Aktív" sort="auto(active)" align="left"
+ sortDirection="@load(vm.cols['active'].sortDirection)"/>
+
</listhead>
<template name="model">
<listitem>
<?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"?>
+<?component name="entity-selector" inline="true" class="hu.user.lis.ui.editor.widget.EntitySelector"?>
<zk>
<zscript>
import hu.user.lis.db.Currency;
value="@bind(vm.formDocument.title) @validator(vm)"
forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
<label value="Partner"/>
- <partner-selector/>
+ <entity-selector entity="Partner"/>
<hlayout>
<vlayout>
<label value="Sorszám"/>
<?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"?>
+<?component name="entity-selector" inline="true" class="hu.user.lis.ui.editor.widget.EntitySelector"?>
<zk>
<zscript>
import hu.user.lis.db.Currency;
value="@bind(vm.formDocument.title) @validator(vm)"
forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
<label value="Partner"/>
- <partner-selector/>
+ <entity-selector entity="Partner"/>
<hlayout>
<vlayout>
<label value="Sorszám"/>
--- /dev/null
+<?component name="entity-selector" inline="true" class="hu.user.lis.ui.editor.widget.EntitySelector"?>
+<zk>
+ <window id="projectEditor" hflex="true" vflex="true"
+ viewModel="@id('vm') @init('hu.user.lis.ui.editor.ProjectEditorModel')"
+ validationMessages="@id('vmsgs')">
+ <caption label="Projekt szerkesztés"/>
+ <borderlayout>
+ <center id="centerPanel" border="none" vflex="true" hflex="true" autoscroll="true">
+ <vlayout hflex="true" vflex="min">
+ <hbox spacing="0" width="100%">
+ <window border="none" hflex="true" vflex="true">
+ <tabbox height="250px">
+ <tabs>
+ <tab label="Adatok" selected="true"/>
+ </tabs>
+ <tabpanels>
+ <tabpanel>
+ <grid sclass="no-hover-grid" oddRowSclass="none"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ <columns visible="false">
+ <column width="40%"/>
+ <column width="60%"/>
+ </columns>
+ <rows>
+ <row>
+ <vlayout>
+ <label value="Azonosító"/>
+ <textbox instant="true" width="100%"
+ value="@bind(vm.formDocument.humanId) @validator(vm)"
+ readonly="true"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
+ </vlayout>
+ <vlayout>
+ <label value="Megnevezés"/>
+ <textbox instant="true" width="100%"
+ value="@bind(vm.formDocument.name) @validator(vm)"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
+ </vlayout>
+ </row>
+ <row>
+ <vlayout>
+ <label value="Ügyfél"/>
+ <entity-selector entity="Partner"/>
+ </vlayout>
+ <vlayout>
+ <label value="Kapcsolattartó"/>
+ <textbox instant="true" width="100%"
+ value="@bind(vm.formDocument.contactName) @validator(vm)"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
+ <label value="@bind(vmsgs[self.previousSibling])"/>
+ </vlayout>
+ </row>
+ <row>
+ <vlayout>
+ <label value="Státusz"/>
+ <selectbox model="@load(vm.projectStatusDataModel)"
+ width="100%"
+ selectedIndex="@bind(vm.formDocument.projectStatus) @converter(vm.projectStatusConverter) @validator(vm)"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ <template name="model">
+ ${each.name}
+ </template>
+ </selectbox>
+ </vlayout>
+ <vlayout>
+ <label value="Aktív"/>
+ <checkbox mold="switch"
+ checked="@bind(vm.formDocument.active) @validator(vm)"/>
+ </vlayout>
+ </row>
+ </rows>
+ </grid>
+ </tabpanel>
+ </tabpanels>
+ </tabbox>
+ </window>
+
+ <window border="none" hflex="true" vflex="true">
+ <tabbox height="250px">
+ <tabs>
+ <tab label="Árrés" selected="true"/>
+ </tabs>
+ <tabpanels>
+ <tabpanel>
+ <vlayout vflex="true">
+ <grid sclass="no-hover-grid" oddRowSclass="none"
+ model="@load(vm.incomeMarginsDataModel)"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick"
+ emptyMessage="Nem kalkulálható!">
+ <columns visible="false">
+ <column width="50px" label="Pénznem"/>
+ <column width="100%" label="Összeg"/>
+ </columns>
+ <rows>
+ <template name="model">
+ <row>
+ <label value="@load(each.currency)"/>
+ <label value="@load(each.amount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
+ </row>
+ </template>
+ </rows>
+ </grid>
+
+ </vlayout>
+ </tabpanel>
+ </tabpanels>
+ </tabbox>
+ </window>
+ </hbox>
+
+ <include src="~./editor/project/outgoing-invoices.zul"/>
+ <include src="~./editor/project/incoming-invoices.zul"/>
+ <include src="~./editor/project/treasuries.zul"/>
+ <include src="~./editor/project/service-records.zul"/>
+ <include src="~./editor/project/project-associates.zul"/>
+
+ </vlayout>
+ </center>
+ <south border="none" flex="true" style="text-align: right; padding: 10px;">
+ <hlayout>
+ <button id="cancel" label="Mégsem"
+ onClick="@command('onEndEdit', target=projectEditor, save=false)"/>
+ <button id="submit" label="Mentés"
+ onClick="@command('onEndEdit', target=projectEditor, save=true)"
+ disabled="@bind(not vm.saveEnabled)"/>
+ </hlayout>
+ </south>
+ </borderlayout>
+ </window>
+</zk>
\ No newline at end of file
--- /dev/null
+<zk>
+ <panel collapsible="true" open="false" border="rounded"
+ onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
+ <caption label="Bejövő számlák" style="cursor: pointer"
+ onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
+ <panelchildren>
+ <vlayout>
+ <toolbar>
+ <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus"
+ onClick="@command('onAddIncoming')"/>
+ <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit"
+ onClick="@command('onEditIncoming')"
+ disabled="@load(empty vm.selectedIncomingInvoice)"/>
+ <toolbarbutton label="Törlés" iconSclass="z-icon-remove"
+ onClick="@command('onRemoveIncoming')"
+ disabled="@load(empty vm.selectedIncomingInvoice)"/>
+ </toolbar>
+ <listbox model="@load(vm.formDocument.incomingInvoices)"
+ selectedItem="@bind(vm.selectedIncomingInvoice)"
+ onDoubleClick="@command('onEditIncoming')"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ <listhead sizable="true">
+ <listheader label="Szállító" sort="auto(partner.name)" align="left"/>
+ <listheader label="Sorszám" sort="auto(humanId)" align="left"/>
+ <listheader label="Megnevezés" sort="auto(title)" align="left"/>
+ <listheader label="Nettó összeg" sort="auto(netAmount)" align="right"
+ style="text-align: center"/>
+ <listheader label="Pénznem" sort="auto(currency)" align="left"/>
+ <listheader label="Teljesítés" sort="auto(completionDate)" align="left"/>
+ <listheader label="Fizetési határidő" sort="auto(paymentDeadline)"
+ align="left"/>
+ </listhead>
+ <template name="model">
+ <listitem>
+ <listcell label="@load(each.partner.name)"/>
+ <listcell label="@load(each.humanId)"/>
+ <listcell label="@load(each.title)"/>
+ <listcell
+ label="@load(each.netAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
+ <listcell label="@load(each.currency)"/>
+ <listcell
+ label="@load(each.completionDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
+ <listcell
+ label="@load(each.paymentDeadline) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
+ </listitem>
+ </template>
+ </listbox>
+ </vlayout>
+ </panelchildren>
+ </panel>
+</zk>
\ No newline at end of file
--- /dev/null
+<zk>
+ <panel collapsible="true" open="false" border="rounded"
+ onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
+ <caption label="Kimenő számlák" style="cursor: pointer"
+ onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
+ <panelchildren>
+ <vlayout>
+ <toolbar>
+ <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus"
+ onClick="@command('onAddOutgoing')"/>
+ <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit"
+ onClick="@command('onEditOutgoing')"
+ disabled="@load(empty vm.selectedOutgoingInvoice)"/>
+ <toolbarbutton label="Törlés" iconSclass="z-icon-remove"
+ onClick="@command('onRemoveOutgoing')"
+ disabled="@load(empty vm.selectedOutgoingInvoice)"/>
+ </toolbar>
+ <listbox model="@load(vm.formDocument.outgoingInvoices)"
+ selectedItem="@bind(vm.selectedOutgoingInvoice)"
+ onDoubleClick="@command('onEditOutgoing')"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ <listhead sizable="true">
+ <listheader label="Vevő" sort="auto(partner.name)" align="left"/>
+ <listheader label="Sorszám" sort="auto(humanId)" align="left"/>
+ <listheader label="Megnevezés" sort="auto(title)" align="left"/>
+ <listheader label="Nettó összeg" sort="auto(netAmount)" align="right"
+ style="text-align: center"/>
+ <listheader label="Pénznem" sort="auto(currency)" align="left"/>
+ <listheader label="Teljesítés" sort="auto(completionDate)" align="left"/>
+ <listheader label="Fizetési határidő" sort="auto(paymentDeadline)"
+ align="left"/>
+ </listhead>
+ <template name="model">
+ <listitem>
+ <listcell label="@load(each.partner.name)"/>
+ <listcell label="@load(each.humanId)"/>
+ <listcell label="@load(each.title)"/>
+ <listcell
+ label="@load(each.netAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
+ <listcell label="@load(each.currency)"/>
+ <listcell
+ label="@load(each.completionDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
+ <listcell
+ label="@load(each.paymentDeadline) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
+ </listitem>
+ </template>
+ </listbox>
+ </vlayout>
+ </panelchildren>
+ </panel>
+</zk>
\ No newline at end of file
--- /dev/null
+<zk>
+ <panel collapsible="true" open="false" border="rounded"
+ onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
+ <caption label="Résztvevők" style="cursor: pointer"
+ onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
+ <!-- <north flex="true">-->
+ <!-- <toolbar>-->
+ <!-- <textbox instant="true" value="@bind(vm.partialAssociateName)"/>-->
+ <!-- <toolbarbutton iconSclass="z-icon-remove"-->
+ <!-- onClick="@command('onResetAssociateFilter')"/>-->
+ <!-- </toolbar>-->
+ <!-- </north>-->
+ <panelchildren>
+ <listbox model="@load(vm.associatesDataModel)"
+ multiple="false">
+ <listhead sizable="true">
+ <listheader hflex="min" label="Tag" align="left"/>
+ <listheader label="Név" sort="auto(name)" align="left"/>
+ <listheader label="Login" sort="auto(login)" align="left"/>
+ </listhead>
+ <template name="model">
+ <listitem>
+ <listcell>
+ <checkbox checked="@bind(vm.formAssociates[each.id])"
+ onCheck="@command('onAssociateChecked')"/>
+ </listcell>
+ <listcell label="@load(each.name)"/>
+ <listcell label="@load(each.login)"/>
+ </listitem>
+ </template>
+ </listbox>
+ </panelchildren>
+ </panel>
+</zk>
\ No newline at end of file
--- /dev/null
+<zk>
+ <panel collapsible="true" open="false" border="rounded"
+ onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
+ <caption label="Munkalap összesítő" style="cursor: pointer"
+ onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
+ <panelchildren>
+ <listbox model="@load(vm.serviceRecordsDataModel)"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ <listhead sizable="true">
+ <listheader label="Munkatárs" sort="auto(associate.name)" align="left"/>
+ <listheader label="Óraszám" sort="auto(workHours)" align="right"
+ style="text-align: center"/>
+ <listheader label="Ráfordítás" sort="auto(cost)" align="right"
+ style="text-align: center"/>
+ </listhead>
+ <template name="model">
+ <listitem>
+ <listcell>
+ <a onClick="@command('showServiceRecords', associate=each.associate)"
+ label="@load(each.associate.name)"/>
+ </listcell>
+ <listcell label="@load(each.workHours)"/>
+ <listcell
+ label="@load(each.cost) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
+ </listitem>
+ </template>
+ </listbox>
+ </panelchildren>
+ </panel>
+</zk>
\ No newline at end of file
--- /dev/null
+<zk>
+ <panel collapsible="true" open="false" border="rounded"
+ onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
+ <caption label="Treasury műveletek" style="cursor: pointer"
+ onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
+ <panelchildren>
+ <vlayout>
+ <toolbar>
+ <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus"
+ onClick="@command('onAddTreasury')"/>
+ <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit"
+ onClick="@command('onEditTreasury')"
+ disabled="@load(empty vm.selectedTreasury)"/>
+ <toolbarbutton label="Törlés" iconSclass="z-icon-remove"
+ onClick="@command('onRemoveTreasury')"
+ disabled="@load(empty vm.selectedTreasury)"/>
+ </toolbar>
+
+ <listbox model="@load(vm.formDocument.treasuries)"
+ selectedItem="@bind(vm.selectedTreasury)"
+ onDoubleClick="@command('onEditTreasury')"
+ forward="onOK=submit.onClick, onCancel=cancel.onClick">
+ <auxhead>
+ <auxheader label="Eladás" colspan="2"/>
+ <auxheader label="Vétel" colspan="2"/>
+ <auxheader colspan="2"/>
+ </auxhead>
+
+ <listhead sizable="true">
+ <listheader label="Összeg" sort="auto(sellAmount)" align="right"
+ style="text-align: center"/>
+ <listheader label="Pénznem" sort="auto(sellCurrency)" align="left"/>
+ <listheader label="Összeg" sort="auto(buyAmount)" align="right"
+ style="text-align: center"/>
+ <listheader label="Pénznem" sort="auto(buyCurrency)" align="left"/>
+ <listheader label="Üzletkötés dátuma" sort="auto(transactionDate)"
+ align="left"/>
+ <listheader label="Értéknap" sort="auto(valueDate)" align="left"/>
+ </listhead>
+ <template name="model">
+ <listitem>
+ <listcell
+ label="@load(each.sellAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
+ <listcell label="@load(each.sellCurrency)"/>
+ <listcell
+ label="@load(each.buyAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
+ <listcell label="@load(each.buyCurrency)"/>
+ <listcell
+ label="@load(each.transactionDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
+ <listcell
+ label="@load(each.valueDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
+ </listitem>
+ </template>
+ </listbox>
+ </vlayout>
+ </panelchildren>
+ </panel>
+</zk>
\ No newline at end of file
-<?component name="associate-selector" inline="true" macroURI="~./associate-selector.zul"?>
-<?component name="project-selector" inline="true" macroURI="~./project-selector.zul"?>
+<?component name="entity-selector" inline="true" class="hu.user.lis.ui.editor.widget.EntitySelector"?>
<zk>
- <window id="serviceRecordPopup" width="50%" height="450px" closable="true"
+ <window id="serviceRecordPopup" width="50%" height="450px" closable="true" sizable="true" maximizable="true"
viewModel="@id('vm') @init('hu.user.lis.ui.editor.ServiceRecordEditorModel')">
<caption label="Munkalap szerkesztés"/>
<borderlayout>
<vlayout hflex="true">
<vlayout hflex="true">
<label value="Projekt"/>
- <project-selector hflex="true"/>
+ <entity-selector entity="Project" hflex="true"/>
</vlayout>
<hlayout>
<vlayout>
<label value="Munkatárs"/>
- <associate-selector/>
+ <entity-selector entity="Associate"/>
</vlayout>
<vlayout>
<label value="Munkanap"/>
<rows>
<row>
<label value="User"/>
- <textbox name="username" hflex="true" value="user"/>
+ <textbox name="username" hflex="true"/>
</row>
<row>
<label value="Password"/>
- <textbox type="password" name="password" hflex="true" value="password"/>
+ <textbox type="password" name="password" hflex="true"/>
</row>
<row spans="2" align="right">
<hlayout>
autopaging="true" mold="paging" pagingPosition="top" multiple="false"
onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')">
<listhead sizable="true">
- <listheader label="Név" sort="auto(name)" align="left"/>
- <listheader label="Adószám" sort="auto(vatNr)" align="left"/>
- <listheader label="Cím" sort="auto(address)" align="left"/>
- <listheader label="Aktív" sort="auto(active)" align="left"/>
+ <listheader label="Név" sort="auto(name)" align="left"
+ sortDirection="@load(vm.cols['name'].sortDirection)"/>
+ <listheader label="Adószám" sort="auto(vatNr)" align="left"
+ sortDirection="@load(vm.cols['vatNr'].sortDirection)"/>
+ <listheader label="Cím" sort="auto(address)" align="left"
+ sortDirection="@load(vm.cols['address'].sortDirection)"/>
+ <listheader label="Aktív" sort="auto(active)" align="left"
+ sortDirection="@load(vm.cols['active'].sortDirection)"/>
+
</listhead>
<template name="model">
<listitem>
+++ /dev/null
-<!--<?component name="partner-selector" inline="true" macroURI="~./partner-selector.zul"?>-->
-<?component name="entity-selector" inline="true" class="hu.user.lis.ui.editor.widget.EntitySelector"?>
-<zk>
- <window id="projectEditor" hflex="true" vflex="true"
- viewModel="@id('vm') @init('hu.user.lis.ui.editor.ProjectEditorModel')">
- <caption label="Projekt szerkesztés"/>
- <borderlayout>
- <center id="centerPanel" border="none" vflex="true" hflex="true" autoscroll="true">
- <vlayout hflex="true" vflex="min">
- <hbox spacing="0" width="100%">
- <window border="none" hflex="true" vflex="true">
- <tabbox height="250px">
- <tabs>
- <tab label="Adatok" selected="true"/>
- </tabs>
- <tabpanels>
- <tabpanel>
- <grid sclass="no-hover-grid" oddRowSclass="none"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <columns visible="false">
- <column width="40%"/>
- <column width="60%"/>
- </columns>
- <rows>
- <row>
- <vlayout>
- <label value="Azonosító"/>
- <textbox instant="true" width="100%"
- value="@bind(vm.formDocument.humanId) @validator(vm)"
- readonly="true"
- forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
- </vlayout>
- <vlayout>
- <label value="Megnevezés"/>
- <textbox instant="true" width="100%"
- value="@bind(vm.formDocument.name) @validator(vm)"
- forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
- </vlayout>
- </row>
- <row>
- <vlayout>
- <label id="label1" value="Ügyfél"/>
- <entity-selector entity="Partner"
- property="formDocument.partner"/>
- </vlayout>
- <vlayout>
- <label value="Kapcsolattartó"/>
- <textbox instant="true" width="100%"
- value="@bind(vm.formDocument.contactName) @validator(vm)"
- forward="onOK=submit.onClick, onCancel=cancel.onClick"/>
- </vlayout>
- </row>
- <row>
- <vlayout>
- <label value="Státusz"/>
- <selectbox model="@load(vm.projectStatusDataModel)"
- width="100%"
- selectedIndex="@bind(vm.formDocument.projectStatus) @converter(vm.projectStatusConverter) @validator(vm)"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <template name="model">
- ${each.name}
- </template>
- </selectbox>
- </vlayout>
- <vlayout>
- <label value="Aktív"/>
- <checkbox mold="switch"
- checked="@bind(vm.formDocument.active) @validator(vm)"/>
- </vlayout>
- </row>
- </rows>
- </grid>
- </tabpanel>
- </tabpanels>
- </tabbox>
- </window>
-
- <window border="none" hflex="true" vflex="true">
- <tabbox height="250px">
- <tabs>
- <tab label="Árrés" selected="true"/>
- </tabs>
- <tabpanels>
- <tabpanel>
- <vlayout vflex="true">
- <grid sclass="no-hover-grid" oddRowSclass="none"
- model="@load(vm.incomeMarginsDataModel)"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <columns visible="false">
- <column width="50px" label="Pénznem"/>
- <column width="100%" label="Összeg"/>
- </columns>
- <rows>
- <template name="model">
- <row>
- <label value="@load(each.currency)"/>
- <label value="@load(each.amount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
- </row>
- </template>
- </rows>
- </grid>
-
- </vlayout>
- </tabpanel>
- </tabpanels>
- </tabbox>
- </window>
- </hbox>
-
-
- <panel collapsible="true" open="false" border="rounded"
- onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
- <caption label="Kimenő számlák"
- onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
- <panelchildren>
- <vlayout>
- <toolbar>
- <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus"
- onClick="@command('onAddOutgoing')"/>
- <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit"
- onClick="@command('onEditOutgoing')"
- disabled="@load(empty vm.selectedOutgoingInvoice)"/>
- <toolbarbutton label="Törlés" iconSclass="z-icon-remove"
- onClick="@command('onRemoveOutgoing')"
- disabled="@load(empty vm.selectedOutgoingInvoice)"/>
- </toolbar>
- <listbox model="@load(vm.formDocument.outgoingInvoices)"
- selectedItem="@bind(vm.selectedOutgoingInvoice)"
- onDoubleClick="@command('onEditOutgoing')"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <listhead sizable="true">
- <listheader label="Vevő" sort="auto(partner.name)" align="left"/>
- <listheader label="Sorszám" sort="auto(humanId)" align="left"/>
- <listheader label="Megnevezés" sort="auto(title)" align="left"/>
- <listheader label="Nettó összeg" sort="auto(netAmount)" align="right"
- style="text-align: center"/>
- <listheader label="Pénznem" sort="auto(currency)" align="left"/>
- <listheader label="Teljesítés" sort="auto(completionDate)" align="left"/>
- <listheader label="Fizetési határidő" sort="auto(paymentDeadline)"
- align="left"/>
- </listhead>
- <template name="model">
- <listitem>
- <listcell label="@load(each.partner.name)"/>
- <listcell label="@load(each.humanId)"/>
- <listcell label="@load(each.title)"/>
- <listcell
- label="@load(each.netAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
- <listcell label="@load(each.currency)"/>
- <listcell
- label="@load(each.completionDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
- <listcell
- label="@load(each.paymentDeadline) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
- </listitem>
- </template>
- </listbox>
- </vlayout>
- </panelchildren>
- </panel>
-
- <panel collapsible="true" open="false" border="rounded"
- onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
- <caption label="Bejövő számlák"
- onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
- <panelchildren>
- <vlayout>
- <toolbar>
- <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus"
- onClick="@command('onAddIncoming')"/>
- <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit"
- onClick="@command('onEditIncoming')"
- disabled="@load(empty vm.selectedIncomingInvoice)"/>
- <toolbarbutton label="Törlés" iconSclass="z-icon-remove"
- onClick="@command('onRemoveIncoming')"
- disabled="@load(empty vm.selectedIncomingInvoice)"/>
- </toolbar>
- <listbox model="@load(vm.formDocument.incomingInvoices)"
- selectedItem="@bind(vm.selectedIncomingInvoice)"
- onDoubleClick="@command('onEditIncoming')"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <listhead sizable="true">
- <listheader label="Szállító" sort="auto(partner.name)" align="left"/>
- <listheader label="Sorszám" sort="auto(humanId)" align="left"/>
- <listheader label="Megnevezés" sort="auto(title)" align="left"/>
- <listheader label="Nettó összeg" sort="auto(netAmount)" align="right"
- style="text-align: center"/>
- <listheader label="Pénznem" sort="auto(currency)" align="left"/>
- <listheader label="Teljesítés" sort="auto(completionDate)" align="left"/>
- <listheader label="Fizetési határidő" sort="auto(paymentDeadline)"
- align="left"/>
- </listhead>
- <template name="model">
- <listitem>
- <listcell label="@load(each.partner.name)"/>
- <listcell label="@load(each.humanId)"/>
- <listcell label="@load(each.title)"/>
- <listcell
- label="@load(each.netAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
- <listcell label="@load(each.currency)"/>
- <listcell
- label="@load(each.completionDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
- <listcell
- label="@load(each.paymentDeadline) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
- </listitem>
- </template>
- </listbox>
- </vlayout>
- </panelchildren>
- </panel>
-
- <panel collapsible="true" open="false" border="rounded"
- onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
- <caption label="Treasury műveletek"
- onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
- <panelchildren>
- <vlayout>
- <toolbar>
- <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus"
- onClick="@command('onAddTreasury')"/>
- <toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit"
- onClick="@command('onEditTreasury')"
- disabled="@load(empty vm.selectedTreasury)"/>
- <toolbarbutton label="Törlés" iconSclass="z-icon-remove"
- onClick="@command('onRemoveTreasury')"
- disabled="@load(empty vm.selectedTreasury)"/>
- </toolbar>
-
- <listbox model="@load(vm.formDocument.treasuries)"
- selectedItem="@bind(vm.selectedTreasury)"
- onDoubleClick="@command('onEditTreasury')"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <auxhead>
- <auxheader label="Eladás" colspan="2"/>
- <auxheader label="Vétel" colspan="2"/>
- <auxheader colspan="2"/>
- </auxhead>
-
- <listhead sizable="true">
- <listheader label="Összeg" sort="auto(sellAmount)" align="right"
- style="text-align: center"/>
- <listheader label="Pénznem" sort="auto(sellCurrency)" align="left"/>
- <listheader label="Összeg" sort="auto(buyAmount)" align="right"
- style="text-align: center"/>
- <listheader label="Pénznem" sort="auto(buyCurrency)" align="left"/>
- <listheader label="Üzletkötés dátuma" sort="auto(transactionDate)"
- align="left"/>
- <listheader label="Értéknap" sort="auto(valueDate)" align="left"/>
- </listhead>
- <template name="model">
- <listitem>
- <listcell
- label="@load(each.sellAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
- <listcell label="@load(each.sellCurrency)"/>
- <listcell
- label="@load(each.buyAmount) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
- <listcell label="@load(each.buyCurrency)"/>
- <listcell
- label="@load(each.transactionDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
- <listcell
- label="@load(each.valueDate) @converter('hu.user.lis.ui.converter.DateToStringConverter')"/>
- </listitem>
- </template>
- </listbox>
- </vlayout>
- </panelchildren>
- </panel>
-
- <panel collapsible="true" open="false" border="rounded"
- onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
- <caption label="Munkalap összesítő"
- onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
- <panelchildren>
- <listbox model="@load(vm.serviceRecordsDataModel)"
- forward="onOK=submit.onClick, onCancel=cancel.onClick">
- <listhead sizable="true">
- <listheader label="Munkatárs" sort="auto(associate.name)" align="left"/>
- <listheader label="Óraszám" sort="auto(workHours)" align="right"
- style="text-align: center"/>
- <listheader label="Ráfordítás" sort="auto(cost)" align="right"
- style="text-align: center"/>
- </listhead>
- <template name="model">
- <listitem>
- <listcell>
- <a onClick="@command('showServiceRecords', associate=each.associate)"
- label="@load(each.associate.name)"/>
- </listcell>
- <listcell label="@load(each.workHours)"/>
- <listcell
- label="@load(each.cost) @converter('hu.user.lis.ui.converter.DoubleToStringConverter')"/>
- </listitem>
- </template>
- </listbox>
- </panelchildren>
- </panel>
-
-
- <panel collapsible="true" open="false" border="rounded"
- onOpen="@command('onOpenFormPanel', parentPanel=centerPanel)">
- <caption label="Résztvevők"
- onClick="@command('onClickFormPanel', parentPanel=centerPanel, panel=self.parent)"/>
- <!-- <north flex="true">-->
- <!-- <toolbar>-->
- <!-- <textbox instant="true" value="@bind(vm.partialAssociateName)"/>-->
- <!-- <toolbarbutton iconSclass="z-icon-remove"-->
- <!-- onClick="@command('onResetAssociateFilter')"/>-->
- <!-- </toolbar>-->
- <!-- </north>-->
- <panelchildren>
- <listbox model="@load(vm.associatesDataModel)"
- multiple="false">
- <listhead sizable="true">
- <listheader hflex="min" label="Tag" align="left"/>
- <listheader label="Név" sort="auto(name)" align="left"/>
- <listheader label="Login" sort="auto(login)" align="left"/>
- </listhead>
- <template name="model">
- <listitem>
- <listcell>
- <checkbox checked="@bind(vm.formAssociates[each.id])"
- onCheck="@command('onAssociateChecked')"/>
- </listcell>
- <listcell label="@load(each.name)"/>
- <listcell label="@load(each.login)"/>
- </listitem>
- </template>
- </listbox>
- </panelchildren>
- </panel>
-
- </vlayout>
- </center>
- <south border="none" flex="true" style="text-align: right; padding: 10px;">
- <hlayout>
- <button id="cancel" label="Mégsem"
- onClick="@command('onEndEdit', target=projectEditor, save=false)"/>
- <button id="submit" label="Mentés"
- onClick="@command('onEndEdit', target=projectEditor, save=true)"
- disabled="@bind(not vm.saveEnabled)"/>
- </hlayout>
- </south>
- </borderlayout>
- </window>
-</zk>
\ No newline at end of file
autopaging="true" pagingPosition="top" multiple="false"
onSelect="@command('onListSelection')" onDoubleClick="@command('onEdit')">
<listhead sizable="true">
- <listheader label="Azonosító" sort="auto(humanId)" align="left"/>
- <listheader label="Ügyfél" sort="auto(partner.name)" align="left"/>
- <listheader label="Státusz" sort="auto(projectStatus.name)" align="left"/>
- <listheader label="Megnevezés" sort="auto(name)" align="left"/>
- <listheader label="Kapcsolattartó" sort="auto(contactName)" align="left"/>
- <listheader label="Aktív" sort="auto(active)" align="left"/>
+ <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>
-<?component name="associate-filter" inline="true" macroURI="~./associate-filter.zul"?>
-<?component name="project-filter" inline="true" macroURI="~./project-filter.zul"?>
+<?component name="entity-selector" inline="true" class="hu.user.lis.ui.editor.widget.EntitySelector"?>
<zk>
<window vflex="true" viewModel="@id('vm') @init('hu.user.lis.ui.view.ServiceRecordsViewModel')">
<caption label="Munkalapok"/>
<toolbarbutton label="Szerkesztés" iconSclass="z-icon-edit" onClick="@command('onEdit')"
disabled="@load(empty vm.selectedEntity)"/>
<separator orient="vertical"/>
+ <toolbarbutton label="Törlés" iconSclass="z-icon-minus" onClick="@command('onDelete')"
+ disabled="@load(empty vm.selectedEntity)"/>
+ <separator orient="vertical"/>
<label value="Projekt"/>
<separator orient="vertical"/>
- <project-filter/>
+ <entity-selector entity="Project" style="display: inline-block;" width="300px"/>
<separator orient="vertical"/>
<label value="Munkatárs"/>
<separator orient="vertical"/>
- <associate-filter/>
+ <entity-selector entity="Associate" style="display: inline-block;"/>
<toolbarbutton label="Nincs szűrés" iconSclass="z-icon-ban" onClick="@command('onClearFilters')"/>
</toolbar>
</north>
autopaging="true" mold="paging" pagingPosition="top" onSelect="@command('onListSelection')"
onDoubleClick="@command('onEdit')">
<listhead sizable="true">
- <!--
- https://www.zkoss.org/wiki/ZK_Component_Reference/Data/Listbox
- -->
<listheader label="Projekt azonosító" sort="auto(project.humanId)" align="left"
- sortDirection="ascending"/>
- <listheader label="Projekt név" sort="auto(project.name)" align="left"/>
- <listheader label="Partner név" sort="auto(project.partner.name)" align="left"/>
- <listheader label="Munkatárs" sort="auto(associate.name)" align="left"/>
- <listheader label="Munkanap" sort="auto(workDay)" align="left"/>
- <listheader label="Leírás" sort="auto(description)" align="left"/>
- <listheader label="Óraszám" sort="auto(workHours)" align="right" style="text-align: center"/>
+ sortDirection="@load(vm.cols['project.humanId'].sortDirection)"/>
+ <listheader label="Projekt név" sort="auto(project.name)" align="left"
+ sortDirection="@load(vm.cols['project.name'].sortDirection)"/>
+ <listheader label="Partner név" sort="auto(project.partner.name)" align="left"
+ sortDirection="@load(vm.cols['project.partner.name'].sortDirection)"/>
+ <listheader label="Munkatárs" sort="auto(associate.name)" align="left"
+ sortDirection="@load(vm.cols['associate.name'].sortDirection)"/>
+ <listheader label="Munkanap" sort="auto(workDay)" align="left"
+ sortDirection="@load(vm.cols['workDay'].sortDirection)"/>
+ <listheader label="Leírás" sort="auto(description)" align="left"
+ sortDirection="@load(vm.cols['description'].sortDirection)"/>
+ <listheader label="Óraszám" sort="auto(workHours)" align="right" style="text-align: center"
+ sortDirection="@load(vm.cols['workHours'].sortDirection)"/>
<listheader label="Aláírt" align="left"/>
</listhead>
<template name="model">
<toolbarbutton label="Le mozgat" iconSclass="z-icon-arrow-down" onClick="@command('onMoveUp')"
disabled="@load(empty vm.selectedProjectStatus)"/>
<separator orient="vertical"/>
- <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus" onClick="@command('onAppend')"/>
+ <toolbarbutton label="Hozzáadás" iconSclass="z-icon-plus" onClick="@command('onCreate')"/>
+ <toolbarbutton label="Törlés" iconSclass="z-icon-minus" onClick="@command('onDelete')"
+ disabled="@load(empty vm.selectedProjectStatus)"/>
</toolbar>
</north>
<center border="none" flex="true">
+.z-grid-emptybody td {
+/* font-size: 2em;*/
+ font-style: normal;
+}
+
.z-loading { left: 45% !important;
/*
top: 50% !important;
+++ /dev/null
-<?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.editor.Field$Text" ?>
-<zk xmlns:c="client">
- <window id="supplierPopup" title="Szállítók" width="80%" height="60%" closable="true"
- viewModel="@id('vm') @init('hu.user.lis.ui.view.SuppliersViewModel')">
- <style>
- .z-listitem-selected>.z-listcell>.z-listcell-content {
- font-weight: bold,;
- }
- </style>
-
- <borderlayout>
- <north flex="true">
- <toolbar>
- <label value="Név"/>
- <textbox id="partialName" value="@bind(vm.partialName)" onOK="@command('search')">
- <attribute c:name="_doKeyDown">
- <![CDATA[
- function (evt) {
- var keyCode = evt.keyCode;
- console.log(keyCode);
- Clients.log(keyCode);
- if (keyCode == 13){
- zk.$("$supplierSearchResult").focus();
- zk.$("$partialName").fireEvent('onSearch', {}, {toServer: true});
- return;
- }
- }
- ]]>
- </attribute>
- </textbox>
- <label value="Irányítószám"/>
- <textbox instant="true" value="@bind(vm.partialZipCode)" onOK="@command('search')"/>
- <toolbarbutton label="Keresés" iconSclass="z-icon-search" onClick="@command('search')"/>
- <toolbarbutton label="Mind" iconSclass="z-icon-search-plus" onClick="@command('listAll')"/>
- </toolbar>
- </north>
- <center border="none" flex="true">
- <listbox id="suppliersSearchResult" vflex="true" model="@load(vm.suppliersDataModel)"
- onSelect="@command('onListSelection')"
- onDoubleClick="@command('onCloseWindow', target=supplierPopup, select=true)">
- <listhead>
- <listheader label="Név" align="left"/>
- </listhead>
- <listfoot>
- <listfooter>
- <hlayout>
- <label value="Találatok: "/>
- <label value="@load(vm.suppliersDataModel.resultSetCount)"/>
- </hlayout>
- </listfooter>
- </listfoot>
- <template name="model">
- <listitem>
- <listcell label="@load(each.name)"/>
- </listitem>
- </template>
- </listbox>
- </center>
- <east title="Adatlap" size="60%" flex="true" splittable="true" collapsible="true">
- <div class="container u-form-width u-max-form-width">
- <div class="row">
- <text class="twelve columns" label="ID" field="id"/>
- </div>
- <div class="row">
- <text class="twelve columns" label="Név" field="name"/>
- </div>
- <div class="row">
- <text class="twelve columns" label="Irányítószám" field="zipCode"/>
- </div>
- </div>
- </east>
- <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)"/>
- </hlayout>
- </south>
- </borderlayout>
- </window>
-</zk>
\ No newline at end of file
<zk xmlns:c="client">
<hlayout viewModel="@id('vmEntity') @init(vm.getEntitySelectorRouter().getEntitySelectorModel(entity))">
- <bandbox id="entityBandBox" autodrop="true" iconSclass="z-icon-sort-down" hflex="true" mold="rounded"
+ <bandbox id="entityBandBox" autodrop="true" hflex="true" mold="rounded"
value="@load(vmEntity.selectedEntity) @converter(vmEntity.displayConverter)"
onChanging="@command('onEntityBandChanging')" onOpen="@command('onEntityBandOpen')"
forward="onOK=submit.onClick, onCancel=cancel.onClick">
}
]]>
</attribute>
- <bandpopup style="background: red" width="400px">
+ <bandpopup width="400px">
<listbox id="entityList" height="250px"
model="@bind(vmEntity.dataModel)"
selectedItem="@bind(vmEntity.selectedEntity)"
</listhead>
<template name="model">
<listitem>
- <listcell label="@load(each.name)"/>
+ <listcell label="@load(each) @converter(vmEntity.displayConverter)"/>
</listitem>
</template>
</listbox>