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.

421 lines
15 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. 
  2. $(document).ready(function () {
  3. //$("#" +mId + "regUp").hide();
  4. $(document).on("change", "#" + mId + "ddlSearchBy", function () {
  5. $("#ContentPlaceHolder1_txtSearchData_aText").val("");
  6. ClearAllInputFields();
  7. $("#" + mId + "regUp").hide();
  8. });
  9. $("#MainContent_BenificiaryAgreement").click(function () {
  10. debugger
  11. if ($("#MainContent_BenificiaryAgreement").is(":checked")) {
  12. $("#" + mId + "register").removeAttr("disabled");
  13. } else {
  14. $("#" + mId + "register").attr("disabled", "disabled");
  15. }
  16. });
  17. $("#" + mId + "ddlPurposeOfRemitance").on("change", function () {
  18. debugger
  19. let purposeValue = $("#" + mId + "ddlPurposeOfRemitance option:selected").val();
  20. if (purposeValue == '11347') {
  21. $("#purposeOtherDiv").show();
  22. } else {
  23. $("#purposeOtherDiv").hide();
  24. }
  25. });
  26. $("#" + mId + "register").click(function () {
  27. var isFormDataValid = CheckFormValidation();
  28. if (isFormDataValid === true) {
  29. var customerSignature = CheckSignatureCustomerFromCustomerRegister();
  30. if (customerSignature === true) {
  31. save();
  32. }
  33. else {
  34. return false;
  35. }
  36. }
  37. else {
  38. return false;
  39. }
  40. });
  41. $("#" + mId + "txtSenderMobileNo").intlTelInput({
  42. nationalMode: true,
  43. formatOnDisplay: false,
  44. utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.3/js/utils.js" // just for formatting/placeholders etc
  45. });
  46. $(document).on("change", "#" + mId + "txtSenderMobileNo", function () {
  47. var input = $("#" + mId + "txtSenderMobileNo");
  48. var mobileNo = input.val();
  49. var countryCode = $(".country.active .dial-code").text();
  50. var maxLength = input.attr("maxLength");
  51. if (mobileNo.indexOf(countryCode) < 0) {
  52. mobileNo = countryCode + mobileNo;
  53. }
  54. if ((mobileNo).length > maxLength) {
  55. alert("Mobile No. Can allow input maxmum " + maxLength + " digit only");
  56. return $(this).val("");
  57. }
  58. //var intlNumber = input.intlTelInput("getNumber", intlTelInputUtils.numberFormat.E164);
  59. $(this).val(mobileNo);
  60. CheckForMobileNumber(this, "Mobile No.");
  61. });
  62. $(document).on("change", "#" + mId + "ddlIdType", function () {
  63. $("#" + mId + "txtIdValue").val("");
  64. idTypeVal = $(this).val();
  65. if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
  66. $("#" + mId + "txtIdValue").removeAttr("disabled");
  67. $("#idNumberErr").show();
  68. }
  69. else {
  70. $("#" + mId + "txtIdValue").attr("disabled", "disabled");
  71. $("#idNumberErr").hide();
  72. $("#" + mId + "ddlIdType").removeAttr("style");
  73. $("#" + mId + "txtIdValue").removeAttr("style");
  74. }
  75. });
  76. $(document).on("change", "#ContentPlaceHolder1_txtSearchData_aSearch", function () {
  77. searchValue = $(this).val();
  78. if (searchValue === null || searchValue === "") {
  79. $("#ContentPlaceHolder1_txtSearchData_aText").val("");
  80. ClearAllInputFields();
  81. $("#" + mId + "regUp").hide();
  82. }
  83. });
  84. });
  85. function ClearAllInputFields() {
  86. $("#" + mId + "ddlCountry").val("");
  87. $("#" + mId + "ddlBenificiaryType").val("4700");
  88. $("#" + mId + "txtEmail").val("");
  89. $("#" + mId + "txtReceiverFName").val("");
  90. $("#" + mId + "txtReceiverMName").val("");
  91. $("#" + mId + "txtReceiverLName").val("");
  92. $("#" + mId + "ddlNativeCountry").val("");
  93. $("#" + mId + "txtReceiverAddress").val("");
  94. $("#" + mId + "txtReceiverCity").val("");
  95. $("#" + mId + "txtContactNo").val("");
  96. $("#" + mId + "txtSenderMobileNo").val("");
  97. $("#" + mId + "txtSenderMobileNo").attr("disabled", "disabled");
  98. $("#" + mId + "ddlIdType").val("");
  99. $("#" + mId + "txtIdValue").val("");
  100. $("#" + mId + "txtPlaceOfIssue").val("");
  101. $("#" + mId + "ddlRelationship").val("");
  102. $("#" + mId + "otherRelationshipTextBox").val("");
  103. $("#" + mId + "ddlPurposeOfRemitance").val("");
  104. $("#" + mId + "ddlPaymentMode").val("");
  105. $("#" + mId + "ddlPayoutPatner").val("");
  106. $("#" + mId + "txtBankName").val("");
  107. $("#" + mId + "txtBenificaryAc").val("");
  108. $("#" + mId + "DDLBankLocation").val("");
  109. $("#" + mId + "txtRemarks").val("");
  110. $("#" + mId + "customerName").text("");
  111. $("#" + mId + "txtMembershipId").text("");
  112. }
  113. function CheckForMobileNumber(nField, fieldName) {
  114. var numberPattern = /^[+]?[0-9]{6,16}$/;
  115. test = numberPattern.test(nField.value);
  116. if (!test) {
  117. alert(fieldName + " Is Not Valid !");
  118. nField.value = "";
  119. return false
  120. }
  121. return true;
  122. }
  123. function CheckForPhoneNumber(nField, fieldName) {
  124. var numberPattern = /^[+]?[0-9]{6,15}$/;
  125. test = numberPattern.test(nField.value);
  126. if (!test) {
  127. alert(fieldName + " Is Not Valid !");
  128. nField.value = "";
  129. return false
  130. }
  131. return true;
  132. }
  133. function ddlCountryChange() {
  134. $("#" + mId + "txtSenderMobileNo").attr("disabled", "disabled");
  135. PopulateCountryFlagForMobileNumber();
  136. PopulatePaymentMethod();
  137. PopulatePayoutPartner();
  138. }
  139. function CallBackAutocomplete(id) {
  140. ClearAllInputFields();
  141. var d = [GetItem(mId + "txtSearchData")[0], GetItem(mId + "txtSearchData")[1].split("|")[0]];
  142. $("#" + mId + "hideCustomerId").val(d[0]);
  143. LoadCustomerInfo(d[0]);
  144. $("#" + mId + "regUp").show();
  145. }
  146. function LoadCustomerInfo(customerId) {
  147. var data = { MethodName: "LoadCustomerInfo", customerId: customerId };
  148. $.ajax({
  149. url: "",
  150. type: "post",
  151. data: data,
  152. dataType: "json",
  153. async: false,
  154. success: function (response) {
  155. if (response != null) {
  156. $("#" + mId + "customerName").text(response[0].fullName);
  157. $("#" + mId + "txtMembershipId").text(response[0].membershipId);
  158. }
  159. },
  160. error: function (error) {
  161. alert("Something went wrong!!!")
  162. }
  163. });
  164. }
  165. function GetCustomerSearchType() {
  166. var searchBy = $("#" + mId + "ddlSearchBy").val()
  167. return searchBy;
  168. }
  169. function PopulatePaymentMethod() {
  170. var data =
  171. {
  172. MethodName: "PopulatePaymentMode",
  173. country: $("#" + mId + "ddlCountry option:selected").text()
  174. };
  175. $.ajax({
  176. url: "",
  177. type: "post",
  178. data: data,
  179. dataType: "json",
  180. async: false,
  181. success: function (response) {
  182. PopulateDDL(response, "MainContent_ddlPaymentMode", "", "", "");
  183. },
  184. error: function (error) {
  185. alert("Something went wrong!!!")
  186. }
  187. })
  188. }
  189. function PopulatePayoutPartner() {
  190. var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
  191. if (pmode == "2") {
  192. $("#" + mId + "receiverAccountNo").show();
  193. $("#agentBankBranchDiv").show();
  194. }
  195. else {
  196. $("#" + mId + "receiverAccountNo").hide();
  197. $("#" + mId + "DDLBankLocation").val("");
  198. $("#agentBankBranchDiv").hide();
  199. }
  200. var data =
  201. {
  202. MethodName: "PopulatePayoutPartner",
  203. country: $("#" + mId + "ddlCountry option:selected").val(),
  204. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").text()
  205. };
  206. $.post("", data, function (response) {
  207. PopulateDDL(response, "MainContent_ddlPayoutPatner", "", "", "");
  208. }).fail(function (error) {
  209. alert("Something went wrong!!!");
  210. });
  211. }
  212. function PopulateDDL(populateData, ddlId, selectedId, selectedText, defaultText) {
  213. var myDDL = document.getElementById(ddlId);
  214. $(myDDL).empty();
  215. var option;
  216. if (defaultText != "") {
  217. option = document.createElement("option");
  218. option.text = defaultText;
  219. option.value = "";
  220. myDDL.options.add(option);
  221. }
  222. for (var i = 0; i < populateData.length; i++) {
  223. option = document.createElement("option");
  224. if (ddlId == "MainContent_ddlPaymentMode") {
  225. option.text = populateData[i].Value;
  226. option.value = populateData[i].Key;
  227. } else if (ddlId == "MainContent_DDLBankLocation") {
  228. option.text = populateData[i].agentName;
  229. option.value = populateData[i].agentId;
  230. } else {
  231. option.text = populateData[i].AGENTNAME;
  232. option.value = populateData[i].bankId;
  233. }
  234. if (selectedId != "" && selectedId == populateData[i].value) {
  235. option.selected = true;
  236. } else if (selectedText != "" && selectedText.toUpperCase() == populateData[i].Key.toUpperCase()) {
  237. option.selected = true;
  238. }
  239. try {
  240. myDDL.options.add(option);
  241. } catch (e) {
  242. alert(e.message);
  243. }
  244. }
  245. }
  246. function showTextBox() {
  247. var res = $("#" + mId + "ddlRelationship").val();
  248. if (res.toUpperCase() == "11339") {
  249. $("#" + mId + "otherRelationDiv").show();
  250. }
  251. else {
  252. $("#" + mId + "otherRelationDiv").hide();
  253. }
  254. }
  255. function CheckFormValidation(e) {
  256. debugger
  257. $("#" + mId + "ddlIdType").removeAttr("style");
  258. $("#" + mId + "txtIdValue").removeAttr("style");
  259. paymentMode = $("#" + mId + "ddlPaymentMode").val();
  260. var reqField = "customerId,ddlCountry,ddlBenificiaryType,txtReceiverFName,txtReceiverLName,txtReceiverAddress,ddlPaymentMode,ddlNativeCountry,";
  261. idTypeVal = $("#" + mId + "ddlIdType").val();
  262. if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
  263. reqField += "ddlIdType,txtIdValue,";
  264. }
  265. let purposeValue = $("#" + mId + "ddlPurposeOfRemitance option:selected").val();
  266. if (purposeValue == '11347') {
  267. reqField += "purposeOther,";
  268. }
  269. if (ValidRequiredField(reqField) === false) {
  270. return false;
  271. }
  272. $("#" + mId + "register").attr("disabled", "disabled");
  273. return true;
  274. }
  275. function save() {
  276. //var addType = "<%=GetReceiverAddType()%>";
  277. var data =
  278. {
  279. MethodName: "SaveReceiverDetails",
  280. customerId: $("#" + mId + "customerId").val(),
  281. nativeCountry: $("#" + mId + "ddlNativeCountry").val(),
  282. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val(),
  283. PayoutPatner: $("#" + mId + "ddlPayoutPatner option:selected").val(),
  284. Country: $("#" + mId + "ddlCountry option:selected").text(),
  285. BenificiaryType: $("#" + mId + "ddlBenificiaryType option:selected").val(),
  286. Email: $("#" + mId + "txtEmail").val(),
  287. ReceiverFName: $("#" + mId + "txtReceiverFName").val(),
  288. ReceiverMName: $("#" + mId + "txtReceiverMName").val(),
  289. ReceiverLName: $("#" + mId + "txtReceiverLName").val(),
  290. ReceiverAddress: $("#" + mId + "txtReceiverAddress").val(),
  291. ReceiverCity: $("#" + mId + "txtReceiverCity").val(),
  292. ContactNo: $("#" + mId + "txtContactNo").val(),
  293. SenderMobileNo: $("#" + mId + "txtSenderMobileNo").val(),
  294. Relationship: $("#" + mId + "ddlRelationship option:selected").val(),
  295. PlaceOfIssue: $("#" + mId + "txtPlaceOfIssue").val(),
  296. TypeId: $("#" + mId + "ddlIdType option:selected").val(),
  297. TypeValue: $("#" + mId + "txtIdValue").val(),
  298. PurposeOfRemitance: $("#" + mId + "ddlPurposeOfRemitance").val(),
  299. OtherPrupose: $("#" + mId + "purposeOther").val(),
  300. BankLocation: $("#" + mId + "DDLBankLocation").val(),
  301. BankName: $("#" + mId + "txtBankName").val(),
  302. BenificaryAc: $("#" + mId + "txtBenificaryAc").val(),
  303. Remarks: $("#" + mId + "txtRemarks").val(),
  304. OtherRelationDescription: $("#" + mId + "otherRelationshipTextBox").val(),
  305. membershipId: $("#" + mId + "hideMembershipId").val(),
  306. ReceiverId: $("#" + mId + "hideBenificialId").val(),
  307. hideCustomerId: $("#" + mId + "hideCustomerId").val(),
  308. hideBenificialId: $("#" + mId + "hideBenificialId").val(),
  309. hddSignatureImage: $("#" + mId + "hddImgURL").val()
  310. };
  311. $.ajax({
  312. url: "",
  313. type: "post",
  314. data: data,
  315. dataType: "json",
  316. success: function (response) {
  317. if (response.ErrorCode == "1") {
  318. alert(response.Msg);
  319. $("#" + mId + "register").prop("disabled", false);
  320. return false;
  321. } else {
  322. alert(response.Msg);
  323. let url = "PrintBeneficiaryDetails.aspx?membershipId=" + response.Extra.split('|')[1] + "&receiverId=" + response.Id;
  324. window.location.href = url;
  325. return true;
  326. }
  327. },
  328. error: function (error) {
  329. alert("Something went wrong!!!");
  330. return false;
  331. }
  332. });
  333. }
  334. var isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
  335. function CallBack(res) {
  336. window.returnValue = res;
  337. if (isChrome) {
  338. window.opener.PostMessageToParentAddReceiver(window.returnValue);
  339. }
  340. window.close();
  341. }
  342. function PopulateCountryFlagForMobileNumber() {
  343. var getCountryId = $("#" + mId + "ddlCountry option:selected").val();
  344. if (getCountryId !== null && getCountryId !== "" && getCountryId !== "0") {
  345. var getCountry = $("#" + mId + "ddlCountry option:selected").text();
  346. $("#" + mId + "txtSenderMobileNo").removeAttr("disabled");
  347. var code = getCountry.split("(");
  348. code = code[1].split(")")[0];
  349. $("#" + mId + "txtSenderMobileNo").intlTelInput("setCountry", code);
  350. }
  351. }
  352. function PopulateLocation() {
  353. var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
  354. if (pmode == "2") {
  355. $("#" + mId + "receiverAccountNo").show();
  356. $("#agentBankBranchDiv").show();
  357. }
  358. else {
  359. $("#" + mId + "receiverAccountNo").hide();
  360. $("#" + mId + "DDLBankLocation").val("");
  361. $("#agentBankBranchDiv").hide();
  362. }
  363. var data =
  364. {
  365. MethodName: "PopulateLocation",
  366. country: $("#" + mId + "ddlCountry option:selected").val(),
  367. pAgent: $("#" + mId + "ddlPayoutPatner option:selected").val(),
  368. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val()
  369. };
  370. $.post("", data, function (response) {
  371. PopulateDDL(response, "MainContent_DDLBankLocation", "", "", "");
  372. }).fail(function (error) {
  373. alert("Something went wrong!!!");
  374. });
  375. }
  376. function CallBackAutocomplete(id) {
  377. ClearAllInputFields();
  378. var d = [GetItem(mId + "txtSearchData")[0], GetItem(mId + "txtSearchData")[1].split('|')[0]];
  379. $("#" + mId + "hideCustomerId").val(d[0]);
  380. LoadCustomerInfo(d[0]);
  381. $("#" + mId + "regUp").show();
  382. }