Subversion Repositories SmartDukaan

Rev

Rev 24044 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4207 mandeep.dh 1
$(function() {
2
    $('input#add-item').live('click', function() {
3
        addNewRowForItem();
4
    });
5
 
6
    $('a#remove-item').live('click', function() {
7
        $(this).closest('tr').remove();
8
        updateTotalAmount();
9
    });
10
 
11
    $('#bulk-order').live('submit', function() {
12
        submitBulkOrderForm();
13
        return false;
14
    });
5527 anupam.sin 15
 
16
    $('#orderType').live('change', function() {
17
    	hideShowTin();
18
    	return false;
19
    });
4207 mandeep.dh 20
 
21
    $('input[name$=unit_price]').live('change', function() {
22
        var quantity = $(this).closest('tr').find('input[name$=quantity]');
23
        var price    = $(this).val();
24
        $(this).closest('tr').find('#item-amount').html(quantity * price);
25
        updateTotalAmount();
26
    });
27
 
28
    $('input[name$=quantity]').live('change', function() {
29
        var price = $(this).closest('tr').find('input[name$=unit_price]');
30
        var quantity    = $(this).val();
31
        $(this).closest('tr').find('#item-amount').html(quantity * price);
32
        updateTotalAmount();
33
    });
34
 
35
    $('input[name$=item_id]').live('change', function() {
24033 amit.gupta 36
    	var count=0;
24044 amit.gupta 37
    	var that = this;
24043 amit.gupta 38
    	$(this).closest('table').find('tr').each(function(el){
24045 amit.gupta 39
    		if($(this).find('input[name=item_id]').val()==$(that).val()) {
24033 amit.gupta 40
    			count += 1;
41
    		}
42
    	});
43
    	if(count==2) {
44
    		alert("item should not be repeated twice");
45
    		return;
46
    	}
4207 mandeep.dh 47
        updateModelName($(this).closest('tr'), $(this).val());
24033 amit.gupta 48
        updateModelPrice($(this).closest('tr'), $(this).val());
4207 mandeep.dh 49
    });
22452 amit.gupta 50
 
51
    $('#walletFlag').live('change', function(){
52
        $('.rtgsgroup').toggle();
53
        $('.rtgsgroup input').attr('disabled', function(i, v) { return !v; });
54
    });
4207 mandeep.dh 55
});