Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33507 tejus.loha 1
$(document).on('click', ".onboarding-form1", function () {
2
    doGetAjaxRequestHandler(`${context}/onboardingForm`,
3
        function (response) {
4
            $('#' + 'main-content').html(response);
5
        });
6
});
7
 
33577 tejus.loha 8
 
9
$(document).on('change', "#maritalStatus", function () {
10
    let maritalStatus = $(this).val();
11
    console.log("maritalStatus - " + maritalStatus);
12
    if (maritalStatus == 1) {
13
        $(".loiAnniversaryDate").removeClass('hide-model');
14
        $(".loiAnniversaryDate").addClass('show-model');
15
    } else {
16
        $(".loiAnniversaryDate").removeClass('show-model');
17
        $(".loiAnniversaryDate").addClass('hide-model');
18
    }
19
 
20
});
21
 
33578 tejus.loha 22
 
33577 tejus.loha 23
$(document).on('click', ".submitLoiForm", function () {
24
    // Gather input values
25
    const referId = $('select[name="referId"]').val();
26
    const billingAddress = $('select[name="billingAddress"]').val();
27
    const firstName = $('input[name="firstName"]').val();
28
    const lastName = $('input[name="lastName"]').val();
29
    const mobile = $('input[name="mobile"]').val();
30
    const email = $('input[name="email"]').val();
31
    const landline = $('input[name="landline"]').val();
32
    const dob = $('input[name="dob"]').val();
33
    var maritalStatus = $('select[name="maritalStatus"]').val();
34
    console.log("maritalStatus - ", maritalStatus);
35
    const anniversaryDate = $('input[name="anniversaryDate"]').val();
36
    const panNo = $('input[name="panNo"]').val();
37
    const adharNo = $('input[name="adharNo"]').val();
38
    const gstNo = $('input[name="gstNo"]').val();
39
    const bankName = $('input[name="bankName"]').val();
40
    const ifscCode = $('input[name="ifscCode"]').val();
41
    const accountNo = $('input[name="accountNo"]').val();
42
    const businessType = $('select[name="businessType"]').val();
43
    const companyName = $('input[name="companyName"]').val();
44
    const gstPin = $('input[name="gstPin"]').val();
45
    const gstState = $('input[name="gstState"]').val();
46
    const gstCity = $('input[name="gstCity"]').val();
47
    const gstDistrict = $('input[name="gstDistrict"]').val();
48
    const agreeWalletValue = $('select[name="agreeWalletValue"]').val();
49
    const storeArea = $('input[name="storeArea"]').val();
50
    const storePotential = $('input[name="storePotential"]').val();
51
    const lessCommitReason = $('input[name="lessCommitReason"]').val();
52
    const vivoCommitmentAmount = $('input[name="vivoCommitmentAmount"]').val();
53
    const oppoCommitmentAmount = $('input[name="oppoCommitmentAmount"]').val();
54
    const samsungCommitmentAmount = $('input[name="samsungCommitmentAmount"]').val();
55
    const xiaomiCommitmentAmount = $('input[name="xiaomiCommitmentAmount"]').val();
56
    const accessoriesCommitmentAmount = $('input[name="accessoriesCommitmentAmount"]').val();
57
    const otherBrandsCommitmentAmount = $('input[name="otherBrandsCommitmentAmount"]').val();
58
    const totalCommit = $('input[name="totaCommitmentAmount"]').val();
59
    console.log("totalCommit - ", totalCommit);
60
    let minCommint = totalCommit >= storePotential * (70 / 100);
61
    const agreedBrandFees = $('select[name="agreedBrandFees"]').val();
62
    console.log("agreedBrandFees - ", agreedBrandFees);
63
    const brandFeesCollected = $('input[name="brandFeesCollected"]').val();
64
    const paymentMode = $('select[name="paymentMode"]').val();
65
    console.log("paymentMode - ", paymentMode);
66
    const paymentReferenceNo = $('input[name="paymentReferenceNo"]').val();
33578 tejus.loha 67
    const feeCollectingDate = $('input[name="feeCollectingDate"]').val();
33577 tejus.loha 68
 
69
    let missingFields = [];
70
    if (!firstName) missingFields.push('First Name');
71
    if (!referId) missingFields.push('Refer by');
72
    if (!lastName) missingFields.push('Last Name');
73
    if (mobile.length < 10 || !mobile) {
74
        missingFields.push('Mobile number should be 10 digit');
75
    }
76
    if (!minCommint) {
77
        if (!lessCommitReason) missingFields.push('Less Commit Reason');
78
    }
79
    if (!maritalStatus) missingFields.push('Marital Status');
80
    if (maritalStatus == 1) {
81
        if (!anniversaryDate) missingFields.push('Anniversary Date');
82
    }
83
    if (!email) missingFields.push('Email');
84
    if (!dob) missingFields.push('dob(Date of Birth)');
85
    if (!panNo) missingFields.push('Pan Number');
86
    if (!adharNo) missingFields.push('Aadhar Number');
87
    if (!gstNo) missingFields.push('GST Number');
88
    if (!bankName) missingFields.push('Bank Name');
89
    if (!ifscCode) missingFields.push('IFSC code');
90
    if (!accountNo) missingFields.push('Account Number');
91
    if (!businessType) missingFields.push('businessType');
92
    if (!companyName) missingFields.push('Company Name');
93
    if (!agreeWalletValue) missingFields.push('Agree Wallet Value');
94
    if (!storeArea) missingFields.push('storeArea');
95
    if (!storePotential) missingFields.push('Store Potential');
96
    if (!oppoCommitmentAmount) missingFields.push('Oppo Commitment');
97
    if (!vivoCommitmentAmount) missingFields.push('Vivo Commitment');
98
    if (!samsungCommitmentAmount) missingFields.push('Samsung Commitment');
99
    if (!xiaomiCommitmentAmount) missingFields.push('Xiaomi Commitment');
100
    if (!accessoriesCommitmentAmount) missingFields.push('Accessories Commitment');
101
    if (!otherBrandsCommitmentAmount) missingFields.push('other Brands Commitment');
102
    if (!agreedBrandFees) missingFields.push('Agreed Brand Fees');
103
    if (!brandFeesCollected) missingFields.push('Brand Fees Collected');
104
    if (!paymentMode) missingFields.push('Payment Mode');
105
    if (!paymentReferenceNo) missingFields.push('Payment Reference No');
33578 tejus.loha 106
    if (!feeCollectingDate) missingFields.push('Fee Collecting Date');
33577 tejus.loha 107
 
108
    if (missingFields.length > 0) {
109
        alert('The following fields are required: ' + missingFields.join(', '));
110
        return;
111
    }
112
 
113
    const loiFormData = {
114
        referId: referId,
115
        businessType: businessType,
116
        firstName: firstName,
117
        lastName: lastName,
118
        mobile: mobile,
119
        email: email,
120
        landline: landline,
121
        dob: dob,
122
        anniversaryDate: anniversaryDate,
123
        panNo: panNo,
124
        adharNo: adharNo,
125
        gstNo: gstNo,
126
        bankName: bankName,
127
        ifscCode: ifscCode,
128
        accountNo: accountNo,
129
        companyName: companyName,
130
        gstPin: gstPin,
131
        gstState: gstState,
132
        gstCity: gstCity,
133
        gstDistrict: gstDistrict,
134
        agreeWalletValue: agreeWalletValue,
135
        storeArea: storeArea,
136
        storePotential: storePotential,
137
        lessCommitReason: lessCommitReason,
138
        vivoCommitmentAmount: vivoCommitmentAmount,
139
        oppoCommitmentAmount: oppoCommitmentAmount,
140
        samsungCommitmentAmount: samsungCommitmentAmount,
141
        xiaomiCommitmentAmount: xiaomiCommitmentAmount,
142
        accessoriesCommitmentAmount: accessoriesCommitmentAmount,
143
        otherBrandsCommitmentAmount: otherBrandsCommitmentAmount,
144
        agreedBrandFees: agreedBrandFees,
145
        brandFeesCollected: brandFeesCollected,
146
        paymentMode: paymentMode,
147
        paymentReferenceNo: paymentReferenceNo,
33578 tejus.loha 148
        feeCollectingTimeStamp: feeCollectingDate,
33577 tejus.loha 149
        billingAddress: billingAddress
150
    };
151
    console.log("form data - ", loiFormData);
152
    if (confirm("Are you sure to submit the form ?")) {
153
        doPostAjaxRequestWithJsonHandler(`${context}/submitLoiForm`, JSON.stringify(loiFormData), function (response) {
154
            console.log('responsee', response);
33507 tejus.loha 155
            if (response) {
156
                alert("Your LOI form Submitted successfully ");
157
                pendingLoiForm("main-content");
158
 
159
            } else {
160
                alert("Your LOI form not Submitted , try again ");
161
                doGetAjaxRequestHandler(`${context}/onboardingForm`,
162
                    function (response) {
163
                        $('#' + 'main-content').html(response);
164
                    });
165
            }
166
        });
167
    }
168
});
33578 tejus.loha 169
 
33507 tejus.loha 170
$(document).on('click', ".updateOnboardingForm", function () {
171
    let loiId = $(this).val();
172
    console.log("form id - ", loiId);
173
    doGetAjaxRequestHandler(context + "/updateOnboardingForm?loiId=" + loiId,
174
        function (response) {
175
            $('#' + 'main-content').html(response);
176
        });
177
});
178
 
33577 tejus.loha 179
$(document).on('click', ".updateLoiFormData", function () {
33507 tejus.loha 180
    let loiId = $(this).val();
181
    let formData = {};
182
    let jsonData = JSON.stringify(objectifyForm($("form[name='Loi_Form']").serializeArray())).trim();
33577 tejus.loha 183
    doPostAjaxRequestWithJsonHandler(`${context}/updateLoiFormData?loiId=` + loiId, jsonData, function (response) {
33507 tejus.loha 184
        if (response) {
185
            alert("LOI Form Updated Successfully..");
186
        }
187
        pendingLoiForm("main-content");
188
    });
189
 
190
});
191
 
192
$(document).on('click', ".pending-onboarding-form", function () {
193
    doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
194
        function (response) {
195
            $('#' + 'main-content').html(response);
196
        });
197
});
198
$(document).on('click', "#addBrandFeePayment", function () {
199
    let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
200
    let loiId = $(this).val();
201
    console.log("form id -", loiId);
202
    for (var key in formData) {
203
        if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
204
            alert("The (" + key + ") value is blank please fill this field !");
205
            return false;
206
        }
207
    }
208
    let jsonData = JSON.stringify(formData);
33525 tejus.loha 209
    if (confirm("Are you sure all payment details are correct ? once payment is add ,you can't able to change details.")) {
210
        doPostAjaxRequestWithJsonHandler(`${context}/brandfeeCollection?loiId=` + loiId, jsonData, function (response) {
211
            console.log("brand collection...");
212
            if (response) {
213
                alert("Payment add successfully...");
214
                pendingLoiForm("main-content");
33507 tejus.loha 215
 
33525 tejus.loha 216
            } else {
217
                //console
218
            }
219
        });
220
    } else {
221
        //Do nothing
222
    }
33507 tejus.loha 223
 
224
});
225
 
226
$(document).on('click', ".generateLoi", function () {
227
    let loiId = $(this).val();
228
    console.log("form id - ", loiId);
229
    doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
230
        function (response) {
231
            $('#' + 'main-content').html(response);
232
        });
233
});
234
 
235
$(document).on('click', "#LOI_otp", function () {
236
    let loiId = $(this).val();
237
    console.log("loiId-", loiId);
33577 tejus.loha 238
    if (confirm("Are you sure to send OTP ?")) {
239
        doPostAjaxRequestHandler(`${context}/loiAcceptanceOtp?loiId=` + loiId,
240
            function (response) {
241
                alert(response);
242
                doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
243
                    function (response) {
244
                        $('#' + 'main-content').html(response);
245
                    });
246
            });
247
    } else {
248
        alert("OTP not send .");
249
    }
250
 
33507 tejus.loha 251
});
252
 
253
 
254
$(document).on('click', ".onboardingFormDone", function () {
255
    let loiId = $(this).val();
256
    var loi = $(document).find(".upload-form-loi input[type=file]").val();
257
    console.log("form id - ", loiId);
258
    doPostAjaxRequestHandler(`${context}/uploadLoi?loiId=${loiId}&loi=${loi}`,
259
        function (response) {
260
            $('#' + 'main-content').html(response);
261
        });
262
});
263
 
264
//confirmPayment
33525 tejus.loha 265
$(document).on('click', ".paymentConfirmBtn", function () {
266
    let approval = $(this).data('approval');
33507 tejus.loha 267
    let bfcId = $(this).val();
33525 tejus.loha 268
    let description = "All details are correct";
269
    if (confirm("Are you sure to confirm this payment ?")) {
270
        doPutAjaxRequestHandler(`${context}/feePaymentApproval?bfcId=${bfcId}&feePaymentStatus=${approval}&description=${description}`,
271
            function (response) {
272
                if (response) {
273
                    alert("Payment is confirm successfully");
274
                }
275
                pendingLoiForm("main-content");
276
            });
277
    } else {
278
        //do nothing
279
    }
280
});
281
 
282
$(document).on('click', ".paymentRejectBtn", function () {
33507 tejus.loha 283
    let approval = $(this).data('approval');
33525 tejus.loha 284
    let bfcId = $(this).val();
285
    let description;
286
    description = prompt("Reason for rejection..");
287
    if (description !== null) {
288
        if (confirm("Are you sure to Reject this payment ?")) {
289
            doPutAjaxRequestHandler(`${context}/feePaymentApproval?bfcId=${bfcId}&feePaymentStatus=${approval}&description=${description}`,
290
                function (response) {
291
                    if (!response) {
292
                        alert("Payment is rejected successfully");
293
                    }
294
                    pendingLoiForm("main-content");
295
                });
296
        } else {
297
            //do nothing
298
        }
299
    } else {
300
        alert("Please mention the reason as description and try again");
301
    }
33507 tejus.loha 302
});
303
$(document).on('click', ".upload-document-form", function () {
304
    let loiId = $(this).val();
305
    doPutAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
306
        function (response) {
307
            $('#' + 'main-content').html(response);
308
        });
309
});
310
$(document).on('input', 'table#OnboardingDocumentTable input[type=file]', function () {
311
    if (confirm('Confirm file upload ?')) {
312
        var fileSelector = $(this)[0];
313
        if (fileSelector != undefined
314
            && fileSelector.files[0] != undefined) {
315
            var file = this.files[0];
316
            console.log("file", file);
317
            let fileInput = $(this);
318
            console.log("fileInput", file);
319
            uploadDocument(file, function (documentId) {
320
                console.log("documentIdzzz  : ", documentId);
321
                fileInput.closest('td').find(".documentId").val(documentId);
322
            });
323
        }
324
    }
325
});
326
$(document).on('click', ".mk_docApproval", function () {
327
    let loiId = $(this).data('form_id');
328
    let docMasterId = $(this).data('doc_master_id');
329
    let flag = $(this).data('flag');
330
    console.log("flag -", flag);
331
    doPutAjaxRequestHandler(`${context}/documentVerify?loiId=${loiId}&docMasterId=${docMasterId}&flag=${flag}`,
332
        function (response) {
333
            alert(response);
334
            doPutAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
335
                function (response) {
336
                    $('#' + 'main-content').html(response);
337
                });
338
 
339
        });
340
});
341
$(document).on('click', "#uploadDocumentbtn1", function () {
342
    if (confirm("Are you sure to upload all documents ?")) {
343
        var loiId = $(this).val();
344
        var loiDocModels = [];
345
        console.log("loiId -", loiId);
346
        $("#OnboardingDocumentTable > tbody > tr").each(function (rowIndex) {
347
            var marsterId = $(this).find(".masterId").val();
348
            var docId = $(this).find(".documentId").val();
349
            var docName = $(this).find(".documentName").val();
350
            console.log("marsterId -", marsterId);
351
            var loiDocModel = {
352
                documentId: docId,
353
                documentName: docName,
354
                documentMasterId: marsterId
355
            };
356
            loiDocModels.push(loiDocModel);
357
        });
358
        console.log(loiDocModels);
359
        var loiDocModelData = JSON.stringify(loiDocModels);
360
        doPostAjaxRequestWithJsonHandler(`${context}/uploadOnboardingDocument?loiId=${loiId}`, loiDocModelData, function (response) {
361
            console.log('response-', response);
362
            pendingLoiForm("main-content");
363
        });
364
    } else {
365
        //Nothing to do
366
    }
367
 
368
 
369
});
370
$(document).on('click', ".documnet-verifed", function () {
371
    let loiId = $(this).val();
372
    if (confirm("Are you sure to verify All document ?")) {
373
        doPutAjaxRequestHandler(`${context}/documentApproved?loiId=${loiId}`,
374
            function (response) {
375
                alert(response);
376
                pendingLoiForm("main-content");
377
            });
378
    } else {
379
        console.log(" All docs not verify");
380
        //Nothing
381
    }
382
});
383
$(document).on('click', ".loiFormComplete", function () {
384
    let loiId = $(this).val();
385
    if (confirm("Are you sure all things are done ?")) {
386
        doPutAjaxRequestHandler(`${context}/loiFormComplete?loiId=${loiId}`,
387
            function (response) {
388
                alert(response);
389
            });
390
        pendingLoiForm("main-content");
391
 
392
    } else {
393
        console.log("Loi form not completed !");
394
        //Nothing
395
    }
396
});
397
$(document).on('click', ".deleteLoiForm", function () {
398
    let loiId = $(this).val();
399
    if (confirm("Are you sure to delete ?")) {
400
        doPutAjaxRequestHandler(`${context}/deleteLoiForm?loiId=${loiId}`,
401
            function (response) {
402
                if (response) {
403
                    alert("Loi form deleted ");
404
                } else {
405
                    //nothing to do
406
                }
407
            });
408
        doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
409
            function (response) {
410
                $('#' + 'main-content').html(response);
411
            });
412
 
413
    } else {
414
        console.log("");
415
        //Nothing
416
    }
417
});
418
 
419
$(document).on('click', ".CompletedLoiForm", function () {
420
    doPutAjaxRequestHandler(`${context}/completedLoiForms`,
421
        function (response) {
422
            $('#' + 'main-content').html(response);
423
        });
424
});
425
 
426
$(document).on('click', "#createNewOnboardingPanel", function () {
427
    let loiId = $(this).val();
428
    let authId = $(this).closest('tr').find('.authId').val();
429
    if (authId != " ") {
430
 
431
        doPutAjaxRequestHandler(`${context}/createNewOnboardingPanel?loiId=${loiId}&authId=${authId}`,
432
            function (response) {
433
                if (response) {
434
                    doPutAjaxRequestHandler(`${context}/completedLoiForms`,
435
                        function (response) {
436
                            $('#' + 'main-content').html(response);
437
                        });
438
                } else {
439
                    //nothing
440
                }
441
 
442
            });
443
    } else {
444
        alert("Please choose RBM ");
445
    }
446
 
447
});
448
 
449
function pendingLoiForm(domId) {
450
    doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
451
        function (response) {
452
            $('#' + domId).html(response);
453
        });
454
}