Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
4687 mandeep.dh 1
$(function() {
4754 mandeep.dh 2
    $('input#add-lineitem').live('click', function() {
3
        addNewRowForLineItem($(this).parent().parent().children('table.lineitems'));
4687 mandeep.dh 4
    });
5
 
4754 mandeep.dh 6
    $('#remove-lineitem').live('click', function() {
7
        $(this).closest('tr').remove();
8
        updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));
4687 mandeep.dh 9
    });
10
 
4754 mandeep.dh 11
    $('input[name$=itemId]').live('change', function() {
12
        updateModelNameXferPrice($(this).closest('tr'), $(this).val(), $(this).attr('supplierId'));
13
    });
14
 
15
    $('input[name$=unitPrice]').live('change', function() {
16
        var quantity = $(this).closest('tr').find('input[name$=quantity]');
17
        var price    = $(this).val();
18
        $(this).closest('tr').find('#amount').html(quantity * price);
19
        updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));
20
    });
21
 
22
    $('input[name$=quantity]').live('change', function() {
23
        var price = $(this).closest('tr').find('input[name$=unitPrice]');
24
        var quantity    = $(this).val();
25
        $(this).closest('tr').find('#amount').html(quantity * price);
26
        updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));
27
    });
28
 
29
    $('form.create-purchase-order').live('submit', function() {
30
        submitPurchaseOrderForm($(this));
31
        return false;
32
    });
33
 
34
    $('#editAndResendPOButton').live('click', function() {
35
        $(this).siblings('input[name$=resendPO]').val(1);
36
        submitEditPurchaseOrderForm($(this).closest('form'), $(this).siblings('input[name$=id]').val());
37
    });
38
 
39
    $('#editPOButton').live('click', function() {
40
        $(this).siblings('input[name$=resendPO]').val(0);
41
        submitEditPurchaseOrderForm($(this).closest('form'), $(this).siblings('input[name$=id]').val());
42
    });
43
 
44
    $('.show-details').live('click', function() {
45
        $(this).closest('tr').siblings().removeClass('bold');
46
        $(this).closest('tr').addClass('bold');
47
        $('div.lineitems').hide();
48
        $('#lineitems-' + $(this).attr('supplierId')).show();
49
    });
4687 mandeep.dh 50
 
4754 mandeep.dh 51
    $('.lineitems #cancel').live('click', function() {
52
        $('div.lineitems').hide();
53
        $('#suppliers').find('tr').removeClass('bold');        
54
    });
55
 
56
    $('form.edit-purchase-order').live('submit', function() {
57
        return false;
58
    });
59
 
60
    $('#amendCancel').live('click', function() {
61
        document.location.href = '/inventory/purchase-order/' + $(this).attr('purchaseOrderId') + '/edit';
62
    });
7410 amar.kumar 63
 
64
    $('#close-po').live('click', function() {
65
        closePO($(this).attr('poId'));
66
    });
9416 amar.kumar 67
 
9925 amar.kumar 68
    $('#open-po-button').live('click', function() {
69
        openPO($(this).attr('poId'));
70
    });
9829 amar.kumar 71
 
72
    $('.change-po-warehouse').live('click', function() {
73
        $(this).hide();
74
        $(this).siblings('.change-po-warehouse-form').show();
9416 amar.kumar 75
    });
9829 amar.kumar 76
 
77
    $('.cancel-change-po-warehouse').live('click', function() {
78
        $(this).parent().siblings('.change-po-warehouse').show();
79
        $(this).parent().hide();
80
    });
10324 manish.sha 81
 
82
    $('.cForm-class').change(function() {
83
    	if ($(this).is(':checked')) {
84
    		$(".cstCostTypeDiv-class").show();
85
    		$('.cstCostType-class').val('ours');
86
    		$('.extraCstInputs-class').hide();
87
    	}
88
    	else{
89
    		$(".cstCostTypeDiv-class").hide();
90
    		$('.cstCostType-class').val('ours');
91
    		$('.extraCstInputs-class').hide();
92
    	}
93
    });
94
 
95
    $('.cstCostType-class').change(function() {
96
    	var cstCostType = $(this).val();
97
    	if(cstCostType=="custom"){
98
    		$('.extraCstInputs-class').show();
99
    		$('.cstBorneByUs-class').val('0.00');
100
    	}
101
    	else{
102
    		$('.extraCstInputs-class').hide();
103
    		$('.cstBorneByUs-class').val('0.00');
104
    	}
105
    });
4687 mandeep.dh 106
});