<?php

namespace App\Terms;

class RelatorioPetUnidade
{

    public function getRelatorioPetUnidade($dados)
    {
        $html = '';
        $html .= '<html>';
        $html .= '<head>';
        $html .= '	<title></title>';
        $html .= '	<style>
	                    h3 {
	                        margin: 40px 0px;
	                    }
	                    .info{
	                        margin: 40px 0px;
	                    }
	                    .rodape{
	                        margin-top: 350px;
	                        text-align: center;
	                    }
	
	
                    </style>';
        $html .= '</head>';
        $html .= '<body>';
        $html .= '<h3>';
        $html .= " <div style='text-align: center;'>";
        $html .= " RELATÓRIO DE PETS POR UNIDADE <br/>";
        $html .= " </h3>";
        $html .= "";

        $html .= '<table style="font-size: 13px" border="0" width="100%">
                 <tr>
                    <td style="text-align: center"><strong> Id pet</strong></td>
                    <td style="text-align: center"><strong>Nome do pet</strong></td>
                    <td style="text-align: center"><strong>Nascimento</strong></td>
                    <td style="text-align: center"><strong>Id Tutor</strong></td>
                    <td style="text-align: center"><strong>Tutor</strong></td>
                    <td style="text-align: center"><strong>Data Cadastro</strong></td>
                    <td style="text-align: center"><strong>Raça</strong></td>
                </tr>';

        $html .= '
            <tr>
                <td colspan="12"><hr></td>
            </tr>
        ';

        // FOREACH PETS
        foreach ( $dados as $key => $value ) {
            $html .= '
                <tr>
                    <td style="text-align: center;">' . $value["id_pet"] . ' </td>
                    <td style="text-align: center;">' . $value["nome_pet"] . ' </td>
                    <td style="text-align: center;">' . date( "d/m/Y", strtotime( $value["data_nascimento"] ) ) . '</td>
                    <td style="text-align: center;">' . $value["id_paciente"] . '</td>
                    <td style="text-align: center;">' . $value["nome"] . ' </td>
                    <td style="text-align: center;">' . $value["criado_em"] . ' </td>
                    <td style="text-align: center;">' . $value["nome_raca"] . ' </td>
                </tr>
            ';
        }
        $html .= '</table>';


        $html .= "</body>";
        $html .= "</html>";

        return $html;
    }
}