var UpdateProfile = function () { $("#btn-update").on("click", function (e) { if ($("#DayMain").find("span").attr("id") == "Day" || $("#MonthMain").find("span").attr("id") == "Month" || $("#YearMain").find("span").attr("id") == "Year") { var title = isNoteDateRequired + " : "; var desc = "\n" + isDateRequired; alert(title + desc); } else { url = $("UrlUpdate").val(); var result = {}; $.each($('form').serializeArray(), function () { result[this.name] = this.value; }); utility.service("MemberService/UpdateAccountDetail", result, function (response) { var btn = {}; btn[l.OK] = function () { window.location.href = "/" + gv.lang + "/profile"; dialog.close(); }; dialog.info(l.Message, $("#msg").val(), btn); }, function (response) { }); } }) } var UpdateCondition = function () { if (gn != "" && dateOfBirth != "" && contactNo.length > lengthArea) { $("#btn-update").hide(); } else if (gn == "") { $("#btn-update").prop("disabled", true); } if (dateOfBirth != "") { $("#DateOfBirth").attr('readonly', "readonly") } if (contactNo.length > lengthArea) { $("#ContactNumber").attr('readonly', "readonly"); } $("#ContactNumber").bind('input', function (e) { var contact = $("#ContactArea").val(); if (e.currentTarget.value.indexOf("0") > 0) { $(this).val(""); } $("#ContactNo").val(contact + e.currentTarget.value); }) $('#FullName').bind('input', function (e) { if (FullnameValidation(e.currentTarget.value)) { $('#givenName').val(e.currentTarget.value); $("#btn-update").prop("disabled", false); } else { $("#btn-update").prop("disabled", true); } }) } var DropDown = function () { var Temp = ""; var SectionList = ["DayMain", "MonthMain", "YearMain"]; $('body').click(function (e) { var Section = ""; var SectionID = ""; $.each(SectionList, function (key, value) { if (e.target.id === value || $(e.target).parent().attr("id") === value) { Section = value; if (Section == "DayMain" || Section == "MonthMain" || Section == "YearMain") { DateOfBirthSetting(Section); } SectionID = $("#" + value + ""); if (SectionID.find("ul li").length < 5) { SectionID.find("ul").css('overflow', 'hidden'); } else { SectionID.find("ul").css('overflow-y', 'scroll'); } } }); if (Temp != Section) { $("#" + Temp + "").removeClass("yellow"); $("#" + Temp + "").find("ul").fadeOut("fast"); $("#" + Temp + "").find("ul").attr("data-status", "0"); } if (SectionID === "") { $(".size-date").find("ul").fadeOut("fast"); $(".size-date").find("ul").attr("data-status", "0"); } else { if (SectionID.find("ul").attr("data-status") === "0") { SectionID.addClass("yellow"); SectionID.find("ul").fadeIn("fast"); SectionID.find("ul").attr("data-status", "1"); Temp = Section; } else if (SectionID.find("ul").attr("data-status") === "1") { SectionID.removeClass("yellow"); SectionID.find("ul").fadeOut("fast"); SectionID.find("ul").attr("data-status", "0"); } } }); $(".size-date").find("ul li").click(function () { var Section = $(this).parent().parent().attr("id"); $("#" + Section + "").find("span").text($(this).text()); $("#" + Section + "Code").val($(this).attr("id")); if (Section == SectionList[0]) { ByCountry($(this).attr("id")); ContactArea($(this).attr("id")); } if (Section == SectionList[1]) { var id = $(this).attr("id"); ByCurrency(id); ContactArea(id); } }); } var DateOfBirthSetting = function (Section) { var isEighteen = false; var MonthList = l.MonthList; var dateNow = new Date(); if (Section != "DayMain" && Section != "MonthMain" && Section != "YearMain") { Year(isEighteen); Month(isEighteen); Day(isEighteen); } var dChoosen = $("#DayMain").find("span").attr("id"); var dEnd = dateNow.getDate(); var mChoosen = $("#MonthMain").find("span").attr("id"); var mEnd = dateNow.getMonth() + 1; var yChoosen = $("#YearMain").find("span").attr("id"); var yEnd = dateNow.getFullYear() - 18; if (Section == "DayMain") { if (yChoosen >= yEnd) { Day(true); } else { Day(false); } } if (Section == "MonthMain") { if (yChoosen >= yEnd) { Month(true); } else { Month(false); } } if (Section == "YearMain") { if (mChoosen >= mEnd) { Year(true); } else { Year(false); } } function Day(isEighteen) { var m = 31; if (isEighteen) { m = mChoosen >= mEnd ? dateNow.getDate() : 31; } var dayNow = m; $("#DayMain").find("ul").empty(); for (var i = 1; i <= dayNow; i++) { i = (i < 10) ? '0' + i : i; $("#DayMain").find("ul").append("