<%@page contentType="text/html; charset=utf-8"%>
<%@page import="org.acts.common.*" %>
<%@page import="org.acts.common.html.*" %>
<%@page import="org.acts.member.*" %>
<%@include file="../include/check_login.jsp" %>

<%@include file="../include/header.jsp" %>
<%msbean.setCur_menu_node(MenuItem.MEMBER__INFO);%>
<script type="text/javascript">
function update(){
	var f=document.stdform;
	var login_id=f.login_id.value;
	var receipt_type=f.receipt_type.value;
	var email=f.email.value;
	if(login_id!=""){
		if(login_id.length < <%=Constants.MIN_MEMBER_LOGIN_ID_LENGTH%>
			|| login_id.length > <%=Constants.MAX_MEMBER_LOGIN_ID_LENGTH%>
			){
	        alert("<%=Lang.set("自定登入編號必須是"+Constants.MIN_MEMBER_LOGIN_ID_LENGTH+"至"+Constants.MAX_MEMBER_LOGIN_ID_LENGTH+"個字元之間,而且是英文或數字")%>");
	        return;
	    }
	}
	if(receipt_type=="<%=Member.RECEIPT_TYPE__EMAIL%>" && email==""){
		alert("<%=Lang.set("若使用電郵收據,必須輸入電郵地址")%>");
		return;
	}
	opSubmit("member.MemberModuleAction.info.update");
}
</script>
<%@include file="../include/body.jsp" %>
<%
Member member=new Member(msbean.getMember_seq());

HtmlTable t=new HtmlTable(new int[]{950});
t.addTitleCell(0,0,msbean.getCur_menu_node().getName());
t.toHtml(out);

t=new HtmlTable(new int[]{125,350,125,350});
t.addDescCell(0,0,"會眾編號");
t.addDescCell(0,1,"姓名1");
t.addDescCell(0,2,"自定登入編號");
t.addDescCell(0,3,"電郵");

TextBox loginNameTB=new TextBox("login_id",msbean.getSData("login_id"),200,Constants.MAX_MEMBER_LOGIN_ID_LENGTH);
TextBox emailTB=new TextBox("email",msbean.getSData("email"),200,50);
String loginNameMsg="(編號必須是"+Constants.MIN_MEMBER_LOGIN_ID_LENGTH+"至"+Constants.MAX_MEMBER_LOGIN_ID_LENGTH+"個字元之間，而且是英文或數字。清空代表不使用自定登入編號)";
if(request.getParameter("err")!=null && request.getParameter("err").equals("login_id")){
	loginNameMsg="<font color=red>這個登入編號已被使用</font>"+loginNameMsg;
}

t.addLCell(1,0,member.getMember_id());
t.addLCell(1,1,member.getName1());
t.addLCell(1,2,3,1,Lang.set(loginNameTB.toHtml()+loginNameMsg));
t.addLCell(1,3,emailTB.toHtml());

t.addDescCell(2,0,"受洗日期");
t.addDescCell(2,1,"姓名2");
t.addDescCell(2,3,"收據形式");

SelectMenu receipt_typeSM=new SelectMenu("receipt_type",SelectMenu.buildItemsByMap(Member.RECEIPT_TYPE_MAP),"name","code",msbean.getSData("receipt_type"));
receipt_typeSM.setNilItemEnable(false);

t.addLCell(3,0,TimeUtil.getStringByDate(member.getBaptist_date()));
t.addLCell(3,1,member.getName2());
t.addLCell(3,3,receipt_typeSM);

t.toHtml(out);
%>

<center>
<%
(new EmptySpace(15,15)).toHtml(out);
(new Button("確定","update()")).toHtml(out);
%>
</center>

<%@include file="../include/footer.jsp" %>