| 167 |
ashish |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.hotspot.dashbaord.client.inbox.InboxPresenter.Display;
|
|
|
4 |
|
|
|
5 |
import com.google.gwt.dom.client.Style.Unit;
|
|
|
6 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
|
|
7 |
import com.google.gwt.user.client.ui.Anchor;
|
|
|
8 |
import com.google.gwt.user.client.ui.Composite;
|
| 306 |
ashish |
9 |
import com.google.gwt.user.client.ui.DockLayoutPanel;
|
| 167 |
ashish |
10 |
import com.google.gwt.user.client.ui.HTML;
|
| 584 |
chandransh |
11 |
import com.google.gwt.user.client.ui.Label;
|
| 167 |
ashish |
12 |
import com.google.gwt.user.client.ui.SplitLayoutPanel;
|
|
|
13 |
import com.google.gwt.user.client.ui.StackLayoutPanel;
|
| 306 |
ashish |
14 |
import com.google.gwt.user.client.ui.Tree;
|
|
|
15 |
import com.google.gwt.user.client.ui.TreeItem;
|
| 167 |
ashish |
16 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
17 |
|
|
|
18 |
public class InboxWidget extends Composite implements Display{
|
|
|
19 |
|
|
|
20 |
private final HTML commandList = new HTML("Navigation");
|
|
|
21 |
private final HTML messageDetails = new HTML("Message Details");
|
| 306 |
ashish |
22 |
private DockLayoutPanel dpanel = new DockLayoutPanel(Unit.EM);
|
| 167 |
ashish |
23 |
private SplitLayoutPanel sp = new SplitLayoutPanel();
|
| 534 |
chandransh |
24 |
|
|
|
25 |
private Tree orderTree = new Tree();
|
|
|
26 |
private final Anchor allOrders = new Anchor("All");
|
| 3065 |
chandransh |
27 |
private final Anchor verificationPendingOrders = new Anchor("Verification Pending");
|
| 487 |
rajveer |
28 |
private final Anchor newOrders = new Anchor("Pending");
|
| 534 |
chandransh |
29 |
private final Anchor acceptedOrders = new Anchor("Accepted");
|
| 306 |
ashish |
30 |
private final Anchor billedOrders = new Anchor("Billed");
|
|
|
31 |
private final Anchor shippedOrders = new Anchor("Shipped");
|
| 2449 |
chandransh |
32 |
private final Anchor deliveredOrders = new Anchor("Delivered");
|
| 530 |
chandransh |
33 |
private final Anchor rejectedOrders = new Anchor("Rejected");
|
| 306 |
ashish |
34 |
private final Anchor notAvailable = new Anchor("No Stock");
|
| 1193 |
chandransh |
35 |
private final Anchor printPending = new Anchor("Print Pending");
|
| 2509 |
chandransh |
36 |
private final Anchor doaAwaited = new Anchor("DOA Return Awaited");
|
|
|
37 |
private final Anchor salesReturnPending = new Anchor("Sales Return Awaited");
|
|
|
38 |
private final Anchor doaReturned = new Anchor("DOA Returned");
|
|
|
39 |
private final Anchor salesReturned = new Anchor("Sales Returned");
|
| 2630 |
chandransh |
40 |
private final Anchor reshipped = new Anchor("Reshipped");
|
| 2697 |
chandransh |
41 |
private final Anchor returnOrders = new Anchor("Returns");
|
| 534 |
chandransh |
42 |
|
| 597 |
chandransh |
43 |
private Label orderTreeHeader = new Label("Orders");
|
| 584 |
chandransh |
44 |
private Label catalogTreeHeader = new Label("Catalog");
|
| 760 |
chandransh |
45 |
private Label providerTreeHeader = new Label("Couriers");
|
| 2835 |
chandransh |
46 |
private Label purchaseTreeHeader = new Label("Purchases");
|
| 760 |
chandransh |
47 |
|
| 534 |
chandransh |
48 |
private Tree catalogTree = new Tree();
|
|
|
49 |
private final Anchor allItems = new Anchor("All Items");
|
|
|
50 |
private final Anchor bestSellers = new Anchor("Best Sellers");
|
|
|
51 |
private final Anchor bestDeals = new Anchor("Best Deals");
|
|
|
52 |
private final Anchor latestArrivals = new Anchor("Latest Arrivals");
|
|
|
53 |
|
| 760 |
chandransh |
54 |
private Tree providerTree = new Tree();
|
|
|
55 |
private final Anchor allProviders = new Anchor("All Couriers");
|
|
|
56 |
|
| 2835 |
chandransh |
57 |
private Tree purchaseTree = new Tree();
|
|
|
58 |
private final Anchor newPurchaseOrders = new Anchor("New POs");
|
|
|
59 |
private final Anchor openPurchaseOrders = new Anchor("Open POs");
|
|
|
60 |
private final Anchor closedPurchaseOrders = new Anchor("Closed POs");
|
|
|
61 |
|
| 306 |
ashish |
62 |
private final Anchor alerts = new Anchor("Alerts");
|
| 167 |
ashish |
63 |
private Widget finalWidget = null;
|
|
|
64 |
private Widget northWidget = null;
|
| 306 |
ashish |
65 |
private TopPanel topPanel = new TopPanel();
|
| 534 |
chandransh |
66 |
|
| 167 |
ashish |
67 |
public InboxWidget(){
|
| 534 |
chandransh |
68 |
//Prepare the order tree
|
|
|
69 |
TreeItem orderRootItem = createOrderTree();
|
|
|
70 |
orderTree.addItem(orderRootItem);
|
|
|
71 |
orderTree.setWidth("200px");
|
| 3065 |
chandransh |
72 |
orderTree.setSelectedItem(orderRootItem.getChild(1)); //FIXME: 0 is the index of the pending orders. Using numbers in code is bad practice. Fix this.
|
| 534 |
chandransh |
73 |
orderTree.ensureSelectedItemVisible();
|
|
|
74 |
|
|
|
75 |
//Prepare the catalogue tree
|
|
|
76 |
TreeItem catalogRootItem = createCatalogTree();
|
|
|
77 |
catalogTree.addItem(catalogRootItem);
|
|
|
78 |
catalogTree.setWidth("200px");
|
|
|
79 |
catalogTree.setSelectedItem(catalogRootItem.getChild(0)); //FIXME: 0 is the index of All Items. Using numbers in code is bad practice.
|
|
|
80 |
catalogTree.ensureSelectedItemVisible();
|
| 760 |
chandransh |
81 |
|
|
|
82 |
TreeItem providerRootItem = createProviderTree();
|
|
|
83 |
providerTree.addItem(providerRootItem);
|
|
|
84 |
providerTree.setWidth("200px");
|
|
|
85 |
providerTree.setSelectedItem(providerRootItem.getChild(0));
|
|
|
86 |
providerTree.ensureSelectedItemVisible();
|
| 584 |
chandransh |
87 |
|
| 2835 |
chandransh |
88 |
TreeItem purchaseRootItem = createPurchaseTree();
|
|
|
89 |
providerTree.addItem(purchaseRootItem);
|
|
|
90 |
providerTree.setWidth("200px");
|
|
|
91 |
providerTree.setSelectedItem(purchaseRootItem.getChild(0));
|
|
|
92 |
providerTree.ensureSelectedItemVisible();
|
|
|
93 |
|
| 534 |
chandransh |
94 |
//Prepare the left panel
|
|
|
95 |
StackLayoutPanel leftPanel = new StackLayoutPanel(Unit.PX);
|
| 597 |
chandransh |
96 |
leftPanel.add(orderTree, orderTreeHeader, 25);
|
| 584 |
chandransh |
97 |
leftPanel.add(catalogTree, catalogTreeHeader, 25);
|
| 760 |
chandransh |
98 |
leftPanel.add(providerTree, providerTreeHeader, 25);
|
| 2835 |
chandransh |
99 |
//leftPanel.add(purchaseTree, purchaseTreeHeader, 25);
|
| 534 |
chandransh |
100 |
leftPanel.add(new HTML("<b>that</b>"), "Reports", 25);
|
|
|
101 |
|
|
|
102 |
// Prepare the lower body of dashboard with the left navigation and the
|
|
|
103 |
// display area on the right.
|
|
|
104 |
sp.addWest(leftPanel, 200);
|
|
|
105 |
sp.add(messageDetails);
|
|
|
106 |
|
|
|
107 |
//Prepare the complete body with the header
|
| 306 |
ashish |
108 |
dpanel.addNorth(topPanel, 5);
|
|
|
109 |
dpanel.add(sp);
|
| 534 |
chandransh |
110 |
|
| 167 |
ashish |
111 |
finalWidget = messageDetails;
|
| 306 |
ashish |
112 |
initWidget(dpanel);
|
| 167 |
ashish |
113 |
|
|
|
114 |
commandList.setHTML("<p> hi, how ae you doing buddy </p><ul><li>one<li>two<li>three</ul>");
|
| 306 |
ashish |
115 |
messageDetails.setText("");
|
| 167 |
ashish |
116 |
}
|
| 534 |
chandransh |
117 |
|
|
|
118 |
private TreeItem createOrderTree(){
|
| 306 |
ashish |
119 |
TreeItem root = new TreeItem("Orders");
|
| 967 |
chandransh |
120 |
//root.addItem(allOrders);
|
| 3065 |
chandransh |
121 |
root.addItem(verificationPendingOrders);
|
| 306 |
ashish |
122 |
root.addItem(newOrders);
|
|
|
123 |
root.addItem(acceptedOrders);
|
|
|
124 |
root.addItem(billedOrders);
|
|
|
125 |
root.addItem(shippedOrders);
|
|
|
126 |
root.addItem(rejectedOrders);
|
|
|
127 |
root.addItem(notAvailable);
|
| 2449 |
chandransh |
128 |
root.addItem(printPending);
|
| 2509 |
chandransh |
129 |
root.addItem(doaAwaited);
|
|
|
130 |
root.addItem(salesReturnPending);
|
| 2449 |
chandransh |
131 |
|
| 2697 |
chandransh |
132 |
root.addItem(returnOrders);
|
| 2630 |
chandransh |
133 |
|
| 2449 |
chandransh |
134 |
root.addItem(deliveredOrders);
|
| 2509 |
chandransh |
135 |
root.addItem(doaReturned);
|
|
|
136 |
root.addItem(salesReturned);
|
| 2630 |
chandransh |
137 |
root.addItem(reshipped);
|
| 306 |
ashish |
138 |
root.addItem(alerts);
|
| 2449 |
chandransh |
139 |
deliveredOrders.setVisible(false);
|
| 2509 |
chandransh |
140 |
doaReturned.setVisible(false);
|
|
|
141 |
salesReturned.setVisible(false);
|
| 2630 |
chandransh |
142 |
reshipped.setVisible(false);
|
| 486 |
rajveer |
143 |
alerts.setVisible(false);
|
| 306 |
ashish |
144 |
return root;
|
|
|
145 |
}
|
|
|
146 |
|
| 534 |
chandransh |
147 |
private TreeItem createCatalogTree(){
|
|
|
148 |
TreeItem root = new TreeItem("Catalog");
|
|
|
149 |
root.addItem(allItems);
|
|
|
150 |
root.addItem(bestDeals);
|
|
|
151 |
root.addItem(bestSellers);
|
|
|
152 |
root.addItem(latestArrivals);
|
|
|
153 |
return root;
|
|
|
154 |
}
|
| 760 |
chandransh |
155 |
|
|
|
156 |
private TreeItem createProviderTree(){
|
|
|
157 |
TreeItem root = new TreeItem("Courier");
|
|
|
158 |
root.addItem(allProviders);
|
|
|
159 |
return root;
|
|
|
160 |
}
|
| 2835 |
chandransh |
161 |
|
|
|
162 |
private TreeItem createPurchaseTree(){
|
|
|
163 |
TreeItem root = new TreeItem("Purchase Orders");
|
|
|
164 |
root.addItem(newPurchaseOrders);
|
|
|
165 |
root.addItem(openPurchaseOrders);
|
|
|
166 |
root.addItem(closedPurchaseOrders);
|
|
|
167 |
return root;
|
|
|
168 |
}
|
| 760 |
chandransh |
169 |
|
| 167 |
ashish |
170 |
@Override
|
|
|
171 |
public Widget asWidget() {
|
|
|
172 |
|
|
|
173 |
return this;
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
@Override
|
| 534 |
chandransh |
177 |
public void updateDetailsPane(Widget details) {
|
|
|
178 |
if(finalWidget != null){
|
|
|
179 |
sp.remove(finalWidget);
|
|
|
180 |
}
|
|
|
181 |
sp.add(details);
|
|
|
182 |
finalWidget = details;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
@Override
|
|
|
186 |
public void removeDetailsPane() {
|
|
|
187 |
updateDetailsPane(messageDetails);
|
|
|
188 |
}
|
| 167 |
ashish |
189 |
|
|
|
190 |
@Override
|
|
|
191 |
public void updateOrderList(OrderList orderList) {
|
|
|
192 |
if(finalWidget != null){
|
|
|
193 |
sp.remove(finalWidget);
|
|
|
194 |
}
|
|
|
195 |
if(northWidget != null){
|
|
|
196 |
sp.remove(northWidget);
|
|
|
197 |
}
|
|
|
198 |
sp.addNorth(orderList, 200);
|
|
|
199 |
this.northWidget = orderList;
|
|
|
200 |
|
|
|
201 |
sp.add(finalWidget);
|
|
|
202 |
}
|
| 584 |
chandransh |
203 |
|
|
|
204 |
@Override
|
| 2697 |
chandransh |
205 |
public void updateReturnOrderList(ReturnOrderList retOrderList) {
|
|
|
206 |
if(finalWidget != null){
|
|
|
207 |
sp.remove(finalWidget);
|
|
|
208 |
}
|
|
|
209 |
if(northWidget != null){
|
|
|
210 |
sp.remove(northWidget);
|
|
|
211 |
}
|
|
|
212 |
sp.addNorth(retOrderList, 200);
|
|
|
213 |
this.northWidget = retOrderList;
|
|
|
214 |
|
|
|
215 |
sp.add(finalWidget);
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
@Override
|
| 584 |
chandransh |
219 |
public void updateItemList(ItemList itemList) {
|
|
|
220 |
if(finalWidget != null){
|
|
|
221 |
sp.remove(finalWidget);
|
|
|
222 |
}
|
|
|
223 |
if(northWidget != null){
|
|
|
224 |
sp.remove(northWidget);
|
|
|
225 |
}
|
|
|
226 |
sp.addNorth(itemList, 200);
|
|
|
227 |
this.northWidget = itemList;
|
|
|
228 |
|
|
|
229 |
sp.add(finalWidget);
|
|
|
230 |
}
|
| 760 |
chandransh |
231 |
|
|
|
232 |
@Override
|
|
|
233 |
public void updateProviderList(ProivderList providerList) {
|
|
|
234 |
if(finalWidget != null){
|
|
|
235 |
sp.remove(finalWidget);
|
|
|
236 |
}
|
|
|
237 |
if(northWidget != null){
|
|
|
238 |
sp.remove(northWidget);
|
|
|
239 |
}
|
|
|
240 |
sp.addNorth(providerList, 200);
|
|
|
241 |
this.northWidget = providerList;
|
|
|
242 |
|
|
|
243 |
sp.add(finalWidget);
|
|
|
244 |
}
|
| 534 |
chandransh |
245 |
|
|
|
246 |
@Override
|
|
|
247 |
public void changeGreeting(String greeting) {
|
|
|
248 |
topPanel.changeGreeting(greeting);
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
@Override
|
|
|
252 |
public HasClickHandlers getMessageBox() {
|
|
|
253 |
return null;
|
|
|
254 |
}
|
| 167 |
ashish |
255 |
|
|
|
256 |
@Override
|
|
|
257 |
public HasClickHandlers getAcceptedOrdersAnchor() {
|
|
|
258 |
return acceptedOrders;
|
|
|
259 |
}
|
|
|
260 |
|
|
|
261 |
@Override
|
| 486 |
rajveer |
262 |
public HasClickHandlers getRejectedOrdersAnchor() {
|
|
|
263 |
return rejectedOrders;
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
@Override
|
| 167 |
ashish |
267 |
public HasClickHandlers getBilledOrdersAnchor() {
|
|
|
268 |
return billedOrders;
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
@Override
|
|
|
272 |
public HasClickHandlers getNewOrdersAnchor() {
|
|
|
273 |
return newOrders;
|
|
|
274 |
}
|
|
|
275 |
|
|
|
276 |
@Override
|
|
|
277 |
public HasClickHandlers getShippedOrdersAnchor() {
|
|
|
278 |
return shippedOrders;
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
@Override
|
| 306 |
ashish |
282 |
public HasClickHandlers getSignOutLink() {
|
|
|
283 |
return topPanel.getSignOutLink();
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
@Override
|
|
|
287 |
public HasClickHandlers getAllOrdersAnchor() {
|
|
|
288 |
return allOrders;
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
@Override
|
|
|
292 |
public HasClickHandlers getAlertsAnchor() {
|
|
|
293 |
return alerts;
|
|
|
294 |
}
|
|
|
295 |
|
|
|
296 |
@Override
|
|
|
297 |
public HasClickHandlers getNotAvailableAnchor() {
|
|
|
298 |
return notAvailable;
|
|
|
299 |
}
|
|
|
300 |
|
| 760 |
chandransh |
301 |
@Override
|
| 597 |
chandransh |
302 |
public HasClickHandlers getOrdersTreeHeader(){
|
|
|
303 |
return orderTreeHeader;
|
|
|
304 |
}
|
|
|
305 |
|
| 760 |
chandransh |
306 |
@Override
|
| 597 |
chandransh |
307 |
public HasClickHandlers getAllItemsAnchor(){
|
|
|
308 |
return allItems;
|
|
|
309 |
}
|
|
|
310 |
|
| 760 |
chandransh |
311 |
@Override
|
| 597 |
chandransh |
312 |
public HasClickHandlers getBestDealsAnchor(){
|
|
|
313 |
return bestDeals;
|
|
|
314 |
}
|
|
|
315 |
|
| 760 |
chandransh |
316 |
@Override
|
| 597 |
chandransh |
317 |
public HasClickHandlers getBestSellersAnchor(){
|
|
|
318 |
return bestSellers;
|
|
|
319 |
}
|
|
|
320 |
|
| 760 |
chandransh |
321 |
@Override
|
| 597 |
chandransh |
322 |
public HasClickHandlers getLatestArrivalsAnchor(){
|
|
|
323 |
return latestArrivals;
|
|
|
324 |
}
|
|
|
325 |
|
| 760 |
chandransh |
326 |
@Override
|
| 584 |
chandransh |
327 |
public HasClickHandlers getCatalogTreeHeader(){
|
|
|
328 |
return catalogTreeHeader;
|
|
|
329 |
}
|
|
|
330 |
|
| 760 |
chandransh |
331 |
@Override
|
|
|
332 |
public HasClickHandlers getProviderTreeHeader(){
|
|
|
333 |
return providerTreeHeader;
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
@Override
|
|
|
337 |
public HasClickHandlers getAllProvidersAnchor(){
|
|
|
338 |
return allProviders;
|
|
|
339 |
}
|
| 1193 |
chandransh |
340 |
|
|
|
341 |
@Override
|
|
|
342 |
public HasClickHandlers getPrintPendingAnchor() {
|
|
|
343 |
return printPending;
|
|
|
344 |
}
|
| 2449 |
chandransh |
345 |
|
|
|
346 |
@Override
|
|
|
347 |
public HasClickHandlers getDeliveredOrdersAnchor(){
|
|
|
348 |
return deliveredOrders;
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
public void enableAdminControls(){
|
|
|
352 |
deliveredOrders.setVisible(true);
|
| 2509 |
chandransh |
353 |
doaReturned.setVisible(true);
|
|
|
354 |
salesReturned.setVisible(true);
|
| 2630 |
chandransh |
355 |
reshipped.setVisible(true);
|
| 2449 |
chandransh |
356 |
}
|
| 2509 |
chandransh |
357 |
|
|
|
358 |
@Override
|
|
|
359 |
public HasClickHandlers getDoaAwaitedAnchor() {
|
|
|
360 |
return doaAwaited;
|
|
|
361 |
}
|
|
|
362 |
|
|
|
363 |
@Override
|
|
|
364 |
public HasClickHandlers getDoaReturnedAnchor() {
|
|
|
365 |
return doaReturned;
|
|
|
366 |
}
|
|
|
367 |
|
|
|
368 |
@Override
|
|
|
369 |
public HasClickHandlers getSalesReturnPendingAnchor() {
|
|
|
370 |
return salesReturnPending;
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
@Override
|
|
|
374 |
public HasClickHandlers getSalesReturnedAnchor() {
|
|
|
375 |
return salesReturned;
|
|
|
376 |
}
|
| 2630 |
chandransh |
377 |
|
|
|
378 |
@Override
|
|
|
379 |
public HasClickHandlers getReshippedAnchor() {
|
|
|
380 |
return reshipped;
|
|
|
381 |
}
|
| 2697 |
chandransh |
382 |
|
|
|
383 |
@Override
|
|
|
384 |
public HasClickHandlers getReturnOrdersAnchor(){
|
|
|
385 |
return returnOrders;
|
|
|
386 |
}
|
| 2835 |
chandransh |
387 |
|
|
|
388 |
@Override
|
|
|
389 |
public HasClickHandlers getPurchaseTreeHeader() {
|
|
|
390 |
return purchaseTreeHeader;
|
|
|
391 |
}
|
|
|
392 |
|
|
|
393 |
@Override
|
|
|
394 |
public HasClickHandlers getNewPurchaseOrdersAnchor() {
|
|
|
395 |
return newPurchaseOrders;
|
|
|
396 |
}
|
|
|
397 |
|
|
|
398 |
@Override
|
|
|
399 |
public HasClickHandlers getOpenPurchaseOrdersAnchor() {
|
|
|
400 |
return openPurchaseOrders;
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
@Override
|
|
|
404 |
public HasClickHandlers getClosedPurchaseOrdersAnchor() {
|
|
|
405 |
return closedPurchaseOrders;
|
|
|
406 |
}
|
| 3065 |
chandransh |
407 |
|
|
|
408 |
@Override
|
|
|
409 |
public HasClickHandlers getVerificationPendingOrdersAnchor() {
|
|
|
410 |
return verificationPendingOrders;
|
|
|
411 |
}
|
| 167 |
ashish |
412 |
}
|