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