| 167 |
ashish |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
|
| 4421 |
mandeep.dh |
4 |
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
|
| 4666 |
rajveer |
5 |
import in.shop2020.hotspot.dashbaord.client.event.LostInTransitEvent;
|
| 487 |
rajveer |
6 |
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
|
| 4421 |
mandeep.dh |
7 |
import in.shop2020.hotspot.dashbaord.client.event.ProvisionalCaptureEvent;
|
| 2628 |
chandransh |
8 |
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
|
| 2843 |
chandransh |
9 |
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
|
| 306 |
ashish |
10 |
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
|
| 167 |
ashish |
11 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
| 2835 |
chandransh |
12 |
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
|
| 167 |
ashish |
13 |
|
| 4421 |
mandeep.dh |
14 |
import java.util.Map;
|
|
|
15 |
|
| 167 |
ashish |
16 |
import org.enunes.gwt.mvp.client.EventBus;
|
|
|
17 |
|
|
|
18 |
import com.google.gwt.core.client.GWT;
|
|
|
19 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
20 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
21 |
import com.google.gwt.resources.client.CssResource;
|
|
|
22 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
23 |
import com.google.gwt.uibinder.client.UiField;
|
| 487 |
rajveer |
24 |
import com.google.gwt.user.client.Window;
|
| 306 |
ashish |
25 |
import com.google.gwt.user.client.ui.Button;
|
| 167 |
ashish |
26 |
import com.google.gwt.user.client.ui.FlexTable;
|
| 306 |
ashish |
27 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
|
28 |
import com.google.gwt.user.client.ui.Label;
|
| 167 |
ashish |
29 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
| 306 |
ashish |
30 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 167 |
ashish |
31 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
32 |
|
|
|
33 |
public class OrderDetails extends ResizeComposite{
|
|
|
34 |
|
|
|
35 |
public interface Listener{
|
|
|
36 |
void onClick();
|
|
|
37 |
}
|
|
|
38 |
|
| 585 |
chandransh |
39 |
interface OrderDetailsUiBinder extends UiBinder<Widget, OrderDetails>{ }
|
| 167 |
ashish |
40 |
|
|
|
41 |
interface SelectionStyle extends CssResource{
|
| 306 |
ashish |
42 |
String blueLabel();
|
|
|
43 |
String greenLabel();
|
| 167 |
ashish |
44 |
}
|
|
|
45 |
|
| 585 |
chandransh |
46 |
private static final OrderDetailsUiBinder binder = GWT.create(OrderDetailsUiBinder.class);
|
| 167 |
ashish |
47 |
|
|
|
48 |
@UiField FlexTable header;
|
|
|
49 |
@UiField FlexTable table;
|
| 306 |
ashish |
50 |
@UiField HorizontalPanel orderDetails;
|
|
|
51 |
@UiField VerticalPanel orderDetails1;
|
|
|
52 |
@UiField VerticalPanel orderDetails2;
|
|
|
53 |
@UiField VerticalPanel orderDetails3;
|
|
|
54 |
@UiField VerticalPanel orderDetails4;
|
|
|
55 |
@UiField VerticalPanel orderDetails5;
|
|
|
56 |
@UiField SelectionStyle selectionStyle;
|
| 167 |
ashish |
57 |
|
|
|
58 |
|
|
|
59 |
private final EventBus eventbus;
|
|
|
60 |
private Order order;
|
|
|
61 |
private Order transaction;
|
| 2509 |
chandransh |
62 |
|
| 3065 |
chandransh |
63 |
//Buttons for the Warehouse Executive
|
| 4367 |
rajveer |
64 |
//private Button verifyOrder = new Button();
|
| 306 |
ashish |
65 |
private Button acceptOrder = new Button();
|
|
|
66 |
private Button rejectOrder = new Button();
|
| 4361 |
rajveer |
67 |
private Button printAllInvoices = new Button();
|
| 306 |
ashish |
68 |
private Button notAvailable= new Button();
|
|
|
69 |
private Button addBillingInfo= new Button();
|
| 2449 |
chandransh |
70 |
private Button printInvoice = new Button();
|
| 2610 |
chandransh |
71 |
private Button receiveReturn = new Button();
|
| 2509 |
chandransh |
72 |
private Button validateDOA = new Button();
|
| 4495 |
rajveer |
73 |
private Button validateReturnProduct = new Button();
|
| 677 |
chandransh |
74 |
|
| 3463 |
chandransh |
75 |
//Buttons for the Admin to track order
|
| 2509 |
chandransh |
76 |
private Button flagOrder = new Button();
|
|
|
77 |
private Button requestPickup = new Button();
|
|
|
78 |
private Button authorizePickup = new Button();
|
|
|
79 |
private Button refundOrder = new Button();
|
| 4421 |
mandeep.dh |
80 |
private Button reshipOrder = new Button();
|
| 4666 |
rajveer |
81 |
private Button markLostInTransit = new Button();
|
| 4421 |
mandeep.dh |
82 |
private Button provisionallyCapturePaymentForOrder = new Button();
|
| 2509 |
chandransh |
83 |
|
| 3463 |
chandransh |
84 |
//Buttons for the Admin to edit order details
|
|
|
85 |
private Button addWeight = new Button();
|
|
|
86 |
private Button changeColor = new Button();
|
| 3553 |
chandransh |
87 |
private Button addDelayReason = new Button();
|
| 4712 |
rajveer |
88 |
private Button markDelivered = new Button();
|
| 3463 |
chandransh |
89 |
private Button shiftWarehouse = new Button();
|
|
|
90 |
|
| 306 |
ashish |
91 |
private String user;
|
|
|
92 |
private DetailsMask mask;
|
| 677 |
chandransh |
93 |
private long warehouseID;
|
| 2835 |
chandransh |
94 |
private UserType userType;
|
| 2843 |
chandransh |
95 |
private BillingType billingType;
|
| 4363 |
rajveer |
96 |
private Map<Long, String> vendors;
|
| 4603 |
rajveer |
97 |
private Map<Long, String> providers;
|
| 167 |
ashish |
98 |
|
| 4603 |
rajveer |
99 |
public OrderDetails(EventBus eventbus, Order order, Order order2, DetailsMask mask, String user, long warehouseID, UserType userType, BillingType billingType, Map<Long, String> vendors, Map<Long, String> providers){
|
| 167 |
ashish |
100 |
this.eventbus = eventbus;
|
|
|
101 |
this.order = order;
|
|
|
102 |
this.transaction = order2;
|
| 306 |
ashish |
103 |
this.mask = mask;
|
|
|
104 |
this.user = user;
|
| 677 |
chandransh |
105 |
this.warehouseID = warehouseID;
|
| 2835 |
chandransh |
106 |
this.userType = userType;
|
| 2843 |
chandransh |
107 |
this.billingType = billingType;
|
| 4363 |
rajveer |
108 |
this.vendors = vendors;
|
| 4606 |
rajveer |
109 |
this.providers = providers;
|
| 2449 |
chandransh |
110 |
|
| 167 |
ashish |
111 |
initWidget(binder.createAndBindUi(this));
|
| 4359 |
rajveer |
112 |
initTableForWE();
|
| 2835 |
chandransh |
113 |
if(this.userType == UserType.ADMIN){
|
| 2509 |
chandransh |
114 |
initTableForAdmin();
|
|
|
115 |
}
|
| 306 |
ashish |
116 |
loadOrderDetails();
|
| 167 |
ashish |
117 |
}
|
|
|
118 |
|
| 2509 |
chandransh |
119 |
private void initTableForWE() {
|
| 4545 |
rajveer |
120 |
header.getColumnFormatter().setWidth(0, "120px");
|
|
|
121 |
header.getColumnFormatter().setWidth(1, "120px");
|
|
|
122 |
header.getColumnFormatter().setWidth(2, "120px");
|
|
|
123 |
header.getColumnFormatter().setWidth(3, "120px");
|
|
|
124 |
header.getColumnFormatter().setWidth(4, "120px");
|
|
|
125 |
header.getColumnFormatter().setWidth(5, "120px");
|
|
|
126 |
header.getColumnFormatter().setWidth(6, "120px");
|
|
|
127 |
header.getColumnFormatter().setWidth(7, "120px");
|
|
|
128 |
header.getColumnFormatter().setWidth(8, "120px");
|
| 306 |
ashish |
129 |
|
| 4367 |
rajveer |
130 |
//verifyOrder.setText("Verify");
|
| 306 |
ashish |
131 |
acceptOrder.setText("Accept");
|
|
|
132 |
notAvailable.setText("Out Of Stock");
|
|
|
133 |
addBillingInfo.setText("Bill");
|
| 2843 |
chandransh |
134 |
if(billingType == BillingType.OURS)
|
|
|
135 |
addBillingInfo.setVisible(false);
|
| 2449 |
chandransh |
136 |
printInvoice.setText("Print Invoice");
|
| 2610 |
chandransh |
137 |
receiveReturn.setText("Receive Return");
|
| 2509 |
chandransh |
138 |
validateDOA.setText("Validate DOA");
|
| 4545 |
rajveer |
139 |
validateReturnProduct.setText("Product Usable?");
|
| 4248 |
rajveer |
140 |
rejectOrder.setText("Cancel Order");
|
| 4361 |
rajveer |
141 |
printAllInvoices.setText("Print All Invoices");
|
| 486 |
rajveer |
142 |
|
| 4367 |
rajveer |
143 |
//header.setWidget(0, 0, verifyOrder);
|
|
|
144 |
header.setWidget(0, 0, acceptOrder);
|
|
|
145 |
header.setWidget(0, 1, notAvailable);
|
|
|
146 |
header.setWidget(0, 2, addBillingInfo);
|
|
|
147 |
header.setWidget(0, 3, printInvoice);
|
|
|
148 |
header.setWidget(0, 4, receiveReturn);
|
|
|
149 |
header.setWidget(0, 5, validateDOA);
|
|
|
150 |
header.setWidget(0, 6, rejectOrder);
|
|
|
151 |
header.setWidget(0, 7, printAllInvoices);
|
| 4495 |
rajveer |
152 |
header.setWidget(0, 8, validateReturnProduct);
|
| 2509 |
chandransh |
153 |
|
|
|
154 |
registerButtonHandlersForWE();
|
| 4367 |
rajveer |
155 |
if(this.userType == UserType.WAREHOUSE_EXECUTIVE || this.userType == UserType.ADMIN){
|
|
|
156 |
implementMaskForWE();
|
|
|
157 |
}
|
|
|
158 |
if(this.userType == UserType.WAREHOUSE_MONITOR){
|
|
|
159 |
implementMaskForWM();
|
|
|
160 |
}
|
|
|
161 |
|
| 167 |
ashish |
162 |
}
|
|
|
163 |
|
| 2509 |
chandransh |
164 |
private void registerButtonHandlersForWE(){
|
| 4367 |
rajveer |
165 |
/*
|
| 3065 |
chandransh |
166 |
verifyOrder.addClickHandler(new ClickHandler() {
|
|
|
167 |
|
|
|
168 |
@Override
|
|
|
169 |
public void onClick(ClickEvent event) {
|
|
|
170 |
if(verifyOrder.isEnabled()){
|
|
|
171 |
GWT.log("Verify order event fired");
|
|
|
172 |
eventbus.fireEvent(new VerifyOrderEvent(order));
|
|
|
173 |
}
|
|
|
174 |
}
|
|
|
175 |
});
|
| 4367 |
rajveer |
176 |
*/
|
| 3065 |
chandransh |
177 |
|
| 306 |
ashish |
178 |
acceptOrder.addClickHandler(new ClickHandler() {
|
|
|
179 |
|
|
|
180 |
@Override
|
|
|
181 |
public void onClick(ClickEvent event) {
|
| 2558 |
chandransh |
182 |
if(acceptOrder.isEnabled())
|
| 306 |
ashish |
183 |
eventbus.fireEvent(new AcceptOrderEvent(order));
|
|
|
184 |
}
|
|
|
185 |
});
|
| 486 |
rajveer |
186 |
|
| 487 |
rajveer |
187 |
notAvailable.addClickHandler(new ClickHandler() {
|
|
|
188 |
|
|
|
189 |
@Override
|
|
|
190 |
public void onClick(ClickEvent event) {
|
| 2558 |
chandransh |
191 |
if(notAvailable.isEnabled())
|
|
|
192 |
eventbus.fireEvent(new NostockOrderEvent(order));
|
| 487 |
rajveer |
193 |
}
|
|
|
194 |
});
|
|
|
195 |
|
| 4248 |
rajveer |
196 |
rejectOrder.addClickHandler(new ClickHandler() {
|
|
|
197 |
|
|
|
198 |
@Override
|
|
|
199 |
public void onClick(ClickEvent event) {
|
|
|
200 |
if(rejectOrder.isEnabled()){
|
|
|
201 |
RejectReasonBox box = new RejectReasonBox(eventbus, order, user);
|
|
|
202 |
box.center();
|
|
|
203 |
}
|
|
|
204 |
}
|
|
|
205 |
});
|
|
|
206 |
|
| 306 |
ashish |
207 |
addBillingInfo.addClickHandler(new ClickHandler() {
|
|
|
208 |
|
|
|
209 |
@Override
|
|
|
210 |
public void onClick(ClickEvent event) {
|
| 1146 |
chandransh |
211 |
if(!addBillingInfo.isEnabled())
|
|
|
212 |
return;
|
| 306 |
ashish |
213 |
BillingInfoBox box = new BillingInfoBox(eventbus, order, user);
|
|
|
214 |
box.center();
|
|
|
215 |
}
|
|
|
216 |
});
|
| 487 |
rajveer |
217 |
|
| 2449 |
chandransh |
218 |
printInvoice.addClickHandler(new ClickHandler() {
|
| 306 |
ashish |
219 |
|
|
|
220 |
@Override
|
|
|
221 |
public void onClick(ClickEvent event) {
|
| 2449 |
chandransh |
222 |
if(!printInvoice.isEnabled())
|
| 1146 |
chandransh |
223 |
return;
|
| 4265 |
rajveer |
224 |
if(order.getJacketNumber()==0 && billingType == BillingType.OURS){
|
| 4363 |
rajveer |
225 |
JacketInfoBox box = new JacketInfoBox(eventbus, order, user, billingType, vendors);
|
| 1146 |
chandransh |
226 |
//box.clean();
|
|
|
227 |
box.center();
|
|
|
228 |
}else{
|
| 4361 |
rajveer |
229 |
String invoiceGenerationUrl = GWT.getHostPageBaseURL() + "invoice/?id=" + order.getOrderId() + "&warehouse=" + warehouseID;
|
| 2843 |
chandransh |
230 |
if(billingType == BillingType.OURS)
|
|
|
231 |
invoiceGenerationUrl += "&withBill=true";
|
|
|
232 |
else
|
|
|
233 |
invoiceGenerationUrl += "&withBill=false";
|
| 1146 |
chandransh |
234 |
Window.open(invoiceGenerationUrl, "newWindowName", "window features.");
|
|
|
235 |
}
|
| 306 |
ashish |
236 |
}
|
|
|
237 |
});
|
| 2588 |
chandransh |
238 |
|
| 4361 |
rajveer |
239 |
printAllInvoices.addClickHandler(new ClickHandler() {
|
|
|
240 |
|
|
|
241 |
@Override
|
|
|
242 |
public void onClick(ClickEvent event) {
|
|
|
243 |
if(!printAllInvoices.isEnabled()){
|
|
|
244 |
return;
|
|
|
245 |
}else{
|
|
|
246 |
String invoiceGenerationUrl = GWT.getHostPageBaseURL() + "invoice/?id=" + order.getOrderId() + "&printAll=true&warehouse=" + warehouseID;
|
|
|
247 |
if(billingType == BillingType.OURS)
|
|
|
248 |
invoiceGenerationUrl += "&withBill=true";
|
|
|
249 |
else
|
|
|
250 |
invoiceGenerationUrl += "&withBill=false";
|
|
|
251 |
Window.open(invoiceGenerationUrl, "newWindowName", "window features.");
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
});
|
|
|
255 |
|
| 2610 |
chandransh |
256 |
receiveReturn.addClickHandler(new ClickHandler() {
|
| 2588 |
chandransh |
257 |
|
|
|
258 |
@Override
|
|
|
259 |
public void onClick(ClickEvent event) {
|
| 4478 |
rajveer |
260 |
if(!receiveReturn.isEnabled())
|
|
|
261 |
return;
|
|
|
262 |
ReceiveReturnBox box = new ReceiveReturnBox(eventbus, order);
|
|
|
263 |
box.center();
|
| 2588 |
chandransh |
264 |
}
|
|
|
265 |
});
|
|
|
266 |
|
|
|
267 |
validateDOA.addClickHandler(new ClickHandler() {
|
|
|
268 |
|
|
|
269 |
@Override
|
|
|
270 |
public void onClick(ClickEvent event) {
|
|
|
271 |
if(!validateDOA.isEnabled())
|
|
|
272 |
return;
|
|
|
273 |
DoaValidationBox box = new DoaValidationBox(eventbus, order);
|
|
|
274 |
box.center();
|
|
|
275 |
}
|
|
|
276 |
});
|
| 4495 |
rajveer |
277 |
|
|
|
278 |
validateReturnProduct.addClickHandler(new ClickHandler() {
|
|
|
279 |
|
|
|
280 |
@Override
|
|
|
281 |
public void onClick(ClickEvent event) {
|
|
|
282 |
if(!validateReturnProduct.isEnabled())
|
|
|
283 |
return;
|
|
|
284 |
ProductValidationBox box = new ProductValidationBox(eventbus, order);
|
|
|
285 |
box.center();
|
|
|
286 |
}
|
|
|
287 |
});
|
| 2449 |
chandransh |
288 |
}
|
| 487 |
rajveer |
289 |
|
| 4367 |
rajveer |
290 |
private void implementMaskForWM(){
|
| 4495 |
rajveer |
291 |
maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
|
| 4367 |
rajveer |
292 |
}
|
|
|
293 |
|
| 2509 |
chandransh |
294 |
private void implementMaskForWE(){
|
| 306 |
ashish |
295 |
switch(mask){
|
| 3065 |
chandransh |
296 |
case VERIFICATION_PENDING:
|
| 4495 |
rajveer |
297 |
maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
|
| 3065 |
chandransh |
298 |
break;
|
| 4421 |
mandeep.dh |
299 |
case CAPTURE_IN_PROCESS:
|
| 306 |
ashish |
300 |
case NEW:
|
| 4495 |
rajveer |
301 |
maskButtonsForWE(true, false, true, false, false, false, false, false, false); //Allow the WE to either accept the order or mark it as out of stock.
|
| 306 |
ashish |
302 |
break;
|
|
|
303 |
case ACCEPT:
|
| 2843 |
chandransh |
304 |
//TODO: Mask buttons based on the billingType
|
|
|
305 |
if(billingType == BillingType.OURS)
|
| 4495 |
rajveer |
306 |
maskButtonsForWE(false, false, false, true, true, false, false, true, false); // For our billing, allow the WE to directly print the invoive.
|
| 2843 |
chandransh |
307 |
else
|
| 4495 |
rajveer |
308 |
maskButtonsForWE(false, false, false, true, true, false, false, true, false); //For external billing, allow the WE to feed the invoice info.
|
| 306 |
ashish |
309 |
break;
|
| 486 |
rajveer |
310 |
case REJECT:
|
| 4495 |
rajveer |
311 |
maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Can't do anything once the order has been rejected.
|
| 486 |
rajveer |
312 |
break;
|
| 306 |
ashish |
313 |
case BILL:
|
| 4495 |
rajveer |
314 |
maskButtonsForWE(false, false, false, true, false, false, false, false, false); //Allow WE to print the invoice for a billed order.
|
| 306 |
ashish |
315 |
break;
|
|
|
316 |
case SHIP:
|
| 4495 |
rajveer |
317 |
maskButtonsForWE(false, false, false, false, false, false, false, false, false);
|
| 306 |
ashish |
318 |
break;
|
| 487 |
rajveer |
319 |
case NO_STOCK:
|
| 4495 |
rajveer |
320 |
maskButtonsForWE(true, false, false, false, false, false, false, false, false); //Allow WE to accept a low inventory item.
|
| 487 |
rajveer |
321 |
break;
|
| 4248 |
rajveer |
322 |
case CANCEL_CONFIRMED:
|
| 4495 |
rajveer |
323 |
maskButtonsForWE(false, true, false, false, false, false, false, false, false); //Allow WE to Cancel a order which is in cancellation pending state.
|
| 4248 |
rajveer |
324 |
break;
|
| 2509 |
chandransh |
325 |
case DOA_AWAITED:
|
| 2610 |
chandransh |
326 |
case SALES_RETURN_AWAITED:
|
| 4495 |
rajveer |
327 |
maskButtonsForWE(false, false, false, false, false, true, false, false, false); //Allow WE to accept the packet.
|
| 2509 |
chandransh |
328 |
break;
|
| 2610 |
chandransh |
329 |
case DOA_RECEIVED:
|
| 4495 |
rajveer |
330 |
maskButtonsForWE(false, false, false, false, false, false, true, false, false); //Allow WE to validate the DOA certificate.
|
| 2509 |
chandransh |
331 |
break;
|
| 4495 |
rajveer |
332 |
case RET_RECEIVED:
|
|
|
333 |
maskButtonsForWE(false, false, false, false, false, false, false, false, true); //Allow WE to validate the DOA certificate.
|
|
|
334 |
break;
|
|
|
335 |
|
| 2558 |
chandransh |
336 |
default:
|
| 4495 |
rajveer |
337 |
maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
|
| 2558 |
chandransh |
338 |
break;
|
| 306 |
ashish |
339 |
}
|
|
|
340 |
}
|
|
|
341 |
|
| 4495 |
rajveer |
342 |
private void maskButtonsForWE(boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa, boolean printAllInvoice, boolean validatereturnproduct){
|
| 4367 |
rajveer |
343 |
//verifyOrder.setEnabled(verify);
|
| 3065 |
chandransh |
344 |
acceptOrder.setEnabled(accept);
|
| 306 |
ashish |
345 |
notAvailable.setEnabled(notavailable);
|
| 2449 |
chandransh |
346 |
printInvoice.setEnabled(printInv);
|
| 306 |
ashish |
347 |
addBillingInfo.setEnabled(billing);
|
| 2610 |
chandransh |
348 |
receiveReturn.setEnabled(acceptdoa);
|
| 2509 |
chandransh |
349 |
validateDOA.setEnabled(validatedoa);
|
|
|
350 |
rejectOrder.setEnabled(reject);
|
| 4363 |
rajveer |
351 |
printAllInvoices.setEnabled(printAllInvoice);
|
| 4495 |
rajveer |
352 |
validateReturnProduct.setEnabled(validatereturnproduct);
|
| 306 |
ashish |
353 |
}
|
| 2509 |
chandransh |
354 |
|
|
|
355 |
private void initTableForAdmin() {
|
|
|
356 |
if(transaction.isDoaFlag()){
|
|
|
357 |
flagOrder.setText("Unflag");
|
|
|
358 |
} else {
|
|
|
359 |
flagOrder.setText("Flag");
|
|
|
360 |
}
|
|
|
361 |
|
|
|
362 |
requestPickup.setText("Request Pick-up No");
|
| 4455 |
rajveer |
363 |
authorizePickup.setText("Confirm Pick-up");
|
| 2509 |
chandransh |
364 |
reshipOrder.setText("Reship");
|
| 4666 |
rajveer |
365 |
markLostInTransit.setText("Lost In Transit");
|
| 2509 |
chandransh |
366 |
refundOrder.setText("Refund");
|
| 4545 |
rajveer |
367 |
provisionallyCapturePaymentForOrder.setText("Capture provisionally");
|
| 2509 |
chandransh |
368 |
|
| 2558 |
chandransh |
369 |
header.setWidget(1, 0, flagOrder);
|
|
|
370 |
header.setWidget(1, 1, requestPickup);
|
|
|
371 |
header.setWidget(1, 2, authorizePickup);
|
|
|
372 |
header.setWidget(1, 3, reshipOrder);
|
| 4666 |
rajveer |
373 |
header.setWidget(1, 4, markLostInTransit);
|
| 4421 |
mandeep.dh |
374 |
header.setWidget(1, 5, provisionallyCapturePaymentForOrder);
|
| 2558 |
chandransh |
375 |
header.setWidget(1, 6, refundOrder);
|
| 2509 |
chandransh |
376 |
|
| 3463 |
chandransh |
377 |
addWeight.setText("Add weight");
|
|
|
378 |
changeColor.setText("Change Color");
|
| 3553 |
chandransh |
379 |
addDelayReason.setText("Add Delay Reason");
|
| 4712 |
rajveer |
380 |
markDelivered.setText("Mark Delivered");
|
| 3463 |
chandransh |
381 |
shiftWarehouse.setText("Shift Warehouse");
|
|
|
382 |
|
|
|
383 |
header.setWidget(2, 0, addWeight);
|
|
|
384 |
header.setWidget(2, 1, changeColor);
|
| 3553 |
chandransh |
385 |
header.setWidget(2, 2, addDelayReason);
|
| 4712 |
rajveer |
386 |
header.setWidget(2, 3, markDelivered);
|
| 3463 |
chandransh |
387 |
header.setWidget(2, 6, shiftWarehouse);
|
|
|
388 |
|
|
|
389 |
if(order.getTotalWeight() != 0)
|
|
|
390 |
addWeight.setEnabled(false);
|
|
|
391 |
|
| 2509 |
chandransh |
392 |
registerButtonHandlersForAdmin();
|
| 3729 |
chandransh |
393 |
implementMaskForAdmin();
|
| 2509 |
chandransh |
394 |
}
|
| 306 |
ashish |
395 |
|
| 2509 |
chandransh |
396 |
private void registerButtonHandlersForAdmin(){
|
|
|
397 |
flagOrder.addClickHandler(new ClickHandler() {
|
|
|
398 |
|
|
|
399 |
@Override
|
|
|
400 |
public void onClick(ClickEvent event) {
|
|
|
401 |
if(flagOrder.isEnabled()){
|
|
|
402 |
eventbus.fireEvent(new FlagOrderEvent(order));
|
|
|
403 |
}
|
|
|
404 |
}
|
|
|
405 |
});
|
|
|
406 |
|
|
|
407 |
requestPickup.addClickHandler(new ClickHandler() {
|
|
|
408 |
|
|
|
409 |
@Override
|
|
|
410 |
public void onClick(ClickEvent event) {
|
| 2513 |
chandransh |
411 |
if(requestPickup.isEnabled()){
|
|
|
412 |
GWT.log("Raising a pickup request for: " + order.getOrderId());
|
| 4578 |
rajveer |
413 |
ChoosePickupProviderBox box = new ChoosePickupProviderBox(eventbus, order, providers);
|
|
|
414 |
box.center();
|
| 2513 |
chandransh |
415 |
}
|
| 2509 |
chandransh |
416 |
}
|
|
|
417 |
});
|
|
|
418 |
|
|
|
419 |
authorizePickup.addClickHandler(new ClickHandler() {
|
|
|
420 |
|
|
|
421 |
@Override
|
|
|
422 |
public void onClick(ClickEvent event) {
|
| 2526 |
chandransh |
423 |
if(!authorizePickup.isEnabled())
|
|
|
424 |
return;
|
| 4603 |
rajveer |
425 |
PickupAuthorizationInfoBox box = new PickupAuthorizationInfoBox(eventbus, order, providers);
|
| 2526 |
chandransh |
426 |
box.center();
|
| 2509 |
chandransh |
427 |
}
|
|
|
428 |
});
|
|
|
429 |
|
| 2628 |
chandransh |
430 |
reshipOrder.addClickHandler(new ClickHandler() {
|
|
|
431 |
|
|
|
432 |
@Override
|
|
|
433 |
public void onClick(ClickEvent event) {
|
|
|
434 |
if(reshipOrder.isEnabled()){
|
|
|
435 |
GWT.log("Reshipping the order: " + order.getOrderId());
|
|
|
436 |
eventbus.fireEvent(new ReshipOrderEvent(order));
|
|
|
437 |
}
|
|
|
438 |
}
|
|
|
439 |
});
|
| 4421 |
mandeep.dh |
440 |
|
| 4666 |
rajveer |
441 |
markLostInTransit.addClickHandler(new ClickHandler() {
|
|
|
442 |
|
|
|
443 |
@Override
|
|
|
444 |
public void onClick(ClickEvent event) {
|
|
|
445 |
if(markLostInTransit.isEnabled()){
|
|
|
446 |
GWT.log("Mark Lost in Transit to the order: " + order.getOrderId());
|
|
|
447 |
eventbus.fireEvent(new LostInTransitEvent(order));
|
|
|
448 |
}
|
|
|
449 |
}
|
|
|
450 |
});
|
|
|
451 |
|
|
|
452 |
provisionallyCapturePaymentForOrder.addClickHandler(new ClickHandler() {
|
| 4421 |
mandeep.dh |
453 |
|
|
|
454 |
@Override
|
|
|
455 |
public void onClick(ClickEvent event) {
|
|
|
456 |
if(provisionallyCapturePaymentForOrder.isEnabled()) {
|
|
|
457 |
GWT.log("Provisionally capturing payment for order: " + order.getOrderId());
|
|
|
458 |
eventbus.fireEvent(new ProvisionalCaptureEvent(order));
|
|
|
459 |
}
|
|
|
460 |
}
|
|
|
461 |
});
|
|
|
462 |
|
| 2509 |
chandransh |
463 |
refundOrder.addClickHandler(new ClickHandler() {
|
|
|
464 |
|
|
|
465 |
@Override
|
|
|
466 |
public void onClick(ClickEvent event) {
|
| 2747 |
chandransh |
467 |
if(refundOrder.isEnabled()){
|
|
|
468 |
RejectReasonBox box = new RejectReasonBox(eventbus, order, user);
|
| 2558 |
chandransh |
469 |
//box.clear();
|
| 4092 |
chandransh |
470 |
box.center();
|
| 2558 |
chandransh |
471 |
}
|
| 2509 |
chandransh |
472 |
}
|
|
|
473 |
});
|
| 3463 |
chandransh |
474 |
|
|
|
475 |
addWeight.addClickHandler(new ClickHandler() {
|
|
|
476 |
|
|
|
477 |
@Override
|
|
|
478 |
public void onClick(ClickEvent event) {
|
|
|
479 |
if(addWeight.isEnabled()){
|
|
|
480 |
AddWeightBox box = new AddWeightBox(eventbus, order);
|
|
|
481 |
box.center();
|
|
|
482 |
}
|
|
|
483 |
}
|
|
|
484 |
});
|
|
|
485 |
|
|
|
486 |
changeColor.addClickHandler(new ClickHandler() {
|
|
|
487 |
|
|
|
488 |
@Override
|
|
|
489 |
public void onClick(ClickEvent event) {
|
| 3473 |
chandransh |
490 |
if(changeColor.isEnabled()){
|
|
|
491 |
ChooseColorBox box = new ChooseColorBox(eventbus, order);
|
|
|
492 |
box.center();
|
|
|
493 |
}
|
| 3463 |
chandransh |
494 |
}
|
|
|
495 |
});
|
|
|
496 |
|
| 3553 |
chandransh |
497 |
addDelayReason.addClickHandler(new ClickHandler() {
|
|
|
498 |
|
|
|
499 |
@Override
|
|
|
500 |
public void onClick(ClickEvent event) {
|
|
|
501 |
AddDelayReasonBox box = new AddDelayReasonBox(eventbus, order);
|
|
|
502 |
box.center();
|
|
|
503 |
}
|
|
|
504 |
});
|
|
|
505 |
|
| 4712 |
rajveer |
506 |
markDelivered.addClickHandler(new ClickHandler() {
|
|
|
507 |
|
|
|
508 |
@Override
|
|
|
509 |
public void onClick(ClickEvent event) {
|
|
|
510 |
MarkDeliveredBox box = new MarkDeliveredBox(eventbus, order);
|
|
|
511 |
box.center();
|
|
|
512 |
}
|
|
|
513 |
});
|
|
|
514 |
|
| 3463 |
chandransh |
515 |
shiftWarehouse.addClickHandler(new ClickHandler() {
|
|
|
516 |
|
|
|
517 |
@Override
|
|
|
518 |
public void onClick(ClickEvent event) {
|
| 3473 |
chandransh |
519 |
if(shiftWarehouse.isEnabled()){
|
|
|
520 |
ChooseWarehouseBox box = new ChooseWarehouseBox(eventbus, order);
|
|
|
521 |
box.center();
|
|
|
522 |
}
|
| 3463 |
chandransh |
523 |
}
|
|
|
524 |
});
|
| 2509 |
chandransh |
525 |
}
|
|
|
526 |
|
|
|
527 |
private void implementMaskForAdmin(){
|
|
|
528 |
switch(mask){
|
| 4421 |
mandeep.dh |
529 |
case CAPTURE_IN_PROCESS:
|
| 4682 |
rajveer |
530 |
maskButtonsForAdmin(false, false, false, false, false, true, true, false); //Allow the OM to refund a COD order or an order with low inventory or when a customer calls or writes to cancel an order.
|
| 4421 |
mandeep.dh |
531 |
break;
|
|
|
532 |
case VERIFICATION_PENDING:
|
| 3729 |
chandransh |
533 |
case NEW:
|
|
|
534 |
case NO_STOCK:
|
|
|
535 |
case ACCEPT:
|
|
|
536 |
case BILL:
|
| 4682 |
rajveer |
537 |
maskButtonsForAdmin(false, false, false, false, false, true, false, false); //Allow the OM to refund a COD order or an order with low inventory or when a customer calls or writes to cancel an order.
|
| 2558 |
chandransh |
538 |
break;
|
| 2509 |
chandransh |
539 |
case DELIVERED:
|
| 4666 |
rajveer |
540 |
maskButtonsForAdmin(false, false, false, false, false, true, false, false); //Allow the OM to flag and request pickup.
|
| 4455 |
rajveer |
541 |
break;
|
|
|
542 |
case DOA_REQUEST_AUTHORIZED:
|
| 4666 |
rajveer |
543 |
maskButtonsForAdmin(true, true, false, false, false, true, false, false); //Allow the OM to flag and request pickup.
|
| 2509 |
chandransh |
544 |
break;
|
|
|
545 |
case DOA_PICKUP_REQUESTED:
|
| 4666 |
rajveer |
546 |
maskButtonsForAdmin(true, true, true, false, false, true, false, false); //Allow the OM to either re-request a pickup no. or authorize pickup by entering one
|
| 2509 |
chandransh |
547 |
break;
|
| 2610 |
chandransh |
548 |
case DOA_RETURNED:
|
| 2509 |
chandransh |
549 |
case SALES_RETURNED:
|
| 4666 |
rajveer |
550 |
maskButtonsForAdmin(false, false, false, true, true, true, false, false); //Allow the OM to either reship the order or refund it
|
| 2509 |
chandransh |
551 |
break;
|
| 4666 |
rajveer |
552 |
case SHIP:
|
|
|
553 |
maskButtonsForAdmin(false, false, false, false, false, true, false, true); //Allow the OM to either reship the order or refund it
|
|
|
554 |
break;
|
| 2558 |
chandransh |
555 |
default:
|
| 4666 |
rajveer |
556 |
maskButtonsForAdmin(false, false, false, false, false, true, false, false); //Unknown state. Let's not allow any untoward actions.
|
| 2558 |
chandransh |
557 |
break;
|
| 2509 |
chandransh |
558 |
}
|
|
|
559 |
}
|
|
|
560 |
|
| 4421 |
mandeep.dh |
561 |
private void maskButtonsForAdmin(boolean flag, boolean reqPickup, boolean authPickup, boolean reship,
|
| 4666 |
rajveer |
562 |
boolean refund, boolean printInv, boolean provisionallyCapturePayment, boolean lostInTransit)
|
| 4421 |
mandeep.dh |
563 |
{
|
| 2509 |
chandransh |
564 |
flagOrder.setEnabled(flag);
|
|
|
565 |
requestPickup.setEnabled(reqPickup);
|
|
|
566 |
authorizePickup.setEnabled(authPickup);
|
|
|
567 |
reshipOrder.setEnabled(reship);
|
| 4421 |
mandeep.dh |
568 |
provisionallyCapturePaymentForOrder.setEnabled(provisionallyCapturePayment);
|
| 2509 |
chandransh |
569 |
refundOrder.setEnabled(refund);
|
| 4309 |
rajveer |
570 |
printInvoice.setEnabled(printInv);
|
| 4666 |
rajveer |
571 |
markLostInTransit.setEnabled(lostInTransit);
|
| 2509 |
chandransh |
572 |
}
|
|
|
573 |
|
| 306 |
ashish |
574 |
private void loadOrderDetails(){
|
| 4175 |
rajveer |
575 |
orderDetails1.add(getHorizontalPanel("FREE ITEM: ", transaction.getDealText()));
|
| 966 |
chandransh |
576 |
orderDetails1.add(getHorizontalPanel("PRODUCT GROUP: ", transaction.getProductGroup()));
|
|
|
577 |
orderDetails1.add(getHorizontalPanel("BRAND: ", transaction.getBrand()));
|
|
|
578 |
orderDetails1.add(getHorizontalPanel("MODEL: ", getModelDisplayName(transaction)));
|
|
|
579 |
orderDetails1.add(getHorizontalPanel("Item ID: ", transaction.getItemId()+""));
|
| 4175 |
rajveer |
580 |
|
| 3553 |
chandransh |
581 |
orderDetails1.add(getHorizontalPanel("DELAY REASON: ", transaction.getDelayReason()));
|
| 4004 |
chandransh |
582 |
orderDetails1.add(getHorizontalPanel("ALERT: ", transaction.getAlert().toString()));
|
| 306 |
ashish |
583 |
|
| 966 |
chandransh |
584 |
orderDetails2.add(getHorizontalPanel("NAME: ", transaction.getCustomerName()));
|
|
|
585 |
orderDetails2.add(getHorizontalPanel("ADDRESS: ", getDisplayAddress(transaction)));
|
|
|
586 |
orderDetails2.add(getHorizontalPanel("MOBILE NUMBER: ", transaction.getCustomerMobileNumber()));
|
| 306 |
ashish |
587 |
|
| 966 |
chandransh |
588 |
orderDetails3.add(getHorizontalPanel("TOTAL WEIGHT: ", transaction.getTotalWeight()+""));
|
|
|
589 |
orderDetails3.add(getHorizontalPanel("TOTAL AMOUNT(Rs): ", transaction.getTotalAmount()+""));
|
| 306 |
ashish |
590 |
|
| 966 |
chandransh |
591 |
orderDetails4.add(getHorizontalPanel("AIRWAY BILL NO: ", transaction.getAirwayBillNo()));
|
|
|
592 |
orderDetails4.add(getHorizontalPanel("INVOICE NUMBER: ", transaction.getInvoiceNumber()));
|
|
|
593 |
orderDetails4.add(getHorizontalPanel("JACKET NUMBER: ", transaction.getJacketNumber() + ""));
|
| 2781 |
chandransh |
594 |
orderDetails4.add(getHorizontalPanel("ITEM NO: ", getDisplayNameForNullableString(transaction.getItemNumber())));
|
|
|
595 |
orderDetails4.add(getHorizontalPanel("IMEI NO: ", transaction.getImeiNumber() + ""));
|
|
|
596 |
|
| 966 |
chandransh |
597 |
orderDetails4.add(getHorizontalPanel("BILLED BY: ", transaction.getBilledBy()));
|
|
|
598 |
}
|
| 639 |
chandransh |
599 |
|
| 966 |
chandransh |
600 |
private HorizontalPanel getHorizontalPanel(String labelText, String valueText) {
|
|
|
601 |
HorizontalPanel hpanel = new HorizontalPanel();
|
| 639 |
chandransh |
602 |
hpanel.setSpacing(5);
|
| 966 |
chandransh |
603 |
hpanel.add(new Label(labelText));
|
|
|
604 |
hpanel.add(new Label(valueText));
|
| 639 |
chandransh |
605 |
hpanel.setCellWidth(hpanel.getWidget(0), "128px");
|
|
|
606 |
hpanel.setCellWidth(hpanel.getWidget(1), "128px");
|
|
|
607 |
hpanel.getWidget(0).setStyleName(selectionStyle.blueLabel());
|
|
|
608 |
hpanel.getWidget(1).setStyleName(selectionStyle.greenLabel());
|
| 966 |
chandransh |
609 |
return hpanel;
|
|
|
610 |
}
|
| 306 |
ashish |
611 |
|
| 966 |
chandransh |
612 |
private String getModelDisplayName(Order order){
|
|
|
613 |
String modelName = "";
|
|
|
614 |
if(order.getModelName()!=null)
|
|
|
615 |
modelName = order.getModelName() + " ";
|
|
|
616 |
if(order.getModelNumber()!=null)
|
|
|
617 |
modelName = modelName + order.getModelNumber();
|
|
|
618 |
if(order.getColor()!=null)
|
|
|
619 |
modelName = modelName + " (" + order.getColor() + ")";
|
|
|
620 |
return modelName;
|
| 306 |
ashish |
621 |
}
|
| 966 |
chandransh |
622 |
|
|
|
623 |
private String getDisplayAddress(Order order){
|
|
|
624 |
StringBuilder displayAddress = new StringBuilder();
|
|
|
625 |
displayAddress.append(order.getCustomerAddress1() + "\n");
|
|
|
626 |
displayAddress.append(order.getCustomerAddress2() + "\n");
|
|
|
627 |
displayAddress.append(order.getCustomerCity() + "\n");
|
|
|
628 |
displayAddress.append(order.getCustomerState() + " PIN - " + order.getCustomerPincode());
|
|
|
629 |
return displayAddress.toString();
|
|
|
630 |
}
|
| 2781 |
chandransh |
631 |
|
|
|
632 |
private String getDisplayNameForNullableString(String s) {
|
|
|
633 |
if (s == null)
|
|
|
634 |
return "";
|
|
|
635 |
return s;
|
|
|
636 |
}
|
| 167 |
ashish |
637 |
}
|