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.

414 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
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. }).fail(function (error) {
  202. alert("Something went wrong!!!");
  203. });
  204. }
  205. function PopulateDDL(populateData, ddlId, selectedId, selectedText, defaultText) {
  206. var myDDL = document.getElementById(ddlId);
  207. $(myDDL).empty();
  208. var option;
  209. if (defaultText != "") {
  210. option = document.createElement("option");
  211. option.text = defaultText;
  212. option.value = "";
  213. myDDL.options.add(option);
  214. }
  215. for (var i = 0; i < populateData.length; i++) {
  216. option = document.createElement("option");
  217. if (ddlId == "MainContent_ddlPaymentMode") {
  218. option.text = populateData[i].Value;
  219. option.value = populateData[i].Key;
  220. } else if (ddlId == "MainContent_DDLBankLocation") {
  221. option.text = populateData[i].agentName;
  222. option.value = populateData[i].agentId;
  223. } else {
  224. option.text = populateData[i].AGENTNAME;
  225. option.value = populateData[i].bankId;
  226. }
  227. if (selectedId != "" && selectedId == populateData[i].value) {
  228. option.selected = true;
  229. } else if (selectedText != "" && selectedText.toUpperCase() == populateData[i].Key.toUpperCase()) {
  230. option.selected = true;
  231. }
  232. try {
  233. myDDL.options.add(option);
  234. } catch (e) {
  235. alert(e.message);
  236. }
  237. }
  238. }
  239. function showTextBox() {
  240. var res = $("#" + mId + "ddlRelationship").val();
  241. if (res.toUpperCase() == "11339") {
  242. $("#" + mId + "otherRelationDiv").show();
  243. }
  244. else {
  245. $("#" + mId + "otherRelationDiv").hide();
  246. }
  247. }
  248. function CheckFormValidation(e) {
  249. debugger
  250. $("#" + mId + "ddlIdType").removeAttr("style");
  251. $("#" + mId + "txtIdValue").removeAttr("style");
  252. var reqField = "customerId,ddlCountry,ddlBenificiaryType,txtReceiverFName,txtReceiverLName,txtReceiverAddress,ddlPaymentMode,ddlNativeCountry,";
  253. idTypeVal = $("#" + mId + "ddlIdType").val();
  254. if (idTypeVal !== null && idTypeVal !== "" && idTypeVal !== "0") {
  255. reqField += "ddlIdType,txtIdValue,";
  256. }
  257. let purposeValue = $("#" + mId + "ddlPurposeOfRemitance option:selected").val();
  258. if (purposeValue == '11347') {
  259. reqField += "purposeOther,";
  260. }
  261. if (ValidRequiredField(reqField) === false) {
  262. return false;
  263. }
  264. debugger
  265. var pMode = $("#" + mId + "ddlPaymentMode").val();
  266. var pAgent = $("#" + mId + "ddlPayoutPatner").val();
  267. if (pMode == "2") {
  268. if (pAgent == '' || pAgent == undefined || pAgent == null || pAgent == "null") {
  269. $("#" + mId + "ddlPayoutPatner").css('background-color', '#FFCCD2');
  270. swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  271. return false
  272. }
  273. }
  274. $("#" + mId + "register").attr("disabled", "disabled");
  275. return true;
  276. }
  277. function save() {
  278. //var addType = "<%=GetReceiverAddType()%>";
  279. var data =
  280. {
  281. MethodName: "SaveReceiverDetails",
  282. customerId: $("#" + mId + "customerId").val(),
  283. nativeCountry: $("#" + mId + "ddlNativeCountry").val(),
  284. paymentMode: $("#" + mId + "ddlPaymentMode option:selected").val(),
  285. PayoutPatner: $("#" + mId + "ddlPayoutPatner option:selected").val(),
  286. Country: $("#" + mId + "ddlCountry option:selected").text(),
  287. BenificiaryType: $("#" + mId + "ddlBenificiaryType option:selected").val(),
  288. Email: $("#" + mId + "txtEmail").val(),
  289. ReceiverFName: $("#" + mId + "txtReceiverFName").val(),
  290. ReceiverMName: $("#" + mId + "txtReceiverMName").val(),
  291. ReceiverLName: $("#" + mId + "txtReceiverLName").val(),
  292. ReceiverAddress: $("#" + mId + "txtReceiverAddress").val(),
  293. ReceiverCity: $("#" + mId + "txtReceiverCity").val(),
  294. ContactNo: $("#" + mId + "txtContactNo").val(),
  295. SenderMobileNo: $("#" + mId + "txtSenderMobileNo").val(),
  296. Relationship: $("#" + mId + "ddlRelationship option:selected").val(),
  297. PlaceOfIssue: $("#" + mId + "txtPlaceOfIssue").val(),
  298. TypeId: $("#" + mId + "ddlIdType option:selected").val(),
  299. TypeValue: $("#" + mId + "txtIdValue").val(),
  300. PurposeOfRemitance: $("#" + mId + "ddlPurposeOfRemitance").val(),
  301. OtherPrupose: $("#" + mId + "purposeOther").val(),
  302. BankLocation: $("#" + mId + "DDLBankLocation").val(),
  303. BankName: $("#" + mId + "txtBankName").val(),
  304. BenificaryAc: $("#" + mId + "txtBenificaryAc").val(),
  305. Remarks: $("#" + mId + "txtRemarks").val(),
  306. OtherRelationDescription: $("#" + mId + "otherRelationshipTextBox").val(),
  307. membershipId: $("#" + mId + "hideMembershipId").val(),
  308. ReceiverId: $("#" + mId + "hideBenificialId").val(),
  309. hideCustomerId: $("#" + mId + "hideCustomerId").val(),
  310. hideBenificialId: $("#" + mId + "hideBenificialId").val(),
  311. hddSignatureImage: $("#" + mId + "hddImgURL").val()
  312. };
  313. $.ajax({
  314. url: "",
  315. type: "post",
  316. data: data,
  317. dataType: "json",
  318. success: function (response) {
  319. if (response.ErrorCode == "1") {
  320. alert(response.Msg);
  321. $("#" + mId + "register").prop("disabled", false);
  322. return false;
  323. } else {
  324. alert(response.Msg);
  325. let url = "PrintBeneficiaryDetails.aspx?membershipId=" + response.Extra.split('|')[1] + "&receiverId=" + response.Id;
  326. window.location.href = url;
  327. return true;
  328. }
  329. },
  330. error: function (error) {
  331. alert("Something went wrong!!!");
  332. return false;
  333. }
  334. });
  335. }
  336. var isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
  337. function CallBack(res) {
  338. window.returnValue = res;
  339. if (isChrome) {
  340. window.opener.PostMessageToParentAddReceiver(window.returnValue);
  341. }
  342. window.close();
  343. }
  344. function PopulateCountryFlagForMobileNumber() {
  345. var getCountryId = $("#" + mId + "ddlCountry option:selected").val();
  346. if (getCountryId !== null && getCountryId !== "" && getCountryId !== "0") {
  347. var getCountry = $("#" + mId + "ddlCountry option:selected").text();
  348. $("#" + mId + "txtSenderMobileNo").removeAttr("disabled");
  349. var code = getCountry.split("(");
  350. code = code[1].split(")")[0];
  351. $("#" + mId + "txtSenderMobileNo").intlTelInput("setCountry", code);
  352. }
  353. }
  354. function PopulateLocation() {
  355. var pmode = $("#" + mId + "ddlPaymentMode option:selected").val();
  356. if (pmode == "2") {
  357. $("#" + mId + "receiverAccountNo").show();
  358. }
  359. else {
  360. $("#" + mId + "receiverAccountNo").hide();
  361. $("#" + mId + "DDLBankLocation").val("");
  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. }