Subversion Repositories SmartDukaan

Rev

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

Rev 18048 Rev 18150
Line 6... Line 6...
6
import in.shop2020.catalog.dashboard.shared.SourcePricings;
6
import in.shop2020.catalog.dashboard.shared.SourcePricings;
7
import in.shop2020.catalog.dashboard.shared.Utils;
7
import in.shop2020.catalog.dashboard.shared.Utils;
8
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
8
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
9
import in.shop2020.catalog.dashboard.shared.VendorPricings;
9
import in.shop2020.catalog.dashboard.shared.VendorPricings;
10
import in.shop2020.catalog.dashboard.shared.VoucherItemMapping;
10
import in.shop2020.catalog.dashboard.shared.VoucherItemMapping;
-
 
11
import in.shop2020.catalog.dashboard.shared.BulkItemPricing;
11
 
12
 
12
import java.util.ArrayList;
13
import java.util.ArrayList;
13
import java.util.Date;
14
import java.util.Date;
14
import java.util.HashMap;
15
import java.util.HashMap;
15
import java.util.Iterator;
16
import java.util.Iterator;
Line 99... Line 100...
99
	private final int TABLE_INDEX_VOUCHERS_TYPE = 0,
100
	private final int TABLE_INDEX_VOUCHERS_TYPE = 0,
100
	TABLE_INDEX_VOUCHERS_AMOUNT = 1,
101
	TABLE_INDEX_VOUCHERS_AMOUNT = 1,
101
	TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON = 2,
102
	TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON = 2,
102
	TABLE_INDEX_VOUCHERS_DEL_BUTTON = 3;
103
	TABLE_INDEX_VOUCHERS_DEL_BUTTON = 3;
103
 
104
 
-
 
105
	private final int TABLE_INDEX_BULK_PRICING_ID=0, 
-
 
106
	TABLE_INDEX_QUANTITY = 1,
-
 
107
	TABLE_INDEX_PRICE = 2,
-
 
108
	TABLE_INDEX_BULK_PRICING_BUTTON =3,
-
 
109
	TABLE_INDEX_BULK_PRICING_REMOVE_BUTTON = 4;
-
 
110
 
104
	private final String MANDATORY_MRP = "MRP",
111
	private final String MANDATORY_MRP = "MRP",
105
	MANDATORY_WEIGHT = "Weight",
112
	MANDATORY_WEIGHT = "Weight",
106
	MANDATORY_BEST_DEAL_TEXT = "Best Deal Text",
113
	MANDATORY_BEST_DEAL_TEXT = "Best Deal Text",
107
	MANDATORY_BEST_DEAL_DETAIL_TEXT = "Best Deal Detail Text",
114
	MANDATORY_BEST_DEAL_DETAIL_TEXT = "Best Deal Detail Text",
108
	MANDATORY_BEST_DEAL_DETAIL_LINK = "Best Deal Detail Link",
115
	MANDATORY_BEST_DEAL_DETAIL_LINK = "Best Deal Detail Link",
Line 114... Line 121...
114
	private final String OPTIONAL_SELLING_PRICE = "Selling Price",	
121
	private final String OPTIONAL_SELLING_PRICE = "Selling Price",	
115
	OPTIONAL_VENDOR_PRICING = "Vendor Pricing",
122
	OPTIONAL_VENDOR_PRICING = "Vendor Pricing",
116
	OPTIONAL_PREFERRED_VENDOR = "Preferred Vendor",
123
	OPTIONAL_PREFERRED_VENDOR = "Preferred Vendor",
117
	OPTIONAL_PREFERRED_INSURER = "Preferred Insurer",
124
	OPTIONAL_PREFERRED_INSURER = "Preferred Insurer",
118
	OPTIONAL_SOURCE_PRICING = "Source Pricing",
125
	OPTIONAL_SOURCE_PRICING = "Source Pricing",
119
	OPTIONAL_FREEBIE_ITEM_ID = "Freebie Item Id";
126
	OPTIONAL_FREEBIE_ITEM_ID = "Freebie Item Id",
-
 
127
	OPTIONAL_PACK_QUANTITY = "Pack Quantity",
-
 
128
	OPTIONAL_QUANTITY_STEP="Quantity Step",
-
 
129
	OPTIONAL_MINIMUM_BUY_QTY="Minimum Buy Qty";
120
 
130
 
121
	private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
131
	private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
122
	VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
132
	VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
123
	BUTTON_WIDTH = "50px";
133
	BUTTON_WIDTH = "50px";
124
 
134
 
Line 149... Line 159...
149
	@UiField TextBox bestDealsText, bestDealsValue ,bestDealsDetailsText,bestDealsDetailsLink; 
159
	@UiField TextBox bestDealsText, bestDealsValue ,bestDealsDetailsText,bestDealsDetailsLink; 
150
	@UiField FlexTable headerAvailability, availabilityTable;
160
	@UiField FlexTable headerAvailability, availabilityTable;
151
	@UiField FlexTable headerVendorItemKey, tableVendorItemKey;
161
	@UiField FlexTable headerVendorItemKey, tableVendorItemKey;
152
	@UiField FlexTable headerVendorPrices, tableVendorPrices;
162
	@UiField FlexTable headerVendorPrices, tableVendorPrices;
153
	@UiField FlexTable headerSourcePrices, tableSourcePrices;
163
	@UiField FlexTable headerSourcePrices, tableSourcePrices;
-
 
164
	@UiField FlexTable headerBulkPricing, tableBulkPricing;
154
	@UiField TextBox bestSellingRank,dealRank;
165
	@UiField TextBox bestSellingRank,dealRank;
155
	@UiField TextBox expectedDelay;
166
	@UiField TextBox expectedDelay;
156
	@UiField CheckBox defaultForEntity, risky, warehouseStickiness, itemType, hasItemNo, showSellingPrice, holdOverride,isCodOnDeal,isDealActive;
167
	@UiField CheckBox defaultForEntity, risky, warehouseStickiness, itemType, hasItemNo, showSellingPrice, holdOverride,isCodOnDeal,isDealActive;
157
	@UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate,dealStartDate,dealEndDate;
168
	@UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate,dealStartDate,dealEndDate;
158
	@UiField FlexTable headerSimilarItems, tableSimilarItems;
169
	@UiField FlexTable headerSimilarItems, tableSimilarItems;
Line 167... Line 178...
167
	@UiField TextBox asin;
178
	@UiField TextBox asin;
168
	@UiField TextBox holdInventory;
179
	@UiField TextBox holdInventory;
169
	@UiField TextBox defaultInventory;
180
	@UiField TextBox defaultInventory;
170
	@UiField TextBox dealFreebieItemId;
181
	@UiField TextBox dealFreebieItemId;
171
	@UiField TextBox dealPrice;
182
	@UiField TextBox dealPrice;
172
	@UiField TextBox packQuantity;
183
	@UiField TextBox packQuantity, quantityStep, minimumBuyQuantity;
173
 
184
 
174
	public ItemDetails(Item item){
185
	public ItemDetails(Item item){
175
		this();
186
		this();
176
		setItemDetails(item);
187
		setItemDetails(item);
177
	}
188
	}
178
 
189
 
179
	public ItemDetails() {
190
	public ItemDetails() {
180
		initWidget(uiBinder.createAndBindUi(this));
191
		initWidget(uiBinder.createAndBindUi(this));
181
		initAvailabilityHeader();
192
		initAvailabilityHeader();
-
 
193
		initBulkPricingHeader();
182
		initVendorKeysHeader();
194
		initVendorKeysHeader();
183
		initVendorPricingHeader();
195
		initVendorPricingHeader();
184
		initSourcePricingHeader();
196
		initSourcePricingHeader();
185
		initSimilarItemList();
197
		initSimilarItemList();
186
		initVoucherHeader();
198
		initVoucherHeader();
Line 359... Line 371...
359
		else{
371
		else{
360
			isCodOnDeal.setValue(false);
372
			isCodOnDeal.setValue(false);
361
		}
373
		}
362
		dealText.setText(item.getPrivateDeal().getDealText());
374
		dealText.setText(item.getPrivateDeal().getDealText());
363
		packQuantity.setText(item.getPackQuantity().toString());
375
		packQuantity.setText(item.getPackQuantity().toString());
-
 
376
		quantityStep.setText(item.getQuantityStep().toString());
-
 
377
		minimumBuyQuantity.setText(item.getMinimumBuyQuantity().toString());
364
		initVatDetailsHeader();
378
		initVatDetailsHeader();
365
		updateVatDetailsTable(item.getStateNameVatPercentageMap());
379
		updateVatDetailsTable(item.getStateNameVatPercentageMap());
366
		updateAvailabilityTable(item.getItemInventory());
380
		updateAvailabilityTable(item.getItemInventory());
367
		updateVendorKeysTable(item.getVendorKeysMap());
381
		updateVendorKeysTable(item.getVendorKeysMap());
368
		updateVendorPricingTable(item.getVendorPricesMap());
382
		updateVendorPricingTable(item.getVendorPricesMap());
369
		updateSourcePricingTable(item.getSourcePricesMap());
383
		updateSourcePricingTable(item.getSourcePricesMap());
370
		updateSimilarItemsTable(item.getSimilarItems());
384
		updateSimilarItemsTable(item.getSimilarItems());
371
		updateVoucherTable(item.getVouchersMap());
385
		updateVoucherTable(item.getVouchersMap());
372
		updateTableIgnoredWarehouse();
386
		updateTableIgnoredWarehouse();
-
 
387
		getBulkPricingForItem(item.getId());
373
		dealTextOption.addChangeHandler(new ChangeHandler(){
388
		dealTextOption.addChangeHandler(new ChangeHandler(){
374
			@Override
389
			@Override
375
			public void onChange(ChangeEvent event) {
390
			public void onChange(ChangeEvent event) {
376
				if(dealTextOption.getSelectedIndex()!=2){
391
				if(dealTextOption.getSelectedIndex()!=2){
377
					dealText.setEnabled(false);
392
					dealText.setEnabled(false);
Line 543... Line 558...
543
				vendorMappingDialog.show();
558
				vendorMappingDialog.show();
544
			}
559
			}
545
		});
560
		});
546
	}
561
	}
547
 
562
 
-
 
563
	private void initBulkPricingHeader(){
-
 
564
		headerBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_BULK_PRICING_ID, "5px");
-
 
565
		headerBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_QUANTITY, "5px");
-
 
566
		headerBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_PRICE, "5px");
-
 
567
		headerBulkPricing.setText(0, TABLE_INDEX_BULK_PRICING_ID, "Bulk Pricing Id");
-
 
568
		headerBulkPricing.setText(0, TABLE_INDEX_QUANTITY, "Quantity");
-
 
569
		headerBulkPricing.setText(0, TABLE_INDEX_PRICE, "Price");
-
 
570
		headerBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_BULK_PRICING_BUTTON, BUTTON_WIDTH);
-
 
571
		headerBulkPricing.getCellFormatter().setVisible(0, TABLE_INDEX_BULK_PRICING_ID, false);
-
 
572
		Button addButton = new Button("Add");
-
 
573
		headerBulkPricing.setWidget(0, TABLE_INDEX_BULK_PRICING_BUTTON, addButton);
-
 
574
		addButton.addClickHandler(new ClickHandler() {
-
 
575
			@Override
-
 
576
			public void onClick(ClickEvent event) {
-
 
577
				if (item==null){
-
 
578
					Window.alert("Please select item first");
-
 
579
					return;
-
 
580
				}
-
 
581
				BulkPricingDialog bulkPricesDialog = new BulkPricingDialog();
-
 
582
				bulkPricesDialog.updateButton.setText("Add");
-
 
583
				bulkPricesDialog.setBulkPricingUpdateListener(new BulkPricingDialog.BulkPricingUpdateListener() {
-
 
584
 
-
 
585
					@Override
-
 
586
					public boolean onUpdate(long quantity, double price) {
-
 
587
						if(!checkBulkPricing(quantity)){
-
 
588
							Window.alert("Quantity already present.");
-
 
589
							return false;
-
 
590
						}
-
 
591
						final int row = tableBulkPricing.getRowCount();
-
 
592
						BulkItemPricing bulkItemPricing = new BulkItemPricing();
-
 
593
						bulkItemPricing.setItem_id(item.getId());
-
 
594
						bulkItemPricing.setPrice(price);
-
 
595
						bulkItemPricing.setQuantity(quantity);
-
 
596
						catalogService.addBulkPricingForItem(bulkItemPricing, new AsyncCallback<BulkItemPricing>() {
-
 
597
							@Override
-
 
598
							public void onSuccess(BulkItemPricing result) {
-
 
599
								if (result==null){
-
 
600
									Window.alert("Unable to add bulk pricing");
-
 
601
									return;
-
 
602
								}
-
 
603
								tableBulkPricing.setText(row, TABLE_INDEX_BULK_PRICING_ID, result.getId()+"");
-
 
604
								tableBulkPricing.setText(row, TABLE_INDEX_QUANTITY, result.getQuantity()+"");
-
 
605
								tableBulkPricing.setText(row, TABLE_INDEX_PRICE, result.getPrice()+"");
-
 
606
								tableBulkPricing.getCellFormatter().setVisible(row, TABLE_INDEX_BULK_PRICING_ID, false);
-
 
607
								Button deleteButton = new Button("Delete");
-
 
608
								tableBulkPricing.setWidget(row, TABLE_INDEX_BULK_PRICING_BUTTON, deleteButton);
-
 
609
								deleteButton.addClickHandler(new ClickHandler() {
-
 
610
									@Override
-
 
611
									public void onClick(ClickEvent event) {
-
 
612
										Cell cell = tableBulkPricing.getCellForEvent(event);
-
 
613
										int row = cell.getRowIndex();
-
 
614
										deleteBulkPricingForId(Long.valueOf(tableBulkPricing.getText(row, TABLE_INDEX_BULK_PRICING_ID)), item.getId());
-
 
615
									}
-
 
616
 
-
 
617
								});
-
 
618
							}
-
 
619
							@Override
-
 
620
							public void onFailure(Throwable caught) {
-
 
621
								caught.printStackTrace();
-
 
622
								Window.alert("Unable to add bulk pricing.");
-
 
623
							}
-
 
624
						});
-
 
625
						return true;
-
 
626
					}
-
 
627
				});
-
 
628
				bulkPricesDialog.show();
-
 
629
			}
-
 
630
		});
-
 
631
		
-
 
632
		Button removeButton = new Button("Delete All");
-
 
633
		headerBulkPricing.setWidget(0, TABLE_INDEX_BULK_PRICING_REMOVE_BUTTON, removeButton);
-
 
634
		removeButton.addClickHandler(new ClickHandler() {
-
 
635
			@Override
-
 
636
			public void onClick(ClickEvent event) {
-
 
637
				if (item==null){
-
 
638
					Window.alert("Please select item first");
-
 
639
					return;
-
 
640
				}
-
 
641
				if(tableBulkPricing.getRowCount()==0){
-
 
642
					Window.alert("Nothing to delete");
-
 
643
					return;
-
 
644
				}
-
 
645
				String removeAllMessage = "Delete all bulk pricing for item id "+item.getId();
-
 
646
				if (!Window.confirm(removeAllMessage)){
-
 
647
					return;
-
 
648
				}
-
 
649
				deleteBulkPricingForItemId(item.getId());
-
 
650
			}
-
 
651
		});
-
 
652
	}
-
 
653
	
-
 
654
	public void deleteBulkPricingForItemId(final long item_id){
-
 
655
		catalogService.deleteBulkPricingForItem(item_id, new AsyncCallback<Boolean>() {
-
 
656
			@Override
-
 
657
			public void onSuccess(Boolean result) {
-
 
658
				if (result){
-
 
659
					Window.alert("All Bulk Pricing deleted");
-
 
660
					getBulkPricingForItem(item_id);
-
 
661
				}
-
 
662
				else{
-
 
663
					Window.alert("Unable to delete bulk pricing.");
-
 
664
				}
-
 
665
			}
-
 
666
			@Override
-
 
667
			public void onFailure(Throwable caught) {
-
 
668
				caught.printStackTrace();
-
 
669
				Window.alert("Unable to delete bulk pricing.");
-
 
670
			}
-
 
671
		});
-
 
672
	}
-
 
673
	
-
 
674
	public void deleteBulkPricingForId(long id, final long item_id){
-
 
675
		String deleteMessage = "Delete bulk pricing for item id " +item_id;
-
 
676
		if (!Window.confirm(deleteMessage)){
-
 
677
			return;
-
 
678
		}
-
 
679
		catalogService.deleteBulkPricingForItemById(id, new AsyncCallback<Boolean>() {
-
 
680
			@Override
-
 
681
			public void onSuccess(Boolean result) {
-
 
682
				if (result){
-
 
683
					Window.alert("Bulk Pricing deleted");
-
 
684
					getBulkPricingForItem(item_id);
-
 
685
				}
-
 
686
				else{
-
 
687
					Window.alert("Unable to delete bulk pricing.");
-
 
688
				}
-
 
689
			}
-
 
690
			@Override
-
 
691
			public void onFailure(Throwable caught) {
-
 
692
				caught.printStackTrace();
-
 
693
				Window.alert("Unable to delete bulk pricing.");
-
 
694
			}
-
 
695
		});
-
 
696
	}
-
 
697
 
-
 
698
 
548
	/**
699
	/**
549
	 * initialises vendor prices table header. Creates an Add button and
700
	 * initialises vendor prices table header. Creates an Add button and
550
	 * adds click event listener to it to create and pop up a dialog for adding 
701
	 * adds click event listener to it to create and pop up a dialog for adding 
551
	 * a prices for a new vendor 
702
	 * a prices for a new vendor 
552
	 */
703
	 */
Line 855... Line 1006...
855
				});
1006
				});
856
				voucherItemDialog.show();
1007
				voucherItemDialog.show();
857
			}
1008
			}
858
		});
1009
		});
859
	}
1010
	}
-
 
1011
	
-
 
1012
	private void getBulkPricingForItem(long item_id){
-
 
1013
		catalogService.getBulkPricingByItemId(item_id, new AsyncCallback<List<BulkItemPricing>>() {
-
 
1014
			@Override
-
 
1015
			public void onSuccess(List<BulkItemPricing> result) {
-
 
1016
				updateBulkPricingTable(result);
-
 
1017
			}
-
 
1018
			@Override
-
 
1019
			public void onFailure(Throwable caught) {
-
 
1020
				caught.printStackTrace();
-
 
1021
				Window.alert("Unable to get bulk pricing for item");
-
 
1022
			}
-
 
1023
			
-
 
1024
		});
-
 
1025
	}
-
 
1026
 
-
 
1027
 
-
 
1028
	private void updateBulkPricingTable(List<BulkItemPricing> items){
-
 
1029
		tableBulkPricing.removeAllRows();
-
 
1030
		tableBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_BULK_PRICING_ID, "5px");
-
 
1031
		tableBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_QUANTITY, "5px");
-
 
1032
		tableBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_PRICE, "5px");
-
 
1033
		tableBulkPricing.getColumnFormatter().setWidth(TABLE_INDEX_BULK_PRICING_BUTTON, BUTTON_WIDTH);
-
 
1034
		int i =0;
-
 
1035
		for (BulkItemPricing result : items){
-
 
1036
			tableBulkPricing.setText(i, TABLE_INDEX_BULK_PRICING_ID, result.getId()+"");
-
 
1037
			tableBulkPricing.setText(i, TABLE_INDEX_QUANTITY, result.getQuantity()+"");
-
 
1038
			tableBulkPricing.setText(i, TABLE_INDEX_PRICE, result.getPrice()+"");
-
 
1039
			tableBulkPricing.getCellFormatter().setVisible(i, TABLE_INDEX_BULK_PRICING_ID, false);
-
 
1040
			Button deleteButton = new Button("Delete");
-
 
1041
			tableBulkPricing.setWidget(i, TABLE_INDEX_BULK_PRICING_BUTTON, deleteButton);
-
 
1042
			deleteButton.addClickHandler(new ClickHandler() {
-
 
1043
				@Override
-
 
1044
				public void onClick(ClickEvent event) {
-
 
1045
					Cell cell = tableBulkPricing.getCellForEvent(event);
-
 
1046
					int row = cell.getRowIndex();
-
 
1047
					deleteBulkPricingForId(Long.valueOf(tableBulkPricing.getText(row, TABLE_INDEX_BULK_PRICING_ID)), item.getId());
-
 
1048
				}
-
 
1049
 
-
 
1050
			});
-
 
1051
			i++;
-
 
1052
		}
-
 
1053
	}
860
 
1054
 
861
	/**
1055
	/**
862
	 * Clear and populate item availability table.
1056
	 * Clear and populate item availability table.
863
	 * @param availabilityMap
1057
	 * @param availabilityMap
864
	 */
1058
	 */
Line 1407... Line 1601...
1407
		}
1601
		}
1408
		else if(dealStartDt==null && privateDeal.getDealPrice()>0){
1602
		else if(dealStartDt==null && privateDeal.getDealPrice()>0){
1409
			Window.alert("Enter valid Start Date");
1603
			Window.alert("Enter valid Start Date");
1410
			return false;
1604
			return false;
1411
		}
1605
		}
1412
/*		if(isDealActive.getValue() && dealStartDt.getTime() < System.currentTimeMillis()){
1606
		/*		if(isDealActive.getValue() && dealStartDt.getTime() < System.currentTimeMillis()){
1413
			Window.alert("Deal Start Date < Current Date (Either mark InActive or Change Deal Start Date)");
1607
			Window.alert("Deal Start Date < Current Date (Either mark InActive or Change Deal Start Date)");
1414
			return false;
1608
			return false;
1415
		}*/
1609
		}*/
1416
		if(dealEndDt!=null && privateDeal.getDealPrice() >0){
1610
		if(dealEndDt!=null && privateDeal.getDealPrice() >0){
1417
			privateDeal.setEndDate(dealEndDt.getTime());
1611
			privateDeal.setEndDate(dealEndDt.getTime());
Line 1535... Line 1729...
1535
			}
1729
			}
1536
		} catch(NumberFormatException ex) {
1730
		} catch(NumberFormatException ex) {
1537
			Window.alert("Invalid PackQuantity format/value. Value should be greater than zero");
1731
			Window.alert("Invalid PackQuantity format/value. Value should be greater than zero");
1538
			return false;
1732
			return false;
1539
		}
1733
		}
-
 
1734
		try {
-
 
1735
			if(!quantityStep.getText().trim().isEmpty()) {
-
 
1736
				long quantityStepValue = Long.parseLong(quantityStep.getText().trim());
-
 
1737
				if(quantityStepValue < 1) {
-
 
1738
					throw new NumberFormatException("Illegal value of Quantity Step");
-
 
1739
				}
-
 
1740
				newItem.setQuantityStep(quantityStepValue);
-
 
1741
			}
-
 
1742
			else{
-
 
1743
				Window.alert("Invalid Quantity Step format/value. Value should can't be empty");
-
 
1744
				return false;
-
 
1745
			}
-
 
1746
		} catch(NumberFormatException ex) {
-
 
1747
			Window.alert("Invalid Quantity Step format/value. Value should be greater than zero");
-
 
1748
			return false;
-
 
1749
		}
-
 
1750
		try {
-
 
1751
			if(!minimumBuyQuantity.getText().trim().isEmpty()) {
-
 
1752
				long minimumBuyQuantityValue= Long.parseLong(minimumBuyQuantity.getText().trim());
-
 
1753
				if(minimumBuyQuantityValue < 1) {
-
 
1754
					throw new NumberFormatException("Illegal value of Min Buy Qty");
-
 
1755
				}
-
 
1756
				newItem.setMinimumBuyQuantity(minimumBuyQuantityValue);
-
 
1757
			}
-
 
1758
			else{
-
 
1759
				Window.alert("Invalid Min Buy Qty format/value. Value should can't be empty");
-
 
1760
				return false;
-
 
1761
			}
-
 
1762
		} catch(NumberFormatException ex) {
-
 
1763
			Window.alert("Invalid Min Buy Qty format/value. Value should be greater than zero");
-
 
1764
			return false;
-
 
1765
		}
-
 
1766
 
1540
		if(newItem.getPrivateDeal().getDealPrice()!=0 && newItem.getPrivateDeal().getDealPrice() >= newItem.getSellingPrice()){
1767
		if(newItem.getPrivateDeal().getDealPrice()!=0 && newItem.getPrivateDeal().getDealPrice() >= newItem.getSellingPrice()){
1541
			Window.alert("Deal Price can't be more than Selling Price");
1768
			Window.alert("Deal Price can't be more than Selling Price");
1542
			return false;
1769
			return false;
1543
		}
1770
		}
1544
		try {
1771
		try {
Line 1975... Line 2202...
1975
			sb.append("\n-Hold Inventory");
2202
			sb.append("\n-Hold Inventory");
1976
		}
2203
		}
1977
		if(!checkParameterIfEqual(newItem.getDefaultInventory(), item.getDefaultInventory())) {
2204
		if(!checkParameterIfEqual(newItem.getDefaultInventory(), item.getDefaultInventory())) {
1978
			sb.append("\n-Default Inventory");
2205
			sb.append("\n-Default Inventory");
1979
		}
2206
		}
1980
		if(newItem.getPackQuantity()!=item.getPackQuantity()) {
2207
		if(!checkParameterIfEqual(newItem.getPackQuantity(),item.getPackQuantity())) {
-
 
2208
			mandatoryChangedValMap.put(OPTIONAL_PACK_QUANTITY, newItem.getPackQuantity());
1981
			sb.append("\n-PackQuantity");
2209
			sb.append("\n-PackQuantity");
1982
		}
2210
		}
-
 
2211
		if(!checkParameterIfEqual(newItem.getQuantityStep(),item.getQuantityStep())) {
-
 
2212
			mandatoryChangedValMap.put(OPTIONAL_QUANTITY_STEP, newItem.getQuantityStep());
-
 
2213
			sb.append("\n-Quantity Step");
1983
		
2214
		}
-
 
2215
 
-
 
2216
		if(!checkParameterIfEqual(newItem.getMinimumBuyQuantity(),item.getMinimumBuyQuantity())) {
-
 
2217
			mandatoryChangedValMap.put(OPTIONAL_MINIMUM_BUY_QTY, newItem.getMinimumBuyQuantity());
-
 
2218
			sb.append("\n-Min Buy Qty");
-
 
2219
		}
-
 
2220
 
1984
		VendorPricings vendorPricings;
2221
		VendorPricings vendorPricings;
1985
		long vendorId;
2222
		long vendorId;
1986
		boolean vendorPricingsChanged = false;
2223
		boolean vendorPricingsChanged = false;
1987
		for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
2224
		for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
1988
			vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
2225
			vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
Line 2029... Line 2266...
2029
			}
2266
			}
2030
			if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
2267
			if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
2031
				sourcePricingsChanged = true;
2268
				sourcePricingsChanged = true;
2032
				sb.append("\n-Selling Price (Source:" + sourceId + ")");
2269
				sb.append("\n-Selling Price (Source:" + sourceId + ")");
2033
			}
2270
			}
2034
			
2271
 
2035
		}
2272
		}
2036
		if(sourcePricingsChanged){
2273
		if(sourcePricingsChanged){
2037
			sb.append("\n-Source Pricing");
2274
			sb.append("\n-Source Pricing");
2038
			optionalChangedValMap.put(OPTIONAL_SOURCE_PRICING, newItem.getSourcePricesMap());
2275
			optionalChangedValMap.put(OPTIONAL_SOURCE_PRICING, newItem.getSourcePricesMap());
2039
		}
2276
		}
Line 2153... Line 2390...
2153
	 * @param o2
2390
	 * @param o2
2154
	 * @return true if two strings are equal
2391
	 * @return true if two strings are equal
2155
	 *      <br>true if one of them is null and another is empty.
2392
	 *      <br>true if one of them is null and another is empty.
2156
	 *      <br>false otherwise
2393
	 *      <br>false otherwise
2157
	 */
2394
	 */
-
 
2395
	
2158
	private boolean checkParameterIfEqual(Object o1, Object o2) {
2396
	private boolean checkParameterIfEqual(Object o1, Object o2) {
2159
		if(o1 == o2) {
2397
		if(o1 == o2) {
2160
			return true;
2398
			return true;
2161
		}
2399
		}
2162
		if(o1 != null && o2 != null && o1.equals(o2)) {
2400
		if(o1 != null && o2 != null && o1.equals(o2)) {
Line 2279... Line 2517...
2279
			Window.alert("Add vendor to Vendor Prices and then change the Preferred Vendor.");
2517
			Window.alert("Add vendor to Vendor Prices and then change the Preferred Vendor.");
2280
			return message;
2518
			return message;
2281
		}
2519
		}
2282
	}
2520
	}
2283
 
2521
 
-
 
2522
	private boolean checkBulkPricing(long quantity) {
-
 
2523
		long row_quantity;
-
 
2524
		for(int i = 0; i < tableBulkPricing.getRowCount(); i++) {
-
 
2525
			row_quantity = Long.parseLong(tableBulkPricing.getText(i, TABLE_INDEX_QUANTITY));
-
 
2526
			if(quantity == row_quantity) {
-
 
2527
				return false;
-
 
2528
			}
-
 
2529
		}
-
 
2530
		return true;
-
 
2531
	}
-
 
2532
 
2284
	public void logAuthorization(String message) {
2533
	public void logAuthorization(String message) {
2285
		String username = catalogDashboardPanel.uname;
2534
		String username = catalogDashboardPanel.uname;
2286
		catalogService.addAuthorizationLog(newItem.getId(), username, message, new AsyncCallback<Boolean>() {
2535
		catalogService.addAuthorizationLog(newItem.getId(), username, message, new AsyncCallback<Boolean>() {
2287
			@Override
2536
			@Override
2288
			public void onSuccess(Boolean result) {
2537
			public void onSuccess(Boolean result) {
Line 2488... Line 2737...
2488
					result.setSourcePricesMap((Map<Long, SourcePricings>) optionalChangedValMap.get(OPTIONAL_SOURCE_PRICING));
2737
					result.setSourcePricesMap((Map<Long, SourcePricings>) optionalChangedValMap.get(OPTIONAL_SOURCE_PRICING));
2489
				}
2738
				}
2490
				if(optionalChangedValMap.containsKey(OPTIONAL_VENDOR_PRICING)){
2739
				if(optionalChangedValMap.containsKey(OPTIONAL_VENDOR_PRICING)){
2491
					result.setVendorPricesMap((Map<Long, VendorPricings>) optionalChangedValMap.get(OPTIONAL_VENDOR_PRICING));
2740
					result.setVendorPricesMap((Map<Long, VendorPricings>) optionalChangedValMap.get(OPTIONAL_VENDOR_PRICING));
2492
				}
2741
				}
-
 
2742
 
2493
				catalogService.updateItem(result, new AsyncCallback<Boolean>() {
2743
				catalogService.updateItem(result, new AsyncCallback<Boolean>() {
2494
 
2744
 
2495
					@Override
2745
					@Override
2496
					public void onSuccess(Boolean result1) {
2746
					public void onSuccess(Boolean result1) {
2497
						if(result1) {
2747
						if(result1) {