<!--
	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">
				<!-- 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-2">
                                    <div class="dataTables_filter">
                                        <label>
                                            <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                            <input type="search" placeholder="装箱记录编号/手机号码/收货人" data-ng-keyup="getPackingList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <div class="dataTables_filter">
                                        <label>
                                            <input type="search" placeholder="收货人" data-ng-keyup="getPackingList()" ng-model="queryParam.consigneeName" class="form-control" aria-controls="dt_basic"></label>
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <div class="dataTables_filter">
                                        <div class="dataTables_filter">
                                            <select ug-select2 style="width: 250px;" ng-model="queryParam.managerId" ng-change="getPackingList()"  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"
                                               placeholder="任务开始时间起始日期"
                                               ng-model="queryParam.packingTaskCreateTimeStart"
                                               close-text="关闭"
                                               current-text="今日"
                                               clear-text="清除"
                                               is-open="datepickerSetting.packingTaskCreateTimeStart.opened"
                                               ng-required="true" />
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default" ng-click="open($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"
                                               placeholder="任务开始时间截止日期"
                                               ng-model="queryParam.packingTaskCreateTimeEnd"
                                               close-text="关闭"
                                               current-text="今日"
                                               clear-text="清除"
                                               is-open="datepickerSetting.packingTaskCreateTimeEnd.opened"
                                               ng-required="true" />
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default" ng-click="open($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="getPackingList()">
                                        <i class="fa fa-refresh"></i>
                                        刷新
                                    </button>
                                    <button class="btn btn-primary" type="button" ui-sref="order_packing">
                                        <i class="fa fa-plus"></i>
                                        装箱
                                    </button>
                                </div>
							</div>
						</div>
						<div class="table-responsive">
							<table class="table table-striped table-condensed table-hover smart-form has-tickbox">
								<thead>
								<tr>
									<th width="120">订单编号</th>
                                    <th>客户经理</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="packing in packingList"  ng-if="packingList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
									<td ng-bind="packing.orderNo"></td>
                                    <td ng-bind="packing.managerName"></td>
                                    <td ng-bind="packing.consigneeName"></td>
									<td ng-bind="packing.orderStatusDesc"></td>
									<td ng-bind="packing.packingTaskUsername"></td>
									<td ng-bind="packing.packingTaskCreateTime | date: 'yyyy-MM-dd hh:mm:ss'"></td>
									<td ng-bind="packing.packingTaskStartTime | date: 'yyyy-MM-dd hh:mm:ss'"></td>
									<td ng-bind="packing.packingTaskEndTime | date: 'yyyy-MM-dd hh:mm:ss'"></td>
									<td ng-bind="packing.packingTaskStatusDesc"></td>
									<td>
										<div ng-show="show">
											<a href="javascript:void(0);" data-ng-click="showPackingDetail($index)" title="">
												<span class="fa fa-eye"></span>
											</a>
											<a href="javascript:void(0);" ng-if="packing.orderStatus <4 || packing.orderStatus == 13" ui-sref="order_update({id:packing.id, orderNo:packing.orderNo})" title="编辑：{{order.orderNo}}">
												<span class="fa fa-pencil"></span>
											</a>
										</div>
									</td>
								</tr>
								<tr ng-if="packingList == null || packingList.length == 0">
									<td colspan="7">
										<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 -->


<script type="text/ng-template" id="viewPackingDetail.html">
	<div class="modal-header">
		<h3 class="modal-title">装箱详情</h3>
	</div>
	<div class="modal-body">
		<div class="widget-body">
			<!-- NEW WIDGET START -->
			<article class="col-xs-12 col-sm-12 col-md-6 col-lg-6">

				<!-- Widget ID (each widget will need unique ID)-->
				<div class="jarviswidget">
					<!-- 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>装箱订单号：{{choseOrder.orderNo}}</label><br>
							</div>
							<div class="dt-toolbar">
								<div class="col-sm-12">
									<label>
										<input type="search" placeholder="装箱记录编号/收货人" data-ng-keyup="getPackingOrderItemList()" ng-model="queryParam.packingOrderKeyword" class="form-control" aria-controls="dt_basic">
									</label>
									<button class="btn btn-primary" type="button" data-ng-click="getPackingOrderItemList()">
										<i class="fa fa-refresh"></i>
										刷新
									</button>
								</div>
								<div class="col-sm-12" ng-show="errors" >
									<div class="form-group">
										<div class="col-md-12 error">
											{{errors.message}}
										</div>
									</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 style="text-align: center">已装数量/总数量</th>
										<th>操作</th>
									</tr>
									</thead>
									<tbody>
									<tr ng-repeat="packingOrderItem in packingOrderItemList"
										ng-class="{'chose-tr':choseOrder.choseOrderItem.orderItemId==packingOrderItem.orderItemId}"
										ng-click="choseOrderItem($index)" ng-if="packingOrderItemList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
										<td ng-bind="($index+1) +((orderItemPageInfoSetting.pageNum -1) * orderItemPageInfoSetting.pageSize)"></td>
										<td ng-bind="packingOrderItem.orderNo"></td>
										<td ng-bind="packingOrderItem.itemName"></td>
										<td ng-bind="packingOrderItem.packingStatusDesc"></td>
										<td style="text-align: center" ng-bind="packingOrderItem.packedItemQty +'/' + packingOrderItem.itemQty"></td>
										<td>
										</td>
									</tr>
									<tr ng-if="packingOrderItemList == null || packingOrderItemList.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="orderItemPageInfoSetting" ></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-6 col-lg-6">

				<!-- Widget ID (each widget will need unique ID)-->
				<div class="jarviswidget">
					<!-- 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="col-sm-4">
									<div class="dataTables_filter">
										<label>
											<input type="search" placeholder="UPC" data-ng-keyup="getPackingRecordList()" ng-model="queryParam.packingRecordKeyword" class="form-control" aria-controls="dt_basic"></label>
									</div>
								</div>
								<div class="col-sm-2">
									<button class="btn btn-primary" type="button" data-ng-click="getPackingRecordList()">
										<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>UPC</th>
										<th>装箱编号</th>
										<th>商品名称</th>
										<th>扫描时间</th>
										<th width="40">操作</th>
									</tr>
									</thead>
									<tbody>
									<tr ng-repeat="packingRecord in packingRecordList"  ng-if="packingRecordList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
										<td ng-bind="packingRecord.upc"></td>
										<td ng-bind="packingRecord.packingNo"></td>
										<td ng-bind="packingRecord.itemName"></td>
										<td ng-bind="packingRecord.scanTime | date: 'yyyy-MM-dd hh:mm:ss'"></td>
										<td>
											<div ng-show="show">
												<a href="javascript:void(0);" data-ng-click="removePacking($index)" title="删除">
													<span class="fa fa-trash-o"></span>
												</a>
											</div>
										</td>
									</tr>
									<tr ng-if="packingRecordList == null || packingRecordList.length == 0">
										<td colspan="6">
											<div>暂无数据</div>
										</td>
									</tr>
									</tbody>
								</table>
							</div>
							<div class="dt-toolbar-footer">
								<div class="col-xs-12 col-sm-12">
									<ug-pagination page-info="packingRecordPageInfoSetting" ></ug-pagination>
								</div>
							</div>
						</div>
						<!-- end widget content -->
					</div>
					<!-- end widget div -->
				</div>
				<!-- end widget -->

			</article>
			<!-- WIDGET END -->
		</div>
	</div>
	<div class="modal-footer">
		<button class="btn btn-warning" ng-click="cancel()">关闭</button>
	</div>
</script>