| 585 |
chandransh |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
| 586 |
chandransh |
3 |
import java.util.Date;
|
|
|
4 |
|
| 585 |
chandransh |
5 |
import in.shop2020.hotspot.dashbaord.shared.actions.Item;
|
|
|
6 |
|
|
|
7 |
import org.enunes.gwt.mvp.client.EventBus;
|
|
|
8 |
|
|
|
9 |
import com.google.gwt.core.client.GWT;
|
|
|
10 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
11 |
import com.google.gwt.uibinder.client.UiField;
|
| 586 |
chandransh |
12 |
import com.google.gwt.user.client.ui.Label;
|
|
|
13 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
| 585 |
chandransh |
14 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
15 |
|
| 586 |
chandransh |
16 |
public class ItemDetails extends ResizeComposite {
|
| 585 |
chandransh |
17 |
|
|
|
18 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
|
|
19 |
|
|
|
20 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {
|
|
|
21 |
}
|
| 586 |
chandransh |
22 |
|
| 585 |
chandransh |
23 |
private final EventBus eventbus;
|
|
|
24 |
private final Item item;
|
|
|
25 |
|
| 960 |
chandransh |
26 |
@UiField Label itemId, productGroup, brand, modelNumber, modelName, color;
|
| 586 |
chandransh |
27 |
@UiField Label category, comments;
|
| 1344 |
chandransh |
28 |
@UiField Label catalogItemId;
|
| 608 |
chandransh |
29 |
@UiField Label mrp, mop, sellingPrice, dealerPrice, weight;
|
|
|
30 |
@UiField Label addedOn, startDate, retireDate, updatedOn;
|
|
|
31 |
@UiField Label bestDealsText, bestDealsValue;
|
| 585 |
chandransh |
32 |
|
|
|
33 |
public ItemDetails(EventBus eventbus, Item item){
|
|
|
34 |
this.eventbus = eventbus;
|
|
|
35 |
this.item = item;
|
|
|
36 |
initWidget(uiBinder.createAndBindUi(this));
|
| 586 |
chandransh |
37 |
initItemDetails(this.item);
|
| 585 |
chandransh |
38 |
}
|
|
|
39 |
|
| 586 |
chandransh |
40 |
private void initItemDetails(Item item){
|
|
|
41 |
itemId.setText(item.getId()+"");
|
| 960 |
chandransh |
42 |
productGroup.setText(item.getProductGroup());
|
|
|
43 |
brand.setText(item.getBrand());
|
| 586 |
chandransh |
44 |
modelNumber.setText(item.getModelNumber());
|
|
|
45 |
modelName.setText(item.getModelName());
|
| 608 |
chandransh |
46 |
color.setText(item.getColor());
|
| 586 |
chandransh |
47 |
|
| 625 |
chandransh |
48 |
category.setText(item.getCategory()+"");
|
| 586 |
chandransh |
49 |
comments.setText(item.getComments());
|
|
|
50 |
catalogItemId.setText(item.getCatalogItemId() + "");
|
|
|
51 |
|
|
|
52 |
mrp.setText(item.getMrp()+"");
|
|
|
53 |
mop.setText(item.getMop()+"");
|
|
|
54 |
sellingPrice.setText(item.getSellingPrice()+"");
|
| 608 |
chandransh |
55 |
dealerPrice.setText(item.getDealerPrice()+"");
|
| 586 |
chandransh |
56 |
weight.setText(item.getWeight()+"");
|
| 587 |
chandransh |
57 |
|
|
|
58 |
addedOn.setText(getDisplayableDate(item.getAddedOn()));
|
|
|
59 |
startDate.setText(getDisplayableDate(item.getStartDate()));
|
|
|
60 |
retireDate.setText(getDisplayableDate(item.getRetireDate()));
|
| 608 |
chandransh |
61 |
updatedOn.setText(getDisplayableDate(item.getUpdatedOn()));
|
|
|
62 |
|
|
|
63 |
bestDealsText.setText(item.getBestDealsText());
|
|
|
64 |
bestDealsValue.setText(item.getBestDealsValue()+"");
|
| 585 |
chandransh |
65 |
}
|
| 586 |
chandransh |
66 |
|
|
|
67 |
//TODO: This code is duplicated between here and OrderList. Move it to a Utility class.
|
| 587 |
chandransh |
68 |
private String getDisplayableDate(Long millis){
|
|
|
69 |
Date date = new Date();
|
|
|
70 |
date.setTime(millis);
|
| 586 |
chandransh |
71 |
String dateString = date.toString();
|
|
|
72 |
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
|
|
|
73 |
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
|
|
|
74 |
return dateString;
|
| 585 |
chandransh |
75 |
}
|
|
|
76 |
}
|