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