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.

447 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
  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. var country = $("#" + mId + "ddlCountry option:selected ").text().split('(')[0];
  122. if (country.toUpperCase() === 'NEPAL' || country.toUpperCase() === 'VIETNAM') {
  123. $('#branchSelect').hide();
  124. $('#branchManual').show();
  125. }
  126. else {
  127. $('#branchSelect').show();
  128. $('#branchManual').hide();
  129. }
  130. PopulateCountryFlagForMobileNumber();
  131. PopulatePaymentMethod();
  132. PopulatePayoutPartner();
  133. }
  134. function CallBackAutocomplete(id) {
  135. ClearAllInputFields();
  136. var d = [GetItem(mId + "txtSearchData")[0], GetItem(mId + "txtSearchData")[1].split("|")[0]];
  137. $("#" + mId + "hideCustomerId").val(d[0]);
  138. LoadCustomerInfo(d[0]);
  139. $("#" + mId + "regUp").show();
  140. }
  141. function LoadCustomerInfo(customerId) {
  142. var data = { MethodName: "LoadCustomerInfo", customerId: customerId };
  143. $.ajax({
  144. url: "",
  145. type: "post",
  146. data: data,
  147. dataType: "json",
  148. async: false,
  149. success: function (response) {
  150. if (response != null) {
  151. $("#" + mId + "customerName").text(response[0].fullName);
  152. $("#" + mId + "txtMembershipId").text(response[0].membershipId);
  153. }
  154. },
  155. error: function (error) {
  156. alert("Something went wrong!!!")
  157. }
  158. });
  159. }
  160. function GetCustomerSearchType() {
  161. var searchBy = $("#" + mId + "ddlSearchBy").val()
  162. return searchBy;
  163. }
  164. function PopulatePaymentMethod() {
  165. var data =
  166. {
  167. MethodName: "PopulatePaymentMode",
  168. country: $("#" + mId + "ddlCountry option:selected").text()
  169. };
  170. $.ajax({
  171. url: "",
  172. type: "post",
  173. data: data,
  174. dataType: "json",
  175. async: false,
  176. success: function (response) {
  177. PopulateDDL(response, "MainContent_ddlPaymentMode", "", "", "");
  178. },
  179. error: function (error) {
  180. alert("Something went wrong!!!")
  181. }
  182. })
  183. }
  184. function PopulatePayoutPartner() {
  185. var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
  186. if (pmode == "2") {
  187. $("#" + mId + "receiverAccountNo").show();
  188. }
  189. else {
  190. $("#" + mId + "receiverAccountNo").hide();
  191. $("#" + mId + "DDLBankLocation").val("");
  192. }
  193. var data =
  194. {
  195. MethodName: "PopulatePayoutPartner",
  196. country: $("#" + mId + "ddlCountry option:selected").val(),
  197. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").text()
  198. };
  199. $.post("", data, function (response) {
  200. PopulateDDL(response, "MainContent_ddlPayoutPatner", "", "", "");
  201. PopulateLocation();
  202. }).fail(function (error) {
  203. alert("Something went wrong!!!");
  204. });
  205. }
  206. function GetBankBranch() {
  207. var bankId = $("#" + mId + "recDdlPayoutPatner option:selected").val();
  208. var countryId = $("#" + mId + "recDdlCountry option:selected").val();
  209. var pMode = $("#" + mId + "recDdlPaymentMode option:selected").val();
  210. var data = { MethodName: "GetBankBranch", bankId: bankId, countryId: countryId, pMode: pMode, branchId: null };
  211. $.post("", data, function (response) {
  212. PopulateBranchDDL(response, "MainContent_DDLBankLocation", "Select Branch");
  213. });
  214. }
  215. function PopulateDDL(populateData, ddlId, selectedId, selectedText, defaultText) {
  216. var myDDL = document.getElementById(ddlId);
  217. $(myDDL).empty();
  218. var option;
  219. if (defaultText != "") {
  220. option = document.createElement("option");
  221. option.text = defaultText;
  222. option.value = "";
  223. myDDL.options.add(option);
  224. }
  225. for (var i = 0; i < populateData.length; i++) {
  226. option = document.createElement("option");
  227. if (ddlId == "MainContent_ddlPaymentMode") {
  228. option.text = populateData[i].Value;
  229. option.value = populateData[i].Key;
  230. } else if (ddlId == "MainContent_DDLBankLocation") {
  231. option.text = populateData[i].agentName;
  232. option.value = populateData[i].agentId;
  233. } else {
  234. option.text = populateData[i].AGENTNAME;
  235. option.value = populateData[i].bankId;
  236. }
  237. if (selectedId != "" && selectedId == populateData[i].value) {
  238. option.selected = true;
  239. } else if (selectedText != "" && selectedText.toUpperCase() == populateData[i].Key.toUpperCase()) {
  240. option.selected = true;
  241. }
  242. try {
  243. myDDL.options.add(option);
  244. } catch (e) {
  245. alert(e.message);
  246. }
  247. }
  248. }
  249. function showTextBox() {
  250. var res = $("#" + mId + "ddlRelationship").val();
  251. if (res.toUpperCase() == "11339") {
  252. $("#" + mId + "otherRelationDiv").show();
  253. }
  254. else {
  255. $("#" + mId + "otherRelationDiv").hide();
  256. }
  257. }
  258. function CheckFormValidation(e) {
  259. debugger
  260. $("#" + mId + "ddlIdType").removeAttr("style");
  261. $("#" + mId + "txtIdValue").removeAttr("style");
  262. var reqField = "customerId,ddlCountry,ddlBenificiaryType,txtReceiverFName,txtReceiverLName,txtReceiverAddress,ddlPaymentMode,ddlNativeCountry,";
  263. idTypeVal = $("#" + mId + "ddlIdType").val();
  264. if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
  265. reqField += "ddlIdType,txtIdValue,";
  266. }
  267. let purposeValue = $("#" + mId + "ddlPurposeOfRemitance option:selected").val();
  268. if (purposeValue == '11347') {
  269. reqField += "purposeOther,";
  270. }
  271. if (ValidRequiredField(reqField) === false) {
  272. return false;
  273. }
  274. debugger
  275. var pMode = $("#" + mId + "ddlPaymentMode").val();
  276. var pAgent = $("#" + mId + "ddlPayoutPatner").val();
  277. if (pMode == "2") {
  278. if (pAgent == '' || pAgent == undefined || pAgent == null || pAgent == "null") {
  279. $("#" + mId + "ddlPayoutPatner").css('background-color', '#FFCCD2');
  280. swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  281. return false
  282. }
  283. }
  284. $("#" + mId + "register").attr("disabled", "disabled");
  285. return true;
  286. }
  287. function save() {
  288. //var addType = "<%=GetReceiverAddType()%>";
  289. var data =
  290. {
  291. MethodName: "SaveReceiverDetails",
  292. customerId: $("#" + mId + "customerId").val(),
  293. nativeCountry: $("#" + mId + "ddlNativeCountry").val(),
  294. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val(),
  295. PayoutPatner: $("#" + mId + "ddlPayoutPatner option:selected").val(),
  296. Country: $("#" + mId + "ddlCountry option:selected").text(),
  297. BenificiaryType: $("#" + mId + "ddlBenificiaryType option:selected").val(),
  298. Email: $("#" + mId + "txtEmail").val(),
  299. ReceiverFName: $("#" + mId + "txtReceiverFName").val(),
  300. ReceiverMName: $("#" + mId + "txtReceiverMName").val(),
  301. ReceiverLName: $("#" + mId + "txtReceiverLName").val(),
  302. ReceiverAddress: $("#" + mId + "txtReceiverAddress").val(),
  303. ReceiverCity: $("#" + mId + "txtReceiverCity").val(),
  304. ContactNo: $("#" + mId + "txtContactNo").val(),
  305. SenderMobileNo: $("#" + mId + "txtSenderMobileNo").val(),
  306. Relationship: $("#" + mId + "ddlRelationship option:selected").val(),
  307. PlaceOfIssue: $("#" + mId + "txtPlaceOfIssue").val(),
  308. TypeId: $("#" + mId + "ddlIdType option:selected").val(),
  309. TypeValue: $("#" + mId + "txtIdValue").val(),
  310. PurposeOfRemitance: $("#" + mId + "ddlPurposeOfRemitance").val(),
  311. OtherPrupose: $("#" + mId + "purposeOther").val(),
  312. BankLocation: $("#" + mId + "DDLBankLocation").val(),
  313. BankName: $("#" + mId + "txtBankName").val(),
  314. BenificaryAc: $("#" + mId + "txtBenificaryAc").val(),
  315. Remarks: $("#" + mId + "txtRemarks").val(),
  316. OtherRelationDescription: $("#" + mId + "otherRelationshipTextBox").val(),
  317. membershipId: $("#" + mId + "hideMembershipId").val(),
  318. ReceiverId: $("#" + mId + "hideBenificialId").val(),
  319. hideCustomerId: $("#" + mId + "hideCustomerId").val(),
  320. hideBenificialId: $("#" + mId + "hideBenificialId").val(),
  321. hddSignatureImage: $("#" + mId + "hddImgURL").val()
  322. };
  323. $.ajax({
  324. url: "",
  325. type: "post",
  326. data: data,
  327. dataType: "json",
  328. success: function (response) {
  329. if (response.ErrorCode == "1") {
  330. alert(response.Msg);
  331. $("#" + mId + "register").prop("disabled", false);
  332. return false;
  333. } else {
  334. alert(response.Msg);
  335. let url = "PrintBeneficiaryDetails.aspx?membershipId=" + response.Extra.split('|')[1] + "&receiverId=" + response.Id;
  336. window.location.href = url;
  337. return true;
  338. }
  339. },
  340. error: function (error) {
  341. alert("Something went wrong!!!");
  342. return false;
  343. }
  344. });
  345. }
  346. var isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
  347. function CallBack(res) {
  348. window.returnValue = res;
  349. if (isChrome) {
  350. window.opener.PostMessageToParentAddReceiver(window.returnValue);
  351. }
  352. window.close();
  353. }
  354. function PopulateCountryFlagForMobileNumber() {
  355. var getCountryId = $("#" + mId + "ddlCountry option:selected").val();
  356. if (getCountryId !== null && getCountryId !== "" && getCountryId !== "0") {
  357. var getCountry = $("#" + mId + "ddlCountry option:selected").text();
  358. $("#" + mId + "txtSenderMobileNo").removeAttr("disabled");
  359. var code = getCountry.split("(");
  360. code = code[1].split(")")[0];
  361. $("#" + mId + "txtSenderMobileNo").intlTelInput("setCountry", code);
  362. }
  363. }
  364. function PopulateLocation() {
  365. var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
  366. if (pmode == "2") {
  367. $("#" + mId + "receiverAccountNo").show();
  368. }
  369. else {
  370. $("#" + mId + "receiverAccountNo").hide();
  371. $("#" + mId + "DDLBankLocation").val("");
  372. }
  373. var data =
  374. {
  375. MethodName: "PopulateLocation",
  376. country: $("#" + mId + "ddlCountry option:selected").val(),
  377. pAgent: $("#" + mId + "ddlPayoutPatner option:selected").val(),
  378. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val()
  379. };
  380. $.post("", data, function (response) {
  381. PopulateDDL(response, "MainContent_DDLBankLocation", "", "", "");
  382. //GetBankBranch();
  383. }).fail(function (error) {
  384. alert("Something went wrong!!!");
  385. });
  386. }
  387. function PopulateBranchDDL(populateData, recDdlId, defaultText) {
  388. var myrecDdl = document.getElementById(recDdlId);
  389. $(myrecDdl).empty();
  390. var option;
  391. if (defaultText != "") {
  392. option = document.createElement("option");
  393. option.text = defaultText;
  394. option.value = "";
  395. myrecDdl.options.add(option);
  396. }
  397. for (var i = 0; i < populateData.length; i++) {
  398. option = document.createElement("option");
  399. option.text = populateData[i].agentName;
  400. option.value = populateData[i].agentId;
  401. try {
  402. myrecDdl.options.add(option);
  403. } catch (e) {
  404. alert(e.message);
  405. }
  406. }
  407. }