<?php 

$model = (isset($model)) ? $model : new Prints;
$index = rand();
$errors = $model->getErrors();
?>

<div id="print<?php echo $index; ?>" class="print_form">
	<a href="#print<?php echo $index; ?>" onclick="removerPrint(<?php echo $index; ?>)" class="excluir_print">
		<?php echo FaHtml::iconDelete(); ?>
	</a>
	<?php if (!empty($model->PRT_ARQUIVO) && !is_array($model->PRT_ARQUIVO)) { ?>
    	<label for="ArquivoPrint<?php echo $index; ?>">Imagem atual</label>
		<?php echo $model->getLink(true); ?>
    	<input name="Prints[<?php echo $index; ?>][PRT_ARQUIVO]" type="hidden" value="<?php echo $model->PRT_ARQUIVO; ?>" />
	<?php } else { ?>
    	<label for="ArquivoPrint<?php echo $index; ?>" class="<?php if(isset($errors['PRT_ARQUIVO'])) echo 'error'?>" >Print <span class="required">*</span></label>
    	<input name="Prints[<?php echo $index; ?>]" type="file" class="<?php if(isset($errors['PRT_ARQUIVO'])) echo 'error'?>" accept="image/png, image/jpg, image/jpeg"/>
    	<?php 
	    if(isset($errors['PRT_ARQUIVO']))
	    	foreach($errors['PRT_ARQUIVO'] as $erro)
	    		echo '<div class="errorMessage">'.$erro.'</div>'
	    ?>
	<?php } ?>
    <label for="DescricaoPrint<?php echo $index; ?>" class="<?php if(isset($errors['PRT_DESCRICAO'])) echo 'error'; ?>">Descri&ccedil;&atilde;o <span class="required">*</span></label>
    <textArea name="Prints[<?php echo $index; ?>][PRT_DESCRICAO]" id="DescricaoPrint<?php echo $index; ?>" class="<?php if(isset($errors['PRT_DESCRICAO'])) echo 'error'; ?>"><?php echo $model->PRT_DESCRICAO; ?></textArea>
    <?php 
    if(isset($errors['PRT_DESCRICAO']))
    	foreach($errors['PRT_DESCRICAO'] as $erro)
    		echo '<div class="errorMessage">'.$erro.'</div>'
    ?>
</div>