<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>报销单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
        var validateForm;
        var count = 0;
        $(document).ready(function() {

            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                rules:{
                },
                messages:{
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });

           /* laydate.render({
                elem: '#collarDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                format: 'yyyy-MM-dd',
                type : 'date'
            });*/


        });
	</script>
	<style>
		/*超过5个汉字，调整label的长度，以下是配套的*/
		.layui-item .layui-form-label{
			width:90px;
		}
		.form-group .layui-item .layui-input-block,
		.query .layui-input-block {
			margin-left: 116px;
		}
	</style>
</head>
<body>
<div class="single-form">
	<div class="container view-form">
		<form:form id="inputForm" modelAttribute="workItemCollar" action="${ctx}/workitemcollar/workItemCollar/save" method="post" class="form-horizontal" >
			<form:hidden path="id"/>
			<div class="form-group layui-row first">
				<div class="form-group-label"><h2>基础信息</h2></div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>领用人：</label>
					<div class="layui-input-block">
						<form:input id="leader" path="userName" readonly="true" htmlEscape="false" class="form-control  layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>领用编号：</label>
					<div class="layui-input-block">
						<div class="input-group">
							<form:input path="number" htmlEscape="false"  readonly="true"  class="form-control  layui-input"/>
							<span class="input-group-btn">
                                <label class="form-status"><c:choose><c:when test="${not empty workItemCollar.state}">${fns:getDictLabel(workItemCollar.state, 'audit_state', '')}</c:when><c:otherwise>新添</c:otherwise></c:choose></label>
                             </span>
						</div>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>领用日期：</label>
					<div class="layui-input-block">
						<input id="collarDate" name="collarDate"  readonly="readonly" type="text"  maxlength="20" class="laydate-icondate form-control layer-date  layui-input laydate-icon"
							   value="<fmt:formatDate value="${workItemCollar.collarDate}" pattern="yyyy-MM-dd"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>领用部门：</label>
					<div class="layui-input-block">
						<form:input id="officeName" readonly="true" path="officeName" htmlEscape="false" class="form-control   layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12  with-textarea">
					<label class="layui-form-label">领用事由：</label>
					<div class="layui-input-block">
						<form:textarea path="collarFor" cssStyle="resize: none" readonly="true"  htmlEscape="false" rows="4"    maxlength="255" class="form-control "/>
					</div>
				</div>
			</div>

			<div class="form-group layui-row">
				<div class="form-group-label"><h2>物品申请明细</h2></div>
				<%--<div class="layui-item nav-btns">
					<sys:gridselectCatalog url="${ctx}/workcatalogueitem/workCatalogueItem/selectCatalog" id="contentData" title="选择物品目录"
										fieldLabels="" fieldKeys=""  searchLabel="" searchKey="name"></sys:gridselectCatalog>

				</div>--%>
				<div class="layui-item layui-col-xs12 form-table-container" >
					<table id="contentTable" class="table table-bordered table-condensed can-edit no-bottom-margin">
						<thead>
						<tr>
							<th width="200px">物品编号</th>
							<th width="200px">物品名称</th>
							<th width="150px">物品分类</th>
							<th width="200px">规格型号</th>
							<th width="200px">计量单位</th>
							<th width="200px">是否固定资产</th>
							<th width="200px">申请数量</th>
							<th width="200px">发放数量</th>

						</tr>
						</thead>
						<tbody id="workItemCollarCatalogList">
						<c:if test="${not empty workItemCollar.workItemCollarCatalogList}">
							<c:forEach items="${workItemCollar.workItemCollarCatalogList}" var="workItemCollarCatalog" varStatus="index">
								<tr id="workItemCollarCatalogList${index.index}">
									<td class="hide">
										<input id="workItemCollarCatalogList${index.index}_id" name="workItemCollarCatalogList[${index.index}].id" type="hidden" value="${workItemCollarCatalog.id}"/>
										<input id="workItemCollarCatalogList${index.index}_workCatalogueItemid" name="workItemCollarCatalogList[${index.index}].workCatalogueItem.id" type="hidden" value="${workItemCollarCatalog.workCatalogueItem.id}"/>
										<input id="workItemCollarCatalogList${index.index}_delFlag" name="workItemCollarCatalogList[${index.index}].delFlag" type="hidden" value="0"/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_1"  readonly="true"   name="workItemCollarCatalogList[${index.index}].workCatalogueItem.number" type="text" value="${workItemCollarCatalog.workCatalogueItem.number}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_2"  readonly="true"   name="workItemCollarCatalogList[${index.index}].workCatalogueItem.name" type="text" value="${workItemCollarCatalog.workCatalogueItem.name}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_3"  readonly="true"   name="workItemCollarCatalogList[${index.index}].workCatalogueItem.type" type="text" value="${fns:getMainDictLabel(workItemCollarCatalog.workCatalogueItem.type, 'item_type', '')}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_4"  readonly="true"   name="workItemCollarCatalogList[${index.index}].workCatalogueItem.model" type="text" value="${workItemCollarCatalog.workCatalogueItem.model}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_5"  readonly="true"   name="workItemCollarCatalogList[${index.index}].workCatalogueItem.primaryUnit" type="text" value="${fns:getMainDictLabel(workItemCollarCatalog.workCatalogueItem.primaryUnit, 'full_count_unit', '')}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_6" readonly="true"    name="workItemCollarCatalogList[${index.index}].workCatalogueItem.isAssets" type="text" value="${workItemCollarCatalog.workCatalogueItem.isAssets}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_7"    name="workItemCollarCatalogList[${index.index}].applyNum" type="text" value="${workItemCollarCatalog.applyNum}"  readonly="true"   class="form-control  number required"/>
									</td>
									<td>
										<input id="workItemCollarCatalogList${index.index}_8"   name="workItemCollarCatalogList[${index.index}].grantNum" type="text" value="${workItemCollarCatalog.grantNum}" readonly="true"   class="form-control number"/>
									</td>

								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>

				</div>
			</div>

			<div class="form-group layui-row">
				<div class="form-group-label"><h2>固定资产明细</h2></div>
				<%--<div class="layui-item nav-btns">
					<sys:gridselectAssets url="${ctx}/workitem/workItem/selectItem" id="contentData1" title="选择物品一览"
										   fieldLabels="" fieldKeys=""  searchLabel="" searchKey="name"></sys:gridselectAssets>

				</div>--%>
				<div class="layui-item layui-col-xs12 form-table-container" >
					<table id="contentTable1" class="table table-bordered table-condensed can-edit no-bottom-margin">
						<thead>
						<tr>
							<th width="200px">固定资产编号</th>
							<th width="200px">物品名称</th>
							<th width="150px">物品编号</th>
							<th width="150px">物品分类</th>
							<th width="200px">规格型号</th>
							<th width="200px">计量单位</th>
						</tr>
						</thead>
						<tbody id="workItemCollarItemList">
						<c:if test="${not empty workItemCollar.workItemCollarItemList}">
							<c:forEach items="${workItemCollar.workItemCollarItemList}" var="workItemCollarItem" varStatus="index">
								<tr id="workItemCollarItemList${index.index}">
									<td class="hide">
										<input id="workItemCollarItemList${index.index}_id" name="workItemCollarItemList[${index.index}].id" type="hidden" value="${workItemCollarItem.id}"/>
										<input id="workItemCollarItemList${index.index}_workAssetsId" name="workItemCollarItemList[${index.index}].itemId" type="hidden" value="${workItemCollarItem.itemId}"/>
										<input id="workItemCollarItemList${index.index}_delFlag" name="workItemCollarItemList[${index.index}].delFlag" type="hidden" value="0"/>
									</td>
									<td>
										<input id="workItemCollarItemList${index.index}_1"  readonly="true"   name="workItemCollarItemList[${index.index}].itemNumber" type="text" value="${workItemCollarItem.itemNumber}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarItemList${index.index}_2"  readonly="true"   name="workItemCollarItemList[${index.index}].itemName" type="text" value="${workItemCollarItem.itemName}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarItemList${index.index}_3"  readonly="true"   name="workItemCollarItemList[${index.index}].itemCatalogNumber" type="text"  value="${workItemCollarItem.itemCatalogNumber}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarItemList${index.index}_4"  readonly="true"   name="workItemCollarItemList[${index.index}].itemType" type="text"  value="${workItemCollarItem.itemType}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarItemList${index.index}_5"  readonly="true"   name="workItemCollarItemList[${index.index}].itemModel" type="text" value="${workItemCollarItem.itemModel}"   class="form-control "/>
									</td>
									<td>
										<input id="workItemCollarItemList${index.index}_6"  readonly="true"   name="workItemCollarItemList[${index.index}].itemPrimaryUnit" type="text"  value="${workItemCollarItem.itemPrimaryUnit}"  class="form-control "/>
									</td>
								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>

</body>
</html>