PageSourceSearch

https://wepaynepal.com/assets/js/LoginJS/Personal.js

js wepaynepal.com collected 2026-09-24 11:05:50 UTC 251,214 bytes, 5,193 lines download raw bytes

1var isValid = false;
2var ajaxcomplete = false;
3var secondstepreview = false;
4var myFilename = "";
5var card, stripe;
6$(document).keypress(
7    function (event) {
8        if (event.which == '13') {
9            event.preventDefault();
10        }
11    });
12$(document).ready(function () {
13    $("#hdncheckfrontdoc").val(0);
14    $("#hdncheckbackdoc").val(0);
15    $('.showloader').show();
16    var currurl = window.location.pathname;
17    myFilename = getPageName(currurl);
18    if (myFilename.toString().toLowerCase() == "personal") {
19        $('#smartwizard').smartWizard({
20            selected: 0,  // Initial selected step, 0 = first step
21            keyNavigation: false, // Enable/Disable keyboard navigation(left and right keys are used if enabled)
22            autoAdjustHeight: true, // Automatically adjust content height
23            cycleSteps: false, // Allows to cycle the navigation of steps
24            backButtonSupport: false, // Enable the back button support
25            /*useURLhash: false,*/ // Enable selection of the step based on url hash
26            lang: {  // Language variables
27                next: 'Continue',
28                previous: 'Back'
29            },
30            toolbarSettings: {
31                toolbarPosition: 'bottom', // none, top, bottom, both
32                toolbarButtonPosition: 'center', // left, right
33                showNextButton: true, // show/hide a Next button
34                showPreviousButton: false,
35                toolbarExtraButtons: [
36                    $('<button></button>').text('Initiate Transaction')
37                        .addClass('fancydefault continuebtn').removeClass('hide').click(function () {
38                          
39                            var bankchecktypt = $("#hdnbankchecktype").val();
40                            var paymenttype = $("#hdnpaymenttype").val();
41                            var csymbol = $("#currencyfrom").val().trim();
42
43                            if (bankchecktypt == "1") {
44                                GetBankTransferDetails();
45                            }
46                            else if (bankchecktypt == "2") {
47                                StripePay();
48                            }
49                            else if (bankchecktypt == "3") {
50                                GetBankTransferDetails();
51
52                            }
53                            else if (paymenttype == "2") {
54                                //GetBanks();
55                            }
56                            else if (paymenttype == "4") {
57                                GetStripeElement();
58                            }
59                            else if (paymenttype == "8" && csymbol == "AUD") {
60
61                                AddTransaction(1);
62                            }
63                            return false;
64                        }),
65                    $('<button></button>').text('Cancel this transfer')
66                        .addClass('fancydefault cancelbtn').removeClass('hide').click(function () {
67                            //$('#sstep1').trigger('click');
68                            window.location.href = '/RecentActivity';
69                            return false;
70                        })
71                ]// show/hide a Previous button
72            },
73            anchorSettings: {
74                anchorClickable: true, // Enable/Disable anchor navigation
75                enableAllAnchors: false, // Activates all anchors clickable all times
76                markDoneStep: true, // add done css
77                enableAnchorOnDoneStep: true // Enable/Disable the done steps navigation
78            },
79            contentURL: null, // content url, Enables Ajax content loading. can set as data data-content-url on anchor
80            disabledSteps: [],    // Array Steps disabled
81            errorSteps: [],
82            useURLhash: false,
83            showStepURLhash: false
84            //hiddenSteps: [1]
85        });
86
87        $("#smartwizard").on("leaveStep", function (e, anchorObject, stepNumber, stepDirection) {
88         
89            var paymentcomplete = $("#hdnpaymentcomplete").val();
90            if (paymentcomplete == 0) {
91                if (stepNumber == 0) {
92                    if (stepDirection == "backward") {
93                        $("#sstep4").parent().removeClass("done");
94                        $("#sstep5").parent().removeClass("done");
95                    }
96                    if (!$('.currency1').find('.alert-danger').hasClass('hide')) {
97                        return false;
98                    }
99                    else if (!$('.currency2').find('.alert-danger').hasClass('hide')) {
100                        return false;
101                    }
102                    else if ($('.sw-btn-next').hasClass('disabled')) {
103                        return false;
104                    }
105
106                }
107                else if (stepNumber == 1) {
108
109                    if (secondstepreview == true) {
110                        ajaxcomplete = false;
111                        return true;
112                    }
113                    else if (ajaxcomplete == false && stepDirection == "forward") {
114
115                        var hdnmanualpersonal = $("#hdnmanualpersonal").val();
116                        if (hdnmanualpersonal == 2) {
117                            CheckValidUser();
118                        }
119                        return false;
120                    }
121                    else {
122                        ajaxcomplete = false;
123                        return true;
124                    }
125                }
126                else if (stepNumber == 2) {
127                    var hdntransferreason = $("#hdntransferreason").val();
128                    if (hdntransferreason != "0" && stepDirection == "forward") {
129                        if (hdntransferreason != "5" || (hdntransferreason == "5" && $("#othertransferreason").val() != "")) {
130                            if (ajaxcomplete == false) {
131                                Review("1");
132                                return false;
133                            }
134                            else {
135                                ajaxcomplete = false;
136                                return true;
137                            }
138                        }
139                        else if (hdntransferreason == "5" && $("#othertransferreason").val() == "") {
140                            AlertConfirm("Please Add Other Reason");
141                            return false;
142                        }
143
144                    }
145                    else if (hdntransferreason == "0" && stepDirection == "forward") {
146                        AlertConfirm("Please Select Reason");
147                        return false;
148                    }
149
150                }
151                else if (stepNumber == 3) {                   
152                    var hdntransferreference = $("#hdntransferreference").val();
153                    if (hdntransferreference == "0" && stepDirection == "forward") {
154                        AlertConfirm("Please Select Reference");
155                        return false;
156                    }
157                    else if (hdntransferreference == "1" && $("#othertransferrefrence").val() == "") {
158                        AlertConfirm("Please Add Other Reference");
159                        return false;
160                    }
161
162                }
163                else if (stepNumber == 4) {
164                    
165                }
166                else if (stepNumber == 5) {
167
168                }
169            } else {
170                return false;
171            }
172
173        });
174
175        $("#smartwizard").on("showStep", function (e, anchorObject, stepNumber, stepDirection) {
176            /*alert("You are on step "+stepNumber+" now");*/
177       
178            var paymentcomplete = $("#hdnpaymentcomplete").val();
179            if (paymentcomplete == 0) {
180                if (stepNumber == 0) {
181                    $('.sw-toolbar').show();
182                    $(".boxscreen").show();
183                    $(".tabscreen").hide();
184                    $(".uploadscreen").hide();
185                    $('.ui.selection.dropdown').dropdown({ 'set selected': 01 });
186                    $(".sw-btn-group-extra").hide();
187                    $(".sw-btn-group").show();
188                    $(".fancydefault").addClass('hide');
189                    $("#hdnbankchecktype").val('');
190                    $(".sw-btn-next").show();
191                    if (stepDirection == "backward") {
192                        $("#sstep4").parent().removeClass("done");
193                        $("#sstep5").parent().removeClass("done");
194                    }
195
196                }
197                if (stepNumber == 1) {
198                    $('.sw-toolbar').hide();
199                    $(".boxscreen").show();
200                    $(".tabscreen").hide();
201                    $(".uploadscreen").hide();
202                    $(".fancydefault").addClass('hide');
203                    $("#hdnbankchecktype").val('');
204                    $(".sw-btn-group-extra").hide();
205                    $(".sw-btn-group").show();
206                    var checkstep = $("#hdncheckstep").val();
207                    if (checkstep == "1" && stepDirection == "forward") {
208                        ajaxcomplete = true;
209                        $("#smartwizard").smartWizard("next");
210
211                    }
212                    $('.sw-btn-next').addClass("disabled");
213                    $('.sw-btn-next').addClass("hide");
214                    var hdnik = $("#hdnik").val();
215                    var hdnmanualpersonal = $("#hdnmanualpersonal").val();
216
217                    if (hdnik == "3" || hdnik == "6" || hdnik == "1") {
218                        $("#fpersonaldetail").addClass("hide");
219                        $("#ManualPersonalForm").addClass("hide");
220                        $("#fApprovedpersonaldetail").removeClass("hide");
221                        if (hdnik == "1") {
222                            $("#pkycstatus").html("In-Review");
223                            $("#pkycmessage").html("Thank you for submitting your KYC verification request. We are verifying your documents.");
224                        }
225                        else if (hdnik == "6") {
226                            $("#pkycstatus").html("In-Complete");
227                            $("#pkycmessage").html("You are just one step away. We need a few more details to complete your KYC.");
228                        }
229                        else if (hdnik == "3") {
230                            $("#pkycstatus").html("Completed");
231                            $("#pkycmessage").html("Your kyc is already approved.");
232                        }
233                        $('.sw-btn-next').removeClass("disabled");
234                        $('.sw-btn-next').removeClass("hide");
235                        secondstepreview = true;
236                    }
237                    else {
238                        if (hdnmanualpersonal == 1) {
239                            $("#fpersonaldetail").removeClass("hide");
240                            $("#ManualPersonalForm").addClass("hide");
241                            $("#specifyinput").removeClass("hide");
242
243                        }
244                        else {
245
246                            $('.sw-btn-next').removeClass("disabled");
247                            $('.sw-btn-next').removeClass("hide");
248                            $("#specifyinput").addClass("hide");
249                            $("#ManualPersonalForm").removeClass("hide");
250                            $("#fpersonaldetail").addClass("hide");
251
252                        }
253
254                        $("#fApprovedpersonaldetail").addClass("hide");
255                    }
256
257                }
258                if (stepNumber == 2) {
259                    UploadVerify();
260                }
261                if (stepNumber == 3) {
262
263                    $(".sw-btn-group-extra").hide();
264                    $(".sw-btn-group").show();
265                    $(".fancydefault").addClass('hide');
266
267                    $("#hdnbankchecktype").val('');
268                    $(".sw-btn-next").hide();
269                    $(".summary6").addClass('hide');
270                    $(".summary7").addClass('hide');
271                    $(".reviewdata").show();
272                }
273                if (stepNumber == 4) {
274                    $(".sw-btn-group").hide();
275                    $(".sw-btn-group-extra").show();
276                    $(".fancydefault").removeClass('hide');
277                    $(".summary3").show();
278                    $("#hdnbankchecktype").val(3);
279                    $(".summary4").addClass('hide');
280                    $(".summary5").addClass('hide');
281                    $(".stripesummary").addClass('hide');
282
283
284                    //$(".sw-btn-next").removeClass("disabled");
285                }
286                if (stepNumber == 5) {
287
288                }
289            }
290            else {
291                return false;
292            }
293        });
294    }
295    CC(null, 'both', 0, 0);
296    if (myFilename.toString().toLowerCase() == "personal") {
297        GUD();
298    }
299    let input = document.getElementById('amountfrom');
300
301    // Init a timeout variable to be used below
302    let timeout = null;
303
304    // Listen for keystroke events
305    input.addEventListener('keyup', function (e) {
306        // Clear the timeout if it has already been set.
307        // This will prevent the previous task from executing
308        // if it has been less than <MILLISECONDS>
309        clearTimeout(timeout);
310
311        // Make a new timeout set to go off in 1000ms (1 second)
312        timeout = setTimeout(function () {
313
314            console.log('Input Value:', input.value);
315            var $agentField = $("#hdnagentid");
316            if ($agentField.length > 0) {
317                var agentid = $agentField.val();
318                if ($.trim(agentid)) {
319                    CurrencyToChanged(0);
320                }
321            }
322            else {
323                CC(this, 'from', 0, 0);
324            }
325        }, 1000);
326    });
327
328    let inputto = document.getElementById('amountto');
329
330    // Init a timeout variable to be used below
331    let timeoutto = null;
332
333    // Listen for keystroke events
334    inputto.addEventListener('keyup', function (e) {
335        // Clear the timeout if it has already been set.
336        // This will prevent the previous task from executing
337        // if it has been less than <MILLISECONDS>
338        clearTimeout(timeoutto);
339
340        // Make a new timeout set to go off in 1000ms (1 second)
341        timeoutto = setTimeout(function () {
342            console.log('Input Value:', inputto.value);
343            CC(this, 'to', 0, 0);
344        }, 1000);
345    });
346});
347
348function showrecipienttab() {
349    $("#image-preview").css('background-image', 'url("")');
350    $(".upload-box").removeClass('imguploaded');
351    $(".confirmbtn").hide();
352    $(".passportbox").hide();
353    $(".issuecountbox").hide();
354    $(".initialverify").show();
355    $(".boxscreen").show();
356    $(".tabscreen").hide();
357    $(".uploadscreen").hide();
358    $(".transfer-reason").hide();
359    $(".sw-btn-group-extra").hide();
360    $(".sw-btn-group").hide();
361    $(".fancydefault").addClass('hide');
362    $("#hdnbankchecktype").val('');
363    var input = $("input[name=file]");
364    var fileName = input.val();
365
366    if (fileName) { // returns true if the string is not empty
367        input.val('');
368    }
369    //document.getElementById("image-label").innerHTML = "Choose File";
370    //document.getElementById("image-label1").innerHTML = "Choose File";
371    //document.getElementById("widget-title").innerHTML = "Upload passport front and back image";
372    var to = $("#currencyto").val().trim();
373
374    GR(to);
375    GetRelationDropDowns();
376    GetTransferPurpose();
377    //GetStates();
378}
379
380function checkReason(obj) {
381    if (obj.innerHTML.toString().toLowerCase().indexOf("other") > -1) {
382        $("#othertransferreason").removeClass("hide");
383    }
384    else {
385        $("#othertransferreason").addClass("hide");
386        $("#othertransferreason").val("");
387    }
388
389    return false;
390}
391
392function checkRefrence(obj) {
393    if (obj.innerHTML.toString().toLowerCase().indexOf("other") > -1) {
394        $("#othertransferrefrence").removeClass("hide");
395    }
396    else {
397        $("#othertransferrefrence").addClass("hide");
398        $("#othertransferrefrence").val("");
399    }
400
401    return false;
402}
403
404function checkagentreason() {
405    if ($("#ContentPlaceHolder1_drptransferpurpose option:selected").text().toString().toLowerCase().indexOf("other") > -1) {
406        $("#othertransferreason").closest(".otherpurpose").removeClass("hide");
407    }
408    else {
409        $("#othertransferreason").closest(".otherpurpose").addClass("hide");
410        $("#othertransferreason").val("");
411    }
412
413    return false;
414}
415
416function checkagentrefrence() {
417
418    if ($("#ContentPlaceHolder1_drprefrence option:selected").text().toString().toLowerCase().indexOf("other") > -1) {
419        $("#othertransferrefrence").closest(".transferreference").removeClass("hide");
420    }
421    else {
422        $("#othertransferrefrence").closest(".transferreference").addClass("hide");
423        $("#othertransferrefrence").val("");
424    }
425
426    return false;
427}
428
429function GetStripeElement() {
430
431    $('.showloader').show();
432    var symbol = $("#currencyfrom").val().trim();
433    var amount = $("#amountfrom").val();
434    $.ajax({
435        url: "/Personal.aspx/GetStripeElement",
436        type: "POST",
437        contentType: "application/json; charset=utf-8",
438        dataType: "json",
439        data: '{"symbol": "' + symbol + '","amount": "' + amount + '"}',
440        success: function (data) {
441            if (data.d != "") {
442                var json = $.parseJSON(data.d);
443                var flag = false;
444                $.each(json, function (i, categories) {
445                    if (json[0].Status == "Success") {
446                        flag = true;
447                        $("#hdnstripesecret").val(json[i].Id);
448                        stripe = Stripe('pk_test_51I3I4LFWPAswTc1ZFxw4h4HsEd1yCHUo2qiHJwXTdjkggcSuWucnhqXpJY4mhYImOM2Nx6MlP7A6kYwJ3blLAdpE006GbMjevY');
449                        var elements = stripe.elements();
450                        var style = {
451                            base: {
452                                color: "#32325d",
453                            }
454                        };
455
456                        card = elements.create("card", { style: style });
457                        card.mount("#card-element");
458                        card.on('change', ({ error }) => {
459                            let displayError = document.getElementById('card-errors');
460                            if (error) {
461                                displayError.textContent = error.message;
462                            } else {
463                                displayError.textContent = '';
464                            }
465                        });
466                    }
467                    else {
468                        AlertConfirm(json[i].Status);
469                        return false;
470                    }
471                });
472                if (flag) {
473                    $('.summary3').hide();
474                    $('.stripesummary').removeClass('hide');
475                    $("#hdnbankchecktype").val(2)
476                }
477                $('.showloader').hide();
478            }
479            else {
480                $('.showloader').hide();
481                AlertConfirm(data.d);
482            }
483            return false;
484        },
485        error: function (XMLHttpRequest, textStatus, errorThrown) {
486            $('.showloader').hide();
487            AlertConfirm(XMLHttpRequest.responseText)
488            return false;
489        }
490    });
491
492}
493
494function GetBanks() {
495    $('.showloader').show();
496    $(".banklist").html('');
497    var symbol = $("#currencyfrom").val().trim();
498    $.ajax({
499        url: "/AddMoney.aspx/GetBanks",
500        type: "POST",
501        contentType: "application/json; charset=utf-8",
502        dataType: "json",
503        data: '{"symbol": "' + symbol + '"}',
504        success: function (data) {
505            if (data.d != "") {
506                var json = $.parseJSON(data.d);
507                var flag = false;
508                $.each(json, function (i, categories) {
509                    if (json[0].Status == "Success") {
510                        flag = true;
511
512                        var paystr = '<div class="field border-bottom p-3">';
513                        paystr += '<div class="radio-row">';
514                        paystr += '<div class="ui slider checkbox">';
515                        paystr += '<input type="radio" name="banktypes" id="' + json[i].Id + '">';
516                        paystr += '<label for="anz"><i class="fas fa-university"></i><strong>' + json[i].BankName + '</strong></label>';
517                        paystr += '</div>';
518                        paystr += '</div>';
519                        paystr += '</div>';
520                        $(".banklist").append(paystr);
521                        $("#hdnbankchecktype").val(1);
522                    }
523                    else {
524                        AlertConfirm(json[i].Status);
525                        return false;
526                    }
527                });
528                if (flag) {
529                    $('.summary3').hide();
530                    $('.summary5').removeClass('hide');
531                    $('.ui.checkbox').checkbox();
532                }
533                $('.showloader').hide();
534            }
535            else {
536                $('.showloader').hide();
537                AlertConfirm(data.d);
538            }
539            return false;
540        },
541        error: function (XMLHttpRequest, textStatus, errorThrown) {
542            $('.showloader').hide();
543            AlertConfirm(XMLHttpRequest.responseText)
544            return false;
545        }
546    });
547}
548
549function GetBankTransferDetails() {
550    $('.showloader').show();
551    var username = $('#hdnusername').val();
552    var to = $("#currencyto").val().trim();
553    var from = $("#currencyfrom").val().trim();
554    var amount = $("#amountfrom").val().replace("-", "");
555    $(".bankdetails").html('');
556    /*var Id = $("input[name='banktypes']:checked").attr("Id");*/
557    var Id = 4;
558    if (Id != "" && typeof (Id) !== "undefined") {
559        $.ajax({
560            url: "/AddMoney.aspx/GetBankDetails",
561            type: "POST",
562            contentType: "application/json; charset=utf-8",
563            dataType: "json",
564            data: '{  "Id":"' + parseInt(Id) + '"}',
565            success: function (data) {
566                if (data.d != "") {
567                    var json = $.parseJSON(data.d);
568                     
569                    if (json[0].Status == "Success") {
570                        flag = true;
571                      
572                        //var str = '<div class="col-md-6 mb-5">';
573                        //str += '<dd>Payee name</dd>';
574                        //str += '<p class="lg-text">' + username + '</p>';
575                        //str += '</div>';
576                        var str = '<div class="col-md-6 mb-3">';
577                        str += '<small>Account name</small>';
578                        str += '<p class="">' + $("#hdnCompanyName").val() +'</p>';
579                        str += '</div>';
580                        str += '<div class="col-md-6 mb-3">';
581                        str += '<small>Amount to send</small>';
582                        str += '<p class="">' + $('.txtsramount').html() + '</p>';
583                        str += '</div>';
584                        str += '<div class="col-md-6 mb-3">';
585                        str += '<small>Account Number</small>';
586                        str += '<p id="AccountNumber" class="">' + json[0].MAccountNumber + '</p> ';
587                        str += '</div>';
588                        str += '<div class="col-md-6 mb-3">';
589                        str += '<small>Bsb Code</small>';
590                        str += '<p id="BSBCode" class="">' + json[0].MBsbCode + '</p> ';
591                        str += '</div>';
592                        str += '<div class="col-md-6 mb-3">';
593                        str += '<small>Payment description</small>';
594                        str += '<p id="PaymentDescription" class="urefer">' + json[0].UniqueId + '</p>';
595                        str += '</div>';
596                        str += '<div id="accountdetails" class="hide">';
597                        str += '<p>Account Name:' + $("#hdnCompanyName").val() +'</p>\r\n';
598                        str += '<p>Amount To Send: ' + $("#hffinalsend").val() + '</p>\r\n';
599                        str += '<p>AccountNumber: ' + json[0].MAccountNumber + '</p>\r\n';
600                        str += '<p>BSBCode: ' + json[0].MBsbCode + '</p>\r\n';
601                        str += '<p>PaymentDescription: ' + json[0].UniqueId + '</p>\r\n';
602                        str += '</div>';
603                        $(".bankdetails").append(str);
604                        $('.urefer').html(json[0].UniqueId);
605                        AddTransaction(0);
606                    }
607                    else {
608                        AlertConfirm(json[0].Status);
609                        $('.showloader').hide();
610                        return false;
611                    }
612                }
613                else {
614                    $('.showloader').hide();
615                    AlertConfirm(data.d);
616                }
617                return false;
618            },
619            error: function (XMLHttpRequest, textStatus, errorThrown) {
620                $('.showloader').hide();
621                AlertConfirm(XMLHttpRequest.responseText)
622                return false;
623            }
624        });
625    }
626    else {
627        $('.showloader').hide();
628        AlertConfirm("Please Select Bank");
629        return false;
630    }
631}
632
633function SomeoneNCopy(obj) {
634    $("#someonebody #txtaccountname").val($("#txtsomeoneholdername").val() + " " + $(obj).val());
635}
636
637function SelfNCopy(obj) {
638    $("#selfbody #txtaccountname").val($("#txtaccountholder").val() + " " + $(obj).val());
639}
640
641function JointNCopy(obj) {
642    $("#jointaccountbody #txtaccountname").val($("#txtjointaccountname").val() + " " + $(obj).val());
643}
644
645function BusinessNCopy(obj) {
646    $("#businessbody #txtaccountname").val($("#txtbusinessholdername").val() + " " + $(obj).val());
647}
648
649
650
651function modalclose(id) {
652    $('#' + id).modal('hide').modal('hide dimmer');
653    return false;
654}
655
656
657//function GetBankTransferDetails() {
658//    $('.showloader').show();
659//    var username = $('#hdnusername').val();
660//    var to = $("#currencyto").val().trim();
661//    var from = $("#currencyfrom").val().trim();
662//    var amount = $("#amountfrom").val().replace("-", "");
663//    $(".bankdetails").html('');
664//    var Id = $("input[name='banktypes']:checked").attr("Id");
665//    if (Id != "" && typeof (Id) !== "undefined") {
666//        $.ajax({
667//            url: "/AddMoney.aspx/GetBankDetails",
668//            type: "POST",
669//            contentType: "application/json; charset=utf-8",
670//            dataType: "json",
671//            data: '{  "Id":"' + parseInt(Id) + '"}',
672//            success: function (data) {
673//                if (data.d != "") {
674//                    var json = $.parseJSON(data.d);
675//                    var flag = false;
676//                    var str = '<div class="col-md-6 mb-5">';
677//                    str += '<dd>Payee name</dd>';
678//                    str += '<p class="lg-text">' + username + '</p>';
679//                    str += '</div>';
680//                    str += '<div class="col-md-6 mb-5">';
681//                    str += '<dd>Payment description</dd>';
682//                    str += '<p class="urefer lg-text"></p>';
683//                    str += '</div>';
684//                    str += '<div class="col-md-6 mb-5">';
685//                    str += '<dd>Amount to send</dd>';
686//                    str += '<p class="lg-text">' + $('.txtsramount').html() + '</p>';
687//                    str += '</div>';
688//                    $(".bankdetails").append(str);
689//                    $.each(json, function (i, categories) {
690//                        if (json[0].Status == "Success") {
691//                            flag = true;
692//                            $('.urefer').html(json[0].UniqueId);
693//                            var paystr = '<div class="col-md-6 mb-5">';
694//                            paystr += '<dd>' + json[i].Title + '</dd>';
695//                            paystr += '<p class="lg-text">' + json[i].Description + '</p>';
696//                            paystr += '</div>';
697//                            $(".bankdetails").append(paystr);
698//                        }
699//                        else {
700//                            AlertConfirm(json[i].Status);
701//                            return false;
702//                        }
703//                    });
704//                    if (flag) {
705//                        $('.summary5').removeClass('hide');
706//                        $('.summary4').addClass('hide');
707//                        $(".fancydefault").addClass('hide');
708//                    }
709//                    $('.showloader').hide();
710//                }
711//                else {
712//                    $('.showloader').hide();
713//                    AlertConfirm(data.d);
714//                }
715//                return false;
716//            },
717//            error: function (XMLHttpRequest, textStatus, errorThrown) {
718//                $('.showloader').hide();
719//                AlertConfirm(XMLHttpRequest.responseText)
720//                return false;
721//            }
722//        });
723//    }
724//    else {
725//        $('.showloader').hide();
726//        AlertConfirm("Please Select Bank");
727//        return false;
728//    }
729//}
730
731function UploadVerify() {
732    var hdnik = $("#hdnik").val();
733    var prfimg = $("#hdnprfimg").val();
734    var hdnprftype = $("#hdnprftype").val();
735    $('.tapcube').click(function () {
736        var id = $(this).attr("id");
737        var uniqueid = $(this).attr("data-uniqueid");
738        var twrecipientid = $(this).attr("data-twrecipientid");
739        var name = $(this).attr("data-name");
740        $("#hdnrid").val(id);
741        $("#hdnruniqueid").val(uniqueid);
742        $("#hdntwrid").val(twrecipientid);
743        $("#hdnrecipientname").val(name);
744
745    });
746    $('.startverify').click(function () {
747        $(".initialverify").hide();
748        $(".issuecountbox").show();
749    });
750    $('.backscreen').click(function () {
751        $(".issuecountbox").hide();
752        $(".initialverify").show();
753
754    });
755    $('.backtokycscreen').click(function () {
756        $(".issuecountbox").show();
757        $(".passportbox").hide();
758        $('#frontimage').attr("src", "/assets/FrontPage/images/default_kyc.png");
759        $('#backimage').attr("src", "/assets/FrontPage/images/default_kyc.png");
760        $('#addressimage').attr("src", "/assets/FrontPage/images/default_kyc.png");
761        $("#hdncheckfrontdoc").val(1);
762        $("#hdncheckbackdoc").val(1);
763        $("#hdncheckaddressdoc").val(1);
764
765    });
766    $('.passport-btn').click(function () {
767        $(".issuecountbox").hide();
768        $(".passportbox").show();
769        $(".doc-title-front").html("Passport front side");
770        $(".doc-title-back").html("Passport back side");
771        $("#hdnprftype").val(1);
772    });
773    $('.dlicense-btn').click(function () {
774        $(".issuecountbox").hide();
775        $(".passportbox").show();
776        $(".doc-title-front").html("Drivers Licence front side");
777        $(".doc-title-back").html("Drivers Licence back side");
778        //document.getElementById("widget-title").innerHTML = "Upload front and back of driver's license";
779        $("#hdnprftype").val(2);
780    });
781    $('.national-btn').click(function () {
782        $(".issuecountbox").hide();
783        $(".passportbox").show();
784        $(".doc-title-front").html("National Id front side");
785        $(".doc-title-back").html("National Id back side");
786        //document.getElementById("widget-title").innerHTML = "Upload front and back of national id card";
787        $("#hdnprftype").val(3);
788    });
789    /* Upload Documents Colm Hide on click Back */
790    $('.nav-link.You').click(function () {
791        $(".passportbox").hide();
792        $(".issuecountbox").hide();
793        $(".initialverify").show();
794    });
795    $('.nav-link').click(function () {
796        if ($(this).attr("id").toString().trim() == "sstep4" && ($(this).parent().hasClass("active") || $(this).parent().hasClass("done"))) {
797            Review("0");
798        }
799    });
800    /* Upload Documents Colm Hide on click Back */
801    $('.backtomain').click(function () {
802        $(".passportbox").hide();
803        $(".issuecountbox").show();
804        $("#image-preview").css('background-image', 'url("")');
805        $(".upload-box").removeClass('imguploaded');
806        $(".confirmbtn").hide();
807        var input = $("input[name=file]");
808        var fileName = input.val();
809
810        if (fileName) { // returns true if the string is not empty
811            input.val('');
812        }
813        document.getElementById("image-label").innerHTML = "Choose File";
814        document.getElementById("widget-title").innerHTML = "Upload passport front and back image";
815
816    });
817
818    if ((parseInt(hdnik) != 1 && parseInt(hdnik) != 3) || prfimg == "") {
819        $(".boxscreen").hide();
820        $(".uploadscreen").show();
821        $(".initialverify").hide();
822        $(".issuecountbox").show();
823        $('.sw-btn-next').addClass("disabled");
824        $('.sw-btn-next').addClass("hide");
825        if (hdnprftype == "1") {
826            $(".issuecountbox").hide();
827            $(".passportbox").show();
828            $(".doc-title-front").html("Passport front side");
829            $(".doc-title-back").html("Passport back side");
830            $("#hdnprftype").val(1);
831        }
832        else if (hdnprftype == "2") {
833            $(".issuecountbox").hide();
834            $(".passportbox").show();
835            $(".doc-title-front").html("Drivers Licence front side");
836            $(".doc-title-back").html("Drivers Licence back side");
837            //document.getElementById("widget-title").innerHTML = "Upload front and back of driver's license";
838            $("#hdnprftype").val(2);
839        }
840        else if (hdnprftype == "4") {
841            $(".issuecountbox").hide();
842            $(".passportbox").show();
843            $(".doc-title-front").html("National Health Id front side");
844            $(".doc-title-back").html("National Health Id Licence back side");
845            //document.getElementById("widget-title").innerHTML = "Upload front and back of driver's license";
846            $("#hdnprftype").val(4);
847        }
848        else {
849            $(".issuecountbox").hide();
850            $(".passportbox").show();
851            $(".doc-title-front").html("National Id front side");
852            $(".doc-title-back").html("National Id back side");
853            //document.getElementById("widget-title").innerHTML = "Upload front and back of national id card";
854            $("#hdnprftype").val(3);
855        }
856    }
857    else {
858        $(".boxscreen").hide();
859        $(".uploadscreen").hide();
860        $(".transfer-reason").show();
861        $('.sw-toolbar').show();
862        $("progress").hide();
863        $(".sw-btn-group").show();
864        showrecipienttab();
865    }
866
867
868
869
870}
871
872function UploadMultipleImage() {
873    $('.showloader').show();
874    $(".confirmbtnkyc").addClass("disabled");
875    $(".confirmbtnkyc").attr("disabled", "disabled");
876    var froncount = parseInt($("#hdncheckfrontdoc").val());
877    var backcount = parseInt($("#hdncheckbackdoc").val());
878    var addresscount = parseInt($("#hdncheckaddressdoc").val());
879    var gender = parseInt($("#txtmgender").val());
880    var occupation = $("#txtmoccupation").val();
881    var otheroccupation = $("#txtmotheroccupation").val();
882    if (gender == "" || isNaN(gender)) {
883        $(".confirmbtnkyc").removeClass("disabled");
884        $(".confirmbtnkyc").removeClass("disabled");
885        $('.showloader').hide();
886        AlertConfirmWithoutReload("Please Select Gender");
887
888        return false;
889    }
890    else if (occupation == "") {
891        $(".confirmbtnkyc").removeClass("disabled");
892        $(".confirmbtnkyc").removeClass("disabled");
893        $('.showloader').hide();
894        AlertConfirmWithoutReload("Please Select Occupation");
895        return false;
896    }
897    else if (occupation == "7" && otheroccupation == "") {
898        $(".confirmbtnkyc").removeClass("disabled");
899        $(".confirmbtnkyc").removeClass("disabled");
900        $('.showloader').hide();
901        AlertConfirmWithoutReload("Please Enter Other Occupation");
902        return false;
903    }
904    if (backcount >= 1 && froncount >= 1 && addresscount >= 1) {
905
906        var fd = new FormData();
907        var file = $('#image-upload')[0].files[0];
908        var file2 = $('#image-upload1')[0].files[0];
909        var file3 = $('#image-upload2')[0].files[0];
910        fd.append("file", file);
911        fd.append("file1", file2);
912        fd.append("file2", file3);
913        fd.append("ProofType", $("#hdnprftype").val());
914        fd.append("MemberId", $("#hdnmemid").val());
915        fd.append("Method", "ProofImage");
916        fd.append("Gender", gender);
917        fd.append("occupation", occupation);
918        fd.append("otheroccupation", otheroccupation);
919        fd.append("platform", "Web");
920        $.ajax({
921            url: '/UploadImage.ashx',
922            type: "POST",
923            processData: false,
924            contentType: false,
925            data: fd,
926            success: function (result) {
927                var splitstr = result.toString().split('!@!');
928                if (result.indexOf('Success') > -1) {
929                    if (splitstr[0] == "Success") {
930                        $("#hdnprfimg").val(splitstr[1]);
931                        $("#hdnik").val(splitstr[2]);
932                        if (splitstr[2] == "3") {
933                            $(".boxscreen").hide();
934                            $(".uploadscreen").hide();
935                            $(".transfer-reason").show();
936                            $('.sw-toolbar').show();
937                            $("progress").hide();
938                            $(".sw-btn-group-extra").hide();
939                            $(".sw-btn-group").show();
940                            AlertConfirmWithoutReload("Your KYC request has been successfully verified. You are all set to send money to your friends and family.");
941                        }
942                        else if (splitstr[2] == "4") {
943                            $('.showloader').hide();
944                            AlertConfirmWithUrl(splitstr[3], "/Dashboard");
945                        }
946                        else {
947                            $('.showloader').hide();
948                            AlertConfirmWithUrl("Thank you for submitting your KYC verification request. We are verifying your documents.", "/Dashboard");
949                        }
950                    } else {
951                        $("progress").hide();
952                        AlertConfirmWithoutReload(splitstr[0]);
953                    }
954
955                    //$("#smartwizard").smartWizard("next");
956
957                }
958                else {
959                    $("#hdnprfimg").val("");
960                    AlertConfirmWithoutReload(splitstr[0]);
961                }
962                $(".confirmbtnkyc").removeAttr("disabled");
963                $(".confirmbtnkyc").removeClass("disabled");
964                $('.showloader').hide();
965                return false;
966            },
967            xhr: function () {
968                var fileXhr = $.ajaxSettings.xhr();
969                if (fileXhr.upload) {
970                    $("progress").show();
971                    fileXhr.upload.addEventListener("progress", function (e) {
972                        if (e.lengthComputable) {
973                            $(".fileProgress").attr({
974                                value: e.loaded,
975                                max: e.total
976                            });
977                        }
978                    }, false);
979                }
980                return fileXhr;
981            },
982            error: function (XMLHttpRequest, textStatus, errorThrown) {
983                AlertConfirm(XMLHttpRequest.responseText);
984                $(".confirmbtnkyc").removeAttr("disabled");
985                $(".confirmbtnkyc").removeClass("disabled");
986                $('.showloader').hide();
987                return false;
988            }
989        });
990        return false;
991    }
992    else {
993        $(".confirmbtnkyc").removeClass("disabled");
994        $(".confirmbtnkyc").removeClass("disabled");
995        $('.showloader').hide();
996        AlertConfirm("Please upload all documents");
997    }
998    return false;
999
1000}
1001
1002function tapboxclick() {
1003    $('.tapbox').click(function () {
1004
1005        $('.sw-toolbar').show();
1006        $(".boxscreen").hide();
1007        $(".tabscreen").show();
1008    });
1009}
1010
1011function CC(obj, type, check, drp) {
1012    debugger;
1013    removeCoupon();
1014    $('.indsendmoney').removeClass('disabled');
1015    $('.gifoverlay').show();
1016    $('.sw-btn-next').addClass("disabled");
1017    var symbol = "", to = "", from = "", amount = "", amountto = "", str = "", ErrorMessage = "", ErrorId = "", paymenttypeid = "", aconversionrate = "", afee = "", count = 0;
1018    to = $("#currencyto").val().trim();
1019    if (drp > 0) {
1020        paymenttypeid = $(obj).attr("data-value");
1021        $("#hdnpaymenttype").val(paymenttypeid);
1022    }
1023    else {
1024        if (check > 0) {
1025            paymenttypeid = "";
1026        }
1027        else {
1028            paymenttypeid = $("#hdnpaymenttype").val();
1029        }
1030
1031    }
1032
1033    var repeattransfer = $("#hdnrepeattransfer").val();
1034    if (repeattransfer != "" && typeof (repeattransfer) !== "undefined") {
1035        $("#amountfrom").val(repeattransfer);
1036        $("#hdnrepeattransfer").val("");
1037    }
1038
1039    from = $("#currencyfrom").val().trim();
1040    amount = $("#amountfrom").val();
1041    amountto = $("#amountto").val();
1042    if (type.trim() == "from") {
1043        if (amountto == "" || parseFloat(amountto) < 1) {
1044            amountto = 1;
1045        }
1046    }
1047    if (type.trim() == "to") {
1048        if (amount == "" || parseFloat(amount) < 1) {
1049            amount = 1;
1050        }
1051    }
1052    if (type.trim() == "to" && check == 1) {
1053        //str = '<div onclick="return ChangeCurrency(this,' + "&apos;" + 'from' + "&apos;" + ',1);" class="item" data-value="' + to + '">' + $(obj).parent().parent().find('.text').html() + '</div>';
1054        //$(".cfrom").prepend(str);
1055        symbol = $(obj).attr("data-value");
1056        to = symbol;
1057        //$(".cfrom").find('[data-value="' + to + '"]').remove();
1058
1059    }
1060    else if (type == "from" && check == 1) {
1061        //str = '<div onclick="return ChangeCurrency(this,' + "&apos;" + 'to' + "&apos;" + ',1);" class="item" data-value="' + from + '">' + $(obj).parent().parent().find('.text').html() + '</div>';
1062        //$(".cto").prepend(str);
1063        symbol = $(obj).attr("data-value");
1064        from = symbol;
1065        //$(".cto").find('[data-value="' + from + '"]').remove();
1066
1067    }
1068    else if (type == "tofrom" && check == 1) {
1069        //str = '<div onclick="return ChangeCurrency(this,' + "&apos;" + 'to' + "&apos;" + ',1);" class="item" data-value="' + from + '">' + $(obj).parent().parent().find('.text').html() + '</div>';
1070        //$(".cto").prepend(str);
1071        symbol = $(obj).attr("data-value");
1072        to = symbol;
1073        type = "from";
1074        //$(".cto").find('[data-value="' + from + '"]').remove();
1075
1076    }
1077    else {
1078        //$(".cto").find('[data-value="AUD"]').remove();
1079        //$(".cfrom").find('[data-value="INR"]').remove();
1080    }
1081    if (amount == "") {
1082        if (ErrorMessage == "") {
1083            ErrorMessage = "Please enter amount";
1084            ErrorId = "currency1";
1085        }
1086        AddErrorMessage(ErrorId, type, ErrorMessage);
1087        $('.gifoverlay').hide();
1088        $('.sw-btn-next').removeClass("disabled");
1089        $('.indsendmoney').addClass('disabled');
1090        return false;
1091    }
1092    else if (amountto == "") {
1093        if (ErrorMessage == "") {
1094            ErrorMessage = "Please enter amount";
1095            ErrorId = "currency2";
1096        }
1097        AddErrorMessage(ErrorId, type, ErrorMessage);
1098        $('.gifoverlay').hide();
1099        $('.sw-btn-next').removeClass("disabled");
1100        $('.indsendmoney').addClass('disabled');
1101        return false;
1102    }
1103    if (parseFloat(amount) < 1) {
1104        if (ErrorMessage == "") {
1105            ErrorMessage = "Please enter amount greater than 1";
1106            ErrorId = "currency1";
1107        }
1108    }
1109    else {
1110        AddErrorMessage('currency1', 'remove', '');
1111    }
1112
1113    if (parseFloat(amountto) < 1) {
1114        if (ErrorMessage == "") {
1115            ErrorMessage = "Please enter amount greater than 1";
1116            ErrorId = "currency2";
1117        }
1118
1119    }
1120    else {
1121        AddErrorMessage('currency2', 'remove', '');
1122    }
1123
1124    var agentid = 0;
1125    var subagentid = 0;
1126
1127    if (myFilename.toString().toLowerCase() == "agent") {
1128
1129        agentid = $("#hdnagentid").val();
1130        subagentid = $("#hdnsubstaffmemberid").val();
1131        aconversionrate = $("#convertrate").val();
1132        afee = $("#agentfee").val();
1133        if (aconversionrate == "") {
1134            if (ErrorMessage == "") {
1135                ErrorMessage = "Please enter conversion rate";
1136                ErrorId = "currency2";
1137            }
1138        }
1139        else if (parseFloat(aconversionrate) <= 0) {
1140            if (ErrorMessage == "") {
1141                ErrorMessage = "Please enter conversion rate greater than 0";
1142                ErrorId = "currency2";
1143            }
1144        }
1145        else if (afee == "") {
1146            if (ErrorMessage == "") {
1147                ErrorMessage = "Please enter fee";
1148                ErrorId = "currency2";
1149            }
1150        }
1151        if (to == undefined || to == 'undefined') {
1152            to = 'NPR';
1153        }
1154        $(".srcamt").html("Source Amount(" + from.trim() + ")*");
1155        $(".conamt").html("Convert Amount(" + from.trim() + ")*");
1156        $(".desamt").html("Destination Amount(" + to.trim() + ")*");
1157        $(".feeamt").html("Fees (" + from.trim() + ")*");
1158    }
1159
1160
1161    var twrecipientid = $("#hdntwrid").val();
1162    if (typeof (twrecipientid) === "undefined") {
1163        twrecipientid = "";
1164    }
1165    var FastPay = 0;
1166    if (to.trim() == 'NPR') {
1167        if ($("#hfIsFastPay").length > 0) {
1168            FastPay = $("#hfIsFastPay").val();
1169        } else {
1170            FastPay = 0;
1171            $("#hfIsFastPay").val('0');
1172        }
1173    }
1174    var paymenttype = $("#ContentPlaceHolder1_drpPayoutType").val();
1175    if (paymenttype == undefined || paymenttype == 'undefined' || paymenttype == null) {
1176        paymenttype = '0';
1177    }
1178    if (ErrorMessage != "") {
1179        AddErrorMessage(ErrorId, type, ErrorMessage);
1180        $('.gifoverlay').hide();
1181        $('.sw-btn-next').removeClass("disabled");
1182        $('.indsendmoney').addClass('disabled');
1183        return false;
1184    }
1185    else {
1186
1187        $.ajax({
1188            url: "/Personal.aspx/GCC",
1189            type: "POST",
1190            dataType: "json",
1191            contentType: "application/json",
1192            data: '{  "to":"' + to + '","from":"' + from + '","amount":"' + amount + '","amountto":"' + amountto + '","type":"' + type + '","paymenttypeid":"' + paymenttypeid + '","agentid":"' + parseInt(agentid) + '","recipientid":"' + twrecipientid + '","aconversionrate":"' + aconversionrate + '","afee":"' + afee + '","SubAgentId":"' + parseInt(subagentid) + '" ,"IsFastPay":"' + parseInt(FastPay) + '","PaymentType":"' + parseInt(paymenttype) + '"}',
1193            success: function (data) {
1194                if (data.d != "") {
1195                    var json = $.parseJSON(data.d);
1196                    var isInstantRate = json[0].isInstantRate;
1197                    if (isInstantRate == 1) {
1198                        $(".drppayouttype").show();
1199                    }
1200                    else {
1201                        $("#hfIsFastPay").val('0');
1202                        $(".drppayouttype").hide();
1203                        $("#ContentPlaceHolder1_drpPayoutType").dropdown('set selected', '0');
1204                    }
1205                    if (drp != 2) {
1206                        $(".paypaymenttypes").html('');
1207                    }
1208                    $(".drppaymenttypes").html('');
1209             
1210                    $.each(json, function (i, categories) {
1211
1212                        if (type != "both") {
1213                            var destcounter = 0;
1214                            $('.cto').html('');
1215                            if (destcounter == 0) {
1216                                var destlist = $.parseJSON(JSON.stringify(json[0].DestinationList));
1217                                $.each(destlist, function (j, categories) {
1218                                    destcounter = 1;
1219                                    var deststr = '<div onclick="return CC(this,&#39;tofrom&#39;,1,0); " class="item" data-cntid="' + destlist[j].CountryId + '" data-id="' + destlist[j].SDCountryId + '" data-value="' + destlist[j].Symbol + ' "><i class="' + destlist[j].CountryCode.toLowerCase() + ' flag"></i>' + destlist[j].Symbol + '<span>' + destlist[j].CurrencyName + '</span></div>';
1220                                    $('.cto').append(deststr);
1221
1222                                });
1223                            }
1224                        }
1225
1226                        if (json[0].status.indexOf("Success") > -1) {
1227                            AddErrorMessage('currency1', 'remove', '');
1228                            AddErrorMessage('currency2', 'remove', '');
1229                        }
1230                        else {
1231                            AddErrorMessage('currency1', type, json[0].message);
1232                            $('.indsendmoney').addClass('disabled');
1233                            return false;
1234                        }
1235                        //$("#guaranteedrate").html('<a href="#" class="popuplink">Conversion rate</a> (' + json[0].GuaranteedRate + ' hrs)');
1236                        //$('.popuplink').popup({
1237                        //    popup: $('.popup'),
1238                        //    on: 'click'
1239                        //});
1240                        /*$("#guaranteedrate").html('Conversion rate (' + json[0].GuaranteedRate + ' hrs)');*/
1241                        $("#guaranteedrate").html('Conversion rate');
1242                        $("#guaranteedratecontent").html('You’ll get this rate as long as we receive your ' + json[0].fromamount + ' ' + from + ' within the next ' + json[0].GuaranteedRate + ' hours.');
1243                        $("#processingdays").html('Should arrive <strong>by ' + json[0].ProcessingDays + '</strong>');
1244
1245                        if (type == "to") {
1246                            $("#amountfrom").val(json[0].fromamount);
1247                        }
1248                        else {
1249                            $("#amountto").val(json[0].toamount);
1250                        }
1251
1252                        if (json[0].ShowDropDown == "1") {
1253                            // $(".seecalc").removeClass('expanddiv');
1254                            $(".seetop").addClass("hideli");
1255                            $(".seetop").show();
1256                            $(".seetop1").show();
1257                        }
1258                        else {
1259                            $(".seecalc").addClass('expanddiv');
1260                            $(".seetop").removeClass("hideli");
1261                            $(".seetop").hide();
1262                            $(".seetop1").hide();
1263                        }
1264
1265                        $("#fees").html(json[0].totalfee + ' ' + from);
1266                        if (parseFloat(json[0].twfee) != 0) {
1267                            $("#twfee").html(json[0].twfee + ' ' + from);
1268                            $(".twfeecontainer").show();
1269                        }
1270                        else {
1271                            $(".twfeecontainer").removeClass("hideli");
1272                            $(".twfeecontainer").hide();
1273                        }
1274                        $("#hdnquoteid").val(json[0].quoteid);
1275                        $("#companyfee").html(json[0].exactfees + ' ' + from);
1276                        $("#ourtotalfee").html(json[0].ourexactfee + ' ' + from);
1277                        $("#convertrate").html(json[0].conversionrate);
1278                        $("#hdnpaymenttype").val(json[0].PaymentTypeId);
1279                        if (agentid != "") {
1280                            $("#hdntransactionid").val(json[0].TransactionId);
1281                            $("#hdnpaymentid").val(json[0].PaymentId);
1282                        }
1283                        if (json[0].convertamount != "" && typeof (json[0].convertamount) != "undefined") {
1284                            $("#convertamount").html(json[0].convertamount.toFixed(2) + ' ' + from);
1285                        }
1286                        if (myFilename.toString().toLowerCase() == "agent") {
1287                            $("#agentfee").val(json[0].agentfee);
1288                            $("#fees").val(json[0].totalfee);
1289                            $("#companyfee").val(json[0].exactfees);
1290                            $("#ourtotalfee").val(json[0].ourexactfee);
1291                            $("#convertrate").val(json[0].conversionrate);
1292                            $("#convertamount").val(json[0].convertamount.toFixed(2));
1293                        }
1294                        
1295                        var str = '<div class="item" onclick="return CC(this,&#39;from&#39;,0,1);" data-value="' + json[i].PaymentTypeId + '" data-text="' + json[i].Tittle + '">' + json[i].Tittle + '  <span>' + json[i].exactfees + ' ' + from + ' fee</span></div>';
1296                        if (drp != 2) {
1297                       
1298                            var paystr = '<div class="field row-patch">';
1299                            paystr += '<div class="title-hd">';
1300                            paystr += '<h6>' + json[i].Tittle + ' </h6>';
1301                            paystr += '<small>- ' + json[i].totalfee + ' ' + from + '  in total fees</small>';
1302                            paystr += '</div >';
1303                            paystr += '<div class="radio-row">';
1304                            paystr += '<div class="ui slider checkbox">';
1305                            if ((paymenttypeid == "" || json[i].PaymentTypeId == paymenttypeid) && count == 0) {
1306                                paystr += '<input type="radio" data-value="' + json[i].PaymentTypeId + '" data-text="' + json[i].Tittle + '" onChange="return CC(this,&#39;from&#39;,0,2);" name="paymenttype" id="' + json[i].Id + '" checked="checked">';
1307                                count = count + 1;
1308                            }
1309                            else {
1310                                paystr += '<input type="radio" data-value="' + json[i].PaymentTypeId + '" data-text="' + json[i].Tittle + '" onChange="return CC(this,&#39;from&#39;,0,2);" name="paymenttype" id="' + json[i].Id + '">';
1311                            }
1312                            paystr += '<label for="' + json[i].Id + '"><i><img src="' + json[i].PaymentTypeImage + '" alt="Image" /></i>' + json[i].Description + '<small class="hide">Should arrive by ' + json[i].ProcessingDays + '</small></label>';
1313                            paystr += '</div></div></div>';
1314                            $(".paypaymenttypes").append(paystr);
1315                        }
1316                        $(".drppaymenttypes").append(str);
1317                    });
1318                    $('.ui.selection.dropdown').dropdown({ 'set selected': 01 });
1319                    $('.ui.checkbox').checkbox();
1320
1321
1322                    amount = $("#amountfrom").val().replace("-", "");
1323                    amountto = $("#amountto").val().replace("-", "");
1324                    if (parseFloat(amountto) < 1) {
1325                        if (ErrorMessage == "") {
1326                            ErrorMessage = "Please enter amount greater than 1";
1327                            ErrorId = "currency2";
1328                        }
1329
1330                    }
1331
1332
1333                    if (parseFloat(amount) < 1) {
1334                        if (ErrorMessage == "") {
1335                            ErrorMessage = "Please enter amount greater than 1";
1336                            ErrorId = "currency1";
1337                        }
1338                    }
1339                    if (ErrorMessage != "") {
1340                        $('.indsendmoney').addClass('disabled');
1341                        $('.showloader').hide();
1342                        $('.gifoverlay').hide();
1343                        AddErrorMessage(ErrorId, type, ErrorMessage);
1344
1345                        return false;
1346                    }
1347
1348
1349                    if (drp == 2) {
1350                        Review("0");
1351                    }
1352                    $('.showloader').hide();
1353                }
1354                else {
1355                    $('.showloader').hide();
1356                    AlertConfirm(data.d);
1357                }
1358                $('.gifoverlay').hide();
1359                $('.sw-btn-next').removeClass("disabled");
1360
1361                return false;
1362            },
1363            error: function (XMLHttpRequest, textStatus, errorThrown) {
1364                $('.gifoverlay').hide();
1365                $('.showloader').hide();
1366                $('.sw-btn-next').removeClass("disabled");
1367                $('.indsendmoney').addClass('disabled');
1368                AlertConfirm(XMLHttpRequest.responseText)
1369                return false;
1370            }
1371        });
1372
1373    }
1374}
1375
1376function Review(step) {
1377
1378    var symbol = "", to = "", from = "", amount = "", amountto = "", str = "", ErrorMessage = "", ErrorId = "", paymenttypeid = "", aconversionrate = "", afee = "", type = "from", subagentid = 0; agentid = 0;
1379    to = $("#currencyto").val().trim();
1380    paymenttypeid = $("#hdnpaymenttype").val();
1381    from = $("#currencyfrom").val().trim();
1382    amount = $("#amountfrom").val().replace("-", "");
1383    amountto = $("#amountto").val().replace("-", "");
1384
1385    var twrecipientid = $("#hdntwrid").val();
1386    if (typeof (twrecipientid) === "undefined") {
1387        twrecipientid = "";
1388    }
1389    var flag = false;
1390    if (amount == "" || amountto == "") {
1391        return false;
1392    }
1393    else {
1394        $('.showloader').show();
1395        $.ajax({
1396            url: "/Personal.aspx/GCC",
1397            type: "POST",
1398            contentType: "application/json; charset=utf-8",
1399            dataType: "json",
1400            data: '{  "to":"' + to + '","from":"' + from + '","amount":"' + amount + '","amountto":"' + amountto + '","type":"' + type + '","paymenttypeid":"' + paymenttypeid + '","agentid":"' + parseInt(agentid) + '","recipientid":"' + twrecipientid + '","aconversionrate":"' + aconversionrate + '","afee":"' + afee + '","SubAgentId":"' + parseInt(subagentid) + '","IsFastPay":0,"PaymentType":0 }',
1401            success: function (data) {
1402                
1403                if (data.d != "") {
1404                    var json = $.parseJSON(data.d)
1405                    $.each(json, function (i, categories) {
1406                        if (json[0].status.indexOf("Success") > -1) {
1407                            
1408                            $(".txtsramount").html(json[0].fromamount + " " + from);
1409                            $(".txtexactfee").html(+ json[0].exactfees + ' ' + from);
1410                            $(".txtourfee").html(+ json[0].ourexactfee + ' ' + from);
1411                            $(".txtrfee").html("-" + json[0].totalfee + ' ' + from);
1412                            $("#hfsend").val(json[0].fromamount);
1413                            $(".txtrconvertamount").html(json[0].convertamount.toFixed(2) + ' ' + from);
1414                            /*  $(".txtrguranteedrate").html("Conversion Rate (" + json[0].GuaranteedRate + " hrs)");*/
1415                            $(".txtrguranteedrate").html("Conversion Rate");
1416                            $(".txtrconvertrate").html(json[0].conversionrate);
1417                            $(".txtrrciptentget").html(json[0].toamount + " " + to);
1418                            $(".txtrarrive").html("by " + json[0].ProcessingDays);
1419                            $("#hdntransactionid").val(json[0].TransactionId);
1420                            $("#hdnpaymentid").val(json[0].PaymentId);
1421                            $("#hfTxtrFee").val(json[0].totalfee);
1422                            $("#hfsend").val(json[0].fromamount);
1423                            $("#hffinalsend").val(json[0].fromamount + " " + from);
1424                            $("#hfTxtrConvertRate").val(json[0].conversionrate);
1425                            $("#hfConvertAmount").val(json[0].convertamount.toFixed(2));
1426                            $("#hfget").val(json[0].toamount);
1427                            flag = true;
1428                        }
1429                    });
1430                    if (flag) {
1431                        RD(flag, step);
1432                    }
1433
1434                }
1435                else {
1436                    AlertConfirmWithoutReload(data.d);
1437                    ajaxcomplete = false;
1438                    $('.showloader').hide();
1439                }
1440                return false;
1441            },
1442            error: function (XMLHttpRequest, textStatus, errorThrown) {
1443                AlertConfirmWithoutReload(XMLHttpRequest.responseText);
1444                ajaxcomplete = false;
1445                $('.showloader').hide();
1446                return false;
1447            }
1448        });
1449    }
1450    return false;
1451
1452}
1453
1454
1455
1456function AddErrorMessage(id, type, message) {
1457    if (id != "" && type != 'remove') {
1458        $('.' + id).find('.alert-danger').html(message).removeClass('hide');
1459        $('.' + id).addClass('has-error');
1460    }
1461    else if (type == "remove") {
1462        $('.' + id).find('.alert-danger').html('').addClass('hide');
1463        $('.' + id).removeClass('has-error');
1464    }
1465
1466}
1467
1468function CheckEmployee(type, method) {
1469    if (method == "p") {
1470        if (type == "other") {
1471            $(".specify-occupation").removeClass('hide');
1472        }
1473        else {
1474            if (!$(".specify-occupation").hasClass('hide')) {
1475                $(".specify-occupation").addClass('hide');
1476            }
1477            $("#txtotheroccupation").val('');
1478        }
1479    }
1480    else if (method == "t") {
1481        if (type == "other") {
1482            $(".mspecify-occupation").removeClass('hide');
1483        }
1484        else {
1485            if (!$(".mspecify-occupation").hasClass('hide')) {
1486                $(".mspecify-occupation").addClass('hide');
1487            }
1488            $("#txtmotheroccupation").val('');
1489        }
1490    }
1491    else {
1492        if (type == "other") {
1493            $(".bspecify-occupation").removeClass('hide');
1494        }
1495        else {
1496            if (!$(".bspecify-occupation").hasClass('hide')) {
1497                $(".bspecify-occupation").addClass('hide');
1498            }
1499            $("#txtbotheroccupation").val('');
1500        }
1501    }
1502}
1503
1504function copyData() {
1505    var accounttype = $("#accounttype").val();
1506    if (accounttype == "1") {
1507        $("#txtfirstname").val($("#txtbfirstname").val());
1508        $("#txtlastname").val($("#txtblastname").val());
1509        $("#txtdate").val($("#txtbdate").val());
1510        $("#txtmonth").val($("#txtbmonth").val());
1511        $("#txtyear").val($("#txtbyear").val());
1512        $("#phoneextension").val($("#txtbphoneextension").val());
1513        $("#phonenumber").val($("#txtbphonenumber").val());
1514        $("#countryid").val($("#txtbcountryid").val());
1515        $("#txtaddress").val($("#txtbaddress").val());
1516        $("#txtcity").val($("#txtbcity").val());
1517        $("#txtstate").val($("#txtbstate").val());
1518        $("#txtpostalcode").val($("#txtbpostalcode").val());
1519        $("#txtoccupation").val($("#txtboccupation").val());
1520        $("#txtotheroccupation").val($("#txtbotheroccupation").val());
1521    }
1522    else {
1523        $("#txtbfirstname").val($("#txtfirstname").val());
1524        $("#txtblastname").val($("#txtlastname").val());
1525        $("#txtbdate").val($("#txtdate").val());
1526        $("#txtbmonth").val($("#txtmonth").val());
1527        $("#txtbyear").val($("#txtyear").val());
1528        $("#txtbphoneextension").val($("#phoneextension").val());
1529        $("#txtbphonenumber").val($("#phonenumber").val());
1530        $("#txtbcountryid").val($("#countryid").val());
1531        $("#txtbaddress").val($("#txtaddress").val());
1532        $("#txtbcity").val($("#txtcity").val());
1533        $("#txtbstate").val($("#txtstate").val());
1534        $("#txtbpostalcode").val($("#txtpostalcode").val());
1535        $("#txtboccupation").val($("#txtoccupation").val());
1536        $("#txtbotheroccupation").val($("#txtotheroccupation").val());
1537    }
1538    $('.ui.selection.dropdown').dropdown({ 'set selected': 01 });
1539}
1540
1541function CheckValidUser() {
1542    ajaxcomplete = false;
1543    var accounttype = $("#accounttype").val();
1544    var firstname = $("#txtfirstname").val();
1545    var lastname = $("#txtlastname").val();
1546    var gender = $("#txtgender").val();
1547    var date = $("#txtdate").val();
1548    var month = $("#txtmonth").val();
1549    var year = $("#txtyear").val();
1550    var phoneext = $("#phoneextension").val();
1551    var phone = $("#phonenumber").val();
1552    var countryid = $("#countryid").val();
1553    var address = $("#txtaddress").val();
1554    var city = $("#txtcity").val();
1555    //var state = $("#txtstate option:selected").text();
1556    var state = $("#txtstate").val();
1557    var statecode = $("#txtstate").val();
1558    var postalcode = $("#txtpostalcode").val();
1559    var occupation = $("#txtoccupation").val();
1560    var otheroccupation = $("#txtotheroccupation").val();
1561    var prooftype = $("#txtprooftype").val();
1562    var documentnumber = $("#txtdocumentnumber").val();
1563    var expirydate = $("#txtexpirydate").val();
1564    var expirymonth = $("#txtexpirymonth").val();
1565    var region = $("#txtregion").val();
1566    var expiryyear = $("#txtexpiryyear").val();
1567    var exactexpirydate = expirymonth + "/" + expirydate + "/" + expiryyear;
1568
1569    var bfirstname = $("#txtbfirstname").val();
1570    var blastname = $("#txtblastname").val();
1571    var bdate = $("#txtbdate").val();
1572    var bgender = $("#txtbgender").val();
1573    var bmonth = $("#txtbmonth").val();
1574    var byear = $("#txtbyear").val();
1575    var bphoneext = $("#txtbphoneextension").val();
1576    var bphone = $("#txtbphonenumber").val();
1577    var bcountryid = $("#txtbcountryid").val();
1578    var baddress = $("#txtbaddress").val();
1579    var bcity = $("#txtbcity").val();
1580    var bstate = $("#txtbstate").val();
1581    var bpostalcode = $("#txtbpostalcode").val();
1582    var boccupation = $("#txtboccupation").val();
1583    var botheroccupation = $("#txtbotheroccupation").val();
1584
1585    var businesscountryid = $("#businesscountryid").val();
1586    var businessname = $("#txtbusinessname").val();
1587    var companytype = $("#txtcompanytype").val();
1588    var companyrole = $("#txtcompanyrole").val();
1589    var registrationnumber = $("#txtregistrationnumber").val();
1590    var websitename = $("#txtwebsitename").val();
1591    var businesscategory = $("#txtbusinesscategory").val();
1592    var businesssubcategory = $("#txtbusinesssubcategory").val();
1593    var businessaddress = $("#txtbusinessaddress").val();
1594    var businesscity = $("#txtbusinesscity").val();
1595    var businesspostalcode = $("#txtbusinesspostalcode").val();
1596    var ErrorMessage = "";
1597
1598
1599    ErrorFind();
1600    if (isValid == true) {
1601        $('.showloader').show();
1602        var dateofbirth = month + "/" + date + "/" + year;
1603        if (date != "") {
1604            if (parseInt(date) > 31) {
1605                AlertConfirmWithoutReload("Please enter correct date");
1606                $('.showloader').hide();
1607                return false;
1608            }
1609        }
1610        if (expirydate != "") {
1611            if (parseInt(expirydate) > 31) {
1612                AlertConfirmWithoutReload("Please enter correct expiry date");
1613                $('.showloader').hide();
1614                return false;
1615            }
1616        }
1617        if (accounttype == "1") {
1618            $.ajax({
1619                url: "/Personal.aspx/UP",
1620                type: "POST",
1621                contentType: "application/json; charset=utf-8",
1622                dataType: "json",
1623                data: '{  "firstname":"' + firstname + '","lastname":"' + lastname + '","dateofbirth":"' + dateofbirth + '","phoneext":"' + phoneext + '","phone":"' + phone + '","countryid":"' + countryid + '","address":"' + address + '","city":"' + city + '","postalcode":"' + postalcode + '","occupation":"' + occupation + '","otheroccupation":"' + otheroccupation + '","state":"' + state + '","statecode":"' + statecode + '","gender":"' + gender + '","prooftype":"' + prooftype + '","documentnumber":"' + documentnumber + '","expirydate":"' + exactexpirydate + '","region":"' + region + '"}',
1624                success: function (data) {
1625
1626                    if (data.d != "") {
1627                        if (data.d.indexOf("Success") > -1) {
1628                            ajaxcomplete = true;
1629                            $("#smartwizard").smartWizard("next");
1630                        }
1631                        else {
1632                            AlertConfirm(data.d);
1633                            ajaxcomplete = false;
1634                            $('.showloader').hide();
1635                            return false;
1636                        }
1637                    }
1638                    else {
1639                        AlertConfirm(data.d);
1640                        ajaxcomplete = false;
1641                        $('.showloader').hide();
1642                        return false;
1643                    }
1644                    $('.showloader').hide();
1645                },
1646                error: function (XMLHttpRequest, textStatus, errorThrown) {
1647                    ajaxcomplete = false;
1648                    AlertConfirm(XMLHttpRequest.responseText);
1649                    $('.showloader').hide();
1650                    return false;
1651                }
1652            });
1653        }
1654        else {
1655            var bdateofbirth = bmonth + "/" + bdate + "/" + byear;
1656            $.ajax({
1657                url: "/Personal.aspx/UB",
1658                type: "POST",
1659                contentType: "application/json; charset=utf-8",
1660                dataType: "json",
1661                data: '{  "firstname":"' + bfirstname + '","lastname":"' + blastname + '","dateofbirth":"' + bdateofbirth + '","phoneext":"' + bphoneext + '","phone":"' + bphone + '","countryid":"' + bcountryid + '","address":"' + baddress + '","city":"' + bcity + '","postalcode":"' + bpostalcode + '","occupation":"' + boccupation + '","otheroccupation":"' + botheroccupation + '","businesscountryid":"' + businesscountryid + '","businessname":"' + businessname + '","companytype":"' + companytype + '","companyrole":"' + companyrole + '","registrationnumber":"' + registrationnumber + '","websitename":"' + websitename + '","businesscategory":"' + businesscategory + '","businesssubcategory":"' + businesssubcategory + '","businessaddress":"' + businessaddress + '","businesscity":"' + businesscity + '","businesspostalcode":"' + businesspostalcode + '","state":"' + bstate + '","gender":"' + bgender + '"}',
1662                success: function (data) {
1663
1664                    if (data.d != "") {
1665                        if (data.d.indexOf("Success") > -1) {
1666                            ajaxcomplete = true;
1667                            $("#smartwizard").smartWizard("next");
1668                        }
1669                        else {
1670                            AlertConfirm(data.d);
1671                            ajaxcomplete = false;
1672                            return false;
1673                        }
1674                    }
1675                    else {
1676                        AlertConfirm(data.d);
1677                        ajaxcomplete = false;
1678                        return false;
1679                    }
1680                    $('.showloader').hide();
1681                },
1682                error: function (XMLHttpRequest, textStatus, errorThrown) {
1683                    AlertConfirm(XMLHttpRequest.responseText)
1684                    ajaxcomplete = false;
1685                    $('.showloader').hide();
1686                    return false;
1687                }
1688            });
1689        }
1690    }
1691    else {
1692        return false;
1693    }
1694}
1695
1696function CheckFrankieUserDetail(e) {
1697   
1698    $('.showloader').show();
1699    var platform = $("#hdnplatform").val();
1700    var ismobile = $("#hdnismobile").val();
1701    var page = $("#hdnpage").val();
1702    var mid = $("#hdnmid").val();
1703    if (ismobile == "" || typeof (ismobile) == "undefined") {
1704        ismobile = "false";
1705    }
1706    if (platform == "" || typeof (platform) == "undefined") {
1707        platform = "WEB";
1708    }
1709    if (mid == "" || typeof (mid) == "undefined") {
1710        mid = "0";
1711    }
1712    var firstname = e.detail.applicant.name.givenName + " " + (e.detail.applicant.name.middleName != null ? e.detail.applicant.name.middleName : "");
1713    var lastname = e.detail.applicant.name.familyName;
1714    var dateofbirth = e.detail.applicant.dateOfBirth;
1715
1716
1717    var address = (e.detail.applicant.addresses[0].unitNumber == null ? "" : e.detail.applicant.addresses[0].unitNumber) + " " + (e.detail.applicant.addresses[0].streetNumber == null ? "" : e.detail.applicant.addresses[0].streetNumber) + " " + (e.detail.applicant.addresses[0].streetName == null ? "" : e.detail.applicant.addresses[0].streetName) + " " + (e.detail.applicant.addresses[0].buildingName == null ? "" : e.detail.applicant.addresses[0].buildingName) + " " + (e.detail.applicant.addresses[0].suburb == null ? "" : e.detail.applicant.addresses[0].suburb);
1718    var city = e.detail.applicant.addresses[0].town;
1719    //var state = $("#txtstate option:selected").text();
1720    var state = e.detail.applicant.addresses[0].state;
1721    var postalcode = e.detail.applicant.addresses[0].postalCode;
1722    var idnumber = e.detail.documents[0].idNumber;
1723    var expirydate = e.detail.documents[0].idExpiry;
1724    var idtype = e.detail.documents[0].idType;
1725    var fresult = e.detail.resultSlug;
1726    var risk = e.detail.checkSummary.risk.class;
1727    var blacklist = "";
1728    var govid = "";
1729    var two_plus = "";
1730    var idcheck = "";
1731    var pep = "";
1732    //if (e.detail.checkSummary.checkResults[0] != null) {
1733    //    blacklist = e.detail.checkSummary.checkResults[0].result.type;
1734    //}
1735    //if (e.detail.checkSummary.checkResults[1] != null) {
1736    //    govid = e.detail.checkSummary.checkResults[1].result.type;
1737    //}
1738    //if (e.detail.checkSummary.checkResults[2] != null) {
1739    //    two_plus = e.detail.checkSummary.checkResults[2].result.type;
1740    //}
1741    //if (e.detail.checkSummary.checkResults[3] != null) {
1742    //    idcheck = e.detail.checkSummary.checkResults[3].result.type;
1743    //}
1744    //if (e.detail.checkSummary.checkResults[4] != null) {
1745    //    pep = e.detail.checkSummary.checkResults[4].result.type;
1746    //}
1747    debugger;
1748    for (var i = 0; i < e.detail.checkSummary.checkResults.length; i++) {
1749
1750        if (e.detail.checkSummary.checkResults[i].type == "blacklist") {
1751            blacklist = e.detail.checkSummary.checkResults[i].result.type;
1752        }
1753        else if (e.detail.checkSummary.checkResults[i].type == "id" || e.detail.checkSummary.checkResults[i].type == "id_only") {
1754            govid = e.detail.checkSummary.checkResults[i].result.type;
1755        }
1756        else if (e.detail.checkSummary.checkResults[i].type == "two_plus") {
1757            two_plus = e.detail.checkSummary.checkResults[i].result.type;
1758        }
1759        else if (e.detail.checkSummary.checkResults[i].type == "idvalidate") {
1760            idcheck = e.detail.checkSummary.checkResults[i].result.type;
1761        }
1762        else if (e.detail.checkSummary.checkResults[i].type == "pep") {
1763            pep = e.detail.checkSummary.checkResults[i].result.type;
1764        }
1765    }
1766
1767    var status = e.detail.checkSummary.status.type;
1768    var entityid = e.detail.applicant.entityId;
1769    var cardnumber = e.detail.documents[0].extraData.document_number;
1770    if (cardnumber == null) {
1771        cardnumber = "";
1772    }
1773    var region = "AUS";
1774
1775
1776    if (idtype == "PASSPORT") {
1777        region = e.detail.documents[0].country;
1778    }
1779    else {
1780        region = e.detail.documents[0].region;
1781        if (region == null) {
1782            region = "";
1783        }
1784    }
1785
1786    $.ajax({
1787        url: "/Personal.aspx/UPF",
1788        type: "POST",
1789        contentType: "application/json; charset=utf-8",
1790        dataType: "json",
1791        data: '{  "firstname":"' + firstname + '","lastname":"' + lastname + '","city":"' + city + '","state":"' + state + '","postalcode":"' + postalcode + '","address":"' + address + '","idtype":"' + idtype + '","idnumber":"' + idnumber + '","expirydate":"' + expirydate + '","fresult":"' + fresult + '","risk":"' + risk + '","status":"' + status + '","dateofbirth":"' + dateofbirth + '","ismobile":"' + ismobile + '","platform":"' + platform + '","memberid":"' + mid + '","entityid":"' + entityid + '","region":"' + region + '","cardnumber":"' + cardnumber + '","blacklist":"' + blacklist + '","govid":"' + govid + '","two_plus":"' + two_plus + '","idcheck":"' + idcheck + '","pep":"' + pep + '"}',
1792        success: function (data) {
1793
1794            if (data.d != "") {
1795                if (data.d.indexOf("Success") > -1) {
1796                    if ((fresult == "pending-success" || fresult == "success") && (status == "passed" || status == "pass_manual")) {
1797                        if (page == "agent") {
1798                            window.location.href = "/Agent/UsersKyc.aspx?mid=" + mid;
1799                        }
1800                        else if (ismobile == "true") {
1801                            window.location.href = "/index";
1802                        }
1803
1804                        else {
1805                            $('.sw-btn-next').removeClass("disabled");
1806                            $('.sw-btn-next').removeClass("hide");
1807                            $("#hdnik").val(6);
1808                            if (idtype == "PASSPORT") {
1809                                $("#hdnprftype").val(1);
1810                            }
1811                            else if (idtype == "DRIVER_LICENSE") {
1812                                $("#hdnprftype").val(2);
1813                            }
1814                            else {
1815                                $("#hdnprftype").val(3);
1816                            }
1817                            $("#fpersonaldetail").addClass("hide");
1818                            $("#fApprovedpersonaldetail").removeClass("hide");
1819                            $("#pkycstatus").html("Woohoo!");
1820                            $("#pkycmessage").html("You are just one step away. We need a few more details to complete your KYC.");
1821                            ajaxcomplete = true;
1822                        }
1823                    }
1824                    else {
1825                        ajaxcomplete = false;
1826                    }
1827                    //$("#smartwizard").smartWizard("next");
1828                }
1829                else {
1830                    AlertConfirmWithoutReload(data.d);
1831                    ajaxcomplete = false;
1832                    $('.showloader').hide();
1833                    return false;
1834                }
1835            }
1836            else {
1837                AlertConfirmWithoutReload(data.d);
1838                ajaxcomplete = false;
1839                $('.showloader').hide();
1840                return false;
1841            }
1842            $('.showloader').hide();
1843        },
1844        error: function (XMLHttpRequest, textStatus, errorThrown) {
1845            ajaxcomplete = false;
1846            AlertConfirmWithoutReload(XMLHttpRequest.responseText);
1847            $('.showloader').hide();
1848            return false;
1849        }
1850    });
1851
1852
1853}
1854
1855function ErrorFind() {
1856    isValid = true;
1857    var accounttype = $("#accounttype").val();
1858    var curStep;
1859
1860    if (accounttype == "1") {
1861        curStep = $(".valid-personal")
1862        $(".valid-personal").find('.has-error').removeClass("has-error");
1863        $(".valid-personal").find('.alert-danger').remove();
1864    }
1865    else {
1866        curStep = $(".valid-business")
1867        $(".valid-business").find('.has-error').removeClass("has-error");
1868        $(".valid-business").find('.alert-danger').remove();
1869    }
1870    var curSelect = curStep.find("select"),
1871        curInputs = curStep.find("input[type='text'],input[type='hidden'],input[type='url'], input[type='password'], input[type='email'],input[type='number'],textarea,select");
1872    for (var i = 0; i < curInputs.length; i++) {
1873        if ($(curInputs[i]).attr("required") == "required" && ($(curInputs[i]).val() == "" || $(curInputs[i]).val() == "0") && $(curInputs[i]).attr("id").indexOf("otheroccupation") < 0) {
1874            isValid = false;
1875            if ($(curInputs[i]).attr("type") == "hidden") {
1876                $(curInputs[i]).parent().addClass("has-error");
1877                var message = "Please enter " + $(curInputs[i]).attr("id").toString().replace('txt', '');
1878                $(curInputs[i]).parent().parent().append('<div class="alert alert-danger">' + message + '</div>');
1879            }
1880            else {
1881                $(curInputs[i]).addClass("has-error");
1882                var message = "Please enter " + $(curInputs[i]).attr("id").toString().replace('txt', '');
1883                $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
1884            }
1885        }
1886        else if ($(curInputs[i]).attr("id").indexOf("phonenumber") > -1 && $(curInputs[i]).val().length < 9 && $(curInputs[i]).val() != "") {
1887            isValid = false;
1888            $(curInputs[i]).addClass("has-error");
1889            var message = "Please enter at least 9 or 10 digit phone number";
1890            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
1891        }
1892        else if ($(curInputs[i]).attr("id").indexOf("year") > -1 && $(curInputs[i]).val().length < 4 && $(curInputs[i]).val() != "") {
1893            isValid = false;
1894            $(curInputs[i]).addClass("has-error");
1895            var message = "Please enter at least 4 digit in year";
1896            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
1897        }
1898        else if ($(curInputs[i]).attr("id").indexOf("otheroccupation") > -1 && $(curInputs[i]).val() == "" && ($("#txtoccupation").val().toString().trim() == "7" || $("#txtboccupation").val().toString().trim() == "7")) {
1899            isValid = false;
1900            $(curInputs[i]).addClass("has-error");
1901            var message = "Please enter specify occupation";
1902            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
1903        }
1904    }
1905    if (isValid == false) {
1906        isValid = false;
1907    }
1908    else {
1909        isValid = true;
1910    }
1911}
1912
1913function GetSubCategories(id, set) {
1914    if (id != "") {
1915        $.ajax({
1916            url: '/Personal.aspx/GetSubCategories',
1917            type: "POST",
1918            dataType: "json",
1919            contentType: "application/json",
1920            data: "{'id':'" + parseInt(id) + "'}",
1921            success: function (result) {
1922                $(".subcategory").html("");
1923                if (result.d != "") {
1924                    var json = $.parseJSON(result.d)
1925                    $.each(json, function (i, categories) {
1926                        var str = '<div class="item" data-value="' + json[i].Id + '">' + json[i].SubCategoryName + '</div>';
1927                        $(".subcategory").append(str);
1928                    });
1929                    if (set != "0") {
1930                        $("#txtbusinesssubcategory").val(set);
1931                    }
1932                    $('.ui.selection.dropdown.subcategoryselection').dropdown();
1933
1934                }
1935            },
1936            error: function (XMLHttpRequest, textStatus, errorThrown) {
1937                AlertConfirm(XMLHttpRequest.responseText);
1938                return false;
1939            }
1940        });
1941    }
1942}
1943
1944function GUD() {
1945    $('.showloader').show();
1946    $.ajax({
1947        url: '/Personal.aspx/GUD',
1948        type: "POST",
1949        dataType: "json",
1950        contentType: "application/json",
1951        success: function (result) {
1952            if (result.d != "") {
1953                var json = $.parseJSON(result.d);
1954                if (json != "") {
1955                    $("#txtfirstname").val(json[0].FirstName);
1956                    $("#txtlastname").val(json[0].LastName);
1957                    if (json[0].FirstName != "" && json[0].LastName != "") {
1958                        if (json[0].Type == "1") {
1959                            $("#personal").find('.card-title').html(json[0].FirstName + ' ' + json[0].LastName);
1960                        }
1961                        else if (json[0].Type == "2") {
1962                            $("#business").find('.card-title').html(json[0].BussinessName);
1963                        }
1964                        else if (json[0].Type == "4") {
1965                            $("#personal").find('.card-title').html(json[0].FirstName + ' ' + json[0].LastName);
1966                            $("#business").find('.card-title').html(json[0].BussinessName);
1967                        }
1968                        if (json[0].IsKYCApproved == "3" || json[0].IsKYCApproved == "6" || json[0].IsKYCApproved == "1") {
1969                            $("#hdncheckstep").val("1");
1970                        }
1971                        else {
1972                            $("#hdncheckstep").val("0");
1973                        }
1974                        //$('#smartwizard').smartWizard("stepState", [1], "disable");
1975                        //$('#smartwizard').smartWizard("stepState", [1], "hide");
1976
1977                        var date = json[0].DateofBirth;
1978                        date = date.toString().split('/');
1979                        $("#txtdate").val(date[1]);
1980                        $("#txtmonth").val(date[0]);
1981                        $("#txtyear").val(date[2]);
1982                        $("#txtgender").val(json[0].Gender);
1983                        $("#txtmgender").val(json[0].Gender);
1984
1985                        //Get User details for Self tab
1986                        $("#txtaccountholder").val(json[0].FirstName);
1987                        $("#txtaccountholderlastname").val(json[0].LastName);
1988                        //$("#txtphoneextension").val(json[0].PhoneExtension);
1989                        //$("#txtselfholderphonenumber").val(json[0].ContactNumber);
1990                        $("#txtselfdate").val(date[1]);
1991                        $("#txtselfmonth").val(date[0]);
1992                        $("#txtselfyear").val(date[2]);
1993                        $("#txtaccountname").val(json[0].FirstName + " " + json[0].LastName);
1994                    }
1995                    else {
1996                        $("#hdncheckstep").val("0");
1997                    }
1998
1999                    if (json[0].ExpiryDate != "") {
2000                        var expirydate = json[0].ExpiryDate;
2001                        expirydate = expirydate.toString().split('/');
2002                        $("#txtexpirydate").val(expirydate[1]);
2003                        $("#txtexpirymonth").val(expirydate[0]);
2004                        $("#txtexpiryyear").val(expirydate[2]);
2005                    }
2006
2007                   
2008
2009
2010                    $("#userjointfirstaname").val(json[0].JointAccountFirstName);
2011                    $("#userjointlastaname").val(json[0].JointAccountLastName);
2012                    $("#userjointrelation").val(json[0].JointRelation);
2013                    $("#txtdocumentnumber").val(json[0].DocumentNumber);
2014                    $("#txtprooftype").val(json[0].ProofType);
2015                    $("#txtregion").val(json[0].region);
2016                    //GetStatesByCountryCode(json[0].CountryCode, json[0].StateCode);
2017                    $("#phoneextension").val(json[0].PhoneExtension);
2018                    $("#phonenumber").val(json[0].ContactNumber);
2019                    $("#countryid").val(json[0].CountryId);
2020                    $("#txtaddress").val(json[0].Address);
2021                    $("#txtcity").val(json[0].City);
2022                    $("#txtstate").val(json[0].State);
2023                    $("#txtpostalcode").val(json[0].ZipCode);
2024                    $("#txtoccupation").val(json[0].EmployeeType);
2025                    $("#txtmoccupation").val(json[0].EmployeeType);
2026                    if (json[0].EmployeeType == "7") {
2027                        $("#txtotheroccupation").val(json[0].SpecifyOccupation);
2028                        $("#txtmotheroccupation").val(json[0].SpecifyOccupation);
2029                        $(".specify-occupation").removeClass('hide');
2030                        $(".bspecify-occupation").removeClass('hide');
2031                        $(".mspecify-occupation").removeClass('hide');
2032                    }
2033                    $("#accounttype").val(json[0].Type);
2034
2035                    $("#txtbfirstname").val($("#txtfirstname").val());
2036                    $("#txtblastname").val($("#txtlastname").val());
2037                    $("#txtbdate").val($("#txtdate").val());
2038                    $("#txtbmonth").val($("#txtmonth").val());
2039                    $("#txtbyear").val($("#txtyear").val());
2040                    $("#txtbphoneextension").val($("#phoneextension").val());
2041                    $("#txtbphonenumber").val($("#phonenumber").val());
2042                    $("#txtbcountryid").val($("#countryid").val());
2043                    $("#txtbaddress").val($("#txtaddress").val());
2044                    $("#txtbcity").val($("#txtcity").val());
2045                    //$("#txtbstate").val($("#txtstate").val());
2046                    $("#txtbpostalcode").val($("#txtpostalcode").val());
2047                    $("#txtboccupation").val($("#txtoccupation").val());
2048                    $("#txtbotheroccupation").val($("#txtotheroccupation").val());
2049
2050                    $("#businesscountryid").val(json[0].BusinessCountryId);
2051                    $("#txtbusinessname").val(json[0].BusinessName);
2052                    $("#txtcompanytype").val(json[0].CompanyType);
2053                    $("#txtcompanyrole").val(json[0].CompanyRole);
2054                    $("#txtregistrationnumber").val(json[0].RegistrationNumber);
2055                    $("#txtwebsitename").val(json[0].WebsiteName);
2056                    $("#txtbusinesscategory").val(json[0].BusinessCategory);
2057                    GetSubCategories(json[0].BusinessCategory, json[0].BusinessSubCategory);
2058
2059                    $("#txtbusinessaddress").val(json[0].BusinessAddress);
2060                    $("#txtbusinesscity").val(json[0].BusinessCity);
2061                    $("#txtbusinesspostalcode").val(json[0].BusinessPostalCode);
2062                    $("#hdnik").val(json[0].IsKYCApproved);
2063                    $("#hdnprfimg").val(json[0].IdProof);
2064                    $("#hdnprftype").val(json[0].ProofType);
2065                    $("#hdnmanualpersonal").val(json[0].VerifiedType);
2066
2067                    $('.ui.selection.dropdown').dropdown({ 'set selected': 01 });
2068
2069                }
2070                else {
2071
2072                }
2073
2074            }
2075            else {
2076
2077            }
2078            $('.showloader').hide();
2079        },
2080        error: function (XMLHttpRequest, textStatus, errorThrown) {
2081            AlertConfirm(XMLHttpRequest.responseText);
2082            $('.showloader').hide();
2083            return false;
2084        }
2085    });
2086}
2087
2088function GR(symbol) {
2089    $('.showloader').show();
2090    $(".reciptentlist").html('');
2091    $(".reciptentlistsomeone").html('');
2092    $(".reciptentlistjoint").html('');
2093    $(".reciptentlistbusiness").html('');
2094    $(".rlmyself").hide();
2095    $(".rlsomeone").hide();
2096    $(".rlbusiness").hide();
2097    $(".rljoint").hide();
2098    $.ajax({
2099        url: '/Personal.aspx/GR',
2100        type: "POST",
2101        dataType: "json",
2102        contentType: "application/json",
2103        data: "{'symbol':'" + symbol + "'}",
2104        success: function (result) {
2105            if (result.d != "") {
2106                if (result.d.indexOf('Success') > -1) {
2107                    var json = $.parseJSON(result.d);
2108                    if (json != "") {
2109                        var myself = 0;
2110                        var someone = 0;
2111                        var business = 0;
2112                        $.each(json, function (i, categories) {
2113
2114                            if (json[i].ReciptentSection == 1) {
2115                                $(".rlmyself").show();
2116                                var str = '<div class="col col-sm-4" style="margin-top:10px;">';
2117                                str += '<div class="card grey-card">';
2118                                str += '<a href="#" class="tapcube" id="' + json[i].Id + '" data-name="' + json[i].ReciptentName.toUpperCase() + " " + json[i].ReciptentLastName.toUpperCase() + '" data-uniqueid="' + json[i].UniqueId + '" data-twrecipientid="' + json[i].TWRecipientId + '">';
2119                                str += '<div class="card-body">';
2120                                str += '<i class="user outline icon"></i>';
2121                                str += '<span>';
2122                                str += '<h5 class="card-title">' + json[i].ReciptentName.toLowerCase() + " " + json[i].ReciptentLastName.toLowerCase() + '</h5>';
2123                                str += '<dd>';
2124                                str += '<i class="' + json[i].CountryCode.toString().toLowerCase() + ' flag"></i>';
2125                                str += json[i].Symbol + ' Account</dd>';
2126                                str += '<small>Account Number: <label>' + json[i].ReciptentAccountNumber + '</label></small>';
2127                                if ((json[i].ReciptentOthers).length > 18) {
2128                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers.substring(0, 18) + '...</label></small>';
2129
2130                                }
2131                                else {
2132                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers + '</label></small>';
2133
2134                                }
2135                                str += '</span>';
2136                                str += '</div>';
2137                                str += '</a>';
2138                                str += '</div>';
2139                                str += '</div >';
2140                                $(".reciptentlist").append(str);
2141                            }
2142                            else if (json[i].ReciptentSection == 2) {
2143                                $(".rlsomeone").show();
2144                                var str = '<div class="col col-sm-4" style="margin-top:10px;">';
2145                                str += '<div class="card grey-card">';
2146                                str += '<a href="#" class="tapcube" id="' + json[i].Id + '" data-name="' + json[i].ReciptentName.toUpperCase() + " " + json[i].ReciptentLastName.toUpperCase() + '" data-uniqueid="' + json[i].UniqueId + '" data-twrecipientid="' + json[i].TWRecipientId + '">';
2147                                str += '<div class="card-body">';
2148                                str += '<i class="user outline icon"></i>';
2149                                str += '<span>';
2150                                str += '<h5 class="card-title">' + json[i].ReciptentName.toLowerCase() + " " + json[i].ReciptentLastName.toLowerCase() + '</h5>';
2151                                str += '<dd>';
2152                                str += '<i class="' + json[i].CountryCode.toString().toLowerCase() + ' flag"></i>';
2153                                str += json[i].Symbol + ' Account</dd>';
2154                                str += '<small>Account Number: <label>' + json[i].ReciptentAccountNumber + '</label></small>';
2155                                if ((json[i].ReciptentOthers).length > 18) {
2156                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers.substring(0, 18) + '...</label></small>';
2157
2158                                }
2159                                else {
2160                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers + '</label></small>';
2161
2162                                }
2163                                str += '</span>';
2164                                str += '</div>';
2165                                str += '</a>';
2166                                str += '</div>';
2167                                str += '</div >';
2168                                $(".reciptentlistsomeone").append(str);
2169                            }
2170                            else if (json[i].ReciptentSection == 3) {
2171                                $(".rlbusiness").show();
2172                                var str = '<div class="col col-sm-4" style="margin-top:10px;">';
2173                                str += '<div class="card grey-card">';
2174                                str += '<a href="#" class="tapcube" id="' + json[i].Id + '" data-name="' + json[i].ReciptentName.toUpperCase() + " " + json[i].ReciptentLastName.toUpperCase() + '" data-uniqueid="' + json[i].UniqueId + '" data-twrecipientid="' + json[i].TWRecipientId + '">';
2175                                str += '<div class="card-body">';
2176                                str += '<i class="user outline icon"></i>';
2177                                str += '<span>';
2178                                str += '<h5 class="card-title">' + json[i].ReciptentName.toLowerCase() + " " + json[i].ReciptentLastName.toLowerCase() + '</h5>';
2179                                str += '<dd>';
2180                                str += '<i class="' + json[i].CountryCode.toString().toLowerCase() + ' flag"></i>';
2181                                str += json[i].Symbol + ' Account</dd>';
2182                                str += '<small>Account Number:<label>' + json[i].ReciptentAccountNumber + '</label></small>';
2183                                if ((json[i].ReciptentOthers).length > 18) {
2184                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers.substring(0, 18) + '...</label></small>';
2185
2186                                }
2187                                else {
2188                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers + '</label></small>';
2189
2190                                }
2191                                str += '</span>';
2192                                str += '</div>';
2193                                str += '</a>';
2194                                str += '</div>';
2195                                str += '</div >';
2196                                $(".reciptentlistbusiness").append(str);
2197                            }
2198                            else if (json[i].ReciptentSection == 5) {
2199                                $(".rljoint").show();
2200                                var str = '<div class="col col-sm-4" style="margin-top:10px;">';
2201                                str += '<div class="card grey-card">';
2202                                str += '<a href="#" class="tapcube" id="' + json[i].Id + '" data-name="' + json[i].ReciptentName.toUpperCase() + " " + json[i].ReciptentLastName.toUpperCase() + '" data-uniqueid="' + json[i].UniqueId + '" data-twrecipientid="' + json[i].TWRecipientId + '">';
2203                                str += '<div class="card-body">';
2204                                str += '<i class="user outline icon"></i>';
2205                                str += '<span>';
2206                                str += '<h5 class="card-title">' + json[i].ReciptentName.toLowerCase() + " " + json[i].ReciptentLastName.toLowerCase() + '</h5>';
2207                                str += '<dd>';
2208                                str += '<i class="' + json[i].CountryCode.toString().toLowerCase() + ' flag"></i>';
2209                                str += json[i].Symbol + ' Account</dd>';
2210                                str += '<small>Account Number:<label>' + json[i].ReciptentAccountNumber + '</label></small>';
2211                                if ((json[i].ReciptentOthers).length > 18) {
2212                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers.substring(0, 18) + '...</label></small>';
2213
2214                                }
2215                                else {
2216                                    str += '<small class="demo-1" >Bank Name: <label id="rec' + json[i].Id + '" title="' + json[i].ReciptentOthers + '">' + json[i].ReciptentOthers + '</label></small>';
2217
2218                                }
2219                                str += '</span>';
2220                                str += '</div>';
2221                                str += '</a>';
2222                                str += '</div>';
2223                                str += '</div >';
2224                                $(".reciptentlistjoint").append(str);
2225                            }
2226
2227                        });
2228                        $('.tapcube').click(function () {
2229                            var id = $(this).attr("id");
2230                            var uniqueid = $(this).attr("data-uniqueid");
2231                            var twrecipientid = $(this).attr("data-twrecipientid");
2232                            var name = $(this).attr("data-name");
2233                            $("#hdnrid").val(id);
2234                            $("#hdnruniqueid").val(uniqueid);
2235                            $("#hdntwrid").val(twrecipientid);
2236                            $("#hdnrecipientname").val(name);
2237                            $(".boxscreen").hide();
2238                            $(".uploadscreen").hide();
2239                            $(".transfer-reason").show();
2240                            $('.sw-toolbar').show();
2241                            $('.sw-btn-next').show();
2242                            $("progress").hide();
2243                            $(".sw-btn-group").show();
2244                            $('.sw-btn-next').removeClass("disabled");
2245                            $('.sw-btn-next').removeClass("hide");
2246                        });
2247                        var hdnrecipientidbylink = $("#hdnrecipientidbylink").val();
2248                        if (hdnrecipientidbylink != "" && typeof (hdnrecipientidbylink) !== "undefined") {
2249                            $("#hdnrecipientidbylink").val("");
2250                            $("#" + hdnrecipientidbylink).click();
2251
2252                        }
2253                        $(".existingreciptent").show();
2254                        $('.showloader').hide();
2255                    }
2256                    else {
2257                        AlertConfirm("Error! Try Again Later");
2258                        $(".existingreciptent").hide();
2259                        $('.showloader').hide();
2260
2261                    }
2262                }
2263                else {
2264                    //alert("Data Not Found");
2265                    $(".existingreciptent").show();
2266                    $('.showloader').hide();
2267                }
2268            }
2269            else {
2270                AlertConfirm("Error! Try Again Later");
2271                $(".existingreciptent").hide();
2272                $('.showloader').hide();
2273
2274            }
2275        },
2276        error: function (XMLHttpRequest, textStatus, errorThrown) {
2277            AlertConfirm(XMLHttpRequest.responseText);
2278            $('.showloader').hide();
2279            return false;
2280        }
2281    });
2282}
2283
2284function GetStates() {
2285    $("#txtsomeoneholderstate").html('');
2286    $("#txtbusinessholderstate").html('');
2287    $("#txtjointaccountstate").html('');
2288    var countrycode = $(".recipient-box").find('.symbolto i').attr("class").replace(" flag", "").toUpperCase();
2289    if (countrycode != "") {
2290        $.ajax({
2291            url: '/Personal.aspx/GetStates',
2292            type: "POST",
2293            dataType: "json",
2294            contentType: "application/json",
2295            data: "{'country':'" + countrycode + "'}",
2296            success: function (result) {
2297                if (result.d != "") {
2298                    if (result.d.indexOf('Success') > -1) {
2299                        var json = $.parseJSON(result.d);
2300                        if (json != "") {
2301                            var str = '';
2302                            $.each(json, function (i, categories) {
2303
2304                                str += '<option value="' + json[i].StateCode + '">' + json[i].StateName + '</option>';
2305
2306                            });
2307                            $("#txtsomeoneholderstate").append(str);
2308                            $("#txtbusinessholderstate").append(str);
2309                            $("#txtjointaccountstate").append(str);
2310                        }
2311                        else {
2312                            AlertConfirm("States Not Found");
2313                        }
2314                    }
2315                    else {
2316                        AlertConfirm("States Not Found");
2317                    }
2318                }
2319                else {
2320                    AlertConfirm("States Not Found");
2321                }
2322
2323            },
2324            error: function (XMLHttpRequest, textStatus, errorThrown) {
2325                AlertConfirm(XMLHttpRequest.responseText);
2326                $('.showloader').hide();
2327                return false;
2328            }
2329        });
2330    }
2331}
2332
2333function GetStatesByCode(countrycode, isbusiness) {
2334    if (isbusiness == '1') {
2335        $("#txtbusinessstate").html('');
2336    }
2337    else {
2338        $("#txtstate").html('');
2339        $("#txtbstate").html('');
2340
2341    }
2342    if (countrycode != "") {
2343        $.ajax({
2344            url: '/Personal.aspx/GetStates',
2345            type: "POST",
2346            dataType: "json",
2347            contentType: "application/json",
2348            data: "{'country':'" + countrycode + "'}",
2349            success: function (result) {
2350                if (result.d != "") {
2351                    if (result.d.indexOf('Success') > -1) {
2352                        var json = $.parseJSON(result.d);
2353                        if (json != "") {
2354                            var str = '';
2355                            $.each(json, function (i, categories) {
2356
2357                                str += '<option value="' + json[i].StateCode + '">' + json[i].StateName + '</option>';
2358
2359                            });
2360                            if (isbusiness == '1') {
2361                                $("#txtbusinessstate").append(str);
2362                            }
2363                            else {
2364                                $("#txtstate").append(str);
2365                                $("#txtbstate").append(str);
2366                            }
2367                        }
2368                        else {
2369                            AlertConfirm("States Not Found");
2370                        }
2371                    }
2372                    else {
2373                        AlertConfirm("States Not Found");
2374                    }
2375                }
2376                else {
2377                    AlertConfirm("States Not Found");
2378                }
2379
2380            },
2381            error: function (XMLHttpRequest, textStatus, errorThrown) {
2382                AlertConfirm(XMLHttpRequest.responseText);
2383                $('.showloader').hide();
2384                return false;
2385            }
2386        });
2387    }
2388}
2389
2390function GetStatesByCountryCode(countrycode, state) {
2391    $("#txtstate").html('');
2392    $("#txtbstate").html('');
2393    if (countrycode != "") {
2394        $.ajax({
2395            url: '/Personal.aspx/GetStates',
2396            type: "POST",
2397            dataType: "json",
2398            contentType: "application/json",
2399            data: "{'country':'" + countrycode + "'}",
2400            success: function (result) {
2401                if (result.d != "") {
2402                    if (result.d.indexOf('Success') > -1) {
2403                        var json = $.parseJSON(result.d);
2404                        if (json != "") {
2405                            var str = '';
2406                            $.each(json, function (i, categories) {
2407
2408                                str += '<option value="' + json[i].StateCode + '">' + json[i].StateName + '</option>';
2409
2410                            });
2411                            $("#txtstate").append(str);
2412                            $("#txtbstate").append(str);
2413                            if (state != "0") {
2414                                $("#txtstate").val(state);
2415                                $("#txtbstate").val(state);
2416                            }
2417                        }
2418                        else {
2419                            AlertConfirm("States Not Found");
2420                        }
2421                    }
2422                    else {
2423                        AlertConfirm("States Not Found");
2424                    }
2425                }
2426                else {
2427                    AlertConfirm("States Not Found");
2428                }
2429
2430            },
2431            error: function (XMLHttpRequest, textStatus, errorThrown) {
2432                AlertConfirm(XMLHttpRequest.responseText);
2433                $('.showloader').hide();
2434                return false;
2435            }
2436        });
2437    }
2438}
2439
2440function GetBankDropDowns(symbol, type) {
2441    debugger;
2442    $("#selfbankdropdown").hide();
2443    $('#selfdrpbank').html('');
2444    $("#someonebankdropdown").hide();
2445    $('#someonedrpbank').html('');
2446    $("#businessbankdropdown").hide();
2447    $('#businessdrpbank').html('');
2448    $("#jointaccountbankdropdown").hide();
2449    $('#jointaccountdrpbank').html('');
2450    if (symbol != "") {
2451        $.ajax({
2452            url: '/Personal.aspx/GetBankDropDown',
2453            type: "POST",
2454            dataType: "json",
2455            contentType: "application/json",
2456            data: "{'symbol':'" + symbol + "'}",
2457            success: function (result) {
2458                debugger;
2459                if (result.d != "") {
2460                    if (result.d.indexOf('Success') > -1) {
2461                        var json = $.parseJSON(result.d);
2462                        if (json != "") {
2463                            var str = '';
2464                            str += '<option value="' + 0 + '">Select Bank</option>';
2465                            $.each(json, function (i, categories) {
2466
2467                                str += '<option value="' + json[i].BankCode + '">' + json[i].BankName + '</option>';
2468
2469                            });
2470                            if (type == "1") {
2471                                $("#selfbankdropdown").show();
2472                                $('#selfdrpbank').append(str);
2473                                return false;
2474                            }
2475                            else if (type == "2") {
2476                                $("#someonebankdropdown").show();
2477                                $('#someonedrpbank').append(str);
2478                                return false;
2479                            }
2480                            else if (type == "3") {
2481                                $("#businessbankdropdown").show();
2482                                $('#businessdrpbank').append(str);
2483                                return false;
2484                            }
2485                            else if (type == "5") {
2486                                $("#jointaccountbankdropdown").show();
2487                                $('#jointaccountdrpbank').append(str);
2488                                return false;
2489                            }
2490
2491                        }
2492
2493                    }
2494                }
2495
2496            },
2497            error: function (XMLHttpRequest, textStatus, errorThrown) {
2498                AlertConfirm(XMLHttpRequest.responseText);
2499                return false;
2500            }
2501        });
2502    }
2503}
2504
2505function GetRelationDropDowns() {
2506
2507  
2508    $('#txtsomeonerelationtoben').html('');
2509    $('#txtjointaccountrelationtoben').html('');
2510    $('#txtbusinessrelationtoben').html('');
2511    var id = $("#currencyto").val().trim();
2512    if (id != "NPR") {
2513        id = "INR";
2514    }
2515    $.ajax({
2516        url: '/Personal.aspx/GetRelationDropDown',
2517        type: "POST",
2518        dataType: "json",
2519        contentType: "application/json",
2520        data: "{'id':'" + id + "'}",
2521        success: function (result) {
2522            if (result.d != "") {
2523                if (result.d.indexOf('Success') > -1) {
2524                    var json = $.parseJSON(result.d);
2525                    if (json != "") {
2526                        var str = '';
2527                        $.each(json, function (i, categories) {
2528
2529                            str += '<option value="' + json[i].CategoryName + '">' + json[i].CategoryName + '</option>';
2530
2531                        });
2532                        $('#txtsomeonerelationtoben').append(str);
2533                        $('#txtjointaccountrelationtoben').append(str);
2534                        $('#txtbusinessrelationtoben').append(str);
2535                        return false;
2536                    }
2537
2538                }
2539            }
2540
2541        },
2542        error: function (XMLHttpRequest, textStatus, errorThrown) {
2543            AlertConfirm(XMLHttpRequest.responseText);
2544            return false;
2545        }
2546    });
2547
2548}
2549
2550function GetTransferPurpose() {
2551    $('#drptransferpurpose').html('');
2552    var id = $("#currencyto").val().trim();
2553    if (id != "NPR") {
2554        id = "INR";
2555    }
2556    $.ajax({
2557        url: '/Personal.aspx/GetTransferPurpose',
2558        type: "POST",
2559        dataType: "json",
2560        contentType: "application/json",
2561        data: "{'id':'" + id + "'}",
2562        success: function (result) {
2563            if (result.d != "") {
2564                if (result.d.indexOf('Success') > -1) {
2565                    var json = $.parseJSON(result.d);
2566                    if (json != "") {
2567                        var str = '';
2568                        str += '<div class="item active selected" data-value="0">Select a reason...</div>';
2569                        $.each(json, function (i, categories) {
2570
2571                            str += '<div class="item" data-value="' + json[i].Id + '" onclick="return checkReason(this);">' + json[i].CategoryName + '</div>';
2572
2573                        });
2574                        $('#drptransferpurpose').append(str);
2575                        $(".reasondropdown").find(".text").html("Select a reason...");
2576                        $("#hdntransferreason").val(0);
2577                        return false;
2578                    }
2579
2580                }
2581            }
2582
2583        },
2584        error: function (XMLHttpRequest, textStatus, errorThrown) {
2585            AlertConfirm(XMLHttpRequest.responseText);
2586            return false;
2587        }
2588    });
2589
2590}
2591
2592function CreateForm(id) {
2593    RefreshRecipient();
2594    $('.showloader').show();
2595    var symbol = $("#currencyto").val().trim();
2596    var str = "";
2597    if (symbol != "") {
2598        $.ajax({
2599            url: '/Personal.aspx/GetForm',
2600            type: "POST",
2601            dataType: "json",
2602            contentType: "application/json",
2603            data: "{'symbol':'" + symbol + "','section':'" + id + "'}",
2604            success: function (result) {
2605                if (result.d != "") {
2606
2607                    var json = $.parseJSON(result.d)
2608                    if (json != "") {
2609                        $.each(json, function (i, categories) {
2610                            str += SelfForm(json[i].Id, json[i].FieldType, json[i].Type, json[i].IsRequired, json[i].Title, json[i].Note, json[i].Maximumlength, json[i].Minimumlength, json[i].PlaceHolder, json[i].ReciptentCurrencyFormId, json[i].TWType, json[i].UniqueId);
2611                        });
2612                        if (result.d.indexOf('Success') > -1) {
2613                        
2614                            GetBankDropDowns(symbol, id);
2615                            checkcountryphone(symbol);
2616                            if (id == "1") {
2617                                $("#selfbody").html(str);
2618                                GUD();
2619                                $('.primarypopup').popup();
2620                                $("#aselfmodal").trigger('click');
2621                                $('.showloader').hide();
2622                                initMap(symbol);
2623                                return false;
2624                            }
2625                            else if (id == "2") {
2626                                $("#someonebody").html(str);
2627                                $('.primarypopup').popup();
2628                                $("#asomeonemodal").trigger('click');
2629                                $('.showloader').hide();
2630                                initMap(symbol);
2631                                return false;
2632                            }
2633                            else if (id == "3") {
2634                                $("#businessbody").html(str);
2635                                $('.primarypopup').popup();
2636                                $("#abusinessmodal").trigger('click');
2637                                $('.showloader').hide();
2638                                initMap(symbol);
2639                                return false;
2640                            }
2641                            else if (id == "5") {
2642                                $("#jointaccountbody").html(str);
2643                                $('.primarypopup').popup();
2644                                $("#ajointaccountmodal").trigger('click');
2645                                $('.showloader').hide();
2646                                initMap(symbol);
2647                                return false;
2648                            }
2649                        }
2650                        else {
2651                            AlertConfirm(json[0].message);
2652                            $('.showloader').hide();
2653                            return false;
2654                        }
2655                    }
2656                    else {
2657                        AlertConfirm("data not found");
2658                    }
2659
2660                }
2661                else {
2662                    AlertConfirm("data not found");
2663                }
2664                $('.showloader').hide();
2665                return false;
2666            },
2667            error: function (XMLHttpRequest, textStatus, errorThrown) {
2668                AlertConfirm(XMLHttpRequest.responseText);
2669                $('.showloader').hide();
2670                return false;
2671            }
2672        });
2673    }
2674    else {
2675        AlertConfirm("Currency not found");
2676    }
2677    return false;
2678}
2679
2680function checkcountryphone(symbol) {
2681    if (symbol.toLowerCase() == "npr") {
2682        $(".phonecountry").html('');
2683        $(".dropdownphone").addClass("disabled");
2684        var str = '<div onclick="return initMap(' + '&apos;' + 'npr' + '&apos;' + ');" class="item phonecodetext" data-value="+977" data-country="Nepal" data-countrycode="npl">+977 <i class="np flag"></i></div>';
2685        $(".phonecountry").append(str);
2686        $('.phonecodetext').html('+977 <i class="np flag"></i>');
2687        $('.phonecodetext').attr('data-value', '+977');
2688        $('#txtsomeoneholderphoneextension').val('+977');
2689        $('#txtjointaccountphoneextension').val('+977');
2690        $('#txtbusinessholderphoneextension').val('+977');
2691    }
2692    else if (symbol.toLowerCase() == "php") {
2693        $(".phonecountry").html('');
2694        $(".dropdownphone").addClass("disabled");
2695        var str = '<div onclick="return initMap(' + '&apos;' + 'php' + '&apos;' + ');" class="item phonecodetext" data-value="+63" data-country="Philippines" data-countrycode="ph">+63 <i class="ph flag"></i></div>';
2696        $(".phonecountry").append(str);
2697        $('.phonecodetext').html('+63 <i class="ph flag"></i>');
2698        $('.phonecodetext').attr('data-value', '+63');
2699        $('#txtsomeoneholderphoneextension').val('+63');
2700        $('#txtjointaccountphoneextension').val('+63');
2701        $('#txtbusinessholderphoneextension').val('+63');
2702    }
2703    else if (symbol.toLowerCase() == "cny") {
2704        $(".phonecountry").html('');
2705        $(".dropdownphone").addClass("disabled");
2706        var str = '<div onclick="return initMap(' + '&apos;' + 'cny' + '&apos;' + ');" class="item phonecodetext" data-value="+86" data-country="China" data-countrycode="cn">+86 <i class="cn flag"></i></div>';
2707        $(".phonecountry").append(str);
2708        $('.phonecodetext').html('+86 <i class="cn flag"></i>');
2709        $('.phonecodetext').attr('data-value', '+86');
2710        $('#txtsomeoneholderphoneextension').val('+86');
2711        $('#txtjointaccountphoneextension').val('+86');
2712        $('#txtbusinessholderphoneextension').val('+86');
2713    }
2714    else if (symbol.toLowerCase() == "inr") {
2715        $(".phonecountry").html('');
2716        $(".dropdownphone").addClass("disabled");
2717        var str = '<div onclick="return initMap(' + '&apos;' + 'inr' + '&apos;' + ');" class="item phonecodetext" data-value="+91" data-country="India" data-countrycode="in">+91 <i class="in flag"></i></div>';
2718        $(".phonecountry").append(str);
2719        $('.phonecodetext').html('+91 <i class="in flag"></i>');
2720        $('.phonecodetext').attr('data-value', '+91');
2721        $('#txtsomeoneholderphoneextension').val('+91');
2722        $('#txtjointaccountphoneextension').val('+91');
2723        $('#txtbusinessholderphoneextension').val('+91');
2724    }
2725    else if (symbol.toLowerCase() == "myr") {
2726        $(".phonecountry").html('');
2727        $(".dropdownphone").addClass("disabled");
2728        var str = '<div onclick="return initMap(' + '&apos;' + 'myr' + '&apos;' + ');" class="item phonecodetext" data-value="+60" data-country="Malaysia" data-countrycode="my">+60 <i class="my flag"></i></div>';
2729        $(".phonecountry").append(str);
2730        $('.phonecodetext').html('+60 <i class="my flag"></i>');
2731        $('.phonecodetext').attr('data-value', '+60');
2732        $('#txtsomeoneholderphoneextension').val('+60');
2733        $('#txtjointaccountphoneextension').val('+60');
2734        $('#txtbusinessholderphoneextension').val('+60');
2735    }
2736    else if (symbol.toLowerCase() == "hkd") {
2737        $(".phonecountry").html('');
2738        $(".dropdownphone").addClass("disabled");
2739        var str = '<div onclick="return initMap(' + '&apos;' + 'hkd' + '&apos;' + ');" class="item phonecodetext" data-value="+852" data-country="Hong Kong" data-countrycode="hk">+852 <i class="hk flag"></i></div>';
2740        $(".phonecountry").append(str);
2741        $('.phonecodetext').html('+852 <i class="hk flag"></i>');
2742        $('.phonecodetext').attr('data-value', '+852');
2743        $('#txtsomeoneholderphoneextension').val('+852');
2744        $('#txtjointaccountphoneextension').val('+852');
2745        $('#txtbusinessholderphoneextension').val('+852');
2746    }
2747    else if (symbol.toLowerCase() == "idr") {
2748        $(".phonecountry").html('');
2749        $(".dropdownphone").addClass("disabled");
2750        var str = '<div onclick="return initMap(' + '&apos;' + 'idr' + '&apos;' + ');" class="item phonecodetext" data-value="+62" data-country="Indonesia" data-countrycode="id">+62 <i class="id flag"></i></div>';
2751        $(".phonecountry").append(str);
2752        $('.phonecodetext').html('+62 <i class="id flag"></i>');
2753        $('.phonecodetext').attr('data-value', '+62');
2754        $('#txtsomeoneholderphoneextension').val('+62');
2755        $('#txtjointaccountphoneextension').val('+62');
2756        $('#txtbusinessholderphoneextension').val('+62');
2757    }
2758    else if (symbol.toLowerCase() == "thb") {
2759        $(".phonecountry").html('');
2760        $(".dropdownphone").addClass("disabled");
2761        var str = '<div onclick="return initMap(' + '&apos;' + 'thb' + '&apos;' + ');" class="item phonecodetext" data-value="+66" data-country="Thailand" data-countrycode="th">+66 <i class="th flag"></i></div>';
2762        $(".phonecountry").append(str);
2763        $('.phonecodetext').html('+66 <i class="th flag"></i>');
2764        $('.phonecodetext').attr('data-value', '+66');
2765        $('#txtsomeoneholderphoneextension').val('+66');
2766        $('#txtjointaccountphoneextension').val('+66');
2767        $('#txtbusinessholderphoneextension').val('+66');
2768    }
2769    else if (symbol.toLowerCase() == "usd") {
2770        $(".phonecountry").html('');
2771        $(".dropdownphone").addClass("disabled");
2772        var str = '<div onclick="return initMap(' + '&apos;' + 'usd' + '&apos;' + ');" class="item phonecodetext" data-value="+1" data-country="United States" data-countrycode="us">+1 <i class="us flag"></i></div>';
2773        $(".phonecountry").append(str);
2774        $('.phonecodetext').html('+1 <i class="us flag"></i>');
2775        $('.phonecodetext').attr('data-value', '+1');
2776        $('#txtsomeoneholderphoneextension').val('+1');
2777        $('#txtjointaccountphoneextension').val('+1');
2778        $('#txtbusinessholderphoneextension').val('+1');
2779    }
2780    else if (symbol.toLowerCase() == "cad") {
2781        $(".phonecountry").html('');
2782        $(".dropdownphone").addClass("disabled");
2783        var str = '<div onclick="return initMap(' + '&apos;' + 'cad' + '&apos;' + ');" class="item phonecodetext" data-value="+1" data-country="Canada" data-countrycode="ca">+1 <i class="ca flag"></i></div>';
2784        $(".phonecountry").append(str);
2785        $('.phonecodetext').html('+1 <i class="ca flag"></i>');
2786        $('.phonecodetext').attr('data-value', '+1');
2787        $('#txtsomeoneholderphoneextension').val('+1');
2788        $('#txtjointaccountphoneextension').val('+1');
2789        $('#txtbusinessholderphoneextension').val('+1');
2790    }
2791    else if (symbol.toLowerCase() == "sgd") {
2792        $(".phonecountry").html('');
2793        $(".dropdownphone").addClass("disabled");
2794        var str = '<div onclick="return initMap(' + '&apos;' + 'sgd' + '&apos;' + ');" class="item phonecodetext" data-value="+65" data-country="Singapore" data-countrycode="sg">+65 <i class="sg flag"></i></div>';
2795        $(".phonecountry").append(str);
2796        $('.phonecodetext').html('+65 <i class="sg flag"></i>');
2797        $('.phonecodetext').attr('data-value', '+65');
2798        $('#txtsomeoneholderphoneextension').val('+65');
2799        $('#txtjointaccountphoneextension').val('+65');
2800        $('#txtbusinessholderphoneextension').val('+65');
2801    }
2802    else if (symbol.toLowerCase() == "gbp") {
2803        $(".phonecountry").html('');
2804        $(".dropdownphone").addClass("disabled");
2805        var str = '<div onclick="return initMap(' + '&apos;' + 'gbp' + '&apos;' + ');" class="item phonecodetext" data-value="+44" data-country="United Kingdom" data-countrycode="gb">+44 <i class="gb flag"></i></div>';
2806        $(".phonecountry").append(str);
2807        $('.phonecodetext').html('+44 <i class="gb flag"></i>');
2808        $('.phonecodetext').attr('data-value', '+44');
2809        $('#txtsomeoneholderphoneextension').val('+44');
2810        $('#txtjointaccountphoneextension').val('+44');
2811        $('#txtbusinessholderphoneextension').val('+44');
2812    }
2813    else if (symbol.toLowerCase() == "bdt") {
2814        $(".phonecountry").html('');
2815        $(".dropdownphone").addClass("disabled");
2816        var str = '<div onclick="return initMap(' + '&apos;' + 'bdt' + '&apos;' + ');" class="item phonecodetext" data-value="+880" data-country="Bangladesh" data-countrycode="bd">+880 <i class="bd flag"></i></div>';
2817        $(".phonecountry").append(str);
2818        $('.phonecodetext').html('+880 <i class="bd flag"></i>');
2819        $('.phonecodetext').attr('data-value', '+880');
2820        $('#txtsomeoneholderphoneextension').val('+880');
2821        $('#txtjointaccountphoneextension').val('+880');
2822        $('#txtbusinessholderphoneextension').val('+880');
2823    }
2824    else if (symbol.toLowerCase() == "eur") {
2825        $(".phonecountry").html('');
2826        $(".dropdownphone").removeClass("disabled");
2827        $('.phonecodetext').html('+43 <i class="at flag"></i>');
2828        $('.phonecodetext').attr('data-value', '+43');
2829        $('#txtsomeoneholderphoneextension').val('+43');
2830        $('#txtjointaccountphoneextension').val('+43');
2831        $('#txtbusinessholderphoneextension').val('+43');
2832        var str = '<div onclick="return initMap(' + '&apos;' + 'eur-at' + '&apos;' + ');" class="item phonecodetext" data-value="+43" data-country="Austria" data-countrycode="at">+43 <i class="at flag"></i></div>';
2833        str += '<div onclick="return initMap(' + '&apos;' + 'eur-be' + '&apos;' + ');" class="item phonecodetext" data-value="+32" data-country="Belgium" data-countrycode="be">+32 <i class="be flag"></i></div>';
2834        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-bg' + '&apos;' + ');" class="item phonecodetext" data-value="+359" data-country="Bulgaria" data-countrycode="bg">+359 <i class="bg flag"></i></div>';
2835        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-hr' + '&apos;' + ');" class="item phonecodetext" data-value="+385" data-country="Croatia" data-countrycode="hr">+385 <i class="hr flag"></i></div>';
2836        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-cz' + '&apos;' + ');" class="item phonecodetext" data-value="+420" data-country="Czech Republic" data-countrycode="cz">+420 <i class="cz flag"></i></div>';
2837        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-dk' + '&apos;' + ');" class="item phonecodetext" data-value="+45" data-country="Denmark" data-countrycode="dk">+45 <i class="dk flag"></i></div>';
2838        str += '<div onclick="return initMap(' + '&apos;' + 'eur-ee' + '&apos;' + ');" class="item phonecodetext" data-value="+372" data-country="Estonia" data-countrycode="ee">+372 <i class="ee flag"></i></div>';
2839        str += '<div onclick="return initMap(' + '&apos;' + 'eur-fi' + '&apos;' + ');" class="item phonecodetext" data-value="+358" data-country="Finland" data-countrycode="fi">+358 <i class="fi flag"></i></div>';
2840        str += '<div onclick="return initMap(' + '&apos;' + 'eur-fr' + '&apos;' + ');" class="item phonecodetext" data-value="+33" data-country="France" data-countrycode="fr">+33 <i class="fr flag"></i></div>';
2841        str += '<div onclick="return initMap(' + '&apos;' + 'eur-de' + '&apos;' + ');" class="item phonecodetext" data-value="+49" data-country="Germany" data-countrycode="de">+49 <i class="dee flag"></i></div>';
2842        str += '<div onclick="return initMap(' + '&apos;' + 'eur-gr' + '&apos;' + ');" class="item phonecodetext" data-value="+30" data-country="Greece" data-countrycode="gr">+30 <i class="gr flag"></i></div>';
2843        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-hu' + '&apos;' + ');" class="item phonecodetext" data-value="+36" data-country="Hungary" data-countrycode="hu">+36 <i class="hu flag"></i></div>';
2844        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-is' + '&apos;' + ');" class="item phonecodetext" data-value="+354" data-country="Iceland" data-countrycode="is">+354 <i class="is flag"></i></div>';
2845        str += '<div onclick="return initMap(' + '&apos;' + 'eur-ie' + '&apos;' + ');" class="item phonecodetext" data-value="+353" data-country="Ireland" data-countrycode="ie">+353 <i class="ie flag"></i></div>';
2846        str += '<div onclick="return initMap(' + '&apos;' + 'eur-it' + '&apos;' + ');" class="item phonecodetext" data-value="+39" data-country="Italy" data-countrycode="it">+39 <i class="it flag"></i></div>';
2847    
2847    str += '<div onclick="return initMap(' + '&apos;' + 'eur-lv' + '&apos;' + ');" class="item phonecodetext" data-value="+371" data-country="Latvia" data-countrycode="lv">+371 <i class="lv flag"></i></div>';
2848        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-li' + '&apos;' + ');" class="item phonecodetext" data-value="+423" data-country="Liechtenstein" data-countrycode="li">+423 <i class="li flag"></i></div>';
2849        str += '<div onclick="return initMap(' + '&apos;' + 'eur-lt' + '&apos;' + ');" class="item phonecodetext" data-value="+370" data-country="Lithuania" data-countrycode="lt">+370 <i class="lt flag"></i></div>';
2850        str += '<div onclick="return initMap(' + '&apos;' + 'eur-lu' + '&apos;' + ');" class="item phonecodetext" data-value="+352" data-country="Luxembourg" data-countrycode="lu">+352 <i class="lu flag"></i></div>';
2851        str += '<div onclick="return initMap(' + '&apos;' + 'eur-mt' + '&apos;' + ');" class="item phonecodetext" data-value="+356" data-country="Malta" data-countrycode="mt">+356 <i class="mt flag"></i></div>';
2852        str += '<div onclick="return initMap(' + '&apos;' + 'eur-nl' + '&apos;' + ');" class="item phonecodetext" data-value="+31" data-country="Netherlands" data-countrycode="nl">+31 <i class="nl flag"></i></div>';
2853        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-no' + '&apos;' + ');" class="item phonecodetext" data-value="+47" data-country="Norway" data-countrycode="no">+47 <i class="no flag"></i></div>';
2854       //str += '<div onclick="return initMap(' + '&apos;' + 'eur-pl' + '&apos;' + ');" class="item phonecodetext" data-value="+48" data-country="Poland" data-countrycode="pl">+48 <i class="pl flag"></i></div>';
2855        str += '<div onclick="return initMap(' + '&apos;' + 'eur-pt' + '&apos;' + ');" class="item phonecodetext" data-value="+351" data-country="Portugal" data-countrycode="pt">+351 <i class="pt flag"></i></div>';
2856        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-ro' + '&apos;' + ');" class="item phonecodetext" data-value="+40" data-country="Romania" data-countrycode="ro">+40 <i class="ro flag"></i></div>';
2857        str += '<div onclick="return initMap(' + '&apos;' + 'eur-sk' + '&apos;' + ');" class="item phonecodetext" data-value="+421" data-country="Slovakia" data-countrycode="sk">+421 <i class="sk flag"></i></div>';
2858        str += '<div onclick="return initMap(' + '&apos;' + 'eur-sl' + '&apos;' + ');" class="item phonecodetext" data-value="+386" data-country="Slovenia" data-countrycode="sl">+386 <i class="sl flag"></i></div>';
2859        str += '<div onclick="return initMap(' + '&apos;' + 'eur-es' + '&apos;' + ');" class="item phonecodetext" data-value="+34" data-country="Spain" data-countrycode="es">+34 <i class="es flag"></i></div>';
2860        //str += '<div onclick="return initMap(' + '&apos;' + 'eur-se' + '&apos;' + ');" class="item phonecodetext" data-value="+46" data-country="Sweden" data-countrycode="se">+46 <i class="se flag"></i></div>';
2861        $(".phonecountry").append(str);
2862
2863    }
2864}
2865
2866function SelfForm(Id, FieldType, Type, IsRequired, Title, Note, Maximumlength, Minimumlength, PlaceHolder, rcId, TWType, UniqueId) {
2867    var str = '<div class="row">';
2868    str += '<div class="col">';
2869    str += ' <div class="field">';
2870    if (Note != "") {
2871        str += ' <label>' + Title + ' <i class="question circle outline icon primarypopup" data-content="' + Note + '"></i><span style="color:red">*</span></label>';
2872
2873    }
2874    else {
2875        str += ' <label>' + Title + ' <span style="color:red">*</span></label>';
2876    }
2877    if (parseInt(Type) == 1) {
2878        if (IsRequired == true) {
2879            if (parseInt(Maximumlength) > 0) {
2880                if (Title == "Account Name") {
2881                    str += ' <input class="bankdata" id="txtaccountname" readonly="true" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '"  data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '"  data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '  required="required">';
2882
2883                }
2884                else {
2885                    str += ' <input class="bankdata" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '"  data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '"  data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '  required="required">';
2886
2887                }
2888            }
2889            else {
2890                if (Title == "Account Name") {
2891                    str += ' <input class="bankdata" id="txtaccountname" readonly="true" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
2892                }
2893                else {
2894                    str += ' <input class="bankdata" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
2895
2896                }
2897            }
2898        }
2899        else {
2900            if (parseInt(Maximumlength) > 0) {
2901                if (Title == "Account Name") {
2902                    str += ' <input class="bankdata" id="txtaccountname" readonly="true" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
2903                }
2904                else {
2905                    str += ' <input class="bankdata" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
2906
2907                }
2908            }
2909            else {
2910                if (Title == "Account Name") {
2911                    str += ' <input class="bankdata" id="txtaccountname" readonly="true" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
2912                }
2913                else {
2914                    str += ' <input class="bankdata" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
2915
2916                }
2917            }
2918        }
2919    }
2920
2921    else if (parseInt(Type) == 2) {
2922        str += '<textarea class="bankdata" data-fieldtype="' + FieldType + '" data-twtype="' + TWType + '" data-uniqueid="' + UniqueId + '" data-rcid="' + rcId + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" id="multi' + Id + '" cols="40" rows="5" MaxLength="' + Maximumlength + '"></textarea>';
2923    }
2924    else if (parseInt(Type) == 3) {
2925        if (IsRequired == true) {
2926            if (parseInt(Maximumlength) > 0) {
2927                str += ' <input class="bankdata" onkeypress="return isNumberKey(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '"  data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '  required="required">';
2928            }
2929            else {
2930                str += ' <input class="bankdata" onkeypress="return isNumberKey(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
2931            }
2932        }
2933        else {
2934            if (parseInt(Maximumlength) > 0) {
2935                str += ' <input class="bankdata" onkeypress="return isNumberKey(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
2936            }
2937            else {
2938                str += ' <input class="bankdata" onkeypress="return isNumberKey(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
2939            }
2940        }
2941    }
2942    else if (parseInt(Type) == 4) {
2943        if (IsRequired == true) {
2944            if (parseInt(Maximumlength) > 0) {
2945                str += ' <input class="bankdata" onkeypress="return lettersOnl
2945y(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '"  data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '  required="required">';
2946            }
2947            else {
2948                str += ' <input class="bankdata" onkeypress="return lettersOnly(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
2949            }
2950        }
2951        else {
2952            if (parseInt(Maximumlength) > 0) {
2953                str += ' <input class="bankdata" onkeypress="return lettersOnly(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
2954            }
2955            else {
2956                str += ' <input class="bankdata" onkeypress="return lettersOnly(event);" type="text" id="txt' + Id + '" data-uniqueid="' + UniqueId + '" data-twtype="' + TWType + '" data-title="' + Title + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
2957            }
2958        }
2959    }
2960    //else if (parseInt(Type) == 3) {
2961    //    if (IsRequired == true) {
2962    //        if (parseInt(Maximumlength) > 0) {
2963    //            str += ' <input class="bankdata" type="email" id="email' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '  required="required">';
2964    //        }
2965    //        else {
2966    //            str += ' <input class="bankdata" type="email" id="email' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
2967    //        }
2968    //    }
2969    //    else {
2970    //        if (parseInt(Maximumlength) > 0) {
2971    //            str += ' <input class="bankdata" type="email" id="email' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
2972    //        }
2973    //        else {
2974    //            str += ' <input class="bankdata" type="email" id="email' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
2975    //        }
2976    //    }
2977    //}
2978    //else if (parseInt(Type) == 4) {
2979    //    if (IsRequired == true) {
2980    //        if (parseInt(Maximumlength) > 0) {
2981    //            str += ' <input class="datepicker bankdata" type="text" id="txt' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '  required="required">';
2982    //        }
2983    //        else {
2984    //            str += ' <input class="datepicker bankdata" type="text" id="txt' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
2985    //        }
2986    //    }
2987    //    else {
2988    //        if (parseInt(Maximumlength) > 0) {
2989    //            str += ' <input class="datepicker bankdata" type="text" id="txt' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
2990    //        }
2991    //        else {
2992    //            str += ' <input class="datepicker bankdata" type="text" id="txt' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
2993    //        }
2994    //    }
2995    //}
2996    //else if (parseInt(Type) == 5) {
2997    //    if (IsRequired == true) {
2998    //        if (parseInt(Maximumlength) > 0) {
2999    //            str += ' <input class="bankdata" type="password" id="password' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + ' required="required">';
3000    //        }
3001    //        else {
3002    //            str += ' <input class="bankdata" type="password" id="password' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" required>';
3003    //        }
3004    //    }
3005    //    else {
3006    //        if (parseInt(Maximumlength) > 0) {
3007    //            str += ' <input class="bankdata" type="password" id="password' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '" MaxLength=' + Maximumlength + '>';
3008    //        }
3009    //        else {
3010    //            str += ' <input class="bankdata" type="password" id="password' + Id + '" data-title="' + Title + '" data-uniqueid="' + UniqueId + '" data-type="' + Type + '" data-cd="' + Id + '" data-fieldtype="' + FieldType +'" data-rcid="' + rcId + '" data-minimumlength="' + Minimumlength + '" placeholder="' + PlaceHolder + '">';
3011    //        }
3012    //    }
3013    //}
3014    //else if (parseInt(Type) == 6) {
3015    //    str += ' <input class="bankdata" type="checkbox" data-type="' + Type + '" data-title="' + Title + '" data-fieldtype="' + FieldType +'" data-uniqueid="' + UniqueId + '" data-rcid="' + rcId + '" data-cd="' + Id + '" id="checkbox' + Id + '">';
3016    //}
3017    str += '</div>';
3018    str += ' </div>';
3019    str += '</div>';
3020    str += '</div>';
3021    return str;
3022}
3023
3024function AR(type) {
3025    debugger;
3026    $('.addrecbtn').addClass('disabled');
3027    var checkvalid = true;
3028    var sourcesymbol = $("#currencyfrom").val().trim();
3029    var destsymbol = $("#currencyto").val().trim();
3030    var sdcountryid = $(".recipient-box").find(".menu .item:contains(" + destsymbol.trim() + ")").attr("data-id");
3031    var countrycode = $(".recipient-box").find('.symbolto i').attr("class").replace(" flag", "").toUpperCase();
3032    var countrycodewithflag = $(".recipient-box").find('.symbolto i').attr("class")
3033    var state = '';
3034    var statecode = '';
3035    var city = '';
3036    var zipcode = '';
3037    var address = '';
3038    var email = '';
3039    var name = '';
3040    var lastname = '';
3041    var jointname = '';
3042    var jointlastname = '';
3043    var dob = '';
3044    var phone = '';
3045    var recipienttype = '2';
3046    var bankcode = '';
3047    var bankname = '';
3048    var relation = '';
3049    var bbusinessname = ''
3050    var branchaddress = "";
3051    var countryid = $(".recipient-box").find(".menu .item:contains(" + destsymbol.trim() + ")").attr("data-cntid");
3052    var str = "";
3053
3054    if (sourcesymbol == "") {
3055        AlertConfirm("Currency Not Found");
3056        $('.addrecbtn').removeClass('disabled');
3057        return false;
3058    }
3059    if (destsymbol == "") {
3060        AlertConfirm("Currency Not Found");
3061        $('.addrecbtn').removeClass('disabled');
3062        return false;
3063    }
3064    if (sdcountryid == "" || typeof (sdcountryid) === "undefined") {
3065        AlertConfirm("source id not found");
3066        $('.addrecbtn').removeClass('disabled');
3067        return false;
3068    }
3069    if (type == "") {
3070        AlertConfirm("Type Not Found");
3071        return false;
3072    }
3073    else if (type == "1") {
3074        curStep = $(".selfmainbody")
3075        $(".selfmainbody").find('.has-error').removeClass("has-error");
3076        $(".selfmainbody").find('.alert-danger').remove();
3077        state = $("#txtmyselfholderstate").val();
3078        city = $("#txtmyselfholdercity").val();
3079        zipcode = $("#txtmyselfholderzipcode").val();
3080        address = $("#txtmyselfholderaddress").val();
3081        //state = "";
3082        //city = "";
3083        //zipcode = "";
3084        //address = "";
3085        email = "";
3086        phone = $("#txtphoneextension").val() + $("#txtselfholderphonenumber").val();
3087        dob = "";
3088        //email = $("#txtmyselfholderemail").val();
3089        name = $("#txtaccountholder").val();
3090        lastname = $("#txtaccountholderlastname").val();
3091        bankcode = $("#selfdrpbank").val();
3092        bankname = $("#selfdrpbank option:selected").text();
3093       
3094        relation = "MySelf";
3095    }
3096    else if (type == "2") {
3097        curStep = $(".someonemainbody")
3098        $(".someonemainbody").find('.has-error').removeClass("has-error");
3099        $(".someonemainbody").find('.alert-danger').remove();
3100        /*state = $("#txtsomeoneholderstate option:selected").text();*/
3101        state = $("#txtsomeoneholderstate").val();
3102        statecode = $("#txtsomeoneholderstate").val();
3103        city = $("#txtsomeoneholdercity").val();
3104        zipcode = $("#txtsomeoneholderzipcode").val();
3105        address = $("#txtsomeoneholderaddress").val();
3106        email = $("#txtsomeoneholderemail").val();
3107        name = $("#txtsomeoneholdername").val();
3108        lastname = $("#txtsomeoneholderlastname").val();
3109        phone = $("#txtsomeoneholderphoneextension").val() + $("#txtsomeoneholderphonenumber").val();
3110        var date = $("#txtsomeonedate").val();
3111        var month = $("#txtsomeonemonth").val();
3112        var year = $("#txtsomeoneyear").val();
3113        if (date != "") {
3114            dob = year + "-" + month + "-" + date;
3115        }
3116        bankcode = $("#someonedrpbank").val();
3117        bankname = $("#someonedrpbank option:selected").text();
3118        
3119        relation = $("#txtsomeonerelationtoben").val();
3120        //$("#btnsomeoneelse").click();
3121    }
3122    else if (type == "5") {
3123        curStep = $(".jointaccountmainbody")
3124        $(".jointaccountmainbody").find('.has-error').removeClass("has-error");
3125        $(".jointaccountmainbody").find('.alert-danger').remove();
3126        /* state = $("#txtjointaccountstate option:selected").text();*/
3127        state = $("#txtjointaccountstate").val();
3128        statecode = $("#txtjointaccountstate").val();
3129        city = $("#txtjointaccountcity").val();
3130        zipcode = $("#txtjointaccountzipcode").val();
3131        address = $("#txtjointaccountaddress").val();
3132        email = $("#txtjointaccountemail").val();
3133        name = $("#txtjointaccountname").val();
3134        lastname = $("#txtjointaccountlastname").val();
3135        jointname = $("#txtjjointaccountname").val();
3136        jointlastname = $("#txtjjointaccountlastname").val();
3137        phone = $("#txtjointaccountphoneextension").val() + $("#txtjointaccountphonenumber").val();
3138        var date = $("#txtjointaccountdate").val();
3139        var month = $("#txtjointaccountmonth").val();
3140        var year = $("#txtjointaccountyear").val();
3141        if (date != "") {
3142            dob = year + "-" + month + "-" + date;
3143        }
3144        bankcode = $("#jointaccountdrpbank").val();
3145        bankname = $("#jointaccountdrpbank option:selected").text();
3146       
3147        relation = $("#txtjointaccountrelationtoben").val();
3148      /*  $("#btnjointaccount").click();*/
3149    }
3150    else if (type == "3") {
3151        curStep = $(".businessmainbody")
3152        $(".businessmainbody").find('.has-error').removeClass("has-error");
3153        $(".businessmainbody").find('.alert-danger').remove();
3154        /* state = $("#txtbusinessholderstate option:selected").text();*/
3155        state = $("#txtbusinessholderstate").val();
3156        city = $("#txtbusinessholdercity").val();
3157        zipcode = $("#txtbusinessholderzipcode").val();
3158        address = $("#txtbusinessholderaddress").val();
3159        statecode = $("#txtbusinessholderstate").val();
3160        email = $("#txtbusinessholderemail").val();
3161        name = $("#txtbusinessholdername").val();
3162        lastname = $("#txtbusinessholderlastname").val();
3163        phone = $("#txtbusinessholderphoneextension").val() + $("#txtbusinessholderphonenumber").val();
3164        var date = $("#txtbusinessdate").val();
3165        var month = $("#txtbusinessmonth").val();
3166        var year = $("#txtbusinessyear").val();
3167        if (date != "") {
3168            dob = year + "-" + month + "-" + date;
3169        }
3170
3171        bankcode = $("#businessdrpbank").val();
3172        bankname = $("#businessdrpbank option:selected").text();
3173       
3174        relation = $("#txtbusinessrelationtoben").val();
3175        bbusinessname = $("#txtbbusinessname").val();
3176        /*$("#btnbusiness").click();*/
3177    }
3178
3179
3180    var dataArr = [];
3181    var curInputs = curStep.find("input[type='text'],input[type='hidden'],input[type='url'], input[type='password'], input[type='email'],input[type='number'],textarea,select");
3182    for (var i = 0; i < curInputs.length; i++) {
3183        if ($(curInputs[i]).attr("required") == "required" && ($(curInputs[i]).val() == "" || $(curInputs[i]).val() == "0")) {
3184            checkvalid = false;
3185            $(curInputs[i]).addClass("has-error");
3186            var message = "Please enter " + $(curInputs[i]).attr("data-title");
3187            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
3188        }
3189        else if ($(curInputs[i]).attr("data-title") == "Bank Name" && ($(curInputs[i]).val() == "" || $(curInputs[i]).val() == "0")) {
3190            checkvalid = false;
3191            $(curInputs[i]).addClass("has-error");
3192            var message = "Please select " + $(curInputs[i]).attr("data-title");
3193            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
3194        }
3195        else if ($(curInputs[i]).attr("id").indexOf("phonenumber") > -1 && $(curInputs[i]).val().length < 10 && $(curInputs[i]).val() != "") {
3196            checkvalid = false;
3197            $(curInputs[i]).addClass("has-error");
3198            var message = "Please enter at least 10 or 11 digit phone number";
3199            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
3200        }
3201        else if ($(curInputs[i]).attr("id").indexOf("year") > -1 && $(curInputs[i]).val().length < 4 && $(curInputs[i]).val() != "") {
3202            checkvalid = false;
3203            $(curInputs[i]).addClass("has-error");
3204            var message = "Please enter at least 4 digit in year";
3205            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
3206        }
3207        else if ($(curInputs[i]).val() != "" && $(curInputs[i])[0].type == "text" && parseInt($(curInputs[i]).attr("data-minimumlength")) > $(curInputs[i]).val().length) {
3208            checkvalid = false;
3209            $(curInputs[i]).addClass("has-error");
3210            var message = "Minimum Length is " + $(curInputs[i]).attr("data-minimumlength").toString();
3211            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
3212        }
3213        else if ($(curInputs[i]).val() != "" && $(curInputs[i])[0].type == "email" && !isEmail($(curInputs[i]).val())) {
3214            checkvalid = false;
3215            $(curInputs[i]).addClass("has-error");
3216            var message = "Please enter valid email";
3217            $(curInputs[i]).parent().append('<div class="alert alert-danger">' + message + '</div>');
3218        }
3219        if (checkvalid == true && $(curInputs[i]).hasClass("bankdata")) {
3220            var KeyValuePair = "{" + "Id" + ":" + $(curInputs[i]).attr("data-cd") + "," + "Type" + ":" + $(curInputs[i]).attr("data-type") + "," + "FieldType" + ":" + $(curInputs[i]).attr("data-fieldtype") + "," + "TWType" + ":&#39;" + $(curInputs[i]).attr("data-twtype") + "&#39; ," + "RcId" + ":" + $(curInputs[i]).attr("data-rcid") + "," + "Answer" + ":&#39;" + $(curInputs[i]).val() + "&#39;" + "," + "UniqueId" + ":&#39;" + $(curInputs[i]).attr("data-uniqueid") + "&#39;}";
3221            dataArr.push(KeyValuePair);
3222        }
3223    }
3224    if (checkvalid == true) {
3225        $('.showloader').show();
3226        $.ajax({
3227            url: '/Personal.aspx/AR',
3228            type: "POST",
3229            dataType: "json",
3230            contentType: "application/json",
3231            data: "{'list':'" + JSON.stringify(dataArr) + "','type':'" + type + "','sourcesymbol':'" + sourcesymbol.trim() + "','destsymbol':'" + destsymbol.trim() + "','sdcountryid':'" + parseInt(sdcountryid) + "','Address':'" + address + "','State':'" + state + "','City':'" + city + "','ZipCode':'" + zipcode + "','CountryId':'" + parseInt(countryid) + "','Email':'" + email + "','Name':'" + name + "','LastName':'" + lastname + "','RecipientType':'" + parseInt(recipienttype) + "','StateCode':'" + statecode + "','DOB':'" + dob + "','Phone':'" + phone + "','BankCode':'" + bankcode + "','Relation':'" + relation + "','BusinessName':'" + bbusinessname + "','JointName':'" + jointname + "','JointLastName':'" + jointlastname + "','BranchAddress':'" + branchaddress + "','bankname':'" + bankname + "'}",
3232            success: function (result) {
3233                debugger;
3234                if (result.d != "") {
3235                    if (result.d.indexOf('Success') > -1) {
3236                        var splitstr = result.d.toString().split('!@!');
3237
3238                        var str = '<div class="col col-4" style="margin-top:10px;">';
3239                        str += '<div class="card grey-card">';
3240                        str += '<a href="#" class="tapcube" id="' + splitstr[3] + '" data-name="' + splitstr[1].toUpperCase() + '" data-uniqueId="' + splitstr[4] + '" data-twrecipientid="' + splitstr[5] + '">';
3241                        str += '<div class="card-body">';
3242                        str += '<i class="user outline icon"></i>';
3243                        str += '<span>';
3244                        str += '<h5 class="card-title">' + splitstr[1].toUpperCase() + '</h5>';
3245                        str += '<dd>';
3246                        str += '<i class="' + countrycodewithflag + '"></i>';
3247                        str += destsymbol + ' Account</dd>';
3248                        str += '<small>ending with XXXX' + splitstr[2] + '</small>';
3249                        str += '</span>';
3250                        str += '</div>';
3251                        str += '</a>';
3252                        str += '</div>';
3253                        str += '</div >';
3254
3255                        if (splitstr[7].toString() == "1") {
3256                            if (splitstr[6].toString() == "1") {
3257                                $(".reciptentlist").html(str);
3258                            }
3259                            else {
3260                                $(".reciptentlist").prepend(str);
3261                            }
3262                            $('.rlmyself').show();
3263                            $("#btnself").click();
3264                        }
3265                        else if (splitstr[7].toString() == "2") {
3266                            if (splitstr[6].toString() == "1") {
3267                                $(".reciptentlistsomeone").html(str);
3268                            }
3269                            else {
3270                                $(".reciptentlistsomeone").prepend(str);
3271                            }
3272                            $('.rlsomeone').show();
3273                            $("#btnsomeoneelse").click();
3274                        }
3275                        else if (splitstr[7].toString() == "3") {
3276                            if (splitstr[6].toString() == "1") {
3277                                $(".reciptentlistbusiness").html(str);
3278                            }
3279                            else {
3280                                $(".reciptentlistbusiness").prepend(str);
3281                            }
3282                            $('.rlbusiness').show();
3283                            $("#btnbusiness").click();
3284                        }
3285                        else if (splitstr[7].toString() == "5") {
3286                            if (splitstr[6].toString() == "1") {
3287                                $(".reciptentlistjoint").html(str);
3288                            }
3289                            else {
3290                                $(".reciptentlistjoint").prepend(str);
3291                            }
3292                            $('.rljoint').show();
3293                            $("#btnjointaccount").click();
3294                        }
3295                        $(".existingreciptent").show();
3296                        RefreshRecipient();
3297                        UploadVerify();
3298                        $(".close" + type).trigger('click');
3299                        $('.showloader').hide();
3300                        $('.addrecbtn').removeClass('disabled');
3301                    }
3302                    else {
3303                        AlertConfirm(result.d);
3304                        $('.showloader').hide();
3305                        $('.addrecbtn').removeClass('disabled');
3306                    }
3307                }
3308                else {
3309                    AlertConfirm("Error! Try Again Later");
3310                    $('.showloader').hide();
3311                    $('.addrecbtn').removeClass('disabled');
3312                }
3313                return false;
3314            },
3315            error: function (XMLHttpRequest, textStatus, errorThrown) {
3316                AlertConfirm(XMLHttpRequest.responseText);
3317                $('.showloader').hide();
3318                $('.addrecbtn').removeClass('disabled');
3319                return false;
3320            }
3321        });
3322    }
3323    else {
3324        $('.addrecbtn').removeClass('disabled');
3325    }
3326
3327    return false;
3328}
3329
3330function RefreshRecipient() {
3331    $("#txtmyselfholderstate").val('');
3332    $("#txtmyselfholdercity").val('');
3333    $("#txtmyselfholderzipcode").val('');
3334    $("#txtmyselfholderaddress").val('');
3335    $("#txtmyselfholderemail").val('');
3336    $("#txtaccountholder").val('');
3337
3338    $("#txtsomeoneholderstate").val('');
3339    $("#txtsomeoneholdercity").val('');
3340    $("#txtsomeoneholderzipcode").val('');
3341    $("#txtsomeoneholderaddress").val('');
3342    $("#txtsomeoneholderemail").val('');
3343    $("#txtsomeoneholdername").val('');
3344    $("#txtsomeoneholderlastname").val('');
3345    $("#txtsomeoneholderphonenumber").val('');
3346    $("#txtsomeonedate").val('');
3347    $("#txtsomeoneyear").val('');
3348
3349    $("#txtbusinessholderstate").val('');
3350    $("#txtbusinessholdercity").val('');
3351    $("#txtbusinessholderzipcode").val('');
3352    $("#txtbusinessholderaddress").val('');
3353    $("#txtbusinessholderemail").val('');
3354    $("#txtbusinessholdername").val('');
3355    $("#txtbusinessholderlastname").val('');
3356    $("#txtbusinessholderphonenumber").val('');
3357    $("#txtbbusinessname").val('');
3358    $("#txtbusinessdate").val('');
3359    $("#txtbusinessyear").val('');
3360
3361
3362    $("#txtjointaccountstate").val('');
3363    $("#txtjointaccountcity").val('');
3364    $("#txtjointaccountzipcode").val('');
3365    $("#txtjointaccountaddress").val('');
3366    $("#txtjointaccountemail").val('');
3367    $("#txtjointaccountname").val('');
3368    $("#txtjointaccountlastname").val('');
3369    $("#txtjjointaccountname").val('');
3370    $("#txtjjointaccountlastname").val('');
3371    $("#txtjointaccountphonenumber").val('');
3372    $("#txtjointaccountdate").val('');
3373    $("#txtjointaccountyear").val('');
3374}
3375
3376
3377function RD(flag, step) {
3378    var id = $("#hdnrid").val();
3379    var uniqueid = $("#hdnruniqueid").val();
3380    if (id != "") {
3381        var name = $("#hdnrecipientname").val();
3382        var bankname = $("#rec" + id).attr("title");
3383        $.ajax({
3384            url: '/Personal.aspx/RD',
3385            type: "POST",
3386            dataType: "json",
3387            contentType: "application/json",
3388            data: "{'Id':'" + parseInt(id) + "','uniqueid':'" + uniqueid + "'}",
3389            success: function (result) {
3390
3391                $(".reviwereciptentdetails").html("");
3392                if (result.d != "") {
3393                    if (bankname != "") {
3394                        var str = '<tr> <td>Bank Name </td><td class="text-right bankname">' + bankname + '</td></tr>';
3395                        $(".reviwereciptentdetails").append(str);
3396                    }
3397                    var json = $.parseJSON(result.d)
3398                    $.each(json, function (i, categories) {
3399                        var str = '<tr> <td>' + json[i].Title + ' </td><td class="text-right">' + json[i].Answer + '</td></tr>';
3400                        $(".reviwereciptentdetails").append(str);
3401                        flag = true;
3402                    });
3403                }
3404                else {
3405                    flag = false;
3406                }
3407                if (flag && step == "1") {
3408                    ajaxcomplete = true;
3409                    $("#smartwizard").smartWizard("next");
3410                }
3411                $('.showloader').hide();
3412            },
3413            error: function (XMLHttpRequest, textStatus, errorThrown) {
3414                AlertConfirm(XMLHttpRequest.responseText);
3415                $('.showloader').hide();
3416                return false;
3417            }
3418        });
3419    }
3420}
3421var popupopen = 0;
3422function kycpopupclose() {
3423
3424    popupopen = 0;
3425}
3426
3427function AddTransaction(ispoli) {
3428    
3429    $('.showloader').show();
3430    var fromsymbol = $("#currencyfrom").val().trim();
3431    var transferpurpose = $("#hdntransferreason").val();
3432    var explanation = $("#txtexplanation").val();
3433    var Proof = $("#hdnimage").val();
3434    var hdntrasactioncount = $("#hdntrasactioncount").val();
3435    var hdntransactiontotalamount = $("#hdntransactiontotalamount").val();
3436    var transferreference = $("#hdntransferreference").val();
3437    var tosymbol = $("#currencyto").val().trim();
3438    var amount = $("#amountfrom").val();
3439    /*   var bid = $("input[name='banktypes']:checked").attr("Id");*/
3440    var bid = 4;
3441    var fcid = $(".fromrecipient-box").find(".menu .item:contains(" + fromsymbol + ")").attr("data-id");
3442    var cid = $(".recipient-box").find(".menu .item:contains(" + tosymbol + ")").attr("data-id");
3443    var pid = $("#hdnpaymenttype").val();
3444    var bankrefnumber = $('.urefer').html();
3445    var recipientid = $("#hdnrid").val();
3446    var twrecipientid = $("#hdntwrid").val();
3447    var twquoteid = $("#hdnquoteid").val();
3448    var paymentid = $("#hdnpaymentid").val();
3449    var transactionid = $("#hdntransactionid").val();
3450    var transferto = $("#hdnrecipientname").val();
3451    var otherreason = $("#othertransferreason").val();
3452    var otherreference = $("#othertransferrefrence").val();
3453    var hdnextrakycrequired = $("#hdnextrakycrequired").val();
3454    var userjointfirstaname = $("#userjointfirstaname").val();
3455    var userjointlastaname = $("#userjointlastaname").val();
3456    var userjointrelation = $("#userjointrelation").val();
3457    var isjointaccount = "";
3458    if ($("#customRadio2").is(":checked")) {
3459        isjointaccount = "yes";
3460    }
3461    var CouponCode = $("#hfcouponcode").val();
3462
3463    var otp = $("#txtotp").val();
3464    if ((parseInt(hdntrasactioncount) >= 8 || parseInt(hdntransactiontotalamount) >= 40000) && hdnextrakycrequired != "2" && hdnextrakycrequired != "1") {
3465
3466        if (Proof == "" && explanation == "" && popupopen == 0) {
3467            $("#extrakycclick").trigger("click");
3468            $('.showloader').hide();
3469            popupopen = 1;
3470            return false;
3471        }
3472        else if (Proof == "" && explanation != "" && popupopen == 0) {
3473            $("#extrakycclick").trigger("click");
3474            $('.showloader').hide();
3475            popupopen = 1;
3476            return false;
3477        }
3478        else if (Proof != "" && explanation == "" && popupopen == 0) {
3479            $("#extrakycclick").trigger("click");
3480            $('.showloader').hide();
3481            popupopen = 1;
3482            return false;
3483        }
3484        else if (((hdnextrakycrequired == "0" || hdnextrakycrequired == "3") && Proof != "" && explanation != "" && popupopen == 0)
3484) {
3485            $("#extrakycclick").trigger("click");
3486            $('.showloader').hide();
3487            popupopen = 1;
3488            return false;
3489        }
3490        else if (Proof == "" && popupopen == 1) {
3491            AlertConfirmWithoutReload("Please Upload Proof");
3492            $('.showloader').hide();
3493            return false;
3494        }
3495        else if (explanation == "" && popupopen == 1) {
3496            AlertConfirmWithoutReload("Please enter explanation");
3497            $('.showloader').hide();
3498            return false;
3499        }
3500    }
3501    //if (otp == "") {
3502    //    AlertConfirmWithoutReload("Please Enter OTP");
3503    //    $('.showloader').hide();
3504    //    return false;
3505    //}
3506    if (recipientid == "" && typeof (recipientid) === "undefined") {
3507        AlertConfirmWithoutReload("Recipient Not Found");
3508        $('.showloader').hide();
3509        return false;
3510    }
3511    else if (transferto == "" && typeof (transferto) === "undefined") {
3512        AlertConfirmWithoutReload("Recipient Not Found");
3513        $('.showloader').hide();
3514        return false;
3515    }
3516    if (twrecipientid == "" && typeof (twrecipientid) === "undefined") {
3517        twrecipientid = 0;
3518    }
3519    if (twquoteid == "" && typeof (twquoteid) === "undefined") {
3520        twquoteid = 0;
3521    }
3522    if ((bid == "" || typeof (bid) === "undefined") && ispoli == 1) {
3523        bid = 0;
3524
3525    }
3526    else if (bid == "" || typeof (bid) === "undefined") {
3527        AlertConfirmWithoutReload("Please Select Bank");
3528        $('.showloader').hide();
3529        return false;
3530    }
3531    if (pid != "" && typeof (pid) !== "undefined") {
3532        $.ajax({
3533            url: "/Personal.aspx/AddTransaction",
3534            type: "POST",
3535            contentType: "application/json; charset=utf-8",
3536            dataType: "json",
3537            data: '{  "CurrencyId":"' + parseInt(cid) + '","FromCurrencyId":"' + parseInt(fcid) + '","BankId":"' + parseInt(bid) + '","ToSymbol":"' + tosymbol + '","FromSymbol":"' + fromsymbol + '","PaymentTypeId":"' + pid + '","Amount":"' + amount + '","BankRefNumber":"' + bankrefnumber + '","TransferTo":"' + transferto + '","RecipientId":"' + parseInt(recipientid) + '","TransferPurpose":"' + parseInt(transferpurpose) + '","TransferReference":"' + parseInt(transferreference) + '","TWRecipientId":"' + twrecipientid + '","TWQuoteId":"' + twquoteid + '","IsPoli":"' + parseInt(ispoli) + '","PaymentId":"' + paymentid + '","TransactionId":"' + transactionid + '","OtherReason":"' + otherreason + '","OtherReference":"' + otherreference + '","OTP":"' + otp + '","Explanation":"' + explanation + '","Proof":"' + Proof + '","IsJointAccount":"' + isjointaccount + '","JointAccountFirstName":"' + userjointfirstaname + '","JointAccountLastName":"' + userjointlastaname + '","JointRelation":"' + userjointrelation + '","CouponCode":"' + CouponCode + '"}',
3538            success: function (data) {
3539                if (data.d != "") {
3540                    var json = $.parseJSON(data.d);
3541                    console.log(json);
3542                    $.each(json, function (i, categories) {
3543                        if (json[0].Status == "Success") {
3544                            if (json[0].IsPoli == 0) {
3545                                //$("#hdnbankchecktype").val(1);                          
3546                                $('#hfTranId').val(json[0].TransactionId);
3547                                $('.summary5').removeClass('hide');
3548                                $('.summary4').addClass('hide');
3549                                $('.summary3').addClass('hide');
3550                                $(".fancydefault").addClass('hide');
3551                                $("#hdnpaymentcomplete").val(1);
3552                                $('.showloader').hide();
3553                                $("#extrakycmodalclose").trigger("click");
3554                                AlertConfirm("You have successfully generated the transaction. We will remit the transaction once we receive the payment.");
3555                                return false;
3556                            }
3557                            else {
3558                                $('.showloader').hide();
3559                                UpdateSignalTransaction(json[0].TransactionId);
3560                                $('#hfTranId').val(json[0].TransactionId);
3561                                window.location.href = json[0].NavigateUrl;
3562                            }
3563                        }
3564                        else {
3565                            $('.showloader').hide();
3566                            AlertConfirm(json[0].Message);
3567                            return false;
3568                        }
3569                    });
3570
3571                }
3572                else {
3573                    $('.showloader').hide();
3574                    AlertConfirm("Something Went Wrong Try Again Later");
3575                }
3576                return false;
3577            },
3578            error: function (XMLHttpRequest, textStatus, errorThrown) {
3579                $('.showloader').hide();
3580                AlertConfirm(XMLHttpRequest.responseText)
3581                return false;
3582            }
3583        });
3584    }
3585    else {
3586        $('.showloader').hide();
3587        AlertConfirmWithoutReload("Payment Type Not Found");
3588        return false;
3589    }
3590}
3591
3592function SendTransactionOTP() {
3593    var type = $("#otptype option:selected").val();
3594    if (type != "" && typeof (type) != "undefined") {
3595        $('.showloader').show();
3596        $.ajax({
3597            url: '/Personal.aspx/SendTransactionOTP',
3598            type: "POST",
3599            dataType: "json",
3600            contentType: "application/json",
3601            data: "{'Type':'" + type + "'}",
3602            success: function (result) {
3603                if (result.d != "") {
3604                    if (result.d.indexOf('Success') > -1) {
3605                        $('.showloader').hide();
3606                        if (type == 1) {
3607                            AlertConfirmWithoutReload("Otp Successfully Sent On Your Email");
3608                        }
3609                        else {
3610                            AlertConfirmWithoutReload("Otp Successfully Sent On Your Phone");
3611                        }
3612                    }
3613                    else {
3614                        AlertConfirmWithoutReload(result.d);
3615                    }
3616                }
3617                $('.showloader').hide();
3618            },
3619            error: function (XMLHttpRequest, textStatus, errorThrown) {
3620                $('.showloader').hide();
3621                AlertConfirmWithoutReload(XMLHttpRequest.responseText);
3622
3623                return false;
3624            }
3625        });
3626    }
3627}
3628
3629function AgentRecipt() {
3630   /* $('.showloader').show();*/
3631    var fromsymbol = $("#currencyfrom").val().trim();
3632    var transferpurpose = $("#ContentPlaceHolder1_drptransferpurpose").val();
3633    var sourceincome = $("#ContentPlaceHolder1_drpsourceincome").val();
3634    var saletype = $("#ContentPlaceHolder1_drpsaletype").val();
3635    var transfertype = $("#ContentPlaceHolder1_drpagenttransfertypes").val();
3636    var deliverytype = $("#ContentPlaceHolder1_drpdeliveryperiod").val();
3637    var tosymbol = $("#currencyto").val().trim();
3638    var amount = $("#amountfrom").val();
3639    var amountto = $("#amountto").val();
3640    var remarks = $("#remarks").val();
3641    var bid = $("#ContentPlaceHolder1_drpbankid").val();
3642    var fcid = $(".fromrecipient-box").find(".menu .item:contains(" + fromsymbol + ")").attr("data-id");
3643    var cid = $(".recipient-box").find(".menu .item:contains(" + tosymbol + ")").attr("data-id");
3644    var pid = $("#hdnpaymenttype").val();
3645    var bankrefnumber = $("#remitterbankref").val();
3646    var recipientid = $("#hdnremitterid").val();
3647    var remitterphone = $("#remittercontactnumber").val();
3648    var beneficiaryphone = $("#benphone").val();
3649    var benid = $("#hdnbenid").val();
3650    var transferfrom = $("#hdnrecipientname").val();
3651    var transferto = $("#benname").val();
3652    var transferreference = $("#ContentPlaceHolder1_drprefrence").val();
3653    var twrecipientid = $("#hdntwrid").val();
3654    var twquoteid = $("#hdnquoteid").val();
3655    var paymentid = $("#hdnpaymentid").val();
3656    var transactionid = $("#hdntransactionid").val();
3657    var otherreason = $("#othertransferreason").val();
3658    var otherreference = $("#othertransferrefrence").val();
3659    var converrate = $("#convertrate").val();
3660    var agentfee = $("#agentfee").val();
3661    var remitteraccountnumber = $("#remitteraccountnumber").val();
3662    var ispoli = 0;
3663    if (!$('.currency1').find('.alert-danger').hasClass('hide')) {
3664        //$('.showloader').hide();
3665        AlertConfirmWithoutReload("Please check transaction error");
3666        return false;
3667    }
3668    else if (!$('.currency2').find('.alert-danger').hasClass('hide')) {
3669        //$('.showloader').hide();
3670        AlertConfirmWithoutReload("Please check transaction error");
3671        return false;
3672    }
3673    else if ($('.sw-btn-next').hasClass('disabled')) {
3674        //$('.showloader').hide();
3675        AlertConfirmWithoutReload("Please check transaction error");
3676        return false;
3677    }
3678    if (transferreference == "0") {
3679        //$('.showloader').hide();
3680        AlertConfirmWithoutReload("Please Select referece");
3681        return false;
3682    }
3683    else if (transferpurpose == "0") {
3684        //$('.showloader').hide();
3685        AlertConfirmWithoutReload("Please Select transfer purpose");
3686        return false;
3687    }
3688    else if (transferpurpose == "5" && otherreason == "") {
3689        //$('.showloader').hide();
3690        AlertConfirmWithoutReload("Please Enter Purpose");
3691        return false;
3692    }
3693    else if (transferreference == "8" && otherreference == "") {
3694        //$('.showloader').hide();
3695        AlertConfirmWithoutReload("Please Enter Reference");
3696        return false;
3697    }
3698    else if (twrecipientid == "") {
3699        //$('.showloader').hide();
3700        AlertConfirmWithoutReload("Recipient Id Not Found");
3701        return false;
3702    }
3703    else if (paymentid == "") {
3704        //$('.showloader').hide();
3705        AlertConfirmWithoutReload("Payment Id Not Found");
3706        return false;
3707    }
3708    else if (bankrefnumber == "") {
3709        //$('.showloader').hide();
3710        AlertConfirmWithoutReload("Bank Reference Code Not Found");
3711        return false;
3712    }
3713    else if (recipientid == "") {
3714        //$('.showloader').hide();
3715        AlertConfirmWithoutReload("Remitter Id Not Found");
3716        return false;
3717    }
3718    else if (transferto == "") {
3719        //$('.showloader').hide();
3720        AlertConfirmWithoutReload("Beneficary Name Not Found");
3721        return false;
3722    }
3723    else if (transferfrom == "") {
3724        //$('.showloader').hide();
3725        AlertConfirmWithoutReload("Remitter Name Not Found");
3726        return false;
3727    }
3728    else if (agentfee == "") {
3729        //$('.showloader').hide();
3730        AlertConfirmWithoutReload("Please enter fee");
3731        return false;
3732    }
3733    else if (converrate == "") {
3734        //$('.showloader').hide();
3735        AlertConfirmWithoutReload("Please enter conversion rate");
3736        return false;
3737    }
3738    else if (parseFloat(converrate) <= 0) {
3739       // $('.showloader').hide();
3740        AlertConfirmWithoutReload("Please enter conversion rate gretaer than 0");
3741        return false;
3742    }
3743    else if (remarks == "") {
3744       // $('.showloader').hide();
3745        AlertConfirmWithoutReload("Please enter remarks");
3746        return false;
3747    }
3748    else if (remitteraccountnumber == "") {
3749       // $('.showloader').hide();
3750        AlertConfirmWithoutReload("This user bank account number is not genrated.Please contact with customer support");
3751        return false;
3752    }
3753    $(".txtsramount").html(amount + " " + fromsymbol);
3754    //$(".txtexactfee").html(+ json[0].exactfees + ' ' + from);
3755    //$(".txtourfee").html(+ json[0].ourexactfee + ' ' + from);
3756    $(".txtrfee").html("-" + agentfee + ' ' + fromsymbol);
3757    $(".txtrconvertamount").html($("#convertamount").val() + ' ' + fromsymbol);
3758    /*  $(".txtrguranteedrate").html("Conversion Rate (" + json[0].GuaranteedRate + " hrs)");*/
3759    $(".txtrguranteedrate").html("Conversion Rate");
3760    $(".txtrconvertrate").html(converrate);
3761    $(".txtrrciptentget").html(amountto + " " + tosymbol);
3762    $(".txtaccountname").html(transferto);
3763    $(".txtaccountnumber").html($("#benaccountnumber").val());
3764    $(".txtbankname").html($("#benbankname").val());
3765    $("#recieptmodal").modal("show");
3766    //$('.showloader').hide();
3767    return false;
3768}
3769
3770function AgentAddTransaction() {
3771    
3772    $('.showloader').show();
3773    var fromsymbol = $("#currencyfrom").val().trim();
3774    var transferpurpose = $("#ContentPlaceHolder1_drptransferpurpose").val();
3775    var sourceincome = $("#ContentPlaceHolder1_drpsourceincome").val();
3776    var saletype = $("#ContentPlaceHolder1_drpsaletype").val();
3777    var transfertype = $("#ContentPlaceHolder1_drpagenttransfertypes").val();
3778    var deliverytype = $("#ContentPlaceHolder1_drpdeliveryperiod").val();
3779    var tosymbol = $("#currencyto").val().trim();
3780    var amount = $("#amountfrom").val();
3781    var bid = $("#ContentPlaceHolder1_drpbankid").val();
3782    var fcid = $(".fromrecipient-box").find(".menu .item:contains(" + fromsymbol + ")").attr("data-id");
3783    var cid = $(".recipient-box").find(".menu .item:contains(" + tosymbol + ")").attr("data-id");
3784    var pid = $("#hdnpaymenttype").val();
3785    var bankrefnumber = $("#remitterbankref").val();
3786    var recipientid = $("#hdnremitterid").val();
3787    var remitterphone = $("#remittercontactnumber").val();
3788    var remarks = $("#remarks").val();
3789    var beneficiaryphone = $("#benphone").val();
3790    var benid = $("#hdnbenid").val();
3791    var transferfrom = $("#hdnrecipientname").val();
3792    var transferto = $("#benname").val();
3793    var transferreference = $("#ContentPlaceHolder1_drprefrence").val();
3794    var twrecipientid = $("#hdntwrid").val();
3795    var twquoteid = $("#hdnquoteid").val();
3796    var paymentid = $("#hdnpaymentid").val();
3797    var transactionid = $("#hdntransactionid").val();
3798    var otherreason = $("#othertransferreason").val();
3799    var otherreference = $("#othertransferrefrence").val();
3800    var converrate = $("#convertrate").val();
3801    var agentfee = $("#agentfee").val();
3802    var substaffmemberid = $("#hdnsubstaffmemberid").val();
3803    var substaffname = $("#hdnsubstaffname").val();
3804    var remitteraccountnumber = $("#remitteraccountnumber").val();
3805    var ispoli = 0;
3806    var CouponCode = $("#hfcouponcode").val();
3807    if (!$('.currency1').find('.alert-danger').hasClass('hide')) {
3808        AlertConfirmWithoutReload("Please check transaction error");
3809        $('.showloader').hide();
3810        return false;
3811    }
3812    else if (!$('.currency2').find('.alert-danger').hasClass('hide')) {
3813        AlertConfirmWithoutReload("Please check transaction error");
3814        $('.showloader').hide();
3815        return false;
3816    }
3817    else if ($('.sw-btn-next').hasClass('disabled')) {
3818        AlertConfirmWithoutReload("Please check transaction error");
3819        $('.showloader').hide();
3820        return false;
3821    }
3822    if (transferreference == "0") {
3823        AlertConfirmWithoutReload("Please Select referece");
3824        $('.showloader').hide();
3825        return false;
3826    }
3827    else if (transferpurpose == "0") {
3828        AlertConfirmWithoutReload("Please Select transfer purpose");
3829        $('.showloader').hide();
3830        return false;
3831    }
3832    else if (transferpurpose == "5" && otherreason == "") {
3833        AlertConfirmWithoutReload("Please Enter Purpose");
3834        $('.showloader').hide();
3835        return false;
3836    }
3837    else if (transferreference == "8" && otherreference == "") {
3838        AlertConfirmWithoutReload("Please Enter Reference");
3839        $('.showloader').hide();
3840        return false;
3841    }
3842    else if (twrecipientid == "") {
3843        AlertConfirmWithoutReload("Recipient Id Not Found");
3844        $('.showloader').hide();
3845        return false;
3846    }
3847
3848    else if (paymentid == "") {
3849        AlertConfirmWithoutReload("Payment Id Not Found");
3850        $('.showloader').hide();
3851        return false;
3852    }
3853    else if (bankrefnumber == "") {
3854        AlertConfirmWithoutReload("Bank Reference Code Not Found");
3855        $('.showloader').hide();
3856        return false;
3857    }
3858    else if (recipientid == "") {
3859        AlertConfirmWithoutReload("Remitter Id Not Found");
3860        $('.showloader').hide();
3861        return false;
3862    }
3863    else if (transferto == "") {
3864        AlertConfirmWithoutReload("Beneficary Name Not Found");
3865        $('.showloader').hide();
3866        return false;
3867    }
3868    else if (transferfrom == "") {
3869        AlertConfirmWithoutReload("Remitter Name Not Found");
3870        $('.showloader').hide();
3871        return false;
3872    }
3873    else if (agentfee == "") {
3874        AlertConfirmWithoutReload("Please enter fee");
3875        $('.showloader').hide();
3876        return false;
3877    }
3878    else if (converrate == "") {
3879        AlertConfirmWithoutReload("Please enter conversion rate");
3880        $('.showloader').hide();
3881        return false;
3882    }
3883    else if (parseFloat(converrate) <= 0) {
3884        AlertConfirmWithoutReload("Please enter conversion rate gretaer than 0");
3885        $('.showloader').hide();
3886        return false;
3887    }
3888    else if (remarks == "") {
3889        AlertConfirmWithoutReload("Please enter remarks");
3890        $('.showloader').hide();
3891        return false;
3892    }
3893    else if (remitteraccountnumber == "") {
3894        AlertConfirmWithoutReload("This user bank account number is not genrated.Please contact with customer support");
3895        $('.showloader').hide();
3896        return false;
3897    }
3898
3899    var FastPay = 0;
3900    if (tosymbol.trim() == 'NPR') {
3901        if ($("#hfIsFastPay").length > 0) {
3902            FastPay = $("#hfIsFastPay").val();
3903        } else {
3904            FastPay = 0;
3905        }
3906    }
3907    if (pid != "" && typeof (pid) !== "undefined") {
3908        $.ajax({
3909            url: "/Agent/AgentTransaction.aspx/AgentAddTransaction",
3910            type: "POST",
3911            contentType: "application/json; charset=utf-8",
3912            dataType: "json",
3913            data: '{  "CurrencyId":"' + parseInt(cid) + '","FromCurrencyId":"' + parseInt(fcid) + '","BankId":"' + parseInt(bid) + '","ToSymbol":"' + tosymbol + '","FromSymbol":"' + fromsymbol + '","PaymentTypeId":"' + pid + '","Amount":"' + amount + '","BankRefNumber":"' + bankrefnumber + '","TransferTo":"' + transferto + '","RecipientId":"' + parseInt(recipientid) + '","TransferPurpose":"' + parseInt(transferpurpose) + '","TransferReference":"' + parseInt(transferreference) + '","AgentTransferType":"' + parseInt(transfertype) + '","SourceIncome":"' + parseInt(sourceincome) + '","SaleType":"' + parseInt(saletype) + '","DeliveryType":"' + parseInt(deliverytype) + '","RemitterPhone":"' + remitterphone + '","BeneficiaryPhone":"' + beneficiaryphone + '","TransferFrom":"' + transferfrom + '","BeneficiaryId":"' + parseInt(benid) + '","TWRecipientId":"' + twrecipientid + '","TWQuoteId":"' + twquoteid + '","IsPoli":"' + parseInt(ispoli) + '","PaymentId":"' + paymentid + '","TransactionId":"' + transactionid + '","OtherReason":"' + otherreason + '","OtherReference":"' + otherreference + '","Remarks":"' + remarks + '","substaffmemberid":"' + parseInt(substaffmemberid) + '","substaffname":"' + substaffname + '","CouponCode":"' + CouponCode + '","IsFastPay":"' + parseInt(FastPay) + '"}',
3914            success: function (data) {
3915                if (data.d != "") {
3916                    var json = $.parseJSON(data.d);
3917                    $('.showloader').hide();
3918                    $('#closerecieptmodal').click();
3919                    $.each(json, function (i, categories) {
3920                        if (json[0].Status == "Success") {
3921                           
3922                            AlertConfirmWithUrl("You have successfully generated the transaction. We will remit the transaction once we receive the payment.", '/Agent/AgentTransaction.aspx');
3923
3924                        }
3925                        else {
3926                            $('.showloader').hide();
3927                            AlertConfirmWithoutReload(json[0].Message);
3928                            return false;
3929                        }
3930                    });
3931
3932                }
3933                else {
3934                    $('.showloader').hide();
3935                    AlertConfirmWithoutReload("Something Went Wrong Try Again Later");
3936                }
3937                return false;
3938            },
3939            error: function (XMLHttpRequest, textStatus, errorThrown) {
3940                $('.showloader').hide();
3941                AlertConfirmWithoutReload(XMLHttpRequest.responseText)
3942                return false;
3943            }
3944
3945        });
3946    }
3947    return false;
3948
3949}
3950
3951function AgentUR(search, type) {
3952    if (search != "") {
3953        $('.showloader').show();
3954        $("." + type).html('');
3955        $.ajax({
3956            url: '/Agent/AgentTransaction.aspx/UR',
3957            type: "POST",
3958            dataType: "json",
3959            contentType: "application/json",
3960            data: "{'search':'" + search + "','Id':'" + parseInt(0) + "'}",
3961            success: function (result) {
3962                if (result.d != "") {
3963                    if (result.d.indexOf('Success') > -1) {
3964                        var json = $.parseJSON(result.d);
3965                        if (json != "") {
3966                            $.each(json, function (i, categories) {
3967                                if (json[i].ExpiryDate != '') {
3968                                    var ExDate = json[i].ExpiryDate;
3969                                    var str2 = "-";
3970                                    if (ExDate.indexOf(str2) != -1) {
3971                                        var dateString = ExDate;
3972                                        var dateComponents = dateString.split("-");
3973                                        var monthNames = ["January", "February", "March", "April", "May", "June",
3974                                            "July", "August", "September", "October", "
3974November", "December"
3975                                        ];
3976                                        var monthIndex = parseInt(dateComponents[1]) - 1;
3977                                        var monthName = monthNames[monthIndex];
3978                                        ExDate = dateComponents[0] + " " + monthName + ", " + dateComponents[2];
3979                                    }
3980                                    var Date1st = new Date(ExDate);
3981                                    var CurrentDate = new Date(Date());
3982                                    if (Date1st < CurrentDate || json[i].IsKYCApproved == '8') {
3983                                        var str = '<li onclick="return UpdateRemitterId(' + "&apos;" + json[i].FirstName + " " + json[i].LastName + "&apos;" + ',' + "&apos;" + json[i].MemberId + "&apos;" + ',' + "&apos;" + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + "&apos;" + ',' + "&apos;" + type + "&apos;" + ',' + "&apos;" + json[i].MAccountNumber + "&apos;" + ',' + "&apos;" + json[i].MBsbCode + "&apos;" + ',' + "&apos;" + json[i].UniqueId + "&apos;" + ')">' + json[i].MemberId + ' - ' + json[i].FirstName.toUpperCase() + " " + json[i].LastName.toUpperCase() + ' - Phone: ' + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + ' - Email: ' + json[i].Email + '   <span class="badge badge-danger">ID Expired</span></li>';
3984                                    }
3985                                    else {
3986                                        var str = '<li onclick="return UpdateRemitterId(' + "&apos;" + json[i].FirstName + " " + json[i].LastName + "&apos;" + ',' + "&apos;" + json[i].MemberId + "&apos;" + ',' + "&apos;" + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + "&apos;" + ',' + "&apos;" + type + "&apos;" + ',' + "&apos;" + json[i].MAccountNumber + "&apos;" + ',' + "&apos;" + json[i].MBsbCode + "&apos;" + ',' + "&apos;" + json[i].UniqueId + "&apos;" + ')">' + json[i].MemberId + ' - ' + json[i].FirstName.toUpperCase() + " " + json[i].LastName.toUpperCase() + ' - Phone: ' + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + ' - Email: ' + json[i].Email + '</li>';
3987                                    }
3988                                }
3989                                else {
3990                                    if (json[i].IsKYCApproved == '8') {
3991                                        var str = '<li onclick="return UpdateRemitterId(' + "&apos;" + json[i].FirstName + " " + json[i].LastName + "&apos;" + ',' + "&apos;" + json[i].MemberId + "&apos;" + ',' + "&apos;" + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + "&apos;" + ',' + "&apos;" + type + "&apos;" + ',' + "&apos;" + json[i].MAccountNumber + "&apos;" + ',' + "&apos;" + json[i].MBsbCode + "&apos;" + ',' + "&apos;" + json[i].UniqueId + "&apos;" + ')">' + json[i].MemberId + ' - ' + json[i].FirstName.toUpperCase() + " " + json[i].LastName.toUpperCase() + ' - Phone: ' + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + ' - Email: ' + json[i].Email + '   <span class="badge badge-danger">ID Expired</span></li>';
3992                                    }
3993                                    else {
3994                                        var str = '<li onclick="return UpdateRemitterId(' + "&apos;" + json[i].FirstName + " " + json[i].LastName + "&apos;" + ',' + "&apos;" + json[i].MemberId + "&apos;" + ',' + "&apos;" + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + "&apos;" + ',' + "&apos;" + type + "&apos;" + ',' + "&apos;" + json[i].MAccountNumber + "&apos;" + ',' + "&apos;" + json[i].MBsbCode + "&apos;" + ',' + "&apos;" + json[i].UniqueId + "&apos;" + ')">' + json[i].MemberId + ' - ' + json[i].FirstName.toUpperCase() + " " + json[i].LastName.toUpperCase() + ' - Phone: ' + json[i].PhoneExtension.replace("+", "") + json[i].ContactNumber + ' - Email: ' + json[i].Email + '</li>';
3995                                    }
3996                                }
3997
3998                                $("." + type).append(str);
3999                            });
4000                            $("ul." + type).addClass("intro");
4001                            $('.showloader').hide();
4002                        }
4003                        else {
4004                            var str = '<li>Error! Try Again Later</li>';
4005                            $("." + type).append(str);
4006                            $("ul." + type).addClass("intro");
4007                            $('.showloader').hide();
4008
4009                        }
4010                    }
4011                    else {
4012                        var str = '<li>
4012Data Not Found</li>';
4013                        $("." + type).append(str);
4014                        $("ul." + type).addClass("intro");
4015                        $('.showloader').hide();
4016                    }
4017                }
4018                else {
4019                    var str = '<li>Error! Try Again Later</li>';
4020                    $("." + type).append(str);
4021                    $("ul." + type).addClass("intro");
4022                    $('.showloader').hide();
4023
4024                }
4025            },
4026            error: function (XMLHttpRequest, textStatus, errorThrown) {
4027                AlertConfirm(XMLHttpRequest.responseText);
4028                $('.showloader').hide();
4029                return false;
4030            }
4031        });
4032    }
4033    else {
4034        var str = '<li>Please enter contact number or name for find.</li>';
4035        $("." + type).append(str);
4036        $("ul." + type).addClass("intro");
4037        $('.showloader').hide();
4038    }
4039    return false;
4040}
4041
4042function GetRecipientList(memberid, id) {
4043    if (memberid != "") {
4044        $('.showloader').show();
4045        $("#drprecipientlist").html('');
4046        $.ajax({
4047            url: '/Personal.aspx/GetRecipientList',
4048            type: "POST",
4049            dataType: "json",
4050            contentType: "application/json",
4051            data: "{'MemberId':'" + parseInt(memberid) + "'}",
4052            success: function (result) {
4053                if (result.d != "") {
4054                    if (result.d.indexOf('Success') > -1) {
4055                        var json = $.parseJSON(result.d);
4056                        if (json != "") {
4057                            var str = '<option value="0">Select Beneficary</option>';
4058                            $.each(json, function (i, categories) {
4059                                str += '<option value="' + json[i].Id + '">' + json[i].ReciptentName + ' ' + json[i].ReciptentLastName + '(' + (json[i].ReciptentOthers != "" ? json[i].ReciptentOthers : "Remit Pin") + ')</option>';
4060                            });
4061                            $("#drprecipientlist").append(str);
4062
4063                            $("#drprecipientlist").change(function () {
4064                                var id = this.value;
4065                                var name = $("#drprecipientlist option:selected").text();
4066                                UpdateRemitterId(name, id);
4067                            });
4068
4069                            if (id != 0) {
4070                                $("#drprecipientlist").val(id);
4071                                $("#drprecipientlist").trigger("change");
4072                            }
4073                        }
4074                        else {
4075                            //AlertConfirmWithoutReload("Recipient Not Found");
4076                        }
4077                    }
4078                    else {
4079                        //AlertConfirmWithoutReload("Recipient Not Found");
4080                    }
4081                }
4082                else {
4083                    //AlertConfirmWithoutReload("Recipient Not Found");
4084                }
4085                $('.showloader').hide();
4086                return false;
4087            },
4088            error: function (XMLHttpRequest, textStatus, errorThrown) {
4089                AlertConfirmWithoutReload(XMLHttpRequest.responseText);
4090                $('.showloader').hide();
4091                return false;
4092            }
4093        });
4094    }
4095}
4096
4097function AgentGR(search, type) {
4098    var id = $("#hdnremitterid").val();
4099    if (id == "") {
4100        AlertConfirmWithoutReload("Please Select Remitter First");
4101        return false;
4102    }
4103    if (search != "" && id != "") {
4104        $('.showloader').show();
4105        $("." + type).html('');
4106        $.ajax({
4107            url: '/Agent/AgentTransaction.aspx/GR',
4108            type: "POST",
4109            dataType: "json",
4110            contentType: "application/json",
4111            data: "{'search':'" + search + "','MemberId':'" + parseInt(id) + "','Id':'" + parseInt(0) + "'}",
4112            success: function (result) {
4113                if (result.d != "") {
4114                    if (result.d.indexOf('Success') > -1) {
4115                        var json = $.parseJSON(result.d);
4116                        if (json != "") {
4117                            $.each(json, function (i, categories) {
4118                                var str = '<li onclick="return UpdateRemitterId(' + "&apos;" + json[i].ReciptentName + " " + json[i].ReciptentLastName + "&apos;" + ',' + "&apos;" + json[i].Id + "&apos;" + ',' + "&apos;" + json[i].ReciptentContactNumber + "&apos;" + ',' + "&apos;" + type + "&apos;" + ')">' + json[i].Id + ' - ' + json[i].ReciptentName.toUpperCase() + " " + json[i].ReciptentLastName.toUpperCase() + ' - Phone: ' + json[i].ReciptentContactNumber + '</li>';
4119                                $("." + type).append(str);
4120                            });
4121                            $("ul." + type).addClass("intro");
4122                            $('.showloader').hide();
4123                        }
4124                        else {
4125                            var str = '<li>Error! Try Again Later</li>';
4126                            $("." + type).append(str);
4127                            $("ul." + type).addClass("intro");
4128                            $('.showloader').hide();
4129
4130                        }
4131                    }
4132                    else {
4133                        var str = '<li>Data Not Found</li>';
4134                        $("." + type).append(str);
4135                        $("ul." + type).addClass("intro");
4136                        $('.showloader').hide();
4137                    }
4138                }
4139                else {
4140                    var str = '<li>Error! Try Again Later</li>';
4141                    $("." + type).append(str);
4142                    $("ul." + type).addClass("intro");
4143                    $('.showloader').hide();
4144
4145                }
4146            },
4147            error: function (XMLHttpRequest, textStatus, errorThrown) {
4148                AlertConfirm(XMLHttpRequest.responseText);
4149                $('.showloader').hide();
4150                return false;
4151            }
4152        });
4153    }
4154    else {
4155        var str = '<li>Please enter contact number or name for find.</li>';
4156        $("." + type).append(str);
4157        $("ul." + type).addClass("intro");
4158        $('.showloader').hide();
4159    }
4160    return false;
4161}
4162
4163function UpdateRemitterId(name, id, phone, type, accountnumber, bsbcode, uniqueid) {
4164    var search = "";
4165    $("." + type).html('');
4166    $("ul." + type).removeClass("intro");
4167    if (type == "remitter") {
4168        $("#remittersearch").val(name);
4169        $("#hdnrecipientname").val(name);
4170        $("#remitteraccountname").val(name);
4171        $("#raccountname").html(name);
4172        $("#raccountnumber").html(accountnumber);
4173        $("#rbsbcode").html(bsbcode);
4174        $("#rpaymentdescription").html(uniqueid);
4175        $("#remittereditid").attr("href", "/Agent/AddUserByAgent.aspx?sid=" + id);
4176        $("#remittercontactnumber").val(phone);
4177        $("#remitteraccountnumber").val(accountnumber);
4178        $("#remitterbsbcode").val(bsbcode);
4179        $("#hdnremitterid").val(id);
4180        $("#remitterbankref").val(uniqueid);
4181        //$("#beneficaryaddid").attr("href", "/Agent/AddRemitter.aspx?rid=" + id);
4182        IsUserEligible(id);
4183    }
4184    else {
4185        var memberid = $("#hdnremitterid").val();
4186        $.ajax({
4187            url: '/Agent/AgentTransaction.aspx/GR',
4188            type: "POST",
4189            dataType: "json",
4190            contentType: "application/json",
4191            data: "{'search':'" + search + "','MemberId':'" + parseInt(memberid) + "','Id':'" + parseInt(id) + "'}",
4192            success: function (result) {
4193                if (result.d != "") {
4194                    if (result.d.indexOf('Success') > -1) {
4195                        var json = $.parseJSON(result.d);
4196                        if (json != "") {
4197                            $.each(json, function (i, categories) {
4198                                if (json[i].ReciptentAccountNumber != "") {
4199                                    $("#ContentPlaceHolder1_drpagenttransfertypes").val(1);
4200                                    $("#ContentPlaceHolder1_drpagenttransfertypes").trigger('change');
4201                                }
4202                                else {
4203                                    $("#ContentPlaceHolder1_drpagenttransfertypes").val(2);
4204                                    $("#ContentPlaceHolder1_drpagenttransfertypes").trigger('change');
4205                                }
4206
4207                                $("#bensearch").val(json[i].ReciptentName + " " + json[i].ReciptentLastName);
4208                                $("#benname").val(json[i].ReciptentName + " " + json[i].ReciptentLastName);
4209                                $("#benstate").val(json[i].State);
4210                                $("#benphone").val(json[i].ReciptentContactNumber.replace("+", ""));
4211                                $("#bencity").val(json[i].City);
4212                                $("#benaddress").val(json[i].Address);
4213                                $("#benbranchaddress").val(json[i].BranchAddress);
4214                                $("#benbankname").val(json[i].ReciptentOthers);
4215                                $("#benaccountnumber").val(json[i].ReciptentAccountNumber);
4216                                $("#benpostalcode").val(json[i].ZipCode);
4217                                $("#bencontactnumber").val(json[i].ReciptentContactNumber.replace("+", ""));
4218                                $("#benemail").val(json[i].ReciptentEmail);
4219                                $("#hdnbenid").val(id);
4220                                $("#hdntwrid").val(json[i].TWRecipientId);
4221                                $("#beneficaryeditid").attr("href", "/Agent/AddRemitter.aspx?sid=" + id + "&rid=" + memberid);
4222
4223                            });
4224                            CC(null, 'both', 0, 0);
4225                        }
4226                        else {
4227                            AlertConfirmWithoutReload("Something Wrong Please Try Again Later");
4228                        }
4229                    }
4230                    else {
4231                        AlertConfirmWithoutReload(result.d);
4232                    }
4233                }
4234                else {
4235
4236                    AlertConfirmWithoutReload("Data Not Found");
4237                }
4238            },
4239            error: function (XMLHttpRequest, textStatus, errorThrown) {
4240                AlertConfirmWithoutReload(XMLHttpRequest.responseText);
4241                $('.showloader').hide();
4242                return false;
4243            }
4244        });
4245    }
4246
4247}
4248
4249function BeneficiaryClear() {
4250    $("#bensearch").val('');
4251    $("#benname").val('');
4252    $("#benstate").val('');
4253    $("#benphone").val('');
4254    $("#bencity").val('');
4255    $("#benaddress").val('');
4256    $("#benpostalcode").val('');
4257    $("#bencontactnumber").val('');
4258    $("#benemail").val('');
4259    $("#hdnbenid").val('');
4260    $("#benbranchaddress").val('');
4261    $("#drprecipientlist").val(0);
4262    $("#benbankname").val('');
4263    $("#benaccountnumber").val('');
4264    $("#beneficaryeditid").attr("href", "#");
4265    return false;
4266}
4267
4268function RemitterClear() {
4269    $("#remittersearch").val('');
4270    $("#raccountname").html('');
4271    $("#raccountnumber").html('');
4272    $("#rbsbcode").html('');
4273    $("#rpaymentdescription").html('');
4274    $("#remitteraccountnumber").val('');
4275    $("#remittercontactnumber").val('');
4276    $("#remitterbsbcode").val('');
4277    $("#remitterbankref").val('');
4278    $("#hdnremitterid").val('');
4279    $("#remittereditid").attr("href", "#");
4280    //$("#beneficaryaddid").attr("href", "#");
4281    return false;
4282}
4283
4284
4285function StripePay() {
4286
4287    var clientSecret = $("#hdnstripesecret").val();
4288    if (clientSecret != "") {
4289        stripe.confirmCardPayment(clientSecret, {
4290            payment_method: {
4291                card: card,
4292                billing_details: {
4293                    name: 'Jenny Rosen'
4294                }
4295            }
4296        }).then(function (result) {
4297            if (result.error) {
4298                // Show error to your customer (e.g., insufficient funds)
4299                console.log(result.error.message);
4300            } else {
4301                // The payment has been processed!
4302                if (result.paymentIntent.status === 'succeeded') {
4303                    // Show a success message to your customer
4304                    // There's a risk of the customer closing the window before callback
4305                    // execution. Set up a webhook or plugin to listen for the
4306                    // payment_intent.succeeded event that handles any business critical
4307                    // post-payment actions.
4308                }
4309            }
4310        });
4311    }
4312    return false;
4313}
4314
4315function AlertConfirm(Title) {
4316
4317    var $dialog = $('<div></div>')
4318        .html(Title)
4319        .dialog({
4320            resizable: true,
4321            title: $("#hdnWebsiteName").val(),
4322            modal: true,
4323            buttons: {
4324                "OK": function () {
4325                    //some stuff
4326                    $(this).dialog("close");
4327                    if (Title == "Session Expired") {
4328                        window.location.href = "/login";
4329                    }
4330                    return false;
4331                }
4332            }
4333        });
4334
4335    $dialog.dialog('open');
4336}
4337
4338function AlertConfirmWithUrl(Title, Url) {
4339
4340    var $dialog = $('<div></div>')
4341        .html(Title)
4342        .dialog({
4343            resizable: true,
4344            title: $("#hdnWebsiteName").val(),
4345            modal: true,
4346            buttons: {
4347                "OK": function () {
4348                    //some stuff
4349                    $(this).dialog("close");
4350                    if (Title == "Session Expired") {
4351                        window.location.href = "/login";
4352                    }
4353                    else {
4354                        window.location.href = Url;
4355                    }
4356                    return false;
4357                }
4358            }
4359        });
4360
4361    $dialog.dialog('open');
4362}
4363
4364function AlertConfirmWithoutReload(Title) {
4365
4366    var $dialog = $('<div></div>')
4367        .html(Title)
4368        .dialog({
4369            resizable: true,
4370            title: $("#hdnWebsiteName").val(),
4371            modal: true,
4372            buttons: {
4373                "OK": function () {
4374                    //some stuff
4375                    $(this).dialog("close");
4376                    if (Title == "Session Expired") {
4377                        window.location.href = "/login";
4378                    }
4379                    return false;
4380                }
4381            }
4382        });
4383
4384    $dialog.dialog('open');
4385}
4386
4387function CopyText(id) {
4388
4389    var text = document.getElementById(id).innerText;
4390    var elem = document.createElement("textarea");
4391    document.body.appendChild(elem);
4392    if (id != "accountdetails") {
4393        elem.value = id + ":" + text;
4394    }
4395    else {
4396        elem.value = text;
4397    }
4398    elem.select();
4399    document.execCommand("copy");
4400    document.body.removeChild(elem);
4401
4402    /* Alert the copied text */
4403    AlertConfirmWithoutReload("Copied the text: " + elem.value);
4404    return false;
4405}
4406function IsUserEligible(MemberId) {
4407    $('#dvLoader').show();
4408    setTimeout(
4409        function () {
4410            if (MemberId != '') {
4411                $.ajax({
4412                    url: "/Agent/AgentTransaction.aspx/IsUserEligible",
4413                    type: "POST",
4414                    contentType: "application/json; charset=utf-8",
4415                    dataType: "json",
4416                    data: '{  "MemberId":"' + MemberId + '"}',
4417                    success: function (data) {
4418                        if (data.d != '') {
4419                            $('#dvLoader').hide();
4420                            AlertConfirmWithoutReload(data.d);
4421                            return false;
4422                        }
4423                        else {
4424                            GetRecipientList(MemberId, 0);
4425                            $('#dvLoader').hide();
4426                            return false;
4427                        }
4428                    },
4429                    error: function (XMLHttpRequest, textStatus, errorThrown) {
4430                        ViewMessage(XMLHttpRequest.responseText, "warning");
4431                        $('#dvLoader').hide();
4432                        return false;
4433                    }
4434                });
4435            }
4436        }, 20);
4437    return false;
4438}
4439
4440
4441function GetUserCoupons() {
4442    $('#divCouponsList').html('');
4443    $(".showloader").show();
4444    $.ajax({
4445        url: '/Personal.aspx/GetUserCoupons',
4446        type: "POST",
4447        dataType: "json",
4448        contentType: "application/json",
4449        success: function (result) {
4450
4451            $('#divCouponsList').html('No Coupons Available');
4452            if (result.d != "") {
4453                if (result.d.indexOf('Success') > -1) {
4454                    var json = $.parseJSON(result.d);
4455
4456                    if (json != "") {
4457                        $('#divCouponsList').html('');
4458                        var days = '';
4459                        var expiringdateText = '';
4460                        var str = '';
4461                        $.each(json, function (i, categories) {
4462
4463                            expiringdateText = json[i].ExpiryDate;
4464
4465                            str += '<div class="coupon-box">'
4466                            str += '    <div class="icon-coupon">'
4467                            if (json[i].CouponType == '1') {
4468                                str += '<img src="/assets/images/Personal/coupon-icon.svg"/>'
4469                            }
4470                            else if (json[i].CouponType == '2') {
4471                                str += '<img src="/assets/images/Personal/exchange.svg"/>'
4472                            }
4473                            else {
4474                                str += '<img src="/assets/images/Personal/exchange3.svg"/>'
4475                            }
4476                            str += '    </div>'
4477                            str += '    <div class="coupon-body">'
4478                            str += '        <h4>' + json[i].Title + '</h4>'
4479                            str += '        <p class="use-code"><span>Use code :</span> ' + json[i].CouponCode + '</p>'
4480                            str += '        <p class="coupondiscounttype">Discount applicable on ' + (json[i].CouponAmountType.toString() == '1' ? 'From' : 'To') + ' Amount</p>';
4481                            str += '        <div class="coupon-content" id="' + json[i].Id + 'content">'
4482                            str += '            <p>' + json[i].Description + '</p>'
4483                            str += '        </div>'
4484                            str += '            <div class="full-content-coupon" id="' + json[i].Id + 'full-content">'
4485                            str += '                <p>' + json[i].Description + '</p>'
4486                            if (json[i].Image != '') {
4487                                str += '<a href="#" data-toggle="modal" data-target="#ImageModal" onclick="ShowCouponImage(&apos;' + json[i].Image + '&apos;)"><img src=Admin/Images/CouponImage/' + json[i].Image + ' /></a>'
4488                            }
4489                            if (json[i].AmountLimitType == '1') {
4490                                str += '<span class="amount-text d-block">This Coupon is Applicable between Amount ' + json[i].MinimumLimit + ' AUD and ' + json[i].AmountLimit + ' AUD. </span>'
4491                            }
4492                            str += '            </div>'
4493                            str += '         <div class="expiry-div">'
4494                            str += '            <p><img src="/assets/images/Personal/clock.svg"/>' + " " + expiringdateText + '</p>'
4495                            str += '         </div> '
4496                            str += '    </div>'
4497                            str += '      <div class="coupon-btn-col">'
4498                            str += '        <button type="button" class="apply-btn" id="applyOne" onclick="ApplyCoupon(&apos;' + json[i].CouponCode + '&apos;)"  data-dismiss="modal">Apply <img src="/assets/images/Personal/arrow-right.svg"/></button>'
4499                            str += '        <div class="view-details-coupon">'
4500                            str += '           <a href="#" id="' + json[i].Id + 'viewMore" onclick="ReadMore(&apos;' + json[i].Id + '&apos;)">Read more</a>'
4501                            str += '        </div>'
4502                            str += '    </div>'
4503                            str += '</div>'
4504
4505                        });
4506                        $(".showloader").hide();
4507                        $('#divCouponsList').html(str);
4508                        return false;
4509                    }
4510
4511                }
4512            }
4513
4514            $(".showloader").hide();
4515            return false;
4516
4517
4518        },
4519        error: function (XMLHttpRequest, textStatus, errorThrown) {
4520            $(".showloader").hide();
4521            AlertConfirm(XMLHttpRequest.responseText);
4522            return false;
4523        }
4524    });
4525}
4526
4527function ShowCouponImage(path) {
4528    $("#CouponFullImage").attr('src', '/Admin/Images/CouponImage/' + path);
4529    $(body).addClass("modal-full-overlay");
4530} 
4531$(".close").click(function () {
4532    $(body).removeClass("modal-full-overlay");
4533});
4534function CountExpiringDays(date) {
4535    try {
4536        var dateMilliseconds = parseInt(date.match(/\d+/)[0], 10);
4537        var datevalue = new Date(dateMilliseconds);
4538        var expirationDateStr = datevalue;
4539
4540        // Convert the expiration date string to a Date object
4541        var expirationDate = new Date(expirationDateStr);
4542
4543        // Get the current date
4544        var currentDate = new Date();
4545
4546        // Calculate the difference in milliseconds
4547        var timeDiff = expirationDate.getTime() - currentDate.getTime();
4548        if (timeDiff < 0) {
4549
4550            return "expired";
4551
4552        }
4553      
4554        else {
4555            return new Date(expirationDate).toLocaleString('en-US', { day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: true });
4556        }
4557        // Calculate the difference in days
4558    } catch (e) {
4559
4560    }
4561}
4562function ApplyCoupon(CouponCode) {
4563    var Amount = parseFloat($('#hfsend').val());
4564    $("#hfcouponcode").val('');
4565    $.ajax({
4566        url: '/Personal.aspx/ApplyCoupon',
4567        type: "POST",
4568        dataType: "json",
4569        contentType: "application/json",
4570        data: "{'CouponCode':'" + CouponCode + "','Amount':'" + Amount.toString() + "'}",
4571
4572        success: function (result) {
4573            debugger;
4574            if (result.d != "") {
4575                var json = $.parseJSON(result.d);
4576                if (json != "") {
4577                    $('#appliedMessage').html('Coupon Applied')
4578                    $(".coupon-col").hide();
4579                    $(".coupon-col-applied").show();
4580                    if (json.ErrorMsg != "") {
4581                        $('#appliedMessage').html(json.ErrorMsg)
4582                        $(".coupon-col").show();
4583                        $(".coupon-col-applied").hide();
4584                        $("#couponValid").hide();
4585                        $("#couponInValid").show();
4586                        $("#appliedMessage").addClass("mb0");
4587                        $("#hfcouponcode").val('');
4588                    }
4589                    else {
4590                        $("#hfcouponcode").val(CouponCode);
4591                        $("#couponValid").show();
4592                        $("#couponInValid").hide();
4593                        $("#appliedMessage").removeClass("mb0");
4594
4595                        $("#appliedCouponTitle").text(json.Title + ' Applied.');
4596
4597                        var currencyfrom = $("#currencyfrom").val().trim();
4598                        var currencyto = $("#currencyto").val().trim();
4599                        var convertAmout = parseFloat($('#hfConvertAmount').val());
4600                        var conversionRate = parseFloat($('#hfTxtrConvertRate').val());
4601                        var sendAmount = parseFloat($('#hfsend').val());
4602                        var CouponAmountType = json.CouponAmountType;
4603
4604                        if (json.CouponType == "1") {
4605                            var ServiceCharge = parseFloat($('#hfTxtrFee').val())
4606                            var ConvertRate = parseFloat($('#hfTxtrConvertRate').val()) + parseFloat(json.DiscountRate);
4607                            $(".txtrconvertrate").html('<span style="text-decoration-line: line-through;">' + $('#hfTxtrConvertRate').val() + '</span> ' + ConvertRate);
4608                            conversionRate = ConvertRate;
4609                        }
4610                        //else if (json.CouponType == "2" && json.CouponCategory == "4") {
4611                        //    var ServiceCharge = 0;
4612                        //    convertAmout = sendAmount - ServiceCharge;
4613                        //    if (ServiceCharge <= 0) {
4614                        //        ServiceCharge = 0;
4615                        //        convertAmout = sendAmount;
4616                        //    }
4617                        //    if (CouponAmountType == "2") {
4618                        //        $(".txtrfee").html('- <span style="text-decoration-line: line-through;">' + $('#hfTxtrFee').val() + '</span> ' + ServiceCharge + ' ' + currencyfrom);
4619                        //        $(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $('#hfConvertAmount').val() + '</span> ' + convertAmout + ' ' + currencyfrom);
4620                        //    }
4621                        //    else {
4622                        //        $(".txtrfee").html('- <span style="text-decoration-line: line-through;">' + $('#hfTxtrFee').val() + '</span> ' + ServiceCharge + ' ' + currencyfrom);
4623                        //    }
4624                        //}
4625                        else if (json.CouponType == "2") {
4626                            var ServiceCharge = parseFloat($('#hfTxtrFee').val()) - parseFloat(json.DiscountServiceCharge);
4627                            convertAmout = sendAmount - ServiceCharge;
4628                            if (ServiceCharge <= 0) {
4629                                ServiceCharge = 0;
4630                                convertAmout = sendAmount;
4631                            }
4632                            if (CouponAmountType == "2") {
4633                                $(".txtrfee").html('- <span style="text-decoration-line: line-through;">' + $('#hfTxtrFee').val() + '</span> ' + ServiceCharge + ' ' + currencyfrom);
4634                                $(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $('#hfConvertAmount').val() + '</span> ' + convertAmout + ' ' + currencyfrom);
4635                            }
4636                            else {
4637                                $(".txtrfee").html('- <span style="text-decoration-line: line-through;">' + $('#hfTxtrFee').val() + '</span> ' + ServiceCharge + ' ' + currencyfrom);
4638                            }
4639                        }
4640                        else {
4641                            var ServiceCharge = parseFloat($('#hfTxtrFee').val()) - parseFloat(json.DiscountServiceCharge);
4642                            convertAmout = sendAmount - ServiceCharge;
4643                            if (ServiceCharge <= 0) {
4644                                ServiceCharge = 0;
4645                                convertAmout = sendAmount
4646                            }
4647                            $(".txtrfee").html('<span style="text-decoration-line: line-through;">' + $('#hfTxtrFee').val() + '</span> ' + ServiceCharge + ' ' + currencyfrom);
4648                            var ConvertRate = parseFloat($('#hfTxtrConvertRate').val()) + parseFloat(json.DiscountRate);
4649                            $(".txtrconvertrate").html('<span style="text-decoration-line: line-through;">' + $('#hfTxtrConvertRate').val() + '</span> ' + ConvertRate);
4650                            $(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $('#hfConvertAmount').val() + '</span> ' + convertAmout + ' ' + currencyfrom);
4651                            conversionRate = ConvertRate;
4652                        }
4653                        if (CouponAmountType == "2") {
4654                            var rciptentget = convertAmout * conversionRate;
4655                            $(".txtrrciptentget").html('<span style="text-decoration-line: line-through;">' + $('#hfget').val() + '</span> ' + parseFloat(rciptentget).toFixed(2) + " " + currencyto);
4656                        }
4657                        else {
4658                            var amountrciptentget = $('#hfget').val()
4659                            convertAmout = (amountrciptentget / conversionRate);
4660                            var updatedSenderAmount = (convertAmout + ServiceCharge);
4661                            if (json.CouponType != "2") {
4662                                $(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $('#hfConvertAmount').val() + '</span> ' + convertAmout.toFixed(2) + ' ' + currencyfrom);
4663                            }
4664                            $(".txtsramount").html('<span style="text-decoration-line: line-through;">' + $('#hfsend').val() + '</span> ' + updatedSenderAmount.toFixed(2) + ' ' + currencyfrom);
4665                            $("#hffinalsend").val(updatedSenderAmount.toFixed(2) + ' ' + currencyfrom);
4666                        }
4667                    }
4668                    $('#AppliedModal').modal('show')
4669                    $('#AppliedModal').css('opacity', '')
4670
4671                    // return false;
4672                }
4673            }
4674
4675        },
4676        error: function (XMLHttpRequest, textStatus, errorThrown) {
4677            AlertConfirm(XMLHttpRequest.responseText);
4678            return false;
4679        }
4680    });
4681}
4682
4683
4684function removeCoupon() {
4685    $(".coupon-col").show();
4686    $(".coupon-col-applied").hide();
4687    var currencyfrom = $("#currencyfrom").val().trim();
4688    var currencyto = $("#currencyto").val().trim();
4689    $(".txtrfee").html('-' + $('#hfTxtrFee').val() + ' ' + currencyfrom);
4690    $(".txtrconvertrate").html($('#hfTxtrConvertRate').val());
4691    $(".txtrconvertamount").html($('#hfConvertAmount').val() + ' ' + currencyfrom);
4692    $(".txtrrciptentget").html($('#hfget').val() + " " + currencyto);
4693    $(".txtsramount").html($('#hfsend').val() + " " + currencyfrom);
4694    $("#hfcouponcode").val("");
4695    $("#appliedCouponTitle").text("");
4696    $("#hffinalsend").val($('#hfsend').val() + ' ' + currencyfrom);
4697}
4698
4699
4700function ReadMore(id) {
4701    if ($('#' + id + 'viewMore').text() == "Read more") {
4702        $('#' + id + 'viewMore').text('Read less');
4703        $('#' + id + 'full-content').show(200);
4704        $('#' + id + 'content').hide();
4705    } else {
4706        $('#' + id + 'viewMore').text('Read more');
4707        $('#' + id + 'full-content').hide();
4708        $('#' + id + 'content').show(200);
4709    }
4710}
4711
4712
4713function checkAgentCoupanValidation() {
4714    var fromsymbol = $("#currencyfrom").val().trim();
4715    var transferpurpose = $("#ContentPlaceHolder1_drptransferpurpose").val();
4716    var sourceincome = $("#ContentPlaceHolder1_drpsourceincome").val();
4717    var saletype = $("#ContentPlaceHolder1_drpsaletype").val();
4718    var transfertype = $("#ContentPlaceHolder1_drpagenttransfertypes").val();
4719    var deliverytype = $("#ContentPlaceHolder1_drpdeliveryperiod").val();
4720    var tosymbol = $("#currencyto").val().trim();
4721    var amount = $("#amountfrom").val();
4722    var amountto = $("#amountto").val();
4723    var remarks = $("#remarks").val();
4724    var bid = $("#ContentPlaceHolder1_drpbankid").val();
4725    var fcid = $(".fromrecipient-box").find(".menu .item:contains(" + fromsymbol + ")").attr("data-id");
4726    var cid = $(".recipient-box").find(".menu .item:contains(" + tosymbol + ")").attr("data-id");
4727    var pid = $("#hdnpaymenttype").val();
4728    var bankrefnumber = $("#remitterbankref").val();
4729    var recipientid = $("#hdnremitterid").val();
4730    var remitterphone = $("#remittercontactnumber").val();
4731    var beneficiaryphone = $("#benphone").val();
4732    var benid = $("#hdnbenid").val();
4733    var transferfrom = $("#hdnrecipientname").val();
4734    var transferto = $("#benname").val();
4735    var transferreference = $("#ContentPlaceHolder1_drprefrence").val();
4736    var twrecipientid = $("#hdntwrid").val();
4737    var twquoteid = $("#hdnquoteid").val();
4738    var paymentid = $("#hdnpaymentid").val();
4739    var transactionid = $("#hdntransactionid").val();
4740    var otherreason = $("#othertransferreason").val();
4741    var otherreference = $("#othertransferrefrence").val();
4742    var converrate = $("#convertrate").val();
4743    var agentfee = $("#agentfee").val();
4744    var remitteraccountnumber = $("#remitteraccountnumber").val();
4745    var ispoli = 0;
4746    if (!$('.currency1').find('.alert-danger').hasClass('hide')) {
4747        AlertConfirmWithoutReload("Please check transaction error");
4748        return false;
4749    }
4750    else if (!$('.currency2').find('.alert-danger').hasClass('hide')) {
4751        AlertConfirmWithoutReload("Please check transaction error");
4752        return false;
4753    }
4754    else if ($('.sw-btn-next').hasClass('disabled')) {
4755        AlertConfirmWithoutReload("Please check transaction error");
4756        return false;
4757    }
4758    if (transferreference == "0") {
4759        AlertConfirmWithoutReload("Please Select reference");
4760        return false;
4761    }
4762    else if (transferpurpose == "0") {
4763        AlertConfirmWithoutReload("Please Select transfer purpose");
4764        return false;
4765    }
4766    else if (transferpurpose == "5" && otherreason == "") {
4767        AlertConfirmWithoutReload("Please Enter Purpose");
4768        return false;
4769    }
4770    else if (transferreference == "8" && otherreference == "") {
4771        AlertConfirmWithoutReload("Please Enter Reference");
4772        return false;
4773    }
4774    else if (twrecipientid == "") {
4775        AlertConfirmWithoutReload("Recipient Id Not Found");
4776        return false;
4777    }
4778    else if (paymentid == "") {
4779        AlertConfirmWithoutReload("Payment Id Not Found");
4780        return false;
4781    }
4782    else if (bankrefnumber == "") {
4783        AlertConfirmWithoutReload("Bank Reference Code Not Found");
4784        return false;
4785    }
4786    else if (recipientid == "") {
4787        AlertConfirmWithoutReload("Remitter Id Not Found");
4788        return false;
4789    }
4790    else if (transferto == "") {
4791        AlertConfirmWithoutReload("Beneficary Name Not Found");
4792        return false;
4793    }
4794    else if (transferfrom == "") {
4795        AlertConfirmWithoutReload("Remitter Name Not Found");
4796        return false;
4797    }
4798    else if (agentfee == "") {
4799        AlertConfirmWithoutReload("Please enter fee");
4800        return false;
4801    }
4802    else if (converrate == "") {
4803        AlertConfirmWithoutReload("Please enter conversion rate");
4804        return false;
4805    }
4806    else if (parseFloat(converrate) <= 0) {
4807        AlertConfirmWithoutReload("Please enter conversion rate gretaer than 0");
4808        return false;
4809    }
4810    else if (remarks == "") {
4811        AlertConfirmWithoutReload("Please enter remarks");
4812        return false;
4813    }
4814    else if (remitteraccountnumber == "") {
4815        AlertConfirmWithoutReload("This user bank account number is not genrated.Please contact with customer support");
4816        return false;
4817    }
4818    return true;
4819}
4820//$("#amountfrom").keyup(function () {
4821//    removeCoupon();
4822//});
4823//$("#amountto").keyup(function () {
4824//    removeCoupon();
4825//});
4826function AgentRecipt(currencyfrom, currencyto, convertAmout, conversionRate, sendAmount, coupontype, discountRate, discountServiceCharge, agentfee, destinationAmount, couponamounttype) {
4827
4828    //$('.showloader').show();
4829    var fromsymbol = $("#currencyfrom").val().trim();
4830    var transferpurpose = $("#ContentPlaceHolder1_drptransferpurpose").val();
4831    var sourceincome = $("#ContentPlaceHolder1_drpsourceincome").val();
4832    var saletype = $("#ContentPlaceHolder1_drpsaletype").val();
4833    var transfertype = $("#ContentPlaceHolder1_drpagenttransfertypes").val();
4834    var deliverytype = $("#ContentPlaceHolder1_drpdeliveryperiod").val();
4835    var tosymbol = $("#currencyto").val().trim();
4836    var amount = $("#amountfrom").val();
4837    var amountto = $("#amountto").val();
4838    var remarks = $("#remarks").val();
4839    var bid = $("#ContentPlaceHolder1_drpbankid").val();
4840    var fcid = $(".fromrecipient-box").find(".menu .item:contains(" + fromsymbol + ")").attr("data-id");
4841    var cid = $(".recipient-box").find(".menu .item:contains(" + tosymbol + ")").attr("data-id");
4842    var pid = $("#hdnpaymenttype").val();
4843    var bankrefnumber = $("#remitterbankref").val();
4844    var recipientid = $("#hdnremitterid").val();
4845    var remitterphone = $("#remittercontactnumber").val();
4846    var beneficiaryphone = $("#benphone").val();
4847    var benid = $("#hdnbenid").val();
4848    var transferfrom = $("#hdnrecipientname").val();
4849    var transferto = $("#benname").val();
4850    var transferreference = $("#ContentPlaceHolder1_drprefrence").val();
4851    var twrecipientid = $("#hdntwrid").val();
4852    var twquoteid = $("#hdnquoteid").val();
4853    var paymentid = $("#hdnpaymentid").val();
4854    var transactionid = $("#hdntransactionid").val();
4855    var otherreason = $("#othertransferreason").val();
4856    var otherreference = $("#othertransferrefrence").val();
4857    var converrate = $("#convertrate").val();
4858    var agentfee = $("#agentfee").val();
4859    var remitteraccountnumber = $("#remitteraccountnumber").val();
4860    var ispoli = 0;
4861    if (!$('.currency1').find('.alert-danger').hasClass('hide')) {
4862        AlertConfirmWithoutReload("Please check transaction error");
4863        //$('.showloader').hide();
4864    
4865        return false;
4866    }
4867    else if (!$('.currency2').find('.alert-danger').hasClass('hide')) {
4868        AlertConfirmWithoutReload("Please check transaction error");
4869        //$('.showloader').hide();
4870        return false;
4871    }
4872    else if ($('.sw-btn-next').hasClass('disabled')) {
4873        AlertConfirmWithoutReload("Please check transaction error");
4874        //$('.showloader').hide();
4875        return false;
4876    }
4877    if (transferreference == "0") {
4878        AlertConfirmWithoutReload("Please Select reference");
4879       // $('.showloader').hide();
4880        return false;
4881    }
4882    else if (transferpurpose == "0") {
4883        AlertConfirmWithoutReload("Please Select transfer purpose");
4884       // $('.showloader').hide();
4885        return false;
4886    }
4887    else if (transferpurpose == "5" && otherreason == "") {
4888        AlertConfirmWithoutReload("Please Enter Purpose");
4889       // $('.showloader').hide();
4890        return false;
4891    }
4892    else if (transferreference == "8" && otherreference == "") {
4893        AlertConfirmWithoutReload("Please Enter Reference");
4894       // $('.showloader').hide();
4895        return false;
4896    }
4897    else if (twrecipientid == "") {
4898        AlertConfirmWithoutReload("Recipient Id Not Found");
4899      //  $('.showloader').hide();
4900        return false;
4901    }
4902    else if (paymentid == "") {
4903        AlertConfirmWithoutReload("Payment Id Not Found");
4904      //  $('.showloader').hide();
4905        return false;
4906    }
4907    else if (bankrefnumber == "") {
4908        AlertConfirmWithoutReload("Bank Reference Code Not Found");
4909       // $('.showloader').hide();
4910        return false;
4911    }
4912    else if (recipientid == "") {
4913        AlertConfirmWithoutReload("Remitter Id Not Found");
4914      //  $('.showloader').hide();
4915        return false;
4916    }
4917    else if (transferto == "") {
4918        AlertConfirmWithoutReload("Beneficary Name Not Found");
4919      //  $('.showloader').hide();
4920        return false;
4921    }
4922    else if (transferfrom == "") {
4923        AlertConfirmWithoutReload("Remitter Name Not Found");
4924       // $('.showloader').hide();
4925        return false;
4926    }
4927    else if (agentfee == "") {
4928        AlertConfirmWithoutReload("Please enter fee");
4929      //  $('.showloader').hide();
4930        return false;
4931    }
4932    else if (converrate == "") {
4933        AlertConfirmWithoutReload("Please enter conversion rate");
4934      //  $('.showloader').hide();
4935        return false;
4936    }
4937    else if (parseFloat(converrate) <= 0) {
4938        AlertConfirmWithoutReload("Please enter conversion rate gretaer than 0");
4939     //   $('.showloader').hide();
4940        return false;
4941    }
4942    else if (remarks == "") {
4943        AlertConfirmWithoutReload("Please enter remarks");
4944     //   $('.showloader').hide();
4945        return false;
4946    }
4947    else if (remitteraccountnumber == "") {
4948        AlertConfirmWithoutReload("This user bank account number is not genrated.Please contact with customer support");
4949      //  $('.showloader').hide();
4950        return false;
4951    }
4952    $(".txtsramount").html(amount + " " + fromsymbol);
4953    //$(".txtexactfee").html(+ json[0].exactfees + ' ' + from);
4954    //$(".txtourfee").html(+ json[0].ourexactfee + ' ' + from);
4955    $(".txtrfee").html("-" + agentfee + ' ' + fromsymbol);
4956    $(".txtrconvertamount").html($("#convertamount").val() + ' ' + fromsymbol);
4957    /*  $(".txtrguranteedrate").html("Conversion Rate (" + json[0].GuaranteedRate + " hrs)");*/
4958    $(".txtrguranteedrate").html("Conversion Rate");
4959    $(".txtrconvertrate").html(converrate);
4960    $(".txtrrciptentget").html(amountto + " " + tosymbol);
4961    $(".txtaccountname").html(transferto);
4962    $(".txtaccountnumber").html($("#benaccountnumber").val());
4963    $(".txtbankname").html($("#benbankname").val());
4964
4965    if (
4966        currencyfrom !== undefined &&
4967        currencyfrom !== null &&
4968        currencyfrom !== '' &&
4969        currencyfrom !== 0 &&
4970        currencyto !== undefined &&
4971        currencyto !== null &&
4972        currencyto !== '' &&
4973        currencyto !== 0 &&
4974        convertAmout !== undefined &&
4975        convertAmout !== null &&
4976        convertAmout !== '' &&
4977        !isNaN(convertAmout) &&
4978        convertAmout !== 0 &&
4979        conversionRate !== undefined &&
4980        conversionRate !== null &&
4981        conversionRate !== '' &&
4982        !isNaN(conversionRate) &&
4983        conversionRate !== 0 &&
4984        sendAmount !== undefined &&
4985        sendAmount !== null &&
4986        sendAmount !== '' &&
4987        !isNaN(sendAmount) &&
4988        sendAmount !== 0 &&
4989        coupontype !== undefined &&
4990        coupontype !== null &&
4991        coupontype !== '' &&
4992        coupontype !== 0 &&
4993        destinationAmount !== undefined &&
4994        destinationAmount !== null &&
4995        destinationAmount !== '' &&
4996        !isNaN(destinationAmount) &&
4997        destinationAmount !== 0
4998    ) {
4999     
5000        var ServiceCharge = agentfee;
5001        if (coupontype == "1") {
5002            var ConvertRate = parseFloat(conversionRate) + parseFloat(discountRate);
5003            $(".txtrconvertrate").html('<span style="text-decoration-line: line-through;">' + conversionRate + '</span> ' + ConvertRate);
5004            conversionRate = ConvertRate;
5005        }
5006        else if (coupontype == "2") {
5007            var ServiceCharge = parseFloat(agentfee) - parseFloat(discountServiceCharge);
5008            convertAmout = parseFloat(sendAmount) - parseFloat(ServiceCharge);
5009            if (ServiceCharge <= 0) {
5010                ServiceCharge = 0;
5011                convertAmout = sendAmount;
5012            }
5013            //$(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $("#convertamount").val() + '</span> ' + convertAmout + ' ' + currencyfrom);
5014            $(".txtrfee").html('- <span style="text-decoration-line: line-through;">' + agentfee + '</span> ' + ServiceCharge + ' ' + currencyfrom);
5015
5016        }
5017        else {
5018            var ServiceCharge = agentfee - discountServiceCharge;
5019            convertAmout = sendAmount - ServiceCharge;
5020            if (ServiceCharge <= 0) {
5021                ServiceCharge = 0;
5022                convertAmout = sendAmount;
5023            }
5024            $(".txtrfee").html('<span style="text-decoration-line: line-through;">' + agentfee + '</span> ' + ServiceCharge + ' ' + currencyfrom);
5025            var ConvertRate = parseFloat(conversionRate) + parseFloat(discountRate);
5026            $(".txtrconvertrate").html('<span style="text-decoration-line: line-through;">' + conversionRate + '</span> ' + ConvertRate);
5027            conversionRate = ConvertRate;
5028        }
5029
5030        var receiptget = convertAmout * conversionRate;
5031        if (couponamounttype == "1") {
5032            var oldamountrciptentget = destinationAmount
5033            convertAmout = (oldamountrciptentget / conversionRate);
5034            var updatedSenderAmount = parseFloat(convertAmout) + parseFloat(ServiceCharge);
5035            if (coupontype != 2) {
5036
5037                $(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $('#convertamount').val() + '</span> ' + convertAmout.toFixed(2) + ' ' + currencyfrom);
5038            }
5039            $(".txtsramount").html('<span style="text-decoration-line: line-through;">' + sendAmount + '</span> ' + parseFloat(updatedSenderAmount).toFixed(2) + ' ' + currencyfrom);
5040
5041        }
5042        else {
5043            $(".txtrrciptentget").html('<span style="text-decoration-line: line-through;">' + destinationAmount + '</span> ' + receiptget + " " + currencyto);
5044            if (coupontype !== "1") {
5045                $(".txtrconvertamount").html('<span style="text-decoration-line: line-through;">' + $('#convertamount').val() + '</span> ' + convertAmout + ' ' + currencyfrom);
5046            }
5047        }
5048    }
5049    setTimeout(function () {
5050        $("#recieptmodal").modal("show");
5051    }, 100);
5052    //$("#recieptmodal").modal("show");
5053    // return false;
5054}
5055function checkValidations() {
5056   
5057    var fromsymbol = $("#currencyfrom").val().trim();
5058    var transferpurpose = $("#ContentPlaceHolder1_drptransferpurpose").val();
5059    var sourceincome = $("#ContentPlaceHolder1_drpsourceincome").val();
5060    var saletype = $("#ContentPlaceHolder1_drpsaletype").val();
5061    var transfertype = $("#ContentPlaceHolder1_drpagenttransfertypes").val();
5062    var deliverytype = $("#ContentPlaceHolder1_drpdeliveryperiod").val();
5063    var tosymbol = $("#currencyto").val().trim();
5064    var amount = $("#amountfrom").val();
5065    var amountto = $("#amountto").val();
5066    var remarks = $("#remarks").val();
5067    var bid = $("#ContentPlaceHolder1_drpbankid").val();
5068    var fcid = $(".fromrecipient-box").find(".menu .item:contains(" + fromsymbol + ")").attr("data-id");
5069    var cid = $(".recipient-box").find(".menu .item:contains(" + tosymbol + ")").attr("data-id");
5070    var pid = $("#hdnpaymenttype").val();
5071    var bankrefnumber = $("#remitterbankref").val();
5072    var recipientid = $("#hdnremitterid").val();
5073    var remitterphone = $("#remittercontactnumber").val();
5074    var beneficiaryphone = $("#benphone").val();
5075    var benid = $("#hdnbenid").val();
5076    var transferfrom = $("#hdnrecipientname").val();
5077    var transferto = $("#benname").val();
5078    var transferreference = $("#ContentPlaceHolder1_drprefrence").val();
5079    var twrecipientid = $("#hdntwrid").val();
5080    var twquoteid = $("#hdnquoteid").val();
5081    var paymentid = $("#hdnpaymentid").val();
5082    var transactionid = $("#hdntransactionid").val();
5083    var otherreason = $("#othertransferreason").val();
5084    var otherreference = $("#othertransferrefrence").val();
5085    var converrate = $("#convertrate").val();
5086    var agentfee = $("#agentfee").val();
5087    var remitteraccountnumber = $("#remitteraccountnumber").val();
5088    var ispoli = 0;
5089    if (!$('.currency1').find('.alert-danger').hasClass('hide')) {
5090        AlertConfirmWithoutReload("Please check transaction error");
5091        return false;
5092    }
5093    else if (!$('.currency2').find('.alert-danger').hasClass('hide')) {
5094        AlertConfirmWithoutReload("Please check transaction error");
5095        return false;
5096    }
5097    else if ($('.sw-btn-next').hasClass('disabled')) {
5098        AlertConfirmWithoutReload("Please check transaction error");
5099        return false;
5100    }
5101    if (transferreference == "0") {
5102        AlertConfirmWithoutReload("Please Select reference");
5103        return false;
5104    }
5105    else if (transferpurpose == "0") {
5106        AlertConfirmWithoutReload("Please Select transfer purpose");
5107        return false;
5108    }
5109    else if (transferpurpose == "5" && otherreason == "") {
5110        AlertConfirmWithoutReload("Please Enter Purpose");
5111        return false;
5112    }
5113    else if (transferreference == "8" && otherreference == "") {
5114        AlertConfirmWithoutReload("Please Enter Reference");
5115        return false;
5116    }
5117    else if (twrecipientid == "") {
5118        AlertConfirmWithoutReload("Recipient Id Not Found");
5119        return false;
5120    }
5121    else if (paymentid == "") {
5122        AlertConfirmWithoutReload("Payment Id Not Found");
5123        return false;
5124    }
5125    else if (bankrefnumber == "") {
5126        AlertConfirmWithoutReload("Bank Reference Code Not Found");
5127        return false;
5128    }
5129    else if (recipientid == "") {
5130        AlertConfirmWithoutReload("Remitter Id Not Found");
5131        return false;
5132    }
5133    else if (transferto == "") {
5134        AlertConfirmWithoutReload("Beneficary Name Not Found");
5135        return false;
5136    }
5137    else if (transferfrom == "") {
5138        AlertConfirmWithoutReload("Remitter Name Not Found");
5139        return false;
5140    }
5141    else if (agentfee == "") {
5142        AlertConfirmWithoutReload("Please enter fee");
5143        return false;
5144    }
5145    else if (converrate == "") {
5146        AlertConfirmWithoutReload("Please enter conversion rate");
5147        return false;
5148    }
5149    else if (parseFloat(converrate) <= 0) {
5150        AlertConfirmWithoutReload("Please enter conversion rate gretaer than 0");
5151        return false;
5152    }
5153    else if (remarks == "") {
5154        AlertConfirmWithoutReload("Please enter remarks");
5155        return false;
5156    }
5157    else if (remitteraccountnumber == "") {
5158        AlertConfirmWithoutReload("This user bank account number is not genrated.Please contact with customer support");
5159        return false;
5160    }
5161    return true;
5162}
5163
5164function FilterCouponsByCode(code) {
5165    debugger;
5166    var couponBoxes = $('.coupon-box');
5167    if (code === '') {
5168        couponBoxes.show();
5169    } else {
5170        couponBoxes.each(function () {
5171
5172            var couponCodeText = $(this).find('.use-code').text().trim();
5173            if (couponCodeText === 'Use code : ' + code) {
5174                $(this).show(); // Show if the coupon code matches
5175            } else {
5176                $(this).hide(); // Hide if the coupon code does not match
5177            }
5178        });
5179    }
5180
5181}
5182
5183function payoutChanged() {
5184    var payouttype = $("[id*=payoutType]").val();
5185    if (payouttype == 'Normal') {
5186        $("#hfIsFastPay").val('0');
5187    }
5188    else {
5189        $("#hfIsFastPay").val('1');
5190    }
5191    CC(null, 'both', 0, 0);
5192}
5193

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.