Subversion Repositories SmartDukaan

Rev

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

Rev 4361 Rev 4363
Line 1... Line 1...
1
package in.shop2020.hotspot.dashbaord.client.inbox;
1
package in.shop2020.hotspot.dashbaord.client.inbox;
2
 
2
 
-
 
3
import java.util.Map;
-
 
4
 
3
import in.shop2020.hotspot.dashbaord.client.event.ReceiveReturnEvent;
5
import in.shop2020.hotspot.dashbaord.client.event.ReceiveReturnEvent;
4
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
6
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
5
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
6
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
8
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
9
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
Line 86... Line 88...
86
	private String user;
88
	private String user;
87
	private DetailsMask mask;
89
	private DetailsMask mask;
88
	private long warehouseID;
90
	private long warehouseID;
89
	private UserType userType;
91
	private UserType userType;
90
	private BillingType billingType;
92
	private BillingType billingType;
-
 
93
	private Map<Long, String> vendors;
91
	
94
	
92
	public OrderDetails(EventBus eventbus, Order order, Order order2, DetailsMask mask, String user, long warehouseID, UserType userType, BillingType billingType){
95
	public OrderDetails(EventBus eventbus, Order order, Order order2, DetailsMask mask, String user, long warehouseID, UserType userType, BillingType billingType, Map<Long, String> vendors){
93
		this.eventbus = eventbus;
96
		this.eventbus = eventbus;
94
		this.order = order;
97
		this.order = order;
95
		this.transaction = order2;
98
		this.transaction = order2;
96
		this.mask = mask;
99
		this.mask = mask;
97
		this.user = user;
100
		this.user = user;
98
		this.warehouseID = warehouseID;
101
		this.warehouseID = warehouseID;
99
		this.userType = userType;
102
		this.userType = userType;
100
		this.billingType = billingType;
103
		this.billingType = billingType;
-
 
104
		this.vendors = vendors;
101
		
105
		
102
		initWidget(binder.createAndBindUi(this));
106
		initWidget(binder.createAndBindUi(this));
103
		initTableForWE();
107
		initTableForWE();
104
		if(this.userType == UserType.ADMIN){
108
		if(this.userType == UserType.ADMIN){
105
			initTableForAdmin();
109
			initTableForAdmin();
Line 199... Line 203...
199
			@Override
203
			@Override
200
			public void onClick(ClickEvent event) {
204
			public void onClick(ClickEvent event) {
201
				if(!printInvoice.isEnabled())
205
				if(!printInvoice.isEnabled())
202
					return;
206
					return;
203
				if(order.getJacketNumber()==0 && billingType == BillingType.OURS){
207
				if(order.getJacketNumber()==0 && billingType == BillingType.OURS){
204
					JacketInfoBox box = new JacketInfoBox(eventbus, order, user, billingType);
208
					JacketInfoBox box = new JacketInfoBox(eventbus, order, user, billingType, vendors);
205
					//box.clean();
209
					//box.clean();
206
					box.center();
210
					box.center();
207
				}else{
211
				}else{
208
					String invoiceGenerationUrl = GWT.getHostPageBaseURL() + "invoice/?id=" + order.getOrderId() + "&warehouse=" + warehouseID;
212
					String invoiceGenerationUrl = GWT.getHostPageBaseURL() + "invoice/?id=" + order.getOrderId() + "&warehouse=" + warehouseID;
209
					if(billingType == BillingType.OURS)
213
					if(billingType == BillingType.OURS)
Line 254... Line 258...
254
	}
258
	}
255
 
259
 
256
	private void implementMaskForWE(){
260
	private void implementMaskForWE(){
257
		switch(mask){
261
		switch(mask){
258
		case VERIFICATION_PENDING:
262
		case VERIFICATION_PENDING:
259
		    maskButtonsForWE(false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
263
		    maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
260
		    break;
264
		    break;
261
		case NEW:
265
		case NEW:
262
			maskButtonsForWE(false, true, false, true, false, false, false, false);  //Allow the WE to either accept the order or mark it as out of stock.
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.
263
			break;
267
			break;
264
		case ACCEPT:
268
		case ACCEPT:
265
		    //TODO: Mask buttons based on the billingType
269
		    //TODO: Mask buttons based on the billingType
266
		    if(billingType == BillingType.OURS)
270
		    if(billingType == BillingType.OURS)
267
		        maskButtonsForWE(false, false, false, false, true, true, false, false); // For our billing, allow the WE to directly print the invoive.
271
		        maskButtonsForWE(false, false, false, false, true, true, false, false, true); // For our billing, allow the WE to directly print the invoive.
268
		    else
272
		    else
269
		        maskButtonsForWE(false, false, false, false, true, true, false, false); //For external billing, allow the WE to feed the invoice info.
273
		        maskButtonsForWE(false, false, false, false, true, true, false, false, true); //For external billing, allow the WE to feed the invoice info.
270
			break;
274
			break;
271
		case REJECT:
275
		case REJECT:
272
			maskButtonsForWE(false, false, false, false, false, false, false, false); //Can't do anything once the order has been rejected.
276
			maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Can't do anything once the order has been rejected.
273
			break;
277
			break;
274
		case BILL:
278
		case BILL:
275
			maskButtonsForWE(false, false, false, false, true, false, false, false); //Allow WE to print the invoice for a billed order.
279
			maskButtonsForWE(false, false, false, false, true, false, false, false, false); //Allow WE to print the invoice for a billed order.
276
			break;
280
			break;
277
		case SHIP:
281
		case SHIP:
278
			maskButtonsForWE(false, false, false, false, false, false, false, false);
282
			maskButtonsForWE(false, false, false, false, false, false, false, false, false);
279
			break;
283
			break;
280
		case NO_STOCK:
284
		case NO_STOCK:
281
			maskButtonsForWE(false, true, false, false, false, false, false, false); //Allow WE to accept a low inventory item. 
285
			maskButtonsForWE(false, true, false, false, false, false, false, false, false); //Allow WE to accept a low inventory item. 
282
			break;
286
			break;
283
		case CANCEL_CONFIRMED:
287
		case CANCEL_CONFIRMED:
284
			maskButtonsForWE(false, false, true, false, false, false, false, false); //Allow WE to Cancel a order which is in cancellation pending state. 
288
			maskButtonsForWE(false, false, true, false, false, false, false, false, false); //Allow WE to Cancel a order which is in cancellation pending state. 
285
			break;			
289
			break;			
286
		case DOA_AWAITED:
290
		case DOA_AWAITED:
287
		case SALES_RETURN_AWAITED:
291
		case SALES_RETURN_AWAITED:
288
			maskButtonsForWE(false, false, false, false, false, false, true, false); //Allow WE to accept the packet.
292
			maskButtonsForWE(false, false, false, false, false, false, true, false, false); //Allow WE to accept the packet.
289
			break;
293
			break;
290
		case DOA_RECEIVED:
294
		case DOA_RECEIVED:
291
			maskButtonsForWE(false, false, false, false, false, false, false, true); //Allow WE to validate the DOA certificate.
295
			maskButtonsForWE(false, false, false, false, false, false, false, true, false); //Allow WE to validate the DOA certificate.
292
			break;
296
			break;
293
		default:
297
		default:
294
			maskButtonsForWE(false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
298
			maskButtonsForWE(false, false, false, false, false, false, false, false, false); //Unknown state, let's disallow any untoward actions.
295
			break;
299
			break;
296
		}
300
		}
297
	}
301
	}
298
	
302
	
299
	private void maskButtonsForWE(boolean verify, boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa){
303
	private void maskButtonsForWE(boolean verify, boolean accept, boolean reject, boolean notavailable, boolean printInv, boolean billing, boolean acceptdoa, boolean validatedoa, boolean printAllInvoice){
300
	    verifyOrder.setEnabled(verify);
304
	    verifyOrder.setEnabled(verify);
301
	    acceptOrder.setEnabled(accept);
305
	    acceptOrder.setEnabled(accept);
302
		notAvailable.setEnabled(notavailable);
306
		notAvailable.setEnabled(notavailable);
303
		printInvoice.setEnabled(printInv);
307
		printInvoice.setEnabled(printInv);
304
		addBillingInfo.setEnabled(billing);
308
		addBillingInfo.setEnabled(billing);
305
		receiveReturn.setEnabled(acceptdoa);
309
		receiveReturn.setEnabled(acceptdoa);
306
		validateDOA.setEnabled(validatedoa);
310
		validateDOA.setEnabled(validatedoa);
307
		rejectOrder.setEnabled(reject);
311
		rejectOrder.setEnabled(reject);
-
 
312
		printAllInvoices.setEnabled(printAllInvoice);
308
	}
313
	}
309
 
314
 
310
	private void initTableForAdmin() {
315
	private void initTableForAdmin() {
311
	    if(transaction.isDoaFlag()){
316
	    if(transaction.isDoaFlag()){
312
	    	flagOrder.setText("Unflag");
317
	    	flagOrder.setText("Unflag");