<!--
	The ID "widget-grid" will start to initialize all widgets below 
	You do not need to use widgets if you dont want to. Simply remove 
	the <section></section> and you can use wells or panels instead 
	-->

<!-- widget grid -->
<section id="widget-grid" class="">

	<!-- row -->
	<div class="row">

		<!-- NEW WIDGET START -->
		<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

			<!-- Widget ID (each widget will need unique ID)-->
			<div class="jarviswidget" id="wid-id-4">
				<header>
					<span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>后付款卡券</h2>
				</header>
				<!-- widget div-->
				<div>
					<!-- widget edit box -->
					<div class="jarviswidget-editbox">
						<!-- This area used as dropdown edit box -->
					</div>
					<!-- end widget edit box -->
					<!-- widget content -->
					<div class="widget-body no-padding">
						<div class="dt-toolbar">
                            <div class="col-sm-3">
                                <div class="dataTables_filter">
                                    <select ug-select2 style="width: 250px;;" ng-model="queryParam.cdCompanyId" name="company" ng-change="getCouponList()">
                                        <option value="">--请选择单位--</option>
                                        <option value="{{company.id}}" ng-repeat="company in companyList">{{company.companyName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="dataTables_filter">
                                    <select ug-select2 style="width: 250px;" ng-model="queryParam.customerMangerId" ng-change="getCouponList()"  name="customerManager" >
                                        <option value="">--请选择客服经理--</option>
                                        <option value="{{customerManager.customerMangerId}}" ng-repeat="customerManager in companyCustomerManagers">{{customerManager.customerManger}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="dataTables_filter">
                                    <label>
                                        <select ug-select2 ug-select2-config="ugSelect2Config" style="width: 250px;" ng-change="getCouponList()" ng-model="queryParam.couponCategoryId" name="couponCategoryId" >
                                            <option value="">--请选择卡类别--</option>
                                            <option value="{{category.id}}" ng-repeat="category in categoryList">{{category.categoryName}}</option>
                                        </select>
                                    </label>
                                </div>
                            </div>
							<div class="col-sm-3">
								<div class="dataTables_filter">
									<label>
										<span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
										<input type="search" placeholder="卡号/券号/描述" data-ng-keyup="getCouponList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
								</div>
							</div>
                            <div class="col-sm-3">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="批号" data-ng-keyup="getCouponList()" ng-model="queryParam.batch" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>
							<div class="col-sm-12">
								<button class="btn btn-primary" type="button" data-ng-click="getCouponList()">
									<i class="fa fa-refresh"></i>
									刷新
								</button>
							</div>
						</div>
						<div class="table-responsive">
							<table class="table table-striped table-condensed table-hover smart-form has-tickbox">
								<thead>
								<tr>
									<th>
										<label class="checkbox">
                                            <input type="checkbox" ng-model="isCheckCoupon" ng-true-value="0" ng-false-value="1" ng-change="checkedAllCoupon()" />
											<i></i>
										</label>
									</th>
									<th>序号</th>
									<th>卡券类型</th>
                                    <th>卡劵类别</th>
									<th>卡号/劵号</th>
                                    <th>批号</th>
									<th>充值金额</th>
                                    <th>发放单位</th>
                                    <th>发放客户经理</th>
                                    <th>实收金额</th>
                                    <th>操作</th>
								</tr>
								</thead>
								<tbody>
								<tr ng-repeat="coupon in couponList  | orderBy:'couponType'"  ng-if="couponList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
									<td>
										<label class="checkbox">
                                            <input type="checkbox"
                                                   checklist-model="chooseCoupon"
                                                   ng-change="changeCouponList()"
                                                   checklist-value="coupon">
											<i></i>
										</label>
									</td>
									<td ng-bind="($index+1) +((pageInfoSetting.pageNum -1) * pageInfoSetting.pageSize)"></td>
                                    <td><span ng-if="coupon.couponType == 1">卡</span><span ng-if="coupon.couponType == 2">消费劵</span></td>
                                    <td ng-bind="coupon.categoryName"></td>
									<td ng-bind="coupon.couponNumber"></td>
                                    <td ng-bind="coupon.batch"></td>
                                    <td>{{coupon.couponValue}}</td>
                                    <td ng-bind="coupon.companyName"></td>
                                    <td ng-bind="coupon.managerName"></td>
                                    <td ng-show="show"><input type="text" placeholder="输入完按回车" ng-blur="receivedPrice(coupon)" ng-model="coupon.receivedPrice" class="form-control" aria-controls="dt_basic"></td>
                                    <td ng-show="!show">{{coupon.receivedPrice}}</td>
                                    <td>
                                    <div ng-show="show">
                                        <a href="javascript:void(0);" ng-show="!coupon.receivedPrice > 0" data-ng-click="returnCoupon(coupon)" title="退卡：{{coupon.couponNumber}}">
                                            <span class="glyphicon glyphicon-remove-circle"></span>
                                        </a>
                                    </div>
                                    </td>
                                </tr>
								<tr ng-if="couponList == null || couponList.length == 0">
									<td colspan="11">
										<div>暂无数据</div>
									</td>
								</tr>
								</tbody>
							</table>
						</div>
						<div class="dt-toolbar-footer">
							<div class="col-xs-12 col-sm-12">
								<ug-pagination page-info="pageInfoNoAuditSetting" ></ug-pagination>
							</div>
						</div>
					</div>
					<!-- end widget content -->
				</div>
				<!-- end widget div -->
			</div>
			<!-- end widget -->

		</article>
		<!-- WIDGET END -->

	</div>

	<!-- end row -->
</section>
<!-- end widget grid -->