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