Subversion Repositories SmartDukaan

Rev

Rev 5460 | Rev 6241 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2066 ankur.sing 1
package in.shop2020.catalog.dashboard.client;
2
 
2105 ankur.sing 3
import in.shop2020.catalog.dashboard.shared.Item;
4
import in.shop2020.catalog.dashboard.shared.Utils;
2119 ankur.sing 5
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
6
import in.shop2020.catalog.dashboard.shared.VendorPricings;
2066 ankur.sing 7
 
5217 amit.gupta 8
import java.util.Date;
2105 ankur.sing 9
import java.util.HashMap;
10
import java.util.Map;
4725 phani.kuma 11
import java.util.Map.Entry;
2066 ankur.sing 12
 
2105 ankur.sing 13
import com.google.gwt.core.client.GWT;
14
import com.google.gwt.event.dom.client.ClickEvent;
15
import com.google.gwt.event.dom.client.ClickHandler;
16
import com.google.gwt.uibinder.client.UiBinder;
17
import com.google.gwt.uibinder.client.UiField;
18
import com.google.gwt.uibinder.client.UiHandler;
19
import com.google.gwt.user.client.Window;
20
import com.google.gwt.user.client.rpc.AsyncCallback;
21
import com.google.gwt.user.client.ui.Button;
22
import com.google.gwt.user.client.ui.CheckBox;
23
import com.google.gwt.user.client.ui.DialogBox;
24
import com.google.gwt.user.client.ui.FlexTable;
25
import com.google.gwt.user.client.ui.ListBox;
26
import com.google.gwt.user.client.ui.TextBox;
27
import com.google.gwt.user.client.ui.Widget;
28
import com.google.gwt.user.datepicker.client.DateBox;
29
 
2427 ankur.sing 30
/**
31
 * ItemForm is a DialogBox which is created on the click of Add Item button in ItemActions.
32
 * This contains UI fields to fill up item attributes. It also contains tables for adding
33
 * vendor prices and vendor mapping keys.
34
 *
35
 */
5217 amit.gupta 36
public class ItemForm extends DialogBox implements ComingSoon{
2105 ankur.sing 37
 
38
    interface ItemFormUiBinder extends UiBinder<Widget, ItemForm> {}
39
    private static ItemFormUiBinder uiBinder = GWT.create(ItemFormUiBinder.class);
40
 
5586 phani.kuma 41
    private final static CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
2119 ankur.sing 42
    private final int TABLE_INDEX_VENDORID = 0,
43
                      TABLE_INDEX_VENDOR_DESC = 1, 
44
                      TABLE_INDEX_ITEM_KEY = 2,
45
                      TABLE_INDEX_MOP = 2,
46
                      TABLE_INDEX_DP = 3,
47
                      TABLE_INDEX_TP = 4;
5586 phani.kuma 48
 
49
    private static boolean entityIdMandatory = Utils.isEntityIdMandatory();
2105 ankur.sing 50
 
5586 phani.kuma 51
    @UiField TextBox productGroup, catalogItemId;
2105 ankur.sing 52
    @UiField TextBox brand, modelNumber, modelName, color, comments;
53
    @UiField TextBox mrp, sellingPrice, weight, bestDealText, bestDealValue, bestSellingRank;
5217 amit.gupta 54
    @UiField DateBox startDate, retireDate, comingSoonStartDate, expectedArrivalDate;
55
    @UiField Button addButton, cancelButton, comingSoonButton;
5460 phani.kuma 56
    @UiField CheckBox defaultForEntity, risky, itemType, hasItemNo, clearance;
2105 ankur.sing 57
    @UiField FlexTable headerVendor, vendorTable;
2119 ankur.sing 58
    @UiField FlexTable headerVendorM, vendorTableM;
5384 phani.kuma 59
    @UiField ListBox preferredVendor;
2105 ankur.sing 60
 
61
    public ItemForm(){
62
        setText("Add New Item");
63
        setWidget(uiBinder.createAndBindUi(this));
2427 ankur.sing 64
        initVendorKeysHeader();
65
        initVendorPricesHeader();
4762 phani.kuma 66
        preferredVendor.addItem("select");
4725 phani.kuma 67
        for(Entry<Long, String> e : Utils.getAllVendors().entrySet()){
68
        	preferredVendor.addItem(e.getValue());
69
        }
5586 phani.kuma 70
        if(!entityIdMandatory) {
71
        	catalogItemId.setEnabled(false);
72
        }
2105 ankur.sing 73
    }
74
 
2427 ankur.sing 75
    /**
76
     * initialises vendor item key table header. Creates an Add button and
77
     * adds click event listener to it to create and pop up a dialog for adding 
78
     * a new vendor item key. 
79
     */
80
    private void initVendorKeysHeader(){
2119 ankur.sing 81
        headerVendorM.getColumnFormatter().setWidth(TABLE_INDEX_VENDORID, "128px");
82
        headerVendorM.getColumnFormatter().setWidth(TABLE_INDEX_VENDOR_DESC, "128px");
2359 ankur.sing 83
        headerVendorM.getColumnFormatter().setWidth(TABLE_INDEX_ITEM_KEY, "400px");
2119 ankur.sing 84
        headerVendorM.getColumnFormatter().setWidth(TABLE_INDEX_ITEM_KEY + 1, "50px");
85
 
86
        headerVendorM.setText(0, TABLE_INDEX_VENDORID, "Vendor Id");
2359 ankur.sing 87
        headerVendorM.setText(0, TABLE_INDEX_VENDOR_DESC, "Vendor");
2119 ankur.sing 88
        headerVendorM.setText(0, TABLE_INDEX_ITEM_KEY, "Item Key");
89
 
2359 ankur.sing 90
        headerVendorM.getCellFormatter().setVisible(0, TABLE_INDEX_VENDORID, false);
91
 
2119 ankur.sing 92
        Button addButton = new Button("Add");
93
        headerVendorM.setWidget(0, TABLE_INDEX_ITEM_KEY + 1, addButton);
94
        addButton.addClickHandler(new ClickHandler() {
95
            @Override
96
            public void onClick(ClickEvent event) {
2126 ankur.sing 97
                VendorMappingDialog vendorMappingDialog = new VendorMappingDialog(productGroup.getText().trim(), brand.getText().trim(), 
98
                        modelNumber.getText().trim(), color.getText().trim());
2119 ankur.sing 99
                vendorMappingDialog.updateButton.setText("Add");
100
                vendorMappingDialog.setVendorMappingUpdateListener(new VendorMappingDialog.VendorMappingUpdateListener() {
101
                    @Override
102
                    public boolean onUpdate(String key, long vendorId) {
103
                        final int row = vendorTableM.getRowCount();
104
                        vendorTableM.getColumnFormatter().setWidth(TABLE_INDEX_VENDORID, "128px");
105
                        vendorTableM.getColumnFormatter().setWidth(TABLE_INDEX_VENDOR_DESC, "128px");
2359 ankur.sing 106
                        vendorTableM.getColumnFormatter().setWidth(TABLE_INDEX_ITEM_KEY, "400px");
2119 ankur.sing 107
                        vendorTableM.getColumnFormatter().setWidth(TABLE_INDEX_ITEM_KEY + 1, "50px");
108
 
109
                        vendorTableM.setText(row, TABLE_INDEX_VENDORID, vendorId + "");
110
                        vendorTableM.setText(row, TABLE_INDEX_VENDOR_DESC, Utils.getVendorDesc(vendorId));
111
                        vendorTableM.setText(row, TABLE_INDEX_ITEM_KEY, key);
112
                        Button removeButton = new Button("X");
113
                        vendorTableM.setWidget(row, TABLE_INDEX_ITEM_KEY + 1, removeButton);
2359 ankur.sing 114
 
115
                        vendorTableM.getCellFormatter().setVisible(row, TABLE_INDEX_VENDORID, false);
2119 ankur.sing 116
                        removeButton.addClickHandler(new ClickHandler() {
117
                            @Override
118
                            public void onClick(ClickEvent event) {
119
                                vendorTableM.removeRow(row);
120
                            }
121
                        });
122
                        return true;
123
                    }
124
                });
125
                vendorMappingDialog.show();
126
            }
127
        });
128
    }
2105 ankur.sing 129
 
2427 ankur.sing 130
    /**
131
     * initialises vendor prices table header. Creates an Add button and
132
     * adds click event listener to it to create and pop up a dialog for adding 
133
     * a prices for a new vendor 
134
     */
135
    private void initVendorPricesHeader(){
2105 ankur.sing 136
        headerVendor.getColumnFormatter().setWidth(TABLE_INDEX_VENDORID, "128px");
137
        headerVendor.getColumnFormatter().setWidth(TABLE_INDEX_VENDOR_DESC, "128px");
138
        headerVendor.getColumnFormatter().setWidth(TABLE_INDEX_MOP, "128px");
139
        headerVendor.getColumnFormatter().setWidth(TABLE_INDEX_DP, "128px");
140
        headerVendor.getColumnFormatter().setWidth(TABLE_INDEX_TP, "128px");
2119 ankur.sing 141
        headerVendor.getColumnFormatter().setWidth(TABLE_INDEX_TP + 1, "50px");
2105 ankur.sing 142
 
143
        headerVendor.setText(0, TABLE_INDEX_VENDORID, "Vendor Id");
2359 ankur.sing 144
        headerVendor.setText(0, TABLE_INDEX_VENDOR_DESC, "Vendor");
2105 ankur.sing 145
        headerVendor.setText(0, TABLE_INDEX_MOP, "MOP");
146
        headerVendor.setText(0, TABLE_INDEX_DP, "Dealer Price");
147
        headerVendor.setText(0, TABLE_INDEX_TP, "Transfer Price");
2119 ankur.sing 148
 
2359 ankur.sing 149
        headerVendor.getCellFormatter().setVisible(0, TABLE_INDEX_VENDORID, false);
150
 
2119 ankur.sing 151
        Button addButton = new Button("Add");
152
        headerVendor.setWidget(0, TABLE_INDEX_TP + 1, addButton);
153
        addButton.addClickHandler(new ClickHandler() {
154
            @Override
155
            public void onClick(ClickEvent event) {
156
                VendorPricesDialog vendorPricesDialog = new VendorPricesDialog();
157
                vendorPricesDialog.updateButton.setText("Add");
158
                vendorPricesDialog.setVendorPriceUpdateListener(new VendorPricesDialog.VendorPriceUpdateListener() {
159
                    @Override
160
                    public boolean onUpdate(double mop, double dp, double tp, long vendorId) {
161
                        if(!vendorExists(vendorId)) {
162
                            Window.alert("Vendor already exists");
163
                            return false;
164
                        }
165
                        /*if(!validateVendorPrices(mop, dp, tp)) {
166
                            return false;
167
                        }*/
168
                        final int row = vendorTable.getRowCount();
169
                        vendorTable.getColumnFormatter().setWidth(TABLE_INDEX_VENDORID, "128px");
170
                        vendorTable.getColumnFormatter().setWidth(TABLE_INDEX_VENDOR_DESC, "128px");
171
                        vendorTable.getColumnFormatter().setWidth(TABLE_INDEX_MOP, "128px");
172
                        vendorTable.getColumnFormatter().setWidth(TABLE_INDEX_DP, "128px");
173
                        vendorTable.getColumnFormatter().setWidth(TABLE_INDEX_TP, "128px");
174
                        vendorTable.getColumnFormatter().setWidth(TABLE_INDEX_TP + 1, "50px");
175
 
176
                        vendorTable.setText(row, TABLE_INDEX_VENDORID, vendorId + "");
177
                        vendorTable.setText(row, TABLE_INDEX_VENDOR_DESC, Utils.getVendorDesc(vendorId));
178
                        vendorTable.setText(row, TABLE_INDEX_MOP, mop + "");
179
                        vendorTable.setText(row, TABLE_INDEX_DP, dp + "");
180
                        vendorTable.setText(row, TABLE_INDEX_TP, tp + "");
2359 ankur.sing 181
 
182
                        vendorTable.getCellFormatter().setVisible(row, TABLE_INDEX_VENDORID, false);
183
 
2119 ankur.sing 184
                        Button removeButton = new Button("X");
185
                        vendorTable.setWidget(row, TABLE_INDEX_TP + 1, removeButton);
186
                        removeButton.addClickHandler(new ClickHandler() {
187
                            @Override
188
                            public void onClick(ClickEvent event) {
189
                                vendorTable.removeRow(row);
190
                            }
191
                        });
192
                        return true;
193
                    }
194
                });
195
                vendorPricesDialog.show();
196
            }
197
        });
2105 ankur.sing 198
    }
199
 
200
    @UiHandler("addButton")
201
    /**
2359 ankur.sing 202
     * On add button click a new Item instance is created and all the information from UI fields is dumped in this item instance.
2427 ankur.sing 203
     * This item instance is then passed to the service to be added to the database.
2105 ankur.sing 204
     */
205
    void addItem(ClickEvent event) {
5586 phani.kuma 206
    	if(entityIdMandatory) {
207
    		long entityId = 0;
208
    		try {
209
                if(!catalogItemId.getText().trim().isEmpty()) {
210
                    entityId = Long.parseLong(catalogItemId.getText().trim());
211
                    if(entityId <= 0) {
212
                        throw new NumberFormatException("Invalid value of Catalog Item Id");
213
                    }
214
                }
215
                else {
216
                	Window.alert("Catalog Item Id can not be empty");
217
                	return;
218
                }
219
            } catch(NumberFormatException ex) {
220
                Window.alert("Invalid value of Catalog Item Id");
2119 ankur.sing 221
                return;
222
            }
5586 phani.kuma 223
	    	catalogService.checkEntityId(entityId, new AsyncCallback<Boolean>() {
224
	            @Override
225
	            public void onFailure(Throwable caught) {
226
	                GWT.log("Error checking Catalog Item Id");
227
	                Window.alert("Error checking Catalog Item Id");
228
	                return;
229
	            }
230
	            @Override
231
	            public void onSuccess(Boolean result) {
232
		        	if(!result) {
233
	                    Window.alert("Invalid value of Catalog Item Id");
234
	                    return;
235
	                }
236
	                addNewItem();
237
		        }
238
	        });
239
    	}
240
    	else {
241
	        catalogService.checkSimilarItem(brand.getText().trim(), modelNumber.getText().trim(),
242
	        		modelName.getText().trim(), color.getText().trim(), new AsyncCallback<Long>() {
243
	            @Override
244
	            public void onFailure(Throwable caught) {
245
	                GWT.log("Error checking similar item");
246
	                Window.alert("Error checking similar item");
247
	                return;
248
	            }
249
	            @Override
250
	            public void onSuccess(Long result) {
251
	                if(result != 0) {
252
	                    Window.alert("Similar product exists with Item Id " + result);
253
	                    return;
254
	                }
255
	                addNewItem();
256
	            }
257
	        });
258
    	}
2119 ankur.sing 259
    }
260
 
2126 ankur.sing 261
    private void addNewItem() {
2105 ankur.sing 262
        Item item = new Item();
263
 
4762 phani.kuma 264
        if(!productGroup.getText().trim().isEmpty()) {
265
        	item.setProductGroup(productGroup.getText().trim());
266
        }
267
        else {
268
        	Window.alert("Product Group can not be empty.");
269
            return;
270
        }
5586 phani.kuma 271
 
272
        if(entityIdMandatory) {
273
	        try {
274
	            if(!catalogItemId.getText().trim().isEmpty()) {
275
	                long entityId = Long.parseLong(catalogItemId.getText().trim());
276
	                if(entityId <= 0) {
277
	                    throw new NumberFormatException("Invalid value of Catalog Item Id");
278
	                }
279
	                item.setCatalogItemId(entityId);
280
	            }
281
	            else {
282
	            	Window.alert("Catalog Item Id can not be empty");
283
	            	return;
284
	            }
285
	        } catch(NumberFormatException ex) {
286
	            Window.alert("Invalid value of Catalog Item Id");
287
	            return;
288
	        }
289
        }
290
 
2105 ankur.sing 291
        item.setBrand(brand.getText().trim());
292
        item.setModelNumber(modelNumber.getText().trim());
293
        item.setModelName(modelName.getText().trim());
294
        item.setColor(color.getText().trim());
295
        item.setComments(comments.getText().trim());
296
        try {
2126 ankur.sing 297
            if(!mrp.getText().trim().isEmpty()) {
298
                double mrpValue = Double.parseDouble(mrp.getText().trim());
299
                if(mrpValue <= 0) {
300
                    throw new NumberFormatException("Negative value of MRP");
301
                }
302
                item.setMrp(mrpValue);
2105 ankur.sing 303
            }
304
        } catch(NumberFormatException ex) {
2126 ankur.sing 305
            Window.alert("Invalid MRP format/value. Value shoule be greater than zero");
2105 ankur.sing 306
            return;
307
        }
308
        try {
2126 ankur.sing 309
            if(!sellingPrice.getText().trim().isEmpty()) {
2427 ankur.sing 310
                double spValue = Double.parseDouble(sellingPrice.getText().trim());
311
                if(spValue <= 0) {
312
                    throw new NumberFormatException("Negative value of Selling price");
313
                }
314
                item.setSellingPrice(spValue);
2126 ankur.sing 315
            }
2105 ankur.sing 316
        } catch(NumberFormatException ex) {
2126 ankur.sing 317
            Window.alert("Invalid Selling Price format/value. Value shoule be greater than zero");
2105 ankur.sing 318
            return;
319
        }
320
        try {
2126 ankur.sing 321
            if(!weight.getText().trim().isEmpty()) {
2105 ankur.sing 322
                double wtValue = Double.parseDouble(weight.getText().trim());
2126 ankur.sing 323
                if(wtValue <= 0) {
2105 ankur.sing 324
                    throw new NumberFormatException("Negative value of Weight");
325
                }
326
                item.setWeight(wtValue);
327
            }
328
        } catch(NumberFormatException ex) {
2126 ankur.sing 329
            Window.alert("Invalid weight format/value. Value shoule be greater than zero");
2105 ankur.sing 330
            return;
331
        }
332
        try {
333
            if(!startDate.getTextBox().getText().trim().equals("")) {
334
                item.setStartDate(startDate.getValue().getTime());
335
            }
336
        } catch(Exception ex) {
337
            Window.alert("Invalid start date format");
338
            return;
339
        }
5217 amit.gupta 340
        if(comingSoonStartDate.getValue()==null){
341
        	item.setComingSoonStartDate(null);
342
        }else {
343
        	item.setComingSoonStartDate(comingSoonStartDate.getValue().getTime());
344
        }
345
        if(expectedArrivalDate.getValue()==null){
346
        	item.setExpectedArrivalDate(null);
347
        }else {
348
        	item.setExpectedArrivalDate(expectedArrivalDate.getValue().getTime());
349
        }
2105 ankur.sing 350
        item.setBestDealsText(bestDealText.getText().trim());
351
        try {
352
            if(!bestDealValue.getText().trim().equals("")) {
353
                double bdValue = Double.parseDouble(bestDealValue.getText().trim());
354
                if(bdValue < 0) {
355
                    throw new NumberFormatException("Negative value of BestDealValue");
356
                }
357
                item.setBestDealsValue(bdValue);
358
            }
359
        } catch(NumberFormatException ex) {
360
            Window.alert("Invalid best deal value format");
361
            return;
362
        }
363
        try {
364
            if(!bestSellingRank.getText().trim().equals("")) {
365
                long bsrValue = Long.parseLong(bestSellingRank.getText().trim());
366
                if(bsrValue < 0) {
367
                    throw new NumberFormatException("Negative value of Best Selling Rank");
368
                }
369
                item.setBestSellingRank(bsrValue);
370
            }
371
        } catch(NumberFormatException ex) {
372
            Window.alert("Invalid best selling rank format");
373
            return;
374
        }
375
        item.setDefaultForEntity(defaultForEntity.getValue());
2252 ankur.sing 376
        item.setRisky(risky.getValue());
5384 phani.kuma 377
        item.setHasItemNo(hasItemNo.getValue());
378
        item.setItemType(itemType.getValue());
5460 phani.kuma 379
        item.setClearance(clearance.getValue());
4762 phani.kuma 380
        if(preferredVendor.getSelectedIndex() == 0) {
381
        	Window.alert("Invalid Vendor Selected");
382
            return;
383
        }
384
    	else {
385
    		item.setPreferredVendor(Utils.getVendorId(preferredVendor.getItemText(preferredVendor.getSelectedIndex())));
386
    	}
2105 ankur.sing 387
 
2119 ankur.sing 388
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
2105 ankur.sing 389
          Add the instance to map and set the map to the item instance created above.*/
2119 ankur.sing 390
        Map<Long, VendorPricings> vendorPrices = new HashMap<Long, VendorPricings>();
391
        VendorPricings v;
2105 ankur.sing 392
        for(int row = 0; row < vendorTable.getRowCount(); row++) {
2119 ankur.sing 393
            v = new VendorPricings();
2105 ankur.sing 394
            v.setMop(Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_MOP)));
395
            v.setDealerPrice(Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_DP)));
396
            v.setTransferPrice(Double.parseDouble(vendorTable.getText(row, TABLE_INDEX_TP)));
397
            v.setVendorId(Long.parseLong(vendorTable.getText(row, TABLE_INDEX_VENDORID)));
398
            vendorPrices.put(v.getVendorId(), v);
399
        }
2119 ankur.sing 400
        item.setVendorPricesMap(vendorPrices);
2105 ankur.sing 401
 
2119 ankur.sing 402
        /*Create an instance of VendorPricings for each row in vendor pricing table. Set the vendor prices to the instance.
403
        Add the instance to map and set the map to the item instance created above.*/
2359 ankur.sing 404
        Map<String, VendorItemMapping> vendorMappings = new HashMap<String, VendorItemMapping>();
2119 ankur.sing 405
        VendorItemMapping vMapping;
406
        for(int row = 0; row < vendorTableM.getRowCount(); row++) {
407
            vMapping = new VendorItemMapping();
408
            vMapping.setItemKey(vendorTableM.getText(row, TABLE_INDEX_ITEM_KEY));
409
            vMapping.setVendorId(Long.parseLong(vendorTableM.getText(row, TABLE_INDEX_VENDORID)));
2359 ankur.sing 410
            vendorMappings.put(vMapping.getVendorId() + Item.KEY_SEPARATOR + vMapping.getItemKey(), vMapping);
2119 ankur.sing 411
        }
2359 ankur.sing 412
        item.setVendorKeysMap(vendorMappings);
2119 ankur.sing 413
 
414
        if(!Utils.validateItem(item)) {
415
            return;
416
        }
417
 
2427 ankur.sing 418
        /*Service method to add item. */
2105 ankur.sing 419
        catalogService.addItem(item, new AsyncCallback<Long>() {
420
            @Override
421
            public void onSuccess(Long result) {
422
                if(result == null || result == 0) {
423
                    Window.alert("Error while adding item");
424
                    return;
425
                }
426
                Window.alert("Item added successfully. Id = " + result);
427
                hide();
428
            }
429
            @Override
430
            public void onFailure(Throwable caught) {
2427 ankur.sing 431
                caught.printStackTrace();
2105 ankur.sing 432
                Window.alert("Error while adding item");
433
            }
434
        });
435
    }
436
 
437
    @UiHandler("cancelButton")
438
    void closeForm(ClickEvent event) {
439
        this.hide();
440
    }
2427 ankur.sing 441
 
2105 ankur.sing 442
    /**
443
     * Checks if vendor details already exists corresponding to the vendor Id parameter. 
444
     */
445
    private boolean vendorExists(long vendorId) {
446
        long id;
447
        for(int i = 0; i < vendorTable.getRowCount(); i++) {
448
            id = Long.parseLong(vendorTable.getText(i, TABLE_INDEX_VENDORID));
449
            if(vendorId == id) {
450
                return false;
451
            }
452
        }
453
        return true;
454
    }
455
 
456
    /**
2119 ankur.sing 457
     * validate vendor prices (MOP, DealerPrice, TransferPrice)
2105 ankur.sing 458
     */
2566 chandransh 459
    @SuppressWarnings("unused")
460
	private boolean validateVendorPrices(double mop, double dp, double tp) {
2105 ankur.sing 461
        double mrpValue;
462
        try {
463
            mrpValue = Double.parseDouble(mrp.getText().trim());
464
        } catch (NumberFormatException ex) {
465
            Window.alert("Invalid MRP value.");
466
            return false;
467
        }
468
        if(mrpValue < mop) {
469
            Window.alert("MOP cannot be more than MRP.");
470
            return false;
471
        }
472
        if(tp > mop) {
473
            Window.alert("Transfer Price cannot be more than MOP.");
474
            return false;
475
        }
476
        return true;
477
    }
5217 amit.gupta 478
 
479
	@UiHandler("comingSoonButton")
480
	void onComingSoonButtonClick(ClickEvent event) {
481
		ComingSoonDialog cd = new ComingSoonDialog(this);
482
		cd.show();
483
	}
484
 
485
	public void setComingSoonStartDate(Date date){
486
		this.comingSoonStartDate.setValue(date);
487
	}
488
	public void setBestDealsText(String bestDealsText){
489
		this.bestDealText.setText(bestDealsText);
490
	}
491
 
492
	public void setExpectedArrivalDate(Date date){
493
		this.expectedArrivalDate.setValue(date);
494
	}
495
 
496
	@Override
497
	public String getBestDealsText() {
498
		return this.bestDealText.getValue();
499
	}
500
 
501
	@Override
502
	public Date getComingSoonStartDate() {
503
		return this.comingSoonStartDate.getValue();
504
	}
505
 
506
	@Override
507
	public Date getExpectedArrivalDate() {
508
		return this.comingSoonStartDate.getValue();
509
	}
2066 ankur.sing 510
}