19 package org.turro.financials.cart.www;
21 import java.io.IOException;
22 import java.io.PrintWriter;
23 import java.util.Date;
24 import java.util.List;
25 import javax.servlet.ServletException;
26 import org.turro.string.ObjectString;
27 import org.turro.string.Strings;
28 import org.turro.auth.Authentication;
29 import org.turro.contacts.Contact;
30 import org.turro.elephant.context.IElement;
31 import org.turro.elephant.impl.abstracts.AbstractElement;
32 import org.turro.elephant.layout.IManageable;
33 import org.turro.elephant.layout.IRenderable;
34 import org.turro.elephant.security.IDefendable;
35 import org.turro.financials.cart.FollowUps;
36 import org.turro.financials.cart.ShopContext;
37 import org.turro.financials.db.FinancialsPU;
38 import org.turro.financials.entity.FollowUp;
39 import org.turro.i18n.I_;
40 import org.turro.jpa.Dao;
41 import org.turro.marker.ElephantMarker;
42 import org.turro.plugin.contacts.IContact;
50 protected String
sclass, fullTemplate, summaryTemplate;
56 public void loadData() throws ServletException, IOException {
58 fullTemplate =
getAttributes().getAttributeValue(
"attrib:fullTemplate",
"");
59 summaryTemplate =
getAttributes().getAttributeValue(
"attrib:summaryTemplate",
"");
85 marker.
process(
"followup", getFullTemplate());
90 marker.
put(
"divider", index > 0);
91 marker.
put(
"header", index == 0);
92 marker.
put(
"title",
I_.
get(
"Not prepared"));
93 marker.
put(
"footer", index == lfu.size() - 1);
94 prepareValues(marker, fu, 0);
95 marker.
process(
"followup", getSummaryTemplate());
101 marker.
put(
"divider", index > 0);
102 marker.
put(
"header", index == 0);
103 marker.
put(
"title",
I_.
get(
"Not delivered"));
104 marker.
put(
"footer", index == lfu.size() - 1);
105 prepareValues(marker, fu, 0);
106 marker.
process(
"followup", getSummaryTemplate());
115 return "<div class='" +
sclass +
"dossier-web'>";
125 marker.
put(
"followUp", fu);
127 String link = getItemLink(fu, page);
129 marker.
put(
"path", link);
130 marker.
put(
"all", getPageLink(page));
132 marker.
put(
"readall", getItemLink(fu, page));
145 private String getItemLink(FollowUp fu,
int page) {
149 private String getPageLink(
int page) {
153 private String getSummaryTemplate() {
154 return Strings.isBlank(summaryTemplate) ?
"mySummary" : summaryTemplate;
157 private String getFullTemplate() {
158 return Strings.isBlank(fullTemplate) ?
"myFull" : fullTemplate;
161 private void processActions() {
164 if(fuid !=
null && fuid > 0) {
167 if(
"true".equals(prepared)) {
168 Dao dao =
new FinancialsPU();
169 FollowUp fu = dao.find(FollowUp.class, fuid);
171 fu.setPreparedDate(
new Date());
174 }
else if(
"true".equals(delivered)) {
175 Dao dao =
new FinancialsPU();
176 FollowUp fu = dao.find(FollowUp.class, fuid);
178 fu.setDeliveredDate(
new Date());
static IContact getIContact()
AttributeSupport getAttributes()
static List< FollowUp > notDelivered(IContact contact)
static List< FollowUp > notPrepared(IContact contact)
static ShopContext getInstance()
IContact getIContractor()
String getDocumentString()
static String get(String msg)
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
String getParameter(String param)
void setTitle(String title)
IConstructor getConstructor()