<%@ page title="Patient Master" language="C#" masterpagefile="~/MasterPage.master" autoeventwireup="true" inherits="PatientMaster, App_Web_olkqyt2e" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="PagePanel" runat="server" ChildrenAsTriggers="true">
        <ContentTemplate>
            <div class="main-content container-fluid">
                <div class="page-title">
                    <h3>Patient Master</h3>
                </div>
                <section class="section">
                    <div class="row bspace">
                        <div class="col-md-12">
                            <div class="divider">
                                <div class="divider-text">Patient Details</div>
                            </div>
                            <div class="row bspace">

                                <div class="col-md-1">
                                    <label class="label">Patient Type</label>
                                </div>
                                <div class="col-md-2">
                                    <asp:DropDownList ID="ddlPatientType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPatientType_SelectedIndexChanged" CssClass="form-select">
                                        <asp:ListItem Text="Individual" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="Farm" Value="2"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1">
                                    <label class="label">Owner Name</label>
                                </div>
                                <div class="col-md-4">
                                    <asp:TextBox ID="txtOwnerName" runat="server" CssClass="form-control" AutoPostBack="true" OnTextChanged="txtOwnerName_TextChanged" placeholder="Owner Name" required AutoComplete="off"></asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="txtOwnerName_AutoCompleteExtender" runat="server" BehaviorID="txtOwnerName_AutoCompleteExtender" CompletionListCssClass="completionList" CompletionListHighlightedItemCssClass="itemHighlighted" CompletionListItemCssClass="listItem" DelimiterCharacters="" ServicePath="AutoComplete.asmx" ServiceMethod="GetOwnerName" TargetControlID="txtOwnerName">
                                    </cc1:AutoCompleteExtender>
                                </div>
                                <div class="col-md-1">
                                    <asp:Label CssClass="label" ID="lblType" Text="Patient Name" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox ID="txtPatientName" runat="server" CssClass="form-select" list="PatientList" AutoPostBack="true" OnTextChanged="txtPatientName_TextChanged" />
                                    <datalist id="PatientList">
                                        <asp:Repeater ID="repeatList" runat="server">
                                            <ItemTemplate>
                                                <option value='<%# Eval("PatientName") %>' itemid='<%# Eval("PatientID") %>'></option>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </datalist>
                                    <%--  <asp:TextBox ID="" runat="server" CssClass="form-control" AutoPostBack="true" OnTextChanged="txtPatientName_TextChanged" placeholder="Patient Name" required AutoComplete="off"></asp:TextBox>
                                  <cc1:AutoCompleteExtender ID="txtPatientName_AutoCompleteExtender" runat="server" BehaviorID="txtPatientName_AutoCompleteExtender" CompletionListCssClass="completionList" CompletionListHighlightedItemCssClass="itemHighlighted" CompletionListItemCssClass="listItem" DelimiterCharacters="" ServicePath="AutoComplete.asmx" ServiceMethod="GetPatientName" TargetControlID="txtPatientName">
                                    </cc1:AutoCompleteExtender>--%>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-6">
                                    <div class="row bspace">
                                        <div class="col-md-4">
                                            <label class="label">WA No</label>
                                        </div>
                                        <div class="col-md-8">
                                            <asp:TextBox ID="txtWaNo" runat="server" CssClass="form-control" placeholder="WA No"></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="row bspace">
                                        <div class="col-md-4">
                                            <label class="label">Alternate No</label>
                                        </div>
                                        <div class="col-md-8">
                                            <asp:TextBox ID="txtAltNo" runat="server" CssClass="form-control" placeholder="Alternate No"></asp:TextBox>
                                        </div>
                                    </div>
                                    <div class="row bspace">
                                        <div class="col-md-4">
                                            <label class="label">Email ID</label>
                                        </div>
                                        <div class="col-md-8">
                                            <asp:TextBox ID="txtEmailID" runat="server" CssClass="form-control" placeholder="Email ID"></asp:TextBox>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-2">
                                    <label class="label">Address</label>
                                </div>
                                <div class="col-md-4">
                                    <asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine" CssClass="form-control" Height="100px" placeholder="Address"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">DOB</label>
                                </div>
                                <div class="col-md-4">
                                    <asp:TextBox ID="txtDOB" runat="server" TextMode="Date" onchange="DateSelectionChanged()" CssClass="form-control" placeholder="dd/MM/yyyy"></asp:TextBox>
                                    <script type="text/javascript">
                                        function DateSelectionChanged() {
                                            var today = new Date();
                                            var dob = new Date(document.getElementById('<%=txtDOB.ClientID%>').value);
                                            var months = (today.getMonth() - dob.getMonth() + (12 * (today.getFullYear() - dob.getFullYear())));
                                            document.getElementById('<%=txtAge.ClientID%>').value = Math.round(months / 12);
                                        }
                                    </script>
                                </div>
                                <div class="col-md-2">
                                    <label class="label">Gender</label>
                                </div>
                                <div class="col-md-4">
                                    <asp:DropDownList ID="ddlGender" runat="server" CssClass="form-select">
                                        <asp:ListItem Text="Male"></asp:ListItem>
                                        <asp:ListItem Text="Female"></asp:ListItem>
                                        <asp:ListItem Text="Neutered Male"></asp:ListItem>
                                        <asp:ListItem Text="Neutered Female"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">Age</label>
                                </div>
                                <div class="col-md-4">
                                    <asp:TextBox ID="txtAge" runat="server" CssClass="form-control" placeholder="Age"></asp:TextBox>
                                </div>
                                <div class="col-md-2">
                                    <label class="label">Weight</label>
                                </div>
                                <div class="col-md-4">
                                    <asp:TextBox ID="txtWeight" runat="server" CssClass="form-control" placeholder="Weight"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">Species</label>
                                </div>
                                <div class="col-md-2">
                                    <asp:DropDownList ID="ddlSpeciesType" runat="server" CssClass="form-select" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="ddlSpeciesType_SelectedIndexChanged">
                                        <asp:ListItem Selected="True" Value="0" Text="Select"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-2">
                                    <label class="label">Breed</label>
                                </div>
                                <div class="col-md-2">
                                    <asp:DropDownList ID="ddlBreed" runat="server" CssClass="form-select" AppendDataBoundItems="true">
                                        <asp:ListItem Selected="True" Value="0" Text="Select"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1">
                                    <label class="label">Nos.</label>
                                </div>
                                <div class="col-md-1">
                                    <asp:TextBox ID="txtNos" runat="server" CssClass="form-control" placeholder="Nos"></asp:TextBox>
                                </div>
                                <div class="col-md-2">
                                    <asp:Button ID="btnAdd" runat="server" Visible="false" Text="Add" CssClass="btn btn-primary btn-block" OnClick="btnAdd_Click" />
                                </div>
                            </div>
                            <div class="row bspace" id="FirmEntry" runat="server" visible="false">
                                <table class="table table-hover mb-0">
                                    <thead>
                                        <tr>
                                            <th>SrNo</th>
                                            <th>Species</th>
                                            <th>Breed</th>
                                            <th>CountOfAnimal</th>
                                            <th>ACTION</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <asp:Repeater ID="RepeaterPatientVisit" runat="server">
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblSrNo" Text='<%# Eval("SrNo") %>' runat="server"></asp:Label></td>

                                                    <td><%# Eval("Species") %></td>
                                                    <td class="text-bold-500"><%# Eval("Breed") %></td>
                                                    <td><%# Eval("CountOfAnimal") %></td>
                                                    <td>
                                                        <asp:Label ID="lblPatientEntryID" Text='<%#Eval("PatientEntryID") %>' runat="server" Visible="false"></asp:Label>
                                                        <asp:Label ID="lblSpeciesTypeID" Text='<%#Eval("SpeciesTypeID") %>' runat="server" Visible="false"></asp:Label>
                                                        <asp:Label ID="lblBreedID" Text='<%#Eval("BreedID") %>' runat="server" Visible="false"></asp:Label>
                                                        <asp:Label ID="lblStat" Text='<%#Eval("Stat") %>' runat="server" Visible="false"></asp:Label>
                                                        <div class="dropdown">
                                                            <a class="btn btn-link font-24 p-0 line-height-1 no-arrow dropdown-toggle" href="#" role="button" data-toggle="dropdown">
                                                                <i class="dw dw-more"></i>
                                                            </a>
                                                            <div class="dropdown-menu dropdown-menu-right dropdown-menu-icon-list">
                                                                <asp:Button CssClass="dropdown-item" runat="server" Text="View" ID="View" AutoPostBack="true" CommandArgument='<%#Eval("SrNo") %>' OnClick="View_Click"></asp:Button>
                                                                <asp:Button CssClass="dropdown-item" runat="server" Text="Delete" ID="btnDelete" AutoPostBack="true" CommandArgument='<%#Eval("SrNo") %>' OnClick="btnDelete_Click"></asp:Button>
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </tbody>
                                </table>
                                <asp:Label ID="lblPatientEntryID" runat="server" Visible="false"></asp:Label>
                            </div>
                          
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">Allergies</label>
                                </div>
                                <div class="col-md-10">
                                    <asp:TextBox ID="txtAllergies" runat="server" TextMode="MultiLine" CssClass="form-control" placeholder="Allergies"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">Prev History</label>
                                </div>
                                <div class="col-md-10">
                                    <asp:TextBox ID="txtHistory" runat="server" TextMode="MultiLine" CssClass="form-control" placeholder="Prev History"></asp:TextBox>
                                </div>
                            </div>
                            <div class="card-body">
                                <div class="row">
                                    <ul class="nav nav-tabs" id="myTab" role="tablist">
                                        <li class="nav-item" role="presentation">
                                            <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home"
                                                aria-selected="true">Home</a>
                                        </li>
                                        <li class="nav-item" role="presentation">
                                            <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile"
                                                aria-selected="false">Profile</a>
                                        </li>
                                        <li class="nav-item" role="presentation">
                                            <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact"
                                                aria-selected="false">Contact</a>
                                        </li>
                                    </ul>
                                    <div class="tab-content" id="myTabContent">
                                        <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                                            <p class='my-2'>
                                                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ut nulla neque. Ut hendrerit nulla a euismod pretium.
                                Fusce venenatis sagittis ex efficitur suscipit. In tempor mattis fringilla. Sed id tincidunt orci, et volutpat ligula.
                                Aliquam sollicitudin sagittis ex, a rhoncus nisl feugiat quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                                Nunc ultricies ligula a tempor vulputate. Suspendisse pretium mollis ultrices.
                                            </p>
                                        </div>
                                        <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
                                            Integer interdum diam eleifend metus lacinia, quis gravida eros mollis. Fusce non sapien sit amet magna dapibus
                                ultrices. Morbi tincidunt magna ex, eget faucibus sapien bibendum non. Duis a mauris ex. Ut finibus risus sed massa
                                mattis porta. Aliquam sagittis massa et purus efficitur ultricies. Integer pretium dolor at sapien laoreet ultricies.
                                Fusce congue et lorem id convallis. Nulla volutpat tellus nec molestie finibus. In nec odio tincidunt eros finibus
                                ullamcorper. Ut sodales, dui nec posuere finibus, nisl sem aliquam metus, eu accumsan lacus felis at odio. Sed lacus
                                quam, convallis quis condimentum ut, accumsan congue massa. Pellentesque et quam vel massa pretium ullamcorper vitae eu
                                tortor.
                           
                                        </div>
                                        <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
                                            <p class="mt-2">
                                                Duis ultrices purus non eros fermentum hendrerit. Aenean ornare interdum viverra. Sed ut odio velit. Aenean eu diam
                                dictum nibh rhoncus mattis quis ac risus. Vivamus eu congue ipsum. Maecenas id sollicitudin ex. Cras in ex vestibulum,
                                posuere orci at, sollicitudin purus. Morbi mollis elementum enim, in cursus sem placerat ut.
                                            </p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">Prev Treatment</label>
                                </div>
                                <div class="col-md-10">
                                    <asp:TextBox ID="txtPrevTreat" runat="server" TextMode="MultiLine" CssClass="form-control" placeholder="Prev Treatment"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-2">
                                    <label class="label">Remarks</label>
                                </div>
                                <div class="col-md-10">
                                    <asp:TextBox ID="txtRemark" runat="server" TextMode="MultiLine" CssClass="form-control" placeholder="Remarks"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row form-group">
                            </div>
                            <div class="row bspace" style="display: none">
                                <div class="col-md-2">
                                    <label class="label">User Name</label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox ID="txtUserName" runat="server" CssClass="form-control" placeholder="User Name"></asp:TextBox>
                                </div>
                                <div class="col-md-2">
                                    <label class="label">Password</label>
                                </div>
                                <div class="col-md-2">
                                    <asp:TextBox ID="txtPassword" runat="server" CssClass="form-control" placeholder="Password" TextMode="Password"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row form-group">
                                <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                                <asp:Label ID="lblID" runat="server" Visible="false"></asp:Label>
                                <asp:Label ID="lblSrNo" runat="server" Visible="false"></asp:Label>
                                <asp:Label ID="lblUserID" runat="server" Visible="false"></asp:Label>
                                <asp:Label ID="lblOwnerID" runat="server" Visible="false"></asp:Label>
                                <asp:Label ID="lblMsg" runat="server" ForeColor="Green"></asp:Label>
                                <asp:Label runat="server" ID="lblImageID" Visible="false"></asp:Label>
                            </div>
                            <div class="row bspace">
                                <div class="col-md-4">
                                    <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="btn btn-primary btn-block" OnClick="btnSave_Click" />
                                </div>
                                <div class="col-md-4">
                                    <button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#exampleModalCenter">Show</button>
                                </div>
                                <div class="col-md-4">
                                    <asp:Button ID="btnReset" runat="server" Text="Reset" CssClass="btn btn-primary btn-block" OnClick="btnReset_Click" UseSubmitBehavior="false" CausesValidation="false" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <%--  <div class="col-md-4">
                    <div class="divider">
                        <div class="divider-text">Doctor List</div>
                    </div>
                    <div class="row bspace">
                      <asp:GridView ID="GridDoctorMaster" runat="server" AutoGenerateColumns="false" CssClass="table table-responsive table-bordered" OnSelectedIndexChanged="GridDoctorMaster_SelectedIndexChanged">
                            <Columns>
                                <asp:CommandField ShowSelectButton="true" SelectText="<<" />
                                <asp:BoundField DataField="DoctorID" HeaderText="DoctorID" SortExpression="DoctorID" HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass="hideGridColumn" />
                                <asp:BoundField DataField="DocName" HeaderText="DocName" SortExpression="DocName" />
                                <asp:BoundField DataField="DocAddress" HeaderText="DocAddress" SortExpression="DocAddress" />
                                <asp:BoundField DataField="DocMobileNo" HeaderText="DocMobileNo" SortExpression="DocMobileNo" />
                                <asp:BoundField DataField="DocImage" HeaderText="DocImage" SortExpression="DocImage" HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass="hideGridColumn" />
                            </Columns>
                        </asp:GridView>
                    </div>
            </div>--%>
                </section>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog"
        aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-dialog-centered modal-dialog-scrollable"
            role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalCenterTitle">Patient List</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <i data-feather="x"></i>
                    </button>
                </div>
                <div class="modal-body">
                    <asp:GridView ID="GridPatientMaster" runat="server" AutoGenerateColumns="false" CssClass="table table-responsive table-bordered" OnSelectedIndexChanged="GridPatientMaster_SelectedIndexChanged">
                        <Columns>
                            <asp:CommandField SelectText="<<" ShowSelectButton="true" />
                            <asp:BoundField DataField="PatientID" HeaderText="PatientID" SortExpression="PatientID" HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass="hideGridColumn" />
                            <asp:BoundField DataField="PatientName" HeaderText="PatientName" SortExpression="PatientName" />
                            <asp:BoundField DataField="OwnerName" HeaderText="OwnerName" SortExpression="OwnerName" />
                        </Columns>
                    </asp:GridView>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-light-secondary" data-dismiss="modal">
                        <i class="bx bx-x d-block d-sm-none"></i>
                        <span class="d-none d-sm-block">Close</span>
                    </button>
                    <%--    <button type="button" class="btn btn-primary ml-1" data-dismiss="modal">
                        <i class="bx bx-check d-block d-sm-none"></i>
                        <span class="d-none d-sm-block">Accept</span>
                    </button>--%>
                </div>
            </div>
        </div>
    </div>
</asp:Content>

