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