| 1961 |
ankur.sing |
1 |
package in.shop2020.catalog.dashboard.client;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.catalog.dashboard.shared.Item;
|
| 4431 |
phani.kuma |
4 |
import in.shop2020.catalog.dashboard.shared.ItemInventory;
|
| 6530 |
vikram.rag |
5 |
import in.shop2020.catalog.dashboard.shared.ItemWarehouse;
|
| 3558 |
rajveer |
6 |
import in.shop2020.catalog.dashboard.shared.SourcePricings;
|
| 2066 |
ankur.sing |
7 |
import in.shop2020.catalog.dashboard.shared.Utils;
|
| 2119 |
ankur.sing |
8 |
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
|
|
|
9 |
import in.shop2020.catalog.dashboard.shared.VendorPricings;
|
| 5504 |
phani.kuma |
10 |
import in.shop2020.catalog.dashboard.shared.VoucherItemMapping;
|
| 1961 |
ankur.sing |
11 |
|
| 5427 |
amit.gupta |
12 |
import java.util.ArrayList;
|
| 1961 |
ankur.sing |
13 |
import java.util.Date;
|
| 2066 |
ankur.sing |
14 |
import java.util.HashMap;
|
| 5427 |
amit.gupta |
15 |
import java.util.Iterator;
|
|
|
16 |
import java.util.List;
|
| 1992 |
ankur.sing |
17 |
import java.util.Map;
|
|
|
18 |
import java.util.Map.Entry;
|
| 1961 |
ankur.sing |
19 |
|
|
|
20 |
import com.google.gwt.core.client.GWT;
|
| 5427 |
amit.gupta |
21 |
import com.google.gwt.dom.client.Style.Unit;
|
| 11671 |
vikram.rag |
22 |
import com.google.gwt.event.dom.client.ChangeEvent;
|
|
|
23 |
import com.google.gwt.event.dom.client.ChangeHandler;
|
| 1961 |
ankur.sing |
24 |
import com.google.gwt.event.dom.client.ClickEvent;
|
| 1992 |
ankur.sing |
25 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
26 |
import com.google.gwt.resources.client.CssResource;
|
| 1961 |
ankur.sing |
27 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
28 |
import com.google.gwt.uibinder.client.UiField;
|
| 5427 |
amit.gupta |
29 |
import com.google.gwt.uibinder.client.UiHandler;
|
| 1961 |
ankur.sing |
30 |
import com.google.gwt.user.client.Window;
|
| 2126 |
ankur.sing |
31 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
| 1961 |
ankur.sing |
32 |
import com.google.gwt.user.client.ui.Button;
|
| 2066 |
ankur.sing |
33 |
import com.google.gwt.user.client.ui.CheckBox;
|
| 5427 |
amit.gupta |
34 |
import com.google.gwt.user.client.ui.DialogBox;
|
| 1992 |
ankur.sing |
35 |
import com.google.gwt.user.client.ui.FlexTable;
|
|
|
36 |
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
| 1961 |
ankur.sing |
37 |
import com.google.gwt.user.client.ui.Label;
|
| 4506 |
phani.kuma |
38 |
import com.google.gwt.user.client.ui.ListBox;
|
| 1961 |
ankur.sing |
39 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
|
|
40 |
import com.google.gwt.user.client.ui.TextBox;
|
| 5427 |
amit.gupta |
41 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 1961 |
ankur.sing |
42 |
import com.google.gwt.user.client.ui.Widget;
|
| 2068 |
ankur.sing |
43 |
import com.google.gwt.user.datepicker.client.DateBox;
|
| 1961 |
ankur.sing |
44 |
|
| 2427 |
ankur.sing |
45 |
/**
|
|
|
46 |
* Panel contains fields for item details. Some of these fields are editable.
|
|
|
47 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
|
|
48 |
* Item availability is made invisible for time being
|
|
|
49 |
*/
|
| 5217 |
amit.gupta |
50 |
public class ItemDetails extends ResizeComposite implements ComingSoon {
|
| 1961 |
ankur.sing |
51 |
|
| 10484 |
vikram.rag |
52 |
private final int TABLE_INDEX_MAPPING_VENDOR_DESC = 0,
|
|
|
53 |
TABLE_INDEX_MAPPING_ITEM_KEY = 1,
|
|
|
54 |
TABLE_INDEX_MAPPING_BUTTON = 2,
|
|
|
55 |
TABLE_INDEX_MAPPING_VENDORID = 3,
|
|
|
56 |
TABLE_INDEX_MAPPING_ITEM_KEY_OLD = 4;
|
| 3558 |
rajveer |
57 |
|
| 10484 |
vikram.rag |
58 |
private final int TABLE_INDEX_PRICING_VENDOR_DESC = 0,
|
|
|
59 |
TABLE_INDEX_PRICING_MOP = 1,
|
|
|
60 |
TABLE_INDEX_PRICING_DP = 2,
|
|
|
61 |
TABLE_INDEX_PRICING_TP = 3,
|
|
|
62 |
TABLE_INDEX_PRICING_NLC = 4,
|
|
|
63 |
TABLE_INDEX_PRICING_BUTTON = 5,
|
|
|
64 |
TABLE_INDEX_PRICING_VENDORID = 6;
|
| 3558 |
rajveer |
65 |
|
| 10484 |
vikram.rag |
66 |
private final int TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC = 0,
|
|
|
67 |
TABLE_INDEX_SOURCE_PRICING_MRP = 1,
|
|
|
68 |
TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE = 2,
|
|
|
69 |
TABLE_INDEX_SOURCE_PRICING_BUTTON = 3,
|
|
|
70 |
TABLE_INDEX_SOURCE_PRICING_SOURCE_ID = 4;
|
| 2066 |
ankur.sing |
71 |
|
| 10484 |
vikram.rag |
72 |
private final int TABLE_INDEX_WAREHOUSE_ID = 0,
|
|
|
73 |
TABLE_INDEX_WAREHOUSE_DESC = 1,
|
|
|
74 |
TABLE_INDEX_WAREHOUSE_INVA = 2,
|
|
|
75 |
TABLE_INDEX_WAREHOUSE_INVR = 3,
|
|
|
76 |
TABLE_INDEX_WAREHOUSE_HELD = 4,
|
|
|
77 |
TABLE_INDEX_WAREHOUSE_EBAY_HELD = 5,
|
|
|
78 |
TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD = 6,
|
|
|
79 |
TABLE_INDEX_WAREHOUSE_FLIPKART_HELD = 7,
|
| 13748 |
manish.sha |
80 |
TABLE_INDEX_WAREHOUSE_HOMESHOP18_HELD = 8,
|
|
|
81 |
TABLE_INDEX_WAREHOUSE_GET_BUTTON = 9,
|
|
|
82 |
TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON = 10;
|
| 2066 |
ankur.sing |
83 |
|
| 10484 |
vikram.rag |
84 |
private final int TABLE_INDEX_WAREHOUSE_NAME = 0,
|
|
|
85 |
TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON = 1;
|
| 1961 |
ankur.sing |
86 |
|
| 10484 |
vikram.rag |
87 |
private final int TABLE_INDEX_STATE_NAME = 0,
|
|
|
88 |
TABLE_INDEX_STATE_TAX_PERCENTAGE = 1;
|
| 1961 |
ankur.sing |
89 |
|
| 2066 |
ankur.sing |
90 |
|
| 10484 |
vikram.rag |
91 |
private final int TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID = 0,
|
|
|
92 |
TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP = 1,
|
|
|
93 |
TABLE_INDEX_SIMILAR_ITEMS_BRAND = 2,
|
|
|
94 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER = 3,
|
|
|
95 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME = 4,
|
|
|
96 |
TABLE_INDEX_SIMILAR_ITEMS_CATEGORY = 5,
|
|
|
97 |
TABLE_INDEX_SIMILAR_ITEMS_BUTTON = 6;
|
| 2066 |
ankur.sing |
98 |
|
| 10484 |
vikram.rag |
99 |
private final int TABLE_INDEX_VOUCHERS_TYPE = 0,
|
|
|
100 |
TABLE_INDEX_VOUCHERS_AMOUNT = 1,
|
|
|
101 |
TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON = 2,
|
|
|
102 |
TABLE_INDEX_VOUCHERS_DEL_BUTTON = 3;
|
| 2066 |
ankur.sing |
103 |
|
| 10484 |
vikram.rag |
104 |
private final String MANDATORY_MRP = "MRP",
|
|
|
105 |
MANDATORY_WEIGHT = "Weight",
|
|
|
106 |
MANDATORY_BEST_DEAL_TEXT = "Best Deal Text",
|
|
|
107 |
MANDATORY_BEST_DEAL_DETAIL_TEXT = "Best Deal Detail Text",
|
|
|
108 |
MANDATORY_BEST_DEAL_DETAIL_LINK = "Best Deal Detail Link",
|
|
|
109 |
MANDATORY_BRAND = "Brand",
|
|
|
110 |
MANDATORY_MODEL_NO = "Model Number",
|
|
|
111 |
MANDATORY_MODEL_NAME = "Model Name";
|
| 4649 |
phani.kuma |
112 |
|
| 2066 |
ankur.sing |
113 |
|
| 10484 |
vikram.rag |
114 |
private final String OPTIONAL_SELLING_PRICE = "Selling Price",
|
|
|
115 |
OPTIONAL_VENDOR_PRICING = "Vendor Pricing",
|
|
|
116 |
OPTIONAL_PREFERRED_VENDOR = "Preferred Vendor",
|
|
|
117 |
OPTIONAL_PREFERRED_INSURER = "Preferred Insurer",
|
|
|
118 |
OPTIONAL_SOURCE_PRICING = "Source Pricing",
|
|
|
119 |
OPTIONAL_FREEBIE_ITEM_ID = "Freebie Item Id";
|
| 5217 |
amit.gupta |
120 |
|
| 10484 |
vikram.rag |
121 |
private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
|
|
|
122 |
VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
|
|
|
123 |
BUTTON_WIDTH = "50px";
|
| 1992 |
ankur.sing |
124 |
|
| 10484 |
vikram.rag |
125 |
private Map<String, String> ConfigMap;
|
|
|
126 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {}
|
|
|
127 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
|
|
128 |
private final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
|
|
|
129 |
Map<String, Object> mandatoryChangedValMap;
|
|
|
130 |
Map<String, Object> optionalChangedValMap;
|
| 2066 |
ankur.sing |
131 |
|
| 10484 |
vikram.rag |
132 |
|
|
|
133 |
interface ItemDetailStyle extends CssResource{
|
|
|
134 |
String greenLabel();
|
|
|
135 |
String fieldChanged();
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
private Item item, newItem;
|
|
|
139 |
private CatalogDashboard catalogDashboardPanel;
|
|
|
140 |
|
|
|
141 |
@UiField ItemDetailStyle style;
|
|
|
142 |
@UiField Label itemId;
|
|
|
143 |
@UiField TextBox brand, modelNumber, modelName, color;
|
|
|
144 |
@UiField Label contentCategory, catalogItemId, productGroup;
|
| 11671 |
vikram.rag |
145 |
@UiField TextBox statusDesc, comments, dealText;
|
| 10484 |
vikram.rag |
146 |
@UiField TextBox sellingPrice, mrp, weight;
|
|
|
147 |
@UiField Label addedOn, retireDate, updatedOn;
|
|
|
148 |
@UiField Label itemStatus;
|
|
|
149 |
@UiField TextBox bestDealsText, bestDealsValue ,bestDealsDetailsText,bestDealsDetailsLink;
|
|
|
150 |
@UiField FlexTable headerAvailability, availabilityTable;
|
|
|
151 |
@UiField FlexTable headerVendorItemKey, tableVendorItemKey;
|
|
|
152 |
@UiField FlexTable headerVendorPrices, tableVendorPrices;
|
|
|
153 |
@UiField FlexTable headerSourcePrices, tableSourcePrices;
|
| 11671 |
vikram.rag |
154 |
@UiField TextBox bestSellingRank,dealRank;
|
| 10484 |
vikram.rag |
155 |
@UiField TextBox expectedDelay;
|
| 11671 |
vikram.rag |
156 |
@UiField CheckBox defaultForEntity, risky, warehouseStickiness, itemType, hasItemNo, showSellingPrice, holdOverride,isCodOnDeal,isDealActive;
|
|
|
157 |
@UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate,dealStartDate,dealEndDate;
|
| 10484 |
vikram.rag |
158 |
@UiField FlexTable headerSimilarItems, tableSimilarItems;
|
| 11671 |
vikram.rag |
159 |
@UiField ListBox preferredVendor,preferredInsurer,dealTextOption,dealFreebieOption;
|
| 10484 |
vikram.rag |
160 |
@UiField Button comingSoonButton;
|
|
|
161 |
@UiField FlexTable headerVouchers, tableVouchers;
|
|
|
162 |
@UiField FlexTable headerIgnoredWarehouse,tableIgnoredWarehouse;
|
|
|
163 |
@UiField FlexTable headerVatDetails,tableVatDetails;
|
|
|
164 |
@UiField TextBox minStockLevel, numOfDaysStock;
|
| 13727 |
manish.sha |
165 |
@UiField TextBox lastNdaySale, websiteLastNdaySale, amazonLastNdaySale, ebayLastNdaySale, snapdealLastNdaySale, flipkartLastNdaySale, homeshop18LastNdaySale;
|
| 10484 |
vikram.rag |
166 |
@UiField TextBox freebieItemId;
|
|
|
167 |
@UiField TextBox asin;
|
|
|
168 |
@UiField TextBox holdInventory;
|
|
|
169 |
@UiField TextBox defaultInventory;
|
| 11671 |
vikram.rag |
170 |
@UiField TextBox dealFreebieItemId;
|
|
|
171 |
@UiField TextBox dealPrice;
|
| 10484 |
vikram.rag |
172 |
|
|
|
173 |
public ItemDetails(Item item){
|
|
|
174 |
this();
|
|
|
175 |
setItemDetails(item);
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
public ItemDetails() {
|
|
|
179 |
initWidget(uiBinder.createAndBindUi(this));
|
|
|
180 |
initAvailabilityHeader();
|
|
|
181 |
initVendorKeysHeader();
|
|
|
182 |
initVendorPricingHeader();
|
|
|
183 |
initSourcePricingHeader();
|
|
|
184 |
initSimilarItemList();
|
|
|
185 |
initVoucherHeader();
|
|
|
186 |
initIgnoredWarehouseHeader();
|
|
|
187 |
preferredVendor.addItem("null");
|
|
|
188 |
preferredInsurer.addItem("null");
|
|
|
189 |
getConfigdataforPriceCompare();
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
public void getConfigdataforPriceCompare(){
|
|
|
193 |
catalogService.getConfigdataforPriceCompare(new AsyncCallback<Map<String,String>>() {
|
|
|
194 |
@Override
|
|
|
195 |
public void onSuccess(Map<String, String> result) {
|
|
|
196 |
ConfigMap = result;
|
|
|
197 |
}
|
|
|
198 |
@Override
|
|
|
199 |
public void onFailure(Throwable caught) {
|
|
|
200 |
caught.printStackTrace();
|
|
|
201 |
}
|
|
|
202 |
});
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
/**
|
|
|
206 |
* Sets the UI fields with item object attributes
|
|
|
207 |
* Also populates tables for vendor prices, keys and item availability
|
|
|
208 |
* @param item
|
|
|
209 |
*/
|
|
|
210 |
public void setItemDetails(Item item){
|
|
|
211 |
this.item = item;
|
|
|
212 |
itemId.setText(item.getId()+"");
|
|
|
213 |
productGroup.setText(item.getProductGroup());
|
|
|
214 |
brand.setText(item.getBrand());
|
|
|
215 |
modelNumber.setText(item.getModelNumber());
|
|
|
216 |
modelName.setText(item.getModelName());
|
|
|
217 |
color.setText(item.getColor());
|
|
|
218 |
|
|
|
219 |
statusDesc.setText(item.getItemStatusDesc());
|
|
|
220 |
contentCategory.setText(item.getContentCategory()+"");
|
|
|
221 |
comments.setText(item.getComments());
|
|
|
222 |
catalogItemId.setText(item.getCatalogItemId() + "");
|
| 11671 |
vikram.rag |
223 |
dealTextOption.clear();
|
|
|
224 |
dealTextOption.addItem("None","0");
|
|
|
225 |
dealTextOption.addItem("Existing Best Deals Text","1");
|
|
|
226 |
dealTextOption.addItem("Other","2");
|
|
|
227 |
dealTextOption.setSelectedIndex(item.getPrivateDeal().getDealTextOption().intValue());
|
|
|
228 |
if(!item.getPrivateDeal().getDealText().equals("")){
|
|
|
229 |
dealText.setText(item.getPrivateDeal().getDealText()+"");
|
|
|
230 |
}
|
|
|
231 |
else{
|
|
|
232 |
dealText.setText("");
|
|
|
233 |
}
|
| 11976 |
vikram.rag |
234 |
if(dealTextOption.getSelectedIndex()!=2){
|
|
|
235 |
dealText.setEnabled(false);
|
|
|
236 |
}
|
| 11671 |
vikram.rag |
237 |
dealFreebieOption.clear();
|
|
|
238 |
dealFreebieOption.addItem("None","0");
|
|
|
239 |
dealFreebieOption.addItem("Existing Freebie","1");
|
|
|
240 |
dealFreebieOption.addItem("Other","2");
|
|
|
241 |
dealFreebieOption.setSelectedIndex(item.getPrivateDeal().getDealFreebieOption().intValue());
|
| 11976 |
vikram.rag |
242 |
if(dealFreebieOption.getSelectedIndex()!=2){
|
|
|
243 |
dealFreebieItemId.setEnabled(false);
|
|
|
244 |
}
|
| 11671 |
vikram.rag |
245 |
dealFreebieItemId.setText(item.getPrivateDeal().getDealFreebieItemId()+"");
|
| 10484 |
vikram.rag |
246 |
preferredInsurer.clear();
|
|
|
247 |
preferredVendor.clear();
|
|
|
248 |
int index = -1;
|
|
|
249 |
if (item.getPreferredVendor() == null) {
|
|
|
250 |
index++;
|
|
|
251 |
preferredVendor.addItem("select");
|
|
|
252 |
}
|
|
|
253 |
|
|
|
254 |
if((item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty())) {
|
|
|
255 |
if(item.getPreferredVendor() != null) {
|
|
|
256 |
index++;
|
|
|
257 |
preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
|
|
|
258 |
}
|
|
|
259 |
}
|
|
|
260 |
else {
|
|
|
261 |
for(VendorPricings vendorDetail : item.getVendorPricesMap().values()){
|
|
|
262 |
index++;
|
|
|
263 |
preferredVendor.addItem(Utils.getVendorDesc(vendorDetail.getVendorId()));
|
|
|
264 |
if(item.getPreferredVendor() != null && item.getPreferredVendor() == vendorDetail.getVendorId()) {
|
|
|
265 |
preferredVendor.setSelectedIndex(index);
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
if(item.getPreferredVendor() != null && !item.getVendorPricesMap().containsKey(item.getPreferredVendor())){
|
|
|
270 |
index++;
|
|
|
271 |
preferredVendor.addItem(Utils.getVendorDesc(item.getPreferredVendor()));
|
|
|
272 |
preferredVendor.setSelectedIndex(index);
|
|
|
273 |
}
|
|
|
274 |
}
|
|
|
275 |
index=0;
|
|
|
276 |
preferredInsurer.addItem("select","0");
|
|
|
277 |
preferredInsurer.setSelectedIndex(0);
|
|
|
278 |
for (Map.Entry<Long, String> entry : Utils.getAllInsurers().entrySet()){
|
|
|
279 |
index++;
|
|
|
280 |
preferredInsurer.addItem(entry.getValue(),entry.getKey().toString());
|
|
|
281 |
if(item.getPreferredInsurer()==entry.getKey()){
|
|
|
282 |
preferredInsurer.setSelectedIndex(index);
|
|
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
mrp.setText(item.getMrp() != null ? item.getMrp()+"" : "");
|
|
|
286 |
sellingPrice.setText(item.getSellingPrice() != null ? item.getSellingPrice()+"" : "");
|
|
|
287 |
weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
|
|
|
288 |
expectedDelay.setValue(item.getExpectedDelay()+"");
|
|
|
289 |
warehouseStickiness.setValue(item.isWarehouseStickiness());
|
|
|
290 |
|
|
|
291 |
hasItemNo.setValue(item.isHasItemNo());
|
|
|
292 |
itemType.setValue(item.isItemType());
|
|
|
293 |
showSellingPrice.setValue(item.isShowSellingPrice());
|
|
|
294 |
holdOverride.setValue(item.isHoldOverride());
|
|
|
295 |
|
|
|
296 |
startDate.setValue(new Date(item.getStartDate()));
|
|
|
297 |
if(item.getComingSoonStartDate() != null){
|
|
|
298 |
comingSoonStartDate.setValue(new Date(item.getComingSoonStartDate()));
|
|
|
299 |
}else {
|
|
|
300 |
comingSoonStartDate.setValue(null);
|
|
|
301 |
}
|
|
|
302 |
|
|
|
303 |
if(item.getExpectedArrivalDate() != null){
|
|
|
304 |
expectedArrivalDate.setValue(new Date(item.getExpectedArrivalDate()));
|
|
|
305 |
}else {
|
|
|
306 |
expectedArrivalDate.setValue(null);
|
|
|
307 |
}
|
|
|
308 |
addedOn.setText(Utils.getDisplayableDate(item.getAddedOn()));
|
|
|
309 |
retireDate.setText(Utils.getDisplayableDate(item.getRetireDate()));
|
|
|
310 |
updatedOn.setText(Utils.getDisplayableDate(item.getUpdatedOn()));
|
|
|
311 |
|
|
|
312 |
bestDealsText.setText(item.getBestDealsText());
|
|
|
313 |
bestDealsDetailsText.setText(item.getBestDealsDetailsText());
|
|
|
314 |
bestDealsDetailsLink.setText(item.getBestDealsDetailsLink());
|
|
|
315 |
bestDealsValue.setText(item.getBestDealsValue() != null ? item.getBestDealsValue()+"" : "");
|
|
|
316 |
bestSellingRank.setText(item.getBestSellingRank() != null ? item.getBestSellingRank()+"" : "");
|
|
|
317 |
minStockLevel.setText(item.getMinStockLevel() != null ? item.getMinStockLevel()+"" : "");
|
|
|
318 |
lastNdaySale.setText(item.getSaleHistory().get(0L));
|
|
|
319 |
websiteLastNdaySale.setText(item.getSaleHistory().get(1L));
|
|
|
320 |
amazonLastNdaySale.setText(item.getSaleHistory().get(3L));
|
|
|
321 |
ebayLastNdaySale.setText(item.getSaleHistory().get(6L));
|
|
|
322 |
snapdealLastNdaySale.setText(item.getSaleHistory().get(7L));
|
|
|
323 |
flipkartLastNdaySale.setText(item.getSaleHistory().get(8L));
|
| 13727 |
manish.sha |
324 |
homeshop18LastNdaySale.setText(item.getSaleHistory().get(4L));
|
| 10484 |
vikram.rag |
325 |
numOfDaysStock.setText(item.getNumOfDaysStock() != null ? item.getNumOfDaysStock()+"" : "");
|
|
|
326 |
defaultForEntity.setValue(item.isDefaultForEntity());
|
|
|
327 |
risky.setValue(item.isRisky());
|
|
|
328 |
|
|
|
329 |
itemStatus.setText(item.getItemStatus());
|
|
|
330 |
freebieItemId.setText(item.getFreebieItemId().toString());
|
|
|
331 |
asin.setText(item.getAsin());
|
|
|
332 |
holdInventory.setText(Long.toString(item.getHoldInventory()));
|
|
|
333 |
defaultInventory.setText(Long.toString(item.getDefaultInventory()));
|
| 11671 |
vikram.rag |
334 |
dealPrice.setText(item.getPrivateDeal().getDealPrice() != 0 ? item.getPrivateDeal().getDealPrice()+"" : "");
|
|
|
335 |
if(item.getPrivateDeal().isActive()){
|
|
|
336 |
isDealActive.setValue(true);
|
|
|
337 |
}
|
|
|
338 |
else{
|
|
|
339 |
isDealActive.setValue(false);
|
|
|
340 |
}
|
|
|
341 |
if(item.getPrivateDeal().getStartDate()!=null){
|
|
|
342 |
dealStartDate.setValue(new Date(item.getPrivateDeal().getStartDate()));
|
|
|
343 |
}
|
|
|
344 |
else{
|
|
|
345 |
dealStartDate.setValue(null);
|
|
|
346 |
}
|
|
|
347 |
if(item.getPrivateDeal().getEndDate()!=null){
|
|
|
348 |
dealEndDate.setValue(new Date(item.getPrivateDeal().getEndDate()));
|
|
|
349 |
}
|
|
|
350 |
else{
|
|
|
351 |
dealEndDate.setValue(null);
|
|
|
352 |
}
|
|
|
353 |
bestSellingRank.setText(item.getBestSellingRank() != null ? item.getBestSellingRank()+"" : "");
|
| 11976 |
vikram.rag |
354 |
dealRank.setText(item.getPrivateDeal().getRank()!= 10000L? item.getPrivateDeal().getRank()+"" : "");
|
| 11671 |
vikram.rag |
355 |
if(item.getPrivateDeal().isCod()){
|
|
|
356 |
isCodOnDeal.setValue(true);
|
|
|
357 |
}
|
|
|
358 |
else{
|
|
|
359 |
isCodOnDeal.setValue(false);
|
|
|
360 |
}
|
|
|
361 |
dealText.setText(item.getPrivateDeal().getDealText());
|
| 10484 |
vikram.rag |
362 |
initVatDetailsHeader();
|
|
|
363 |
updateVatDetailsTable(item.getStateNameVatPercentageMap());
|
|
|
364 |
updateAvailabilityTable(item.getItemInventory());
|
|
|
365 |
updateVendorKeysTable(item.getVendorKeysMap());
|
|
|
366 |
updateVendorPricingTable(item.getVendorPricesMap());
|
|
|
367 |
updateSourcePricingTable(item.getSourcePricesMap());
|
|
|
368 |
updateSimilarItemsTable(item.getSimilarItems());
|
|
|
369 |
updateVoucherTable(item.getVouchersMap());
|
|
|
370 |
updateTableIgnoredWarehouse();
|
| 11671 |
vikram.rag |
371 |
dealTextOption.addChangeHandler(new ChangeHandler(){
|
|
|
372 |
@Override
|
|
|
373 |
public void onChange(ChangeEvent event) {
|
|
|
374 |
if(dealTextOption.getSelectedIndex()!=2){
|
|
|
375 |
dealText.setEnabled(false);
|
|
|
376 |
}
|
|
|
377 |
else{
|
|
|
378 |
dealText.setEnabled(true);
|
|
|
379 |
}
|
|
|
380 |
if(dealTextOption.getSelectedIndex()==1){
|
|
|
381 |
dealText.setText(bestDealsText.getText());
|
|
|
382 |
}
|
|
|
383 |
if(dealTextOption.getSelectedIndex()==0){
|
|
|
384 |
dealText.setText("");
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
}}
|
|
|
388 |
);
|
|
|
389 |
dealFreebieOption.addChangeHandler(new ChangeHandler(){
|
|
|
390 |
@Override
|
|
|
391 |
public void onChange(ChangeEvent event) {
|
|
|
392 |
if(dealFreebieOption.getSelectedIndex()!=2){
|
|
|
393 |
dealFreebieItemId.setEnabled(false);
|
|
|
394 |
}
|
|
|
395 |
else{
|
|
|
396 |
dealFreebieItemId.setEnabled(true);
|
|
|
397 |
}
|
|
|
398 |
if(dealFreebieOption.getSelectedIndex()==1){
|
|
|
399 |
dealFreebieItemId.setText(freebieItemId.getText());
|
|
|
400 |
}
|
|
|
401 |
if(dealFreebieOption.getSelectedIndex()==0){
|
|
|
402 |
dealFreebieItemId.setText("");
|
|
|
403 |
}
|
|
|
404 |
|
|
|
405 |
}}
|
|
|
406 |
);
|
| 10484 |
vikram.rag |
407 |
}
|
|
|
408 |
|
|
|
409 |
/**
|
|
|
410 |
* initialise item availability table header.
|
|
|
411 |
*/
|
|
|
412 |
private void initAvailabilityHeader(){
|
|
|
413 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ID, "100px");
|
|
|
414 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_DESC, "250px");
|
|
|
415 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVA, "100px");
|
|
|
416 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVR, "100px");
|
|
|
417 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HELD, "100px");
|
|
|
418 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_EBAY_HELD, "80px");
|
|
|
419 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "80px");
|
|
|
420 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "80px");
|
| 13748 |
manish.sha |
421 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HOMESHOP18_HELD, "80px");
|
| 10484 |
vikram.rag |
422 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_GET_BUTTON, "100px");
|
|
|
423 |
headerAvailability.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, "100px");
|
|
|
424 |
|
|
|
425 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_ID, "Warehouse Id");
|
|
|
426 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_DESC, "Warehouse Desc");
|
|
|
427 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_INVA, "Availability");
|
|
|
428 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_INVR, "Reserved");
|
|
|
429 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_HELD, "Held");
|
|
|
430 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_EBAY_HELD, "Ebay Held");
|
|
|
431 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "Snapdeal Held");
|
|
|
432 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "Flipkart Held");
|
| 13748 |
manish.sha |
433 |
headerAvailability.setText(0, TABLE_INDEX_WAREHOUSE_HOMESHOP18_HELD, "Homeshop18 Held");
|
| 10484 |
vikram.rag |
434 |
|
|
|
435 |
Button getLiveDataButton = new Button("Get Live Data");
|
|
|
436 |
headerAvailability.setWidget(0, TABLE_INDEX_WAREHOUSE_GET_BUTTON, getLiveDataButton);
|
|
|
437 |
getLiveDataButton.addClickHandler(new ClickHandler() {
|
|
|
438 |
@Override
|
|
|
439 |
public void onClick(ClickEvent event) {
|
|
|
440 |
catalogService.getProdItemInventory(item.getId(), new AsyncCallback<Map<Long, ItemInventory>>() {
|
|
|
441 |
@Override
|
|
|
442 |
public void onSuccess(Map<Long, ItemInventory> itemInventoryMap) {
|
|
|
443 |
if(itemInventoryMap != null) {
|
|
|
444 |
GWT.log("Inventory Data fetched");
|
|
|
445 |
item.setItemInventory(itemInventoryMap);
|
|
|
446 |
updateAvailabilityTable(item.getItemInventory());
|
|
|
447 |
}
|
|
|
448 |
else {
|
|
|
449 |
GWT.log("Error fetching Inventory Data");
|
|
|
450 |
Window.alert("Error fetching Inventory Data");
|
|
|
451 |
}
|
|
|
452 |
}
|
|
|
453 |
@Override
|
|
|
454 |
public void onFailure(Throwable caught) {
|
|
|
455 |
caught.printStackTrace();
|
|
|
456 |
Window.alert("Error fetching Inventory Data");
|
|
|
457 |
}
|
|
|
458 |
});
|
|
|
459 |
}
|
|
|
460 |
});
|
|
|
461 |
|
|
|
462 |
Button updateLiveDataButton = new Button("Update Live Data");
|
|
|
463 |
headerAvailability.setWidget(0, TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, updateLiveDataButton);
|
|
|
464 |
/* code to be rewritten later
|
| 4431 |
phani.kuma |
465 |
updateLiveDataButton.addClickHandler(new ClickHandler() {
|
|
|
466 |
@Override
|
|
|
467 |
public void onClick(ClickEvent event) {
|
|
|
468 |
catalogService.getProdItemInventory(item.getId(), new AsyncCallback<Map<Long, ItemInventory>>() {
|
|
|
469 |
@Override
|
|
|
470 |
public void onSuccess(Map<Long, ItemInventory> itemInventoryMap) {
|
|
|
471 |
if(itemInventoryMap != null) {
|
|
|
472 |
GWT.log("Inventory Data fetched");
|
|
|
473 |
item.setItemInventory(itemInventoryMap);
|
|
|
474 |
updateAvailabilityTable(item.getItemInventory());
|
|
|
475 |
}
|
|
|
476 |
else {
|
|
|
477 |
GWT.log("Error fetching Inventory Data");
|
|
|
478 |
Window.alert("Error fetching Inventory Data");
|
|
|
479 |
}
|
|
|
480 |
}
|
|
|
481 |
@Override
|
|
|
482 |
public void onFailure(Throwable caught) {
|
|
|
483 |
caught.printStackTrace();
|
|
|
484 |
Window.alert("Error fetching Inventory Data");
|
|
|
485 |
}
|
|
|
486 |
});
|
|
|
487 |
}
|
|
|
488 |
});
|
| 10484 |
vikram.rag |
489 |
*/
|
|
|
490 |
headerAvailability.getCellFormatter().setVisible(0, TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, false);
|
| 1992 |
ankur.sing |
491 |
|
| 10484 |
vikram.rag |
492 |
}
|
| 2066 |
ankur.sing |
493 |
|
| 10484 |
vikram.rag |
494 |
/**
|
|
|
495 |
* initialises vendor item key table header. Creates an Add button and
|
|
|
496 |
* adds click event listener to it to create and pop up a dialog for adding
|
|
|
497 |
* a new vendor item key.
|
|
|
498 |
*/
|
|
|
499 |
private void initVendorKeysHeader(){
|
|
|
500 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
|
|
501 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
|
|
502 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
|
|
503 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
|
|
504 |
headerVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_BUTTON, BUTTON_WIDTH);
|
| 2119 |
ankur.sing |
505 |
|
| 10484 |
vikram.rag |
506 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_VENDORID, "Vendor Id");
|
|
|
507 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_VENDOR_DESC, "Vendor");
|
|
|
508 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_ITEM_KEY, "Item Key");
|
|
|
509 |
headerVendorItemKey.setText(0, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, "Prev Item Key");
|
| 2119 |
ankur.sing |
510 |
|
| 10484 |
vikram.rag |
511 |
headerVendorItemKey.getCellFormatter().setVisible(0, TABLE_INDEX_MAPPING_VENDORID, false);
|
|
|
512 |
headerVendorItemKey.getCellFormatter().setVisible(0, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
| 2066 |
ankur.sing |
513 |
|
| 10484 |
vikram.rag |
514 |
Button addButton = new Button("Add");
|
|
|
515 |
headerVendorItemKey.setWidget(0, TABLE_INDEX_MAPPING_BUTTON, addButton);
|
|
|
516 |
addButton.addClickHandler(new ClickHandler() {
|
|
|
517 |
@Override
|
|
|
518 |
public void onClick(ClickEvent event) {
|
|
|
519 |
VendorMappingDialog vendorMappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(),
|
|
|
520 |
modelNumber.getText().trim(), color.getText().trim());
|
|
|
521 |
vendorMappingDialog.updateButton.setText("Add");
|
|
|
522 |
vendorMappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
|
|
|
523 |
@Override
|
|
|
524 |
public boolean onUpdate(String key, long vendorId) {
|
|
|
525 |
int row = tableVendorItemKey.getRowCount();
|
|
|
526 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
|
|
527 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
|
|
528 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
|
|
529 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
|
|
530 |
|
|
|
531 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_VENDORID, vendorId + "");
|
|
|
532 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_VENDOR_DESC, Utils.getVendorDesc(vendorId));
|
|
|
533 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY, key);
|
|
|
534 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, key);
|
|
|
535 |
|
|
|
536 |
tableVendorItemKey.getCellFormatter().setVisible(row, TABLE_INDEX_MAPPING_VENDORID, false);
|
|
|
537 |
tableVendorItemKey.getCellFormatter().setVisible(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
|
|
538 |
return true;
|
|
|
539 |
}
|
|
|
540 |
});
|
|
|
541 |
vendorMappingDialog.show();
|
|
|
542 |
}
|
|
|
543 |
});
|
|
|
544 |
}
|
|
|
545 |
|
|
|
546 |
/**
|
|
|
547 |
* initialises vendor prices table header. Creates an Add button and
|
|
|
548 |
* adds click event listener to it to create and pop up a dialog for adding
|
|
|
549 |
* a prices for a new vendor
|
|
|
550 |
*/
|
|
|
551 |
private void initVendorPricingHeader(){
|
|
|
552 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
|
|
553 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
|
|
554 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
|
|
555 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
|
|
556 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
|
|
557 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
|
|
558 |
headerVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_BUTTON, BUTTON_WIDTH);
|
|
|
559 |
|
|
|
560 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_VENDORID, "Vendor Id");
|
|
|
561 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_VENDOR_DESC, "Vendor");
|
|
|
562 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_MOP, "MOP");
|
|
|
563 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_DP, "Dealer Price");
|
|
|
564 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_TP, "Transfer Price");
|
|
|
565 |
headerVendorPrices.setText(0, TABLE_INDEX_PRICING_NLC, "NLC");
|
|
|
566 |
|
|
|
567 |
headerVendorPrices.getCellFormatter().setVisible(0, TABLE_INDEX_PRICING_VENDORID, false);
|
|
|
568 |
|
|
|
569 |
Button addButton = new Button("Add");
|
|
|
570 |
headerVendorPrices.setWidget(0, TABLE_INDEX_PRICING_BUTTON, addButton);
|
|
|
571 |
addButton.addClickHandler(new ClickHandler() {
|
|
|
572 |
@Override
|
|
|
573 |
public void onClick(ClickEvent event) {
|
|
|
574 |
VendorPricesDialog vendorPricesDialog = new VendorPricesDialog();
|
|
|
575 |
vendorPricesDialog.updateButton.setText("Add");
|
|
|
576 |
vendorPricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
|
|
|
577 |
@Override
|
|
|
578 |
public boolean onUpdate(double mop, double dp, double tp, double nlc, long vendorId) {
|
|
|
579 |
if(!vendorExists(vendorId)) {
|
|
|
580 |
Window.alert("Vendor already exists");
|
|
|
581 |
return false;
|
|
|
582 |
}
|
|
|
583 |
/*if(!validateVendorPrices(mop, dp, tp)) {
|
| 2105 |
ankur.sing |
584 |
return false;
|
| 2119 |
ankur.sing |
585 |
}*/
|
| 10484 |
vikram.rag |
586 |
int row = tableVendorPrices.getRowCount();
|
|
|
587 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
|
|
588 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
|
|
589 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
|
|
590 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
|
|
591 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
|
|
592 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
| 3558 |
rajveer |
593 |
|
| 10484 |
vikram.rag |
594 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_VENDORID, vendorId + "");
|
|
|
595 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_VENDOR_DESC, Utils.getVendorDesc(vendorId));
|
|
|
596 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_MOP, mop + "");
|
|
|
597 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_DP, dp + "");
|
|
|
598 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_TP, tp + "");
|
|
|
599 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_NLC, nlc + "");
|
| 3558 |
rajveer |
600 |
|
| 10484 |
vikram.rag |
601 |
tableVendorPrices.getCellFormatter().setVisible(row, TABLE_INDEX_PRICING_VENDORID, false);
|
|
|
602 |
return true;
|
|
|
603 |
}
|
|
|
604 |
});
|
|
|
605 |
vendorPricesDialog.show();
|
|
|
606 |
}
|
|
|
607 |
});
|
|
|
608 |
}
|
| 3558 |
rajveer |
609 |
|
| 10484 |
vikram.rag |
610 |
/**
|
|
|
611 |
* initialises source prices table header. Creates an Add button and
|
|
|
612 |
* adds click event listener to it to create and pop up a dialog for adding
|
|
|
613 |
* a prices for a new source
|
|
|
614 |
*/
|
|
|
615 |
private void initSourcePricingHeader(){
|
|
|
616 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
|
|
617 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
|
|
618 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
|
|
619 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
|
|
620 |
headerSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_BUTTON, BUTTON_WIDTH);
|
|
|
621 |
|
|
|
622 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, "Source Id");
|
|
|
623 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, "Source");
|
|
|
624 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_MRP, "MRP");
|
|
|
625 |
headerSourcePrices.setText(0, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, "Selling Price");
|
|
|
626 |
|
|
|
627 |
headerSourcePrices.getCellFormatter().setVisible(0, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
|
|
628 |
|
|
|
629 |
Button addButton = new Button("Add");
|
|
|
630 |
headerSourcePrices.setWidget(0, TABLE_INDEX_SOURCE_PRICING_BUTTON, addButton);
|
|
|
631 |
addButton.addClickHandler(new ClickHandler() {
|
|
|
632 |
@Override
|
|
|
633 |
public void onClick(ClickEvent event) {
|
|
|
634 |
SourcePricesDialog sourcePricesDialog = new SourcePricesDialog(mrp.getText().trim(), sellingPrice.getText().trim());
|
|
|
635 |
//SourcePricesDialog sourcePricesDialog = new SourcePricesDialog();
|
|
|
636 |
sourcePricesDialog.updateButton.setText("Add");
|
|
|
637 |
sourcePricesDialog.setSourcePriceUpdateListener(new SourcePricesDialog.SourcePriceUpdateListener() {
|
| 4423 |
phani.kuma |
638 |
@Override
|
| 10484 |
vikram.rag |
639 |
public boolean onUpdate(double mrp, double sellingPrice, long sourceId) {
|
|
|
640 |
if(!sourceExists(sourceId)) {
|
|
|
641 |
Window.alert("Source already exists");
|
|
|
642 |
return false;
|
|
|
643 |
}
|
|
|
644 |
|
|
|
645 |
int row = tableSourcePrices.getRowCount();
|
|
|
646 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
|
|
647 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
|
|
648 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
|
|
649 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
|
|
650 |
|
|
|
651 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, sourceId + "");
|
|
|
652 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, Utils.getSourceDesc(sourceId));
|
|
|
653 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_MRP, mrp + "");
|
|
|
654 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sellingPrice + "");
|
|
|
655 |
|
|
|
656 |
tableSourcePrices.getCellFormatter().setVisible(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
|
|
657 |
return true;
|
|
|
658 |
}
|
|
|
659 |
});
|
|
|
660 |
sourcePricesDialog.show();
|
|
|
661 |
}
|
|
|
662 |
});
|
|
|
663 |
}
|
|
|
664 |
|
|
|
665 |
/**
|
|
|
666 |
* initialises similar items table header. Creates an Add button and
|
|
|
667 |
* adds click event listener to it to create and pop up a dialog for adding
|
|
|
668 |
* a new similar item.
|
|
|
669 |
*/
|
|
|
670 |
private void initSimilarItemList() {
|
|
|
671 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, PRICE_WIDTH);
|
|
|
672 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, PRICE_WIDTH);
|
|
|
673 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BRAND, PRICE_WIDTH);
|
|
|
674 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, PRICE_WIDTH);
|
|
|
675 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, PRICE_WIDTH);
|
|
|
676 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "150px");
|
|
|
677 |
headerSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BUTTON, BUTTON_WIDTH);
|
|
|
678 |
|
|
|
679 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, "Catalog ItemId");
|
|
|
680 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, "Product Group");
|
|
|
681 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_BRAND, "Brand");
|
|
|
682 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, "Model Number");
|
|
|
683 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, "Model Name");
|
|
|
684 |
headerSimilarItems.setText(0, TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "Category");
|
|
|
685 |
|
|
|
686 |
Button addButton = new Button("Add");
|
|
|
687 |
headerSimilarItems.setWidget(0, TABLE_INDEX_SIMILAR_ITEMS_BUTTON, addButton);
|
|
|
688 |
addButton.addClickHandler(new ClickHandler() {
|
|
|
689 |
@Override
|
|
|
690 |
public void onClick(ClickEvent event) {
|
|
|
691 |
AddSimilarItemDialog addSimilarItemDialog = new AddSimilarItemDialog();
|
|
|
692 |
addSimilarItemDialog.setAddSimilarItemUpdateListener(new AddSimilarItemDialog.AddSimilarItemUpdateListener() {
|
|
|
693 |
@Override
|
| 4423 |
phani.kuma |
694 |
public boolean onUpdate(long catalogItemId) {
|
|
|
695 |
if (item.getSimilarItems().containsKey(catalogItemId)) {
|
|
|
696 |
Window.alert("Similar Item exists.");
|
|
|
697 |
return false;
|
|
|
698 |
}
|
|
|
699 |
else {
|
| 10484 |
vikram.rag |
700 |
catalogService.addSimilarItem(item.getId(), catalogItemId, new AsyncCallback<Item>() {
|
|
|
701 |
@Override
|
|
|
702 |
public void onSuccess(Item similarItem) {
|
|
|
703 |
if(similarItem != null) {
|
|
|
704 |
GWT.log("Similar Item Added");
|
|
|
705 |
Map<Long, Item> newsimilarItems = item.getSimilarItems();
|
|
|
706 |
newsimilarItems.put(similarItem.getCatalogItemId(), similarItem);
|
|
|
707 |
item.setSimilarItems(newsimilarItems);
|
|
|
708 |
updateSimilarItemsTable(item.getSimilarItems());
|
|
|
709 |
Window.alert("Similar Item Added successfully.");
|
|
|
710 |
}
|
|
|
711 |
else {
|
|
|
712 |
GWT.log("Error Adding Similar Item");
|
|
|
713 |
Window.alert("Error Adding Similar Item");
|
|
|
714 |
}
|
|
|
715 |
}
|
|
|
716 |
@Override
|
|
|
717 |
public void onFailure(Throwable caught) {
|
|
|
718 |
caught.printStackTrace();
|
|
|
719 |
Window.alert("Error deleting Similar Item");
|
|
|
720 |
}
|
|
|
721 |
});
|
|
|
722 |
return true;
|
| 4423 |
phani.kuma |
723 |
}
|
|
|
724 |
}
|
|
|
725 |
});
|
| 10484 |
vikram.rag |
726 |
addSimilarItemDialog.show();
|
|
|
727 |
}
|
|
|
728 |
});
|
|
|
729 |
}
|
|
|
730 |
private void initVatDetailsHeader(){
|
|
|
731 |
headerVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_NAME, "80px");
|
|
|
732 |
headerVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_TAX_PERCENTAGE, "50px");
|
|
|
733 |
headerVatDetails.setText(0, TABLE_INDEX_STATE_NAME, "State Name");
|
|
|
734 |
headerVatDetails.setText(0, TABLE_INDEX_STATE_TAX_PERCENTAGE, "Tax Percentage");
|
|
|
735 |
|
|
|
736 |
}
|
|
|
737 |
private void updateVatDetailsTable(Map<String,String> stateVatPercentage){
|
|
|
738 |
tableVatDetails.removeAllRows();
|
|
|
739 |
if(stateVatPercentage == null || stateVatPercentage.isEmpty()) {
|
|
|
740 |
return;
|
|
|
741 |
}
|
|
|
742 |
tableVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_NAME, "80px");
|
|
|
743 |
tableVatDetails.getColumnFormatter().setWidth(TABLE_INDEX_STATE_TAX_PERCENTAGE, "50px");
|
|
|
744 |
int i=0;
|
|
|
745 |
for(Entry<String,String> e : stateVatPercentage.entrySet()){
|
|
|
746 |
tableVatDetails.setText(i, TABLE_INDEX_STATE_NAME, e.getKey() +"");
|
|
|
747 |
if(e.getValue().equals("-1.0")){
|
|
|
748 |
tableVatDetails.setText(i, TABLE_INDEX_STATE_TAX_PERCENTAGE, "N.A" + "");
|
|
|
749 |
}
|
|
|
750 |
else{
|
|
|
751 |
tableVatDetails.setText(i, TABLE_INDEX_STATE_TAX_PERCENTAGE, e.getValue()+" %" + "");
|
|
|
752 |
}
|
|
|
753 |
i++;
|
|
|
754 |
}
|
|
|
755 |
}
|
|
|
756 |
private void initIgnoredWarehouseHeader(){
|
|
|
757 |
headerIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_NAME, "100px");
|
|
|
758 |
headerIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, BUTTON_WIDTH);
|
|
|
759 |
headerIgnoredWarehouse.setText(0, TABLE_INDEX_WAREHOUSE_NAME, "Warehouse Desc");
|
|
|
760 |
Button addButton = new Button("Add");
|
|
|
761 |
headerIgnoredWarehouse.setWidget(0,TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON,addButton);
|
|
|
762 |
addButton.addClickHandler(new ClickHandler() {
|
|
|
763 |
@Override
|
|
|
764 |
public void onClick(ClickEvent event) {
|
|
|
765 |
DeactivateWarehouseDialog deactivateWarehouseDialog = new DeactivateWarehouseDialog(new ArrayList<Long>(item.getVendorPricesMap().keySet()));
|
|
|
766 |
deactivateWarehouseDialog.updateButton.setText("Add");
|
|
|
767 |
deactivateWarehouseDialog.setDeactivateWarehouseListener(new DeactivateWarehouseDialog.DeactivateWarehouseListener(){
|
| 6530 |
vikram.rag |
768 |
@Override
|
|
|
769 |
public boolean onUpdate(final long warehouseId) {
|
| 10484 |
vikram.rag |
770 |
if(Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().contains(new ItemWarehouse(item.getId(),warehouseId))) {
|
|
|
771 |
Window.alert("Warehouse already deactivated");
|
|
|
772 |
return false;
|
|
|
773 |
}
|
|
|
774 |
catalogService.addtoIgnoredInventoryUpdateItemsIdsWarehouseIds(item.getId(),warehouseId,new AsyncCallback<Boolean>() {
|
|
|
775 |
@Override
|
|
|
776 |
public void onSuccess(Boolean result) {
|
|
|
777 |
if(result) {
|
|
|
778 |
Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().add(new ItemWarehouse(item.getId(),warehouseId));
|
|
|
779 |
int index1 = tableIgnoredWarehouse.insertRow(0);
|
|
|
780 |
addRowToIgnoredWarehouseTable(index1, warehouseId, Utils.getAllWarehouses().get(warehouseId));
|
| 4423 |
phani.kuma |
781 |
|
| 10484 |
vikram.rag |
782 |
Window.alert("Warehouse deactivated successfully");
|
|
|
783 |
}
|
|
|
784 |
else {
|
|
|
785 |
GWT.log("Error Deactivating warehouse");
|
|
|
786 |
Window.alert("Error Deactivating warehouse");
|
|
|
787 |
}
|
|
|
788 |
}
|
|
|
789 |
@Override
|
|
|
790 |
public void onFailure(Throwable caught) {
|
|
|
791 |
caught.printStackTrace();
|
|
|
792 |
Window.alert("Error Deactivating warehouse");
|
|
|
793 |
}
|
|
|
794 |
});
|
|
|
795 |
return true;
|
|
|
796 |
}
|
|
|
797 |
});
|
|
|
798 |
deactivateWarehouseDialog.show();
|
|
|
799 |
}
|
|
|
800 |
});
|
|
|
801 |
}
|
| 5504 |
phani.kuma |
802 |
|
| 2066 |
ankur.sing |
803 |
|
| 10484 |
vikram.rag |
804 |
private void initVoucherHeader(){
|
|
|
805 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_TYPE, ITEM_KEY_WIDTH);
|
|
|
806 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_AMOUNT, VENDOR_DESC_WIDTH);
|
|
|
807 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, BUTTON_WIDTH);
|
|
|
808 |
headerVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_DEL_BUTTON, BUTTON_WIDTH);
|
| 4423 |
phani.kuma |
809 |
|
| 10484 |
vikram.rag |
810 |
headerVouchers.setText(0, TABLE_INDEX_VOUCHERS_TYPE, "Voucher Type");
|
|
|
811 |
headerVouchers.setText(0, TABLE_INDEX_VOUCHERS_AMOUNT, "Voucher Amount");
|
|
|
812 |
headerVouchers.getCellFormatter().setVisible(0, TABLE_INDEX_VOUCHERS_DEL_BUTTON, false);
|
|
|
813 |
Button addButton = new Button("Add");
|
|
|
814 |
headerVouchers.setWidget(0, TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, addButton);
|
|
|
815 |
addButton.addClickHandler(new ClickHandler() {
|
|
|
816 |
@Override
|
|
|
817 |
public void onClick(ClickEvent event) {
|
|
|
818 |
VoucherItemDialog voucherItemDialog = new VoucherItemDialog();
|
|
|
819 |
voucherItemDialog.updateButton.setText("Add");
|
|
|
820 |
voucherItemDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
|
|
821 |
@Override
|
|
|
822 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
|
|
823 |
if(!voucherExists(voucherType)) {
|
|
|
824 |
Window.alert("Voucher already exists");
|
|
|
825 |
return false;
|
|
|
826 |
}
|
|
|
827 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);;
|
|
|
828 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
|
|
829 |
@Override
|
|
|
830 |
public void onSuccess(Boolean result) {
|
|
|
831 |
if(result) {
|
|
|
832 |
GWT.log("Voucher Added");
|
|
|
833 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
|
|
834 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
|
|
835 |
newvouchersMap.put(voucherType, newvoucher);
|
|
|
836 |
item.setVouchersMap(newvouchersMap);
|
|
|
837 |
updateVoucherTable(item.getVouchersMap());
|
|
|
838 |
Window.alert("Voucher Added successfully.");
|
|
|
839 |
}
|
|
|
840 |
else {
|
|
|
841 |
GWT.log("Error Adding Voucher");
|
|
|
842 |
Window.alert("Error Adding Voucher");
|
|
|
843 |
}
|
|
|
844 |
}
|
|
|
845 |
@Override
|
|
|
846 |
public void onFailure(Throwable caught) {
|
|
|
847 |
caught.printStackTrace();
|
|
|
848 |
Window.alert("Error deleting voucher");
|
|
|
849 |
}
|
|
|
850 |
});
|
|
|
851 |
return true;
|
|
|
852 |
}
|
|
|
853 |
});
|
|
|
854 |
voucherItemDialog.show();
|
|
|
855 |
}
|
|
|
856 |
});
|
|
|
857 |
}
|
| 2066 |
ankur.sing |
858 |
|
| 10484 |
vikram.rag |
859 |
/**
|
|
|
860 |
* Clear and populate item availability table.
|
|
|
861 |
* @param availabilityMap
|
|
|
862 |
*/
|
| 2119 |
ankur.sing |
863 |
|
| 10484 |
vikram.rag |
864 |
private void updateAvailabilityTable(Map<Long, ItemInventory> itemInventoryMap){
|
|
|
865 |
availabilityTable.removeAllRows();
|
|
|
866 |
if(itemInventoryMap == null || itemInventoryMap.isEmpty()) {
|
|
|
867 |
return;
|
|
|
868 |
}
|
|
|
869 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ID, "100px");
|
|
|
870 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_DESC, "300px");
|
|
|
871 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVA, "100px");
|
|
|
872 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_INVR, "100px");
|
|
|
873 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HELD, "100px");
|
|
|
874 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_EBAY_HELD, "80px");
|
|
|
875 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, "80px");
|
|
|
876 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, "80px");
|
| 13748 |
manish.sha |
877 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_HOMESHOP18_HELD, "80px");
|
| 10484 |
vikram.rag |
878 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_GET_BUTTON, "100px");
|
|
|
879 |
availabilityTable.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_UPDATE_BUTTON, "100px");
|
| 2066 |
ankur.sing |
880 |
|
| 10484 |
vikram.rag |
881 |
int i=0;
|
|
|
882 |
for(ItemInventory warehousedata : itemInventoryMap.values()){
|
|
|
883 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_ID, warehousedata.getWarehouseId() + "");
|
|
|
884 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_DESC, Utils.getWarehouseDesc(warehousedata.getWarehouseId()) + "");
|
|
|
885 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_INVA, warehousedata.getAvailability() + "");
|
|
|
886 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_INVR, warehousedata.getReserved() + "");
|
|
|
887 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_HELD, warehousedata.getHeld() + "");
|
|
|
888 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_EBAY_HELD, warehousedata.getEbayHeld() + "");
|
|
|
889 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_SNAPDEAL_HELD, warehousedata.getSnapdealHeld() + "");
|
|
|
890 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_FLIPKART_HELD, warehousedata.getFlipkartHeld() + "");
|
| 13748 |
manish.sha |
891 |
availabilityTable.setText(i, TABLE_INDEX_WAREHOUSE_HOMESHOP18_HELD, warehousedata.getHomeshop18Held() + "");
|
| 2066 |
ankur.sing |
892 |
|
| 10484 |
vikram.rag |
893 |
i++;
|
|
|
894 |
}
|
|
|
895 |
}
|
| 2066 |
ankur.sing |
896 |
|
| 10484 |
vikram.rag |
897 |
/**
|
|
|
898 |
* Clear and populate vendor item key table with keys in the passed argument.
|
|
|
899 |
* With each row in the table, an edit button is created and click event listener
|
|
|
900 |
* is added to it to edit that vendor item key row.
|
|
|
901 |
* @param vendorKeysMap
|
|
|
902 |
*/
|
|
|
903 |
private void updateVendorKeysTable(Map<String, VendorItemMapping> vendorKeysMap){
|
|
|
904 |
tableVendorItemKey.removeAllRows();
|
| 3558 |
rajveer |
905 |
|
| 10484 |
vikram.rag |
906 |
if(vendorKeysMap == null || vendorKeysMap.isEmpty()) {
|
|
|
907 |
return;
|
|
|
908 |
}
|
|
|
909 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDORID, VENDOR_ID_WIDTH);
|
|
|
910 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
|
|
911 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY, ITEM_KEY_WIDTH);
|
|
|
912 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_ITEM_KEY_OLD, ITEM_KEY_WIDTH);
|
|
|
913 |
tableVendorItemKey.getColumnFormatter().setWidth(TABLE_INDEX_MAPPING_BUTTON, BUTTON_WIDTH);
|
| 4423 |
phani.kuma |
914 |
|
| 10484 |
vikram.rag |
915 |
int i=0;
|
|
|
916 |
for(Entry<String, VendorItemMapping> e : vendorKeysMap.entrySet()){
|
|
|
917 |
VendorItemMapping vendorMapping = e.getValue();
|
|
|
918 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_VENDORID, vendorMapping.getVendorId() + "");
|
|
|
919 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_VENDOR_DESC, Utils.getVendorDesc(vendorMapping.getVendorId()));
|
|
|
920 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_ITEM_KEY, vendorMapping.getItemKey());
|
|
|
921 |
tableVendorItemKey.setText(i, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, e.getKey().substring(e.getKey().indexOf(Item.KEY_SEPARATOR)+1));
|
|
|
922 |
Button editButton = new Button("Edit");
|
|
|
923 |
tableVendorItemKey.setWidget(i, TABLE_INDEX_MAPPING_BUTTON, editButton);
|
|
|
924 |
editButton.addClickHandler(new ClickHandler() {
|
|
|
925 |
@Override
|
|
|
926 |
public void onClick(ClickEvent event) {
|
|
|
927 |
Cell cell = tableVendorItemKey.getCellForEvent(event);
|
|
|
928 |
int row = cell.getRowIndex();
|
|
|
929 |
long vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
|
|
930 |
editVendorKey(vendorId, row);
|
|
|
931 |
}
|
|
|
932 |
});
|
|
|
933 |
tableVendorItemKey.getCellFormatter().setVisible(i, TABLE_INDEX_MAPPING_VENDORID, false);
|
|
|
934 |
tableVendorItemKey.getCellFormatter().setVisible(i, TABLE_INDEX_MAPPING_ITEM_KEY_OLD, false);
|
|
|
935 |
i++;
|
|
|
936 |
}
|
|
|
937 |
}
|
| 4423 |
phani.kuma |
938 |
|
| 10484 |
vikram.rag |
939 |
/**
|
|
|
940 |
* Clear and populate vendor prices table with prices in the passed argument.
|
|
|
941 |
* With each row in the table, an edit button is created and click event listener
|
|
|
942 |
* is added to it to edit that vendor prices row.
|
|
|
943 |
* @param vendorPricingMap
|
|
|
944 |
*/
|
|
|
945 |
private void updateVendorPricingTable(Map<Long, VendorPricings> vendorPricingMap){
|
|
|
946 |
tableVendorPrices.removeAllRows();
|
| 4423 |
phani.kuma |
947 |
|
| 10484 |
vikram.rag |
948 |
if(vendorPricingMap == null || vendorPricingMap.isEmpty()) {
|
|
|
949 |
return;
|
|
|
950 |
}
|
|
|
951 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDORID, VENDOR_ID_WIDTH);
|
|
|
952 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_VENDOR_DESC, VENDOR_DESC_WIDTH);
|
|
|
953 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_MOP, PRICE_WIDTH);
|
|
|
954 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_DP, PRICE_WIDTH);
|
|
|
955 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_TP, PRICE_WIDTH);
|
|
|
956 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_NLC, PRICE_WIDTH);
|
|
|
957 |
tableVendorPrices.getColumnFormatter().setWidth(TABLE_INDEX_PRICING_BUTTON, BUTTON_WIDTH);
|
| 5504 |
phani.kuma |
958 |
|
|
|
959 |
|
| 10484 |
vikram.rag |
960 |
int i=0;
|
|
|
961 |
for(VendorPricings vendorDetail : vendorPricingMap.values()){
|
|
|
962 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_VENDORID, vendorDetail.getVendorId() + "");
|
|
|
963 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_VENDOR_DESC, Utils.getVendorDesc(vendorDetail.getVendorId()));
|
|
|
964 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_MOP, vendorDetail.getMop() + "");
|
|
|
965 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_DP, vendorDetail.getDealerPrice() + "");
|
|
|
966 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_TP, vendorDetail.getTransferPrice() + "");
|
|
|
967 |
tableVendorPrices.setText(i, TABLE_INDEX_PRICING_NLC, vendorDetail.getNlc() + "");
|
|
|
968 |
Button editButton = new Button("Edit");
|
|
|
969 |
tableVendorPrices.setWidget(i, TABLE_INDEX_PRICING_BUTTON, editButton);
|
|
|
970 |
editButton.addClickHandler(new ClickHandler() {
|
|
|
971 |
@Override
|
|
|
972 |
public void onClick(ClickEvent event) {
|
|
|
973 |
Cell cell = tableVendorPrices.getCellForEvent(event);
|
|
|
974 |
int row = cell.getRowIndex();
|
|
|
975 |
long vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
|
|
976 |
editVendorPrices(vendorId, row);
|
|
|
977 |
}
|
|
|
978 |
});
|
|
|
979 |
tableVendorPrices.getCellFormatter().setVisible(i, TABLE_INDEX_PRICING_VENDORID, false);
|
|
|
980 |
i++;
|
|
|
981 |
}
|
| 6532 |
amit.gupta |
982 |
}
|
|
|
983 |
|
|
|
984 |
/**
|
| 10484 |
vikram.rag |
985 |
* Clear and populate vendor prices table with prices in the passed argument.
|
|
|
986 |
* With each row in the table, an edit button is created and click event listener
|
|
|
987 |
* is added to it to edit that vendor prices row.
|
|
|
988 |
* @param sourcePricingMap
|
|
|
989 |
*/
|
|
|
990 |
private void updateSourcePricingTable(Map<Long, SourcePricings> sourcePricingMap){
|
|
|
991 |
tableSourcePrices.removeAllRows();
|
|
|
992 |
|
|
|
993 |
if(sourcePricingMap == null || sourcePricingMap.isEmpty()) {
|
|
|
994 |
return;
|
|
|
995 |
}
|
|
|
996 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, VENDOR_ID_WIDTH);
|
|
|
997 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, VENDOR_DESC_WIDTH);
|
|
|
998 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_MRP, PRICE_WIDTH);
|
|
|
999 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, PRICE_WIDTH);
|
|
|
1000 |
tableSourcePrices.getColumnFormatter().setWidth(TABLE_INDEX_SOURCE_PRICING_BUTTON, BUTTON_WIDTH);
|
|
|
1001 |
|
|
|
1002 |
int i=0;
|
|
|
1003 |
for(SourcePricings sourceDetail : sourcePricingMap.values()){
|
|
|
1004 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, sourceDetail.getSourceId() + "");
|
|
|
1005 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_DESC, Utils.getSourceDesc(sourceDetail.getSourceId()));
|
|
|
1006 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_MRP, sourceDetail.getMrp() + "");
|
|
|
1007 |
tableSourcePrices.setText(i, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sourceDetail.getSellingPrice() + "");
|
|
|
1008 |
|
|
|
1009 |
Button editButton = new Button("Edit");
|
|
|
1010 |
tableSourcePrices.setWidget(i, TABLE_INDEX_SOURCE_PRICING_BUTTON, editButton);
|
|
|
1011 |
editButton.addClickHandler(new ClickHandler() {
|
|
|
1012 |
@Override
|
|
|
1013 |
public void onClick(ClickEvent event) {
|
|
|
1014 |
Cell cell = tableSourcePrices.getCellForEvent(event);
|
|
|
1015 |
int row = cell.getRowIndex();
|
|
|
1016 |
long sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
|
|
1017 |
editSourcePrices(sourceId, row);
|
|
|
1018 |
}
|
|
|
1019 |
});
|
|
|
1020 |
tableSourcePrices.getCellFormatter().setVisible(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID, false);
|
|
|
1021 |
i++;
|
|
|
1022 |
}
|
|
|
1023 |
}
|
|
|
1024 |
|
|
|
1025 |
/**
|
|
|
1026 |
* Clear and populate similar items table with items in the passed argument.
|
|
|
1027 |
* With each row in the table, an delete button is created and click event listener
|
|
|
1028 |
* is added to it to delete that similar item row.
|
|
|
1029 |
* @param similarItems
|
|
|
1030 |
*/
|
|
|
1031 |
private void updateSimilarItemsTable(Map<Long, Item> similarItems){
|
|
|
1032 |
tableSimilarItems.removeAllRows();
|
|
|
1033 |
|
|
|
1034 |
if(similarItems == null || similarItems.isEmpty()) {
|
|
|
1035 |
return;
|
|
|
1036 |
}
|
|
|
1037 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, PRICE_WIDTH);
|
|
|
1038 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, PRICE_WIDTH);
|
|
|
1039 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BRAND, PRICE_WIDTH);
|
|
|
1040 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, PRICE_WIDTH);
|
|
|
1041 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, PRICE_WIDTH);
|
|
|
1042 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, "150px");
|
|
|
1043 |
tableSimilarItems.getColumnFormatter().setWidth(TABLE_INDEX_SIMILAR_ITEMS_BUTTON, BUTTON_WIDTH);
|
|
|
1044 |
|
|
|
1045 |
|
|
|
1046 |
int i=0;
|
|
|
1047 |
for(Item similarItemDetail : similarItems.values()){
|
|
|
1048 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID, similarItemDetail.getCatalogItemId() + "");
|
|
|
1049 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_PRODUCT_GROUP, similarItemDetail.getProductGroup() + "");
|
|
|
1050 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_BRAND, similarItemDetail.getBrand() + "");
|
|
|
1051 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER, similarItemDetail.getModelNumber() + "");
|
|
|
1052 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME, similarItemDetail.getModelName() + "");
|
|
|
1053 |
tableSimilarItems.setText(i, TABLE_INDEX_SIMILAR_ITEMS_CATEGORY, similarItemDetail.getContentCategory() + "");
|
|
|
1054 |
|
|
|
1055 |
Button deleteButton = new Button("Delete");
|
|
|
1056 |
tableSimilarItems.setWidget(i, TABLE_INDEX_SIMILAR_ITEMS_BUTTON, deleteButton);
|
|
|
1057 |
deleteButton.addClickHandler(new ClickHandler() {
|
|
|
1058 |
@Override
|
|
|
1059 |
public void onClick(ClickEvent event) {
|
|
|
1060 |
Cell cell = tableSimilarItems.getCellForEvent(event);
|
|
|
1061 |
final int row = cell.getRowIndex();
|
|
|
1062 |
long catalogItemId = Long.parseLong(tableSimilarItems.getText(row, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID));
|
|
|
1063 |
|
|
|
1064 |
catalogService.deleteSimilarItem(item.getId(), catalogItemId, new AsyncCallback<Boolean>() {
|
|
|
1065 |
@Override
|
|
|
1066 |
public void onSuccess(Boolean result) {
|
|
|
1067 |
if(result) {
|
|
|
1068 |
GWT.log("Similar Item deleted");
|
|
|
1069 |
long catalogItemId = Long.parseLong(tableSimilarItems.getText(row, TABLE_INDEX_SIMILAR_ITEMS_CATALOG_ITEM_ID));
|
|
|
1070 |
tableSimilarItems.removeRow(row);
|
|
|
1071 |
Map<Long, Item> newsimilarItems = item.getSimilarItems();
|
|
|
1072 |
newsimilarItems.remove(catalogItemId);
|
|
|
1073 |
item.setSimilarItems(newsimilarItems);
|
|
|
1074 |
}
|
|
|
1075 |
else {
|
|
|
1076 |
GWT.log("Error deleting Similar Item");
|
|
|
1077 |
Window.alert("Error deleting Similar Item");
|
|
|
1078 |
}
|
|
|
1079 |
}
|
|
|
1080 |
@Override
|
|
|
1081 |
public void onFailure(Throwable caught) {
|
|
|
1082 |
caught.printStackTrace();
|
|
|
1083 |
Window.alert("Error deleting Similar Item");
|
|
|
1084 |
}
|
|
|
1085 |
});
|
|
|
1086 |
}
|
|
|
1087 |
});
|
|
|
1088 |
i++;
|
|
|
1089 |
}
|
|
|
1090 |
}
|
|
|
1091 |
|
|
|
1092 |
private void updateVoucherTable(Map<String, VoucherItemMapping> vouchersMap){
|
|
|
1093 |
tableVouchers.removeAllRows();
|
|
|
1094 |
|
|
|
1095 |
if(vouchersMap == null || vouchersMap.isEmpty()) {
|
|
|
1096 |
return;
|
|
|
1097 |
}
|
|
|
1098 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_TYPE, ITEM_KEY_WIDTH);
|
|
|
1099 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_AMOUNT, VENDOR_DESC_WIDTH);
|
|
|
1100 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, BUTTON_WIDTH);
|
|
|
1101 |
tableVouchers.getColumnFormatter().setWidth(TABLE_INDEX_VOUCHERS_DEL_BUTTON, BUTTON_WIDTH);
|
|
|
1102 |
|
|
|
1103 |
int i=0;
|
|
|
1104 |
for(VoucherItemMapping voucher : vouchersMap.values()){
|
|
|
1105 |
tableVouchers.setText(i, TABLE_INDEX_VOUCHERS_TYPE, voucher.getVoucherType());
|
|
|
1106 |
tableVouchers.setText(i, TABLE_INDEX_VOUCHERS_AMOUNT, voucher.getAmount() + "");
|
|
|
1107 |
|
|
|
1108 |
Button editButton = new Button("Edit");
|
|
|
1109 |
tableVouchers.setWidget(i, TABLE_INDEX_VOUCHERS_ADD_EDIT_BUTTON, editButton);
|
|
|
1110 |
editButton.addClickHandler(new ClickHandler() {
|
|
|
1111 |
@Override
|
|
|
1112 |
public void onClick(ClickEvent event) {
|
|
|
1113 |
Cell cell = tableVouchers.getCellForEvent(event);
|
|
|
1114 |
final int row = cell.getRowIndex();
|
|
|
1115 |
String voucherAmount = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_AMOUNT);
|
|
|
1116 |
VoucherItemDialog voucherDialog = new VoucherItemDialog(voucherAmount);
|
|
|
1117 |
voucherDialog.updateButton.setText("Update");
|
|
|
1118 |
voucherDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
|
|
1119 |
@Override
|
|
|
1120 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
|
|
1121 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
|
|
1122 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
|
|
1123 |
@Override
|
|
|
1124 |
public void onSuccess(Boolean result) {
|
|
|
1125 |
if(result) {
|
|
|
1126 |
GWT.log("Voucher Updated");
|
|
|
1127 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
|
|
1128 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
|
|
1129 |
newvouchersMap.remove(voucherType);
|
|
|
1130 |
newvouchersMap.put(voucherType, newvoucher);
|
|
|
1131 |
item.setVouchersMap(newvouchersMap);
|
|
|
1132 |
updateVoucherTable(item.getVouchersMap());
|
|
|
1133 |
Window.alert("Voucher Updated successfully.");
|
|
|
1134 |
}
|
|
|
1135 |
else {
|
|
|
1136 |
GWT.log("Error Updating Voucher");
|
|
|
1137 |
Window.alert("Error Updating Voucher");
|
|
|
1138 |
}
|
|
|
1139 |
}
|
|
|
1140 |
@Override
|
|
|
1141 |
public void onFailure(Throwable caught) {
|
|
|
1142 |
caught.printStackTrace();
|
|
|
1143 |
Window.alert("Error Updating voucher");
|
|
|
1144 |
}
|
|
|
1145 |
});
|
|
|
1146 |
return true;
|
|
|
1147 |
}
|
|
|
1148 |
});
|
|
|
1149 |
voucherDialog.show();
|
|
|
1150 |
}
|
|
|
1151 |
});
|
|
|
1152 |
|
|
|
1153 |
Button deleteButton = new Button("Delete");
|
|
|
1154 |
tableVouchers.setWidget(i, TABLE_INDEX_VOUCHERS_DEL_BUTTON, deleteButton);
|
|
|
1155 |
deleteButton.addClickHandler(new ClickHandler() {
|
|
|
1156 |
@Override
|
|
|
1157 |
public void onClick(ClickEvent event) {
|
|
|
1158 |
Cell cell = tableVouchers.getCellForEvent(event);
|
|
|
1159 |
final int row = cell.getRowIndex();
|
|
|
1160 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
|
|
1161 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
|
|
1162 |
catalogService.deleteVoucher(item.getCatalogItemId(), voucherTypeValue, new AsyncCallback<Boolean>() {
|
|
|
1163 |
@Override
|
|
|
1164 |
public void onSuccess(Boolean result) {
|
|
|
1165 |
if(result) {
|
|
|
1166 |
GWT.log("Voucher deleted");
|
|
|
1167 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
|
|
1168 |
tableVouchers.removeRow(row);
|
|
|
1169 |
Map<String, VoucherItemMapping> newvouchersMap = item.getVouchersMap();
|
|
|
1170 |
newvouchersMap.remove(voucherType);
|
|
|
1171 |
item.setVouchersMap(newvouchersMap);
|
|
|
1172 |
}
|
|
|
1173 |
else {
|
|
|
1174 |
GWT.log("Error deleting Voucher");
|
|
|
1175 |
Window.alert("Error deleting Voucher");
|
|
|
1176 |
}
|
|
|
1177 |
}
|
|
|
1178 |
@Override
|
|
|
1179 |
public void onFailure(Throwable caught) {
|
|
|
1180 |
caught.printStackTrace();
|
|
|
1181 |
Window.alert("Error deleting Voucher");
|
|
|
1182 |
}
|
|
|
1183 |
});
|
|
|
1184 |
}
|
|
|
1185 |
});
|
|
|
1186 |
i++;
|
|
|
1187 |
}
|
|
|
1188 |
}
|
|
|
1189 |
private void updateTableIgnoredWarehouse(){
|
|
|
1190 |
tableIgnoredWarehouse.removeAllRows();
|
|
|
1191 |
List<ItemWarehouse> itemWarehouses = Utils.getignoredInventoryUpdateItemsIdsWarehouseIds();
|
|
|
1192 |
Map<Long,String> ignoredWarehouses = new HashMap<Long, String>();
|
|
|
1193 |
for(ItemWarehouse itemWarehouse:itemWarehouses){
|
|
|
1194 |
if(itemWarehouse.getItemId()==item.getId()){
|
|
|
1195 |
ignoredWarehouses.put(itemWarehouse.getWarehouseId(),Utils.getAllWarehouses().get(itemWarehouse.getWarehouseId()));
|
|
|
1196 |
}
|
|
|
1197 |
|
|
|
1198 |
}
|
|
|
1199 |
tableIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_NAME, "100px");
|
|
|
1200 |
tableIgnoredWarehouse.getColumnFormatter().setWidth(TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, BUTTON_WIDTH);
|
|
|
1201 |
|
|
|
1202 |
int i=0;
|
|
|
1203 |
for(final Map.Entry<Long,String> entry : ignoredWarehouses.entrySet()){
|
|
|
1204 |
addRowToIgnoredWarehouseTable(i, entry.getKey(), entry.getValue());
|
|
|
1205 |
i++;
|
|
|
1206 |
}
|
|
|
1207 |
}
|
|
|
1208 |
|
|
|
1209 |
private void addRowToIgnoredWarehouseTable(int i, final Long whId, final String whName) {
|
|
|
1210 |
tableIgnoredWarehouse.setText(i,TABLE_INDEX_WAREHOUSE_NAME,whName);
|
|
|
1211 |
Button deleteButton = new Button("Delete");
|
|
|
1212 |
tableIgnoredWarehouse.setWidget(i, TABLE_INDEX_WAREHOUSE_ADD_DEL_BUTTON, deleteButton);
|
|
|
1213 |
deleteButton.addClickHandler(new ClickHandler() {
|
|
|
1214 |
@Override
|
|
|
1215 |
public void onClick(ClickEvent event) {
|
|
|
1216 |
Cell cell = tableIgnoredWarehouse.getCellForEvent(event);
|
|
|
1217 |
final int row = cell.getRowIndex();
|
|
|
1218 |
catalogService.deleteFromIgnoredInventoryUpdateItemsIdsWarehouseIds(item.getId(),whId, new AsyncCallback<Boolean>() {
|
|
|
1219 |
@Override
|
|
|
1220 |
public void onSuccess(Boolean result) {
|
|
|
1221 |
if(result) {
|
|
|
1222 |
GWT.log("Warehouse will now be in sync");
|
|
|
1223 |
tableIgnoredWarehouse.removeRow(row);
|
|
|
1224 |
Window.alert("Warehouse deleted from list ");
|
|
|
1225 |
Utils.getignoredInventoryUpdateItemsIdsWarehouseIds().remove(new ItemWarehouse(item.getId(),whId));
|
|
|
1226 |
}
|
|
|
1227 |
else {
|
|
|
1228 |
GWT.log("Error deleting Warehouse");
|
|
|
1229 |
Window.alert("Error deleting Warehouse");
|
|
|
1230 |
}
|
|
|
1231 |
}
|
|
|
1232 |
@Override
|
|
|
1233 |
public void onFailure(Throwable caught) {
|
|
|
1234 |
caught.printStackTrace();
|
|
|
1235 |
Window.alert("Error deleting Warehouse");
|
|
|
1236 |
}
|
|
|
1237 |
});
|
|
|
1238 |
}
|
|
|
1239 |
});
|
|
|
1240 |
|
|
|
1241 |
}
|
|
|
1242 |
|
|
|
1243 |
/**
|
|
|
1244 |
* called on the click event of update item button in ItemActions
|
|
|
1245 |
*/
|
|
|
1246 |
void updateItem() {
|
|
|
1247 |
if(item == null) {
|
|
|
1248 |
Window.alert("Please select an item to update.");
|
|
|
1249 |
return;
|
|
|
1250 |
}
|
|
|
1251 |
try {
|
|
|
1252 |
if(!createNewItem()) {
|
|
|
1253 |
return;
|
|
|
1254 |
}
|
|
|
1255 |
} catch(NumberFormatException ex) {
|
|
|
1256 |
ex.printStackTrace();
|
|
|
1257 |
GWT.log("Number format exception");
|
|
|
1258 |
}
|
|
|
1259 |
String paramsChanged = isItemChanged();
|
|
|
1260 |
if(paramsChanged.equals("")) {
|
|
|
1261 |
Window.alert("Nothing to update. Please change intended item parameters and try again.");
|
|
|
1262 |
return;
|
|
|
1263 |
} else {
|
|
|
1264 |
if(item.getSameItemsWithDifferentColors().size()>0 && optionalChangedValMap.size()>0 ){
|
|
|
1265 |
createDialog(paramsChanged);
|
|
|
1266 |
} else {
|
|
|
1267 |
String paramsChanged1 = "";
|
|
|
1268 |
paramsChanged1 = "You have changed following items.\n" + paramsChanged;
|
|
|
1269 |
Window.alert(paramsChanged1);
|
|
|
1270 |
validateNUpdate();
|
|
|
1271 |
}
|
|
|
1272 |
if("\n-Expected Delay".equals(paramsChanged) || "\n-Has Serial Number Flag".equals(paramsChanged)){
|
|
|
1273 |
catalogService.updateExpectedDelayOnProd(newItem, new AsyncCallback<String>() {
|
|
|
1274 |
@Override
|
|
|
1275 |
public void onSuccess(String result) {
|
|
|
1276 |
Window.alert(result);
|
|
|
1277 |
}
|
|
|
1278 |
@Override
|
|
|
1279 |
public void onFailure(Throwable caught) {
|
|
|
1280 |
Window.alert("Error while updating item on production");
|
|
|
1281 |
}
|
|
|
1282 |
});
|
|
|
1283 |
}
|
|
|
1284 |
}
|
|
|
1285 |
}
|
|
|
1286 |
|
|
|
1287 |
|
|
|
1288 |
private void validateNUpdate() {
|
|
|
1289 |
if(!Utils.validateItem(newItem)) {
|
|
|
1290 |
return;
|
|
|
1291 |
}
|
|
|
1292 |
|
|
|
1293 |
final String[] messageList = new String[2];
|
|
|
1294 |
|
|
|
1295 |
String sellingpricemessage = compareSellingPricewithBreakEven();
|
|
|
1296 |
if(sellingpricemessage.equals("false")) {
|
|
|
1297 |
return;
|
|
|
1298 |
}
|
|
|
1299 |
else if(!sellingpricemessage.equals("true")) {
|
|
|
1300 |
messageList[0] = sellingpricemessage;
|
|
|
1301 |
}
|
|
|
1302 |
|
|
|
1303 |
String preferredvendormessage = checkTransferPriceforPreferredVendor();
|
|
|
1304 |
if(preferredvendormessage.equals("false")) {
|
|
|
1305 |
return;
|
|
|
1306 |
}
|
|
|
1307 |
else if(!preferredvendormessage.equals("true")) {
|
|
|
1308 |
messageList[1] = preferredvendormessage;
|
|
|
1309 |
}
|
|
|
1310 |
|
|
|
1311 |
/*if(!validatePrices()) {
|
| 2126 |
ankur.sing |
1312 |
return;
|
|
|
1313 |
}*/
|
| 10484 |
vikram.rag |
1314 |
catalogService.updateItem(newItem, new AsyncCallback<Boolean>() {
|
|
|
1315 |
@Override
|
|
|
1316 |
public void onSuccess(Boolean result) {
|
|
|
1317 |
if(result) {
|
|
|
1318 |
for(int i = 0; i < messageList.length; i++) {
|
|
|
1319 |
if(messageList[i] != null) {
|
|
|
1320 |
logAuthorization(messageList[i]);
|
|
|
1321 |
}
|
|
|
1322 |
}
|
|
|
1323 |
if(optionalChangedValMap.size()>0 || mandatoryChangedValMap.size()>0){
|
|
|
1324 |
for(Long itemId : item.getSameItemsWithDifferentColors()){
|
|
|
1325 |
updateItem(itemId);
|
|
|
1326 |
}
|
|
|
1327 |
}
|
|
|
1328 |
item = newItem;
|
|
|
1329 |
GWT.log("Item updated. Id = " + item.getId());
|
|
|
1330 |
catalogDashboardPanel.getItemListWidget().updateItem(item);
|
|
|
1331 |
getFreshItemFromDB(item.getId());
|
|
|
1332 |
Window.alert("Item updated successfully.");
|
|
|
1333 |
}
|
|
|
1334 |
else {
|
|
|
1335 |
GWT.log("Error updating item");
|
|
|
1336 |
Window.alert("Error updating item");
|
|
|
1337 |
}
|
|
|
1338 |
}
|
|
|
1339 |
@Override
|
|
|
1340 |
public void onFailure(Throwable caught) {
|
|
|
1341 |
caught.printStackTrace();
|
|
|
1342 |
Window.alert("Error while updating item");
|
|
|
1343 |
}
|
|
|
1344 |
});
|
|
|
1345 |
}
|
|
|
1346 |
|
|
|
1347 |
private void getFreshItemFromDB(long id) {
|
|
|
1348 |
catalogService.getItem(id, new AsyncCallback<Item>() {
|
|
|
1349 |
@Override
|
|
|
1350 |
public void onSuccess(Item result) {
|
|
|
1351 |
setItemDetails(result);
|
|
|
1352 |
}
|
|
|
1353 |
@Override
|
|
|
1354 |
public void onFailure(Throwable caught) {
|
|
|
1355 |
caught.printStackTrace();
|
|
|
1356 |
Window.alert("Unable to fetch item details.");
|
|
|
1357 |
}
|
|
|
1358 |
});
|
|
|
1359 |
}
|
|
|
1360 |
|
|
|
1361 |
/**
|
|
|
1362 |
* This method is called while updating item.<br> It will create a new Item object and set
|
|
|
1363 |
* its editable attributes with UI fields values and non-editable attributes with old Item
|
|
|
1364 |
* object attributes. This new Item object is then passed to the service to update item in the database.
|
|
|
1365 |
* <br>If update is successful, the old Item object is replaced with the new Item object.
|
|
|
1366 |
* @return true if new Item object is created successfully
|
|
|
1367 |
* <br>false if some error occurs due to NumberFormatException
|
|
|
1368 |
*/
|
|
|
1369 |
private boolean createNewItem() {
|
| 11976 |
vikram.rag |
1370 |
|
| 10484 |
vikram.rag |
1371 |
newItem = new Item();
|
|
|
1372 |
newItem.setId(item.getId());
|
|
|
1373 |
newItem.setProductGroup(productGroup.getText().trim());
|
|
|
1374 |
newItem.setBrand(brand.getText().trim());
|
|
|
1375 |
newItem.setModelNumber(modelNumber.getText().trim());
|
|
|
1376 |
newItem.setModelName(modelName.getText().trim());
|
|
|
1377 |
newItem.setColor(color.getText().trim());
|
|
|
1378 |
newItem.setContentCategory(contentCategory.getText());
|
|
|
1379 |
newItem.setComments(comments.getText().trim());
|
|
|
1380 |
newItem.setCatalogItemId(Long.parseLong(catalogItemId.getText()));
|
| 11671 |
vikram.rag |
1381 |
in.shop2020.catalog.dashboard.shared.PrivateDeal privateDeal = new in.shop2020.catalog.dashboard.shared.PrivateDeal();
|
|
|
1382 |
Date dealStartDt = dealStartDate.getValue();
|
|
|
1383 |
Date dealEndDt = dealEndDate.getValue();
|
| 10484 |
vikram.rag |
1384 |
try {
|
| 11671 |
vikram.rag |
1385 |
if(!dealPrice.getText().trim().isEmpty()) {
|
|
|
1386 |
double dpValue = Double.parseDouble(dealPrice.getText().trim());
|
|
|
1387 |
if(dpValue <= 0) {
|
|
|
1388 |
throw new NumberFormatException("Negative value of Deal price");
|
|
|
1389 |
}
|
|
|
1390 |
privateDeal.setDealPrice(dpValue);
|
|
|
1391 |
}
|
|
|
1392 |
else{
|
|
|
1393 |
privateDeal.setDealPrice(0);
|
|
|
1394 |
}
|
|
|
1395 |
} catch(NumberFormatException ex) {
|
|
|
1396 |
Window.alert("Invalid Deal Price format/value. Value should be greater than zero");
|
|
|
1397 |
return false;
|
|
|
1398 |
}
|
|
|
1399 |
if(dealStartDt!=null && privateDeal.getDealPrice() >0){
|
|
|
1400 |
privateDeal.setStartDate(dealStartDt.getTime());
|
|
|
1401 |
}
|
|
|
1402 |
else if(dealStartDt!=null && privateDeal.getDealPrice()==0){
|
|
|
1403 |
Window.alert("Invalid Deal Price format/value. Value should be greater than zero");
|
|
|
1404 |
return false;
|
|
|
1405 |
}
|
|
|
1406 |
else if(dealStartDt==null && privateDeal.getDealPrice()>0){
|
|
|
1407 |
Window.alert("Enter valid Start Date");
|
|
|
1408 |
return false;
|
|
|
1409 |
}
|
| 12340 |
amit.gupta |
1410 |
/* if(isDealActive.getValue() && dealStartDt.getTime() < System.currentTimeMillis()){
|
| 11976 |
vikram.rag |
1411 |
Window.alert("Deal Start Date < Current Date (Either mark InActive or Change Deal Start Date)");
|
|
|
1412 |
return false;
|
| 12340 |
amit.gupta |
1413 |
}*/
|
| 11671 |
vikram.rag |
1414 |
if(dealEndDt!=null && privateDeal.getDealPrice() >0){
|
|
|
1415 |
privateDeal.setEndDate(dealEndDt.getTime());
|
|
|
1416 |
}
|
|
|
1417 |
else if(dealEndDt!=null && privateDeal.getDealPrice()==0){
|
|
|
1418 |
Window.alert("Invalid Deal Price format/value. Value should be greater than zero");
|
|
|
1419 |
return false;
|
|
|
1420 |
}
|
|
|
1421 |
else if(dealEndDt==null && privateDeal.getDealPrice()>0){
|
|
|
1422 |
Window.alert("Enter valid End Date");
|
|
|
1423 |
return false;
|
|
|
1424 |
}
|
|
|
1425 |
if(dealEndDt!=null && dealStartDt!=null && dealEndDt.getTime() < dealStartDt.getTime()){
|
|
|
1426 |
Window.alert("End date can't be less than start date");
|
|
|
1427 |
return false;
|
|
|
1428 |
}
|
|
|
1429 |
try {
|
|
|
1430 |
if(dealFreebieOption.getSelectedIndex()==1 && freebieItemId.getText().trim().isEmpty()){
|
|
|
1431 |
Window.alert("Invalid Freebie ItemId");
|
|
|
1432 |
return false;
|
|
|
1433 |
}
|
|
|
1434 |
if(dealFreebieOption.getSelectedIndex()==2 && dealFreebieItemId.getText().trim().isEmpty()){
|
|
|
1435 |
Window.alert("Invalid Deal Freebie ItemId");
|
|
|
1436 |
return false;
|
|
|
1437 |
}
|
|
|
1438 |
if(!dealFreebieItemId.getText().trim().equals("")) {
|
|
|
1439 |
long dealFreeItemId = Long.parseLong(dealFreebieItemId.getText().trim());
|
|
|
1440 |
if(dealFreeItemId < 0) {
|
|
|
1441 |
throw new NumberFormatException("Negative value of dealFreebieItemId ");
|
|
|
1442 |
}
|
|
|
1443 |
privateDeal.setDealFreebieItemId(dealFreeItemId);
|
|
|
1444 |
if(dealFreebieOption.getSelectedIndex()==1){
|
|
|
1445 |
if(Long.parseLong(freebieItemId.getText().trim()) < 0) {
|
|
|
1446 |
throw new NumberFormatException("Negative value of dealFreebieItemId ");
|
|
|
1447 |
}
|
|
|
1448 |
privateDeal.setDealFreebieItemId(Long.parseLong(freebieItemId.getText().trim()));
|
|
|
1449 |
}
|
|
|
1450 |
privateDeal.setDealFreebieOption(Long.valueOf(dealFreebieOption.getSelectedIndex()));
|
|
|
1451 |
}
|
|
|
1452 |
else{
|
|
|
1453 |
privateDeal.setDealFreebieItemId(0L);
|
|
|
1454 |
privateDeal.setDealFreebieOption(Long.valueOf(dealFreebieOption.getSelectedIndex()));
|
|
|
1455 |
}
|
|
|
1456 |
} catch(NumberFormatException ex) {
|
|
|
1457 |
Window.alert("Invalid deal freebie ItemId");
|
|
|
1458 |
return false;
|
|
|
1459 |
}
|
| 11976 |
vikram.rag |
1460 |
/*if(dealTextOption.getSelectedIndex()==1 && bestDealsText.getText().trim().isEmpty()){
|
| 11671 |
vikram.rag |
1461 |
Window.alert("Invalid Best Deals Text");
|
|
|
1462 |
return false;
|
| 11976 |
vikram.rag |
1463 |
}*/
|
|
|
1464 |
if(dealTextOption.getSelectedIndex()==1){
|
| 11671 |
vikram.rag |
1465 |
privateDeal.setDealText(bestDealsText.getText().trim());
|
|
|
1466 |
privateDeal.setDealTextOption((long) dealTextOption.getSelectedIndex());
|
|
|
1467 |
}
|
|
|
1468 |
else if(dealTextOption.getSelectedIndex()==2 && dealText.getText().trim().isEmpty()){
|
|
|
1469 |
Window.alert("Please enter some deal Text");
|
|
|
1470 |
return false;
|
|
|
1471 |
}
|
|
|
1472 |
else{
|
|
|
1473 |
privateDeal.setDealText(dealText.getText().trim());
|
|
|
1474 |
privateDeal.setDealTextOption((long) dealTextOption.getSelectedIndex());
|
|
|
1475 |
}
|
|
|
1476 |
privateDeal.setCod(isCodOnDeal.getValue());
|
|
|
1477 |
privateDeal.setActive(isDealActive.getValue());
|
|
|
1478 |
try{
|
|
|
1479 |
if(dealRank.getText().trim().isEmpty()){
|
| 11976 |
vikram.rag |
1480 |
privateDeal.setRank(10000L);
|
| 11671 |
vikram.rag |
1481 |
}
|
|
|
1482 |
else{
|
| 11976 |
vikram.rag |
1483 |
if(Long.parseLong(dealRank.getText().trim()) < 0){
|
|
|
1484 |
throw new NumberFormatException();
|
|
|
1485 |
}
|
| 11671 |
vikram.rag |
1486 |
privateDeal.setRank(Long.parseLong(dealRank.getText().trim()));
|
|
|
1487 |
}
|
|
|
1488 |
}
|
|
|
1489 |
catch(NumberFormatException nex){
|
|
|
1490 |
Window.alert("Invalid Deals Rank");
|
|
|
1491 |
return false;
|
|
|
1492 |
}
|
|
|
1493 |
newItem.setPrivateDeal(privateDeal);
|
|
|
1494 |
if(newItem.getPrivateDeal().getDealPrice()==0 && (newItem.getPrivateDeal().getDealPrice()!=item.getPrivateDeal().getDealPrice())){
|
|
|
1495 |
Window.alert("Deal Price can't be zero");
|
|
|
1496 |
return false;
|
|
|
1497 |
}
|
|
|
1498 |
try {
|
| 10484 |
vikram.rag |
1499 |
if(!mrp.getText().trim().isEmpty()) {
|
|
|
1500 |
double mrpValue = Double.parseDouble(mrp.getText().trim());
|
|
|
1501 |
if(mrpValue <= 0) {
|
|
|
1502 |
throw new NumberFormatException("Negative value of MRP");
|
|
|
1503 |
}
|
|
|
1504 |
newItem.setMrp(mrpValue);
|
|
|
1505 |
}
|
|
|
1506 |
} catch(NumberFormatException ex) {
|
| 11976 |
vikram.rag |
1507 |
Window.alert("Invalid MRP format/value. Value should be greater than zero");
|
| 10484 |
vikram.rag |
1508 |
return false;
|
|
|
1509 |
}
|
|
|
1510 |
try {
|
|
|
1511 |
if(!sellingPrice.getText().trim().isEmpty()) {
|
|
|
1512 |
double spValue = Double.parseDouble(sellingPrice.getText().trim());
|
|
|
1513 |
if(spValue <= 0) {
|
|
|
1514 |
throw new NumberFormatException("Negative value of Selling price");
|
|
|
1515 |
}
|
|
|
1516 |
newItem.setSellingPrice(spValue);
|
|
|
1517 |
}
|
|
|
1518 |
} catch(NumberFormatException ex) {
|
|
|
1519 |
Window.alert("Invalid Selling Price format/value. Value shoule be greater than zero");
|
|
|
1520 |
return false;
|
|
|
1521 |
}
|
| 11976 |
vikram.rag |
1522 |
if(newItem.getPrivateDeal().getDealPrice()!=0 && newItem.getPrivateDeal().getDealPrice() >= newItem.getSellingPrice()){
|
|
|
1523 |
Window.alert("Deal Price can't be more than Selling Price");
|
|
|
1524 |
return false;
|
|
|
1525 |
}
|
| 10484 |
vikram.rag |
1526 |
try {
|
|
|
1527 |
if(!weight.getText().trim().isEmpty()) {
|
|
|
1528 |
double wtValue = Double.parseDouble(weight.getText().trim());
|
|
|
1529 |
if(wtValue <= 0) {
|
|
|
1530 |
throw new NumberFormatException("Negative value of Weight");
|
|
|
1531 |
}
|
|
|
1532 |
newItem.setWeight(wtValue);
|
|
|
1533 |
}
|
|
|
1534 |
} catch(NumberFormatException ex) {
|
| 11671 |
vikram.rag |
1535 |
Window.alert("Invalid weight format/value. Value should be greater than zero");
|
| 10484 |
vikram.rag |
1536 |
return false;
|
|
|
1537 |
}
|
|
|
1538 |
try {
|
|
|
1539 |
if(!startDate.getTextBox().getText().trim().equals("")) {
|
|
|
1540 |
newItem.setStartDate(startDate.getValue().getTime());
|
|
|
1541 |
}
|
|
|
1542 |
} catch(Exception ex) {
|
|
|
1543 |
Window.alert("Invalid start date format");
|
|
|
1544 |
return false;
|
|
|
1545 |
}
|
|
|
1546 |
newItem.setBestDealsText(bestDealsText.getText().trim());
|
|
|
1547 |
newItem.setBestDealsDetailsText(bestDealsDetailsText.getText().trim());
|
|
|
1548 |
newItem.setBestDealsDetailsLink(bestDealsDetailsLink.getText().trim());
|
|
|
1549 |
Date comingSoonStartDt = comingSoonStartDate.getValue();
|
|
|
1550 |
Date expectedArrivalDt = expectedArrivalDate.getValue();
|
|
|
1551 |
if(comingSoonStartDt == null){
|
|
|
1552 |
newItem.setComingSoonStartDate(null);
|
|
|
1553 |
}else {
|
|
|
1554 |
newItem.setComingSoonStartDate(comingSoonStartDt.getTime());
|
|
|
1555 |
}
|
|
|
1556 |
if(expectedArrivalDt == null){
|
|
|
1557 |
newItem.setExpectedArrivalDate(null);
|
|
|
1558 |
}else {
|
|
|
1559 |
newItem.setExpectedArrivalDate(expectedArrivalDt.getTime());
|
|
|
1560 |
}
|
|
|
1561 |
try {
|
|
|
1562 |
if(!bestDealsValue.getText().trim().equals("")) {
|
|
|
1563 |
double bdValue = Double.parseDouble(bestDealsValue.getText().trim());
|
|
|
1564 |
if(bdValue < 0) {
|
|
|
1565 |
throw new NumberFormatException("Negative value of BestDealValue");
|
|
|
1566 |
}
|
|
|
1567 |
newItem.setBestDealsValue(bdValue);
|
|
|
1568 |
}
|
|
|
1569 |
} catch(NumberFormatException ex) {
|
|
|
1570 |
Window.alert("Invalid best deal value format");
|
|
|
1571 |
return false;
|
|
|
1572 |
}
|
|
|
1573 |
|
|
|
1574 |
try {
|
|
|
1575 |
if(!bestSellingRank.getText().trim().equals("")) {
|
|
|
1576 |
long bsrValue = Long.parseLong(bestSellingRank.getText().trim());
|
|
|
1577 |
if(bsrValue < 0) {
|
|
|
1578 |
throw new NumberFormatException("Negative value of Best Selling Rank");
|
|
|
1579 |
}
|
|
|
1580 |
newItem.setBestSellingRank(bsrValue);
|
|
|
1581 |
}
|
|
|
1582 |
} catch(NumberFormatException ex) {
|
|
|
1583 |
Window.alert("Invalid best selling rank format");
|
|
|
1584 |
return false;
|
|
|
1585 |
}
|
|
|
1586 |
newItem.setDefaultForEntity(defaultForEntity.getValue());
|
|
|
1587 |
newItem.setRisky(risky.getValue());
|
|
|
1588 |
|
|
|
1589 |
try {
|
|
|
1590 |
if(!minStockLevel.getText().trim().equals("")) {
|
|
|
1591 |
long minStock = Long.parseLong(minStockLevel.getText().trim());
|
|
|
1592 |
if(minStock < 0) {
|
|
|
1593 |
throw new NumberFormatException("Negative value of Minimum Stock Level");
|
|
|
1594 |
}
|
|
|
1595 |
newItem.setMinStockLevel(minStock);
|
|
|
1596 |
}
|
|
|
1597 |
} catch(NumberFormatException ex) {
|
|
|
1598 |
Window.alert("Invalid minimum Stock Level format");
|
|
|
1599 |
return false;
|
|
|
1600 |
}
|
|
|
1601 |
|
|
|
1602 |
try {
|
|
|
1603 |
if(!numOfDaysStock.getText().trim().equals("")) {
|
|
|
1604 |
long numDays = Long.parseLong(numOfDaysStock.getText().trim());
|
|
|
1605 |
if(numDays < 0) {
|
|
|
1606 |
throw new NumberFormatException("Negative value of num Of Days ");
|
|
|
1607 |
}
|
|
|
1608 |
newItem.setNumOfDaysStock(new Long(numDays).intValue());
|
|
|
1609 |
}
|
|
|
1610 |
} catch(NumberFormatException ex) {
|
|
|
1611 |
Window.alert("Invalid number Of Days format");
|
|
|
1612 |
return false;
|
|
|
1613 |
}
|
|
|
1614 |
newItem.setShowSellingPrice(showSellingPrice.getValue());
|
|
|
1615 |
newItem.setHoldOverride(holdOverride.getValue());
|
|
|
1616 |
try {
|
|
|
1617 |
String expectedDelayText = expectedDelay.getText().trim();
|
|
|
1618 |
if(!expectedDelayText.equals("")){
|
|
|
1619 |
newItem.setExpectedDelay(Integer.parseInt(expectedDelayText));
|
|
|
1620 |
}
|
|
|
1621 |
} catch(NumberFormatException nfe) {
|
|
|
1622 |
Window.alert("Invalid expected delay");
|
|
|
1623 |
return false;
|
|
|
1624 |
}
|
|
|
1625 |
try {
|
|
|
1626 |
if(!freebieItemId.getText().trim().equals("")) {
|
|
|
1627 |
long freeItemId = Long.parseLong(freebieItemId.getText().trim());
|
|
|
1628 |
if(freeItemId < 0) {
|
|
|
1629 |
throw new NumberFormatException("Negative value of freebieItemId ");
|
|
|
1630 |
}
|
|
|
1631 |
newItem.setFreebieItemId(new Long(freeItemId));
|
|
|
1632 |
}
|
|
|
1633 |
} catch(NumberFormatException ex) {
|
|
|
1634 |
Window.alert("Invalid freebie ItemId");
|
|
|
1635 |
return false;
|
|
|
1636 |
}
|
|
|
1637 |
if((item.getPreferredVendor() == null || item.getVendorPricesMap() == null || item.getVendorPricesMap().isEmpty()) && preferredVendor.getSelectedIndex() == 0) {
|
|
|
1638 |
newItem.setPreferredVendor(item.getPreferredVendor());
|
|
|
1639 |
}
|
|
|
1640 |
else {
|
|
|
1641 |
long vendorId = Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex()));
|
|
|
1642 |
newItem.setPreferredVendor(vendorId);
|
|
|
1643 |
}
|
|
|
1644 |
newItem.setPreferredInsurer(Long.parseLong(preferredInsurer.getValue(preferredInsurer.getSelectedIndex())));
|
|
|
1645 |
newItem.setWarehouseStickiness(warehouseStickiness.getValue());
|
|
|
1646 |
newItem.setHasItemNo(hasItemNo.getValue());
|
|
|
1647 |
newItem.setItemType(itemType.getValue());
|
|
|
1648 |
newItem.setAsin(asin.getText().trim());
|
|
|
1649 |
try {
|
|
|
1650 |
if(!holdInventory.getText().trim().equals("")) {
|
|
|
1651 |
long hold_inventory = Long.parseLong(holdInventory.getText().trim());
|
|
|
1652 |
if(hold_inventory < 0) {
|
|
|
1653 |
throw new NumberFormatException("Negative value of Hold Inventory");
|
|
|
1654 |
}
|
|
|
1655 |
newItem.setHoldInventory(hold_inventory);
|
|
|
1656 |
}
|
|
|
1657 |
} catch(NumberFormatException ex) {
|
|
|
1658 |
Window.alert("Invalid Hold Inventory Value");
|
|
|
1659 |
return false;
|
|
|
1660 |
}
|
|
|
1661 |
|
|
|
1662 |
try {
|
|
|
1663 |
if(!defaultInventory.getText().trim().equals("")) {
|
|
|
1664 |
long default_inventory = Long.parseLong(defaultInventory.getText().trim());
|
|
|
1665 |
if(default_inventory < 0) {
|
|
|
1666 |
throw new NumberFormatException("Negative value of Default Inventory");
|
|
|
1667 |
}
|
|
|
1668 |
newItem.setDefaultInventory(default_inventory);
|
|
|
1669 |
}
|
|
|
1670 |
} catch(NumberFormatException ex) {
|
|
|
1671 |
Window.alert("Invalid Default Inventory Value");
|
|
|
1672 |
return false;
|
|
|
1673 |
}
|
|
|
1674 |
/*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
|
| 2126 |
ankur.sing |
1675 |
Add the instance to map and set the map to the item instance created above.*/
|
| 10484 |
vikram.rag |
1676 |
Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
|
|
|
1677 |
VendorPricings v;
|
|
|
1678 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
|
|
1679 |
v = new VendorPricings();
|
|
|
1680 |
v.setMop(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP)));
|
|
|
1681 |
v.setDealerPrice(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP)));
|
|
|
1682 |
v.setTransferPrice(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP)));
|
|
|
1683 |
v.setNlc(Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC)));
|
|
|
1684 |
v.setVendorId(Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID)));
|
|
|
1685 |
vendorPrices.put(v.getVendorId(), v);
|
|
|
1686 |
}
|
|
|
1687 |
newItem.setVendorPricesMap(vendorPrices);
|
|
|
1688 |
newItem.setItemStatusDesc(statusDesc.getText().trim());
|
|
|
1689 |
|
|
|
1690 |
/*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
|
| 2126 |
ankur.sing |
1691 |
Add the instance to map and set the map to the item instance created above.*/
|
| 10484 |
vikram.rag |
1692 |
Map<String, VendorItemMapping> vendorMappings = new HashMap<String, VendorItemMapping>();
|
|
|
1693 |
VendorItemMapping vMapping;
|
|
|
1694 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
|
|
1695 |
vMapping = new VendorItemMapping();
|
|
|
1696 |
vMapping.setItemKey(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY));
|
|
|
1697 |
vMapping.setVendorId(Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID)));
|
|
|
1698 |
vendorMappings.put(vMapping.getVendorId() + Item.KEY_SEPARATOR + tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD), vMapping);
|
|
|
1699 |
}
|
|
|
1700 |
newItem.setVendorKeysMap(vendorMappings);
|
|
|
1701 |
|
|
|
1702 |
/*Create an instance of SourcePricings for each row in source pricing table. Set the source prices to the instance.
|
| 3558 |
rajveer |
1703 |
Add the instance to map and set the map to the item instance created above.*/
|
| 10484 |
vikram.rag |
1704 |
Map<Long, SourcePricings> sourcePrices = new HashMap<Long, SourcePricings>();
|
|
|
1705 |
SourcePricings s;
|
|
|
1706 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
|
|
1707 |
s = new SourcePricings();
|
|
|
1708 |
s.setMrp(Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP)));
|
|
|
1709 |
s.setSellingPrice(Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE)));
|
|
|
1710 |
s.setSourceId(Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID)));
|
|
|
1711 |
sourcePrices.put(s.getSourceId(), s);
|
|
|
1712 |
}
|
| 3558 |
rajveer |
1713 |
newItem.setSourcePricesMap(sourcePrices);
|
| 2066 |
ankur.sing |
1714 |
|
| 10484 |
vikram.rag |
1715 |
newItem.setContentCategoryId(item.getContentCategoryId());
|
|
|
1716 |
newItem.setFeatureId(item.getFeatureId());
|
|
|
1717 |
newItem.setFeatureDescription(item.getFeatureDescription());
|
|
|
1718 |
newItem.setAddedOn(item.getAddedOn());
|
|
|
1719 |
newItem.setRetireDate(item.getRetireDate());
|
|
|
1720 |
newItem.setUpdatedOn(item.getUpdatedOn());
|
|
|
1721 |
newItem.setItemStatus(item.getItemStatus());
|
|
|
1722 |
newItem.setItemInventory(item.getItemInventory());
|
|
|
1723 |
newItem.setSimilarItems(item.getSimilarItems());
|
|
|
1724 |
newItem.setVouchersMap(item.getVouchersMap());
|
| 11976 |
vikram.rag |
1725 |
|
| 10484 |
vikram.rag |
1726 |
return true;
|
|
|
1727 |
}
|
| 2066 |
ankur.sing |
1728 |
|
| 10484 |
vikram.rag |
1729 |
/**
|
|
|
1730 |
* This method is called when Edit button is clicked corresponding to a row in
|
|
|
1731 |
* vendor prices table. It will pop up a form to edit the vendor prices.
|
|
|
1732 |
* @param vendorId
|
|
|
1733 |
* @param row
|
|
|
1734 |
*/
|
|
|
1735 |
private void editVendorPrices(final long vendorId, final int row) {
|
|
|
1736 |
String mop = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP);
|
|
|
1737 |
String dp = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP);
|
|
|
1738 |
String tp = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP);
|
|
|
1739 |
String nlc = tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC);
|
|
|
1740 |
VendorPricesDialog pricesDialog = new VendorPricesDialog(mop, dp, tp, nlc);
|
|
|
1741 |
pricesDialog.updateButton.setText("Update");
|
|
|
1742 |
pricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
|
|
|
1743 |
@Override
|
|
|
1744 |
public boolean onUpdate(double mop, double dp, double tp, double nlc, long vendorId) {
|
|
|
1745 |
if(!validateVendorPrices(mop, dp, tp, nlc)) {
|
|
|
1746 |
return false;
|
|
|
1747 |
}
|
|
|
1748 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_MOP, mop + "");
|
|
|
1749 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_DP, dp + "");
|
|
|
1750 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_TP, tp + "");
|
|
|
1751 |
tableVendorPrices.setText(row, TABLE_INDEX_PRICING_NLC, nlc + "");
|
|
|
1752 |
return true;
|
|
|
1753 |
}
|
|
|
1754 |
});
|
|
|
1755 |
pricesDialog.show();
|
|
|
1756 |
}
|
|
|
1757 |
|
|
|
1758 |
/**
|
|
|
1759 |
* This method is called when Edit button is clicked corresponding to a row in
|
|
|
1760 |
* vendor prices table. It will pop up a form to edit the vendor prices.
|
|
|
1761 |
* @param vendorId
|
|
|
1762 |
* @param row
|
|
|
1763 |
*/
|
|
|
1764 |
private void editSourcePrices(final long sourceId, final int row) {
|
|
|
1765 |
String mrp = tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP);
|
|
|
1766 |
String sellingPrice = tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE);
|
|
|
1767 |
SourcePricesDialog pricesDialog = new SourcePricesDialog(mrp, sellingPrice);
|
|
|
1768 |
pricesDialog.updateButton.setText("Update");
|
|
|
1769 |
pricesDialog.setSourcePriceUpdateListener(new SourcePricesDialog.SourcePriceUpdateListener() {
|
|
|
1770 |
@Override
|
|
|
1771 |
public boolean onUpdate(double mrp, double sellingPrice, long sourceId) {
|
|
|
1772 |
if(!validateSourcePrices(mrp, sellingPrice)) {
|
|
|
1773 |
return false;
|
|
|
1774 |
}
|
|
|
1775 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_MRP, mrp + "");
|
|
|
1776 |
tableSourcePrices.setText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE, sellingPrice + "");
|
|
|
1777 |
return true;
|
|
|
1778 |
}
|
|
|
1779 |
});
|
|
|
1780 |
pricesDialog.show();
|
|
|
1781 |
}
|
|
|
1782 |
|
|
|
1783 |
|
|
|
1784 |
/**
|
|
|
1785 |
* This method is called when Edit button is clicked corresponding to a row in
|
|
|
1786 |
* vendor item key table. It will pop up a form to edit the item key.
|
|
|
1787 |
* @param vendorId
|
|
|
1788 |
* @param row
|
|
|
1789 |
*/
|
|
|
1790 |
private void editVendorKey(final long vendorId, final int row) {
|
|
|
1791 |
String key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
|
|
|
1792 |
VendorMappingDialog mappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(),
|
|
|
1793 |
modelNumber.getText().trim(), color.getText().trim(), key);
|
|
|
1794 |
mappingDialog.updateButton.setText("Update");
|
|
|
1795 |
mappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
|
|
|
1796 |
@Override
|
|
|
1797 |
public boolean onUpdate(String itemKey, long vendorId) {
|
|
|
1798 |
if(itemKey == null || itemKey.equals("")) {
|
|
|
1799 |
Window.alert("Item key cannot be empty.");
|
|
|
1800 |
return false;
|
|
|
1801 |
}
|
|
|
1802 |
tableVendorItemKey.setText(row, TABLE_INDEX_MAPPING_ITEM_KEY, itemKey);
|
|
|
1803 |
return true;
|
|
|
1804 |
}
|
|
|
1805 |
});
|
|
|
1806 |
mappingDialog.show();
|
|
|
1807 |
}
|
|
|
1808 |
|
|
|
1809 |
/**
|
|
|
1810 |
* This method compares all the editable UI fields values with attributes in the item object.
|
|
|
1811 |
* If they differ, the attribute name is appended to a string.
|
|
|
1812 |
* @return String showing attributes which are changed by the user for confirmation.
|
|
|
1813 |
* <br>Empty string if nothing is changed.
|
|
|
1814 |
*/
|
|
|
1815 |
private String isItemChanged() {
|
|
|
1816 |
StringBuilder sb = new StringBuilder("");
|
|
|
1817 |
mandatoryChangedValMap = new HashMap<String, Object>();
|
|
|
1818 |
optionalChangedValMap = new HashMap<String, Object>();
|
|
|
1819 |
if(!checkParameterIfEqual(brand.getText().trim(), item.getBrand())) {
|
|
|
1820 |
mandatoryChangedValMap.put(MANDATORY_BRAND, brand.getText().trim());
|
|
|
1821 |
sb.append("\n-Brand");
|
|
|
1822 |
}
|
|
|
1823 |
if(!checkParameterIfEqual(modelNumber.getText().trim(), item.getModelNumber())) {
|
|
|
1824 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NO, modelNumber.getText().trim());
|
|
|
1825 |
sb.append("\n-Model Number");
|
|
|
1826 |
}
|
|
|
1827 |
if(!checkParameterIfEqual(modelName.getText().trim(), item.getModelName())) {
|
|
|
1828 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NAME, modelName.getText().trim());
|
|
|
1829 |
sb.append("\n-Model Name");
|
|
|
1830 |
}
|
|
|
1831 |
if(!checkParameterIfEqual(color.getText().trim(), item.getColor())) {
|
|
|
1832 |
sb.append("\n-Color");
|
|
|
1833 |
}
|
|
|
1834 |
if(!checkParameterIfEqual(statusDesc.getText().trim(), item.getItemStatusDesc())) {
|
|
|
1835 |
sb.append("\n-Status Description");
|
|
|
1836 |
}
|
|
|
1837 |
if(!checkParameterIfEqual(comments.getText().trim(), item.getComments())) {
|
|
|
1838 |
sb.append("\n-Comments");
|
|
|
1839 |
}
|
|
|
1840 |
if(!checkParameterIfEqual(newItem.getMrp(), item.getMrp())) {
|
|
|
1841 |
mandatoryChangedValMap.put(MANDATORY_MRP, newItem.getMrp());
|
|
|
1842 |
sb.append("\n-MRP");
|
|
|
1843 |
}
|
|
|
1844 |
if(!checkParameterIfEqual(newItem.getSellingPrice(), item.getSellingPrice())) {
|
|
|
1845 |
optionalChangedValMap.put(OPTIONAL_SELLING_PRICE, newItem.getSellingPrice());
|
|
|
1846 |
sb.append("\n-Selling Price");
|
|
|
1847 |
}
|
|
|
1848 |
if(!checkParameterIfEqual(newItem.getWeight(), item.getWeight())) {
|
|
|
1849 |
mandatoryChangedValMap.put(MANDATORY_WEIGHT, newItem.getWeight());
|
|
|
1850 |
sb.append("\n-Weight");
|
|
|
1851 |
}
|
|
|
1852 |
if(!checkParameterIfEqual(bestDealsText.getText().trim(), item.getBestDealsText())) {
|
|
|
1853 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_TEXT, bestDealsText.getText().trim());
|
|
|
1854 |
sb.append("\n-Best Deal Text");
|
|
|
1855 |
}
|
|
|
1856 |
if(!checkParameterIfEqual(bestDealsDetailsText.getText().trim(), item.getBestDealsDetailsText())) {
|
|
|
1857 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_DETAIL_TEXT, bestDealsDetailsText.getText().trim());
|
|
|
1858 |
sb.append("\n-Best Deal Detail Text");
|
|
|
1859 |
}
|
|
|
1860 |
if(!checkParameterIfEqual(bestDealsDetailsLink.getText().trim(), item.getBestDealsDetailsLink())) {
|
|
|
1861 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_DETAIL_LINK, bestDealsDetailsLink.getText().trim());
|
|
|
1862 |
sb.append("\n-Best Deal Detail Link");
|
|
|
1863 |
}
|
|
|
1864 |
if(!checkParameterIfEqual(newItem.getBestDealsValue(), item.getBestDealsValue())) {
|
|
|
1865 |
sb.append("\n-Best Deal Value");
|
|
|
1866 |
}
|
|
|
1867 |
if(!checkParameterIfEqual(newItem.getBestSellingRank(), item.getBestSellingRank())) {
|
|
|
1868 |
sb.append("\n-Best Selling Rank");
|
|
|
1869 |
}
|
|
|
1870 |
if(!checkParameterIfEqual(newItem.getMinStockLevel(), item.getMinStockLevel())) {
|
|
|
1871 |
sb.append("\n-Min Stock Level");
|
|
|
1872 |
}
|
|
|
1873 |
if(!checkParameterIfEqual(newItem.getNumOfDaysStock(), item.getNumOfDaysStock())) {
|
|
|
1874 |
sb.append("\n-Number Of Days Of Stock");
|
|
|
1875 |
}
|
|
|
1876 |
if(item.isDefaultForEntity() != defaultForEntity.getValue()) {
|
|
|
1877 |
sb.append("\n-Default For Entity Flag");
|
|
|
1878 |
}
|
|
|
1879 |
if(item.isRisky() != risky.getValue()) {
|
|
|
1880 |
sb.append("\n-Risky Flag");
|
|
|
1881 |
}
|
|
|
1882 |
if(!checkParameterIfEqual(newItem.getStartDate(), item.getStartDate())) {
|
|
|
1883 |
sb.append("\n-Start Date");
|
|
|
1884 |
}
|
|
|
1885 |
if(!checkParameterIfEqual(newItem.getExpectedArrivalDate(), item.getExpectedArrivalDate())) {
|
|
|
1886 |
sb.append("\n-Expected Arrival Date");
|
|
|
1887 |
}
|
|
|
1888 |
if(!checkParameterIfEqual(newItem.getComingSoonStartDate(), item.getComingSoonStartDate())) {
|
|
|
1889 |
sb.append("\n-Coming Soon Start Date");
|
|
|
1890 |
}
|
|
|
1891 |
if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
|
|
|
1892 |
sb.append("\n-Expected Delay");
|
|
|
1893 |
}
|
|
|
1894 |
if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
|
|
|
1895 |
sb.append("\n-Warehouse Stickiness Flag");
|
|
|
1896 |
}
|
|
|
1897 |
if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
|
|
|
1898 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_VENDOR, newItem.getPreferredVendor());
|
|
|
1899 |
sb.append("\n-Preferred Vendor");
|
|
|
1900 |
}
|
|
|
1901 |
if(!checkParameterIfEqual(newItem.getPreferredInsurer(), item.getPreferredInsurer())) {
|
|
|
1902 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_INSURER, newItem.getPreferredInsurer());
|
|
|
1903 |
sb.append("\n-Preferred Insurer");
|
|
|
1904 |
}
|
|
|
1905 |
if(item.isHasItemNo() != hasItemNo.getValue()) {
|
|
|
1906 |
sb.append("\n-Has Item Number Flag");
|
|
|
1907 |
}
|
|
|
1908 |
if(item.isItemType() != itemType.getValue()) {
|
|
|
1909 |
sb.append("\n-Has Serial Number Flag");
|
|
|
1910 |
}
|
|
|
1911 |
if(item.isShowSellingPrice() != showSellingPrice.getValue()) {
|
|
|
1912 |
sb.append("\n-Coming Soon item pricing marked");
|
|
|
1913 |
}
|
|
|
1914 |
if(item.isHoldOverride() != holdOverride.getValue()) {
|
|
|
1915 |
sb.append("\n-Hold Override is marked");
|
|
|
1916 |
}
|
|
|
1917 |
if(!checkParameterIfEqual(newItem.getFreebieItemId(), item.getFreebieItemId())) {
|
|
|
1918 |
optionalChangedValMap.put(OPTIONAL_FREEBIE_ITEM_ID, freebieItemId.getText().trim());
|
|
|
1919 |
sb.append("\n-Freebie Item Id");
|
|
|
1920 |
}
|
| 11671 |
vikram.rag |
1921 |
if(newItem.getPrivateDeal().getDealFreebieItemId()!=0){
|
|
|
1922 |
if(newItem.getPrivateDeal().getDealFreebieItemId()!=item.getPrivateDeal().getDealFreebieItemId()) {
|
|
|
1923 |
sb.append("\n-Deal Freebie Item Id");
|
|
|
1924 |
}
|
|
|
1925 |
}
|
|
|
1926 |
if(newItem.getPrivateDeal().getDealPrice()!=item.getPrivateDeal().getDealPrice()) {
|
|
|
1927 |
sb.append("\n-Deal Price");
|
|
|
1928 |
}
|
|
|
1929 |
if(newItem.getPrivateDeal().getDealFreebieOption().longValue()!=item.getPrivateDeal().getDealFreebieOption().longValue()) {
|
|
|
1930 |
sb.append("\n-Deal Freebie Option");
|
|
|
1931 |
}
|
|
|
1932 |
if(!newItem.getPrivateDeal().getDealText().equalsIgnoreCase(item.getPrivateDeal().getDealText())) {
|
| 11976 |
vikram.rag |
1933 |
sb.append("\n-Deal Text " + newItem.getPrivateDeal().getDealText() +" "+item.getPrivateDeal().getDealText());
|
| 11671 |
vikram.rag |
1934 |
}
|
|
|
1935 |
if(newItem.getPrivateDeal().getDealTextOption()!=item.getPrivateDeal().getDealTextOption()) {
|
|
|
1936 |
sb.append("\n-Deal Text Option");
|
|
|
1937 |
}
|
|
|
1938 |
if(newItem.getPrivateDeal().getRank().longValue()!=item.getPrivateDeal().getRank().longValue()) {
|
| 11976 |
vikram.rag |
1939 |
sb.append("\n-Deal Rank"+" "+newItem.getPrivateDeal().getRank().longValue()+" "+item.getPrivateDeal().getRank().longValue());
|
| 11671 |
vikram.rag |
1940 |
}
|
|
|
1941 |
if(newItem.getPrivateDeal().isCod()!=item.getPrivateDeal().isCod()) {
|
|
|
1942 |
sb.append("\n-Is Deal Cod");
|
|
|
1943 |
}
|
|
|
1944 |
if(newItem.getPrivateDeal().isActive()!=item.getPrivateDeal().isActive()) {
|
|
|
1945 |
sb.append("\n-Is Deal Active");
|
|
|
1946 |
}
|
|
|
1947 |
if(!checkParameterIfEqual(newItem.getPrivateDeal().getStartDate(),item.getPrivateDeal().getStartDate())) {
|
|
|
1948 |
sb.append("\n-Deal Start Date");
|
|
|
1949 |
}
|
|
|
1950 |
if(!checkParameterIfEqual(newItem.getPrivateDeal().getEndDate(),item.getPrivateDeal().getEndDate())) {
|
|
|
1951 |
sb.append("\n-Deal End Date");
|
|
|
1952 |
}
|
| 10484 |
vikram.rag |
1953 |
if(!checkParameterIfEqual(asin.getText().trim(), item.getAsin())) {
|
|
|
1954 |
sb.append("\n-Asin");
|
|
|
1955 |
}
|
|
|
1956 |
if(!checkParameterIfEqual(newItem.getHoldInventory(), item.getHoldInventory())) {
|
|
|
1957 |
sb.append("\n-Hold Inventory");
|
|
|
1958 |
}
|
|
|
1959 |
if(!checkParameterIfEqual(newItem.getDefaultInventory(), item.getDefaultInventory())) {
|
|
|
1960 |
sb.append("\n-Default Inventory");
|
|
|
1961 |
}
|
|
|
1962 |
VendorPricings vendorPricings;
|
|
|
1963 |
long vendorId;
|
|
|
1964 |
boolean vendorPricingsChanged = false;
|
|
|
1965 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
|
|
1966 |
vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
|
|
1967 |
vendorPricings = item.getVendorPricesMap().get(vendorId);
|
|
|
1968 |
if(vendorPricings == null) {
|
|
|
1969 |
sb.append("\n-Vendor Prices (Vendor:" + vendorId + ")");
|
|
|
1970 |
vendorPricingsChanged = true;
|
|
|
1971 |
continue;
|
|
|
1972 |
}
|
|
|
1973 |
if(vendorPricings.getMop() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP))) {
|
|
|
1974 |
vendorPricingsChanged = true;
|
|
|
1975 |
sb.append("\n-MOP (Vendor:" + vendorId + ")");
|
|
|
1976 |
}
|
|
|
1977 |
if(vendorPricings.getDealerPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP))) {
|
|
|
1978 |
vendorPricingsChanged = true;
|
|
|
1979 |
sb.append("\n-Dealer Price (Vendor:" + vendorId + ")");
|
|
|
1980 |
}
|
|
|
1981 |
if(vendorPricings.getTransferPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP))) {
|
|
|
1982 |
vendorPricingsChanged = true;
|
|
|
1983 |
}
|
|
|
1984 |
if(vendorPricings.getNlc() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_NLC))) {
|
|
|
1985 |
vendorPricingsChanged = true;
|
|
|
1986 |
}
|
|
|
1987 |
}
|
|
|
1988 |
if(vendorPricingsChanged){
|
|
|
1989 |
sb.append("\n-Vendor Pricing");
|
|
|
1990 |
optionalChangedValMap.put(OPTIONAL_VENDOR_PRICING, newItem.getVendorPricesMap());
|
|
|
1991 |
}
|
|
|
1992 |
|
|
|
1993 |
SourcePricings sourcePricings;
|
|
|
1994 |
boolean sourcePricingsChanged = false;
|
|
|
1995 |
long sourceId;
|
|
|
1996 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
|
|
1997 |
sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
|
|
1998 |
sourcePricings = item.getSourcePricesMap().get(sourceId);
|
|
|
1999 |
if(sourcePricings == null) {
|
|
|
2000 |
sourcePricingsChanged = true;
|
|
|
2001 |
sb.append("\n-Source Prices (Source:" + sourceId + ")");
|
|
|
2002 |
continue;
|
|
|
2003 |
}
|
|
|
2004 |
if(sourcePricings.getMrp() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP))) {
|
|
|
2005 |
sourcePricingsChanged = true;
|
|
|
2006 |
sb.append("\n-MRP (Source:" + sourceId + ")");
|
|
|
2007 |
}
|
|
|
2008 |
if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
|
|
|
2009 |
sourcePricingsChanged = true;
|
|
|
2010 |
sb.append("\n-Selling Price (Source:" + sourceId + ")");
|
|
|
2011 |
}
|
|
|
2012 |
}
|
|
|
2013 |
if(sourcePricingsChanged){
|
|
|
2014 |
sb.append("\n-Source Pricing");
|
|
|
2015 |
optionalChangedValMap.put(OPTIONAL_SOURCE_PRICING, newItem.getSourcePricesMap());
|
|
|
2016 |
}
|
|
|
2017 |
VendorItemMapping mapping;
|
|
|
2018 |
String old_key, new_key;
|
|
|
2019 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
|
|
2020 |
vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
|
|
2021 |
old_key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY_OLD);
|
|
|
2022 |
new_key = tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_ITEM_KEY);
|
|
|
2023 |
mapping = item.getVendorKeysMap().get(vendorId + Item.KEY_SEPARATOR + old_key);
|
|
|
2024 |
if(mapping == null || !old_key.equals(new_key)) {
|
|
|
2025 |
sb.append("\n-Vendor Key (Vendor:" + vendorId + ",Key: = " + old_key + ")");
|
|
|
2026 |
continue;
|
|
|
2027 |
}
|
|
|
2028 |
}
|
|
|
2029 |
return sb.toString();
|
|
|
2030 |
}
|
|
|
2031 |
|
|
|
2032 |
@SuppressWarnings("unused")
|
| 2566 |
chandransh |
2033 |
private boolean validatePrices() {
|
| 10484 |
vikram.rag |
2034 |
if(newItem.getSellingPrice() > newItem.getMrp()) {
|
|
|
2035 |
Window.alert("Selling price cannot be more than MRP");
|
|
|
2036 |
return false;
|
|
|
2037 |
}
|
|
|
2038 |
for(VendorPricings v : newItem.getVendorPricesMap().values()) {
|
|
|
2039 |
if(newItem.getMrp() < v.getMop()) {
|
|
|
2040 |
Window.alert("MRP cannot be less than MOP. Vendor: " + v.getVendorId());
|
|
|
2041 |
return false;
|
|
|
2042 |
}
|
|
|
2043 |
if(v.getTransferPrice() > v.getMop()) {
|
|
|
2044 |
Window.alert("Transfer Price cannot be more than MOP. Vendor: " + v.getVendorId());
|
|
|
2045 |
return false;
|
|
|
2046 |
}
|
|
|
2047 |
}
|
|
|
2048 |
return true;
|
|
|
2049 |
}
|
| 3558 |
rajveer |
2050 |
|
| 10484 |
vikram.rag |
2051 |
private boolean validateVendorPrices(double mop, double dp, double tp, double nlc) {
|
|
|
2052 |
if(item.getMrp() != null && item.getMrp() < mop) {
|
|
|
2053 |
Window.alert("MOP cannot be more than MRP.");
|
|
|
2054 |
return false;
|
|
|
2055 |
}
|
|
|
2056 |
if(tp > mop) {
|
|
|
2057 |
Window.alert("Transfer Price cannot be more than MOP.");
|
|
|
2058 |
return false;
|
|
|
2059 |
}
|
|
|
2060 |
if(tp < nlc) {
|
|
|
2061 |
Window.alert("Transfer Price cannot be less than NLC.");
|
|
|
2062 |
return false;
|
|
|
2063 |
}
|
|
|
2064 |
return true;
|
|
|
2065 |
}
|
| 3558 |
rajveer |
2066 |
|
| 10484 |
vikram.rag |
2067 |
private boolean validateSourcePrices(double mrp, double sellingPrice) {
|
|
|
2068 |
if(sellingPrice > mrp) {
|
|
|
2069 |
Window.alert("Selling Price cannot be more than MRP.");
|
|
|
2070 |
return false;
|
|
|
2071 |
}
|
|
|
2072 |
return true;
|
|
|
2073 |
}
|
|
|
2074 |
|
|
|
2075 |
|
|
|
2076 |
public long getItemId() {
|
|
|
2077 |
return item == null ? 0 : item.getId();
|
|
|
2078 |
}
|
|
|
2079 |
|
|
|
2080 |
public Item getItem() {
|
|
|
2081 |
return item;
|
|
|
2082 |
}
|
|
|
2083 |
|
|
|
2084 |
private boolean voucherExists(String voucherType) {
|
|
|
2085 |
for(int i = 0; i < tableVouchers.getRowCount(); i++) {
|
|
|
2086 |
if(voucherType.equals(tableVouchers.getText(i, TABLE_INDEX_VOUCHERS_TYPE))) {
|
|
|
2087 |
return false;
|
|
|
2088 |
}
|
|
|
2089 |
}
|
|
|
2090 |
return true;
|
|
|
2091 |
}
|
|
|
2092 |
|
|
|
2093 |
/**
|
|
|
2094 |
* This method is used while adding vendor prices to ensure that there is only one row in the table for a vendor.
|
|
|
2095 |
* @param vendorId
|
|
|
2096 |
* @return true if parameter vendor Id is already added to vendor prices table.
|
|
|
2097 |
* <br>else false
|
|
|
2098 |
*/
|
|
|
2099 |
private boolean vendorExists(long vendorId) {
|
|
|
2100 |
long id;
|
|
|
2101 |
for(int i = 0; i < tableVendorPrices.getRowCount(); i++) {
|
|
|
2102 |
id = Long.parseLong(tableVendorPrices.getText(i, TABLE_INDEX_PRICING_VENDORID));
|
|
|
2103 |
if(vendorId == id) {
|
|
|
2104 |
return false;
|
|
|
2105 |
}
|
|
|
2106 |
}
|
|
|
2107 |
return true;
|
|
|
2108 |
}
|
|
|
2109 |
|
|
|
2110 |
/**
|
|
|
2111 |
* This method is used while adding source prices to ensure that there is only one row in the table for a source.
|
|
|
2112 |
* @param sourceId
|
|
|
2113 |
* @return true if parameter vendor Id is already added to source prices table.
|
|
|
2114 |
* <br>else false
|
|
|
2115 |
*/
|
|
|
2116 |
private boolean sourceExists(long sourceId) {
|
|
|
2117 |
long id;
|
|
|
2118 |
for(int i = 0; i < tableSourcePrices.getRowCount(); i++) {
|
|
|
2119 |
id = Long.parseLong(tableSourcePrices.getText(i, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
|
|
2120 |
if(sourceId == id) {
|
|
|
2121 |
return false;
|
|
|
2122 |
}
|
|
|
2123 |
}
|
|
|
2124 |
return true;
|
|
|
2125 |
}
|
|
|
2126 |
|
|
|
2127 |
/**
|
|
|
2128 |
* This method is used to check if any of the string item attributes is changed by the user.
|
|
|
2129 |
* @param o1
|
|
|
2130 |
* @param o2
|
|
|
2131 |
* @return true if two strings are equal
|
|
|
2132 |
* <br>true if one of them is null and another is empty.
|
|
|
2133 |
* <br>false otherwise
|
|
|
2134 |
*/
|
|
|
2135 |
private boolean checkParameterIfEqual(Object o1, Object o2) {
|
|
|
2136 |
if(o1 == o2) {
|
|
|
2137 |
return true;
|
|
|
2138 |
}
|
|
|
2139 |
if(o1 != null && o2 != null && o1.equals(o2)) {
|
|
|
2140 |
return true;
|
|
|
2141 |
}
|
|
|
2142 |
if((o1 == null && o2.equals("")) || (o2 == null && o1.equals(""))) {
|
|
|
2143 |
return true;
|
|
|
2144 |
}
|
|
|
2145 |
return false;
|
|
|
2146 |
}
|
|
|
2147 |
|
|
|
2148 |
public void setCatalogDashboardPanel(CatalogDashboard catalogDashboardPanel) {
|
|
|
2149 |
this.catalogDashboardPanel = catalogDashboardPanel;
|
|
|
2150 |
}
|
|
|
2151 |
|
|
|
2152 |
private String compareSellingPricewithBreakEven() {
|
|
|
2153 |
String message = "false";
|
|
|
2154 |
if(newItem.getWeight() == null) {
|
|
|
2155 |
Window.alert("Weight is empty.");
|
|
|
2156 |
return message;
|
|
|
2157 |
}
|
|
|
2158 |
if(newItem.getSellingPrice() == null) {
|
|
|
2159 |
Window.alert("Selling Price is empty.");
|
|
|
2160 |
return message;
|
|
|
2161 |
}
|
|
|
2162 |
|
|
|
2163 |
double transferPrice;
|
|
|
2164 |
if(newItem.getPreferredVendor() == null && !newItem.getVendorPricesMap().isEmpty()) {
|
|
|
2165 |
transferPrice = -1;
|
| 4649 |
phani.kuma |
2166 |
for(VendorPricings vendorDetail : newItem.getVendorPricesMap().values()){
|
| 6779 |
rajveer |
2167 |
if(transferPrice > vendorDetail.getNlc() || transferPrice == -1){
|
|
|
2168 |
transferPrice = vendorDetail.getNlc();
|
| 4649 |
phani.kuma |
2169 |
}
|
|
|
2170 |
}
|
| 10484 |
vikram.rag |
2171 |
}
|
|
|
2172 |
else if(!newItem.getVendorPricesMap().isEmpty() && newItem.getVendorPricesMap().containsKey(newItem.getPreferredVendor())){
|
|
|
2173 |
transferPrice = newItem.getVendorPricesMap().get(newItem.getPreferredVendor()).getNlc();
|
|
|
2174 |
}
|
|
|
2175 |
else{
|
|
|
2176 |
Window.alert("Add vendor to Vendor Prices and then change the Selling Price.");
|
|
|
2177 |
return message;
|
|
|
2178 |
}
|
| 4649 |
phani.kuma |
2179 |
|
| 10484 |
vikram.rag |
2180 |
double weightfactor = Math.ceil((newItem.getWeight() * 1000)/Double.parseDouble(ConfigMap.get("courier_weight_factor")));
|
| 4649 |
phani.kuma |
2181 |
double couriercost = Double.parseDouble(ConfigMap.get("courier_cost_factor")) * weightfactor;
|
|
|
2182 |
double costfactor = (Double.parseDouble(ConfigMap.get("transfer_price_percentage")) * transferPrice)/100;
|
|
|
2183 |
double breakeven;
|
|
|
2184 |
if(costfactor < Double.parseDouble(ConfigMap.get("transfer_price_factor"))){
|
|
|
2185 |
breakeven = transferPrice + couriercost + Double.parseDouble(ConfigMap.get("breakeven_additon_factor"));
|
|
|
2186 |
}
|
|
|
2187 |
else{
|
|
|
2188 |
breakeven = (transferPrice + couriercost)/Double.parseDouble(ConfigMap.get("breakeven_divisor"));
|
|
|
2189 |
}
|
| 10484 |
vikram.rag |
2190 |
|
| 4649 |
phani.kuma |
2191 |
if(breakeven > newItem.getSellingPrice()) {
|
|
|
2192 |
message = "Selling Price("+newItem.getSellingPrice()+") is less than Breakeven Price("+breakeven+").";
|
|
|
2193 |
if(Window.confirm(message)){
|
|
|
2194 |
return message;
|
|
|
2195 |
}
|
|
|
2196 |
else{
|
|
|
2197 |
message = "false";
|
|
|
2198 |
Window.alert("Updation of Item is canceled.");
|
|
|
2199 |
return message;
|
|
|
2200 |
}
|
|
|
2201 |
}
|
|
|
2202 |
else {
|
|
|
2203 |
message = "true";
|
| 10484 |
vikram.rag |
2204 |
return message;
|
| 4649 |
phani.kuma |
2205 |
}
|
| 10484 |
vikram.rag |
2206 |
}
|
|
|
2207 |
|
|
|
2208 |
private String checkTransferPriceforPreferredVendor() {
|
|
|
2209 |
String message = "false";
|
|
|
2210 |
if(newItem.getPreferredVendor() == null) {
|
|
|
2211 |
message = "true";
|
|
|
2212 |
return message;
|
|
|
2213 |
}
|
|
|
2214 |
else if(!newItem.getVendorPricesMap().isEmpty() && newItem.getVendorPricesMap().containsKey(newItem.getPreferredVendor())){
|
|
|
2215 |
double transferPrice = newItem.getVendorPricesMap().get(newItem.getPreferredVendor()).getTransferPrice();
|
|
|
2216 |
double mintransferPrice = -1;
|
|
|
2217 |
String minvendor = "";
|
|
|
2218 |
boolean compareTransferPrices = false;
|
| 4649 |
phani.kuma |
2219 |
for(VendorPricings vendorDetail : newItem.getVendorPricesMap().values()){
|
|
|
2220 |
if(mintransferPrice > vendorDetail.getTransferPrice() || mintransferPrice == -1){
|
|
|
2221 |
mintransferPrice = vendorDetail.getTransferPrice();
|
|
|
2222 |
minvendor = Utils.getVendorDesc(vendorDetail.getVendorId());
|
|
|
2223 |
}
|
|
|
2224 |
}
|
|
|
2225 |
if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor()) || item.getVendorPricesMap().isEmpty()) {
|
|
|
2226 |
compareTransferPrices = true;
|
|
|
2227 |
}
|
|
|
2228 |
else {
|
|
|
2229 |
double oldmintransferPrice = -1;
|
|
|
2230 |
for(VendorPricings vendorDetail : item.getVendorPricesMap().values()){
|
|
|
2231 |
if(oldmintransferPrice > vendorDetail.getTransferPrice() || oldmintransferPrice == -1){
|
|
|
2232 |
oldmintransferPrice = vendorDetail.getTransferPrice();
|
|
|
2233 |
}
|
|
|
2234 |
}
|
|
|
2235 |
if(mintransferPrice < oldmintransferPrice){
|
|
|
2236 |
compareTransferPrices = true;
|
|
|
2237 |
}
|
|
|
2238 |
}
|
|
|
2239 |
if(compareTransferPrices && transferPrice > mintransferPrice){
|
|
|
2240 |
message = "Transfer Price("+transferPrice+") of Preferred Vendor("+Utils.getVendorDesc(newItem.getPreferredVendor())+") is more than Transfer Price("+mintransferPrice+") of "+minvendor+".";
|
|
|
2241 |
if(Window.confirm(message)){
|
|
|
2242 |
return message;
|
|
|
2243 |
}
|
|
|
2244 |
else{
|
|
|
2245 |
message = "false";
|
|
|
2246 |
Window.alert("Updation of Item is canceled.");
|
|
|
2247 |
return message;
|
|
|
2248 |
}
|
|
|
2249 |
}
|
|
|
2250 |
else {
|
|
|
2251 |
message = "true";
|
| 10484 |
vikram.rag |
2252 |
return message;
|
| 4649 |
phani.kuma |
2253 |
}
|
| 10484 |
vikram.rag |
2254 |
}
|
|
|
2255 |
else{
|
|
|
2256 |
Window.alert("Add vendor to Vendor Prices and then change the Preferred Vendor.");
|
|
|
2257 |
return message;
|
|
|
2258 |
}
|
|
|
2259 |
}
|
| 5217 |
amit.gupta |
2260 |
|
| 10484 |
vikram.rag |
2261 |
public void logAuthorization(String message) {
|
|
|
2262 |
String username = catalogDashboardPanel.uname;
|
|
|
2263 |
catalogService.addAuthorizationLog(newItem.getId(), username, message, new AsyncCallback<Boolean>() {
|
|
|
2264 |
@Override
|
|
|
2265 |
public void onSuccess(Boolean result) {
|
|
|
2266 |
if(result) {
|
|
|
2267 |
GWT.log("Event is added");
|
|
|
2268 |
}
|
|
|
2269 |
else {
|
|
|
2270 |
GWT.log("Error adding the event");
|
|
|
2271 |
Window.alert("Error adding the event");
|
|
|
2272 |
}
|
|
|
2273 |
}
|
|
|
2274 |
@Override
|
|
|
2275 |
public void onFailure(Throwable caught) {
|
|
|
2276 |
caught.printStackTrace();
|
|
|
2277 |
Window.alert("Error while adding the event");
|
|
|
2278 |
}
|
|
|
2279 |
});
|
|
|
2280 |
}
|
|
|
2281 |
|
| 5217 |
amit.gupta |
2282 |
@Override
|
|
|
2283 |
public void setComingSoonStartDate(Date date) {
|
|
|
2284 |
this.comingSoonStartDate.setValue(date);
|
| 10484 |
vikram.rag |
2285 |
|
| 5217 |
amit.gupta |
2286 |
}
|
|
|
2287 |
|
|
|
2288 |
@Override
|
|
|
2289 |
public void setBestDealsText(String bestDealsText) {
|
|
|
2290 |
this.bestDealsText.setValue(bestDealsText);
|
| 10484 |
vikram.rag |
2291 |
|
| 5217 |
amit.gupta |
2292 |
}
|
|
|
2293 |
|
|
|
2294 |
@Override
|
|
|
2295 |
public void setExpectedArrivalDate(Date date) {
|
|
|
2296 |
this.expectedArrivalDate.setValue(date);
|
| 10484 |
vikram.rag |
2297 |
|
| 5217 |
amit.gupta |
2298 |
}
|
|
|
2299 |
|
|
|
2300 |
@Override
|
|
|
2301 |
public String getBestDealsText() {
|
|
|
2302 |
return this.bestDealsText.getValue();
|
|
|
2303 |
}
|
| 7291 |
vikram.rag |
2304 |
|
| 6777 |
vikram.rag |
2305 |
public void setBestDealsDetailsText(String bestDealsDetailsText) {
|
|
|
2306 |
this.bestDealsDetailsText.setValue(bestDealsDetailsText);
|
| 10484 |
vikram.rag |
2307 |
|
| 6777 |
vikram.rag |
2308 |
}
|
| 10484 |
vikram.rag |
2309 |
|
| 6777 |
vikram.rag |
2310 |
public String getBestDealsDetailsText() {
|
|
|
2311 |
return this.bestDealsDetailsText.getValue();
|
|
|
2312 |
}
|
| 5217 |
amit.gupta |
2313 |
|
|
|
2314 |
@Override
|
|
|
2315 |
public Date getComingSoonStartDate() {
|
|
|
2316 |
return this.comingSoonStartDate.getValue();
|
|
|
2317 |
}
|
|
|
2318 |
|
|
|
2319 |
@Override
|
|
|
2320 |
public Date getExpectedArrivalDate() {
|
|
|
2321 |
return this.expectedArrivalDate.getValue();
|
|
|
2322 |
}
|
|
|
2323 |
@UiHandler("comingSoonButton")
|
|
|
2324 |
void onComingSoonButtonClick(ClickEvent event) {
|
|
|
2325 |
ComingSoonDialog cd = new ComingSoonDialog(this);
|
|
|
2326 |
cd.show();
|
|
|
2327 |
}
|
| 10484 |
vikram.rag |
2328 |
|
| 5427 |
amit.gupta |
2329 |
private void createDialog(String changedString) {
|
| 10484 |
vikram.rag |
2330 |
VerticalPanel vp = new VerticalPanel();
|
|
|
2331 |
final DialogBox db = new DialogBox();
|
|
|
2332 |
db.setText("Changed fields");
|
|
|
2333 |
|
|
|
2334 |
vp.add(new Label("Check the fields to update all SKUs with similar entity."));
|
|
|
2335 |
vp.add(new Label("--------------------------------------------------------"));
|
|
|
2336 |
CheckBox allChecked = new CheckBox("Select all");
|
|
|
2337 |
if(optionalChangedValMap.size()>1){
|
|
|
2338 |
allChecked.setName("all");
|
|
|
2339 |
allChecked.addClickHandler(new ClickHandler() {
|
| 5427 |
amit.gupta |
2340 |
@Override
|
|
|
2341 |
public void onClick(ClickEvent event) {
|
|
|
2342 |
CheckBox cb = (CheckBox)event.getSource();
|
|
|
2343 |
VerticalPanel vp = (VerticalPanel)cb.getParent();
|
|
|
2344 |
Iterator<Widget> iterator = vp.iterator();
|
|
|
2345 |
while(iterator.hasNext()){
|
|
|
2346 |
Widget w = iterator.next();
|
|
|
2347 |
if(w instanceof CheckBox){
|
|
|
2348 |
CheckBox cbox = (CheckBox)w;
|
|
|
2349 |
if(cbox.getName()!="all"){
|
|
|
2350 |
cbox.setValue(cb.getValue());
|
|
|
2351 |
}
|
|
|
2352 |
}
|
|
|
2353 |
}
|
|
|
2354 |
if(cb.getValue()){
|
|
|
2355 |
cb.setText("Deselect all");
|
|
|
2356 |
}else {
|
|
|
2357 |
cb.setText("Select all");
|
|
|
2358 |
}
|
|
|
2359 |
}
|
|
|
2360 |
});
|
| 10484 |
vikram.rag |
2361 |
vp.add(allChecked);
|
|
|
2362 |
}
|
|
|
2363 |
String[] changedFields = changedString.split("\n-");
|
|
|
2364 |
for(String changeField : changedFields){
|
|
|
2365 |
if(optionalChangedValMap.containsKey(changeField)){
|
|
|
2366 |
CheckBox ch = new CheckBox(changeField);
|
|
|
2367 |
ch.getElement().getStyle().setPadding(10d, Unit.PX);
|
|
|
2368 |
vp.add(ch);
|
|
|
2369 |
} else {
|
|
|
2370 |
Label l = new Label(changeField);
|
|
|
2371 |
l.getElement().getStyle().setMarginLeft(10d, Unit.PX);
|
|
|
2372 |
l.getElement().getStyle().setPadding(10d, Unit.PX);
|
|
|
2373 |
vp.add(l);
|
|
|
2374 |
}
|
|
|
2375 |
}
|
| 5427 |
amit.gupta |
2376 |
|
| 10484 |
vikram.rag |
2377 |
Button submitButton = new Button();
|
|
|
2378 |
submitButton.setText("Update");
|
|
|
2379 |
submitButton.addClickHandler(new ClickHandler() {
|
|
|
2380 |
|
| 5427 |
amit.gupta |
2381 |
@Override
|
|
|
2382 |
public void onClick(ClickEvent event) {
|
|
|
2383 |
Button b = (Button)event.getSource();
|
|
|
2384 |
VerticalPanel vp = (VerticalPanel)b.getParent();
|
|
|
2385 |
Iterator<Widget> iterator = vp.iterator();
|
|
|
2386 |
while(iterator.hasNext()){
|
|
|
2387 |
Widget w = iterator.next();
|
|
|
2388 |
if(w instanceof CheckBox){
|
|
|
2389 |
CheckBox cbox = (CheckBox)w;
|
|
|
2390 |
if(cbox.getName()!="all"){
|
|
|
2391 |
if(!cbox.getValue()){
|
|
|
2392 |
optionalChangedValMap.remove(cbox.getText());
|
|
|
2393 |
}
|
|
|
2394 |
}
|
|
|
2395 |
}
|
|
|
2396 |
}
|
|
|
2397 |
db.hide();
|
|
|
2398 |
List<Item> items = new ArrayList<Item>();
|
|
|
2399 |
items.add(newItem);
|
|
|
2400 |
validateNUpdate();
|
|
|
2401 |
/*for(Long id : item.getSameItemsWithDifferentColors()){
|
|
|
2402 |
catalogService.getItem(id, new AsyncCallback<Item>() {
|
|
|
2403 |
@Override
|
|
|
2404 |
public void onSuccess(Item result) {
|
|
|
2405 |
items.add(e)
|
|
|
2406 |
}
|
|
|
2407 |
@Override
|
|
|
2408 |
public void onFailure(Throwable caught) {
|
|
|
2409 |
caught.printStackTrace();
|
|
|
2410 |
Window.alert("Unable to fetch item details.");
|
|
|
2411 |
}
|
|
|
2412 |
});
|
|
|
2413 |
}*/
|
|
|
2414 |
}
|
| 10484 |
vikram.rag |
2415 |
|
| 5427 |
amit.gupta |
2416 |
});
|
| 10484 |
vikram.rag |
2417 |
vp.add(submitButton);
|
|
|
2418 |
db.add(vp);
|
|
|
2419 |
db.center();
|
|
|
2420 |
db.show();
|
|
|
2421 |
}
|
|
|
2422 |
|
| 5427 |
amit.gupta |
2423 |
private void updateItem(Long itemId) {
|
|
|
2424 |
catalogService.getItem(itemId, new AsyncCallback<Item>() {
|
| 10484 |
vikram.rag |
2425 |
@Override
|
|
|
2426 |
public void onSuccess(Item result) {
|
|
|
2427 |
final Item res = result;
|
|
|
2428 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BRAND)){
|
|
|
2429 |
result.setBrand((String)mandatoryChangedValMap.get(MANDATORY_BRAND));
|
|
|
2430 |
}
|
|
|
2431 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_TEXT)){
|
|
|
2432 |
result.setBestDealsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_TEXT));
|
|
|
2433 |
}
|
|
|
2434 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_DETAIL_TEXT)){
|
|
|
2435 |
result.setBestDealsDetailsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_DETAIL_TEXT));
|
|
|
2436 |
}
|
|
|
2437 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_DETAIL_LINK)){
|
|
|
2438 |
result.setBestDealsDetailsLink((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_DETAIL_LINK));
|
|
|
2439 |
}
|
|
|
2440 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NAME)){
|
|
|
2441 |
result.setModelName((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NAME));
|
|
|
2442 |
}
|
|
|
2443 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NO)){
|
|
|
2444 |
result.setModelNumber((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NO));
|
|
|
2445 |
}
|
|
|
2446 |
if(mandatoryChangedValMap.containsKey(MANDATORY_WEIGHT)){
|
|
|
2447 |
result.setWeight((Double)mandatoryChangedValMap.get(MANDATORY_WEIGHT));
|
|
|
2448 |
}
|
|
|
2449 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MRP)){
|
|
|
2450 |
result.setMrp((Double)mandatoryChangedValMap.get(MANDATORY_MRP));
|
|
|
2451 |
}
|
|
|
2452 |
if(optionalChangedValMap.containsKey(OPTIONAL_FREEBIE_ITEM_ID)) {
|
|
|
2453 |
result.setFreebieItemId((Long)optionalChangedValMap.get(OPTIONAL_FREEBIE_ITEM_ID));
|
|
|
2454 |
}
|
|
|
2455 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_VENDOR)){
|
|
|
2456 |
result.setPreferredVendor((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_VENDOR));
|
|
|
2457 |
}
|
|
|
2458 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_INSURER)){
|
|
|
2459 |
result.setPreferredInsurer((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_INSURER));
|
|
|
2460 |
}
|
|
|
2461 |
if(optionalChangedValMap.containsKey(OPTIONAL_SELLING_PRICE)){
|
|
|
2462 |
result.setSellingPrice((Double)optionalChangedValMap.get(OPTIONAL_SELLING_PRICE));
|
|
|
2463 |
}
|
|
|
2464 |
if(optionalChangedValMap.containsKey(OPTIONAL_SOURCE_PRICING)){
|
|
|
2465 |
result.setSourcePricesMap((Map<Long, SourcePricings>) optionalChangedValMap.get(OPTIONAL_SOURCE_PRICING));
|
|
|
2466 |
}
|
|
|
2467 |
if(optionalChangedValMap.containsKey(OPTIONAL_VENDOR_PRICING)){
|
|
|
2468 |
result.setVendorPricesMap((Map<Long, VendorPricings>) optionalChangedValMap.get(OPTIONAL_VENDOR_PRICING));
|
|
|
2469 |
}
|
|
|
2470 |
catalogService.updateItem(result, new AsyncCallback<Boolean>() {
|
|
|
2471 |
|
| 5427 |
amit.gupta |
2472 |
@Override
|
|
|
2473 |
public void onSuccess(Boolean result1) {
|
|
|
2474 |
if(result1) {
|
|
|
2475 |
Window.alert(res.getId() + " updated Successfully");
|
|
|
2476 |
}
|
| 10484 |
vikram.rag |
2477 |
|
| 5427 |
amit.gupta |
2478 |
}
|
| 10484 |
vikram.rag |
2479 |
|
| 5427 |
amit.gupta |
2480 |
@Override
|
|
|
2481 |
public void onFailure(Throwable caught) {
|
|
|
2482 |
caught.printStackTrace();
|
|
|
2483 |
Window.alert("Error updating item " + res.getId());
|
| 10484 |
vikram.rag |
2484 |
|
| 5427 |
amit.gupta |
2485 |
}
|
|
|
2486 |
});
|
| 10484 |
vikram.rag |
2487 |
}
|
|
|
2488 |
@Override
|
|
|
2489 |
public void onFailure(Throwable caught) {
|
|
|
2490 |
caught.printStackTrace();
|
|
|
2491 |
Window.alert("Unable to fetch item details.");
|
|
|
2492 |
}
|
|
|
2493 |
});
|
| 5427 |
amit.gupta |
2494 |
}
|
| 6241 |
amit.gupta |
2495 |
|
|
|
2496 |
@Override
|
|
|
2497 |
public void setShowPrice(boolean b) {
|
|
|
2498 |
this.showSellingPrice.setValue(b);
|
|
|
2499 |
}
|
|
|
2500 |
|
|
|
2501 |
@Override
|
|
|
2502 |
public boolean isShowPrice() {
|
|
|
2503 |
return this.showSellingPrice.getValue();
|
|
|
2504 |
}
|
| 1961 |
ankur.sing |
2505 |
}
|