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