<%@ Control Language="VB" AutoEventWireup="false" CodeFile="uc_RequestForm.ascx.vb" Inherits="teacher_uc_RequestForm" %>
<div style="width:500px;padding-left:10px;">
    <div>
        <uc:TitleBar ID="uc_TitleBar_研修情報" Text="研修情報" Mode="point" runat="server" />
    </div>
    <div class="vertical_space"></div>
    <asp:FormView ID="frm_研修科目" runat="server" CssClass="uc_info adaptiveWidth400" Width="95%" >
        <ItemTemplate>
            <table class="training-sheet">
              <colgroup>
                <col style="width:20%;" />
                <col style="width:30%;" />
                <col style="width:20%;" />
                <col style="width:30%;" />
              </colgroup>
              <tr>
                <td class="header" style="text-align:center;">
                    課目
                </td>
                <td class="detail">
                    <asp:Label ID="lbl_課目" runat="server" />
                </td>
                <td class="header" style="text-align:center;">
                    講義日
                </td>
                <td class="detail">
                    <asp:Label ID="lbl_講義日" runat="server" />
                </td>
            </tr>
              <tr>
                <td class="header" style="text-align:center;">
                    課目名
                </td>
                <td class="detail" colspan="3">
                    <asp:Label ID="lbl_課目名" runat="server"/>
                </td>
            </tr>
              <tr>
                <td class="header" style="text-align:center;">
                    講義開始時間
                </td>
                <td class="detail">
                    <asp:Label ID="lbl_講義開始時間" runat="server"/>
                </td>
                <td class="header" style="text-align:center;">
                    講義終了時間
                </td>
                <td class="detail">
                    <asp:Label ID="lbl_講義終了時間" runat="server"/>
                </td>
            </tr>
              <tr>
                <td class="header" style="text-align:center;">
                    迎えバス
                </td>
                <td class="detail">
                    <asp:Label ID="lbl_迎え時刻" runat="server"/>
                </td>
                <td class="header" style="text-align:center;">
                    送りバス
                </td>
                <td class="detail">
                    <asp:Label ID="lbl_送り時刻" runat="server" />
                </td>
            </tr>
            </table>
            </ItemTemplate>
        <EmptyDataTemplate>
            <div style="width:500px;">

        &nbsp;<asp:Label ID="Label15" runat="server" 
            style="color: #333333" 
            Text="課目を選択してください。"></asp:Label>
            </div>
    </EmptyDataTemplate>
    </asp:FormView>

    <asp:FormView ID="frm_課目別連絡票" runat="server" CssClass="uc_info adaptiveWidth400" Width="95%">
        <ItemTemplate>
             <table class="training-sheet" style="padding:10px;">
              <colgroup>
                <col style="width:2%;" />
                <col style="width:68%;" />
                <col style="width:30%;" />
              </colgroup>
                   <tr>
                       <td rowspan="2">
                          ①
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_迎え" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_別手段" runat="server" CssClass="ddl-otherway" onchange="toggleTextBoxOtherWay(this)" Width="95%">
                               <asp:ListItem Text="" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_別手段" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                           <asp:Label ID="lbl_質問_別手段" runat="server"/>
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_別手段" runat="server" Enabled="false" Width="95%" CssClass="txt-otherway"></asp:TextBox>
                           <asp:Label ID="lbl_err_別手段他" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                          ②
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_到着" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_到着" runat="server" Width="95%" CssClass="txt-arrival" type="time"></asp:TextBox>
                           <asp:Label ID="lbl_err_到着" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                          ③
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_車種" runat="server"/>
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_車種" runat="server" Width="95%"></asp:TextBox>
                           <asp:Label ID="lbl_err_車種" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                          ④
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_宿泊" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_宿泊" runat="server" Width="95%" CssClass="ddl-inn" onchange="toggleTextBoxInn(this)">
                               <asp:ListItem Text="" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_宿泊" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                          ⑤
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_宿泊到着" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_宿泊到着" runat="server" Width="95%" CssClass="txt-inn" type="time"></asp:TextBox>
                           <asp:Label ID="lbl_err_宿泊到着" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td rowspan="2">
                          ⑥
                       </td>
                       <td rowspan="2">
                           <asp:Label ID="lbl_質問_夕食" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_夕食" runat="server" Width="95%" CssClass="ddl-dinner">
                               <asp:ListItem Text="" />
                               <asp:ListItem Value="○" Text="夕食あり" />
                               <asp:ListItem Value="×" Text="夕食なし" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_夕食" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_朝食" runat="server" Width="95%" CssClass="ddl-bf">
                               <asp:ListItem Text="" />
                               <asp:ListItem Value="○" Text="朝食あり" />
                               <asp:ListItem Value="×" Text="朝食なし" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_朝食" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                          ⑦
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_昼食" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_昼食" runat="server" Width="95%">
                               <asp:ListItem Text="" />
                               <asp:ListItem Value="○" Text="必要" />
                               <asp:ListItem Value="×" Text="不要" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_昼食" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td rowspan="2">
                          ⑧
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_機器" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_機器" runat="server" Width="95%" CssClass="ddl-instrument" onchange="toggleTextBoxInstrument(this)">
                               <asp:ListItem Text="" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_機器" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                           <asp:Label ID="lbl_質問_機器他" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_機器他" runat="server" Enabled="false" Width="95%" CssClass="txt-instrument"></asp:TextBox>
                           <asp:Label ID="lbl_err_機器他" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td rowspan="2">
                          ⑨
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_送り" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:DropDownList ID="ddl_回答_送り" runat="server" Width="95%" CssClass="ddl-otherway2" onchange="toggleTextBoxOtherWay2(this)">
                               <asp:ListItem Text="" />
                           </asp:DropDownList>
                           <asp:Label ID="lbl_err_送り" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                           <asp:Label ID="lbl_質問_送り他" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_送り他" runat="server" Width="95%" CssClass="txt-otherway2"></asp:TextBox>
                           <asp:Label ID="lbl_err_送り他" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
                   <tr>
                       <td>
                           ⑩
                       </td>
                       <td>
                           <asp:Label ID="lbl_質問_送り出発" runat="server" />
                       </td>
                       <td style="text-align:center;">
                           <asp:TextBox ID="txt_回答_送り出発" runat="server" Width="95%" CssClass="txt-departure" type="time"></asp:TextBox>
                           <asp:Label ID="lbl_err_送り出発" runat="server" CssClass="error" Visible="false" />
                       </td>
                   </tr>
              </table>
        </ItemTemplate>
        <EmptyDataTemplate>
        <span class="accent">
            課目を選択してください。
        </span>
    </EmptyDataTemplate>
    </asp:FormView>
    <%-- ボタン Start --%>
    <div id="div1" runat="server" style="width:500px;text-align:center;">
        <asp:Button ID="btn_更新" runat="server" CssClass="training-button training-button-red" Text="更&nbsp;&nbsp;新" OnClick="btn_更新_Click" />
        <asp:Label ID="lbl_errMes" CssClass="error" runat="server" Visible="false" />
    </div>
    <div class="vertical_space"></div>
</div>
<script type="text/javascript">
    function toggleTextBoxOtherWay(ddl) {
        // 同じFormView内のクラス名で検索
        var formView = ddl.closest('table');
        var txtBox = formView.querySelector('.txt-otherway');
        var txtBox2 = formView.querySelector('.txt-arrival');

        toggleTextBox(ddl, txtBox, 'その他')
        toggleTextBox2(ddl, txtBox2, '○')
    }
    function toggleTextBoxInstrument(ddl) {
        // 同じFormView内のクラス名で検索
        var formView = ddl.closest('table');
        var txtBox = formView.querySelector('.txt-instrument');
        toggleTextBox(ddl, txtBox, 'その他')
    }
    function toggleTextBoxInn(ddl) {
        // 同じFormView内のクラス名で検索
        var frm = ddl.closest('table');
        var txtBox = frm.querySelector('.txt-inn');
        var ddl_d = frm.querySelector('.ddl-dinner');
        var ddl_b = frm.querySelector('.ddl-bf');

        toggleTextBox(ddl, txtBox, '所内泊(前泊)')
        toggleDdl(ddl, ddl_d)
        toggleDdl(ddl, ddl_b)
    }
    function toggleTextBoxOtherWay2(ddl) {
        // 同じFormView内のクラス名で検索
        var formView = ddl.closest('table');
        var txtBox = formView.querySelector('.txt-otherway2');
        var txtBox2 = formView.querySelector('.txt-departure');

        toggleTextBox(ddl, txtBox, 'その他')
        toggleTextBox2(ddl, txtBox2, '○')
    }
    function toggleTextBox(ddl, txtBox, enableVal) {
        if (txtBox) {
            if (ddl.value === enableVal) {
                txtBox.disabled = false;
            } else {
                txtBox.disabled = true;
                txtBox.value = '';
            }
        }
    }
    function toggleTextBox2(ddl, txtBox, enableVal) {
        if (txtBox) {
            if (ddl.value != enableVal) {
                txtBox.disabled = false;
            } else {
                txtBox.disabled = true;
                txtBox.value = '';
            }
        }
    }
    function toggleDdl(ddl, ddl_d) {
        if (ddl_d) {
            if (ddl.value == '所内泊(前泊)' || ddl.value == '所内泊(後泊)' ) {
                ddl_d.disabled = false;
            } else {
                ddl_d.disabled = true;
                ddl_d.value = '';
            }
        }
    }
    $(function () {

        $('.ddl-otherway').each(function () {
            toggleTextBoxOtherWay(this);
        });

        $('.ddl-instrument').each(function () {
            toggleTextBoxInstrument(this);
        });

        $('.ddl-inn').each(function () {
            toggleTextBoxInn(this);
        });

        $('.ddl-otherway2').each(function () {
            toggleTextBoxOtherWay2(this);
        });

    });
</script>




