<%@ Page Title="" Language="C#" MasterPageFile="~/Package/package.Master" AutoEventWireup="true"
    CodeBehind="EndParcelList.aspx.cs" Inherits="GxHub.Wms.Abroad.Web.Packages.EndParcelList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title><%=GetText("直发包裹列表") %> </title>
     <link href="../Scripts/bootstrap_3.3.7_css_bootstrap.min[1].css" rel="stylesheet" />
     <link href="../Scripts/bootstrap-select.min.css" rel="stylesheet" />
     <script src="../Scripts/jquery-3.3.1.min.js"></script>
     <script src="../Scripts/bootstrap_3.3.7_js_bootstrap.min.js"></script>
     <script src="../Scripts/bootstrap-select.min.js"></script>
    <script>
        //使用checkbox当做全选反选
        function check_all_not() {
            var check = $("#checkboxAll").prop("checked");
            $(".check").prop("checked", check);
        }

        //当明细复选框状态改变时，检查是否需要更新全选框状态
        $(document).ready(function() {
            $(".check").change(function() {
                var allChecked = $(".check").length === $(".check:checked").length;
                $("#checkboxAll").prop("checked", allChecked);
            });
        });

        //生成提货单
        function generatePickupList() {
            var selectedIds = [];
            $(".check:checked").each(function() {
                selectedIds.push($(this).val());
            });
            
            if (selectedIds.length === 0) {
                alert("请至少选择一个包裹");
                return;
            }

            console.log(selectedIds);
            
            //添加确认对话框
            if (confirm("确定要生成提货单吗？\n已选择 " + selectedIds.length + " 个包裹")) {
                $("#<%= hfSelectedIds.ClientID %>").val(selectedIds.join(','));
                // 在后端执行生成提货单
                __doPostBack('btnGeneratePickupList', '');
            }
        }

         // 新增末端大包
         function CreateBigBag(){
           // 执行按钮
           document.getElementById('<%= btnCreateBigBag.ClientID %>').click();
         }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <yee:PageTitle ID="title" runat="server" >
         <ShortCuts>
            <!--<a href="InternationalBigPackageEnter.aspx">返回</a> 
            <a href="javascript:CreateBigBag()" title="新增">新增</a>-->
            <a href="InternationalBigPackageEnter.aspx" title="新增"><%=GetText("新增") %></a>
        </ShortCuts>
    </yee:PageTitle>
    <yee:MessageBox ID="msg" runat="server">
    </yee:MessageBox>

    <asp:Button ID="btnCreateBigBag" runat="server" style="display: none;" CssClass="button" OnClick="btnCreateBigBag_Click" Text="新增末端大包" />

    <!--查询版面-->
    <div class="query">
        <asp:HiddenField ID="hfSelectedIds" runat="server" />
        <table cellpadding="0" cellspacing="0" border="0" >
            <tr>
                <td class="queryLeft">
                    <%=GetText("站点") %>：
                </td>
                <td class="queryRigth">
                    <yee:UserFrontWebsitesDropDownList ID="ddlWebSite" runat="server"   OnSelectedIndexChanged="ddlWebSite_SelectedIndexChanged"  AutoPostBack="true">
                    </yee:UserFrontWebsitesDropDownList>  
                </td>

                <td class="queryLeft">
                    <%=GetText("大包类型") %>：
                </td>
                <td class="queryRigth">
                    <asp:DropDownList ID="ddlParcelType"  runat="server"></asp:DropDownList>
                </td>

                <td class="queryLeft">
                    <%=GetText("大包号") %>：
                </td>
                <td class="queryRigth">
                    <asp:TextBox ID="txtBigBagID" runat="server"></asp:TextBox>
                </td>
               
                
                <td colspan="2" >
                    <yee:Button ID="btnQuery" runat="server" OnClick="btnQuery_Click" />
                </td>
            </tr>
         <!--   <tr>
                <input type="button" value="生成提货单" onclick="generatePickupList()" class="btn btn-primary" />
            </tr> -->
        </table>
    </div>
    <asp:Repeater ID="rptMaster" runat="server" OnItemCommand="rptMaster_ItemCommand"
        OnItemDataBound="rptMaster_ItemDataBound">
        <HeaderTemplate>
            <table class="table" cellpadding="0" cellspacing="0" border="0" id="table">
                <thead>
                    <tr>
                        <td class="tbheader" width="40px"><input type="checkbox" id="checkboxAll" class="checkboxAll" onclick="check_all_not()" /></td>
                      <!--  <td class="tbheader"><%=GetText("状态") %></td> -->
                        <td class="tbheader"><%=GetText("类型") %></td>
                        <td class="tbheader"><%=GetText("大包号") %></td>
                        <td class="tbheader"><%=GetText("大包长") %></td>
                        <td class="tbheader"><%=GetText("大包宽") %></td>
                        <td class="tbheader"><%=GetText("大包高") %></td>
                        <td class="tbheader"><%=GetText("长度单位") %></td>
                        <td class="tbheader"><%=GetText("小包数量") %></td>
                        <td class="tbheader"><%=GetText("大包重量") %></td>
                        <td class="tbheader"><%=GetText("重量单位") %></td>
                        <td class="tbheader"><%=GetText("创建信息") %></td>
                        <td class="tbheader"><%=GetText("修改信息") %></td>
                        <td class="tbheader" rowspan="2" colspan="2"><%=GetText("操作")%></td>
                    </tr>
                </thead>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="tbrow" >
                <td class="tbpost">
                    <input type="checkbox" id="cbItem" runat="server" class="check" value='<%#Eval("BigBagID")%>' clientidmode="Static"/>
                    <asp:HiddenField ID="hfId" runat="server" Value='<%# Eval("Id")%>' />
                    <asp:HiddenField ID="hfParcelStatus" runat="server" Value='<%# Eval("ParcelStatus")%>' />
                </td>
                <td class="tbpost" style="text-align:center"><%#Eval("ParcelTypeName")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagID")%></td>
             <!--   <td class="tbpost" style="text-align:center"><%#Eval("ParcelStatusName")%></td> -->
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagLength")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagWidth")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagHeight")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagDimensionUnit")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("ParcelQuantity")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagWeight")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagWeightUnit")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("CreatedOn")%> </br><%#Eval("CreatedByName")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("ModifiedOn")%> </br><%#Eval("ModifiedByName")%></td>
                <td class="tbpost">
                    <asp:LinkButton ID="lbnDetail" CommandName="Detail" CommandArgument='<%#Eval("Id")%>' runat="server"><%=GetText("详情") %></asp:LinkButton>
                    <asp:LinkButton ID="lbnReceived" CommandName="Received" CommandArgument='<%#Eval("Id")%>' Text="接收干线" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnPrebooking" CommandName="Prebooking" CommandArgument='<%#Eval("Id")%>' Text="预计订舱" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnPreadvice" CommandName="Preadvice" CommandArgument='<%#Eval("Id")%>' Text="完成订舱" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnExportCustomClearanceStart" CommandName="ExportCustomClearanceStart" CommandArgument='<%#Eval("Id")%>' Text="开始出口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnExportCustomClearanceSuccess" CommandName="ExportCustomClearanceSuccess" CommandArgument='<%#Eval("Id")%>' Text="完成出口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnUplifted" CommandName="Uplifted" CommandArgument='<%#Eval("Id")%>' Text="航班起飞" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnArrived" CommandName="Arrived" CommandArgument='<%#Eval("Id")%>' Text="航班到达" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnImportCustomClearanceStart" CommandName="ImportCustomClearanceStart" CommandArgument='<%#Eval("Id")%>' Text="开始进口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnImportCustomClearanceSuccess" CommandName="ImportCustomClearanceSuccess" CommandArgument='<%#Eval("Id")%>' Text="完成进口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnHandovered" CommandName="Handovered" CommandArgument='<%#Eval("Id")%>' Text="交出末端" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnAddChild" CommandName="AddChild" CommandArgument='<%#Eval("Id")%>' runat="server"><%=GetText("录入子包") %></asp:LinkButton>
                    <asp:LinkButton ID="lbnDelete" CommandName="Delete" CommandArgument='<%#Eval("Id")%>' runat="server" OnClientClick="return confirm('确定删除数据?')" ><%=GetText("删除")%></asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr class="tbrowalter">
                <td class="tbpost">
                    <input type="checkbox" id="cbItem" runat="server" class="check" value='<%#Eval("BigBagID")%>' clientidmode="Static" />
                    <asp:HiddenField ID="hfId" runat="server" Value='<%# Eval("Id")%>' />
                    <asp:HiddenField ID="hfParcelStatus" runat="server" Value='<%# Eval("ParcelStatus")%>' />
                </td>
                <td class="tbpost" style="text-align:center"><%#Eval("ParcelTypeName")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagID")%></td>
           <!--     <td class="tbpost" style="text-align:center"><%#Eval("ParcelStatusName")%></td> -->
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagLength")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagWidth")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagHeight")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagDimensionUnit")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("ParcelQuantity")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagWeight")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("BigBagWeightUnit")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("CreatedOn")%> </br><%#Eval("CreatedByName")%></td>
                <td class="tbpost" style="text-align:center"><%#Eval("ModifiedOn")%> </br><%#Eval("ModifiedByName")%></td>
                <td class="tbpost">
                    <asp:LinkButton ID="lbnDetail" CommandName="Detail" CommandArgument='<%#Eval("Id")%>' runat="server"><%=GetText("详情") %></asp:LinkButton>
                    <asp:LinkButton ID="lbnReceived" CommandName="Received" CommandArgument='<%#Eval("Id")%>' Text="接收干线" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnPrebooking" CommandName="Prebooking" CommandArgument='<%#Eval("Id")%>' Text="预计订舱" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnPreadvice" CommandName="Preadvice" CommandArgument='<%#Eval("Id")%>' Text="完成订舱" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnExportCustomClearanceStart" CommandName="ExportCustomClearanceStart" CommandArgument='<%#Eval("Id")%>' Text="开始出口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnExportCustomClearanceSuccess" CommandName="ExportCustomClearanceSuccess" CommandArgument='<%#Eval("Id")%>' Text="完成出口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnUplifted" CommandName="Uplifted" CommandArgument='<%#Eval("Id")%>' Text="航班起飞" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnArrived" CommandName="Arrived" CommandArgument='<%#Eval("Id")%>' Text="航班到达" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnImportCustomClearanceStart" CommandName="ImportCustomClearanceStart" CommandArgument='<%#Eval("Id")%>' Text="开始进口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnImportCustomClearanceSuccess" CommandName="ImportCustomClearanceSuccess" CommandArgument='<%#Eval("Id")%>' Text="完成进口清关" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnHandovered" CommandName="Handovered" CommandArgument='<%#Eval("Id")%>' Text="交出末端" runat="server"></asp:LinkButton>
                    <asp:LinkButton ID="lbnAddChild" CommandName="AddChild" CommandArgument='<%#Eval("Id")%>' runat="server"><%=GetText("录入子包") %></asp:LinkButton>
                    <asp:LinkButton ID="lbnDelete" CommandName="Delete" CommandArgument='<%#Eval("Id")%>' runat="server" OnClientClick="return confirm('确定删除数据?')" ><%=GetText("删除")%></asp:LinkButton>
                </td>
            </tr>
        </AlternatingItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
    <!--列表-->
    <yee:Pager ID="Pager1" runat="server" PageSize="10" PagerType="1" OnPageIndex_Changed="Pager1_PageIndex_Changed" />
     
</asp:Content>
