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