<!--
	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-3 col-lg-3">

			<!-- Widget ID (each widget will need unique ID)-->
			<div class="jarviswidget" id="wid-id-4">
				<!-- widget options:
                usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

                data-widget-colorbutton="false"
                data-widget-editbutton="false"
                data-widget-togglebutton="false"
                data-widget-deletebutton="false"
                data-widget-fullscreenbutton="false"
                data-widget-custombutton="false"
                data-widget-collapsed="true"
                data-widget-sortable="false"

                -->
				<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="row">
                                <div class="col-sm-4">
                                    <div class="dataTables_filter">
                                        <label>
                                            <input type="search" placeholder="姓名" data-ng-keyup="getCustomerManagersList()" ng-model="queryParam.customerKeyword" class="form-control" aria-controls="dt_basic"></label>
                                    </div>
                                </div>
							</div>
                            <div class="row">
                                <div class="col-sm-2">
                                    <button class="btn btn-primary" type="button" data-ng-click="getCustomerManagersList()">
                                        <i class="fa fa-refresh"></i>
                                        刷新
                                    </button>
                                </div>
                            </div>
						</div>
						<div class="table-responsive">
							<table class="table table-condensed table-hover smart-form has-tickbox">
								<thead>
								<tr>
									<th>序号</th>
									<th width="120">负责人</th>
									<th>待操作</th>
									<th>操作中</th>
									<th>已完成</th>
									<th>合计</th>
									<th width="80">操作</th>
								</tr>
								</thead>
								<tbody>
								<tr ng-repeat="companyCustomer in companyCustomerManagers"
									ng-click="chosePackingCustomer($index)"
									ng-class="{'chose-tr':companyCustomer.actorId==currentCustomer.actorId}"
									title="点击选择为当前装箱负责人"
									ng-if="companyCustomerManagers.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
									<td ng-bind="($index+1) +((packingTaskPageInfoSetting.pageNum -1) * packingTaskPageInfoSetting.pageSize)"></td>
									<td ng-bind="companyCustomer.actorName"></td>
									<td ng-bind="companyCustomer.readyCount"></td>
									<td ng-bind="companyCustomer.executingCount"></td>
									<td ng-bind="companyCustomer.finishedCount"></td>
									<td ng-bind="companyCustomer.totalCount"></td>
									<td>
										<div >

										</div>
									</td>
								</tr>
								<tr ng-if="companyCustomerManagers == null || companyCustomerManagers.length == 0">
									<td colspan="4">
										<div>暂无数据</div>
									</td>
								</tr>
								</tbody>
							</table>
						</div>
						<div class="dt-toolbar-footer">
							<div class="col-xs-12 col-sm-12">
								<ug-pagination page-info="packingTaskPageInfoSetting" ></ug-pagination>
							</div>
						</div>
					</div>
					<!-- end widget content -->
				</div>
				<!-- end widget div -->
			</div>
			<!-- end widget -->

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

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

			<!-- Widget ID (each widget will need unique ID)-->
			<div class="jarviswidget" id="wid-id-4">
				<!-- widget options:
                usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

                data-widget-colorbutton="false"
                data-widget-editbutton="false"
                data-widget-togglebutton="false"
                data-widget-deletebutton="false"
                data-widget-fullscreenbutton="false"
                data-widget-custombutton="false"
                data-widget-collapsed="true"
                data-widget-sortable="false"

                -->
				<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="alert alert-info no-margin fade in">
							<label>装箱负责人：{{currentCustomer.actorName}}     <a ng-show="currentCustomer.customerManger" href="#" ng-click="resetCurrentCustomer()">重选</a></label>
						</div>
						<div class="dt-toolbar">
                            <div class="row">
                                <div class="col-md-2">
                                    <div class="dataTables_filter">
                                        <label>
                                            <input type="search" placeholder="订单号" data-ng-keyup="getOrderList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
                                    </div>
                                </div>
                                <div class="col-md-2">
                                    <div class="dataTables_filter">
                                        <label>
                                            <input type="search" placeholder="收货人" data-ng-keyup="getOrderList()" ng-model="queryParam.consigneeName" class="form-control" aria-controls="dt_basic"></label>
                                    </div>
                                </div>
                                <div class="col-md-2">
                                    <div class="dataTables_filter">
                                        <div class="dataTables_filter">
                                            <select ug-select2 style="width: 250px;" ng-model="queryParam.managerId" ng-change="getOrderList()"  name="managerId" >
                                                <option value="">--请选择客服经理--</option>
                                                <option value="{{manager.customerMangerId}}" ng-repeat="manager in managers">{{manager.customerManger}}</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-2">
                                    <div class="input-group">
                                        <input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" datepicker-localdate
                                               placeholder="配送起始时间"
                                               ng-model="queryParam.appointmentTimeStart"
                                               close-text="关闭"
                                               current-text="今日"
                                               clear-text="清除"
                                               is-open="datepickerSetting.appointmentTimeStart.opened"
                                               ng-required="true" />
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default" ng-click="openDate($event, 0)"><i class="glyphicon glyphicon-calendar"></i></button>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-2">
                                    <div class="input-group">
                                        <input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" datepicker-localdate
                                               placeholder="配送截止时间"
                                               ng-model="queryParam.appointmentTimeEnd"
                                               close-text="关闭"
                                               current-text="今日"
                                               clear-text="清除"
                                               is-open="datepickerSetting.appointmentTimeEnd.opened"
                                               ng-required="true" />
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default" ng-click="openDate($event, 1)"><i class="glyphicon glyphicon-calendar"></i></button>
                                        </div>
                                    </div>
                                </div>

                            </div>
							<div class="row">
                                <div class="col-sm-2">
                                    <button class="btn btn-primary" type="button" data-ng-click="getOrderList()">
                                        <i class="fa fa-refresh"></i>
                                        刷新
                                    </button>
                                </div>
                                <div class="col-sm-2">
                                    <button class="btn btn-primary" btn-loading="saveBtnLoading" type="button" data-ng-click="batchBindPackingTask()">
                                        <i class="fa fa-inbox"></i>
                                        批量分配
                                    </button>
                                </div>
							</div>
						</div>
						<div class="table-responsive margin-top-10">
							<table class="table table-condensed table-hover smart-form has-tickbox">
								<thead>
								<tr>
                                    <th style="width : 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox" ng-model="chooseAllCheck.isCheckOrder" ng-true-value="0" ng-false-value="1" ng-change="checkedAllOrder()" />
                                            <i></i>
                                        </label>
                                    </th>
									<th>序号</th>
									<th width="120">订单编号</th>
                                    <th>客户经理</th>
                                    <th>收货人</th>
                                    <th>批次号</th>
									<th>装箱任务负责人</th>
                                    <th>订单状态</th>
									<th>分配状态</th>
									<th>配送时间</th>
									<th width="80">操作</th>
								</tr>
								</thead>
								<tbody>
								<tr ng-repeat="order in orderList"  ng-if="orderList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
                                    <td style="width : 20px;">
                                        <label class="checkbox" ng-if="order.packingTaskStatus == null && order.orderStatus != 1">
                                            <input type="checkbox"
                                                   checklist-model="chooseOrder"
                                                   checklist-before-change="changeOrderList()"
                                                   checklist-value="order"
                                                    >
                                            <i></i>
                                        </label>
                                    </td>
									<td ng-bind="($index+1) +((pageInfoSetting.pageNum -1) * pageInfoSetting.pageSize)"></td>
									<td ng-bind="order.orderNo"></td>
                                    <td ng-bind="order.managerName"></td>
                                    <td ng-bind="order.consigneeName"></td>
                                    <td ng-bind="order.batchNo"></td>
									<td ng-bind="order.packingTaskUsername"></td>
                                    <td ng-bind="order.orderStatusDesc"></td>
									<td>
										<div ng-if="order.packingTaskStatus != null">已分配</div>
										<div ng-if="order.packingTaskStatus == null">待分配</div>
									</td>
									<td ng-bind="order.appointmentTime | date: 'yyyy-MM-dd'"></td>
									<td>
										<div ng-show="order.packingTaskStatus == null && order.orderStatus != 1" >
                                            <button class="btn btn-primary" btn-loading="order.saveBtnLoading" data-ng-click="bindPackingTask($index)" title="分配">
                                                <i class="fa fa-inbox"></i>分配
                                            </button>
										</div>
										<div ng-show="order.packingTaskStatus == 0" >
											<a href="javascript:void(0);" data-ng-click="unbindPackingTask($index)" title="取消">
												<span class="fa fa-empire"> </span>
											</a>
										</div>
									</td>
								</tr>
								<tr ng-if="orderList == null || orderList.length == 0">
									<td colspan="5">
										<div>暂无数据</div>
									</td>
								</tr>
								</tbody>
							</table>
						</div>
						<div class="dt-toolbar-footer">
							<div class="col-xs-12 col-sm-12">
								<ug-pagination page-info="pageInfoSetting" ></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 -->