<%@ page language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" autoeventwireup="true" inherits="Pages_Communication_AssignmentList, App_Web_xo24zi45" uiculture="auto" meta:resourcekey="PageResource1" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <style type="text/css">
        .volU {
            color: green !important;
            font-size: large;
        }

        .volM {
            color: red !important;
            font-size: large;
        }
    </style>
    <asp:UpdatePanel ID="HREmployeeMasterSearchUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="divContentPage" class="divcontentpagemargin">

                <div class="dashBoardLeftCont" valign="top" runat="server" id="ScreenGroup">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="114"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <div class="himssuHeader1WireBox card card-box">
                        <div class="himsBoxHeader card-head" id="Div4" runat="server" visible="True">

                            <div class="himsBoxTitle">
                                <div class="headerText fLeft">
                                    <header>
                                        <i class="fas fa-tasks"></i>
                                        <asp:Label ID="Label4" Text="Assignment List"
                                            runat="server" />
                                    </header>
                                </div>
                            </div>
                        </div>
                        <div class="himsBoxContent card-body">
                            <asp:Panel ID="DetailPanel" runat="Server">
                                <div class="contentHolder">
                                    <asp:Panel ID="SearchPanel" runat="Server">
                                        <div class="contentHolder">
                                            <div class="outerBox pTop5 col-md-3">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="NameLabel" runat="server" Text="Name"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:TextBox ID="NameTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                        SkinID="CustomWidthTextBox" runat="server" MaxLength="200"> </asp:TextBox>
                                                </div>
                                            </div>

                                            <div class="outerBox pTop5 col-md-3 center">
                                                <asp:Label ID="ORLabel" runat="server" Text="OR" Visible="True" Font-Bold="true" Font-Size="Medium" ForeColor="Red"></asp:Label>
                                            </div>

                                            <div class="outerBox pTop5 col-md-3">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="FromDateLabel" runat="server" Text="From Date" Visible="True"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <Date:DatePickerControl DisplayDatePicker="true" ID="FromDatePickerControl" Visible="True"
                                                        runat="server" />
                                                </div>
                                            </div>
                                            <div class="outerBox pTop5 col-md-3">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="ToDateLabel" runat="server" Text="To Date" Visible="True"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <Date:DatePickerControl DisplayDatePicker="True" ID="ToDatePickerControl" Visible="True"
                                                        runat="server" />
                                                </div>
                                            </div>
                                        </div>

                                        <div class="alignCenter pTop5 col-md-12 middle center">
                                            <asp:Button ID="SearchButton" runat="server" Text="&#xf002; Search" OnClick="SearchButton_Click"
                                                SkinID="0" class="btn-search btn fas" />
                                            <asp:Button ID="ClearButton" runat="server" Text="&#xf0e2; Reset" OnClick="ClearSearch_Click" SkinID="0" class="btn-reset btn fas" />
                                        </div>
                                        <div class="cBoth"></div>
                                        <br />

                                    </asp:Panel>
                                    <div class="himssuHeader6WireBox col-md-12">
                                        <div class="himsBoxHeader" id="AssignmentListGridViewPagerDiv" runat="server" visible="true">
                                            <div class="leftdiv">
                                            </div>
                                            <div class="himsBoxTitle">

                                                <div class="fRight pTop5">

                                                    <uc1:GridViewPager ID="AssignmentListGridViewPager" ParentGridView="AssignmentListGridView"
                                                        runat="server" OnFirstRecordClick="AssignmentListGridViewPager_FirstRecordClick" OnLastRecordClick="AssignmentListGridViewPager_LastRecordClick"
                                                        OnNextRecordClick="AssignmentListGridViewPager_NextRecordClick" OnPrevRecordClick="AssignmentListGridViewPager_PrevRecordClick"
                                                        OnTextBoxValueChange="AssignmentListGridViewPager_TextBoxValueChange" />
                                                </div>
                                            </div>
                                        </div>

                                        <div class="himsBoxHeader card-head inner" id="PatientRelationDiv" runat="server" style="display: none">
                                            <%--<div class="gridHeaderText">
                                                            <header>
                                                                <asp:Label ID="ClusterBatchlabel" Text="Assignment List" runat="server" />
                                                            </header>
                                                            </div>--%>
                                        </div>

                                        <div class="himsBoxContent card-body table-responsive">
                                            <asp:GridView runat="server" ID="AssignmentListGridView" AutoGenerateColumns="False"
                                                EmptyDataText="No records available for the seacrh criteria!" OnRowDataBound="AssignmentListGridView_RowDataBound"
                                                AllowPaging="True" PageSize="10" DataKeyNames="AssignmentId"
                                                ShowHeader="true" meta:resourcekey="AssignmentListGridViewResource1" CssClass="table table-striped table-bordered table-hover">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="User Id" Visible="false" HeaderStyle-HorizontalAlign="Left">
                                                        <ItemTemplate>
                                                            <asp:Label ID="UserIdLabel" runat="server" Text='<%# Bind("UserId") %>'></asp:Label>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="ViewLinkButton" runat="server" CommandName="Select" OnClick="ViewLinkButton_Click"
                                                                Text="View" CausesValidation="false"></asp:LinkButton>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="Title" HeaderText="Name" ItemStyle-Width="25%" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="SubjectName" HeaderText="Subject Name" ItemStyle-Width="15%" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:TemplateField ItemStyle-Width="25%" ItemStyle-Wrap="true" HeaderText="Remark">
                                                        <ItemStyle HorizontalAlign="Left" Wrap="true" />
                                                        <ItemTemplate>
                                                            <asp:TextBox ID="RemarkTextBox" Height="70px" runat="server" TextMode="MultiLine" Text='<%# Bind("Remark") %>' Style="width: 87% !important"></asp:TextBox>
                                                            <asp:Label ID="RemarkLabel" runat="server" Text='<%# Bind("Remark") %>' Style="width: 87% !important"></asp:Label>                                                                        
                                                            <input type="button" onclick="TextToSpeech(this);" style="background: transparent; border: transparent; position: absolute" id="RemarkSpeakButton" class="fas fa-volume-mute volM" value="&#xf6a9;" runat="server" />
                                                            <input type="button" onclick="StopSpeech(this);" style="background: transparent; border: transparent; position: absolute; display: none" id="RemarkMuteButton" class="fas fa-volume-up volU" value="&#xf028;" runat="server" />
                                                            <asp:HiddenField ID="RemarkHiddenField" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <%--<asp:BoundField DataField="Remark" HeaderText="Remark" ItemStyle-Width="30%" HeaderStyle-HorizontalAlign="Left" />--%>
                                                    <asp:BoundField DataField="StartDate" HeaderText="Start Date" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="10%" HeaderStyle-HorizontalAlign="Left" />
                                                    <asp:BoundField DataField="EndDate" HeaderText="End Date" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="10%" HeaderStyle-HorizontalAlign="Left" />

                                                </Columns>
                                                <PagerSettings Visible="False" />
                                            </asp:GridView>
                                        </div>
                                    </div>

                                </div>
                            </asp:Panel>
                        </div>
                    </div>
                </div>
                </tr>
                    </table>
            </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <%-- <script data-main="../../JavaScript/rjs/encrypt/assign-organization-encrypt" src="../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/assign-organization")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script type="text/javascript">
        var flag = 0;
        var PrevId;
        var myTimeout;
        var myTimeout2;
        window.speechSynthesis.cancel();
        function TextToSpeech(obj) {
            let utter = new SpeechSynthesisUtterance();
            if (PrevId == null || PrevId == $(obj)[0].id) {
                PrevId = $(obj)[0].id;
                if (flag > 0) {                    
                    clearTimeout(myTimeout2);
                    window.speechSynthesis.resume();
                    if ($(obj).next().next()[0].value == "hindi")
                        myTimeout = setTimeout(myTimer, 10000);
                    $(obj).next().show()
                    $(obj).hide()
                    document.getElementById($(obj).next()[0].id).style.display = 'inline'
                }
                else {
                    clearTimeout(myTimeout2);
                    utter.text = $(obj).prev().val();
                    if ($(obj).next().next()[0].value == "hindi") {
                        myTimeout = setTimeout(myTimer, 10000);
                        utter.lang = 'hi-Hindi'
                    }
                    window.speechSynthesis.speak(utter);
                    $(obj).next().show()
                    $(obj).hide()
                    document.getElementById($(obj).next()[0].id).style.display = 'inline'
                }
            }
            else {
                clearTimeout(myTimeout);
                clearTimeout(myTimeout2);
                window.speechSynthesis.cancel();
                flag = 0
                PrevId = $(obj)[0].id;
                utter.text = $(obj).prev().val();
                if ($(obj).next().next()[0].value == "hindi") {
                    myTimeout2 = setTimeout(myTimer2, 10000);
                    utter.lang = 'hi-Hindi'
                }
                window.speechSynthesis.speak(utter);
                $(obj).next().show()
                $(obj).hide()
                document.getElementById($(obj).next()[0].id).style.display = 'inline'
            }

            // event after text has been spoken
            utter.onend = function () {
                SpeechEnd(obj);
            }
        }
        function StopSpeech(obj) {
            window.speechSynthesis.pause();
            $(obj).hide();
            $(obj).prev().show()
            document.getElementById($(obj).prev()[0].id).style.display = 'inline'
            clearTimeout(myTimeout);
            clearTimeout(myTimeout2);
            //window.speechSynthesis.cancel();                        
            flag += 1;
        }
        function SpeechEnd(obj) {
            $(obj).show();
            $(obj).next().hide();
            document.getElementById($(obj)[0].id).style.display = 'inline'
            flag = 0;
            clearTimeout(myTimeout);
        }

        function myTimer() {
            window.speechSynthesis.pause();
            window.speechSynthesis.resume();
            myTimeout = setTimeout(myTimer, 10000);
        }

        function myTimer2() {
            window.speechSynthesis.pause();
            window.speechSynthesis.resume();
            myTimeout2 = setTimeout(myTimer2, 10000);
        }
    </script>
</asp:Content>
