<%@ Page Title="" Language="C#" MasterPageFile="~/Car/car.Master" AutoEventWireup="true" CodeBehind="newcar.aspx.cs" Inherits="Car.Car.newcar" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:HiddenField runat="server" ID="hf_myemail" />

    <h3>车辆申请</h3>
    <style>
        .ca {
         height:60px;
        }
        .noborder {
         border:0px; 
        }
        .line {
         border-bottom:solid 1px #888;
        }
    </style>

    <table width="100%">
        <tr valign="top">
            <td>
 <table class="table">
        <tr>
            <th>
               <span class="red">*</span>出车事由：
            </th>

            <td colspan="3">
                <asp:TextBox ID="txt_reason"  Width="600px" CssClass="form-control" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
       <th>
               出发时间：
            </th>

            <td colspan="3" >
                从 <asp:TextBox runat="server" CssClass="form-control _dt" style="width:140px; display:inline-block" ID="txt_startdate"></asp:TextBox>

                <asp:DropDownList ID="ddl_starttime"   runat="server" CssClass="form-control" style="width:120px; display:inline-block"  ></asp:DropDownList>
             
                
                  到
                 <asp:TextBox runat="server" CssClass="form-control _dt" style="width:140px; display:inline-block" ID="txt_enddate"></asp:TextBox>
                 <asp:DropDownList ID="ddl_endtime" runat="server" CssClass="form-control" style="width:120px; display:inline-block"  ></asp:DropDownList>
             
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>人数</b>
           
                <asp:TextBox runat="server" ID="txt_num"  Text="1" CssClass="form-control" style="width:80px; display:inline-block" ></asp:TextBox>
            </td>
        </tr>

        <tr>
            <th>
            去时线路：</th>
            
              <td>
            从 <asp:TextBox runat="server" Text="公司" CssClass="form-control"  ClientIDMode="Static" style="width:130px; display:inline-block" ID="txt_from1"></asp:TextBox>
                到  <asp:TextBox runat="server" CssClass="form-control" ClientIDMode="Static"  style="width:130px; display:inline-block" ID="txt_to1"></asp:TextBox>
                  <img src="images/marker.png" style="width:25px; cursor:pointer"
                       onclick="Pop('../map/address.aspx', 850, 550, '公司地图');return false;"
                       />
           

            </td>
            <th>
                去时途径(可填)
            </th>
            <td>
                  <p class="form-control-static">
                <asp:TextBox runat="server" CssClass="noborder line"  Width="100px" ID="txt_address1"></asp:TextBox>
                  <asp:TextBox runat="server" CssClass="noborder line"    Width="100px"  ID="txt_address2"></asp:TextBox>
                  <asp:TextBox runat="server" CssClass="noborder line"   Width="100px"  ID="txt_address3"></asp:TextBox>
</p>
            </td>


        </tr>


     <tr>
         
             <th>
        回时线路：
            </th>
            <td>
                 从 <asp:TextBox runat="server" CssClass="form-control" ClientIDMode="Static"  style="width:130px; display:inline-block" ID="txt_from2"></asp:TextBox>
                 到 <asp:TextBox runat="server"  Text="公司"  ClientIDMode="Static"  CssClass="form-control" style="width:130px; display:inline-block" ID="txt_to2"></asp:TextBox>
          
            </td>
         <th>
             回时途径(可填)
         </th>
         <td>

                           <p class="form-control-static">
                <asp:TextBox runat="server" CssClass="noborder line"  Width="100px"   ID="txt_address6"></asp:TextBox>
                  <asp:TextBox runat="server" CssClass="noborder line"    Width="100px"  ID="txt_address7"></asp:TextBox>
                  <asp:TextBox runat="server" CssClass="noborder line"   Width="100px"  ID="txt_address8"></asp:TextBox>
</p>
         </td>
     </tr>

     
     <tr>

       <th> 用车类型：
    </th>

            <td colspan="3">
                <asp:RadioButtonList runat="server" Width="200px" ID="rbl_usecartype" RepeatDirection="Horizontal" RepeatColumns="2">
                    <asp:ListItem Text="市内" Selected="True" Value="市内"></asp:ListItem>
                       <asp:ListItem Text="外地"  Value="外地"></asp:ListItem>
                </asp:RadioButtonList>
            </td>
</tr>









     <asp:PlaceHolder runat="server" ID="ph_apply_select_car">

    


        
     <tr>
         <td style="background-color:#f5f5f5" colspan="4">
              
         </td>
     </tr>
     <tr>
         <th>
             车辆选择
         </th>
         <td colspan="3">
             <table class="table" id="tbl_calist">
                 <tr>
                     <th>ID</th>
                     <th>车辆名称</th>
                       <th>车牌号</th>
                       <th>容纳人数</th>
                       <th>颜色</th>
                       <th>司机姓名</th>
                       <th>司机手机</th>
                       <th>司机头像</th>
                       <th style="display:none"></th>
                 </tr>
            
             <asp:Repeater runat="server" ID="rpt_car">
                 <ItemTemplate>
                    <tr>
                          <td> 
                              <input type="checkbox" onclick="setcar(this)"  class="cargroup" value="<%#Eval("id") %>" />

                          </td>
                        <td><%#Eval("carname") %></td>
                          <td><%#Eval("carnum") %></td>
                          <td><%#Eval("num") %></td>
                          <td><%#Eval("color") %></td>
                          <td><%#Eval("displayname") %></td>
                          <td><%#Eval("tel") %></td>
                          <td><img src='<%#Eval("avtor") %>' class="ca"/> </td>
                         <td style="display:none"><%#Eval("uid") %></td>
                    </tr>
                 </ItemTemplate>

             </asp:Repeater>


 </table>
         </td>

     </tr>

  </asp:PlaceHolder>















     
     <tr>
         <td style="background-color:#f5f5f5" colspan="4">
              
         </td>
     </tr>
     

      

     <tr>
         <th>
             联系人：
         </th>
         <td colspan="3">
              <p class="form-control-static">
   
               <asp:TextBox runat="server" ID="txt_contactname"    CssClass="noborder line" />  
               <asp:TextBox runat="server" ID="txt_contactdept"     CssClass="noborder line "/> 
              <asp:TextBox runat="server" ID="txt_contacttel"     CssClass="noborder line"  />  
              <asp:TextBox runat="server" ID="txt_contactemail"     CssClass="noborder line" />  
          </p>

         </td>

     </tr>

          <tr>
              
         <th>
             其他说明：
         </th>

         <td colspan="3">
             <asp:TextBox runat="server" CssClass="form-control" TextMode="MultiLine" Width="600px" Height="60" ID="txt_specialrequire"></asp:TextBox>

         </td>
     </tr>


     
       <tr>
         <td style="background-color:#f5f5f5" colspan="4">
              
         </td>
     </tr>




     <tr>
         <th>
             直属主管审批：
         </th>
         <td>
             <asp:DropDownList runat="server"  AppendDataBoundItems="true" CssClass="form-control" Width="250px" ID="ddl_audit1">
                 <asp:ListItem Text="" Value="0"></asp:ListItem>


             </asp:DropDownList>

             <asp:RequiredFieldValidator runat="server" ID="rq1" ControlToValidate="ddl_audit1" ForeColor="Red"
                  InitialValue="" ErrorMessage="请选择具体人员或者留空"
                  Display="Dynamic" 
                 ></asp:RequiredFieldValidator>

         </td>
         <td colspan="2">
             如果需要直属主管审批，请选择审批人员，为空则直接跳过审批
         </td>
         </tr>

     <tr>

          <th>
            部门经理审批：
         </th>
         <td>
             <asp:DropDownList runat="server" CssClass="form-control" Width="250px" ID="ddl_audit2">
                  <asp:ListItem Text="" Value="0"></asp:ListItem>

             </asp:DropDownList>

               <asp:RequiredFieldValidator runat="server" ID="rv2" ControlToValidate="ddl_audit2" ForeColor="Red"
                  InitialValue="" ErrorMessage="请选择具体人员或者留空"
                  Display="Dynamic" 
                 ></asp:RequiredFieldValidator>

         </td>
           <td colspan="2">
              如果需要部门经理审批，请选择审批人员，为空则直接跳过审批
         </td>
     </tr>




     


 <tr>

          <th>
           行政派车：
         </th>
         <td>
             <asp:DropDownList enabled=false runat="server" CssClass="form-control" Width="250px" ID="ddl_audit3">
          <asp:ListItem Text="行政派车专员" Value=""></asp:ListItem>

             </asp:DropDownList>

         </td>
           <td colspan="2">
                为了合理分配资源，行政部门会对车辆进行调度安排。
         </td>
     </tr>





     <tr>

         <td colspan="4"  align="center">

             <asp:button runat="server" ID="save" Text="提交" 
                 
                
                  CssClass="btn btn-primary" OnClick="save_Click"/>
         </td>

     </tr>
    </table>

            </td>

            <td width="200px">
                <div style="margin-left:20px; line-height:30px;">
                <b>实用小工具</b> <br />
                <a href="#" onclick=" Pop('../map/company.aspx', 850, 550, '公司地图');">(1)公司地图</a> <br />
  <a href="#" onclick=" Pop('../map/Realtime_Road.aspx', 850, 550, '实时路况');">(2)实时路况</a> <br />

                     <a href="###" onclick=" Pop('http://i.tianqi.com/index.php?c=code&id=12&bdc=%23FFFFFF&icon=1&num=5', 550, 150, '天气预报');">(3)天气预报</a> <br />

            </div>
            </td>
        </tr>

    </table>
   
    <input type="hidden" name="__carid" id="__carid"  value="0"/>
     <input type="hidden" name="__carname" id="__carname"  value="未分配"/>
     <input type="hidden" name="__duid" id="__duid"   value="0"/>
     <input type="hidden" name="__dusername" id="__dusername"  value="未分配"/>
      <input type="hidden" name="__dtel" id="__dtel"   value=""/>


    <script>

        function setaddress(d)
        {
            $("#txt_to1").val(d);
            $("#txt_from2").val(d);
            layer.closeAll();
        }


        $("#txt_to1").keyup(
       function () {
           $("#txt_from2").val($("#txt_to1").val());
          }
      );


        $("#txt_from1").keyup(
           function () {
        $("#txt_to2").val($("#txt_from1").val());
          }
      );


         





    </script>












    
     <asp:PlaceHolder runat="server" ID="ph_apply_select_car2">



    <script>



        function InitBookList() {
            $(".cargroup").change(
              function () {
                  var ischeck = $(this).prop("checked");
                  if (ischeck) {
                      $(".cargroup").prop("checked", false);
                      $(this).prop("checked", true);
                  }
              }
           )
        }



        $(document).ready(
        function () {

            InitBookList();

        });










        function setcar(obj) {
            _carid = $(obj).val();
            var _tr = $(obj).parent().parent();
            var tds = $(_tr).children();
            var _carname = $(tds[1]).html();
            var _duid = $(tds[8]).html();
            var _dtel = $(tds[6]).html();
            var _duname = $(tds[5]).html();
            $("#__carid").val(_carid);
            $("#__carname").val(_carname);
            $("#__duid").val(_duid);
            $("#__dusername").val(_duname);
            $("#__dtel").val(_dtel)

            var _day = document.getElementById('<%=txt_startdate.ClientID %>').value;
            var _start = _day + " " + document.getElementById('<%=ddl_starttime.ClientID %>').value;
            var _end = _day + " " + document.getElementById('<%=ddl_endtime.ClientID %>').value;

            return;

            $.get("IsFree.aspx",
                     { carid: _carid, start: _start, end: _end, mod: "new", random: Math.random() },
                     function (result) {
                         if (result == "1") {

                         }
                         else {

                             layer.alert("系统检测到您当前的选择使用冲突，但您仍可以申请，具体以管理员分配车辆为准");

                         }

                     }
                   );



        }


        function ischkCar() {


            var ischeck = $(".cargroup").is(":checked")
            if (ischeck) {
                return true;
            }
            else {

                layer.alert("请选择所需要的车辆");
                return false;
            }




        }

    </script>

</asp:PlaceHolder>





</asp:Content>
