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