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