<?php

/* DorcasTabithaBundle:Assistance:assistanceformedit.html.twig */
class __TwigTemplate_fe2f00a9164ea5fe240ac3bbd6479be5 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

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

        $this->blocks = array(
            'image' => array($this, 'block_image'),
            'body' => array($this, 'block_body'),
            'logout' => array($this, 'block_logout'),
            '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 2
    public function block_image($context, array $blocks = array())
    {
    }

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

<div id=\"override_javascript_alert\"></div>

<form id=\"clientform\" action=\"";
        // line 9
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("DorcasTabithaBundle_assistance_update", array("assistance_id" => $this->getAttribute($this->getContext($context, "assistance"), "assistanceid"))), "html", null, true);
        echo "\" method=\"post\" ";
        echo $this->env->getExtension('form')->renderEnctype($this->getContext($context, "form"));
        echo " class=\"dorcas\">

    <h4>Edit a Check - Admin Only</h4>

 

    <div style=\"width:30%; float:left;\">
                Purpose*
                ";
        // line 17
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "checkpurpose"), array("attr" => array("style" => "width: 160px;")));
        echo "
    </div>
    <div style=\"width:20%; float:left;\">
                ";
        // line 20
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "checks_issued_date"));
        echo "
                ";
        // line 21
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "checks_issued_date"));
        echo "
                ";
        // line 22
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "checks_issued_date"), array("attr" => array("size" => "11", "class" => "datepicker")));
        echo "
    </div>
    <div style=\"width:40%; float:left;\">
                ";
        // line 25
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "checks_issued_payee"));
        echo "
                ";
        // line 26
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "checks_issued_payee"));
        echo "
                ";
        // line 27
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "checks_issued_payee"), array("attr" => array("size" => "30")));
        echo "
    </div>
<br>&nbsp;<br>

    <div style=\"width:23%; float:left;\">
                ";
        // line 32
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "check_dorcas"));
        echo "
                ";
        // line 33
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "check_dorcas"));
        echo "
                ";
        // line 34
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "check_dorcas"), array("attr" => array("size" => "10", "onchange" => "isNumber(this)")));
        echo " 
    </div>
    <div style=\"width:23%; float:left;\">
                ";
        // line 37
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "check_oasis"));
        echo "
                ";
        // line 38
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "check_oasis"));
        echo "
                ";
        // line 39
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "check_oasis"), array("attr" => array("size" => "10", "onchange" => "isNumber(this)")));
        echo "
    </div>
    <div style=\"width:23%; float:left;\">
                ";
        // line 42
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "check_sfumc"));
        echo "
                ";
        // line 43
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "check_sfumc"));
        echo "
                ";
        // line 44
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "check_sfumc"), array("attr" => array("size" => "10", "onchange" => "isNumber(this)")));
        echo "
    </div>
    <div style=\"width:23%; float:left;\">
                ";
        // line 47
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "check_other"));
        echo "
                ";
        // line 48
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "check_other"));
        echo "
                ";
        // line 49
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "check_other"), array("attr" => array("size" => "10", "onchange" => "isNumber(this)")));
        echo "
    </div>

<br>&nbsp;<br>
        <div style=\" padding-top: 18px;\">
    <input type=\"button\" value=\"Save and Close Window\" onclick=\"closeandreload()\" >
    </div>      

                ";
        // line 57
        echo $this->env->getExtension('form')->renderRest($this->getContext($context, "form"));
        echo "

            ";
        // line 59
        if ($this->getAttribute($this->getAttribute($this->getContext($context, "app"), "session"), "hasFlash", array(0 => "notice"), "method")) {
            // line 60
            echo "                <div class=\"flash-notice\" >
                    ";
            // line 61
            echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($this->getContext($context, "app"), "session"), "flash", array(0 => "notice"), "method"), "html", null, true);
            echo "
                </div>
            ";
        }
        // line 64
        echo "
    <br />
</form>
</div>

";
    }

    // line 71
    public function block_logout($context, array $blocks = array())
    {
    }

    // line 74
    public function block_javascripts($context, array $blocks = array())
    {
        // line 75
        echo "
";
        // line 76
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo "
               
<script type=\"text/javascript\">          

\$(function() {
    \$( \".datepicker\" ).datepicker({ showAnim: \"slideDown\" });
});

</script>

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

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});
};


/**--------------------------
//* Validate Date Field script- By JavaScriptKit.com
//* For this script and 100s more, visit http://www.javascriptkit.com
//* This notice must stay intact for usage
---------------------------**/

function checkdate(input){
    var validformat=/^\\d{2}\\/\\d{2}\\/\\d{4}\$/ //Basic check for format validity
    var returnval=false
    if (!validformat.test(input))
    {
//        alert(\"Invalid Date Format. Please correct and submit again.\")
    }
    else{ //Detailed check for valid date ranges
        var monthfield=input.split(\"/\")[0]
        var dayfield=input.split(\"/\")[1]
        var yearfield=input.split(\"/\")[2]
        var dayobj = new Date(yearfield, monthfield-1, dayfield)
        if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
        {
//            alert(\"Invalid Day, Month, or Year range detected. Please correct and submit again.\")
        }
        else
            returnval=true
    }
//    if (returnval==false) input.select()
    return returnval
}


function closeandreload(){ 

    // Do Validation
    var payee = document.getElementById('assistanceform_checks_issued_payee');
    var dorcas = document.getElementById('assistanceform_check_dorcas');
    var oasis = document.getElementById('assistanceform_check_oasis');
    var sfumc = document.getElementById('assistanceform_check_sfumc');
    var other = document.getElementById('assistanceform_check_other');
    var cidate = document.getElementById('assistanceform_checks_issued_date');
    var purpose = document.getElementById('assistanceform_checkpurpose');
    var message = '';

    if ( payee.value == '' )
    {
        var valid = false;
        var message = message + '&#8227 Please enter a Payee.<br/>';
    }

    if ( dorcas.value == '' && oasis.value == '' && sfumc.value == '' && other.value == '' )
    {
        var valid = false;
        var message = message + '&#8227 Please enter a dollar value in one of the fields.<br/>';
    }

    if ( cidate.value == '' )
    {
        var valid = false;
        var message = message + '&#8227 Please enter a Date.<br/>';
    }

    // Check Checks Issued Date for valid date
    if ( cidate.value && !checkdate(cidate.value))
    {
        var valid = false;
        var message = message + '&#8227 Please enter a valid Date. <br/>';
    }

    if ( purpose.value == '1' )
    {
        var valid = false;
        var message = message + '&#8227 Please select a Purpose.<br/>';
    }

    if ( valid == false )
    {
        alert( message );
        return(false);
    }
    
    var form = document.forms[\"clientform\"];
    form.submit();
    opener.location.reload(true); // or opener.location.href = opener.location.href;
    window.close(); // or self.close(); 
}


function isNumber(field)
{
     if( isNaN(field.value)){
        alert(\"&#8227 Please enter a dollar amount with no dollar sign.\");
        field.value = 0;
        field.focus();
         }
}


</script>

    
";
    }

    public function getTemplateName()
    {
        return "DorcasTabithaBundle:Assistance:assistanceformedit.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  190 => 76,  187 => 75,  184 => 74,  179 => 71,  170 => 64,  164 => 61,  161 => 60,  159 => 59,  154 => 57,  143 => 49,  139 => 48,  135 => 47,  129 => 44,  125 => 43,  121 => 42,  115 => 39,  111 => 38,  107 => 37,  101 => 34,  97 => 33,  93 => 32,  85 => 27,  81 => 26,  77 => 25,  71 => 22,  67 => 21,  63 => 20,  57 => 17,  44 => 9,  37 => 4,  34 => 3,  29 => 2,);
    }
}
