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.
 
 
 
 
 

452 lines
16 KiB

function CallSignature() {
CustomerSignature();
$(document).ready(function () {
$("#ContentPlaceHolder1_BenificiaryAgreement").click(function () {
if ($("#ContentPlaceHolder1_BenificiaryAgreement").is(":checked")) {
$("#" + mId + "register").removeAttr("disabled");
} else {
$("#" + mId + "register").attr("disabled", "disabled");
}
});
$("#" + mId + "ddlPurposeOfRemitance").on("change", function () {
let purposeValue = $("#" + mId + "ddlPurposeOfRemitance 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;
}
});
$("#" + mId + "txtSenderMobileNo").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
});
$(document).on("change", "#" + mId + "txtSenderMobileNo", function () {
var input = $("#" + mId + "txtSenderMobileNo");
var mobileNo = input.val();
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");
return $(this).val("");
}
//var intlNumber = input.intlTelInput("getNumber", intlTelInputUtils.numberFormat.E164);
$(this).val(mobileNo);
CheckForMobileNumber(this, "Mobile No.");
});
$(document).on("change", "#" + mId + "ddlIdType", function () {
$("#" + mId + "txtIdValue").val("");
idTypeVal = $(this).val();
if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
$("#" + mId + "txtIdValue").removeAttr("disabled");
$("#idNumberErr").show();
}
else {
$("#" + mId + "txtIdValue").attr("disabled", "disabled");
$("#idNumberErr").hide();
$("#" + mId + "ddlIdType").removeAttr("style");
$("#" + mId + "txtIdValue").removeAttr("style");
}
});
})
}
function ClearAllInputFields() {
$("#" + mId + "ddlCountry").val("");
$("#" + mId + "ddlBenificiaryType").val("4700");
$("#" + mId + "txtEmail").val("");
$("#" + mId + "txtReceiverFName").val("");
$("#" + mId + "txtReceiverMName").val("");
$("#" + mId + "txtReceiverLName").val("");
$("#" + mId + "ddlNativeCountry").val("");
$("#" + mId + "txtReceiverAddress").val("");
$("#" + mId + "txtReceiverCity").val("");
$("#" + mId + "txtContactNo").val("");
$("#" + mId + "txtSenderMobileNo").val("");
$("#" + mId + "txtSenderMobileNo").attr("disabled", "disabled");
$("#" + mId + "ddlIdType").val("");
$("#" + mId + "txtIdValue").val("");
$("#" + mId + "txtPlaceOfIssue").val("");
$("#" + mId + "ddlRelationship").val("");
$("#" + mId + "otherRelationshipTextBox").val("");
$("#" + mId + "ddlPurposeOfRemitance").val("");
$("#" + mId + "ddlPaymentMode").val("");
$("#" + mId + "ddlPayoutPatner").val("");
$("#" + mId + "txtBankName").val("");
$("#" + mId + "txtBenificaryAc").val("");
$("#" + mId + "DDLBankLocation").val("");
$("#" + mId + "txtRemarks").val("");
$("#" + mId + "customerName").text("");
$("#" + mId + "txtMembershipId").text("");
}
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 ddlCountryChange() {
$("#" + mId + "txtSenderMobileNo").attr("disabled", "disabled");
PopulateCountryFlagForMobileNumber();
PopulatePaymentMethod();
PopulatePayoutPartner();
CheckForBranchShowIde();
}
function CallBackAutocomplete(id) {
ClearAllInputFields();
var d = [GetItem(mId + "txtSearchData")[0], GetItem(mId + "txtSearchData")[1].split("|")[0]];
$("#" + mId + "hideCustomerId").val(d[0]);
LoadCustomerInfo(d[0]);
$("#" + mId + "regUp").show();
}
function LoadCustomerInfo(customerId) {
var data = { MethodName: "LoadCustomerInfo", customerId: customerId };
$.ajax({
url: "",
type: "post",
data: data,
dataType: "json",
async: false,
success: function (response) {
if (response != null) {
$("#" + mId + "customerName").text(response[0].fullName);
$("#" + mId + "txtMembershipId").text(response[0].membershipId);
}
},
error: function (error) {
alert("Something went wrong!!!")
}
});
}
function GetCustomerSearchType() {
var searchBy = $("#" + mId + "ddlSearchBy").val()
return searchBy;
}
function PopulatePaymentMethod() {
var data =
{
MethodName: "PopulatePaymentMode",
country: $("#" + mId + "ddlCountry option:selected").text()
};
$.ajax({
url: "",
type: "post",
data: data,
dataType: "json",
async: false,
success: function (response) {
PopulateDDL(response, "ContentPlaceHolder1_ddlPaymentMode", "", "", "");
},
error: function (error) {
alert("Something went wrong!!!")
}
})
}
function PopulatePayoutPartner() {
var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
if (pmode == "2") {
$("#" + mId + "receiverAccountNo").show();
}
else {
$("#" + mId + "receiverAccountNo").hide();
$("#" + mId + "DDLBankLocation").val("");
}
CheckForBranchShowIde();
var data =
{
MethodName: "PopulatePayoutPartner",
country: $("#" + mId + "ddlCountry option:selected").val(),
paymentMode: $("#" + mId + "ddlPaymentMode option:selected").text()
};
$.post("", data, function (response) {
PopulateDDL(response, "ContentPlaceHolder1_ddlPayoutPatner", "", "", "");
PopulateLocation();
}).fail(function (error) {
alert("Something went wrong!!!");
});
}
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, "ContentPlaceHolder1_DDLBankLocation", "Select Branch");
});
}
function PopulateDDL(populateData, ddlId, selectedId, selectedText, defaultText) {
var myDDL = document.getElementById(ddlId);
$(myDDL).empty();
var option;
if (defaultText != "") {
option = document.createElement("option");
option.text = defaultText;
option.value = "";
myDDL.options.add(option);
}
for (var i = 0; i < populateData.length; i++) {
option = document.createElement("option");
if (ddlId == "ContentPlaceHolder1_ddlPaymentMode") {
option.text = populateData[i].Value;
option.value = populateData[i].Key;
} else if (ddlId == "ContentPlaceHolder1_DDLBankLocation") {
option.text = populateData[i].agentName;
option.value = populateData[i].agentId;
} 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 {
myDDL.options.add(option);
} catch (e) {
alert(e.message);
}
}
}
function showTextBox() {
var res = $("#" + mId + "ddlRelationship").val();
if (res.toUpperCase() == "11339") {
$("#" + mId + "otherRelationDiv").show();
}
else {
$("#" + mId + "otherRelationDiv").hide();
}
}
function CheckFormValidation(e) {
$("#" + mId + "ddlIdType").removeAttr("style");
$("#" + mId + "txtIdValue").removeAttr("style");
var reqField = "customerId,ddlCountry,ddlBenificiaryType,txtReceiverFName,txtReceiverLName,txtReceiverAddress,ddlPaymentMode,ddlNativeCountry,";
idTypeVal = $("#" + mId + "ddlIdType").val();
if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
reqField += "ddlIdType,txtIdValue,";
}
let purposeValue = $("#" + mId + "ddlPurposeOfRemitance option:selected").val();
if (purposeValue == '11347') {
reqField += "purposeOther,";
}
if (ValidRequiredFieldNew(reqField) === false) {
return false;
}
var pMode = $("#" + mId + "ddlPaymentMode").val();
var pAgent = $("#" + mId + "ddlPayoutPatner").val();
if (pMode == "2") {
if (pAgent == '' || pAgent == undefined || pAgent == null || pAgent == "null") {
$("#" + mId + "ddlPayoutPatner").css('background-color', '#FFCCD2');
alert('Required Field(s)\n _____________________________ \n The red fields are required!');
return false
}
}
$("#" + mId + "register").attr("disabled", "disabled");
return true;
}
function save() {
//var addType = "<%=GetReceiverAddType()%>";
var data =
{
MethodName: "SaveReceiverDetails",
customerId: $("#" + mId + "hideCustomerId").val(),
nativeCountry: $("#" + mId + "ddlNativeCountry").val(),
paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val(),
PayoutPatner: $("#" + mId + "ddlPayoutPatner option:selected").val(),
Country: $("#" + mId + "ddlCountry option:selected").text(),
BenificiaryType: $("#" + mId + "ddlBenificiaryType option:selected").val(),
Email: $("#" + mId + "txtEmail").val(),
ReceiverFName: $("#" + mId + "txtReceiverFName").val(),
ReceiverMName: $("#" + mId + "txtReceiverMName").val(),
ReceiverLName: $("#" + mId + "txtReceiverLName").val(),
ReceiverAddress: $("#" + mId + "txtReceiverAddress").val(),
ReceiverCity: $("#" + mId + "txtReceiverCity").val(),
ContactNo: $("#" + mId + "txtContactNo").val(),
SenderMobileNo: $("#" + mId + "txtSenderMobileNo").val(),
Relationship: $("#" + mId + "ddlRelationship option:selected").val(),
PlaceOfIssue: $("#" + mId + "txtPlaceOfIssue").val(),
TypeId: $("#" + mId + "ddlIdType option:selected").val(),
TypeValue: $("#" + mId + "txtIdValue").val(),
PurposeOfRemitance: $("#" + mId + "ddlPurposeOfRemitance").val(),
OtherPrupose: $("#" + mId + "purposeOther").val(),
BankLocation: $("#" + mId + "DDLBankLocation").val(),
BankName: $("#" + mId + "txtBankName").val(),
BenificaryAc: $("#" + mId + "txtBenificaryAc").val(),
Remarks: $("#" + mId + "txtRemarks").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);
$("#" + mId + "register").prop("disabled", false);
return false;
} else {
alert(response.Msg);
let url = "/AgentNew/Transaction/AddBenificiary/PrintBenificiaryDetails.aspx?membershipId=" + response.Extra.split('|')[1] + "&receiverId=" + response.Id;
window.location.href = url;
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();
}
function PopulateCountryFlagForMobileNumber() {
var getCountryId = $("#" + mId + "ddlCountry option:selected").val();
if (getCountryId !== null && getCountryId !== "" && getCountryId !== "0") {
var getCountry = $("#" + mId + "ddlCountry option:selected").text();
$("#" + mId + "txtSenderMobileNo").removeAttr("disabled");
var code = getCountry.split("(");
code = code[1].split(")")[0];
$("#" + mId + "txtSenderMobileNo").intlTelInput("setCountry", code);
}
}
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, "ContentPlaceHolder1_DDLBankLocation", "", "", "");
//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 CheckForBranchShowIde() {
debugger
var country = $("#" + mId + "ddlCountry option:selected ").text().split('(')[0];
if (country.toUpperCase() === 'NEPAL' || country.toUpperCase() === 'VIETNAM') {
$('#branchSelect').hide();
$('#branchManual').show();
if ($('#ContentPlaceHolder1_ddlPaymentMode').val() === '1' && country.toUpperCase() === 'NEPAL') {
$('#branchSelect').hide();
$('#branchManual').hide();
}
}
else {
$('#branchSelect').show();
$('#branchManual').hide();
}
}