Subversion Repositories SmartDukaan

Rev

Rev 4363 | Rev 4421 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4363 Rev 4367
Line 6... Line 6...
6
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
6
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
8
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
8
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
9
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
9
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
10
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
10
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
11
import in.shop2020.hotspot.dashbaord.client.event.VerifyOrderEvent;
-
 
12
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
11
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
13
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
12
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
14
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
13
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
15
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
14
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
16
 
15
 
Line 60... Line 59...
60
	private final EventBus eventbus;
59
	private final EventBus eventbus;
61
	private Order order;
60
	private Order order;
62
	private Order transaction;
61
	private Order transaction;
63
	
62
	
64
	//Buttons for the Warehouse Executive
63
	//Buttons for the Warehouse Executive
65
	private Button verifyOrder = new Button();
64
	//private Button verifyOrder = new Button();
66
	private Button acceptOrder = new Button();
65
	private Button acceptOrder = new Button();
67
	private Button rejectOrder = new Button();
66
	private Button rejectOrder = new Button();
68
	private Button printAllInvoices = new Button();
67
	private Button printAllInvoices = new Button();
69
	private Button notAvailable= new Button();
68
	private Button notAvailable= new Button();
70
	private Button addBillingInfo= new Button();
69
	private Button addBillingInfo= new Button();
Line 110... Line 109...
110
		}
109
		}
111
		loadOrderDetails();
110
		loadOrderDetails();
112
	}
111
	}
113
	
112
	
114
	private void initTableForWE() {
113
	private void initTableForWE() {
115
		header.getColumnFormatter().setWidth(0, "128px");
114
		header.getColumnFormatter().setWidth(0, "100px");
116
	    header.getColumnFormatter().setWidth(1, "128px");
115
	    header.getColumnFormatter().setWidth(1, "100px");
117
	    header.getColumnFormatter().setWidth(2, "128px");
116
	    header.getColumnFormatter().setWidth(2, "100px");
118
	    header.getColumnFormatter().setWidth(3, "128px");
117
	    header.getColumnFormatter().setWidth(3, "100px");
119
	    header.getColumnFormatter().setWidth(4, "128px");
118
	    header.getColumnFormatter().setWidth(4, "100px");
120
	    header.getColumnFormatter().setWidth(5, "128px");
119
	    header.getColumnFormatter().setWidth(5, "100px");
121
	    header.getColumnFormatter().setWidth(6, "128px");
120
	    header.getColumnFormatter().setWidth(6, "100px");
-
 
121
	    header.getColumnFormatter().setWidth(7, "100px");
122
	    
122
	    
123
	    verifyOrder.setText("Verify");
123
	    //verifyOrder.setText("Verify");
124
	    acceptOrder.setText("Accept");
124
	    acceptOrder.setText("Accept");
125
	    notAvailable.setText("Out Of Stock");
125
	    notAvailable.setText("Out Of Stock");
126
	    addBillingInfo.setText("Bill");
126
	    addBillingInfo.setText("Bill");
127
	    if(billingType == BillingType.OURS)
127
	    if(billingType == BillingType.OURS)
128
	        addBillingInfo.setVisible(false);
128
	        addBillingInfo.setVisible(false);
Line 130... Line 130...
130
	    receiveReturn.setText("Receive Return");
130
	    receiveReturn.setText("Receive Return");
131
	    validateDOA.setText("Validate DOA");
131
	    validateDOA.setText("Validate DOA");
132
	    rejectOrder.setText("Cancel Order");
132
	    rejectOrder.setText("Cancel Order");
133
	    printAllInvoices.setText("Print All Invoices");
133
	    printAllInvoices.setText("Print All Invoices");
134
	    
134
	    
135
	    header.setWidget(0, 0, verifyOrder);
135
	    //header.setWidget(0, 0, verifyOrder);
136
	    header.setWidget(0, 1, acceptOrder);
136
	    header.setWidget(0, 0, acceptOrder);
137
	    header.setWidget(0, 2, notAvailable);
137
	    header.setWidget(0, 1, notAvailable);
138
	    header.setWidget(0, 3, addBillingInfo);
138
	    header.setWidget(0, 2, addBillingInfo);
139
	    header.setWidget(0, 4, printInvoice);
139
	    header.setWidget(0, 3, printInvoice);
140
	    header.setWidget(0, 5, receiveReturn);
140
	    header.setWidget(0, 4, receiveReturn);
141
	    header.setWidget(0, 6, validateDOA);
141
	    header.setWidget(0, 5, validateDOA);
142
	    header.setWidget(0, 7, rejectOrder);
142
	    header.setWidget(0, 6, rejectOrder);
143
	    header.setWidget(0, 8, printAllInvoices);
143
	    header.setWidget(0, 7, printAllInvoices);
144
	    
144
	    
145
	    registerButtonHandlersForWE();
145
	    registerButtonHandlersForWE();
-
 
146
	    if(this.userType == UserType.WAREHOUSE_EXECUTIVE || this.userType == UserType.ADMIN){
146
		implementMaskForWE();
147
			implementMaskForWE();
-
 
148
		}
-
 
149
		if(this.userType == UserType.WAREHOUSE_MONITOR){
-
 
150
			implementMaskForWM();
-
 
151
		}
-
 
152
		
147
	}
153
	}
148
	
154
	
149
	private void registerButtonHandlersForWE(){
155
	private void registerButtonHandlersForWE(){
-
 
156
		/*
150
	    verifyOrder.addClickHandler(new ClickHandler() {
157
	    verifyOrder.addClickHandler(new ClickHandler() {
151
            
158
            
152
            @Override
159
            @Override
153
            public void onClick(ClickEvent event) {
160
            public void onClick(ClickEvent event) {
154
                if(verifyOrder.isEnabled()){
161
                if(verifyOrder.isEnabled()){
155
                    GWT.log("Verify order event fired");
162
                    GWT.log("Verify order event fired");
156
                    eventbus.fireEvent(new VerifyOrderEvent(order));
163
                    eventbus.fireEvent(new VerifyOrderEvent(order));
157
                }
164
                }
158
            }
165
            }
159
        });
166
        });
-
 
167
	    */
160
	    
168
	    
161
		acceptOrder.addClickHandler(new ClickHandler() {
169
		acceptOrder.addClickHandler(new ClickHandler() {
162
			
170
			
163
			@Override
171
			@Override
164
			public void onClick(ClickEvent event) {
172
			public void onClick(ClickEvent event) {
Line 255... Line 263...
255
				box.center();
263
				box.center();
256
			}
264
			}
257
		});
265
		});
258
	}
266
	}
259
 
267
 
-
 
268
	private void implementMaskForWM(){
-
 
269
		maskButtonsForWE(false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
-
 
270
	}
-
 
271
	
260
	private void implementMaskForWE(){
272
	private void implementMaskForWE(){
261
		switch(mask){
273
		switch(mask){
262
		case VERIFICATION_PENDING:
274
		case VERIFICATION_PENDING:
263
		    maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
275
		    maskButtonsForWE(false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
264
		    break;
276
		    break;
265
		case NEW:
277
		case NEW:
266
			maskButtonsForWE(false, true, false, true, false, false, false, false, false);  //Allow the WE to either accept the order or mark it as out of stock.
278
			maskButtonsForWE(true, false, true, false, false, false, false, false);  //Allow the WE to either accept the order or mark it as out of stock.
267
			break;
279
			break;
268
		case ACCEPT:
280
		case ACCEPT:
269
		    //TODO: Mask buttons based on the billingType
281
		    //TODO: Mask buttons based on the billingType
270
		    if(billingType == BillingType.OURS)
282
		    if(billingType == BillingType.OURS)
271
		        maskButtonsForWE(false, false, false, false, true, true, false, false, true); // For our billing, allow the WE to directly print the invoive.
283
		        maskButtonsForWE(false, false, false, true, true, false, false, true); // For our billing, allow the WE to directly print the invoive.
272
		    else
284
		    else
273
		        maskButtonsForWE(false, false, false, false, true, true, false, false, true); //For external billing, allow the WE to feed the invoice info.
285
		        maskButtonsForWE(false, false, false, true, true, false, false, true); //For external billing, allow the WE to feed the invoice info.
274
			break;
286
			break;
275
		case REJECT:
287
		case REJECT:
276
			maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Can't do anything once the order has been rejected.
288
			maskButtonsForWE(false, false, false, false, false, false, false, false); //Can't do anything once the order has been rejected.
277
			break;
289
			break;
278
		case BILL:
290
		case BILL:
279
			maskButtonsForWE(false, false, false, false, true, false, false, false, false); //Allow WE to print the invoice for a billed order.
291
			maskButtonsForWE(false, false, false, true, false, false, false, false); //Allow WE to print the invoice for a billed order.
280
			break;
292
			break;
281
		case SHIP:
293
		case SHIP:
282
			maskButtonsForWE(false, false, false, false, false, false, false, false, false);
294
			maskButtonsForWE(false, false, false, false, false, false, false, false);
283
			break;
295
			break;
284
		case NO_STOCK:
296
		case NO_STOCK:
285
			maskButtonsForWE(false, true, false, false, false, false, false, false, false); //Allow WE to accept a low inventory item. 
297
			maskButtonsForWE(true, false, false, false, false, false, false, false); //Allow WE to accept a low inventory item. 
286
			break;
298
			break;
287
		case CANCEL_CONFIRMED:
299
		case CANCEL_CONFIRMED:
288
			maskButtonsForWE(false, false, true, false, false, false, false, false, false); //Allow WE to Cancel a order which is in cancellation pending state. 
300
			maskButtonsForWE(false, true, false, false, false, false, false, false); //Allow WE to Cancel a order which is in cancellation pending state. 
289
			break;			
301
			break;			
290
		case DOA_AWAITED:
302
		case DOA_AWAITED:
291
		case SALES_RETURN_AWAITED:
303
		case SALES_RETURN_AWAITED:
292
			maskButtonsForWE(false, false, false, false, false, false, true, false, false); //Allow WE to accept the packet.
304
			maskButtonsForWE(false, false, false, false, false, true, false, false); //Allow WE to accept the packet.
293
			break;
305
			break;
294
		case DOA_RECEIVED:
306
		case DOA_RECEIVED:
295
			maskButtonsForWE(false, false, false, false, false, false, false, true, false); //Allow WE to validate the DOA certificate.
307
			maskButtonsForWE(false, false, false, false, false, false, true, false); //Allow WE to validate the DOA certificate.
296
			break;
308
			break;
297
		default:
309
		default:
298
			maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
310
			maskButtonsForWE(false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
299
			break;
311
			break;
300
		}
312
		}
301
	}
313
	}
302
	
314
	
303
	private void maskButtonsForWE(boolean verify, boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa, boolean printAllInvoice){
315
	private void maskButtonsForWE(boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa, boolean printAllInvoice){
304
	    verifyOrder.setEnabled(verify);
316
	    //verifyOrder.setEnabled(verify);
305
	    acceptOrder.setEnabled(accept);
317
	    acceptOrder.setEnabled(accept);
306
		notAvailable.setEnabled(notavailable);
318
		notAvailable.setEnabled(notavailable);
307
		printInvoice.setEnabled(printInv);
319
		printInvoice.setEnabled(printInv);
308
		addBillingInfo.setEnabled(billing);
320
		addBillingInfo.setEnabled(billing);
309
		receiveReturn.setEnabled(acceptdoa);
321
		receiveReturn.setEnabled(acceptdoa);