<?php

/* DorcasTabithaBundle:Users:userform.html.twig */
class __TwigTemplate_802d0f8647ed81178d719a125e6d35b6 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("::base.html.twig");

        $this->blocks = array(
            'body' => array($this, 'block_body'),
            'javascripts' => array($this, 'block_javascripts'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "::base.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_body($context, array $blocks = array())
    {
        // line 4
        echo "
<div id=\"override_javascript_alert\"></div>
<div id=\"override_javascript_alertx\"></div>

<div id=\"navbar\" style=\"font-size:18px;\">   
    <ul>       
        <li><a href=\"";
        // line 10
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("DorcasTabithaBundle_homepage"), "html", null, true);
        echo "\">Home</a></li>
        <li><a href=\"";
        // line 11
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("DorcasTabithaBundle_search_show"), "html", null, true);
        echo "\">Client Search</a></li> 
        <li><a href=\"";
        // line 12
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("DorcasTabithaBundle_clientinformation_new"), "html", null, true);
        echo "\">New Client</a></li> 
        ";
        // line 13
        if ($this->env->getExtension('security')->isGranted("ROLE_ADMIN")) {
            // line 14
            echo "            <li><a href=\"";
            echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("DorcasTabithaBundle_users_show"), "html", null, true);
            echo "\" style=\"background-color:#00b5cb; font-size:30px;\">Users</a></li>
            <li><a href=\"";
            // line 15
            echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("DorcasTabithaBundle_message_show"), "html", null, true);
            echo "\">Message/Reports</a></li>
        ";
        }
        // line 16
        echo "  
    </ul> 
</div>

    <section class=\"user\" id=\"users\">
                ";
        // line 22
        echo "       

        ";
        // line 24
        if (array_key_exists("form", $context)) {
            // line 25
            echo "            <div style=\"color:maroon;\">
            ";
            // line 26
            echo $this->env->getExtension('form')->renderErrors($this->getContext($context, "form"));
            echo "
            </div>
        ";
        }
        // line 29
        echo "
        ";
        // line 30
        echo $this->env->getExtension('actions')->renderAction("DorcasTabithaBundle:Users:new", array(), array());
        // line 31
        echo "    </section>

    <section class=\"users\" id=\"users\">
        <section class=\"previous-users\">       
           ";
        // line 35
        $this->env->loadTemplate("DorcasTabithaBundle:Users:userloop.html.twig")->display(array_merge($context, array("users" => $this->getContext($context, "users"))));
        // line 36
        echo "        </section>
    </section>

    </div>
</div>

";
    }

    // line 44
    public function block_javascripts($context, array $blocks = array())
    {
        // line 45
        echo "
    ";
        // line 46
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo " 

<script type=\"text/javascript\">

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

}   

window.alert = function(message) {
\t\$('#override_javascript_alert').html(message).dialog({
\t\tmodal:true,
\t\ttitle:'Tabitha Validation Message',
\t\tbuttons: {
\t\t\t'OK':function(){
\t\t\t\t\$(this).dialog('close');
\t\t\t}
\t\t}
\t});
};

function save(nav)
{ 
    // Read all values

    var username = document.getElementById('userform_username');
    var firstname = document.getElementById('userform_first_name');
    var lastname = document.getElementById('userform_last_name');
    var passwordfirst = document.getElementById('userform_password_first');
    var passwordsecond = document.getElementById('userform_password_second');
    var phone = document.getElementById('userform_phone');
    var email = document.getElementById('userform_email');

    okaytosubmit = true;
    alertMessage = \"\";

    // Check username for length < 5 characters
    if ( username.value.length < 5 )
    {
        alertMessage = alertMessage + '&#8227 Username must have at least 5 <br/>&nbsp; characters.<br/>';
        okaytosubmit = false;
    }

    // Check Password First not blank and for length < 8 chanracters
    if ( passwordfirst.value != '' && passwordfirst.value.length < 8 )
    {
        alertMessage = alertMessage + '&#8227 Password must have at least 8 <br/>&nbsp; characters.<br/>';
        okaytosubmit = false;
    }

    // Check Password Second not blank and for length < 8 chanracters
    else if ( passwordsecond.value != '' && passwordsecond.value.length < 8 )
    {
        alertMessage = alertMessage + '&#8227 Confirm Password must have at least 8 <br/>&nbsp; characters.<br/>';
        okaytosubmit = false;
    }

    // Check that passwords match
    if ( passwordfirst.value != passwordsecond.value )
    {
        alertMessage = alertMessage + '&#8227 Passwords do not match.<br/>';
        okaytosubmit = false;
    }


    // Check First Name not blank
    if ( firstname.value == '' )
    {
        alertMessage = alertMessage + '&#8227 Please enter a First Name.<br/>';
        okaytosubmit = false;
    }

    // Check Last Name not blank
    if ( lastname.value == '' )
    {
        alertMessage = alertMessage + '&#8227 Please enter a Last Name.<br/>';
        okaytosubmit = false;
    }

    // Check Phone for < 14 characters
    if ( phone.value && phone.value.length < 14 )
    {
        alertMessage = alertMessage + '&#8227 Please complete Phone number.<br/>';
        okaytosubmit = false;
    }

    // Check Email for valid (kinda) address
    if ( email.value )
    {
        var atpos = email.value.indexOf(\"@\");
        var dotpos = email.value.lastIndexOf(\".\");
        if ( atpos <1 || dotpos < atpos+2 || dotpos+2 >= email.value.length)
        //if ( email.value && email.value.indexOf(\"@\") == -1 ))
        {
        alertMessage = alertMessage + '&#8227 Please enter a valid Email address.<br/>';
        okaytosubmit = false;
        }
    }

    if (okaytosubmit == true)
    {
        var form = document.forms[\"clientform\"];
        form.submit();
    }
    else
    {
        alert(alertMessage);
    }
}


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

warnRedirect = function(uriLocation, message) {
\t\$('#override_javascript_alertx').html(message).dialog({
\t\tmodal: true,
                title:'Tabitha Warning Message',
\t\t\tbuttons: {
\t\t\t\t\"Delete User\": function() {
                                        window.location = uriLocation;
\t\t\t\t\t\$( this ).dialog( \"close\" );
\t\t\t\t},
\t\t\t\tCancel: function() {
\t\t\t\t\t\$( this ).dialog( \"close\" );
\t\t\t\t}
\t\t\t}
\t\t});
\t};
        


</script>   
 
";
    }

    public function getTemplateName()
    {
        return "DorcasTabithaBundle:Users:userform.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  113 => 46,  110 => 45,  107 => 44,  97 => 36,  95 => 35,  89 => 31,  87 => 30,  84 => 29,  78 => 26,  75 => 25,  73 => 24,  69 => 22,  62 => 16,  57 => 15,  52 => 14,  50 => 13,  46 => 12,  42 => 11,  38 => 10,  30 => 4,  27 => 3,);
    }
}
