<%@ include file="/common/taglibs.jsp"%>
<title><fmt:message key="menu.admin" />-><fmt:message key="menu.admin.departmentsManager" /></title>
<link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/default.css'/>" />
<link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/helptip.css'/>" />
<link rel="stylesheet" type="text/css" media="print" href="<c:url value='/styles/print.css'/>" />
<c:if test="${not empty errorReason}">
<div align="center" style="color: red">
<c:if test="${errorReason=='updateConstraint'}">
<fmt:message key="tcsBox.updateConstraint"/>
</c:if>
<c:if test="${errorReason=='addConstraint'}">
<fmt:message key="tcsBox.addConstraint"/>
</c:if>
</div>
</c:if>
<html:form action="editBoxes.html?method=finishEdit" styleId="TcsboxForm" >
<table class="detail" valign="top">
<c:if test="${from == 'update' or param.handle =='update'}">
<input type="hidden" value="update" name="handle"/>
</c:if >
<c:if test="${from == 'add'}">
<input type="hidden" value="add" name="handle"/>
</c:if >
<!-- <c:set var="pageButtons">
<tr>
<td height="50"></td>
<td class="buttonBar">
<c:if test="${from == 'update'}">
<input type="submit" value='<fmt:message key="button.submit"/>' class="button" />
<input type="hidden" value="update" name="handle"/>
</c:if >
<c:if test="${from == 'add'}">
<input type="submit" value='<fmt:message key="button.submit"/>' class="button" />
<input type="hidden" value="add" name="handle"/>
</c:if >
<input type="reset" value='<fmt:message key="button.reset"/>' class="button"/>
<input type="button" value='<fmt:message key="button.back"/>' class="button" onclick="history.back()"/>
</td>
</tr>
</c:set> -->
<c:if test="${from=='update' or param.handle =='update'}">
<tr>
<th>
<manhourpool:label key="TcsBoxForm.tcs_box_id"/>
</th>
<td>
<html:text property="tcs_box_id" styleId="tcs_box_id" readonly="true"></html:text>
</td>
</tr>
</c:if>
<tr>
<th>
<manhourpool:label key="TcsBoxForm.code"/>
</th>
<td>
<html:text property="tcs_box_code" styleId="tcs_box_code" ></html:text>
</td>
</tr>
<tr>
<th>
<manhourpool:label key="TcsBoxForm.tcs_box_name"/>
</th>
<td>
<html:text property="tcs_box_name" styleId="tcs_box_name" ></html:text>
</td>
</tr>
<tr>
<th>
<manhourpool:label key="TcsBoxForm.companycode"/>
</th>
<td>
<html:select property="company_code" styleId="company_code" onchange="changeCompany_Code(this)">
<html:options collection="companyLst" property="code" labelProperty="name" />
</html:select>
</td>
</tr>
<tr>
<th>
<manhourpool:label key="TcsBoxForm.burea"/>
</th>
<td>
<html:select property="bureau_id" styleId="bureau_id" >
<html:options collection="bureauLst" property="code" labelProperty="name" />
</html:select>
</td>
</tr>
<tr>
<th>
<manhourpool:label key="TcsBoxForm.district"/>
</th>
<td>
<html:select property="district_id" styleId="district_id" >
<html:options collection="districtLst" property="code" labelProperty="name" />
</html:select>
</td>
</tr>
<tr>
<th>
<manhourpool:label key="TcsBoxForm.address"/>
</th>
<td>
<html:text property="tcs_address" styleId="tcs_address" ></html:text>
</td>
</tr>
<c:if test="${from=='update' or param.handle =='update'}">
<tr>
<th>
<manhourpool:label key="chartem.state"/>
</th>
<td>
<html:select property="state" >
<html:options collection="doms" property="column_value" labelProperty="description"/>
</html:select>
</td>
</tr>
</c:if>
</table>
<table align="center">
<!-- <c:out value="${pageButtons}" escapeXml="false"/> --></table>
</html:form>
<script type='text/javascript' src='dwr/interface/bureauManager.js'></script>
<script type='text/javascript' src='dwr/interface/districtManager.js'></script>
<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<script type="text/javascript">
var bureau_on_load=true;
var bureau_id='<c:out value="${tcsBoxForm.bureau_id}"/>';
window.onload=function(){
window.changeCompany_Code(document.all.company_code);
var ppage = window.parent.document.frames['theiframtwo'];
if('<c:out value="${handlesucc}" />'){
ppage.document.getElementById('viewBoxes').submit();
}
}
function changeCompany_Code(sel_obj)
{
var company_code=sel_obj.value;
if(company_code=='')
return;
var param =new Object();
param.company_code=company_code;
bureauManager.getBureauListInDwr(param,showBureau);
districtManager.getDistrictBycompany(company_code,showDistrict);
}
function showBureau(bureaus)
{
// var bureau_id=$('bureau_id').value;
// if(window.bureau_on_load)
// {
// bureau_id='<c:out value="${param.bureau_id}"/>';
// window.bureau_on_load=false;
// }
DWRUtil.removeAllOptions('bureau_id');
var op=document.createElement('option');
op.value='';
op.text='<fmt:message key="task.default" />';
$('bureau_id').options.add(op);
DWRUtil.addOptions('bureau_id',bureaus,'bureau_id','bureau_name');
for(var i=0;i<$('bureau_id').options.length;i++)
{
if($('bureau_id').options[i].value==bureau_id)
{
$('bureau_id').selectedIndex=i;
break;
}
}
}
function showDistrict(dis)
{
var dis_code=$('district_id').value;
if(window.isOnload)
{
dis_code='<c:out value="${taskInfoForm.district_id}"/>';
window.isOnload=false;
}
DWRUtil.removeAllOptions('district_id');
var op=document.createElement('option');
op.value='';
op.text='<fmt:message key="task.default" />';
$('district_id').options.add(op);
DWRUtil.addOptions('district_id',dis,'code','name');
for(var i=0;i<$('district_id').options.length;i++)
{
if($('district_id').options[i].value==dis_code)
{
$('district_id').selectedIndex=i;
break;
}
}
}
</script>