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