<?php

/* DorcasTabithaBundle:Assistance:assistanceformeditsp.html.twig */
class __TwigTemplate_83dcb878e46cab4fb496582519e33611 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_updatesp", 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 Special Program - Admin Only</h4>

 

    <div style=\"width:36%; float:left;\">
                Program*
                ";
        // line 17
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "special_program"), array("attr" => array("style" => "width: 220px;")));
        echo "
    </div>
    <div style=\"width:20%; float:left;\">
                ";
        // line 20
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "special_program_date"));
        echo "
                ";
        // line 21
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "special_program_date"));
        echo "
                ";
        // line 22
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "special_program_date"), array("attr" => array("size" => "11", "class" => "datepicker")));
        echo "
    </div>
    <div style=\"width:44%; float:left;\">
                ";
        // line 25
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "special_program_recipient_name"));
        echo "
                ";
        // line 26
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "special_program_recipient_name"));
        echo "
                ";
        // line 27
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "special_program_recipient_name"), array("attr" => array("size" => "30")));
        echo "
    </div>
    <br >&nbsp;<br />
    <div style=\"width:50%; float:left;\">
                ";
        // line 31
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "special_program_parent_name"));
        echo "
                ";
        // line 32
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "special_program_parent_name"));
        echo "
                ";
        // line 33
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "special_program_parent_name"), array("attr" => array("size" => "30")));
        echo "
    </div>
    <div style=\"width:23%; float:left;\">
                ";
        // line 36
        echo $this->env->getExtension('form')->renderLabel($this->getAttribute($this->getContext($context, "form"), "special_program_check"));
        echo "
                ";
        // line 37
        echo $this->env->getExtension('form')->renderErrors($this->getAttribute($this->getContext($context, "form"), "special_program_check"));
        echo "
                ";
        // line 38
        echo $this->env->getExtension('form')->renderWidget($this->getAttribute($this->getContext($context, "form"), "special_program_check"), 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 47
        echo $this->env->getExtension('form')->renderRest($this->getContext($context, "form"));
        echo "

            ";
        // line 49
        if ($this->getAttribute($this->getAttribute($this->getContext($context, "app"), "session"), "hasFlash", array(0 => "notice"), "method")) {
            // line 50
            echo "                <div class=\"flash-notice\" >
                    ";
            // line 51
            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 54
        echo "
    <br />
</form>
</div>

";
    }

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

    // line 64
    public function block_javascripts($context, array $blocks = array())
    {
        // line 65
        echo "
";
        // line 66
        $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 recipient = document.getElementById('assistanceform_special_program_recipient_name');
    var spcheck = document.getElementById('assistanceform_special_program_check');
//    var parent = document.getElementById('assistanceform_special_program_parent_name');
    var spdate = document.getElementById('assistanceform_special_program_date');
    var program = document.getElementById('assistanceform_special_program');
    var message = '';

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

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

    // Check Special Programs Date for valid date
    if ( spdate.value && !checkdate(spdate.value))
    {
        var valid = false;
        var message = message + '&#8227 Please enter a valid Date. <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:assistanceformeditsp.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  162 => 66,  159 => 65,  156 => 64,  151 => 61,  142 => 54,  136 => 51,  133 => 50,  131 => 49,  126 => 47,  114 => 38,  110 => 37,  106 => 36,  100 => 33,  96 => 32,  92 => 31,  85 => 27,  81 => 26,  77 => 25,  71 => 22,  67 => 21,  63 => 20,  57 => 17,  44 => 9,  37 => 4,  34 => 3,  29 => 2,);
    }
}
