<!--
	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 -->
		<!-- WIDGET END -->
        <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">
                <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="table-responsive">
                            <table class="table table-condensed table-hover smart-form has-tickbox">
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>包装工</th>
                                    <th width="80">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="packageUser in packageUserList"
                                    ng-class="{'chose-tr':packageUser.customerMangerId==currentCustomer.customerMangerId}"
                                    ng-if="packageUserList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
                                    <td ng-bind="($index+1) +((pageInfoSetting.pageNum -1) * pageInfoSetting.pageSize)"></td>
                                    <td ng-bind="packageUser.customerManger"></td>
                                    <td>
                                        <div>
                                            <a href="javascript:void(0);" data-ng-click="chosePackageUser($index)" title="选择">
                                                <span class="fa fa-inbox"></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>
        <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">
                <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.customerManger}}</label>
                        </div>
                        <div class="dt-toolbar">
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="产品名称" data-ng-keyup="getPurchaseList()" ng-model="queryParam.keyword" 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="getPurchaseList()">
                                    <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></th>
                                    <th width="80">采购单号</th>
                                    <th>产品名称</th>
                                    <th>规格</th>
                                    <th>数量</th>
                                    <th>已分配数</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="purchase in purchaseList"  ng-if="purchaseList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
                                    <td></td>
                                    <td ng-bind="purchase.purchaseCode"></td>
                                    <td ng-bind="purchase.itemName"></td>
                                    <td>{{purchase.spec}}{{purchase.itemUnit}}</td>
                                    <td ng-bind="purchase.totalItemQty"></td>
                                    <td ng-bind="purchase.distributeValue"></td>
                                    <td>
                                        <div>
                                            <a href="javascript:void(0);" data-ng-click="openDistributeModal(purchase)" title="分配：{{purchase.itemName}}">
                                                <span class="fa fa-inbox"> 分配</span>
                                            </a>
                                        </div>
                                    </td>
                                </tr>

                                <tr ng-if="purchaseList == null || purchaseList.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="pageInfoSetting" ></ug-pagination>
                            </div>
                        </div>
                    </div>
                    <!-- end widget content -->
                </div>
                <!-- end widget div -->
            </div>
            <!-- end widget -->

        </article>
	</div>

	<!-- end row -->

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

<script type="text/ng-template" id="addPackageTask.html">
    <div class="modal-header">
        <h3 class="modal-title">下发包装任务</h3>
    </div>
    <div class="modal-body">
        <div class="widget-body">

            <form class="form-horizontal" ug-validate="addPackageTaskForm" name="addPackageTaskForm" novalidate="">

                <fieldset>
                    <div class="form-group">
                        <label class="col-md-2 control-label">产品名称<span class="vaild">*</span></label>
                        <div class="col-md-10">
                            <input class="form-control" required="true"  readonly data-rule-minlength="1" data-rule-maxlength="20" ng-model="packageTask.itemName" name="name" placeholder="产品名称" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">总数量<span class="vaild">*</span></label>
                        <div class="col-md-10">
                            <input class="form-control" required="true" readonly data-rule-minlength="1" data-rule-maxlength="20" ng-model="packageTask.totalItemQty" name="name" placeholder="未分配数" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">未分配数<span class="vaild">*</span></label>
                        <div class="col-md-10">
                            <input class="form-control" required readonly data-rule-minlength="1" data-rule-maxlength="20" ng-model="packageTask.noDistributeValue" name="name" placeholder="未分配数" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">包装工人<span class="vaild">*</span></label>
                        <div class="col-md-10">
                            <input class="form-control" required="true"  readonly data-rule-minlength="1" data-rule-maxlength="20" ng-model="packageTask.jobUserName" name="name" placeholder="包装工人" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">下发数<span class="vaild">*</span></label>
                        <div class="col-md-10">
                            <input class="form-control" required  data-rule-number="true" ng-model="packageTask.countValue" name="name" placeholder="分配数" type="text">
                        </div>
                    </div>
                    <div class="form-group" ng-if="errors">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-10 error">
                            {{errors.message}}
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit" data-ng-click="savePackageTask()">
            <i class="fa fa-save"></i>
            保存
        </button>
        <button class="btn btn-warning" ng-click="cancel()">关闭</button>
    </div>
</script>