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
 
8
$(document).on('click', ".submitOnboardingForm", function () {
9
    if (confirm("Are you sure to submit form ?")) {
10
        let formData = objectifyForm($("form[name='Loi_Form']").serializeArray());
11
        for (var key in formData) {
12
            if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
13
                alert("The (" + key + ") value is blank please fill this field !");
14
                return false;
15
            }
16
        }
17
        let jsonData = JSON.stringify(formData);
18
        doPostAjaxRequestWithJsonHandler(`${context}/submitOnboardingForm`, jsonData, function (response) {
19
            if (response) {
20
                alert("Your LOI form Submitted successfully ");
21
                pendingLoiForm("main-content");
22
 
23
            } else {
24
                alert("Your LOI form not Submitted , try again ");
25
                doGetAjaxRequestHandler(`${context}/onboardingForm`,
26
                    function (response) {
27
                        $('#' + 'main-content').html(response);
28
                    });
29
            }
30
        });
31
    } else {
32
        //nothing to do now
33
    }
34
 
35
});
36
$(document).on('click', ".updateOnboardingForm", function () {
37
    let loiId = $(this).val();
38
    console.log("form id - ", loiId);
39
    doGetAjaxRequestHandler(context + "/updateOnboardingForm?loiId=" + loiId,
40
        function (response) {
41
            $('#' + 'main-content').html(response);
42
        });
43
});
44
 
45
$(document).on('click', ".updateOnboardingFormData", function () {
46
    let loiId = $(this).val();
47
    let formData = {};
48
    let jsonData = JSON.stringify(objectifyForm($("form[name='Loi_Form']").serializeArray())).trim();
49
    doPostAjaxRequestWithJsonHandler(`${context}/updateOnboardingFormData?loiId=` + loiId, jsonData, function (response) {
50
        if (response) {
51
            alert("LOI Form Updated Successfully..");
52
        }
53
        pendingLoiForm("main-content");
54
    });
55
 
56
});
57
 
58
$(document).on('click', ".pending-onboarding-form", function () {
59
    doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
60
        function (response) {
61
            $('#' + 'main-content').html(response);
62
        });
63
});
64
$(document).on('click', "#addBrandFeePayment", function () {
65
    let formData = objectifyForm($("form[name='brandFeeCollectionForm']").serializeArray());
66
    let loiId = $(this).val();
67
    console.log("form id -", loiId);
68
    for (var key in formData) {
69
        if (formData.hasOwnProperty(key) && formData[key].trim() === '') {
70
            alert("The (" + key + ") value is blank please fill this field !");
71
            return false;
72
        }
73
    }
74
    let jsonData = JSON.stringify(formData);
33525 tejus.loha 75
    if (confirm("Are you sure all payment details are correct ? once payment is add ,you can't able to change details.")) {
76
        doPostAjaxRequestWithJsonHandler(`${context}/brandfeeCollection?loiId=` + loiId, jsonData, function (response) {
77
            console.log("brand collection...");
78
            if (response) {
79
                alert("Payment add successfully...");
80
                pendingLoiForm("main-content");
33507 tejus.loha 81
 
33525 tejus.loha 82
            } else {
83
                //console
84
            }
85
        });
86
    } else {
87
        //Do nothing
88
    }
33507 tejus.loha 89
 
90
});
91
 
92
$(document).on('click', ".generateLoi", function () {
93
    let loiId = $(this).val();
94
    console.log("form id - ", loiId);
95
    doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
96
        function (response) {
97
            $('#' + 'main-content').html(response);
98
        });
99
});
100
 
101
$(document).on('click', "#LOI_otp", function () {
102
    let loiId = $(this).val();
103
    console.log("loiId-", loiId);
104
    doPostAjaxRequestHandler(`${context}/loiAcceptanceOtp?loiId=` + loiId,
105
        function (response) {
106
            alert(response);
107
            doGetAjaxRequestHandler(context + "/generateLoi?loiId=" + loiId,
108
                function (response) {
109
                    $('#' + 'main-content').html(response);
110
                });
111
        });
112
});
113
 
114
 
115
$(document).on('click', ".onboardingFormDone", function () {
116
    let loiId = $(this).val();
117
    var loi = $(document).find(".upload-form-loi input[type=file]").val();
118
    console.log("form id - ", loiId);
119
    doPostAjaxRequestHandler(`${context}/uploadLoi?loiId=${loiId}&loi=${loi}`,
120
        function (response) {
121
            $('#' + 'main-content').html(response);
122
        });
123
});
124
 
125
//confirmPayment
33525 tejus.loha 126
$(document).on('click', ".paymentConfirmBtn", function () {
127
    let approval = $(this).data('approval');
33507 tejus.loha 128
    let bfcId = $(this).val();
33525 tejus.loha 129
    let description = "All details are correct";
130
    if (confirm("Are you sure to confirm this payment ?")) {
131
        doPutAjaxRequestHandler(`${context}/feePaymentApproval?bfcId=${bfcId}&feePaymentStatus=${approval}&description=${description}`,
132
            function (response) {
133
                if (response) {
134
                    alert("Payment is confirm successfully");
135
                }
136
                pendingLoiForm("main-content");
137
            });
138
    } else {
139
        //do nothing
140
    }
141
});
142
 
143
$(document).on('click', ".paymentRejectBtn", function () {
33507 tejus.loha 144
    let approval = $(this).data('approval');
33525 tejus.loha 145
    let bfcId = $(this).val();
146
    let description;
147
    description = prompt("Reason for rejection..");
148
    if (description !== null) {
149
        if (confirm("Are you sure to Reject this payment ?")) {
150
            doPutAjaxRequestHandler(`${context}/feePaymentApproval?bfcId=${bfcId}&feePaymentStatus=${approval}&description=${description}`,
151
                function (response) {
152
                    if (!response) {
153
                        alert("Payment is rejected successfully");
154
                    }
155
                    pendingLoiForm("main-content");
156
                });
157
        } else {
158
            //do nothing
159
        }
160
    } else {
161
        alert("Please mention the reason as description and try again");
162
    }
33507 tejus.loha 163
});
164
$(document).on('click', ".upload-document-form", function () {
165
    let loiId = $(this).val();
166
    doPutAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
167
        function (response) {
168
            $('#' + 'main-content').html(response);
169
        });
170
});
171
$(document).on('input', 'table#OnboardingDocumentTable input[type=file]', function () {
172
    if (confirm('Confirm file upload ?')) {
173
        var fileSelector = $(this)[0];
174
        if (fileSelector != undefined
175
            && fileSelector.files[0] != undefined) {
176
            var file = this.files[0];
177
            console.log("file", file);
178
            let fileInput = $(this);
179
            console.log("fileInput", file);
180
            uploadDocument(file, function (documentId) {
181
                console.log("documentIdzzz  : ", documentId);
182
                fileInput.closest('td').find(".documentId").val(documentId);
183
            });
184
        }
185
    }
186
});
187
$(document).on('click', ".mk_docApproval", function () {
188
    let loiId = $(this).data('form_id');
189
    let docMasterId = $(this).data('doc_master_id');
190
    let flag = $(this).data('flag');
191
    console.log("flag -", flag);
192
    doPutAjaxRequestHandler(`${context}/documentVerify?loiId=${loiId}&docMasterId=${docMasterId}&flag=${flag}`,
193
        function (response) {
194
            alert(response);
195
            doPutAjaxRequestHandler(`${context}/uploadDocumentForm?loiId=${loiId}`,
196
                function (response) {
197
                    $('#' + 'main-content').html(response);
198
                });
199
 
200
        });
201
});
202
$(document).on('click', "#uploadDocumentbtn1", function () {
203
    if (confirm("Are you sure to upload all documents ?")) {
204
        var loiId = $(this).val();
205
        var loiDocModels = [];
206
        console.log("loiId -", loiId);
207
        $("#OnboardingDocumentTable > tbody > tr").each(function (rowIndex) {
208
            var marsterId = $(this).find(".masterId").val();
209
            var docId = $(this).find(".documentId").val();
210
            var docName = $(this).find(".documentName").val();
211
            console.log("marsterId -", marsterId);
212
            var loiDocModel = {
213
                documentId: docId,
214
                documentName: docName,
215
                documentMasterId: marsterId
216
            };
217
            loiDocModels.push(loiDocModel);
218
        });
219
        console.log(loiDocModels);
220
        var loiDocModelData = JSON.stringify(loiDocModels);
221
        doPostAjaxRequestWithJsonHandler(`${context}/uploadOnboardingDocument?loiId=${loiId}`, loiDocModelData, function (response) {
222
            console.log('response-', response);
223
            pendingLoiForm("main-content");
224
        });
225
    } else {
226
        //Nothing to do
227
    }
228
 
229
 
230
});
231
$(document).on('click', ".documnet-verifed", function () {
232
    let loiId = $(this).val();
233
    if (confirm("Are you sure to verify All document ?")) {
234
        doPutAjaxRequestHandler(`${context}/documentApproved?loiId=${loiId}`,
235
            function (response) {
236
                alert(response);
237
                pendingLoiForm("main-content");
238
            });
239
    } else {
240
        console.log(" All docs not verify");
241
        //Nothing
242
    }
243
});
244
$(document).on('click', ".loiFormComplete", function () {
245
    let loiId = $(this).val();
246
    if (confirm("Are you sure all things are done ?")) {
247
        doPutAjaxRequestHandler(`${context}/loiFormComplete?loiId=${loiId}`,
248
            function (response) {
249
                alert(response);
250
            });
251
        pendingLoiForm("main-content");
252
 
253
    } else {
254
        console.log("Loi form not completed !");
255
        //Nothing
256
    }
257
});
258
$(document).on('click', ".deleteLoiForm", function () {
259
    let loiId = $(this).val();
260
    if (confirm("Are you sure to delete ?")) {
261
        doPutAjaxRequestHandler(`${context}/deleteLoiForm?loiId=${loiId}`,
262
            function (response) {
263
                if (response) {
264
                    alert("Loi form deleted ");
265
                } else {
266
                    //nothing to do
267
                }
268
            });
269
        doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
270
            function (response) {
271
                $('#' + 'main-content').html(response);
272
            });
273
 
274
    } else {
275
        console.log("");
276
        //Nothing
277
    }
278
});
279
 
280
$(document).on('click', ".CompletedLoiForm", function () {
281
    doPutAjaxRequestHandler(`${context}/completedLoiForms`,
282
        function (response) {
283
            $('#' + 'main-content').html(response);
284
        });
285
});
286
 
287
$(document).on('click', "#createNewOnboardingPanel", function () {
288
    let loiId = $(this).val();
289
    let authId = $(this).closest('tr').find('.authId').val();
290
    if (authId != " ") {
291
 
292
        doPutAjaxRequestHandler(`${context}/createNewOnboardingPanel?loiId=${loiId}&authId=${authId}`,
293
            function (response) {
294
                if (response) {
295
                    doPutAjaxRequestHandler(`${context}/completedLoiForms`,
296
                        function (response) {
297
                            $('#' + 'main-content').html(response);
298
                        });
299
                } else {
300
                    //nothing
301
                }
302
 
303
            });
304
    } else {
305
        alert("Please choose RBM ");
306
    }
307
 
308
});
309
 
310
function pendingLoiForm(domId) {
311
    doGetAjaxRequestHandler(`${context}/pendingOnboardingForm`,
312
        function (response) {
313
            $('#' + domId).html(response);
314
        });
315
}