Subversion Repositories SmartDukaan

Rev

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

Rev 2908 Rev 3065
Line 4... Line 4...
4
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
4
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
5
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
5
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
6
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
6
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
8
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
8
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
-
 
9
import in.shop2020.hotspot.dashbaord.client.event.VerifyOrderEvent;
9
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
10
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
10
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
11
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
11
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
12
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
12
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
13
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
13
 
14
 
Line 56... Line 57...
56
	
57
	
57
	private final EventBus eventbus;
58
	private final EventBus eventbus;
58
	private Order order;
59
	private Order order;
59
	private Order transaction;
60
	private Order transaction;
60
	
61
	
61
	//Buttons for the Warehouse Executive 
62
	//Buttons for the Warehouse Executive
-
 
63
	private Button verifyOrder = new Button();
62
	private Button acceptOrder = new Button();
64
	private Button acceptOrder = new Button();
63
	private Button rejectOrder = new Button();
65
	private Button rejectOrder = new Button();
64
	private Button notAvailable= new Button();
66
	private Button notAvailable= new Button();
65
	private Button addBillingInfo= new Button();
67
	private Button addBillingInfo= new Button();
66
	private Button printInvoice = new Button();
68
	private Button printInvoice = new Button();
Line 105... Line 107...
105
	    header.getColumnFormatter().setWidth(3, "128px");
107
	    header.getColumnFormatter().setWidth(3, "128px");
106
	    header.getColumnFormatter().setWidth(4, "128px");
108
	    header.getColumnFormatter().setWidth(4, "128px");
107
	    header.getColumnFormatter().setWidth(5, "128px");
109
	    header.getColumnFormatter().setWidth(5, "128px");
108
	    header.getColumnFormatter().setWidth(6, "256px");
110
	    header.getColumnFormatter().setWidth(6, "256px");
109
	    
111
	    
-
 
112
	    verifyOrder.setText("Verify");
110
	    acceptOrder.setText("Accept");
113
	    acceptOrder.setText("Accept");
111
	    notAvailable.setText("Out Of Stock");
114
	    notAvailable.setText("Out Of Stock");
112
	    addBillingInfo.setText("Bill");
115
	    addBillingInfo.setText("Bill");
113
	    if(billingType == BillingType.OURS)
116
	    if(billingType == BillingType.OURS)
114
	        addBillingInfo.setVisible(false);
117
	        addBillingInfo.setVisible(false);
115
	    printInvoice.setText("Print Invoice");
118
	    printInvoice.setText("Print Invoice");
116
	    receiveReturn.setText("Receive Return");
119
	    receiveReturn.setText("Receive Return");
117
	    validateDOA.setText("Validate DOA");
120
	    validateDOA.setText("Validate DOA");
118
	    
121
	    
-
 
122
	    header.setWidget(0, 0, verifyOrder);
119
	    header.setWidget(0, 0, acceptOrder);
123
	    header.setWidget(0, 1, acceptOrder);
120
	    header.setWidget(0, 1, notAvailable);
124
	    header.setWidget(0, 2, notAvailable);
121
	    header.setWidget(0, 2, addBillingInfo);
125
	    header.setWidget(0, 3, addBillingInfo);
122
	    header.setWidget(0, 3, printInvoice);
126
	    header.setWidget(0, 4, printInvoice);
123
	    header.setWidget(0, 4, receiveReturn);
127
	    header.setWidget(0, 5, receiveReturn);
124
	    header.setWidget(0, 5, validateDOA);
128
	    header.setWidget(0, 6, validateDOA);
125
	    
129
	    
126
	    registerButtonHandlersForWE();
130
	    registerButtonHandlersForWE();
127
		implementMaskForWE();
131
		implementMaskForWE();
128
	}
132
	}
129
	
133
	
130
	private void registerButtonHandlersForWE(){
134
	private void registerButtonHandlersForWE(){
-
 
135
	    verifyOrder.addClickHandler(new ClickHandler() {
-
 
136
            
-
 
137
            @Override
-
 
138
            public void onClick(ClickEvent event) {
-
 
139
                if(verifyOrder.isEnabled()){
-
 
140
                    GWT.log("Verify order event fired");
-
 
141
                    eventbus.fireEvent(new VerifyOrderEvent(order));
-
 
142
                }
-
 
143
            }
-
 
144
        });
-
 
145
	    
131
		acceptOrder.addClickHandler(new ClickHandler() {
146
		acceptOrder.addClickHandler(new ClickHandler() {
132
			
147
			
133
			@Override
148
			@Override
134
			public void onClick(ClickEvent event) {
149
			public void onClick(ClickEvent event) {
135
				if(acceptOrder.isEnabled())
150
				if(acceptOrder.isEnabled())
Line 200... Line 215...
200
		});
215
		});
201
	}
216
	}
202
 
217
 
203
	private void implementMaskForWE(){
218
	private void implementMaskForWE(){
204
		switch(mask){
219
		switch(mask){
-
 
220
		case VERIFICATION_PENDING:
-
 
221
		    maskButtonsForWE(true, false, false, false, false, false, false, false); //Allow the WE to verify the order.
-
 
222
		    break;
205
		case NEW:
223
		case NEW:
206
			maskButtonsForWE(true, true, true, false, false, false, false);
224
			maskButtonsForWE(false, true, true, true, false, false, false, false);  //Allow the WE to either accept the order or mark it as out of stock.
207
			break;
225
			break;
208
		case ACCEPT:
226
		case ACCEPT:
209
		    //TODO: Mask buttons based on the billingType
227
		    //TODO: Mask buttons based on the billingType
210
		    if(billingType == BillingType.OURS)
228
		    if(billingType == BillingType.OURS)
211
		        maskButtonsForWE(false, false, false, true, true, false, false);
229
		        maskButtonsForWE(false, false, false, false, true, true, false, false); // For our billing, allow the WE to directly print the invoive.
212
		    else
230
		    else
213
		        maskButtonsForWE(false, false, false, false, true, false, false);
231
		        maskButtonsForWE(false, false, false, false, false, true, false, false); //For external billing, allow the WE to feed the invoice info.
214
			break;
232
			break;
215
		case REJECT:
233
		case REJECT:
216
			maskButtonsForWE(false, false, false, false, false, false, false);
234
			maskButtonsForWE(false, false, false, false, false, false, false, false); //Can't do anything once the order has been rejected.
217
			break;
235
			break;
218
		case BILL:
236
		case BILL:
219
			maskButtonsForWE(false, false, false, true, false, false, false);
237
			maskButtonsForWE(false, false, false, false, true, false, false, false); //Allow WE to print the invoice for a billed order.
220
			break;
238
			break;
221
		case SHIP:
239
		case SHIP:
222
			maskButtonsForWE(false, false, false, false, false, false, false);
240
			maskButtonsForWE(false, false, false, false, false, false, false, false);
223
			break;
241
			break;
224
		case NO_STOCK:
242
		case NO_STOCK:
225
			maskButtonsForWE(true, true, false, false, false, false, false);
243
			maskButtonsForWE(false, true, true, false, false, false, false, false); //Allow WE to accept a low inventory item. Reject has been allowed but this button is no longer visible.
226
			break;
244
			break;
227
		case DOA_AWAITED:
245
		case DOA_AWAITED:
228
		case SALES_RETURN_AWAITED:
246
		case SALES_RETURN_AWAITED:
229
			maskButtonsForWE(false, false, false, false, false, true, false);
247
			maskButtonsForWE(false, false, false, false, false, false, true, false); //Allow WE to accept the packet.
230
			break;
248
			break;
231
		case DOA_RECEIVED:
249
		case DOA_RECEIVED:
232
			maskButtonsForWE(false, false, false, false, false, false, true);
250
			maskButtonsForWE(false, false, false, false, false, false, false, true); //Allow WE to validate the DOA certificate.
233
			break;
251
			break;
234
		default:
252
		default:
235
			maskButtonsForWE(false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
253
			maskButtonsForWE(false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
236
			break;
254
			break;
237
		}
255
		}
238
	}
256
	}
239
	
257
	
240
	private void maskButtonsForWE(boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa){
258
	private void maskButtonsForWE(boolean verify, boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa){
-
 
259
	    verifyOrder.setEnabled(verify);
241
		acceptOrder.setEnabled(accept);
260
	    acceptOrder.setEnabled(accept);
242
		notAvailable.setEnabled(notavailable);
261
		notAvailable.setEnabled(notavailable);
243
		printInvoice.setEnabled(printInv);
262
		printInvoice.setEnabled(printInv);
244
		addBillingInfo.setEnabled(billing);
263
		addBillingInfo.setEnabled(billing);
245
		receiveReturn.setEnabled(acceptdoa);
264
		receiveReturn.setEnabled(acceptdoa);
246
		validateDOA.setEnabled(validatedoa);
265
		validateDOA.setEnabled(validatedoa);
Line 335... Line 354...
335
	}
354
	}
336
	
355
	
337
	private void implementMaskForAdmin(){
356
	private void implementMaskForAdmin(){
338
		switch(mask){
357
		switch(mask){
339
		case NO_STOCK:
358
		case NO_STOCK:
340
			maskButtonsForAdmin(false, false, false, false, true);
359
			maskButtonsForAdmin(false, false, false, false, true); //Allow the OM to refund an order with low inventory.
341
			break;
360
			break;
342
		case DELIVERED:
361
		case DELIVERED:
343
			maskButtonsForAdmin(true, true, false, false, false);	//Allow the OM to flag and request pickup.
362
			maskButtonsForAdmin(true, true, false, false, false);	//Allow the OM to flag and request pickup.
344
			break;
363
			break;
345
		case DOA_PICKUP_REQUESTED:
364
		case DOA_PICKUP_REQUESTED: