<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/WeeklyReport.master" AutoEventWireup="true" CodeBehind="WeeklyReport_Edit.aspx.cs" Inherits="helpdesk.helpdesk.WeeklyReport_Edit" %>
<%@ Register src="~/UserControls/HtmlEdit.ascx" tagname="HtmlEdit" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">


     
      


    <table  style=" vertical-align:top" class="table">

    <tr>
    <td width=150px>
       报告类型 
    </td>
    
    <td>
       <asp:DropDownList runat="server" ID="ddl_types"  ClientIDMode="Static" CssClass="form-control"    Width="300px" >
     <asp:ListItem Text="周报" Value="周报"></asp:ListItem>
     <asp:ListItem Text="月报" Value="月报"></asp:ListItem>
      <asp:ListItem Text="季报" Value="季报"></asp:ListItem>
       <asp:ListItem Text="年报" Value="年报"></asp:ListItem>
        <asp:ListItem Text="其它" Value="其它"></asp:ListItem>
    </asp:DropDownList>
    
    </td> 

    </tr>
    
    


    <tr>
    <td>
    报告主题
    </td>
    
    <td>
    <asp:TextBox runat="server" CssClass="form-control" Width="500" ID="txt_subject"></asp:TextBox>
      <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="txt_subject" ID="RequiredFieldValidator5" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>

    </td>

    </tr>
    
    


    
      <tr>
      <td>
      报告时间范围
      </td>
 
      <td>
      
      
        从<asp:TextBox ID="txt_reportstart" ClientIDMode="Static" 
             CssClass="form-control" Width="120px" style="display:inline-block"
              onclick="ShowCalendar(this)" runat="server"></asp:TextBox>
        
          <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="txt_reportstart" ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>
         到

     从<asp:TextBox ID="txt_reportend" 
           CssClass="form-control" Width="120px" style="display:inline-block"
         
         runat="server"   ClientIDMode="Static"  onclick="ShowCalendar(this)" ></asp:TextBox>
            <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="txt_reportend" ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>
    

     </td>
     </tr>

     








 <!-- log  -->
     <tr>
     <td>
     工作要点
     </td>
     <td>



 <div style="text-align:right; width:700px; margin:10px;">
       <input type="button" class="btnadd btn btn-success btn-sm btn-flat "  onclick="addlog();" value="增加要点"/>
    </div>


 
   <table id="tbl_logs" class="table table-condensed" style="width:900px" >
<tr>

    <asp:Literal runat="server" ID="_lt_worklog"></asp:Literal>

<td width=540px> 
<input type="text" value="" class="form-control" name="report" style="width:500px"/>
</td>
<td width=180>


进度
<select  name="per"   class="per form-control"  style="display:inline-block; width:140px"> 
<option value="0">--</option>
<option value="20">20%</option>
<option value="40">40%</option>
<option value="60">60%</option>
<option value="80">80%</option>
<option value="100">100%</option>
</select>
 
 

</td>
<td width=80px> 
 <img    class="del" src="../images/del.jpg" /> 
</td>
</tr>









</table>
 

      </td>
      </tr>









<!-- summary  -->


       <tr>
      <td>
      工作总结
      </td>
      <td>
          <uc1:HtmlEdit ID="txt_contents" Width="900" Height="300" runat="server" />
          <br />
          <br />
      </td>
      </tr>











<!-- plan  -->







       <tr>
      <td>
      计划时间范围
      </td>
      <td>
         从<asp:TextBox ID="txt_planstart" 
                CssClass="form-control" Width="120px" style="display:inline-block"
               ClientIDMode="Static"    onclick="ShowCalendar(this)"  runat="server"></asp:TextBox>
             <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="txt_planstart" ID="RequiredFieldValidator3" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>

          到



      <asp:TextBox ID="txt_planend"  
             CssClass="form-control" Width="120px" style="display:inline-block" 
           ClientIDMode="Static"    onclick="ShowCalendar(this)"  runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ForeColor="Red" ControlToValidate="txt_planend" ID="RequiredFieldValidator4" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>

    </td>
    </tr>

    <tr>
    <td>
    计划要点
    </td>

    <td>
    




 <div style="text-align:right; width:700px; margin:10px;">
       <input type="button" class="btnadd btn btn-success btn-sm btn-flat"  onclick="addplan();" value="增加要点"/>
    </div>




  
   <table id="tbl_plan" class="table table-condensed" style="width:900px" >

 
 <asp:Literal runat="server" ID="_lt_plan"></asp:Literal>


       
<tr>



<td width=540px> 
<input type="text" value="" class="form-control" name="plan" style="width:500px"/>
</td>



<td  > 
 <img    class="del" src="../images/del.jpg" /> 
</td>
</tr>



</table>
 

      </td>
      </tr>



    </table>

 




















 <script type="text/javascript">

     $("document").ready(function () {

        

         $.ajax({
             url: "ajax/weeklyreport_getdt.aspx",
             data: { types: "weekly", dt: '<%=DateTime.Now %>' },
             cache: false,
             async: false,
             success: function (result) {
                 var i = eval("(" + result + ")");

                 $("#txt_reportstart").val(i.d1);
                 $("#txt_reportend").val(i.d2);
                 $("#txt_planstart").val(i.d3);
                 $("#txt_planend").val(i.d4);
             }
         });


         $("#ddl_types").change(
          function () {

              var v = $(this).val();
              var types = "";

              switch (v) {
                  case "周报":
                      types = "weekly";
                      break;

                  case "月报":
                      types = "monthly";
                      break;

                  case "季报":
                      types = "quarterly";
                      break;

                  case "年报":
                      types = "yearly";
                      break;

                  default:
                      types = "";
                      break;
              }




              $.ajax({
                  url: "ajax/weeklyreport_getdt.aspx",
                  data: { types: types, dt: '<%=DateTime.Now %>' },
                  cache: false,
                  async: true,
                  success: function (result) {
                      var i = eval("(" + result + ")");

                      $("#txt_reportstart").val(i.d1);
                      $("#txt_reportend").val(i.d2);
                      $("#txt_planstart").val(i.d3);
                      $("#txt_planend").val(i.d4);
                  }
              });


              return;
          }






         );

     });

 </script>


    



    <div style="  width:800px; text-align:center; margin:20px">
    <asp:Button ID="btnSubmit" runat="server" class="btn btn-primary" onclick="btnSubmit_Click" Text="更新周报" />
   </div>

    
     
      


















    <script>




        

        function addlog(tableId)
        {
           
           
            
            var html = '<tr>' +
                         '<td><input type="text" value="" class="form-control" name="report" style="width:500px"/></td>'+
                          '<td>进度 <select  name="per"   class="per form-control"  style="display:inline-block; width:140px">   <option value="0">--</option>     <option value="20">20%</option>        <option value="40">40%</option>         <option value="60">60%</option>       <option value="80">80%</option>         <option value="100">100%</option>        </select></td> '+
                          '<td>  <img    class="del" src="../images/del.jpg" />   </td>'+
                        ' </tr>';

            $(html).appendTo($("#tbl_logs"))

          

        }



        function addplan() {

           // ID = $("#" + tableId + " tr").length + 1;

            var html = '<tr>' +
                         '<td><input type="text" value="" class="form-control" name="plan" style="width:500px"/></td>' +
                         // '<td>进度 <select  name="per"   class="per form-control"  style="display:inline-block; width:140px">   <option value="0">--</option>     <option value="20">20%</option>        <option value="40">40%</option>         <option value="60">60%</option>       <option value="80">80%</option>         <option value="100">100%</option>        </select></td> ' +
                          '<td>  <img    class="del" src="../images/del.jpg" />   </td>' +
                        ' </tr>';

            $(html).appendTo($("#tbl_plan"))



        }

        function deleteRow() {
            var par = $(this).parent().parent();
            par.remove();
        };


        $("table").on("click", ".del", deleteRow);







    </script>





</asp:Content>
