| 3444 |
vikas |
1 |
<%@page import="in.shop2020.model.ItemActivityWithSource"%>
|
|
|
2 |
<%@page import="in.shop2020.server.ItemActivityWithSourceRepository"%>
|
|
|
3 |
<%@page import="in.shop2020.server.ItemActivityRepository"%>
|
|
|
4 |
<%@page import="in.shop2020.model.ItemActivity"%>
|
|
|
5 |
<%@page import="com.google.appengine.api.datastore.FetchOptions"%>
|
|
|
6 |
<%@page import="java.util.ArrayList"%>
|
|
|
7 |
<%@page import="in.shop2020.model.Item"%>
|
|
|
8 |
<%@page import="in.shop2020.server.ItemRepository"%>
|
|
|
9 |
<%@page import="java.util.Map"%>
|
|
|
10 |
<%@page import="java.util.HashMap"%>
|
|
|
11 |
<%@page import="java.util.Calendar"%>
|
|
|
12 |
<%@page import="java.util.Date"%>
|
|
|
13 |
<%@page import="java.util.TimeZone"%>
|
|
|
14 |
<%@page import="java.text.SimpleDateFormat"%>
|
|
|
15 |
<%@page import="com.google.appengine.api.datastore.Query.SortDirection"%>
|
|
|
16 |
<%@page import="java.util.Map.Entry"%>
|
|
|
17 |
<%@ page import="java.util.List" %>
|
|
|
18 |
<%@ page import="com.google.appengine.api.datastore.DatastoreServiceFactory" %>
|
|
|
19 |
<%@ page import="com.google.appengine.api.datastore.DatastoreService" %>
|
|
|
20 |
<%@ page import="com.google.appengine.api.datastore.Query" %>
|
|
|
21 |
<%@ page import="com.google.appengine.api.datastore.Entity" %>
|
|
|
22 |
<%@ page import="com.google.appengine.api.datastore.PreparedQuery" %>
|
|
|
23 |
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
|
24 |
|
|
|
25 |
<html>
|
|
|
26 |
<head>
|
|
|
27 |
<link rel="stylesheet" href="/DataTables/media/css/demo_table.css" type="text/css" />
|
|
|
28 |
<link rel="stylesheet" href="/DataTables/extras/TableTools/media/css/TableTools.css" type="text/css" />
|
|
|
29 |
</head>
|
|
|
30 |
<body>
|
|
|
31 |
<%
|
|
|
32 |
SimpleDateFormat iSdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
33 |
iSdf.setTimeZone(TimeZone.getTimeZone("IST"));
|
|
|
34 |
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("IST"));
|
|
|
35 |
String dateStr = request.getParameter("date");
|
|
|
36 |
Date date;
|
|
|
37 |
if (dateStr != null && !dateStr.isEmpty()) {
|
|
|
38 |
date = iSdf.parse(dateStr);
|
|
|
39 |
}
|
|
|
40 |
else {
|
|
|
41 |
date = iSdf.parse(iSdf.format(cal.getTime()));
|
|
|
42 |
dateStr = iSdf.format(date);
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
ItemRepository itemRepository = new ItemRepository();
|
|
|
46 |
List<Item> items = itemRepository.getAll();
|
|
|
47 |
Map<Long, String> itemsCatalogIdNameMap = new HashMap<Long, String>();
|
|
|
48 |
for (Item item : items) {
|
|
|
49 |
itemsCatalogIdNameMap.put(item.getCatalogId(), item.getName());
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
ItemActivityWithSourceRepository itemActivityRepository = new ItemActivityWithSourceRepository();
|
|
|
53 |
List<ItemActivityWithSource> itemActivities = itemActivityRepository.getByDate(date);
|
|
|
54 |
%>
|
|
|
55 |
<form id="frmProductActivity" name="frmProductActivity" method="post" action="/jsp/product-activity-with-source.jsp">
|
|
|
56 |
<label>Date(YYYYMMDD) : </label> <input type="text" name="date" id="date" value="<%= dateStr %>"/>
|
|
|
57 |
<input type="submit" name="submit" id="submit" value="Submit"/><br/>
|
|
|
58 |
</form>
|
|
|
59 |
<table cellpadding="0" cellspacing="0" border="0" class="display"
|
|
|
60 |
id="prodFunnel">
|
|
|
61 |
<thead>
|
|
|
62 |
<tr>
|
|
|
63 |
<th>Product</th>
|
|
|
64 |
<th>Source</th>
|
|
|
65 |
<th>Paid</th>
|
|
|
66 |
<th>SessSource</th>
|
|
|
67 |
<th>Paid</th>
|
|
|
68 |
<th>View</th>
|
|
|
69 |
<th>Unique</th>
|
|
|
70 |
<th>AddCart</th>
|
|
|
71 |
<th>Unique</th>
|
|
|
72 |
<th>Shipping</th>
|
|
|
73 |
<th>Unique</th>
|
|
|
74 |
<th>ProceedPay</th>
|
|
|
75 |
<th>Unique</th>
|
|
|
76 |
<th>OrderCreation</th>
|
|
|
77 |
<th>Unique</th>
|
|
|
78 |
<th>PayFail</th>
|
|
|
79 |
<th>Unique</th>
|
|
|
80 |
<th>PayOk</th>
|
|
|
81 |
<th>Unique</th>
|
|
|
82 |
<th>DelCart</th>
|
|
|
83 |
<th>Unique</th>
|
|
|
84 |
<th>AddResearch</th>
|
|
|
85 |
<th>Unique</th>
|
|
|
86 |
<th>DelResearch</th>
|
|
|
87 |
<th>Unique</th>
|
|
|
88 |
</tr>
|
|
|
89 |
</thead>
|
|
|
90 |
<tbody>
|
|
|
91 |
|
|
|
92 |
<%
|
|
|
93 |
int rowId = 0;
|
|
|
94 |
for (ItemActivityWithSource itemActivity : itemActivities) {
|
|
|
95 |
rowId++;
|
|
|
96 |
%>
|
|
|
97 |
<tr id="tr-<%=rowId%>">
|
|
|
98 |
<td>
|
|
|
99 |
<%=itemsCatalogIdNameMap.get(itemActivity.getCatalogId())==null? itemActivity.getCatalogId() : itemsCatalogIdNameMap.get(itemActivity.getCatalogId())%>
|
|
|
100 |
<a href="#" class="show-chart"
|
|
|
101 |
rowId="<%=rowId%>">
|
|
|
102 |
chart</a>
|
|
|
103 |
</td>
|
|
|
104 |
<td><%=itemActivity.getFirstSource()%></td>
|
|
|
105 |
<td><%=itemActivity.getIsPaidFirstSource()%></td>
|
|
|
106 |
<td><%=itemActivity.getSessionSource()%></td>
|
|
|
107 |
<td><%=itemActivity.getIsPaidSessionSource()%></td>
|
|
|
108 |
<td countAttr="view"><%=itemActivity.getView()==null? 0 : itemActivity.getView()%></td>
|
|
|
109 |
<td countAttr="unique_view"><%=itemActivity.getUniqueView()==null? 0 : itemActivity.getUniqueView()%></td>
|
|
|
110 |
<td countAttr="cart"><%=itemActivity.getAddToCart()==null? 0 : itemActivity.getAddToCart()%></td>
|
|
|
111 |
<td countAttr="unique_cart"><%=itemActivity.getUniqueAddToCart()==null? 0 : itemActivity.getUniqueAddToCart()%></td>
|
|
|
112 |
<td countAttr="shipping"><%=itemActivity.getShippingAccess()==null? 0 : itemActivity.getShippingAccess()%></td>
|
|
|
113 |
<td countAttr="unique_shipping"><%=itemActivity.getUniqueShippingAccess()==null? 0 : itemActivity.getUniqueShippingAccess()%></td>
|
|
|
114 |
<td countAttr="pay"><%=itemActivity.getProceedToPay()==null? 0 : itemActivity.getProceedToPay()%></td>
|
|
|
115 |
<td countAttr="unique_pay"><%=itemActivity.getUniqueProceedToPay()==null? 0 : itemActivity.getUniqueProceedToPay()%></td>
|
|
|
116 |
<td countAttr="order"><%=itemActivity.getOrderCreation()==null? 0 : itemActivity.getOrderCreation()%></td>
|
|
|
117 |
<td countAttr="unique_order"><%=itemActivity.getUniqueOrderCreation()==null? 0 : itemActivity.getUniqueOrderCreation()%></td>
|
|
|
118 |
<td countAttr="pay_fail"><%=itemActivity.getPaymentFailure()==null? 0 : itemActivity.getPaymentFailure()%></td>
|
|
|
119 |
<td countAttr="unique_pay_fail"><%=itemActivity.getUniquePaymentFailure()==null? 0 : itemActivity.getUniquePaymentFailure()%></td>
|
|
|
120 |
<td countAttr="pay_ok"><%=itemActivity.getPaymentSuccess()==null? 0 : itemActivity.getPaymentSuccess()%></td>
|
|
|
121 |
<td countAttr="unique_pay_ok"><%=itemActivity.getUniquePaymentSuccess()==null? 0 : itemActivity.getUniquePaymentSuccess()%></td>
|
|
|
122 |
<td><%=itemActivity.getDeleteFromCart()==null? 0 : itemActivity.getDeleteFromCart()%></td>
|
|
|
123 |
<td><%=itemActivity.getUniqueDeleteFromCart()==null? 0 : itemActivity.getUniqueDeleteFromCart()%></td>
|
|
|
124 |
<td><%=itemActivity.getAddToResearch()==null? 0 : itemActivity.getAddToResearch()%></td>
|
|
|
125 |
<td><%=itemActivity.getUniqueAddToResearch()==null? 0 : itemActivity.getUniqueAddToResearch()%></td>
|
|
|
126 |
<td><%=itemActivity.getDeleteFromResearch()==null? 0 : itemActivity.getDeleteFromResearch()%></td>
|
|
|
127 |
<td><%=itemActivity.getUniqueDeleteFromResearch()==null? 0 : itemActivity.getUniqueDeleteFromResearch()%></td>
|
|
|
128 |
</tr>
|
|
|
129 |
<%
|
|
|
130 |
}
|
|
|
131 |
%>
|
|
|
132 |
</tbody>
|
|
|
133 |
</table>
|
|
|
134 |
|
|
|
135 |
<div id="placeholder" style="width:800px;height:300px;"></div>
|
|
|
136 |
|
|
|
137 |
<script type="text/javascript" language="javascript" src="/DataTables/media/js/jquery.js"></script>
|
|
|
138 |
<script type="text/javascript" language="javascript" src="/DataTables/media/js/jquery.dataTables.min.js"></script>
|
|
|
139 |
<script type="text/javascript" charset="utf-8" src="/DataTables/extras/TableTools/media/js/ZeroClipboard.js"></script>
|
|
|
140 |
<script type="text/javascript" charset="utf-8" src="/DataTables/extras/TableTools/media/js/TableTools.js"></script>
|
|
|
141 |
<script type="text/javascript" charset="utf-8" src="/js/flot/jquery.flot.js"></script>
|
|
|
142 |
<script type="text/javascript" charset="utf-8">
|
|
|
143 |
$(document).ready(function() {
|
|
|
144 |
$('#prodFunnel').dataTable({
|
|
|
145 |
"iDisplayLength": 15,
|
|
|
146 |
"bProcessing": true,
|
|
|
147 |
"aaSorting": [[1,'desc']],
|
|
|
148 |
"sDom": 'T<"clear">lfrtip',
|
|
|
149 |
"oTableTools": {
|
|
|
150 |
"sSwfPath": "/DataTables/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf"
|
|
|
151 |
},
|
|
|
152 |
"aLengthMenu": [[10, 15, 25, 50, 100, -1], [10, 15, 25, 50, 100, "All"]]
|
|
|
153 |
});
|
|
|
154 |
} );
|
|
|
155 |
$('.show-chart').click(function() {
|
|
|
156 |
var d1 = [];
|
|
|
157 |
var d2 = [];
|
|
|
158 |
var x = [];
|
|
|
159 |
var index = 0;
|
|
|
160 |
alert($(this).attr('rowId'));
|
|
|
161 |
$('#tr-' + $(this).attr('rowId')).children('[countAttr]').each(function() {
|
|
|
162 |
var countAttr = $(this).attr('countAttr');
|
|
|
163 |
var count = $(this).text();
|
|
|
164 |
if (countAttr.indexOf('unique_') != -1) {
|
|
|
165 |
index = x.length - 1;
|
|
|
166 |
d2.push([index, count]);
|
|
|
167 |
}
|
|
|
168 |
else {
|
|
|
169 |
index = x.length;
|
|
|
170 |
x.push([index, countAttr]);
|
|
|
171 |
d1.push([index, count]);
|
|
|
172 |
}
|
|
|
173 |
});
|
|
|
174 |
|
|
|
175 |
$.plot($("#placeholder"), [
|
|
|
176 |
{ label: "Count", data: d1},
|
|
|
177 |
{ label: "Unique Count", data: d2}
|
|
|
178 |
], {
|
|
|
179 |
series: {
|
|
|
180 |
lines: { show: true },
|
|
|
181 |
points: { show: true }
|
|
|
182 |
},
|
|
|
183 |
xaxis: {
|
|
|
184 |
ticks: x
|
|
|
185 |
},
|
|
|
186 |
|
|
|
187 |
grid: {
|
|
|
188 |
backgroundColor: { colors: ["#fff", "#eee"] }
|
|
|
189 |
}
|
|
|
190 |
});
|
|
|
191 |
});
|
|
|
192 |
</script>
|
|
|
193 |
</body>
|
|
|
194 |
</html>
|