Subversion Repositories SmartDukaan

Rev

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

Rev 33149 Rev 33437
Line 1... Line 1...
1
$(function () {
1
$(function () {
2
    //Price change handler
2
    //Price change handler
3
    $(document).on('change', "form#cd input.unitPrice, form#cd input.discount", function () {
3
    $(document).on('change', "form#cd input.unitPrice, form#cd input.discount", function () {
4
        var $row = $(this).closest('tr'); // Get the closest <tr> parent of the changed input
4
        var $row = $(this).closest('tr'); // Get the closest <tr> parent of the changed input
5
 
-
 
6
        var unitPrice = parseFloat($row.find('input.unitPrice').val());
5
        var unitPrice = parseFloat($row.find('input.unitPrice').val());
-
 
6
 
7
        if (isNaN(unitPrice)) {
7
        if (isNaN(unitPrice)) {
8
            unitPrice = 0;
8
            unitPrice = 0;
9
        }
9
        }
10
        var discount = parseFloat($row.find('input.discount').val());
10
        var discount = parseFloat($row.find('input.discount').val());
11
        var maxDiscount = parseFloat($row.find('input.discount').data('maxdiscount'));
11
        var maxDiscount = parseFloat($row.find('input.discount').data('maxdiscount'));
Line 60... Line 60...
60
        if (!isNaN(sellingPrice) && parseFloat(sellingPrice) >= mop) {
60
        if (!isNaN(sellingPrice) && parseFloat(sellingPrice) >= mop) {
61
            price = parseFloat(sellingPrice);
61
            price = parseFloat(sellingPrice);
62
        } else {
62
        } else {
63
            price = mop;
63
            price = mop;
64
        }
64
        }
-
 
65
        var poiId = parseFloat($(this).closest("tr").find("input.poiId").val());
65
        var discount = parseFloat($(this).closest("tr").find("input.discount").val());
66
        var discount = parseFloat($(this).closest("tr").find("input.discount").val());
66
        if (!isNaN(discount)) {
67
        if (!isNaN(discount)) {
67
            price = price - discount;
68
            price = price - discount;
68
        }
69
        }
69
        let that = this;
70
        let that = this;
70
        doGetAjaxRequestHandler(`${context}/checkplans?price=${price}&itemId=${itemId}`, function (response) {
71
        doGetAjaxRequestHandler(`${context}/checkplans?price=${price}&itemId=${itemId}&poiId=${poiId}`, function (response) {
71
            var obj = JSON.parse(response);
72
            var obj = JSON.parse(response);
72
            if (obj != null) {
73
            if (obj != null) {
73
                getInsurancePlansModal(obj, that);
74
                getInsurancePlansModal(obj, that);
74
                return;
75
                return;
75
            } else {
76
            } else {