Subversion Repositories SmartDukaan

Rev

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

Rev 4367 Rev 4421
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
 
-
 
5
import in.shop2020.hotspot.dashbaord.client.event.ReceiveReturnEvent;
-
 
6
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
3
import in.shop2020.hotspot.dashbaord.client.event.AcceptOrderEvent;
7
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
-
 
8
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
4
import in.shop2020.hotspot.dashbaord.client.event.FlagOrderEvent;
-
 
5
import in.shop2020.hotspot.dashbaord.client.event.NostockOrderEvent;
-
 
6
import in.shop2020.hotspot.dashbaord.client.event.ProvisionalCaptureEvent;
-
 
7
import in.shop2020.hotspot.dashbaord.client.event.ReceiveReturnEvent;
9
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
8
import in.shop2020.hotspot.dashbaord.client.event.RequestPickupEvent;
10
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
9
import in.shop2020.hotspot.dashbaord.client.event.ReshipOrderEvent;
11
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
10
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
12
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
11
import in.shop2020.hotspot.dashbaord.shared.actions.DetailsMask;
13
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
12
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
14
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
13
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
15
 
14
 
-
 
15
import java.util.Map;
-
 
16
 
16
import org.enunes.gwt.mvp.client.EventBus;
17
import org.enunes.gwt.mvp.client.EventBus;
17
 
18
 
18
import com.google.gwt.core.client.GWT;
19
import com.google.gwt.core.client.GWT;
19
import com.google.gwt.event.dom.client.ClickEvent;
20
import com.google.gwt.event.dom.client.ClickEvent;
20
import com.google.gwt.event.dom.client.ClickHandler;
21
import com.google.gwt.event.dom.client.ClickHandler;
Line 74... Line 75...
74
	//Buttons for the Admin to track order
75
	//Buttons for the Admin to track order
75
	private Button flagOrder = new Button();
76
	private Button flagOrder = new Button();
76
	private Button requestPickup = new Button();
77
	private Button requestPickup = new Button();
77
	private Button authorizePickup = new Button();
78
	private Button authorizePickup = new Button();
78
	private Button refundOrder = new Button();
79
	private Button refundOrder = new Button();
79
	private Button reshipOrder = new Button();	
80
	private Button reshipOrder = new Button();
-
 
81
	private Button provisionallyCapturePaymentForOrder = new Button();
80
	
82
	
81
	//Buttons for the Admin to edit order details
83
	//Buttons for the Admin to edit order details
82
	private Button addWeight = new Button();
84
	private Button addWeight = new Button();
83
	private Button changeColor = new Button();
85
	private Button changeColor = new Button();
84
	private Button addDelayReason = new Button();
86
	private Button addDelayReason = new Button();
Line 272... Line 274...
272
	private void implementMaskForWE(){
274
	private void implementMaskForWE(){
273
		switch(mask){
275
		switch(mask){
274
		case VERIFICATION_PENDING:
276
		case VERIFICATION_PENDING:
275
		    maskButtonsForWE(false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
277
		    maskButtonsForWE(false, false, false, false, false, false, false, false); //Do not allow the WE to verify the order.
276
		    break;
278
		    break;
-
 
279
		case CAPTURE_IN_PROCESS:
277
		case NEW:
280
		case NEW:
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.
281
			maskButtonsForWE(true, false, true, false, false, false, false, false);  //Allow the WE to either accept the order or mark it as out of stock.
279
			break;
282
			break;
280
		case ACCEPT:
283
		case ACCEPT:
281
		    //TODO: Mask buttons based on the billingType
284
		    //TODO: Mask buttons based on the billingType
Line 333... Line 336...
333
	    
336
	    
334
	    requestPickup.setText("Request Pick-up No");
337
	    requestPickup.setText("Request Pick-up No");
335
	    authorizePickup.setText("Authorize Pick-up");
338
	    authorizePickup.setText("Authorize Pick-up");
336
	    reshipOrder.setText("Reship");
339
	    reshipOrder.setText("Reship");
337
	    refundOrder.setText("Refund");
340
	    refundOrder.setText("Refund");
-
 
341
	    provisionallyCapturePaymentForOrder.setText("Capture payment provisionally");
338
	    
342
	    
339
	    header.setWidget(1, 0, flagOrder);
343
	    header.setWidget(1, 0, flagOrder);
340
	    header.setWidget(1, 1, requestPickup);
344
	    header.setWidget(1, 1, requestPickup);
341
	    header.setWidget(1, 2, authorizePickup);
345
	    header.setWidget(1, 2, authorizePickup);
342
	    header.setWidget(1, 3, reshipOrder);
346
	    header.setWidget(1, 3, reshipOrder);
-
 
347
	    header.setWidget(1, 5, provisionallyCapturePaymentForOrder);
343
	    header.setWidget(1, 6, refundOrder);
348
	    header.setWidget(1, 6, refundOrder);
344
	    
349
	    
345
	    addWeight.setText("Add weight");
350
	    addWeight.setText("Add weight");
346
	    changeColor.setText("Change Color");
351
	    changeColor.setText("Change Color");
347
	    addDelayReason.setText("Add Delay Reason");
352
	    addDelayReason.setText("Add Delay Reason");
Line 400... Line 405...
400
					GWT.log("Reshipping the order: " + order.getOrderId());
405
					GWT.log("Reshipping the order: " + order.getOrderId());
401
					eventbus.fireEvent(new ReshipOrderEvent(order));
406
					eventbus.fireEvent(new ReshipOrderEvent(order));
402
				}
407
				}
403
			}
408
			}
404
		});
409
		});
-
 
410
 
-
 
411
	    provisionallyCapturePaymentForOrder.addClickHandler(new ClickHandler() {
405
		
412
 
-
 
413
	        @Override
-
 
414
	        public void onClick(ClickEvent event) {
-
 
415
	            if(provisionallyCapturePaymentForOrder.isEnabled()) {
-
 
416
	                GWT.log("Provisionally capturing payment for order: " + order.getOrderId());
-
 
417
	                eventbus.fireEvent(new ProvisionalCaptureEvent(order));
-
 
418
	            }
-
 
419
	        }
-
 
420
	    });
-
 
421
 
406
		refundOrder.addClickHandler(new ClickHandler() {
422
		refundOrder.addClickHandler(new ClickHandler() {
407
			
423
			
408
			@Override
424
			@Override
409
			public void onClick(ClickEvent event) {
425
			public void onClick(ClickEvent event) {
410
				if(refundOrder.isEnabled()){
426
				if(refundOrder.isEnabled()){
Line 458... Line 474...
458
        });
474
        });
459
	}
475
	}
460
	
476
	
461
	private void implementMaskForAdmin(){
477
	private void implementMaskForAdmin(){
462
		switch(mask){
478
		switch(mask){
-
 
479
        case CAPTURE_IN_PROCESS:
-
 
480
            maskButtonsForAdmin(false, false, false, false, true, 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.
-
 
481
            break;
463
		case VERIFICATION_PENDING:
482
        case VERIFICATION_PENDING:
464
        case NEW:
483
        case NEW:
465
        case NO_STOCK:
484
        case NO_STOCK:
466
        case ACCEPT:
485
        case ACCEPT:
467
        case BILL:
486
        case BILL:
468
			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.
487
			maskButtonsForAdmin(false, false, false, false, true, true, false); //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.
469
			break;
488
			break;
470
		case DELIVERED:
489
		case DELIVERED:
471
			maskButtonsForAdmin(true, true, false, false, false, true);	//Allow the OM to flag and request pickup.
490
			maskButtonsForAdmin(true, true, false, false, false, true, false);	//Allow the OM to flag and request pickup.
472
			break;
491
			break;
473
		case DOA_PICKUP_REQUESTED:
492
		case DOA_PICKUP_REQUESTED:
474
			maskButtonsForAdmin(true, true, true, false, false, true);	//Allow the OM to either re-request a pickup no. or authorize pickup by entering one
493
			maskButtonsForAdmin(true, true, true, false, false, true, false);	//Allow the OM to either re-request a pickup no. or authorize pickup by entering one
475
			break;
494
			break;
476
		case DOA_RETURNED:
495
		case DOA_RETURNED:
477
		case SALES_RETURNED:
496
		case SALES_RETURNED:
478
			maskButtonsForAdmin(false, false, false, true, true, true);	//Allow the OM to either reship the order or refund it
497
			maskButtonsForAdmin(false, false, false, true, true, true, false);	//Allow the OM to either reship the order or refund it
479
			break;
498
			break;
480
		default:
499
		default:
481
			maskButtonsForAdmin(false, false, false, false, false, true);	//Unknown state. Let's not allow any untoward actions.
500
			maskButtonsForAdmin(false, false, false, false, false, true, false);	//Unknown state. Let's not allow any untoward actions.
482
			break;
501
			break;
483
		}
502
		}
484
	}
503
	}
485
	
504
	
486
	private void maskButtonsForAdmin(boolean flag, boolean reqPickup, boolean authPickup, boolean reship, boolean refund, boolean printInv){
505
	private void maskButtonsForAdmin(boolean flag, boolean reqPickup, boolean authPickup, boolean reship,
-
 
506
	                                 boolean refund, boolean printInv, boolean provisionallyCapturePayment)
-
 
507
	{
487
		flagOrder.setEnabled(flag);
508
		flagOrder.setEnabled(flag);
488
		requestPickup.setEnabled(reqPickup);
509
		requestPickup.setEnabled(reqPickup);
489
		authorizePickup.setEnabled(authPickup);
510
		authorizePickup.setEnabled(authPickup);
490
		reshipOrder.setEnabled(reship);
511
		reshipOrder.setEnabled(reship);
-
 
512
		provisionallyCapturePaymentForOrder.setEnabled(provisionallyCapturePayment);
491
		refundOrder.setEnabled(refund);
513
		refundOrder.setEnabled(refund);
492
		printInvoice.setEnabled(printInv);
514
		printInvoice.setEnabled(printInv);
493
	}
515
	}
494
	
516
	
495
	private void loadOrderDetails(){
517
	private void loadOrderDetails(){