Subversion Repositories SmartDukaan

Rev

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

Rev 33891 Rev 33908
Line 37... Line 37...
37
        console.log(row);
37
        console.log(row);
38
        var brandlength = $(this).data("brandlength");
38
        var brandlength = $(this).data("brandlength");
39
        var onboardingId = $(row).find("td:eq(0)").text();
39
        var onboardingId = $(row).find("td:eq(0)").text();
40
        var partnerCode = $(row).find("td:eq(4)").text();
40
        var partnerCode = $(row).find("td:eq(4)").text();
41
 
41
 
42
        console.log("brandlength" + brandlength)
42
        console.log("brandlength" + brandlength);
43
        var brandCodes = []
43
        var brandCodes = [];
44
        for (let i = 5; i < 5 + brandlength; i++) {
44
        for (let i = 5; i < 5 + brandlength; i++) {
45
 
-
 
46
            brandCodes.push($(row).find(
45
            brandCodes.push($(row).find(
47
                "td:eq(" + i + ") input[type='text']").val());
46
                "td:eq(" + i + ") input[type='text']").val());
48
        }
47
        }
49
 
48
 
50
        console.log("bands" + brandCodes);
49
        console.log("bands" + brandCodes);
51
 
50
 
52
        dmsCode = {
51
        dmsCode = {
53
            "onboardingId": onboardingId,
52
            "onboardingId": onboardingId,
54
            "partnerCode": partnerCode,
53
            "partnerCode": partnerCode,
55
 
-
 
56
            "brands": brandCodes,
54
            "brands": brandCodes,
57
        }
55
        };
58
 
56
 
59
        var jsonObject = JSON.stringify(dmsCode)
57
        var jsonObject = JSON.stringify(dmsCode);
60
 
58
 
61
        console.log("jsonObject" + jsonObject);
59
        console.log("jsonObject" + jsonObject);
62
        if (confirm("Are you sure you want to submit") == true) {
60
        if (confirm("Are you sure you want to submit") == true) {
63
            doAjaxRequestWithJsonHandler(context + "/partnerDealerSubmit",
61
            doAjaxRequestWithJsonHandler(context + "/partnerDealerSubmit",
64
                "POST", jsonObject, function (response) {
62
                "POST", jsonObject, function (response) {
65
 
-
 
66
                    row.html(response);
63
                    row.html(response);
67
 
64
 
68
                });
65
                });
69
        }
66
        }
70
    });
67
    });
Line 223... Line 220...
223
    let isValid = true;  // To track if all validations pass
220
    let isValid = true;  // To track if all validations pass
224
    $('#requiredNoc tbody tr').each(function () {
221
    $('#requiredNoc tbody tr').each(function () {
225
        let brandId = $(this).find('.brandId').val();
222
        let brandId = $(this).find('.brandId').val();
226
        let documentId = $(this).find('.documentId').val();
223
        let documentId = $(this).find('.documentId').val();
227
        let commitAmount = $(this).find('.commitAmount').val();
224
        let commitAmount = $(this).find('.commitAmount').val();
228
        let isActive = $(this).find('.mk_LoiBrandCommit-isActive').val();
225
        let isActive = $(this).find('.mk_loiBrandCommit-isActive').val();
229
        let nocRequiredSelect = $(this).find('.noc-required');
226
        let nocRequiredSelect = $(this).find('.noc-required');
230
        let nocRequired = nocRequiredSelect.val();
227
        let nocRequired = nocRequiredSelect.val();
-
 
228
 
231
        console.log("nocRequired - ", nocRequired);
229
        console.log("nocRequired - ", nocRequired);
232
        console.log("documentId - ", documentId);
230
        console.log("documentId - ", documentId);
233
        console.log("commitAmount - ", commitAmount);
231
        console.log("commitAmount - ", commitAmount);
234
        console.log("isActive - ", isActive);
232
        console.log("isActive - ", isActive);
235
 
233
 
Line 255... Line 253...
255
        return;
253
        return;
256
    }
254
    }
257
 
255
 
258
    // Get loiId from the button value
256
    // Get loiId from the button value
259
    let loiId = $(this).val();
257
    let loiId = $(this).val();
-
 
258
    let onBoardingId = $(this).data('onboardingid');
260
 
259
 
261
    console.log("loiId - ", loiId);
260
    console.log("loiId - ", loiId);
-
 
261
    console.log("onBoardingId  - ", onBoardingId);
262
    console.log("data - ", data);
262
    console.log("data - ", data);
263
    // Check if data is available to send
263
    // Check if data is available to send
264
    if (data.length === 0) {
264
    if (data.length === 0) {
265
        alert("Please select a value for NOC in at least one row then try to click Upload all ");
265
        alert("Please select a value for NOC in at least one row then try to click Upload all ");
266
        return;
266
        return;
267
    }
267
    }
268
    let payload = JSON.stringify(data);
268
    let payload = JSON.stringify(data);
269
    console.log("data - ", data);
269
    console.log("data - ", data);
270
    if (confirm("Are you sure to upload")) {
270
    if (confirm("Are you sure to upload")) {
271
        //updateLoiBrandCommintment
-
 
272
        doPostAjaxRequestWithJsonHandler(`${context}/uploadNoc?loiId=${loiId}`, payload, function (response) {
271
        doPostAjaxRequestWithJsonHandler(`${context}/updateLoiBrandCommitment?loiId=${loiId}&onBoardingId=${onBoardingId}`, payload, function (response) {
273
            if (response) {
272
            if (response) {
274
                $('#nocUploadModal').modal('hide');
273
                $('#nocUploadModal').modal('hide');
275
                alert("NOC uploaded successfully");
274
                alert("NOC uploaded successfully");
276
            }
275
            }
277
        });
276
        });
Line 490... Line 489...
490
    doGetAjaxRequestHandler(`${context}/brandNocUpdateForm?onboardingId=` + onboardingId, function (response) {
489
    doGetAjaxRequestHandler(`${context}/brandNocUpdateForm?onboardingId=` + onboardingId, function (response) {
491
        $('#nocUploadBody').html(response);
490
        $('#nocUploadBody').html(response);
492
    });
491
    });
493
}
492
}
494
 
493
 
-
 
494
 
495
var table = $('#onboardingLegal').DataTable();
495
var table = $('#onboardingLegal').DataTable();
496
$(document).on('dblclick', '#onboardingLegal tbody tr', function () {
496
$(document).on('dblclick', '#onboardingLegal tbody tr', function () {
497
    console.log("dblclick");
497
    console.log("dblclick");
498
    var data = table.row(this).data();
498
    var data = table.row(this).data();
499
 
499