| Line 1... |
Line 1... |
| 1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.util.HashMap;
|
| - |
|
4 |
import java.util.Map;
|
| - |
|
5 |
import java.util.Map.Entry;
|
| - |
|
6 |
|
| 3 |
import in.shop2020.hotspot.dashbaord.client.event.AddJacketNumberEvent;
|
7 |
import in.shop2020.hotspot.dashbaord.client.event.AddJacketNumberEvent;
|
| 4 |
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
|
8 |
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
|
| 5 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
9 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
| 6 |
|
10 |
|
| 7 |
import org.enunes.gwt.mvp.client.EventBus;
|
11 |
import org.enunes.gwt.mvp.client.EventBus;
|
| Line 10... |
Line 14... |
| 10 |
import com.google.gwt.event.dom.client.ClickHandler;
|
14 |
import com.google.gwt.event.dom.client.ClickHandler;
|
| 11 |
import com.google.gwt.user.client.ui.Button;
|
15 |
import com.google.gwt.user.client.ui.Button;
|
| 12 |
import com.google.gwt.user.client.ui.DialogBox;
|
16 |
import com.google.gwt.user.client.ui.DialogBox;
|
| 13 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
17 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
| 14 |
import com.google.gwt.user.client.ui.Label;
|
18 |
import com.google.gwt.user.client.ui.Label;
|
| - |
|
19 |
import com.google.gwt.user.client.ui.ListBox;
|
| 15 |
import com.google.gwt.user.client.ui.TextBox;
|
20 |
import com.google.gwt.user.client.ui.TextBox;
|
| 16 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
21 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 17 |
import com.google.gwt.user.client.ui.Widget;
|
22 |
import com.google.gwt.user.client.ui.Widget;
|
| 18 |
|
23 |
|
| 19 |
public class JacketInfoBox extends DialogBox {
|
24 |
public class JacketInfoBox extends DialogBox {
|
| Line 28... |
Line 33... |
| 28 |
private Label imeiNumberLabel = new Label("IMEI No.");
|
33 |
private Label imeiNumberLabel = new Label("IMEI No.");
|
| 29 |
private TextBox imeiNumberBox = new TextBox();
|
34 |
private TextBox imeiNumberBox = new TextBox();
|
| 30 |
|
35 |
|
| 31 |
private Label billedBy = new Label("Billed by");
|
36 |
private Label billedBy = new Label("Billed by");
|
| 32 |
|
37 |
|
| - |
|
38 |
private Label vendorLabel = new Label("Vendor");
|
| - |
|
39 |
private ListBox vendorBox = new ListBox();
|
| - |
|
40 |
|
| - |
|
41 |
|
| 33 |
private Button submitbutton = new Button("Submit");
|
42 |
private Button submitbutton = new Button("Submit");
|
| 34 |
private VerticalPanel vpanel = new VerticalPanel();
|
43 |
private VerticalPanel vpanel = new VerticalPanel();
|
| 35 |
|
44 |
|
| - |
|
45 |
private Map<Long, String> vendors = new HashMap<Long, String>();
|
| - |
|
46 |
|
| 36 |
public JacketInfoBox(final EventBus eventBus, final Order order, final String user, final BillingType billingType){
|
47 |
public JacketInfoBox(final EventBus eventBus, final Order order, final String user, final BillingType billingType){
|
| 37 |
vpanel.add(errorLabel);
|
48 |
vpanel.add(errorLabel);
|
| 38 |
vpanel.add(getHorizontalPanel(jacketNumberLabel, jacketNumberBox)); //Ask for the jacket number
|
49 |
vpanel.add(getHorizontalPanel(jacketNumberLabel, jacketNumberBox)); //Ask for the jacket number
|
| 39 |
if(billingType == BillingType.OURS){
|
50 |
if(billingType == BillingType.OURS){
|
| 40 |
vpanel.add(getHorizontalPanel(itemNumberLabel, itemNumberBox)); //Ask for the item number
|
51 |
vpanel.add(getHorizontalPanel(itemNumberLabel, itemNumberBox)); //Ask for the item number
|
| 41 |
if("Handsets".equalsIgnoreCase(order.getProductGroup())){
|
52 |
if("Handsets".equalsIgnoreCase(order.getProductGroup())){
|
| 42 |
vpanel.add(getHorizontalPanel(imeiNumberLabel, imeiNumberBox)); //Ask for IMEI only in case of Handsets
|
53 |
vpanel.add(getHorizontalPanel(imeiNumberLabel, imeiNumberBox)); //Ask for IMEI only in case of Handsets
|
| 43 |
}
|
54 |
}
|
| 44 |
}
|
55 |
}
|
| - |
|
56 |
|
| - |
|
57 |
//FIXME Hardcoded for vendor
|
| - |
|
58 |
//vendors.put(2L, "Tulip Tech Products");
|
| - |
|
59 |
vendors.put(3L, "Sarvottam Telecare");
|
| - |
|
60 |
vendors.put(4L, "Indira Switch");
|
| 45 |
|
61 |
|
| - |
|
62 |
for(Entry<Long, String> vendor: vendors.entrySet()){
|
| - |
|
63 |
vendorBox.addItem(vendor.getValue(), vendor.getKey()+"");
|
| - |
|
64 |
}
|
| - |
|
65 |
vpanel.add(getHorizontalPanel(vendorLabel, vendorBox));
|
| - |
|
66 |
|
| - |
|
67 |
|
| 46 |
vpanel.add(getHorizontalPanel(billedBy, new Label(user)));
|
68 |
vpanel.add(getHorizontalPanel(billedBy, new Label(user)));
|
| 47 |
vpanel.add(submitbutton);
|
69 |
vpanel.add(submitbutton);
|
| 48 |
|
70 |
|
| 49 |
setWidget(vpanel);
|
71 |
setWidget(vpanel);
|
| 50 |
setAutoHideEnabled(true);
|
72 |
setAutoHideEnabled(true);
|
| Line 91... |
Line 113... |
| 91 |
errorLabel.setText("Invalid IMEI number");
|
113 |
errorLabel.setText("Invalid IMEI number");
|
| 92 |
return;
|
114 |
return;
|
| 93 |
}
|
115 |
}
|
| 94 |
}
|
116 |
}
|
| 95 |
}
|
117 |
}
|
| - |
|
118 |
long vendorId = -1;
|
| - |
|
119 |
try {
|
| - |
|
120 |
vendorId = Long.parseLong(vendorBox.getValue(vendorBox.getSelectedIndex()));
|
| - |
|
121 |
} catch(NumberFormatException nfe){
|
| - |
|
122 |
nfe.printStackTrace();
|
| - |
|
123 |
}
|
| - |
|
124 |
|
| - |
|
125 |
if(vendorId <= 0){
|
| - |
|
126 |
errorLabel.setText("Invalid Vendor");
|
| - |
|
127 |
return;
|
| - |
|
128 |
}
|
| - |
|
129 |
|
| 96 |
eventBus.fireEvent(new AddJacketNumberEvent(order, jacketNumber, imeiNumber, itemNumber.trim(), user, billingType));
|
130 |
eventBus.fireEvent(new AddJacketNumberEvent(order, jacketNumber, imeiNumber, itemNumber.trim(), user, billingType, vendorId));
|
| 97 |
hide();
|
131 |
hide();
|
| 98 |
clean();
|
132 |
clean();
|
| 99 |
}
|
133 |
}
|
| 100 |
});
|
134 |
});
|
| 101 |
}
|
135 |
}
|