Subversion Repositories SmartDukaan

Rev

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

Rev 6830 Rev 6838
Line 2... Line 2...
2
 
2
 
3
import in.shop2020.catalog.dashboard.shared.Item;
3
import in.shop2020.catalog.dashboard.shared.Item;
4
import in.shop2020.catalog.dashboard.shared.Utils;
4
import in.shop2020.catalog.dashboard.shared.Utils;
5
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
5
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
6
import in.shop2020.catalog.dashboard.shared.VendorPricings;
6
import in.shop2020.catalog.dashboard.shared.VendorPricings;
7
 
-
 
8
import java.util.Date;
7
import java.util.Date;
9
import java.util.HashMap;
8
import java.util.HashMap;
10
import java.util.Map;
9
import java.util.Map;
11
import java.util.Map.Entry;
10
import java.util.Map.Entry;
12
 
-
 
13
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.core.client.GWT;
14
import com.google.gwt.event.dom.client.ClickEvent;
12
import com.google.gwt.event.dom.client.ClickEvent;
15
import com.google.gwt.event.dom.client.ClickHandler;
13
import com.google.gwt.event.dom.client.ClickHandler;
16
import com.google.gwt.uibinder.client.UiBinder;
14
import com.google.gwt.uibinder.client.UiBinder;
17
import com.google.gwt.uibinder.client.UiField;
15
import com.google.gwt.uibinder.client.UiField;
Line 55... Line 53...
55
    @UiField DateBox startDate, retireDate, comingSoonStartDate, expectedArrivalDate;
53
    @UiField DateBox startDate, retireDate, comingSoonStartDate, expectedArrivalDate;
56
    @UiField Button addButton, cancelButton, comingSoonButton;
54
    @UiField Button addButton, cancelButton, comingSoonButton;
57
    @UiField CheckBox defaultForEntity, risky, itemType, hasItemNo, clearance, showSellingPrice;
55
    @UiField CheckBox defaultForEntity, risky, itemType, hasItemNo, clearance, showSellingPrice;
58
    @UiField FlexTable headerVendor, vendorTable;
56
    @UiField FlexTable headerVendor, vendorTable;
59
    @UiField FlexTable headerVendorM, vendorTableM;
57
    @UiField FlexTable headerVendorM, vendorTableM;
60
    @UiField ListBox preferredVendor;
58
    @UiField ListBox preferredVendor,preferredInsurer;
61
    
59
    
62
    public ItemForm(){
60
    public ItemForm(){
63
        setText("Add New Item");
61
        setText("Add New Item");
64
        setWidget(uiBinder.createAndBindUi(this));
62
        setWidget(uiBinder.createAndBindUi(this));
65
        initVendorKeysHeader();
63
        initVendorKeysHeader();
Line 69... Line 67...
69
        	preferredVendor.addItem(e.getValue());
67
        	preferredVendor.addItem(e.getValue());
70
        }
68
        }
71
        if(!entityIdMandatory) {
69
        if(!entityIdMandatory) {
72
        	catalogItemId.setEnabled(false);
70
        	catalogItemId.setEnabled(false);
73
        }
71
        }
-
 
72
        preferredInsurer.addItem("select");
-
 
73
        for(Entry<Long, String> e : Utils.getAllInsurers().entrySet()){
-
 
74
        	preferredInsurer.addItem(e.getValue(),e.getKey().toString());
-
 
75
        }
-
 
76
        
74
    }
77
    }
75
    
78
    
76
    /**
79
    /**
77
     * initialises vendor item key table header. Creates an Add button and
80
     * initialises vendor item key table header. Creates an Add button and
78
     * adds click event listener to it to create and pop up a dialog for adding 
81
     * adds click event listener to it to create and pop up a dialog for adding 
Line 423... Line 426...
423
        }
426
        }
424
    	else {
427
    	else {
425
    		item.setPreferredVendor(Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex())));
428
    		item.setPreferredVendor(Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex())));
426
    	}
429
    	}
427
        
430
        
-
 
431
        item.setPreferredInsurer(Long.parseLong(preferredInsurer.getValue(preferredInsurer.getSelectedIndex())));
-
 
432
        
-
 
433
   	
428
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
434
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
429
          Add the instance to map and set the map to the item instance created above.*/
435
          Add the instance to map and set the map to the item instance created above.*/
430
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
436
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
431
        VendorPricings v;
437
        VendorPricings v;
432
        for(int row = 0; row < vendorTable.getRowCount(); row++) {
438
        for(int row = 0; row < vendorTable.getRowCount(); row++) {