<%-- 
    Document   : viewBulkIncr_STB
    Created on : Oct 26, 2018, 1:20:17 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>Bulk Mark</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>
<style>


#recordsTable {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

#recordsTable td, #recordsTable th {
    border: 2px solid #000000;
    padding: 8px;
}

#recordsTable tr:<%--nth-child(even)--%>{background-color: #f2f2f2;}

#recordsTable tr:hover {background-color: #a8ecab;}

#recordsTable th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: left;
    background-color: #4CAF50;
    color: white;
}

#recordsTable2 {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

#recordsTable2 td, #recordsTable2 th {
    border: 2px solid #000000;
    padding: 8px;
}

#recordsTable2 tr:<%--nth-child(even)--%>{background-color: #f2f2f2;}

#recordsTable2 tr:hover {background-color: #a8ecab;}

#recordsTable2 th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: left;
    background-color: #4CAF50;
    color: white;
}
</style>


    <script>
        getPacsAccountList();
        getExsPacsAccountList();

        function getPacsAccountList() {

            $.ajax({
                url:'../BulkMarkServletSTB',
                data:{"temp":"viewAccAuthSTB"},
                type:'post',
                cache:false,
               // success:function(data){
                    if(data!=null){
                    //response = $.parseJSON(data);
                $(function() {
                    $.each(data, function(i, item) {
                    var $tr = $('<tr>').append(
                    $('<td id="pacsId'+i+'">').text(item.rejectedQ),
                  
                    $('<td>').text(item.pendingQ),
                      $('<td>').text(item.authorisedQ),
                    $('<td>').html('<input type="button" id="'+i+'" value="View" onclick="viewDetails('+i+')"/>')
                    ).appendTo('#recordsTable');
            });
        });
                }
                else
                {
                    alert("no records");
                }},
                error:function(){
                }
            }
             );
        };
        function getExsPacsAccountList() {

            $.ajax({
                url:'../BulkMarkServletSTB',
                data:{"temp":"viewAccAuthSTB_Exs"},
                type:'post',
                cache:false,
                //success:function(data){
                    if(data!=null){
                    //response = $.parseJSON(data);
                $(function() {
                    $.each(data, function(i, item) {
                    var $tr = $('<tr>').append(
                    $('<td id="pacsId_Exs'+i+'">').text(item.rejectedQ),

                    $('<td>').text(item.pendingQ),
                      $('<td>').text(item.authorisedQ),
                    $('<td>').html('<input type="button" id="'+i+'" value="View" onclick="viewDetails_Exs('+i+')"/>')
                    ).appendTo('#recordsTable2');
                //console.log($tr.wrap('<p>').html());
            });
        });
                }
                else
                {
                    alert("no records");
                }},
                error:function(){

                }
            }
             );
        };

        function viewDetails(i)
        {
            var pacsId = $('#pacsId'+i).text();
            document.forms[0].temp.value = "redirectBulkForm";
            document.forms[0].tempId2.value = pacsId;
            bulkDetForm.action = '/PacsApplication/BulkMarkServletSTB';
            bulkDetForm.submit();
        }
        function viewDetails_Exs(i)
        {
            var pacsId = $('#pacsId_Exs'+i).text();
            document.forms[0].temp.value = "redirectBulkForm_Exs";
            document.forms[0].tempId2.value = pacsId;
            bulkDetForm.action = '/PacsApplication/BulkMarkServletSTB';
            bulkDetForm.submit();
        }
       
        function noBack()
            {
                window.history.forward();
                $('#chequDetTab').hide();
                $('#exsDetTab').hide();
            }
            
            $(document).ready(function () {
               $('select#searchCust').change(function () {
                    var shouldEnable = $(this).val();
                    switch(shouldEnable)
                    {
                        case 'N':
                            $('#chequDetTab').show();
                            $('#exsDetTab').hide();
                           // getPacsAccountList();
                            break;
                        case 'E':
                            $('#chequDetTab').hide();
                            $('#exsDetTab').show();
                           // getExsPacsAccountList();
                            break;
                        default:
                            $('#chequDetTab').hide();
                            $('#exsDetTab').hide();
                            break;
                    }
                });
            });

                      var repeater;

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

         <%
             String error_msg = "";
             Object error = request.getAttribute("message");
             if (error != null) {
                 error_msg = error.toString();
             }
        %>



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

        <div id="ChequeEnquiry">
            <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"></legend>--%>
                <legend style="padding: 8px; border-radius: 20px; background-color: #006600; color: white">Bulk Mark</legend>
                <form name="bulkDetForm" method="post" action="" id="bulkDetForm">
                    <%if (!error_msg.equalsIgnoreCase("")) {%>
                    <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                    <% }%>
                    <br>
                  <br><br>
                    <center>
                    <tr><td>Auth Bulk Mark for: </td><td><select id="searchCust" name="searchCust">
                                <option value=""> --Select-- </option>
                                <option value="N">Non-Existing Bank CIF</option>
                                <option value="E">Existing Bank CIF</option>
                            </select></td></tr>
                         <tr><td> <br></td></tr>
                         <br><br></center>

                    <div align="center" style="display:block" id="chequDetTab">
                        <%--<p>Tellerwise Transaction details</p>--%>
                        <div><p><font face="Trebuchet MS" color="#000000" size="4"><u>Marked Non-Existing Bank CIF Bulk Account Details</u></font></p></div>
                        <table border="2" width="auto" cellspacing="1" cellpadding="1" id ="recordsTable" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                            <thead class="CSSTableGenerator">

                                <tr>
                                    <td>Pacs Id</td>
                                    <td>Pacs Name</td>
                                    <td>Count</td>
                                    <td>Select</td>
                                    
                                </tr>
                            </thead>
                        </table>
                        <center>
                        <br><br>
                         <input type="hidden" id="tempId" value="redirectBulkForm" name="temp">
                         <input type="hidden" id="tempId2" name="tempId2">
                    </center>
                    </div>

                    <div align="center" style="display:block" id="exsDetTab">
                        <div><p><font face="Trebuchet MS" color="#000000" size="4"><u>Marked Existing Bank CIF Bulk Account Details</u></font></p></div>
                        <table border="2" width="auto" cellspacing="1" cellpadding="1" id ="recordsTable2" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                            <thead class="CSSTableGenerator">

                                <tr>
                                    <td>Pacs Id</td>
                                    <td>Pacs Name</td>
                                    <td>Count</td>
                                    <td>Select</td>

                                </tr>
                            </thead>
                        </table>
                        <center>
                        <br><br>                         
                    </center>
                    </div>
                </form>
            </fieldset>
        </div>
    </body>

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