Subversion Repositories SmartDukaan

Rev

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

Rev 32434 Rev 32468
Line 23... Line 23...
23
        if (unitPrice < 0 || (unitPrice > 0 && unitPrice - discount < 0)) {
23
        if (unitPrice < 0 || (unitPrice > 0 && unitPrice - discount < 0)) {
24
            alert("Invalid unit/discount price");
24
            alert("Invalid unit/discount price");
25
            $(this).focus();
25
            $(this).focus();
26
            return;
26
            return;
27
        }
27
        }
28
 
-
 
-
 
28
        let lines = $("#order-items").find('tbody>tr:gt(0)').length;
-
 
29
        if (lines > 3) {
29
        calculateTotalAmount();
30
            calculateTotalAmount(this);
-
 
31
        }
30
        $('.mk_check_plans').trigger('click', ['manual']);
32
        $('.mk_check_plans').trigger('click', ['manual']);
-
 
33
 
31
    });
34
    });
32
 
35
 
33
 
36
 
34
    $(document).on('change', "form#cd input.insuranceamount", function () {
37
    $(document).on('change', "form#cd input.insuranceamount", function () {
35
        calculateTotalAmount();
38
        calculateTotalAmount();
Line 147... Line 150...
147
    $('#mobilePlansModal').modal({show: true});
150
    $('#mobilePlansModal').modal({show: true});
148
 
151
 
149
}
152
}
150
 
153
 
151
 
154
 
152
function calculateTotalAmount() {
155
function calculateTotalAmount(inputEle) {
-
 
156
    if (typeof inputEle !== "undefined") {
-
 
157
        let itemId = $(inputEle).attr("itemid");
-
 
158
        let unitPrice = inputEle.value;
-
 
159
        $("#order-items").find(`input.unitPrice[itemid=${itemId}]`).each(function () {
-
 
160
            this.value = unitPrice;
-
 
161
        })
-
 
162
 
-
 
163
    }
153
    var netPayableAmount = 0;
164
    var netPayableAmount = 0;
154
    var totaInsuranceAmount = 0;
165
    var totaInsuranceAmount = 0;
155
    $("#order-items").find('tbody>tr:gt(0)').each(function (index, el) {
166
    $("#order-items").find('tbody>tr:gt(0)').each(function (index, el) {
156
        var rowTotal = 0;
167
        var rowTotal = 0;
157
        let $tr = $(el);
168
        let $tr = $(el);