Subversion Repositories SmartDukaan

Rev

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

Rev 34158 Rev 34338
Line 14... Line 14...
14
            // }
14
            // }
15
 
15
 
16
            var json = JSON.parse(orderCustomerDetailsJson());
16
            var json = JSON.parse(orderCustomerDetailsJson());
17
            const keysToCheck = Object.keys(json);
17
            const keysToCheck = Object.keys(json);
18
 
18
 
19
            console.log("keysToCheck json = " + keysToCheck);
-
 
-
 
19
 
20
            if (keysToCheck.length) {
20
            if (keysToCheck.length) {
21
                for (const key of keysToCheck) {
21
                for (const key of keysToCheck) {
22
                    if (!json[key]) {
22
                    if (!json[key]) {
-
 
23
                        if (key !== "gstNumber") {
-
 
24
                            console.log("keysToCheck json = " + key);
23
                        alert(`${key} is required`);
25
                            alert(`${key} is required`);
24
                        return;
26
                            return;
-
 
27
                        }
-
 
28
 
25
                    }
29
                    }
26
                }
30
                }
27
            }
31
            }
28
            console.log("orderCustomerDetails json = " + json);
32
            console.log("orderCustomerDetails json = " + json);
29
 
33
 
30
            if (confirm("Are you sure you want to update Customer Details!")) {
34
            if (confirm("Are you sure you want to update Customer Details!")) {
31
                var invoiceNumber = $("#search-invoice-text").val();
35
                var invoiceNumber = $("#update-detail-invoice-number").val();
32
                console.log("About to make AJAX request with JSON: ", json);
36
                console.log("About to make AJAX request with JSON: ", invoiceNumber);
33
                doPutAjaxRequestWithJsonHandler(`${context}/customerDetails?invoiceNumber= ${invoiceNumber}`, JSON.stringify(json), function (response) {
37
                doPutAjaxRequestWithJsonHandler(`${context}/customerDetails?invoiceNumber= ${invoiceNumber}`, JSON.stringify(json), function (response) {
34
                    $('#search-order-details-container').html(response);
38
                    $('#search-order-details-container').html(response);
35
                    alert("Customer Details has been successfully updated.");
39
                    alert("Customer Details has been successfully updated.");
36
                });
40
                });
37
 
41