Subversion Repositories SmartDukaan

Rev

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

Rev 5118 Rev 5217
Line 3... Line 3...
3
import in.shop2020.catalog.dashboard.shared.Item;
3
import in.shop2020.catalog.dashboard.shared.Item;
4
import in.shop2020.catalog.dashboard.shared.Utils;
4
import in.shop2020.catalog.dashboard.shared.Utils;
5
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
5
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
6
import in.shop2020.catalog.dashboard.shared.VendorPricings;
6
import in.shop2020.catalog.dashboard.shared.VendorPricings;
7
 
7
 
-
 
8
import java.util.Date;
8
import java.util.HashMap;
9
import java.util.HashMap;
9
import java.util.Map;
10
import java.util.Map;
10
import java.util.Map.Entry;
11
import java.util.Map.Entry;
11
 
12
 
12
import com.google.gwt.core.client.GWT;
13
import com.google.gwt.core.client.GWT;
13
import com.google.gwt.event.dom.client.ChangeEvent;
-
 
14
import com.google.gwt.event.dom.client.ClickEvent;
14
import com.google.gwt.event.dom.client.ClickEvent;
15
import com.google.gwt.event.dom.client.ClickHandler;
15
import com.google.gwt.event.dom.client.ClickHandler;
16
import com.google.gwt.uibinder.client.UiBinder;
16
import com.google.gwt.uibinder.client.UiBinder;
17
import com.google.gwt.uibinder.client.UiField;
17
import com.google.gwt.uibinder.client.UiField;
18
import com.google.gwt.uibinder.client.UiHandler;
18
import com.google.gwt.uibinder.client.UiHandler;
Line 31... Line 31...
31
 * ItemForm is a DialogBox which is created on the click of Add Item button in ItemActions.
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
32
 * This contains UI fields to fill up item attributes. It also contains tables for adding
33
 * vendor prices and vendor mapping keys.
33
 * vendor prices and vendor mapping keys.
34
 *
34
 *
35
 */
35
 */
36
public class ItemForm extends DialogBox {
36
public class ItemForm extends DialogBox implements ComingSoon{
37
 
37
 
38
    interface ItemFormUiBinder extends UiBinder<Widget, ItemForm> {}
38
    interface ItemFormUiBinder extends UiBinder<Widget, ItemForm> {}
39
    private static ItemFormUiBinder uiBinder = GWT.create(ItemFormUiBinder.class);
39
    private static ItemFormUiBinder uiBinder = GWT.create(ItemFormUiBinder.class);
40
    
40
    
41
    private final String HANDSETS = "Handsets",
41
    private final String HANDSETS = "Handsets",
Line 50... Line 50...
50
                      TABLE_INDEX_TP = 4;
50
                      TABLE_INDEX_TP = 4;
51
 
51
 
52
    @UiField TextBox productGroup;
52
    @UiField TextBox productGroup;
53
    @UiField TextBox brand, modelNumber, modelName, color, comments;
53
    @UiField TextBox brand, modelNumber, modelName, color, comments;
54
    @UiField TextBox mrp, sellingPrice, weight, bestDealText, bestDealValue, bestSellingRank;
54
    @UiField TextBox mrp, sellingPrice, weight, bestDealText, bestDealValue, bestSellingRank;
55
    @UiField DateBox startDate, retireDate;
55
    @UiField DateBox startDate, retireDate, comingSoonStartDate, expectedArrivalDate;
56
    @UiField Button addButton, cancelButton;
56
    @UiField Button addButton, cancelButton, comingSoonButton;
57
    @UiField CheckBox defaultForEntity, risky;
57
    @UiField CheckBox defaultForEntity, risky;
58
    @UiField FlexTable headerVendor, vendorTable;
58
    @UiField FlexTable headerVendor, vendorTable;
59
    @UiField FlexTable headerVendorM, vendorTableM;
59
    @UiField FlexTable headerVendorM, vendorTableM;
60
    @UiField ListBox preferredVendor, defaultWarehouse, preferredWarehouse;
60
    @UiField ListBox preferredVendor, defaultWarehouse, preferredWarehouse;
61
    
61
    
Line 286... Line 286...
286
            }
286
            }
287
        } catch(Exception ex) {
287
        } catch(Exception ex) {
288
            Window.alert("Invalid start date format");
288
            Window.alert("Invalid start date format");
289
            return;
289
            return;
290
        }
290
        }
-
 
291
        if(comingSoonStartDate.getValue()==null){
-
 
292
        	item.setComingSoonStartDate(null);
-
 
293
        }else {
-
 
294
        	item.setComingSoonStartDate(comingSoonStartDate.getValue().getTime());
-
 
295
        }
-
 
296
        if(expectedArrivalDate.getValue()==null){
-
 
297
        	item.setExpectedArrivalDate(null);
-
 
298
        }else {
-
 
299
        	item.setExpectedArrivalDate(expectedArrivalDate.getValue().getTime());
-
 
300
        }
291
        item.setBestDealsText(bestDealText.getText().trim());
301
        item.setBestDealsText(bestDealText.getText().trim());
292
        try {
302
        try {
293
            if(!bestDealValue.getText().trim().equals("")) {
303
            if(!bestDealValue.getText().trim().equals("")) {
294
                double bdValue = Double.parseDouble(bestDealValue.getText().trim());
304
                double bdValue = Double.parseDouble(bestDealValue.getText().trim());
295
                if(bdValue < 0) {
305
                if(bdValue < 0) {
Line 426... Line 436...
426
            Window.alert("Transfer Price cannot be more than MOP.");
436
            Window.alert("Transfer Price cannot be more than MOP.");
427
            return false;
437
            return false;
428
        }
438
        }
429
        return true;
439
        return true;
430
    }
440
    }
-
 
441
    
-
 
442
	@UiHandler("comingSoonButton")
-
 
443
	void onComingSoonButtonClick(ClickEvent event) {
-
 
444
		ComingSoonDialog cd = new ComingSoonDialog(this);
-
 
445
		cd.show();
-
 
446
	}
-
 
447
	
-
 
448
	public void setComingSoonStartDate(Date date){
-
 
449
		this.comingSoonStartDate.setValue(date);
-
 
450
	}
-
 
451
	public void setBestDealsText(String bestDealsText){
-
 
452
		this.bestDealText.setText(bestDealsText);
-
 
453
	}
-
 
454
 
-
 
455
	public void setExpectedArrivalDate(Date date){
-
 
456
		this.expectedArrivalDate.setValue(date);
-
 
457
	}
-
 
458
 
-
 
459
	@Override
-
 
460
	public String getBestDealsText() {
-
 
461
		return this.bestDealText.getValue();
-
 
462
	}
-
 
463
 
-
 
464
	@Override
-
 
465
	public Date getComingSoonStartDate() {
-
 
466
		return this.comingSoonStartDate.getValue();
-
 
467
	}
-
 
468
 
-
 
469
	@Override
-
 
470
	public Date getExpectedArrivalDate() {
-
 
471
		return this.comingSoonStartDate.getValue();
-
 
472
	}
431
}
473
}