{% extends "::base.html.twig" %}        

{% block body %}

    <div id="override_javascript_alertx"></div>

<div id="navbar" style="font-size:18px;">   
    <ul>       
        <li><a href="{{ path('DorcasTabithaBundle_homepage' ) }}">Home</a></li>
        <li><a href="{{ path('DorcasTabithaBundle_search_show' ) }}" style="background-color:#00b5cb; font-size:30px;">Client Search</a></li> 
        <li><a href="{{ path('DorcasTabithaBundle_clientinformation_new' ) }}">New Client</a></li> 
        {% if is_granted('ROLE_ADMIN') %}
            <li><a href="{{ path('DorcasTabithaBundle_users_show' ) }}">Users</a></li> 
            <li><a href="{{ path('DorcasTabithaBundle_message_show' ) }}">Message/Reports</a></li> 
        {% endif %}  
    </ul> 
</div>

    <section class="user" id="users">
                {# .. #}
        <br/>
        <input type=button onClick="location.href='javascript: clearform()'" value='Clear Search' style="color:#00b5cb; background-color:white; margin-right: 30px;">
        {% if allnumberrecords > 100 %}
            <input type=button onClick="jsSubmit()" value="Display ALL Records"  style="color:#00b5cb; background-color:white; margin-right: 30px;">  
        {% endif %}

        {% render 'DorcasTabithaBundle:Search:renew' %}

    </section>

    <section class="users" id="users">
        <section class="previous-users">       
           {% include 'DorcasTabithaBundle:Search:searchloop.html.twig' with { 'clients': clients, 'numberrecords': numberrecords , 'allnumberrecords': allnumberrecords} %}
        </section>
    </section>

    </div>
</div>

{% endblock %}

{% block javascripts %}

    {{ parent() }}           
 
<script type="text/javascript">

function jsSubmit(){ 
    var form = document.forms["clientform"];
    form.action ="true";
    form.submit();
}

function displayemail()
{
    var textareaid = document.getElementById('emailList');
    if ( textareaid.style.display=='none')
    {
        textareaid.style.display='block';
    }
    else
    {
        textareaid.style.display='none';
    }

}

function clearform()
{
    var textboxid = document.getElementById('clientinformationform_ssn');
    textboxid.value = "";
    var input = document.getElementById('clientinformationform_first_name');
    input.value = "";
    var input = document.getElementById('clientinformationform_last_name');
    input.value = "";
    var input = document.getElementById('clientinformationform_alias');
    input.value = "";
    var input = document.getElementById('clientinformationform_current_address');
    input.value = "";
    var input = document.getElementById('clientinformationform_prev_address1');
    input.value = "";
    var input = document.getElementById('clientinformationform_other_adult_oneLastName');
    input.value = "";
    var input = document.getElementById('clientinformationform_other_adult_twoLastName');
    input.value = "";  
    var input = document.getElementById('clientinformationform_other_adult_oneFirstName');
    input.value = "";  
    var input = document.getElementById('clientinformationform_other_adult_twoFirstName');
    input.value = "";  
}  


function warnUsersDelete(uriLocation)
{
     alertMessage = '<p style = "color:red;"> Warning: Are you sure you want to delete this client record? </p>';
     warnRedirect(uriLocation, alertMessage);
}

warnRedirect = function(uriLocation, message) {
	$('#override_javascript_alertx').html(message).dialog({
		modal: true,
                title:'Tabitha Warning Message',
			buttons: {
				"Delete Client Record": function() {
                                        window.location = uriLocation;
					$( this ).dialog( "close" );
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			}
		});
	};
        
 
</script>

{% endblock %}