Subversion Repositories SmartDukaan

Rev

Rev 35549 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35549 Rev 36064
Line 129... Line 129...
129
                minlength: "Number should be of 10 digits"
129
                minlength: "Number should be of 10 digits"
130
            }
130
            }
131
        },
131
        },
132
        submitHandler: function (form, event) {
132
        submitHandler: function (form, event) {
133
            event.preventDefault();
133
            event.preventDefault();
-
 
134
            if ($(form).data('submitting')) return;
-
 
135
            $(form).data('submitting', true);
134
            let customerAddress = {};
136
            let customerAddress = {};
135
            customerAddress['name'] = $("#firstName").val();
137
            customerAddress['name'] = $("#firstName").val();
136
            customerAddress['lastName'] = $("#lastName").val();
138
            customerAddress['lastName'] = $("#lastName").val();
137
            customerAddress['line1'] = $("#line1").val();
139
            customerAddress['line1'] = $("#line1").val();
138
            customerAddress['line2'] = $("#line2").val();
140
            customerAddress['line2'] = $("#line2").val();
Line 144... Line 146...
144
            customerAddress['country'] = "India";
146
            customerAddress['country'] = "India";
145
            doPostAjaxRequestWithJsonHandler(`${context}/customer/address?customerId=${customerId}`, JSON.stringify(customerAddress), function (response) {
147
            doPostAjaxRequestWithJsonHandler(`${context}/customer/address?customerId=${customerId}`, JSON.stringify(customerAddress), function (response) {
146
                $("#address-body").prepend(getAddressTr(response.response));
148
                $("#address-body").prepend(getAddressTr(response.response));
147
                $('#newaddressModal').modal('toggle');
149
                $('#newaddressModal').modal('toggle');
148
                $("#address-body").find('a.select-address').click();
150
                $("#address-body").find('a.select-address').click();
-
 
151
                $(form).data('submitting', false);
149
            });
152
            });
150
        }
153
        }
151
 
154
 
152
    });
155
    });
153
 
156
 
Line 248... Line 251...
248
        $(this).closest('table').data("addressselected", "true").find('td').css("font-weight", "normal");
251
        $(this).closest('table').data("addressselected", "true").find('td').css("font-weight", "normal");
249
        $(this).closest('tr').find('td').css("font-weight", "bold");
252
        $(this).closest('tr').find('td').css("font-weight", "bold");
250
        selectedAddressId = $(this).data("addressid");
253
        selectedAddressId = $(this).data("addressid");
251
    });
254
    });
252
    $(document).on('click', 'button.btn-add-address', function () {
255
    $(document).on('click', 'button.btn-add-address', function () {
-
 
256
        var $btn = $(this);
-
 
257
        if ($btn.prop('disabled')) return;
-
 
258
        $btn.prop('disabled', true);
253
        $("form#newaddress").submit();
259
        $("form#newaddress").submit();
-
 
260
        setTimeout(function () {
-
 
261
            $btn.prop('disabled', false);
-
 
262
        }, 2000);
-
 
263
    });
-
 
264
 
-
 
265
    $('#newaddressModal').on('hidden.bs.modal', function () {
-
 
266
        $('form#newaddress').data('submitting', false);
254
    });
267
    });
255
 
268
 
256
}
269
}
257
 
270
 
258
function validateOrderDetails() {
271
function validateOrderDetails() {
Line 503... Line 516...
503
    retObj['customer'] = (customerObj);
516
    retObj['customer'] = (customerObj);
504
    retObj['paymentOptions'] = (paymentOptionIdAmount);
517
    retObj['paymentOptions'] = (paymentOptionIdAmount);
505
    retObj['poId'] = $('#poid').val();
518
    retObj['poId'] = $('#poid').val();
506
 
519
 
507
    retObj['poItemId'] = $('#poItemId').val();
520
    retObj['poItemId'] = $('#poItemId').val();
-
 
521
    retObj['sendInvoiceOnWhatsApp'] = $('#sendInvoiceOnWhatsApp').is(':checked');
508
 
522
 
509
    console.log(retObj);
523
    console.log(retObj);
510
    return JSON.stringify(retObj);
524
    return JSON.stringify(retObj);
511
}
525
}
512
 
526