<div class="panel panel-default mg wrapper" ng-controller="paperTaskDetailCtrl" cg-busy="{promise:loading, backdrop:true, message:'加载中'}">
	<div class="panel-body">
		<div class="row">
			<div class="col-md-10">
				<span><b>课程信息：</b>{{task.course.code}} - {{task.course.name}}</span>
				<span class="m-l"><b>教材信息：</b>{{task.book.name}} {{task.book.editor}}  {{task.book.press}}  {{task.book.version}}</span>
			</div>
		</div>
		
		<div class="row">
			<div class="col-md-10">相关人员：{{task.propositionTeacherBean.name}}（命题教师1）
							&nbsp;&nbsp;{{task.auditTeacherBean.name}}（命题教师2）
							&nbsp;&nbsp;{{task.primarySecretaryBean.name}}（学科秘书）
							&nbsp;&nbsp;{{task.typesetterBean.name}}（排版员）</div>
		</div>
		
		<div class="m-t">
			<div class="row m-b">
				<div class="col-md-3 "><strong>试卷编号：{{task.taskNo}}</strong></div>
				<div class="col-md-2"><strong>当前处理人：{{task.curDealerBean.name}}</strong></div>
				<div class="col-md-3"><strong>状态：{{task.statusName}}</strong></div>
			</div>
		</div>
		<div>
			<button type="button" class="btn {{row.finished ? 'btn-success' : 'btn-default'}} btn-arrow-right" ng-repeat="row in paperTaskStatus">
				{{row.value}}
			</button>
		</div>
		
		<div class="m-t panel panel-info">
			<div class="panel-heading">试卷与细目表信息</div>
			<div class="panel-body">
				<span ng-if="task.paperSkeleton == null && task.curDealer == curUser.id ">
					<button class="btn btn-small btn-primary" ng-click="createSkel()">
						<i class="glyphicon glyphicon-th"> 创建细目表</i></button>
				</span>
				<span ng-if="task.paperSkeleton != null">
					<button class="btn btn-small btn-default" ng-click="viewSkel()">
						<i class="glyphicon glyphicon-th"> 查看细目表</i></button>
				</span>
				<span ng-if="task.paperSkeleton != null && task.curDealer == curUser.id ">
					<button class="btn btn-small btn-primary" ng-if="task.status=='TO_CREATE_SKEL'" ng-click="showWorkflowSubmitModal()">提交审核细目表</button>
					<button class="btn btn-small btn-primary" ng-if="task.status=='TO_AUDIT_SKEL'" ng-click="showWorkflowAuditModal()">审核细目表</button>
				</span>
				
				<!-- 开始组卷（命题教师1） -->
				<span ng-if="task.status=='GENERATE_PAPER' && task.pagerConstruct == null && task.curDealer == curUser.id">
					<button class="btn btn-small btn-primary" ng-click="viewPaper()">
						<i class="glyphicon glyphicon-th-list"> 组卷</i></button>
				</span>
				<span ng-if="task.pagerConstruct != null">
					<button class="btn btn-small btn-default" ng-click="viewPaper()">
						<i class="glyphicon glyphicon-th-list"> 查看题卡</i>
					</button>
				</span>
				
				<!-- 提交排版（命题教师1） -->
				<span ng-if="task.status=='GENERATE_PAPER' && task.pagerConstruct != null && task.curDealer == curUser.id">
					<button class="btn btn-small btn-primary" ng-click="submitPaperToTypeset()">提交排版</button>
				</span>
				
				<!-- 预排版时提交排版审核（录入员） -->
				<span ng-if="task.status=='TYPESET' && task.curDealer == curUser.id">
					<button class="btn btn-small btn-primary" ng-click="submitByTypeset()">提交排版审核</button>
				</span>
				
				<!-- 终排版时提交排版审核（录入员） -->
				<span ng-if="task.status=='FINAL_TYPESET' && task.curDealer == curUser.id">
					<button class="btn btn-small btn-primary" ng-click="finalTypesetSubmitByTypeset()">提交排版审核</button>
				</span>
				
				<span ng-if="(task.status=='TO_AUDIT_PAPER' || task.status=='TO_CHECK_PAPER') && task.curDealer == curUser.id">
   					<button class="btn btn-small btn-primary myMargin3" ng-click="showWorkflowAuditModal()">审核试卷</button>
   				</span>
   				
				<span ng-if="(task.status=='TO_ARCHIVE') && task.curDealer == curUser.id">
   					<button class="btn btn-small btn-primary myMargin3" ng-click="showWorkflowAuditModal()">归档试卷</button>
   				</span>
				
				<!-- 试卷下载按钮 -->
				<div class="btn-group m-l" ng-if="task.pagerConstruct.lastWangpingWord != null">
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					<i class="glyphicon glyphicon-download">&nbsp;试卷文档</i> <span class="caret"></span>
					</button>
					<ul class="dropdown-menu">
						<li ng-if="task.pagerConstruct.lastWangpingWord != null && (task.pagerConstruct.lastWangpingWord - 0) > 0">
							<a ng-click="downloadWangpingWord()"> 最新网评卷 </a>
						</li>
						<li ng-if="task.pagerConstruct.lastPaperWord != null && (task.pagerConstruct.lastPaperWord - 0) > 0">
							<a ng-click="downloadPaperWord()"> 最新合卷</a>
						</li>
						<li ng-if="task.pagerConstruct.lastAnswerWord != null && (task.pagerConstruct.lastAnswerWord - 0) > 0">
							<a ng-click="downloadAnswerWord()"> 最新答案 </a>
						</li>
						<li ng-if="1 != 1 && task.pagerConstruct.lastTikaWord != null && (task.pagerConstruct.lastTikaWord - 0) > 0">
							<a ng-click="downloadTikaWord()"> 最新题卡 </a>
						</li>
						<li ng-if="task.typesetter==curUser.id && task.pagerConstruct.tikaType=='SPECIAL' && task.pagerConstruct.lastZhuanyinWord != null && (task.pagerConstruct.lastZhuanyinWord - 0) > 0">
							<a ng-click="downloadZhuanyin(true,1)"> 最新转印说明附件一 </a>
						</li>
						<li ng-if="task.typesetter!=curUser.id && task.pagerConstruct.tikaType=='SPECIAL' && task.pagerConstruct.lastZhuanyinWord != null && (task.pagerConstruct.lastZhuanyinWord - 0) > 0">
							<a ng-click="downloadZhuanyin(false,1)"> 最新转印说明附件一  </a>
						</li>
						<li ng-if="task.typesetter==curUser.id && task.pagerConstruct.tikaType=='SPECIAL' && task.pagerConstruct.lastZhuanyinWord2 != null && (task.pagerConstruct.lastZhuanyinWord2 - 0) > 0">
							<a ng-click="downloadZhuanyin(true,2)"> 最新转印说明附件二 </a>
						</li>
						<li ng-if="task.typesetter!=curUser.id && task.pagerConstruct.tikaType=='SPECIAL' && task.pagerConstruct.lastZhuanyinWord2 != null && (task.pagerConstruct.lastZhuanyinWord2 - 0) > 0">
							<a ng-click="downloadZhuanyin(false,2)"> 最新转印说明附件二</a>
						</li>						
					</ul>
				</div>
				<!-- 试卷上传按钮 -->
				<div class="btn-group" ng-if="task.curDealer == curUser.id && openWordStatus == '1' 
										&& (task.status == 'TYPESET' 
											|| task.status == 'TO_AUDIT_PAPER'
											|| task.status == 'TO_CHECK_PAPER'
											|| task.status == 'FINAL_TYPESET'
											|| task.status == 'TO_ARCHIVE')
											">
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					<i class="glyphicon glyphicon-upload">&nbsp;上传文档</i> <span class="caret"></span>
					</button>
					<ul class="dropdown-menu">
						<li ng-if="task.pagerConstruct.lastWangpingWord != null && (task.pagerConstruct.lastWangpingWord - 0) > 0">
							<a ng-click="showUploadModal('WANGPING')"> 网评卷 </a>
						</li>
						<!-- 
						<li ng-if="task.pagerConstruct.lastPaperWord != null && (task.pagerConstruct.lastPaperWord - 0) > 0">
							<a ng-click="showUploadModal('PAPER')"> 试卷</a>
						</li>
						 -->
						<li ng-if="task.pagerConstruct.lastAnswerWord != null && (task.pagerConstruct.lastAnswerWord - 0) > 0">
							<a ng-click="showUploadModal('ANSWER')"> 答案 </a>
						</li>
						<li ng-if="1 != 1 && task.pagerConstruct.lastTikaWord != null && (task.pagerConstruct.lastTikaWord - 0) > 0">
							<a ng-click="showUploadModal('TIKA')"> 题卡 </a>
						</li>
					</ul>
				</div>
				
				<span ng-if="task.pagerConstruct != null">
					<button class="btn btn-small btn-primary" ng-click="showDifficultyEstimateWindow(task.propositionTeacher == curUser.id)">及格分数预估表</button>
				</span>
				
				<span ng-if="task.pagerConstruct != null && (curUser.id == task.propositionTeacher || curUser.id == task.primarySecretary)">
					<button class="btn btn-small btn-primary" ng-click="showTeacherAssessmentWindow(task.primarySecretary == curUser.id)">教师评价</button>
				</span>
			</div>
			<div class="panel-body" ng-if="task.pagerConstruct != null">
				<div class="col-md-10"><b>答题卡类型：</b>
					<span>
					{{task.pagerConstruct.tikaType==null || task.pagerConstruct.tikaType=='' ? '未设置' : (task.pagerConstruct.tikaType=='NORMAL' ? '通用答题卡':'专用答题卡')}}
					</span>
					<span ng-if="task.typesetter!=curUser.id && task.primarySecretary!=curUser.id && task.curDealer == curUser.id">
						<button class="btn btn-small btn-primary" ng-click="toTikaCfg()">答题卡设置</button>
					</span>
				</div>
			</div>
		</div>
		<!-- 
		<div class="m-t panel panel-info">
			<div class="panel-heading">试卷版本跟踪</div>
			<div class="panel-body">
				<table class="table table-striped">
					<thead>
						<tr>
							<th>上传时间</th>
							<th>上传人</th>
							<th>文档名称</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="history in task.pagerConstruct.paperWordHistories">
							<td>{{history.createdTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
							<td>{{history.createdByBean.name}}</td>
							<td>
								<a href="attachment/download/{{history.attId}}" target="_blank">
									{{history.att.originalName}}
								</a>
							</td>
						</tr>
					</tbody>					
				</table>
			</div>	
		</div>
		 -->
		<div class="m-t panel panel-info">
			<div class="panel-heading">网评卷版本跟踪</div>
			<div class="panel-body">
				<table class="table table-striped">
					<thead>
						<tr>
							<th>上传时间</th>
							<th>上传人</th>
							<th>文档名称</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="history in task.pagerConstruct.wangpingWordHistories">
							<td>{{history.createdTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
							<td>{{history.createdByBean.name}}</td>
							<td>
								<a href="attachment/download/{{history.attId}}" target="_blank">
									{{history.att.originalName}}
								</a>
							</td>
						</tr>
					</tbody>					
				</table>
			</div>	
		</div>
		<div class="m-t panel panel-info">
			<div class="panel-heading">答案版本跟踪</div>
			<div class="panel-body">
				<table class="table table-striped">
					<thead>
						<tr>
							<th>上传时间</th>
							<th>上传人</th>
							<th>文档名称</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="history in task.pagerConstruct.answerWordHistories">
							<td>{{history.createdTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
							<td>{{history.createdByBean.name}}</td>
							<td>
								<a href="attachment/download/{{history.attId}}" target="_blank">
									{{history.att.originalName}}
								</a>
							</td>
						</tr>
					</tbody>					
				</table>
			</div>	
		</div>
		<div class="m-t panel panel-info">
			<div class="panel-heading">题卡版本跟踪</div>
			<div class="panel-body">
				<table class="table table-striped">
					<thead>
						<tr>
							<th>上传时间</th>
							<th>上传人</th>
							<th>文档名称</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="history in task.pagerConstruct.tikaWordHistories">
							<td>{{history.createdTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
							<td>{{history.createdByBean.name}}</td>
							<td>
								<a href="attachment/download/{{history.attId}}" target="_blank">
									{{history.att.originalName}}
								</a>
							</td>
						</tr>
					</tbody>					
				</table>
			</div>	
		</div>
		<div class="m-t panel panel-info" ng-if="task.pagerConstruct.tikaType=='SPECIAL'">
			<div class="panel-heading">转印说明版本跟踪</div>
			<div class="panel-body">
				<table class="table table-striped">
					<thead>
						<tr>
							<th>上传时间</th>
							<th>上传人</th>
							<th>文档名称</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="history in task.pagerConstruct.zhuanyinHistories">
							<td>{{history.createdTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
							<td>{{history.createdByBean.name}}</td>
							<td>
								<a href="attachment/download/{{history.attId}}" target="_blank">
									{{history.att.originalName}}
								</a>
							</td>
						</tr>
					</tbody>					
				</table>
			</div>	
		</div>
		<div class="m-t panel panel-info">
			<div class="panel-heading">试卷流程跟踪</div>
			<div class="panel-body">
				<ul class="list-group">
					<li class="list-group-item" ng-repeat="flow in task.flows">
						{{flow.createdTime | date:'yyyy-MM-dd HH:mm:ss'}}
						<span class="text-success">{{flow.createdByBean.name}}</span>
						{{flow.operName}}
						{{flow.remark != null && flow.remark != '' && flow.remark != 'null' ? '备注:'+ flow.remark : ''}}
					</li>
				</ul>
			</div>	
		</div>
		
	</div>
</div>
