| Line 5... |
Line 5... |
| 5 |
import in.shop2020.catalog.dashboard.shared.SourcePricings;
|
5 |
import in.shop2020.catalog.dashboard.shared.SourcePricings;
|
| 6 |
import in.shop2020.catalog.dashboard.shared.Utils;
|
6 |
import in.shop2020.catalog.dashboard.shared.Utils;
|
| 7 |
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
|
7 |
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
|
| 8 |
import in.shop2020.catalog.dashboard.shared.VendorPricings;
|
8 |
import in.shop2020.catalog.dashboard.shared.VendorPricings;
|
| 9 |
|
9 |
|
| - |
|
10 |
import java.util.ArrayList;
|
| 10 |
import java.util.Date;
|
11 |
import java.util.Date;
|
| 11 |
import java.util.HashMap;
|
12 |
import java.util.HashMap;
|
| - |
|
13 |
import java.util.Iterator;
|
| - |
|
14 |
import java.util.List;
|
| 12 |
import java.util.Map;
|
15 |
import java.util.Map;
|
| 13 |
import java.util.Map.Entry;
|
16 |
import java.util.Map.Entry;
|
| 14 |
|
17 |
|
| 15 |
import com.google.gwt.core.client.GWT;
|
18 |
import com.google.gwt.core.client.GWT;
|
| - |
|
19 |
import com.google.gwt.dom.client.Style.Unit;
|
| 16 |
import com.google.gwt.event.dom.client.ClickEvent;
|
20 |
import com.google.gwt.event.dom.client.ClickEvent;
|
| 17 |
import com.google.gwt.event.dom.client.ClickHandler;
|
21 |
import com.google.gwt.event.dom.client.ClickHandler;
|
| 18 |
import com.google.gwt.resources.client.CssResource;
|
22 |
import com.google.gwt.resources.client.CssResource;
|
| 19 |
import com.google.gwt.uibinder.client.UiBinder;
|
23 |
import com.google.gwt.uibinder.client.UiBinder;
|
| 20 |
import com.google.gwt.uibinder.client.UiField;
|
24 |
import com.google.gwt.uibinder.client.UiField;
|
| - |
|
25 |
import com.google.gwt.uibinder.client.UiHandler;
|
| 21 |
import com.google.gwt.user.client.Window;
|
26 |
import com.google.gwt.user.client.Window;
|
| 22 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
27 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
| 23 |
import com.google.gwt.user.client.ui.Button;
|
28 |
import com.google.gwt.user.client.ui.Button;
|
| 24 |
import com.google.gwt.user.client.ui.CheckBox;
|
29 |
import com.google.gwt.user.client.ui.CheckBox;
|
| - |
|
30 |
import com.google.gwt.user.client.ui.DialogBox;
|
| 25 |
import com.google.gwt.user.client.ui.FlexTable;
|
31 |
import com.google.gwt.user.client.ui.FlexTable;
|
| 26 |
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
32 |
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
| 27 |
import com.google.gwt.user.client.ui.Label;
|
33 |
import com.google.gwt.user.client.ui.Label;
|
| 28 |
import com.google.gwt.user.client.ui.ListBox;
|
34 |
import com.google.gwt.user.client.ui.ListBox;
|
| 29 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
35 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
| 30 |
import com.google.gwt.user.client.ui.TextBox;
|
36 |
import com.google.gwt.user.client.ui.TextBox;
|
| - |
|
37 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 31 |
import com.google.gwt.user.client.ui.Widget;
|
38 |
import com.google.gwt.user.client.ui.Widget;
|
| 32 |
import com.google.gwt.user.datepicker.client.DateBox;
|
39 |
import com.google.gwt.user.datepicker.client.DateBox;
|
| 33 |
import com.google.gwt.uibinder.client.UiHandler;
|
- |
|
| 34 |
|
40 |
|
| 35 |
/**
|
41 |
/**
|
| 36 |
* Panel contains fields for item details. Some of these fields are editable.
|
42 |
* Panel contains fields for item details. Some of these fields are editable.
|
| 37 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
43 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
| 38 |
* Item availability is made invisible for time being
|
44 |
* Item availability is made invisible for time being
|
| Line 71... |
Line 77... |
| 71 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER = 3,
|
77 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NUMBER = 3,
|
| 72 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME = 4,
|
78 |
TABLE_INDEX_SIMILAR_ITEMS_MODEL_NAME = 4,
|
| 73 |
TABLE_INDEX_SIMILAR_ITEMS_CATEGORY = 5,
|
79 |
TABLE_INDEX_SIMILAR_ITEMS_CATEGORY = 5,
|
| 74 |
TABLE_INDEX_SIMILAR_ITEMS_BUTTON = 6;
|
80 |
TABLE_INDEX_SIMILAR_ITEMS_BUTTON = 6;
|
| 75 |
|
81 |
|
| - |
|
82 |
private final String MANDATORY_MRP = "MRP",
|
| - |
|
83 |
MANDATORY_WEIGHT = "Weight",
|
| - |
|
84 |
MANDATORY_BEST_DEAL_TEXT = "Best Deal Text",
|
| - |
|
85 |
MANDATORY_BRAND = "Brand",
|
| - |
|
86 |
MANDATORY_MODEL_NO = "Model Number",
|
| - |
|
87 |
MANDATORY_MODEL_NAME = "Model Name";
|
| - |
|
88 |
|
| - |
|
89 |
private final String OPTIONAL_SELLING_PRICE = "Selling Price",
|
| - |
|
90 |
OPTIONAL_VENDOR_PRICING = "Vendor Pricing",
|
| - |
|
91 |
OPTIONAL_PREFERRED_VENDOR = "Preferred Vendor",
|
| - |
|
92 |
OPTIONAL_SOURCE_PRICING = "Source Pricing";
|
| - |
|
93 |
|
| 76 |
private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
|
94 |
private final String PRICE_WIDTH = "100px", VENDOR_DESC_WIDTH = "130px",
|
| 77 |
VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
|
95 |
VENDOR_ID_WIDTH = "100px", ITEM_KEY_WIDTH = "200px",
|
| 78 |
BUTTON_WIDTH = "50px";
|
96 |
BUTTON_WIDTH = "50px";
|
| 79 |
|
97 |
|
| 80 |
private Map<String, String> ConfigMap;
|
98 |
private Map<String, String> ConfigMap;
|
| 81 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {}
|
99 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {}
|
| 82 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
100 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
| 83 |
private final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
|
101 |
private final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
|
| - |
|
102 |
Map<String, Object> mandatoryChangedValMap;
|
| - |
|
103 |
Map<String, Object> optionalChangedValMap;
|
| 84 |
|
104 |
|
| 85 |
|
105 |
|
| 86 |
interface ItemDetailStyle extends CssResource{
|
106 |
interface ItemDetailStyle extends CssResource{
|
| 87 |
String greenLabel();
|
107 |
String greenLabel();
|
| 88 |
String fieldChanged();
|
108 |
String fieldChanged();
|
| Line 766... |
Line 786... |
| 766 |
}
|
786 |
}
|
| 767 |
try {
|
787 |
try {
|
| 768 |
if(!createNewItem()) {
|
788 |
if(!createNewItem()) {
|
| 769 |
return;
|
789 |
return;
|
| 770 |
}
|
790 |
}
|
| 771 |
String paramsChanged = isItemChanged();
|
- |
|
| 772 |
if(paramsChanged.equals("")) {
|
- |
|
| 773 |
Window.alert("Nothing to update. Please change intended item parameters and try again.");
|
- |
|
| 774 |
return;
|
- |
|
| 775 |
} else {
|
- |
|
| 776 |
paramsChanged = "You have changed following items.\n" + paramsChanged;
|
- |
|
| 777 |
Window.alert(paramsChanged);
|
- |
|
| 778 |
}
|
- |
|
| 779 |
} catch(NumberFormatException ex) {
|
791 |
} catch(NumberFormatException ex) {
|
| 780 |
ex.printStackTrace();
|
792 |
ex.printStackTrace();
|
| 781 |
GWT.log("Number format exception");
|
793 |
GWT.log("Number format exception");
|
| 782 |
}
|
794 |
}
|
| - |
|
795 |
String paramsChanged = isItemChanged();
|
| - |
|
796 |
if(paramsChanged.equals("")) {
|
| - |
|
797 |
Window.alert("Nothing to update. Please change intended item parameters and try again.");
|
| - |
|
798 |
return;
|
| - |
|
799 |
} else {
|
| - |
|
800 |
if(item.getSameItemsWithDifferentColors().size()>0 && optionalChangedValMap.size()>0 ){
|
| - |
|
801 |
createDialog(paramsChanged);
|
| - |
|
802 |
} else {
|
| - |
|
803 |
paramsChanged = "You have changed following items.\n" + paramsChanged;
|
| - |
|
804 |
Window.alert(paramsChanged);
|
| - |
|
805 |
validateNUpdate();
|
| - |
|
806 |
}
|
| - |
|
807 |
}
|
| - |
|
808 |
}
|
| - |
|
809 |
|
| - |
|
810 |
|
| - |
|
811 |
private void validateNUpdate() {
|
| 783 |
if(!Utils.validateItem(newItem)) {
|
812 |
if(!Utils.validateItem(newItem)) {
|
| 784 |
return;
|
813 |
return;
|
| 785 |
}
|
814 |
}
|
| 786 |
|
815 |
|
| 787 |
final String[] messageList = new String[2];
|
816 |
final String[] messageList = new String[2];
|
| 788 |
|
817 |
|
| Line 812... |
Line 841... |
| 812 |
for(int i = 0; i < messageList.length; i++) {
|
841 |
for(int i = 0; i < messageList.length; i++) {
|
| 813 |
if(messageList[i] != null) {
|
842 |
if(messageList[i] != null) {
|
| 814 |
logAuthorization(messageList[i]);
|
843 |
logAuthorization(messageList[i]);
|
| 815 |
}
|
844 |
}
|
| 816 |
}
|
845 |
}
|
| - |
|
846 |
if(optionalChangedValMap.size()>0 || mandatoryChangedValMap.size()>0){
|
| - |
|
847 |
for(Long itemId : item.getSameItemsWithDifferentColors()){
|
| - |
|
848 |
updateItem(itemId);
|
| - |
|
849 |
}
|
| - |
|
850 |
}
|
| 817 |
item = newItem;
|
851 |
item = newItem;
|
| 818 |
GWT.log("Item updated. Id = " + item.getId());
|
852 |
GWT.log("Item updated. Id = " + item.getId());
|
| 819 |
catalogDashboardPanel.getItemListWidget().updateItem(item);
|
853 |
catalogDashboardPanel.getItemListWidget().updateItem(item);
|
| 820 |
getFreshItemFromDB(item.getId());
|
854 |
getFreshItemFromDB(item.getId());
|
| 821 |
Window.alert("Item updated successfully.");
|
855 |
Window.alert("Item updated successfully.");
|
| Line 1111... |
Line 1145... |
| 1111 |
* @return String showing attributes which are changed by the user for confirmation.
|
1145 |
* @return String showing attributes which are changed by the user for confirmation.
|
| 1112 |
* <br>Empty string if nothing is changed.
|
1146 |
* <br>Empty string if nothing is changed.
|
| 1113 |
*/
|
1147 |
*/
|
| 1114 |
private String isItemChanged() {
|
1148 |
private String isItemChanged() {
|
| 1115 |
StringBuilder sb = new StringBuilder("");
|
1149 |
StringBuilder sb = new StringBuilder("");
|
| - |
|
1150 |
mandatoryChangedValMap = new HashMap<String, Object>();
|
| 1116 |
|
1151 |
optionalChangedValMap = new HashMap<String, Object>();
|
| 1117 |
if(!checkParameterIfEqual(brand.getText().trim(), item.getBrand())) {
|
1152 |
if(!checkParameterIfEqual(brand.getText().trim(), item.getBrand())) {
|
| - |
|
1153 |
mandatoryChangedValMap.put(MANDATORY_BRAND, brand.getText().trim());
|
| 1118 |
sb.append("\n-Brand");
|
1154 |
sb.append("\n-Brand");
|
| 1119 |
}
|
1155 |
}
|
| 1120 |
if(!checkParameterIfEqual(modelNumber.getText().trim(), item.getModelNumber())) {
|
1156 |
if(!checkParameterIfEqual(modelNumber.getText().trim(), item.getModelNumber())) {
|
| - |
|
1157 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NO, modelNumber.getText().trim());
|
| 1121 |
sb.append("\n-Model Number");
|
1158 |
sb.append("\n-Model Number");
|
| 1122 |
}
|
1159 |
}
|
| 1123 |
if(!checkParameterIfEqual(modelName.getText().trim(), item.getModelName())) {
|
1160 |
if(!checkParameterIfEqual(modelName.getText().trim(), item.getModelName())) {
|
| - |
|
1161 |
mandatoryChangedValMap.put(MANDATORY_MODEL_NAME, modelName.getText().trim());
|
| 1124 |
sb.append("\n-Model Name");
|
1162 |
sb.append("\n-Model Name");
|
| 1125 |
}
|
1163 |
}
|
| 1126 |
if(!checkParameterIfEqual(color.getText().trim(), item.getColor())) {
|
1164 |
if(!checkParameterIfEqual(color.getText().trim(), item.getColor())) {
|
| 1127 |
sb.append("\n-Color");
|
1165 |
sb.append("\n-Color");
|
| 1128 |
}
|
1166 |
}
|
| Line 1131... |
Line 1169... |
| 1131 |
}
|
1169 |
}
|
| 1132 |
if(!checkParameterIfEqual(comments.getText().trim(), item.getComments())) {
|
1170 |
if(!checkParameterIfEqual(comments.getText().trim(), item.getComments())) {
|
| 1133 |
sb.append("\n-Comments");
|
1171 |
sb.append("\n-Comments");
|
| 1134 |
}
|
1172 |
}
|
| 1135 |
if(!checkParameterIfEqual(newItem.getMrp(), item.getMrp())) {
|
1173 |
if(!checkParameterIfEqual(newItem.getMrp(), item.getMrp())) {
|
| - |
|
1174 |
mandatoryChangedValMap.put(MANDATORY_MRP, newItem.getMrp());
|
| 1136 |
sb.append("\n-MRP");
|
1175 |
sb.append("\n-MRP");
|
| 1137 |
}
|
1176 |
}
|
| 1138 |
if(!checkParameterIfEqual(newItem.getSellingPrice(), item.getSellingPrice())) {
|
1177 |
if(!checkParameterIfEqual(newItem.getSellingPrice(), item.getSellingPrice())) {
|
| - |
|
1178 |
optionalChangedValMap.put(OPTIONAL_SELLING_PRICE, newItem.getSellingPrice());
|
| 1139 |
sb.append("\n-Selling Price");
|
1179 |
sb.append("\n-Selling Price");
|
| 1140 |
}
|
1180 |
}
|
| 1141 |
if(!checkParameterIfEqual(newItem.getWeight(), item.getWeight())) {
|
1181 |
if(!checkParameterIfEqual(newItem.getWeight(), item.getWeight())) {
|
| - |
|
1182 |
mandatoryChangedValMap.put(MANDATORY_WEIGHT, newItem.getWeight());
|
| 1142 |
sb.append("\n-Weight");
|
1183 |
sb.append("\n-Weight");
|
| 1143 |
}
|
1184 |
}
|
| 1144 |
if(!checkParameterIfEqual(bestDealsText.getText().trim(), item.getBestDealsText())) {
|
1185 |
if(!checkParameterIfEqual(bestDealsText.getText().trim(), item.getBestDealsText())) {
|
| - |
|
1186 |
mandatoryChangedValMap.put(MANDATORY_BEST_DEAL_TEXT, bestDealsText.getText().trim());
|
| 1145 |
sb.append("\n-Best Deal Text");
|
1187 |
sb.append("\n-Best Deal Text");
|
| 1146 |
}
|
1188 |
}
|
| 1147 |
if(!checkParameterIfEqual(newItem.getBestDealsValue(), item.getBestDealsValue())) {
|
1189 |
if(!checkParameterIfEqual(newItem.getBestDealsValue(), item.getBestDealsValue())) {
|
| 1148 |
sb.append("\n-Best Deal Value");
|
1190 |
sb.append("\n-Best Deal Value");
|
| 1149 |
}
|
1191 |
}
|
| Line 1170... |
Line 1212... |
| 1170 |
}
|
1212 |
}
|
| 1171 |
if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
|
1213 |
if(item.isWarehouseStickiness() != warehouseStickiness.getValue()) {
|
| 1172 |
sb.append("\n-Warehouse Stickiness Flag");
|
1214 |
sb.append("\n-Warehouse Stickiness Flag");
|
| 1173 |
}
|
1215 |
}
|
| 1174 |
if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
|
1216 |
if(!checkParameterIfEqual(newItem.getPreferredVendor(), item.getPreferredVendor())) {
|
| - |
|
1217 |
optionalChangedValMap.put(OPTIONAL_PREFERRED_VENDOR, newItem.getPreferredVendor());
|
| 1175 |
sb.append("\n-Preferred Vendor");
|
1218 |
sb.append("\n-Preferred Vendor");
|
| 1176 |
}
|
1219 |
}
|
| 1177 |
if(item.isHasItemNo() != hasItemNo.getValue()) {
|
1220 |
if(item.isHasItemNo() != hasItemNo.getValue()) {
|
| 1178 |
sb.append("\n-Has Item Number Flag");
|
1221 |
sb.append("\n-Has Item Number Flag");
|
| 1179 |
}
|
1222 |
}
|
| Line 1181... |
Line 1224... |
| 1181 |
sb.append("\n-Has Serial Number Flag");
|
1224 |
sb.append("\n-Has Serial Number Flag");
|
| 1182 |
}
|
1225 |
}
|
| 1183 |
|
1226 |
|
| 1184 |
VendorPricings vendorPricings;
|
1227 |
VendorPricings vendorPricings;
|
| 1185 |
long vendorId;
|
1228 |
long vendorId;
|
| - |
|
1229 |
boolean vendorPricingsChanged = false;
|
| 1186 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
1230 |
for(int row = 0; row < tableVendorPrices.getRowCount(); row++) {
|
| 1187 |
vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
1231 |
vendorId = Long.parseLong(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_VENDORID));
|
| 1188 |
vendorPricings = item.getVendorPricesMap().get(vendorId);
|
1232 |
vendorPricings = item.getVendorPricesMap().get(vendorId);
|
| 1189 |
if(vendorPricings == null) {
|
1233 |
if(vendorPricings == null) {
|
| 1190 |
sb.append("\n-Vendor Prices (Vendor:" + vendorId + ")");
|
1234 |
sb.append("\n-Vendor Prices (Vendor:" + vendorId + ")");
|
| - |
|
1235 |
vendorPricingsChanged = true;
|
| 1191 |
continue;
|
1236 |
continue;
|
| 1192 |
}
|
1237 |
}
|
| 1193 |
if(vendorPricings.getMop() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP))) {
|
1238 |
if(vendorPricings.getMop() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_MOP))) {
|
| - |
|
1239 |
vendorPricingsChanged = true;
|
| 1194 |
sb.append("\n-MOP (Vendor:" + vendorId + ")");
|
1240 |
sb.append("\n-MOP (Vendor:" + vendorId + ")");
|
| 1195 |
}
|
1241 |
}
|
| 1196 |
if(vendorPricings.getDealerPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP))) {
|
1242 |
if(vendorPricings.getDealerPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_DP))) {
|
| - |
|
1243 |
vendorPricingsChanged = true;
|
| 1197 |
sb.append("\n-Dealer Price (Vendor:" + vendorId + ")");
|
1244 |
sb.append("\n-Dealer Price (Vendor:" + vendorId + ")");
|
| 1198 |
}
|
1245 |
}
|
| 1199 |
if(vendorPricings.getTransferPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP))) {
|
1246 |
if(vendorPricings.getTransferPrice() != Double.parseDouble(tableVendorPrices.getText(row, TABLE_INDEX_PRICING_TP))) {
|
| 1200 |
sb.append("\n-Transfer Price (Vendor:" + vendorId + ")");
|
1247 |
vendorPricingsChanged = true;
|
| 1201 |
}
|
1248 |
}
|
| 1202 |
}
|
1249 |
}
|
| - |
|
1250 |
if(vendorPricingsChanged){
|
| - |
|
1251 |
sb.append("\n-Vendor Pricing");
|
| - |
|
1252 |
optionalChangedValMap.put(OPTIONAL_VENDOR_PRICING, newItem.getVendorPricesMap());
|
| - |
|
1253 |
}
|
| 1203 |
|
1254 |
|
| 1204 |
SourcePricings sourcePricings;
|
1255 |
SourcePricings sourcePricings;
|
| - |
|
1256 |
boolean sourcePricingsChanged = false;
|
| 1205 |
long sourceId;
|
1257 |
long sourceId;
|
| 1206 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
1258 |
for(int row = 0; row < tableSourcePrices.getRowCount(); row++) {
|
| 1207 |
sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
1259 |
sourceId = Long.parseLong(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SOURCE_ID));
|
| 1208 |
sourcePricings = item.getSourcePricesMap().get(sourceId);
|
1260 |
sourcePricings = item.getSourcePricesMap().get(sourceId);
|
| 1209 |
if(sourcePricings == null) {
|
1261 |
if(sourcePricings == null) {
|
| - |
|
1262 |
sourcePricingsChanged = true;
|
| 1210 |
sb.append("\n-Source Prices (Source:" + sourceId + ")");
|
1263 |
sb.append("\n-Source Prices (Source:" + sourceId + ")");
|
| 1211 |
continue;
|
1264 |
continue;
|
| 1212 |
}
|
1265 |
}
|
| 1213 |
if(sourcePricings.getMrp() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP))) {
|
1266 |
if(sourcePricings.getMrp() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_MRP))) {
|
| - |
|
1267 |
sourcePricingsChanged = true;
|
| 1214 |
sb.append("\n-MRP (Source:" + sourceId + ")");
|
1268 |
sb.append("\n-MRP (Source:" + sourceId + ")");
|
| 1215 |
}
|
1269 |
}
|
| 1216 |
if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
|
1270 |
if(sourcePricings.getSellingPrice() != Double.parseDouble(tableSourcePrices.getText(row, TABLE_INDEX_SOURCE_PRICING_SELLING_PRICE))) {
|
| - |
|
1271 |
sourcePricingsChanged = true;
|
| 1217 |
sb.append("\n-Selling Price (Source:" + sourceId + ")");
|
1272 |
sb.append("\n-Selling Price (Source:" + sourceId + ")");
|
| 1218 |
}
|
1273 |
}
|
| 1219 |
}
|
1274 |
}
|
| - |
|
1275 |
if(sourcePricingsChanged){
|
| - |
|
1276 |
sb.append("\n-Source Pricing");
|
| - |
|
1277 |
optionalChangedValMap.put(OPTIONAL_SOURCE_PRICING, newItem.getSourcePricesMap());
|
| - |
|
1278 |
}
|
| - |
|
1279 |
|
| 1220 |
|
1280 |
|
| 1221 |
VendorItemMapping mapping;
|
1281 |
VendorItemMapping mapping;
|
| 1222 |
String old_key, new_key;
|
1282 |
String old_key, new_key;
|
| 1223 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
1283 |
for(int row = 0; row < tableVendorItemKey.getRowCount(); row++) {
|
| 1224 |
vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
1284 |
vendorId = Long.parseLong(tableVendorItemKey.getText(row, TABLE_INDEX_MAPPING_VENDORID));
|
| Line 1505... |
Line 1565... |
| 1505 |
@UiHandler("comingSoonButton")
|
1565 |
@UiHandler("comingSoonButton")
|
| 1506 |
void onComingSoonButtonClick(ClickEvent event) {
|
1566 |
void onComingSoonButtonClick(ClickEvent event) {
|
| 1507 |
ComingSoonDialog cd = new ComingSoonDialog(this);
|
1567 |
ComingSoonDialog cd = new ComingSoonDialog(this);
|
| 1508 |
cd.show();
|
1568 |
cd.show();
|
| 1509 |
}
|
1569 |
}
|
| - |
|
1570 |
|
| - |
|
1571 |
private void createDialog(String changedString) {
|
| - |
|
1572 |
VerticalPanel vp = new VerticalPanel();
|
| - |
|
1573 |
final DialogBox db = new DialogBox();
|
| - |
|
1574 |
db.setText("Changed fields");
|
| - |
|
1575 |
|
| - |
|
1576 |
vp.add(new Label("Check the fields to update all SKUs with similar entity."));
|
| - |
|
1577 |
vp.add(new Label("--------------------------------------------------------"));
|
| - |
|
1578 |
CheckBox allChecked = new CheckBox("Select all");
|
| - |
|
1579 |
if(optionalChangedValMap.size()>1){
|
| - |
|
1580 |
allChecked.setName("all");
|
| - |
|
1581 |
allChecked.addClickHandler(new ClickHandler() {
|
| - |
|
1582 |
@Override
|
| - |
|
1583 |
public void onClick(ClickEvent event) {
|
| - |
|
1584 |
CheckBox cb = (CheckBox)event.getSource();
|
| - |
|
1585 |
VerticalPanel vp = (VerticalPanel)cb.getParent();
|
| - |
|
1586 |
Iterator<Widget> iterator = vp.iterator();
|
| - |
|
1587 |
while(iterator.hasNext()){
|
| - |
|
1588 |
Widget w = iterator.next();
|
| - |
|
1589 |
if(w instanceof CheckBox){
|
| - |
|
1590 |
CheckBox cbox = (CheckBox)w;
|
| - |
|
1591 |
if(cbox.getName()!="all"){
|
| - |
|
1592 |
cbox.setValue(cb.getValue());
|
| - |
|
1593 |
}
|
| - |
|
1594 |
}
|
| - |
|
1595 |
}
|
| - |
|
1596 |
if(cb.getValue()){
|
| - |
|
1597 |
cb.setText("Deselect all");
|
| - |
|
1598 |
}else {
|
| - |
|
1599 |
cb.setText("Select all");
|
| - |
|
1600 |
}
|
| - |
|
1601 |
}
|
| - |
|
1602 |
});
|
| - |
|
1603 |
vp.add(allChecked);
|
| - |
|
1604 |
}
|
| - |
|
1605 |
String[] changedFields = changedString.split("\n-");
|
| - |
|
1606 |
for(String changeField : changedFields){
|
| - |
|
1607 |
if(optionalChangedValMap.containsKey(changeField)){
|
| - |
|
1608 |
CheckBox ch = new CheckBox(changeField);
|
| - |
|
1609 |
ch.getElement().getStyle().setPadding(10d, Unit.PX);
|
| - |
|
1610 |
vp.add(ch);
|
| - |
|
1611 |
} else {
|
| - |
|
1612 |
Label l = new Label(changeField);
|
| - |
|
1613 |
l.getElement().getStyle().setMarginLeft(10d, Unit.PX);
|
| - |
|
1614 |
l.getElement().getStyle().setPadding(10d, Unit.PX);
|
| - |
|
1615 |
vp.add(l);
|
| - |
|
1616 |
}
|
| - |
|
1617 |
}
|
| - |
|
1618 |
|
| - |
|
1619 |
Button submitButton = new Button();
|
| - |
|
1620 |
submitButton.setText("Update");
|
| - |
|
1621 |
submitButton.addClickHandler(new ClickHandler() {
|
| - |
|
1622 |
|
| - |
|
1623 |
@Override
|
| - |
|
1624 |
public void onClick(ClickEvent event) {
|
| - |
|
1625 |
Button b = (Button)event.getSource();
|
| - |
|
1626 |
VerticalPanel vp = (VerticalPanel)b.getParent();
|
| - |
|
1627 |
Iterator<Widget> iterator = vp.iterator();
|
| - |
|
1628 |
while(iterator.hasNext()){
|
| - |
|
1629 |
Widget w = iterator.next();
|
| - |
|
1630 |
if(w instanceof CheckBox){
|
| - |
|
1631 |
CheckBox cbox = (CheckBox)w;
|
| - |
|
1632 |
if(cbox.getName()!="all"){
|
| - |
|
1633 |
if(!cbox.getValue()){
|
| - |
|
1634 |
optionalChangedValMap.remove(cbox.getText());
|
| - |
|
1635 |
}
|
| - |
|
1636 |
}
|
| - |
|
1637 |
}
|
| - |
|
1638 |
}
|
| - |
|
1639 |
db.hide();
|
| - |
|
1640 |
List<Item> items = new ArrayList<Item>();
|
| - |
|
1641 |
items.add(newItem);
|
| - |
|
1642 |
validateNUpdate();
|
| - |
|
1643 |
/*for(Long id : item.getSameItemsWithDifferentColors()){
|
| - |
|
1644 |
catalogService.getItem(id, new AsyncCallback<Item>() {
|
| - |
|
1645 |
@Override
|
| - |
|
1646 |
public void onSuccess(Item result) {
|
| - |
|
1647 |
items.add(e)
|
| - |
|
1648 |
}
|
| - |
|
1649 |
@Override
|
| - |
|
1650 |
public void onFailure(Throwable caught) {
|
| - |
|
1651 |
caught.printStackTrace();
|
| - |
|
1652 |
Window.alert("Unable to fetch item details.");
|
| - |
|
1653 |
}
|
| - |
|
1654 |
});
|
| - |
|
1655 |
}*/
|
| - |
|
1656 |
}
|
| - |
|
1657 |
|
| - |
|
1658 |
});
|
| - |
|
1659 |
vp.add(submitButton);
|
| - |
|
1660 |
db.add(vp);
|
| - |
|
1661 |
db.center();
|
| - |
|
1662 |
db.show();
|
| - |
|
1663 |
}
|
| - |
|
1664 |
|
| - |
|
1665 |
private void updateItem(Long itemId) {
|
| - |
|
1666 |
catalogService.getItem(itemId, new AsyncCallback<Item>() {
|
| - |
|
1667 |
@Override
|
| - |
|
1668 |
public void onSuccess(Item result) {
|
| - |
|
1669 |
final Item res = result;
|
| - |
|
1670 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BRAND)){
|
| - |
|
1671 |
result.setBrand((String)mandatoryChangedValMap.get(MANDATORY_BRAND));
|
| - |
|
1672 |
}
|
| - |
|
1673 |
if(mandatoryChangedValMap.containsKey(MANDATORY_BEST_DEAL_TEXT)){
|
| - |
|
1674 |
result.setBestDealsText((String)mandatoryChangedValMap.get(MANDATORY_BEST_DEAL_TEXT));
|
| - |
|
1675 |
}
|
| - |
|
1676 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NAME)){
|
| - |
|
1677 |
result.setModelName((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NAME));
|
| - |
|
1678 |
}
|
| - |
|
1679 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MODEL_NO)){
|
| - |
|
1680 |
result.setModelNumber((String)mandatoryChangedValMap.get(MANDATORY_MODEL_NO));
|
| - |
|
1681 |
}
|
| - |
|
1682 |
if(mandatoryChangedValMap.containsKey(MANDATORY_WEIGHT)){
|
| - |
|
1683 |
result.setWeight((Double)mandatoryChangedValMap.get(MANDATORY_WEIGHT));
|
| - |
|
1684 |
}
|
| - |
|
1685 |
if(mandatoryChangedValMap.containsKey(MANDATORY_MRP)){
|
| - |
|
1686 |
result.setMrp((Double)mandatoryChangedValMap.get(MANDATORY_MRP));
|
| - |
|
1687 |
}
|
| - |
|
1688 |
if(optionalChangedValMap.containsKey(OPTIONAL_PREFERRED_VENDOR)){
|
| - |
|
1689 |
result.setPreferredVendor((Long)optionalChangedValMap.get(OPTIONAL_PREFERRED_VENDOR));
|
| - |
|
1690 |
}
|
| - |
|
1691 |
if(optionalChangedValMap.containsKey(OPTIONAL_SELLING_PRICE)){
|
| - |
|
1692 |
result.setSellingPrice((Double)optionalChangedValMap.get(OPTIONAL_SELLING_PRICE));
|
| - |
|
1693 |
}
|
| - |
|
1694 |
if(optionalChangedValMap.containsKey(OPTIONAL_SOURCE_PRICING)){
|
| - |
|
1695 |
result.setSourcePricesMap((Map<Long, SourcePricings>) optionalChangedValMap.get(OPTIONAL_SOURCE_PRICING));
|
| - |
|
1696 |
}
|
| - |
|
1697 |
if(optionalChangedValMap.containsKey(OPTIONAL_VENDOR_PRICING)){
|
| - |
|
1698 |
result.setVendorPricesMap((Map<Long, VendorPricings>) optionalChangedValMap.get(OPTIONAL_VENDOR_PRICING));
|
| - |
|
1699 |
}
|
| - |
|
1700 |
catalogService.updateItem(result, new AsyncCallback<Boolean>() {
|
| - |
|
1701 |
|
| - |
|
1702 |
@Override
|
| - |
|
1703 |
public void onSuccess(Boolean result1) {
|
| - |
|
1704 |
if(result1) {
|
| - |
|
1705 |
Window.alert(res.getId() + " updated Successfully");
|
| - |
|
1706 |
}
|
| - |
|
1707 |
|
| - |
|
1708 |
}
|
| - |
|
1709 |
|
| - |
|
1710 |
@Override
|
| - |
|
1711 |
public void onFailure(Throwable caught) {
|
| - |
|
1712 |
caught.printStackTrace();
|
| - |
|
1713 |
Window.alert("Error updating item " + res.getId());
|
| - |
|
1714 |
|
| - |
|
1715 |
}
|
| - |
|
1716 |
});
|
| - |
|
1717 |
}
|
| - |
|
1718 |
@Override
|
| - |
|
1719 |
public void onFailure(Throwable caught) {
|
| - |
|
1720 |
caught.printStackTrace();
|
| - |
|
1721 |
Window.alert("Unable to fetch item details.");
|
| - |
|
1722 |
}
|
| - |
|
1723 |
});
|
| - |
|
1724 |
}
|
| 1510 |
}
|
1725 |
}
|