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