| 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 Item item;
|
|
|
24 |
|
| 960 |
chandransh |
25 |
@UiField Label itemId, productGroup, brand, modelNumber, modelName, color;
|
| 586 |
chandransh |
26 |
@UiField Label category, comments;
|
| 1344 |
chandransh |
27 |
@UiField Label catalogItemId;
|
| 608 |
chandransh |
28 |
@UiField Label mrp, mop, sellingPrice, dealerPrice, weight;
|
|
|
29 |
@UiField Label addedOn, startDate, retireDate, updatedOn;
|
|
|
30 |
@UiField Label bestDealsText, bestDealsValue;
|
| 585 |
chandransh |
31 |
|
|
|
32 |
public ItemDetails(EventBus eventbus, Item item){
|
|
|
33 |
this.item = item;
|
|
|
34 |
initWidget(uiBinder.createAndBindUi(this));
|
| 586 |
chandransh |
35 |
initItemDetails(this.item);
|
| 585 |
chandransh |
36 |
}
|
|
|
37 |
|
| 586 |
chandransh |
38 |
private void initItemDetails(Item item){
|
|
|
39 |
itemId.setText(item.getId()+"");
|
| 960 |
chandransh |
40 |
productGroup.setText(item.getProductGroup());
|
|
|
41 |
brand.setText(item.getBrand());
|
| 586 |
chandransh |
42 |
modelNumber.setText(item.getModelNumber());
|
|
|
43 |
modelName.setText(item.getModelName());
|
| 608 |
chandransh |
44 |
color.setText(item.getColor());
|
| 586 |
chandransh |
45 |
|
| 625 |
chandransh |
46 |
category.setText(item.getCategory()+"");
|
| 586 |
chandransh |
47 |
comments.setText(item.getComments());
|
|
|
48 |
catalogItemId.setText(item.getCatalogItemId() + "");
|
|
|
49 |
|
|
|
50 |
mrp.setText(item.getMrp()+"");
|
|
|
51 |
mop.setText(item.getMop()+"");
|
|
|
52 |
sellingPrice.setText(item.getSellingPrice()+"");
|
| 608 |
chandransh |
53 |
dealerPrice.setText(item.getDealerPrice()+"");
|
| 586 |
chandransh |
54 |
weight.setText(item.getWeight()+"");
|
| 587 |
chandransh |
55 |
|
|
|
56 |
addedOn.setText(getDisplayableDate(item.getAddedOn()));
|
|
|
57 |
startDate.setText(getDisplayableDate(item.getStartDate()));
|
|
|
58 |
retireDate.setText(getDisplayableDate(item.getRetireDate()));
|
| 608 |
chandransh |
59 |
updatedOn.setText(getDisplayableDate(item.getUpdatedOn()));
|
|
|
60 |
|
|
|
61 |
bestDealsText.setText(item.getBestDealsText());
|
|
|
62 |
bestDealsValue.setText(item.getBestDealsValue()+"");
|
| 585 |
chandransh |
63 |
}
|
| 586 |
chandransh |
64 |
|
|
|
65 |
//TODO: This code is duplicated between here and OrderList. Move it to a Utility class.
|
| 587 |
chandransh |
66 |
private String getDisplayableDate(Long millis){
|
|
|
67 |
Date date = new Date();
|
|
|
68 |
date.setTime(millis);
|
| 586 |
chandransh |
69 |
String dateString = date.toString();
|
|
|
70 |
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
|
|
|
71 |
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
|
|
|
72 |
return dateString;
|
| 585 |
chandransh |
73 |
}
|
|
|
74 |
}
|