<style>
	label {
		margin-bottom: 0px;
	}
	.va-top {
		vertical-align: top;
	}
	.text-help {
		color: #CCCCCC;
	}
	.formDate, .toDate, .interval {
		display: inline-block;
	}
	.formDate, .toDate {
		width: 34%;
	}
	.interval {
		width: 28%;
		position: relative;
	}
	.intervalLeftC, .intervalRightC, .intervalLeftU, .intervalRightU {
		display: inline-block;
		height: 2px;
		width: 50%;
		line-height: 0;
	}
	.intervalLeftC {
		background: -webkit-linear-gradient(left, #FFFFFF, #009900);
	}
	.intervalRightC {
		background: -webkit-linear-gradient(right, #FFFFFF, #009900);
	}.intervalLeftU {
		background: -webkit-linear-gradient(left, #FFFFFF, #FF3300);
	}
	.intervalRightU {
		background: -webkit-linear-gradient(right, #FFFFFF, #FF3300);
	}
	
	.replyItem {
		border-left: solid 1px #999999;
		width: 100%;
		height: 40px;
		margin-left: 20px;
		position: relative;
		margin-bottom: 10px;
		vertical-align: middle;
		padding-top: 10px;
	}
	
	.replyTitle {
		margin-left: 30px;
		margin-right: 30px;
		margin-bottom: 5px;
		border-bottom: solid 1px #888888;
	}
	
	.replyItem .replyCircle {
		position: absolute;
		width:10px;
	    height:10px;
	    border: solid 1px #999999;
	    border-radius: 5px;
	    background-color: #FFFFFF;
		top: 0px;
		left: -5px;
	}
	
	.inpuiry tr {
		margin-bottom: 10px;
	}
	
	.input-group-sm>.input-group-addon {
		padding: 5px 5px;
	}
	.border-success {
		border-color: #449d44;
	}
</style>
<div ng-controller="SaleInquiryCtrl">
	<div class="top padding5 bold">
		<a href="#" class="f16 topText">&nbsp;<i class="fa fa-angle-left"></i>&nbsp;单据详情</a>
		<div class="right"><i class="fa fa-reorder"></i>&nbsp;&nbsp;</div>
	</div>
	<div class="orderInfo padding5">
		<table>
			<tr>
				<td class="va-top text-right"><label class="text-black">客户：</label></td>
				<td>
					<span ng-bind="purcInquiry.inquiry.enterprise.enName"></span><br>
					<span class="text-help">{{purcInquiry.inquiry.enterprise.enAddress}} 
						<i class="fa fa-map-marker"></i>
					</span><br>
					<span class="text-help text-num">{{purcInquiry.inquiry.enterprise.enTel}} <i class="fa fa-phone"></i></span>
				</td>
			</tr>
			<tr>
				<td class="va-top text-right"><label class="text-black">单据：</label></td>
				<td>
					<span class="text-num" ng-bind="purcInquiry.inquiry.code"></span> {{purcInquiry.status | status}}<br>
					<span class="text-help text-num">{{purcInquiry.inquiry.date | date:'yyyy-MM-dd'}} </span>
				</td>
			</tr>
			<tr>
				<td class="va-top text-right"><label class="text-black">物料：</label></td>
				<td>
					<span ng-bind="purcInquiry.product.title"></span><br>
					<span class="text-help" ng-bind="purcInquiry.product.spec"></span><br>
					<span class="text-help text-num" ng-bind="purcInquiry.product.code"></span>
				</td>
			</tr>
		</table>
	</div>
	<div class="padding5" style="min-height: 400px; position: relative;">
		<div class="loading"  ng-class="{'in': loading}">
			<i></i>
		</div>
		<div style="border-bottom: solid 1px #398439;margin-bottom: 5px;"><label>报价有效期</label></div>
		<div ng-hide="purcInquiry.fromDate || purcInquiry.toDate" class="text-center text-muted">客户没有指定有效期限!</div>
		<div ng-show="purcInquiry.fromDate || purcInquiry.toDate"  style="color: #009900; padding-top: 10px;">
			<div class="formDate text-right">{{purcInquiry.fromDate | date:'yyyy-MM-dd'}}</div>
			<div class="interval text-center">
				<div style="position: absolute; top: -7px; width: 100%;">客户指定</div>
				<div><div class="intervalLeftC"></div><div class="intervalRightC"></div></div>
			</div>
			<div class="toDate text-left">{{purcInquiry.toDate | date:'yyyy-MM-dd'}}</div>
		</div>
		<div style="padding-top: 10px;">
			<div class="formDate text-right">
				<div class=" input-group input-group-sm input-trigger">
				<input type="text" class="form-control" placeholder="起始日期"
					datepicker-popup="yyyy-MM-dd" is-open="vendFromDateOpen" ng-model="purcInquiry.vendFromDate"
					max-date="purcInquiry.vendToDate" ng-required="true" current-text="今天"
					clear-text="清除" close-text="关闭"
					datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
					ng-focus="openF($event)"> 
				<span class="input-group-btn">
                	<button type="button" class="btn btn-default" ng-click="openF($event)">
                		<i class="glyphicon glyphicon-calendar"></i>
                	</button>
              	</span>
              	</div>
			</div>
			<div class="interval text-center" style="color: #FF3300;">
				<div style="position: absolute; top: -7px; width: 100%;">您指定</div>
				<div><div class="intervalLeftU"></div><div class="intervalRightU"></div></div>
			</div>
			<div class="toDate text-left">
				<div class=" input-group input-group-sm input-trigger">
				<span class="input-group-btn">
                	<button type="button" class="btn btn-default" ng-click="openT($event)">
                		<i class="glyphicon glyphicon-calendar"></i>
                	</button>
              	</span>
				<input type="text" class="form-control" placeholder="截止日期"
					datepicker-popup="yyyy-MM-dd" is-open="vendToDateOpen" ng-model="purcInquiry.vendToDate"
					min-date="purcInquiry.vendFromDate" ng-required="true" current-text="今天"
					clear-text="清除" close-text="关闭"
					datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
					ng-focus="openT($event)"> 
              	</div>
			</div>
		</div>
		<div style="border-bottom: solid 1px #398439;margin-bottom: 5px;"><label>分段报价</label></div>
		<form name="repliesForm">
		<div class="inquiry">
			<table class="table table-condensed table-bordered table-striped text-center ">
				<tr>
					<th style="width: 5%;"><th style="width: 45%;">分段数量({{purcInquiry.product.unit}})</th>
					<th style="width: 40%;">分段单价</th>
					<th>
						<span ng-if="purcInquiry.replies.length<9" class="btn btn-success btn-sm" ng-click="addNewReply(reply)" 
							ng-disabled="(purcInquiry.status!=200) || purcInquiry.custLap">
							&nbsp;<i class="fa fa-plus"></i>&nbsp;
						</span>
					</th>
				</tr>
				<tr ng-repeat="reply in purcInquiry.replies" ng-click="reply.editing = true">
					<td>{{$index + 1}}</td>
					<td>
						<span ng-if="!reply.editing" class="text-num">≥ {{reply.lapQty}}</span>
						<div ng-if="reply.editing" class=" input-group input-group-sm">
							<span class="input-group-addon input-group-addon-sm">≥</span>
							<input type="number" ng-disabled="$first || purchInqiry.custLap" 
								class="form-control" ng-model="reply.lapQty" required min="0">
		              	</div>
					</td>
					<td>
						<span ng-if="!reply.editing" class="text-num">{{reply.price | currency: symbol(purcInquiry.currency)}}
						</span>
						<div ng-if="reply.editing" class=" input-group input-group-sm">
							<span class="input-group-addon input-group-addon-sm">{{symbol(purcInquiry.currency)}}</span>
							<input type="number" class="form-control" ng-model="reply.price" required min="0">
		              	</div>
					</td>
					<td class="text-left">
						<span ng-if="!$first" class="btn btn-warning btn-sm" 
							ng-click="purcInquiry.replies.splice($index,1)" ng-disabled="purcInquiry.status != 200">
							&nbsp;<i class="fa fa-trash"></i>&nbsp;
						</span>
					</td>
				</tr>
			</table>
		</div>
		<div style="width: 100%;" class="btn-group" role="group">
				<button style="width: 40%;" type="button" class="btn btn-default border-success" 
					ng-click="reply(purcInquiry)" ng-disabled="purcInquiry.status != 200 || repliesForm.$invalid">
					<label><i class="fa fa-reply"></i> 回复</label>
				</button>
  				<button style="width: 60%;" type="button" class="btn btn-default" ng-click="save(purcInquiry)" 
  					ng-disabled="purcInquiry.status != 200 || repliesForm.$invalid">
  					<label><i class="fa fa-save"></i> 保存</label>
  				</button>
		</div>
		</form>
	</div>
</div>