František Přibyl 9 years ago
commit 07d0949bea

@ -63,6 +63,8 @@ public class ModuleUtils {
} }
} }
continue;
} catch (ClassCastException e) { //nestandardní moduly neřeší...
continue; continue;
} }

@ -0,0 +1,25 @@
package info.bukova.isspst;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.ServletContext;
/**
* @author Pepa Rokos
*/
public class SpringUtils {
private static WebApplicationContext webCtx(ServletContext sc) {
return WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
}
public static Object getBean(String name, ServletContext sc) {
return webCtx(sc).getBean(name);
}
public static <T> T getBean(Class<T> clazz, ServletContext sc) {
return webCtx(sc).getBean(clazz);
}
}

@ -3,19 +3,18 @@ package info.bukova.isspst.data;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.Module; import info.bukova.isspst.Module;
import info.bukova.isspst.StringUtils; import info.bukova.isspst.StringUtils;
import org.hibernate.annotations.LazyCollection;
import java.util.Date; import org.hibernate.annotations.LazyCollectionOption;
import java.util.List; import org.hibernate.search.annotations.IndexedEmbedded;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.ArrayList;
import org.hibernate.annotations.LazyCollection; import java.util.Date;
import org.hibernate.annotations.LazyCollectionOption; import java.util.List;
import org.hibernate.search.annotations.IndexedEmbedded;
@Entity @Entity
@Table(name = "SIGNED_DOCUMENTS") @Table(name = "SIGNED_DOCUMENTS")
@ -105,6 +104,10 @@ public class SignedDocument extends BaseData {
} }
public void addItem(SignedDocumentItem item) { public void addItem(SignedDocumentItem item) {
if (items == null) {
items = new ArrayList<SignedDocumentItem>();
}
item.setSignedDocument(this); item.setSignedDocument(this);
this.items.add(item); this.items.add(item);
} }

@ -22,7 +22,7 @@ public class SignedDocumentItem {
private int id; private int id;
@Column(name = "REPORT_ID") @Column(name = "REPORT_ID")
private int reportId; private long reportId;
@Column(name = "REPORT_NAME", length = Constants.LEN_TEXT) @Column(name = "REPORT_NAME", length = Constants.LEN_TEXT)
private String reportName; private String reportName;
@ -42,11 +42,11 @@ public class SignedDocumentItem {
this.id = id; this.id = id;
} }
public int getReportId() { public long getReportId() {
return reportId; return reportId;
} }
public void setReportId(int reportId) { public void setReportId(long reportId) {
this.reportId = reportId; this.reportId = reportId;
} }

@ -1,15 +1,14 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.math.BigDecimal; import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import java.math.BigDecimal;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@Entity @Entity
@Table(name = "WORKFLOW") @Table(name = "WORKFLOW")
@ -25,6 +24,8 @@ public class Workflow extends BaseData {
private Integer wOrder; private Integer wOrder;
@Column(name = "WLIMIT", precision=15, scale=4) @Column(name = "WLIMIT", precision=15, scale=4)
private BigDecimal limit; private BigDecimal limit;
@Column(name = "SIGNATURE")
private Boolean signature;
public Boolean getCentre() { public Boolean getCentre() {
return centre; return centre;
@ -68,4 +69,11 @@ public class Workflow extends BaseData {
this.limit = limit; this.limit = limit;
} }
public Boolean getSignature() {
return signature;
}
public void setSignature(Boolean signature) {
this.signature = signature;
}
} }

@ -74,7 +74,7 @@ public class ParamFiller {
definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile())); definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
} }
AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1); AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getApproval().getAuthorization().size() - 1);
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate()); definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
User u = lastAuth.getApprover(); User u = lastAuth.getApprover();

@ -1,18 +1,21 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import java.io.File; import info.bukova.isspst.SpringUtils;
import info.bukova.isspst.data.DataModel;
import javax.servlet.ServletContext; import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import org.slf4j.Logger; import info.bukova.isspst.storage.ReportFileStorage;
import org.slf4j.LoggerFactory;
import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager; import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.util.JRProperties; import net.sf.jasperreports.engine.util.JRProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletContext;
import java.io.File;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class PredefinedGenerator implements Generator { public class PredefinedGenerator implements Generator {
@ -29,6 +32,11 @@ public class PredefinedGenerator implements Generator {
@Override @Override
public byte[] generate() { public byte[] generate() {
byte[] bytes = null; byte[] bytes = null;
SignedDocumentItem signedItem = getSignedDocument();
if (signedItem != null) {
return fromStorage(signedItem);
}
try { try {
JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile()); JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile());
@ -44,6 +52,18 @@ public class PredefinedGenerator implements Generator {
return bytes; return bytes;
} }
private byte[] fromStorage(SignedDocumentItem sdItem) {
ReportFileStorage reportStorage = SpringUtils.getBean(ReportFileStorage.class, ctx);
return reportStorage.fileData(sdItem);
}
private SignedDocumentItem getSignedDocument() {
SignedDocumentService sdService = SpringUtils.getBean(SignedDocumentService.class, ctx);
SignedDocumentItem sdItem = sdService.getItem((DataModel) definition.getDataSet().get(0), definition.getReport().getReportId());
return sdItem;
}
protected File getReportFile() { protected File getReportFile() {
return new File(ctx.getRealPath("WEB-INF/reports") + "/" + definition.getReport().getJasperFile() + ".jasper"); return new File(ctx.getRealPath("WEB-INF/reports") + "/" + definition.getReport().getJasperFile() + ".jasper");
} }

@ -1,17 +1,17 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import java.io.IOException; import info.bukova.isspst.storage.ReportFileStorage;
import java.io.OutputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
@Controller @Controller
public class ReportController { public class ReportController {
@ -21,6 +21,8 @@ public class ReportController {
private GeneratorFactory factory; private GeneratorFactory factory;
@Autowired @Autowired
private ParamFiller paramFiller; private ParamFiller paramFiller;
@Autowired
private ReportFileStorage reportFileStorage;
private static final String ERROR_MESSAGE = "<html><body><b>Generator returned no data!</b><br/>%s</body></html>"; private static final String ERROR_MESSAGE = "<html><body><b>Generator returned no data!</b><br/>%s</body></html>";
private final static Logger logger = LoggerFactory.getLogger(ReportController.class); private final static Logger logger = LoggerFactory.getLogger(ReportController.class);
@ -46,13 +48,20 @@ public class ReportController {
try { try {
os = response.getOutputStream(); os = response.getOutputStream();
if (reportDefinition.getReport() == null || reportDefinition.getDataSet() == null) { if ((reportDefinition.getReport() == null || reportDefinition.getDataSet() == null) && reportDefinition.getSignedDocItem() == null) {
throw new ReportException("Definition is null"); throw new ReportException("Definition is null");
} }
byte[] data;
if (reportDefinition.getSignedDocItem() == null) {
paramFiller.fill(); paramFiller.fill();
Generator gen = factory.createGenerator(reportDefinition); Generator gen = factory.createGenerator(reportDefinition);
byte[] data = gen.generate(); data = gen.generate();
} else {
data = reportFileStorage.fileData(reportDefinition.getSignedDocItem());
}
response.setContentType(contentType); response.setContentType(contentType);
response.setContentLength(data.length); response.setContentLength(data.length);

@ -1,5 +1,6 @@
package info.bukova.isspst.reporting; package info.bukova.isspst.reporting;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.io.Serializable; import java.io.Serializable;
@ -20,6 +21,7 @@ public class ReportDefinition implements Serializable {
private List<String> fieldsToPrint; private List<String> fieldsToPrint;
private String reportTitle; private String reportTitle;
private Service<Object> service; private Service<Object> service;
private SignedDocumentItem signedDocItem;
public ReportDefinition() { public ReportDefinition() {
params = new HashMap<String, Object>(); params = new HashMap<String, Object>();
@ -92,6 +94,7 @@ public class ReportDefinition implements Serializable {
reportTitle = ""; reportTitle = "";
service = null; service = null;
params.clear(); params.clear();
signedDocItem = null;
} }
public String getReportTitle() { public String getReportTitle() {
@ -110,4 +113,11 @@ public class ReportDefinition implements Serializable {
this.service = service; this.service = service;
} }
public SignedDocumentItem getSignedDocItem() {
return signedDocItem;
}
public void setSignedDocItem(SignedDocumentItem signedDocItem) {
this.signedDocItem = signedDocItem;
}
} }

@ -2,6 +2,7 @@ package info.bukova.isspst.services.requirement;
import info.bukova.isspst.data.RequirementBase; import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.util.Date; import java.util.Date;
@ -22,10 +23,11 @@ public interface RequirementBaseService<T extends RequirementBase> extends Servi
public void loadType(T data); public void loadType(T data);
public void loadWorkflow(T data); public void loadWorkflow(T data);
public void approve(T entity); public void approve(T entity);
public void approve(T entity, Date approveDate); public void approve(T entity, Date approveDate, byte[] signedPdf);
public boolean canApprove(T entity); public boolean canApprove(T entity);
public List<User> getNextApprover(T entity); public List<User> getNextApprover(T entity);
public boolean prepareSignData(T entity, Date approveDate); public boolean prepareSignData(T entity, Date approveDate);
public Workflow getNextWorkflow(T entity);
public List<T> getMy(); public List<T> getMy();

@ -10,6 +10,8 @@ import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workflow; import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
@ -25,10 +27,12 @@ import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.signapi.SignData; import info.bukova.isspst.signapi.SignData;
import info.bukova.isspst.storage.FileStorage; import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.storage.ReportFileStorage;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -73,6 +77,10 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
private ServletContext servletContext; private ServletContext servletContext;
@Autowired @Autowired
private FileStorage storage; private FileStorage storage;
@Autowired
private SignedDocumentService signedDocumentService;
@Autowired
private ReportFileStorage signedDocStorage;
@Override @Override
@Transactional @Transactional
@ -142,6 +150,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
workflow.setLimit(w.getLimit()); workflow.setLimit(w.getLimit());
workflow.setOrder(w.getOrder()); workflow.setOrder(w.getOrder());
workflow.setRole(w.getRole()); workflow.setRole(w.getRole());
workflow.setSignature(w.getSignature());
entity.getWorkflow().add(workflow); entity.getWorkflow().add(workflow);
} }
} }
@ -237,7 +246,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
} }
protected void approve(T entity, User user, Date approveDate) { protected void approve(T entity, User user, Date approveDate, byte[] signedPdf) {
T e = (T) dao.getById(entity.getId()); T e = (T) dao.getById(entity.getId());
if (e.getReqDate().getTime() > approveDate.getTime()) { if (e.getReqDate().getTime() > approveDate.getTime()) {
@ -269,6 +278,12 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
super.update(e); super.update(e);
if (signedPdf != null) {
saveSignedDoc(e, signedPdf);
} else if (wf.getSignature() != null && wf.getSignature()) {
throw new ApproveException("ErrApproveMustBeSigned");
}
if (!autoApprove(e, approveDate)) { if (!autoApprove(e, approveDate)) {
this.sendToApprovers(e); this.sendToApprovers(e);
@ -296,7 +311,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
protected void approve(T entity, User user) { protected void approve(T entity, User user) {
approve(entity, user, new Date()); approve(entity, user, new Date(), null);
} }
@Override @Override
@ -309,8 +324,8 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
@Override @Override
@Transactional @Transactional
@PreAuthorize("this.canApprove(#entity)") @PreAuthorize("this.canApprove(#entity)")
public void approve(T entity, Date approveDate) { public void approve(T entity, Date approveDate, byte[] signedPdf) {
approve(entity, getLoggedInUser(), approveDate); approve(entity, getLoggedInUser(), approveDate, signedPdf);
} }
/** /**
@ -333,6 +348,30 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
} }
protected void saveSignedDoc(T entity, byte[] signedPdf) {
DataModel reportEntity = entityForSignReport(entity);
SignedDocumentItem signedItem = signedDocumentService.getItem(entityForSignReport(entity), getSignReport(entity).getReportId());
if (signedItem == null) {
SignedDocument signDoc = new SignedDocument();
signDoc.setDescription(entity.getDescription());
signDoc.setNumser(entity.getNumser());
signDoc.setRecordId(reportEntity.getId());
signDoc.setModuleName(ModuleUtils.getModule(reportEntity, servletContext).getId());
signDoc.setSignDate(entity.getLastApproveDate());
SignedDocumentItem item = new SignedDocumentItem();
item.setReportId(reportDefinition.getReport().getReportId());
item.setReportName(reportDefinition.getReport().getName());
signDoc.addItem(item);
signedDocStorage.saveFile(signedPdf, item);
signedDocumentService.addFromApprove(signDoc);
} else {
signedDocStorage.saveFile(signedPdf, signedItem);
}
}
@Override @Override
@Transactional @Transactional
public boolean canApprove(T entity) { public boolean canApprove(T entity) {
@ -344,7 +383,11 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
return false; return false;
} }
protected Workflow getNextWorkflow(T e) { @Override
@Transactional
public Workflow getNextWorkflow(T entity) {
T e = dao.getById(entity.getId());
AuthItem authItem = null; AuthItem authItem = null;
if (e.getWorkflow() == null) { if (e.getWorkflow() == null) {
return null; return null;
@ -439,23 +482,16 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
sessionData.setProperty(Constants.KEY_SIGN_GUID, data.getSignGuid()); sessionData.setProperty(Constants.KEY_SIGN_GUID, data.getSignGuid());
reportDefinition.clear(); reportDefinition.clear();
reportDefinition.setSingleObject(entityForReport(entity)); reportDefinition.setSingleObject(entityForSignReport(entity));
Module module = ModuleUtils.getModule(entityForReport(entity), servletContext); Report report = getSignReport(entity);
Report report = null;
for (Report r : module.getReports()) {
if (r.isSignable()) {
report = r;
break;
}
}
if (report == null) { if (report == null) {
return false; return false;
} }
reportDefinition.setReport(report); reportDefinition.setReport(report);
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
reportDefinition.setService((Service<Object>) ModuleUtils.getServiceInstance(module, servletContext)); reportDefinition.setService((Service<Object>) ModuleUtils.getServiceInstance(module, servletContext));
paramFiller.fill(); paramFiller.fill();
@ -464,6 +500,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
data.setDescription(entity.getDescription()); data.setDescription(entity.getDescription());
data.setNumser(entity.getNumser()); data.setNumser(entity.getNumser());
data.setSignDate(approveDate); data.setSignDate(approveDate);
data.setSigned(signedDocumentService.getItem(entityForSignReport(entity), report.getReportId()) != null);
if (entity.getState() == RequirementState.NEW) { if (entity.getState() == RequirementState.NEW) {
data.setAreaId(1); data.setAreaId(1);
@ -472,12 +509,28 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
data.setAreaId(entity.getAuthorization().size() + 1); data.setAreaId(entity.getAuthorization().size() + 1);
} }
if (userService.getUserSettings().getSignatureFile() != null) {
data.setSignImg(storage.fileData(userService.getUserSettings().getSignatureFile())); data.setSignImg(storage.fileData(userService.getUserSettings().getSignatureFile()));
}
return true; return true;
} }
protected DataModel entityForReport(T entity) { protected DataModel entityForSignReport(T entity) {
return entity; return entity;
} }
private Report getSignReport(T entity) {
Module module = ModuleUtils.getModule(entityForSignReport(entity), servletContext);
Report report = null;
for (Report r : module.getReports()) {
if (r.isSignable()) {
report = r;
break;
}
}
return report;
}
} }

@ -60,7 +60,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
if ((entity.getSumTotal() != null) if ((entity.getSumTotal() != null)
&& (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1)) && (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1))
{ {
approve(entity, approvers.get(0), approveDate); approve(entity, approvers.get(0), approveDate, null);
return true; return true;
} }

@ -1,8 +1,14 @@
package info.bukova.isspst.services.signeddocs; package info.bukova.isspst.services.signeddocs;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocument; import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
public interface SignedDocumentService extends Service<SignedDocument> { public interface SignedDocumentService extends Service<SignedDocument> {
SignedDocument getForEntity(DataModel entity);
SignedDocumentItem getItem(DataModel entity, long reportId);
void addFromApprove(SignedDocument document);
} }

@ -1,13 +1,25 @@
package info.bukova.isspst.services.signeddocs; package info.bukova.isspst.services.signeddocs;
import info.bukova.isspst.Module;
import info.bukova.isspst.ModuleUtils;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.SignedDocument; import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletContext;
public class SignedDocumentServiceImpl extends AbstractOwnedService<SignedDocument> implements SignedDocumentService { public class SignedDocumentServiceImpl extends AbstractOwnedService<SignedDocument> implements SignedDocumentService {
@Autowired
private ServletContext servletContext;
@LazyLoader("grid") @LazyLoader("grid")
@Transactional @Transactional
public void lazyLoadItems(SignedDocument signedDocument) { public void lazyLoadItems(SignedDocument signedDocument) {
@ -19,4 +31,45 @@ public class SignedDocumentServiceImpl extends AbstractOwnedService<SignedDocume
Hibernate.initialize(sd.getItems()); Hibernate.initialize(sd.getItems());
signedDocument.setItems(sd.getItems()); signedDocument.setItems(sd.getItems());
} }
@Override
@Transactional
public SignedDocument getForEntity(DataModel entity) {
Module module = ModuleUtils.getModule(entity, servletContext);
if (module == null) {
return null;
}
Query q = dao.getQuery("from SignedDocument where moduleName = :module and recordId = :record");
q.setParameter("module", module.getId());
q.setParameter("record", entity.getId());
return (SignedDocument) q.uniqueResult();
}
@Override
@Transactional
public SignedDocumentItem getItem(DataModel entity, long reportId) {
SignedDocument doc = getForEntity(entity);
if (doc == null) {
return null;
}
for (SignedDocumentItem item : doc.getItems()) {
if (item.getReportId() == reportId) {
return item;
}
}
return null;
}
@Override
public void addFromApprove(SignedDocument document) {
super.add(document);
}
} }

@ -55,7 +55,7 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
} }
@Override @Override
protected DataModel entityForReport(TripBillApproval entity) { protected DataModel entityForSignReport(TripBillApproval entity) {
return entity.getBill(); return entity.getBill();
} }
} }

@ -19,9 +19,9 @@ public abstract class AbstractFileStorage<T> implements FileStorage<T> {
os.flush(); os.flush();
os.close(); os.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); throw new StorageException("File cannot be found: " + file.getName(), e.getCause());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new StorageException("Cannot write file: " + file.getName(), e.getCause());
} finally { } finally {
try { try {
if (os != null) { if (os != null) {

@ -0,0 +1,10 @@
package info.bukova.isspst.storage;
import info.bukova.isspst.data.SignedDocumentItem;
/**
* @author Pepa Rokos
*/
public interface ReportFileStorage extends FileStorage<SignedDocumentItem> {
}

@ -0,0 +1,75 @@
package info.bukova.isspst.storage;
import info.bukova.isspst.data.SignedDocumentItem;
import java.io.File;
import java.util.UUID;
/**
* @author Pepa Rokos
*/
public class ReportFileStorageImpl extends AbstractFileStorage<SignedDocumentItem> implements ReportFileStorage {
private String rootPath;
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
private String getFilePath(String fileName) {
return rootPath + "/" + fileName;
}
@Override
public void saveFile(byte[] data, SignedDocumentItem signedDocumentItem) {
String fileName = signedDocumentItem.getFileName();
if (fileName == null) {
fileName = UUID.randomUUID().toString() + ".pdf";
}
saveFileDataToPath(data, getFilePath(fileName));
signedDocumentItem.setFileName(fileName);
}
@Override
public void saveFile(File file, SignedDocumentItem fileId) {
throw new UnsupportedOperationException();
}
@Override
public void removeFile(SignedDocumentItem signedDocumentItem) {
removeFileByPath(getFilePath(signedDocumentItem.getFileName()));
}
@Override
public void moveFile(String source, String destination) {
throw new UnsupportedOperationException();
}
@Override
public void createDirectory(String dir) {
throw new UnsupportedOperationException();
}
@Override
public byte[] fileData(SignedDocumentItem signedDocumentItem) {
return fileDataFromPath(getFilePath(signedDocumentItem.getFileName()));
}
@Override
public File file(SignedDocumentItem signedDocumentItem) {
return null;
}
@Override
public boolean dirExists(String path) {
return false;
}
@Override
public String serverPath(SignedDocumentItem signedDocumentItem) {
return null;
}
}

@ -33,7 +33,9 @@ public class ApproveDialogVM {
@WireVariable @WireVariable
private SessionData sessionData; private SessionData sessionData;
private boolean signed; private boolean signed;
private boolean signRequired;
private boolean timer; private boolean timer;
private byte[] signedPdf;
public Date getApproveDate() { public Date getApproveDate() {
return approveDate; return approveDate;
@ -52,14 +54,21 @@ public class ApproveDialogVM {
this.grid = grid; this.grid = grid;
this.approveDate = new Date(); this.approveDate = new Date();
if (service.getNextWorkflow(requirement).getSignature() != null
&& service.getNextWorkflow(requirement).getSignature()) {
this.signed = false; this.signed = false;
this.signRequired = true;
} else {
this.signRequired = false;
}
this.timer = false; this.timer = false;
} }
@Command @Command
public void approve(@BindingParam("window") Window window) { public void approve(@BindingParam("window") Window window) {
try { try {
service.approve(requirement, approveDate); service.approve(requirement, approveDate, signedPdf);
BindUtils.postNotifyChange(null, null, grid, "dataBean"); BindUtils.postNotifyChange(null, null, grid, "dataBean");
BindUtils.postNotifyChange(null, null, grid, "canApprove"); BindUtils.postNotifyChange(null, null, grid, "canApprove");
BindUtils.postGlobalCommand(null, null, "reload", null); BindUtils.postGlobalCommand(null, null, "reload", null);
@ -88,6 +97,7 @@ public class ApproveDialogVM {
if (guid.equals(data.getSignGuid()) && data.isSignSuccess()) { if (guid.equals(data.getSignGuid()) && data.isSignSuccess()) {
signed = true; signed = true;
timer = false; timer = false;
signedPdf = data.getPdfData();
} else { } else {
signed = false; signed = false;
} }
@ -101,4 +111,7 @@ public class ApproveDialogVM {
return timer; return timer;
} }
public boolean isSignRequired() {
return signRequired;
}
} }

@ -6,13 +6,6 @@ import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workflow; import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.GlobalCommand;
@ -24,6 +17,12 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RequirementTypesVM { public class RequirementTypesVM {
@WireVariable @WireVariable
@ -237,6 +236,18 @@ public class RequirementTypesVM {
win.doModal(); win.doModal();
} }
@Command
@NotifyChange({"selected", "centreSelWorkflow", "wgSelWorkflow"})
public void toggleSignature(@BindingParam("workflow") Workflow workflow) {
if (workflow.getSignature() != null && workflow.getSignature()) {
workflow.setSignature(false);
} else {
workflow.setSignature(true);
}
reqTypeService.update(selected);
}
@GlobalCommand @GlobalCommand
@NotifyChange("selected") @NotifyChange("selected")
public void refresh() { public void refresh() {

@ -3,20 +3,22 @@ package info.bukova.isspst.ui.signeddocs;
import info.bukova.isspst.data.SignedDocument; import info.bukova.isspst.data.SignedDocument;
import info.bukova.isspst.data.SignedDocumentItem; import info.bukova.isspst.data.SignedDocumentItem;
import info.bukova.isspst.filters.SignedDocumentFilter; import info.bukova.isspst.filters.SignedDocumentFilter;
import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.signeddocs.SignedDocumentService; import info.bukova.isspst.services.signeddocs.SignedDocumentService;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listbox; import org.zkoss.zul.Listbox;
import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.List;
public class SignedDocsList extends ListViewModel<SignedDocument> public class SignedDocsList extends ListViewModel<SignedDocument>
{ {
@ -30,6 +32,9 @@ public class SignedDocsList extends ListViewModel<SignedDocument>
protected List<SignedDocumentItem> signedDocumentItems; protected List<SignedDocumentItem> signedDocumentItems;
@WireVariable
private ReportDefinition reportDefinition;
@Init(superclass = true) @Init(superclass = true)
public void initSignedDocsList() { public void initSignedDocsList() {
service = signedDocumentService; service = signedDocumentService;
@ -70,4 +75,12 @@ public class SignedDocsList extends ListViewModel<SignedDocument>
this.signedDocumentItems = new ArrayList<SignedDocumentItem>(); this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
} }
} }
@Command
public void onOpen(@BindingParam("item") SignedDocumentItem item) {
reportDefinition.clear();
reportDefinition.setSignedDocItem(item);
Window reportWin = (Window) Executions.createComponents("/app/reporting/report.zul", null, null);
reportWin.doModal();
}
} }

@ -412,3 +412,7 @@ ForeignPersons = Cizí osoby
TripBillResultMessageText = Zpráva z pracovní cesty TripBillResultMessageText = Zpráva z pracovní cesty
ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty. ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty.
ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu. ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu.
ErrApproveMustBeSigned = Schválení musí být digitálně podepsané.
DigitalSignature = Elektronický podpis
ContextMenu = Volby v kontextovém menu

@ -2,7 +2,7 @@
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af"> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af">
<property name="ireport.zoom" value="1.5"/> <property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="511"/> <property name="ireport.y" value="396"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter> </parameter>
@ -58,12 +58,6 @@
</background> </background>
<pageHeader> <pageHeader>
<band height="275" splitType="Stretch"> <band height="275" splitType="Stretch">
<image onErrorType="Blank">
<reportElement uuid="f9a1f9fe-b6d4-4b1d-972a-59d43b380a5b" x="440" y="206" width="130" height="43">
<printWhenExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<staticText> <staticText>
<reportElement uuid="6e60bd03-48b9-4555-91ab-757532d93e6a" x="10" y="61" width="143" height="20"/> <reportElement uuid="6e60bd03-48b9-4555-91ab-757532d93e6a" x="10" y="61" width="143" height="20"/>
<textElement> <textElement>
@ -236,11 +230,13 @@ tuzemské pracovní cesty]]></text>
</textElement> </textElement>
<textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression> <textFieldExpression><![CDATA[$P{P_MAIN_ADDRESS}]]></textFieldExpression>
</textField> </textField>
<textField pattern="dd. MM. yyyy" isBlankWhenNull="false"> <genericElement>
<reportElement uuid="d8f79af9-b603-4103-9f78-a98ef574447e" x="340" y="229" width="100" height="20"/> <reportElement uuid="14ae63ff-6be2-4419-9f39-8c9c8d2daf42" x="382" y="206" width="162" height="42"/>
<textElement verticalAlignment="Bottom"/> <genericElementType namespace="urn:sig:sig" name="signature"/>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression> <genericElementParameter name="index">
</textField> <valueExpression><![CDATA[1]]></valueExpression>
</genericElementParameter>
</genericElement>
</band> </band>
</pageHeader> </pageHeader>
<detail> <detail>
@ -427,12 +423,6 @@ tuzemské pracovní cesty]]></text>
</reportElement> </reportElement>
<imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression> <imageExpression><![CDATA[$P{P_PREV_APPROVER_SIGNATURE}]]></imageExpression>
</image> </image>
<image onErrorType="Blank">
<reportElement uuid="2e42de6e-3f15-42c0-8a1d-5a21809f3193" x="290" y="103" width="130" height="46">
<printWhenExpression><![CDATA[$P{P_APPROVER_SIGNATURE} != null]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$P{P_APPROVER_SIGNATURE}]]></imageExpression>
</image>
<staticText> <staticText>
<reportElement uuid="58e4cf15-a8e1-4b4d-b491-ad4a1825f0a3" x="281" y="5" width="30" height="15"/> <reportElement uuid="58e4cf15-a8e1-4b4d-b491-ad4a1825f0a3" x="281" y="5" width="30" height="15"/>
<textElement/> <textElement/>
@ -472,11 +462,6 @@ tuzemské pracovní cesty]]></text>
</textElement> </textElement>
<text><![CDATA[Účtovaná náhrada byla přezkoušena a upravena na Kč:]]></text> <text><![CDATA[Účtovaná náhrada byla přezkoušena a upravena na Kč:]]></text>
</staticText> </staticText>
<staticText>
<reportElement uuid="4aca1ec1-c2dc-47b9-a973-40ded5f52d29" x="260" y="103" width="290" height="20"/>
<textElement/>
<text><![CDATA[Datum a podpis zaměstnance, který upravil vyúčtování]]></text>
</staticText>
<line> <line>
<reportElement uuid="2665a0ca-420d-46dc-9085-522ed3950c44" x="291" y="149" width="130" height="1"/> <reportElement uuid="2665a0ca-420d-46dc-9085-522ed3950c44" x="291" y="149" width="130" height="1"/>
</line> </line>
@ -571,13 +556,6 @@ tuzemské pracovní cesty]]></text>
<line> <line>
<reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/> <reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/>
</line> </line>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="7bbd89ae-f9e7-4359-b2df-5020b7a57456" x="292" y="135" width="100" height="13"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_APPROVE_DATE}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy"> <textField pattern="dd. MM. yyyy">
<reportElement uuid="8f8ad8d2-dc49-46cc-8732-914951931569" x="440" y="135" width="100" height="15"/> <reportElement uuid="8f8ad8d2-dc49-46cc-8732-914951931569" x="440" y="135" width="100" height="15"/>
<textElement> <textElement>
@ -585,6 +563,18 @@ tuzemské pracovní cesty]]></text>
</textElement> </textElement>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression> <textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
</textField> </textField>
<staticText>
<reportElement uuid="4aca1ec1-c2dc-47b9-a973-40ded5f52d29" x="260" y="103" width="290" height="20"/>
<textElement/>
<text><![CDATA[Datum a podpis zaměstnance, který upravil vyúčtování]]></text>
</staticText>
<genericElement>
<reportElement uuid="3753147d-3c79-4377-b296-3281ab3d54b3" x="291" y="103" width="130" height="46"/>
<genericElementType namespace="urn:sig:sig" name="signature"/>
<genericElementParameter name="index">
<valueExpression><![CDATA[2]]></valueExpression>
</genericElementParameter>
</genericElement>
</band> </band>
</summary> </summary>
</jasperReport> </jasperReport>

@ -183,6 +183,10 @@
<property name="rootPath" value="${storage.root}"/> <property name="rootPath" value="${storage.root}"/>
</bean> </bean>
<bean id="signeDocStorage" class="info.bukova.isspst.storage.ReportFileStorageImpl">
<property name="rootPath" value="${storage.signedDocuments}"/>
</bean>
<!-- Session data --> <!-- Session data -->
<bean id="sessionData" class="info.bukova.isspst.SessionData" scope="session"> <bean id="sessionData" class="info.bukova.isspst.SessionData" scope="session">
<aop:scoped-proxy/> <aop:scoped-proxy/>

@ -1,2 +1,3 @@
storage.root=/home/pepa/tmp/isspst storage.root=/home/pepa/tmp/isspst
storage.fulltextIndex=/home/pepa/tmp/isspst storage.fulltextIndex=/home/pepa/tmp/isspst
storage.signedDocuments=/home/pepa/tmp/isspst/signedDoc

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

@ -1,5 +1,7 @@
<?page contentType="text/html;charset=UTF-8"?> <?page contentType="text/html;charset=UTF-8"?>
<zk> <zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window <window
vflex="1" vflex="1"
@ -125,18 +127,23 @@
model="@load(vm.signedDocumentItems)"> model="@load(vm.signedDocumentItems)">
<listhead menupopup="auto"> <listhead menupopup="auto">
<listheader <listheader
hflex="1" hflex="2"
sort="czech(actualReportName)" sort="czech(actualReportName)"
label="${labels.PrintReports}" /> label="${labels.PrintReports}" />
<listheader <listheader
hflex="2" hflex="3"
sort="czech(fileName)" sort="czech(fileName)"
label="${labels.FileName}" /> label="${labels.FileName}" />
<listheader
hflex="1"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem> <listitem>
<listcell label="@load(each.actualReportName)" /> <listcell label="@load(each.actualReportName)" />
<listcell label="@load(each.fileName)" /> <listcell label="@load(each.fileName)" />
<listcell>
<button label="Otevřít" onClick="@command('onOpen', item = each)" sclass="nicebutton"/>
</listcell>
</listitem> </listitem>
</template> </template>
</listbox> </listbox>

@ -17,12 +17,12 @@
<label value="${labels.RequirementApproveDate}"/> <label value="${labels.RequirementApproveDate}"/>
<datebox <datebox
value="@bind(vm.approveDate)" value="@bind(vm.approveDate)"
format="${labels.DateFormat}" disabled="@load(vm.signed)"/> format="${labels.DateFormat}" disabled="@load(vm.signed and vm.signRequired)"/>
</hbox> </hbox>
<separator bar="true" hflex="1"/> <separator bar="true" hflex="1"/>
<hbox> <hbox>
<button label="Podepsat" onClick="@command('signPdf')" sclass="nicebutton" disabled="@load(vm.signed)"/> <button label="Podepsat" onClick="@command('signPdf')" sclass="nicebutton" disabled="@load(vm.signed or not vm.signRequired)"/>
<button image="/img/approve-016.png" label="${labels.Confirm}" onClick="@command('approve', window=approveWin)" sclass="nicebutton" disabled="@load(not vm.signed)"/> <button image="/img/approve-016.png" label="${labels.Confirm}" onClick="@command('approve', window=approveWin)" sclass="nicebutton" disabled="@load(not vm.signed and vm.signRequired)"/>
<button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="approveWin.detach()" sclass="nicebutton"/> <button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="approveWin.detach()" sclass="nicebutton"/>
</hbox> </hbox>
</vbox> </vbox>

@ -1,5 +1,7 @@
<?page title="${labels.AgendaWorkflow}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.AgendaWorkflow}" contentType="text/html;charset=UTF-8"?>
<zk> <zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<window border="normal" apply="org.zkoss.bind.BindComposer" <window border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementTypesVM')" viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementTypesVM')"
vflex="1"> vflex="1">
@ -63,32 +65,46 @@
<groupbox mold="3d" visible="@load(not empty vm.selected)"> <groupbox mold="3d" visible="@load(not empty vm.selected)">
<caption label="${labels.Workflow}"/> <caption label="${labels.Workflow}"/>
<vbox> <vbox>
<label value="${labels.ContextMenu}"/>
<listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup" <listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup"
onDrop="@command('addRoleWg', event=event)" onDrop="@command('addRoleWg', event=event)"
selectedItem="@bind(vm.wgSelWorkflow)"> selectedItem="@bind(vm.wgSelWorkflow)">
<listhead> <listhead>
<listheader width="50px"/>
<listheader label="${labels.WorkgroupWorkflow}"/> <listheader label="${labels.WorkgroupWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(not each.centre)" <listitem visible="@load(not each.centre)"
onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup" onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup"
context="limitPopUpWg" context="limitPopUpWg"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')" style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')"
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/> tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))">
<listcell>
<image src="/img/money-small.png" visible="@load(not empty each.limit)"/>
<image src="/img/sign-small.png" visible="@load(each.signature)"/>
</listcell>
<listcell label="@load(each.role.description)"/>
</listitem>
</template> </template>
</listbox> </listbox>
<listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre" <listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre"
onDrop="@command('addRoleCentre', event=event)" onDrop="@command('addRoleCentre', event=event)"
selectedItem="@bind(vm.centreSelWorkflow)"> selectedItem="@bind(vm.centreSelWorkflow)">
<listhead> <listhead>
<listheader width="50px"/>
<listheader label="${labels.CentreWorkflow}"/> <listheader label="${labels.CentreWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(each.centre)" <listitem visible="@load(each.centre)"
onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre" onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre"
context="limitPopUp" context="limitPopUp"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')" tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))">
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/> <listcell>
<image src="/img/money-small.png" visible="@load(not empty each.limit)"/>
<image src="/img/sign-small.png" visible="@load(each.signature)"/>
</listcell>
<listcell label="@load(each.role.description)"/>
</listitem>
</template> </template>
</listbox> </listbox>
</vbox> </vbox>
@ -97,11 +113,17 @@
<menuitem label="${labels.OverLimit}" checkmark="true" <menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.centreSelWorkflow.limit)" checked="@load(not empty vm.centreSelWorkflow.limit)"
onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/> onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/>
<menuitem label="${labels.DigitalSignature}" checkmark="true"
checked="@load(vm.centreSelWorkflow.signature)"
onClick="@command('toggleSignature', workflow=centreWorkflow.selectedItem.value)"/>
</menupopup> </menupopup>
<menupopup id="limitPopUpWg"> <menupopup id="limitPopUpWg">
<menuitem label="${labels.OverLimit}" checkmark="true" <menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.wgSelWorkflow.limit)" checked="@load(not empty vm.wgSelWorkflow.limit)"
onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/> onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/>
<menuitem label="${labels.DigitalSignature}" checkmark="true"
checked="@load(vm.wgSelWorkflow.signature)"
onClick="@command('toggleSignature', workflow=wgWorkflow.selectedItem.value)"/>
</menupopup> </menupopup>
</div> </div>
</hbox> </hbox>

Loading…
Cancel
Save