<%-- 
    Document   : userLoginManagement
    Created on : Sep 11, 2018, 4:53:49 PM
    Author     : 1004242
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.SQLException"%>
<%@page import="LoginDb.DbHandler"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.Date"%>
<%@page import="DataEntryBean.ChequeDetailsBean"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.UUID" %>
<%String uuid = UUID.randomUUID().toString();%>
<% try {
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>

        <title>User Login Managemnt</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>

    </head>
    <script>

        function submitform(userTimeForm)
        {                
                if(document.getElementById("telerId").value == "def")
                    {
                        alert ("Please select a teller Id first then proceed");
                        return;
                    }
                document.userTimeForm.action = '/PacsApplication/UserLoginManagementServlet';
                document.userTimeForm.submit();
           
        }
       
             function noBack()
            {
                window.history.forward();
            }

            function addOpt(opt)
            {
                var x = document.getElementById("telerId");
                var option = document.createElement("option");
                option.text = opt;
                option.val = opt;
                x.add(option);
            }
            function popTellers(){
            $.ajax({
                url:'UserLoginManagementServlet',
                data:{"temp":"seacrh"},
                type:'post',
                cache:false,
                success:function(data){

                for( opt in data)
                    {
                        addOpt(data[opt]);
                    }

                },
                error:function(){

                }
            }
             );
            }

             function getTellerDetails(event){
             
               // alert(event.target.value);
             
            $.ajax({
                url:'UserLoginManagementServlet',
                data:{"temp":"info","teller":event.target.value},
                type:'post',
                cache:false,
                success:function(data){

                   $("#dayMonS").val(data.mS);
                   $("#dayMonE").val(data.mE);
                   if(data.mC == "Y")
                   $( "#monCheck").prop('checked', true);

                   $("#dayTueS").val(data.tS);
                   $("#dayTueE").val(data.tE);
                   if(data.tC == "Y")
                   $( "#tueCheck").prop('checked', true);

                   $("#dayWedS").val(data.wS);
                   $("#dayWedE").val(data.wE);
                   if(data.wC == "Y")
                   $( "#wedCheck").prop('checked', true);

                   $("#dayThuS").val(data.thS);
                   $("#dayThuE").val(data.thE);
                   if(data.thC == "Y")
                   $( "#thuCheck").prop('checked', true);

                   $("#dayFriS").val(data.fS);
                   $("#dayFriE").val(data.fE);
                   if(data.fC == "Y")
                   $( "#friCheck").prop('checked', true);

                   $("#daySatS").val(data.saS);
                   $("#daySatE").val(data.saE);
                   if(data.saC == "Y")
                   $( "#satCheck").prop('checked', true);

                   $("#daySunS").val(data.suS);
                   $("#daySunE").val(data.suE);
                   if(data.suC == "Y")
                   $( "#sunCheck").prop('checked', true);

                },
                error:function(){

                }
            }
             );
             }
             
             // to restrict back button
            history.pushState(null, null, location.href);
            window.addEventListener('popstate', function(event) {
                history.pushState(null, null, location.href);
            });
            
    </script>

            <%
                 int count = 1;
                 String pacsid = (String) session.getAttribute("pacsId");
                 String tellerId = (String) session.getAttribute("user");
                 String error_msg1 = "";
                 Object error1 = request.getAttribute("message");
                  if (error1 != null) {
                     error_msg1 = error1.toString();

                 }

            %>


    <body onload="noBack();popTellers();">
        <jsp:include page="Deposit/MenuHead_Deposit.jsp" flush="true" />


        <div id="userLoginModi">
            <br>
            <fieldset style="border-color: black; background-image: url('/PacsApplication/img/download.jpg'); border-width: 3px">
                <legend style="padding: 8px; border-radius: 20px; background-color: #006600; color: white">User Login Managemnt</legend>
                <form name="userTimeForm" method="post" action="" id="userTimeForm">
                    <%if (!error_msg1.equalsIgnoreCase("")) {%>
                    <center><div class="info" id="errorMessage"><center><%= error_msg1%></center></div></center>
                    <% }%>
                    <br>
                    <center>
                        <td>Logged in User:<%=tellerId%></td>
                        
                        <br><br>
                        <tr><td style="text-align: right">Select Teller ID: </td>
                            <td><select class="selectpicker" id="telerId" name ="telerId" onchange="getTellerDetails(event);" >
                                    <option value="def" > --Select-- </option>
                                </select></td>
                    </center> 
                    <br><br>
                    <center>
                        <table >
                             <tr>
                                <td style="text-align: center"></td>
                                <td style="text-align: center">Start time</td>
                                <td style="text-align: center">End time</td>
                                
                            </tr>

                            <tr>
                                <td style="text-align: right">MONDAY: &nbsp;</td>
                                <td><input type="time" name="dayMonS" id="dayMonS" /></td>
                                <td><input type="time" name="dayMonE" id="dayMonE" /></td>
                                <td><input type="checkbox" name="monCheck" value="monCheck" id="monCheck">Allow this setting<br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">TUESDAY: &nbsp;</td>
                                <td><input type="time" name="dayTueS" id="dayTueS" /></td>
                                <td><input type="time" name="dayTueE" id="dayTueE" /></td>
                                <td><input type="checkbox" name="tueCheck" value="tueCheck" id="tueCheck">Allow this setting<br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">WEDNESDAY: &nbsp;</td>
                                <td><input type="time" name="dayWedS" id="dayWedS" /></td>
                                <td><input type="time" name="dayWedE" id="dayWedE" /></td>
                                <td><input type="checkbox" name="wedCheck" value="wedCheck" id="wedCheck">Allow this setting<br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">THURSDAY: &nbsp;</td>
                                <td><input type="time" name="dayThuS" id="dayThuS" /></td>
                                <td><input type="time" name="dayThuE" id="dayThuE" /></td>
                                <td><input type="checkbox" name="thuCheck" value="thuCheck" id="thuCheck">Allow this setting<br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">FRIDAY: &nbsp;</td>
                                <td><input type="time" name="dayFriS" id="dayFriS" /></td>
                                <td><input type="time" name="dayFriE" id="dayFriE" /></td>
                                <td><input type="checkbox" name="friCheck" value="friCheck" id="friCheck">Allow this setting<br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">SATURDAY: &nbsp;</td>
                                <td><input type="time" name="daySatS" id="daySatS" /></td>
                                <td><input type="time" name="daySatE" id="daySatE" /></td>
                                <td><input type="checkbox" name="satCheck" value="satCheck" id="satCheck">Allow this setting<br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">SUNDAY: &nbsp;</td>
                                <td><input type="time" name="daySunS" id="daySunS" /></td>
                                <td><input type="time" name="daySunE" id="daySunE" /></td>
                                <td><input type="checkbox" name="sunCheck" value="sunCheck" id="sunCheck">Allow this setting<br></td>
                            </tr>

                        </table>
                        <br><br>
                           <center>
                        <input type="button" id="submitButton"  value="Submit" onclick="javascript:submitform(userTimeForm)">
                        <input type="reset" value="Reset" />
                    </center>
                    </center>
                   <input type="hidden" name="temp" id="temp" value="submit">
                </form>
            </fieldset>
        </div>
    </body>

</html>
<% 	} catch (Exception e) {
                
            }
%>