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.

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