You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
464 lines
17 KiB
464 lines
17 KiB
$(document).ready(function () {
|
|
var a = $("#" + mId + "hideSearchDivVal").val();
|
|
$("#" + mId + "register").prop("disabled", true);
|
|
$("#" + mId + "otherRelationDiv").hide();
|
|
$("#divOccupation").hide();
|
|
$('#branchSelect').hide();
|
|
$('#branchManual').hide();
|
|
|
|
//divOccupation
|
|
if (a == "true") {
|
|
$("#" + mId + "hideSearchDivVal").hide();
|
|
$(".main-nav").hide();
|
|
}
|
|
$("#" + mId + "recDdlPurposeOfRemitance").on("change", function () {
|
|
let purposeValue = $("#" + mId + "recDdlPurposeOfRemitance option:selected").val();
|
|
if (purposeValue == '11347') {
|
|
$("#purposeOtherDiv").show();
|
|
} else {
|
|
$("#purposeOtherDiv").hide();
|
|
}
|
|
});
|
|
|
|
$("#" + mId + "register").click(function () {
|
|
var isFormDataValid = CheckFormValidation();
|
|
if (isFormDataValid === 'true') {
|
|
var customerSignature = CheckSignatureCustomerFromCustomerRegister();
|
|
if (customerSignature === 'true') {
|
|
save();
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
|
|
$(document).on("change", "#" + mId + "recDdlIdType", function () {
|
|
$("#" + mId + "recrecTxtIdValue").val("");
|
|
idTypeVal = $(this).val();
|
|
if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
|
|
$("#" + mId + "recTxtIdValue").removeAttr("disabled");
|
|
$("#" + mId + "idNumberErr").show();
|
|
}
|
|
else {
|
|
$("#" + mId + "recTxtIdValue").attr("disabled", "disabled");
|
|
$("#" + mId + "idNumberErr").hide();
|
|
$("#" + mId + "recDdlIdType").removeAttr("style");
|
|
$("#" + mId + "recTxtIdValue").removeAttr("style");
|
|
}
|
|
});
|
|
|
|
$(document).on("change", "#" + mId + "recDdlPayoutPatner", function () {
|
|
GetBankBranch();
|
|
});
|
|
|
|
hideShowMenuBar();
|
|
});
|
|
function GetBankBranch() {
|
|
var bankId = $("#" + mId + "recDdlPayoutPatner option:selected").val();
|
|
var countryId = $("#" + mId + "recDdlCountry option:selected").val();
|
|
var pMode = $("#" + mId + "recDdlPaymentMode option:selected").val();
|
|
var data = { MethodName: "GetBankBranch", bankId: bankId, countryId: countryId, pMode: pMode, branchId: null };
|
|
$.post("", data, function (response) {
|
|
PopulateBranchDDL(response, "MainContent_recDDLBankBranch", "Select Branch");
|
|
});
|
|
}
|
|
|
|
function CheckForMobileNumber(nField, fieldName) {
|
|
var numberPattern = /^[+]?[0-9]{6,16}$/;
|
|
test = numberPattern.test(nField.value);
|
|
if (!test) {
|
|
alert(fieldName + " Is Not Valid !");
|
|
nField.value = "";
|
|
return false
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function CheckForPhoneNumber(nField, fieldName) {
|
|
var numberPattern = /^[+]?[0-9]{6,15}$/;
|
|
test = numberPattern.test(nField.value);
|
|
if (!test) {
|
|
alert(fieldName + " Is Not Valid !");
|
|
nField.value = "";
|
|
return false
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function hideShowMenuBar() {
|
|
var addType = "GetReceiverAddType()";
|
|
if (addType === "s") {
|
|
$(".navbar.navbar-inverse.yamm.navbar-fixed-top.main-nav").hide();
|
|
$(".listtabs").hide()
|
|
}
|
|
}
|
|
function PopulatePaymentMethod() {
|
|
var data =
|
|
{
|
|
MethodName: "PopulatePaymentMode",
|
|
country: $("#" + mId + "recDdlCountry option:selected").text()
|
|
};
|
|
$.ajax({
|
|
url: "",
|
|
type: "post",
|
|
data: data,
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (response) {
|
|
PopulaterecDdl(response, "" + mId + "recDdlPaymentMode", "", "", "");
|
|
},
|
|
error: function (error) {
|
|
alert("Something went wrong!!!")
|
|
}
|
|
})
|
|
}
|
|
|
|
function PopulatePayoutPartner() {
|
|
$("#" + mId + "recDdlPayoutPatner").empty();
|
|
$("#" + mId + "recDDlBankBranch").empty();
|
|
var pmode = $("#" + mId + "recDdlPaymentMode option:selected").val();
|
|
if (pmode == "2") {
|
|
$("#" + mId + "receiverAccountNo").show();
|
|
}
|
|
else {
|
|
$("#" + mId + "receiverAccountNo").hide();
|
|
$("#" + mId + "recDDlBankBranch").val("");
|
|
}
|
|
var data =
|
|
{
|
|
MethodName: "PopulatePayoutPartner",
|
|
country: $("#" + mId + "recDdlCountry option:selected").val(),
|
|
paymentMode: $("#" + mId + "recDdlPaymentMode option:selected").text()
|
|
};
|
|
$.post("", data, function (response) {
|
|
CheckForBranchShowIde();
|
|
PopulaterecDdl(response, "" + mId + "recDdlPayoutPatner", "", "", "");
|
|
GetBankBranch();
|
|
}).fail(function (error) {
|
|
alert("Something went wrong!!!");
|
|
});
|
|
}
|
|
|
|
function PopulateBranchDDL(populateData, recDdlId, defaultText) {
|
|
var myrecDdl = document.getElementById(recDdlId);
|
|
$(myrecDdl).empty();
|
|
var option;
|
|
if (defaultText != "") {
|
|
option = document.createElement("option");
|
|
option.text = defaultText;
|
|
option.value = "";
|
|
myrecDdl.options.add(option);
|
|
}
|
|
for (var i = 0; i < populateData.length; i++) {
|
|
option = document.createElement("option");
|
|
option.text = populateData[i].agentName;
|
|
option.value = populateData[i].agentId;
|
|
try {
|
|
myrecDdl.options.add(option);
|
|
} catch (e) {
|
|
alert(e.message);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
function PopulaterecDdl(populateData, recDdlId, selectedId, selectedText, defaultText) {
|
|
var myrecDdl = document.getElementById(recDdlId);
|
|
$(myrecDdl).empty();
|
|
var option;
|
|
if (defaultText != "") {
|
|
option = document.createElement("option");
|
|
option.text = defaultText;
|
|
option.value = "";
|
|
|
|
myrecDdl.options.add(option);
|
|
}
|
|
for (var i = 0; i < populateData.length; i++) {
|
|
option = document.createElement("option");
|
|
if (recDdlId == "" + mId + "recDdlPaymentMode") {
|
|
option.text = populateData[i].Value;
|
|
option.value = populateData[i].Key;
|
|
|
|
} else {
|
|
option.text = populateData[i].AGENTNAME;
|
|
option.value = populateData[i].bankId;
|
|
}
|
|
|
|
if (selectedId != "" && selectedId == populateData[i].value) {
|
|
option.selected = true;
|
|
} else if (selectedText != "" && selectedText.toUpperCase() == populateData[i].Key.toUpperCase()) {
|
|
option.selected = true;
|
|
}
|
|
|
|
try {
|
|
myrecDdl.options.add(option);
|
|
} catch (e) {
|
|
alert(e.message);
|
|
|
|
}
|
|
}
|
|
}
|
|
function getUrlVars() {
|
|
var vars = [], hash;
|
|
var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("&");
|
|
for (var i = 0; i < hashes.length; i++) {
|
|
hash = hashes[i].split("=");
|
|
vars.push(hash[0]);
|
|
vars[hash[0]] = hash[1];
|
|
}
|
|
return vars;
|
|
}
|
|
|
|
function showTextBox() {
|
|
var res = $("#" + mId + "recDdlRelationship").val();
|
|
if (res.toUpperCase() == "11339") {
|
|
$("#" + mId + "otherRelationDiv").show();
|
|
}
|
|
else {
|
|
$("#" + mId + "otherRelationDiv").hide();
|
|
}
|
|
}
|
|
|
|
function CheckFormValidation() {
|
|
$("#" + mId + "recDdlIdType").removeAttr("style");
|
|
$("#" + mId + "recTxtIdValue").removeAttr("style");
|
|
var input = $("#" + mId + "recTxtRecMobileNo");
|
|
var mobileNo = input.val();
|
|
if (mobileNo != "") {
|
|
var countryCode = $(".country.active .dial-code").text();
|
|
var maxLength = input.attr("maxLength");
|
|
if (mobileNo.indexOf(countryCode) < 0) {
|
|
mobileNo = countryCode + mobileNo;
|
|
}
|
|
if (mobileNo.length > maxLength) {
|
|
alert("Mobile No. Can allow input maxmum " + maxLength + " digit only");
|
|
$("#" + mId + "recTxtRecMobileNo").val("");
|
|
return false;
|
|
}
|
|
$("#" + mId + "recTxtRecMobileNo").val(mobileNo);
|
|
var numberPattern = /^[+]?[0-9]{6,16}$/;
|
|
test = numberPattern.test(mobileNo);
|
|
if (!test) {
|
|
alert("Mobile No Is Not Valid !");
|
|
input.val("");
|
|
return false
|
|
}
|
|
}
|
|
paymentMode = $("#" + mId + "recDdlPaymentMode").val();
|
|
var reqField = "" + mId + "recDdlCountry," + mId + "recDdlBenificiaryType," + mId + "recTxtReceiverFName," + mId + "recTxtReceiverLName," + mId + "recTxtReceiverAddress," + mId + "recDdlPaymentMode," + mId + "recDdlNativeCountry,";
|
|
idTypeVal = $("#" + mId + "recDdlIdType").val();
|
|
idTypeNumber = $("#" + mId + "recTxtIdValue").val();
|
|
if ((idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") || (idTypeNumber !== null && idTypeNumber !== "" && idTypeNumber !== "0")) {
|
|
reqField += "" + mId + "recDdlIdType," + mId + "recTxtIdValue,";
|
|
}
|
|
if (ValidRequiredField(reqField) === false) {
|
|
return false;
|
|
}
|
|
$("#" + mId + "register").attr("disabled", "disabled");
|
|
};
|
|
function save() {
|
|
var addType = 'GetReceiverAddType()';
|
|
var bankBranch = $("#" + mId + "recDDlBankBranch option:selected").val();
|
|
if (bankBranch === undefined || bankBranch === null || bankBranch.length < 0) {
|
|
bankBranch = "";
|
|
}
|
|
var data =
|
|
{
|
|
MethodName: "SaveReceiverDetails",
|
|
nativeCountry: $("#" + mId + "recDdlNativeCountry").val(),
|
|
paymentMode: $("#" + mId + "recDdlPaymentMode option:selected").val(),
|
|
PayoutPatner: $("#" + mId + "recDdlPayoutPatner option:selected").val(),
|
|
Country: $("#" + mId + "recDdlCountry option:selected").text().split("(")[0],
|
|
BenificiaryType: $("#" + mId + "recDdlBenificiaryType option:selected").val(),
|
|
Email: $("#" + mId + "recTxtEmail").val(),
|
|
ReceiverFName: $("#" + mId + "recTxtReceiverFName").val(),
|
|
ReceiverMName: $("#" + mId + "recTxtReceiverMName").val(),
|
|
ReceiverLName: $("#" + mId + "recTxtReceiverLName").val(),
|
|
ReceiverAddress: $("#" + mId + "recTxtReceiverAddress").val(),
|
|
ReceiverCity: $("#" + mId + "recTxtReceiverCity").val(),
|
|
ContactNo: $("#" + mId + "recTxtContactNo").val(),
|
|
SenderMobileNo: $("#" + mId + "recTxtRecMobileNo").val(),
|
|
Relationship: $("#" + mId + "recDdlRelationship option:selected").val(),
|
|
PlaceOfIssue: $("#" + mId + "recTxtPlaceOfIssue").val(),
|
|
TypeId: $("#" + mId + "recDdlIdType option:selected").val(),
|
|
TypeValue: $("#" + mId + "recTxtIdValue").val(),
|
|
BenificaryAc: $("#" + mId + "receiverAccountNo").val(),
|
|
PurposeOfRemitance: $("#" + mId + "recDdlPurposeOfRemitance").val(),
|
|
BankLocation: bankBranch,
|
|
BankName: $("#" + mId + "recTxtBankName").val(),
|
|
Remarks: $("#" + mId + "recTxtRemarksRec").val(),
|
|
OtherRelationDescription: $("#" + mId + "otherRelationshipTextBox").val(),
|
|
membershipId: $("#" + mId + "hideMembershipId").val(),
|
|
ReceiverId: $("#" + mId + "hideBenificialId").val(),
|
|
hideCustomerId: $("#" + mId + "hideCustomerId").val(),
|
|
hideBenificialId: $("#" + mId + "hideBenificialId").val(),
|
|
hddSignatureImage: $("#" + mId + "hddImgURL").val()
|
|
};
|
|
$.ajax({
|
|
url: "",
|
|
type: "post",
|
|
data: data,
|
|
dataType: "json",
|
|
success: function (response) {
|
|
if (response.ErrorCode == "1") {
|
|
alert(response.Msg);
|
|
return false;
|
|
} else {
|
|
if (addType.toLowerCase() == "s") {
|
|
CallBack(response.Id);
|
|
}
|
|
else {
|
|
var hide = $("#" + mId + "hideSearchDivVal").val();
|
|
if (hide == "true") {
|
|
window.location.href = "List.aspx?customerDetails=true&customerId=" + response.Extra + "&hideSearchDiv=true";
|
|
} else {
|
|
window.location.href = "List.aspx?customerDetails=true&customerId=" + response.Extra + "";
|
|
}
|
|
return;
|
|
}
|
|
return true;
|
|
}
|
|
},
|
|
error: function (error) {
|
|
alert("Something went wrong!!!");
|
|
return false;
|
|
}
|
|
})
|
|
|
|
}
|
|
var isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
|
function CallBack(res) {
|
|
window.returnValue = res;
|
|
if (isChrome) {
|
|
window.opener.PostMessageToParentAddReceiver(window.returnValue);
|
|
}
|
|
window.close();
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
|
|
var a = $("#" + mId + "hideSearchDivVal").val();
|
|
if (a == "true") {
|
|
$("#" + mId + "hideSearchDivVal").hide();
|
|
$(".main-nav").hide();
|
|
}
|
|
|
|
|
|
$("#" + mId + "recTxtRecMobileNo").intlTelInput({
|
|
nationalMode: true,
|
|
formatOnDisplay: false,
|
|
utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.3/js/utils.js" // just for formatting/placeholders etc
|
|
});
|
|
|
|
$("#" + mId + "recTxtRecMobileNo").on("change", function () {
|
|
var input = $("#" + mId + "recTxtRecMobileNo");
|
|
var mobileNo = input.val();
|
|
var countryCode = $(".receiver .country.active .dial-code").text();
|
|
var maxLength = input.attr("maxLength");
|
|
if (mobileNo.indexOf(countryCode) < 0) {
|
|
mobileNo = countryCode + mobileNo;
|
|
}
|
|
if (mobileNo.length > maxLength) {
|
|
alert("Mobile No. Can allow input maxmum " + maxLength + " digit only");
|
|
return $(this).val("");
|
|
}
|
|
$(this).val(mobileNo);
|
|
CheckForMobileNumber(this, "Mobile No.");
|
|
});
|
|
PopulateCountryFlagForMobileNumber();
|
|
|
|
$("#" + mId + "recDdlCountry").on("change", function () {
|
|
PopulateCountryFlagForMobileNumber();
|
|
PopulatePaymentMethod();
|
|
PopulatePayoutPartner();
|
|
CheckForBranchShowIde();
|
|
});
|
|
|
|
});
|
|
function CheckForBranchShowIde() {
|
|
var country = $("#" + mId + "recDdlCountry option:selected ").text().split('(')[0];
|
|
if (country.toUpperCase() === 'NEPAL' || country.toUpperCase() === 'VIETNAM') {
|
|
$('#branchSelect').hide();
|
|
$('#branchManual').show();
|
|
if ($('#MainContent_recDdlPaymentMode').val() === '1' && country.toUpperCase() === 'NEPAL') {
|
|
$('#branchSelect').hide();
|
|
$('#branchManual').hide();
|
|
}
|
|
}
|
|
else {
|
|
$('#branchSelect').show();
|
|
$('#branchManual').hide();
|
|
}
|
|
}
|
|
|
|
function PopulateCountryFlagForMobileNumber() {
|
|
$("#" + mId + "recTxtRecMobileNo").attr("disabled", "disabled");
|
|
var getCountry = $("#" + mId + "recDdlCountry option:selected").text();
|
|
var countryId = $("#" + mId + "recDdlCountry option:selected").val();
|
|
if (countryId === "" || countryId === null || countryId === "0") {
|
|
return;
|
|
}
|
|
$("#" + mId + "recTxtRecMobileNo").removeAttr("disabled");
|
|
var code = getCountry.split("(");
|
|
code = code[1].split(")")[0];
|
|
$("#" + mId + "recTxtRecMobileNo").intlTelInput("setCountry", code);
|
|
|
|
if ($("<%=GetReceiverId()%>") != "") {
|
|
CheckMobileNumberorCountryCode();
|
|
}
|
|
}
|
|
|
|
function CheckMobileNumberorCountryCode() {
|
|
var input = $("#" + mId + "recTxtRecMobileNo");
|
|
var mobileNo = input.val();
|
|
var newMobile = "";
|
|
|
|
if (mobileNo.indexOf("+") >= 0 || mobileNo === "") {
|
|
return true;
|
|
}
|
|
|
|
if (mobileNo != "") {
|
|
var countryCode = $(".country.active .dial-code").text();
|
|
var len = countryCode.length;
|
|
var firstletters = mobileNo.substring(0, len - 1);
|
|
|
|
var codeWithoutPlus = countryCode.replace("+", "");
|
|
|
|
if (codeWithoutPlus === firstletters) {
|
|
newMobile = "+" + mobileNo;
|
|
}
|
|
else {
|
|
newMobile = countryCode + mobileNo;
|
|
}
|
|
|
|
$("#" + mId + "recTxtRecMobileNo").val(newMobile);
|
|
}
|
|
}
|
|
function PopulateLocation() {
|
|
var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
|
|
if (pmode == "2") {
|
|
$("#" + mId + "receiverAccountNo").show();
|
|
}
|
|
else {
|
|
$("#" + mId + "receiverAccountNo").hide();
|
|
$("#" + mId + "DDLBankLocation").val("");
|
|
}
|
|
|
|
var data =
|
|
{
|
|
MethodName: "PopulateLocation",
|
|
country: $("#" + mId + "ddlCountry option:selected").val(),
|
|
pAgent: $("#" + mId + "ddlPayoutPatner option:selected").val(),
|
|
paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val()
|
|
};
|
|
$.post("", data, function (response) {
|
|
PopulateDDL(response, "MainContent_DDLBankLocation", "", "", "");
|
|
}).fail(function (error) {
|
|
alert("Something went wrong!!!");
|
|
});
|
|
}
|