<div class="info-cliente atendimentos">
    <div class="col-xs-12 header">
        <a data-toggle='tooltip' data-placement='right' class="col-xs-1" title='Atendimento do Comercial'>
            <i class="fa fa-usd"></i> Código: <?php echo $data->ATD_IDATENDIMENTO; ?>
        </a>
        <ul class="col-xs-11 text-right">
            <?php //if ($data->getLinkEditar()) { ?>
            <?php if (User::isAdmin()) { ?>
                <li>
                    <a href="<?= Yii::app()->createUrl('clientesCancelamentos/updateContato',
                                                       array('id'=>$data->ATD_IDATENDIMENTO)); ?>">
                        <?= FaHtml::iconUpdate(); ?>
                    </a>
                </li>
            <?php } ?>
            <?php if (User::isAdmin()) { ?>
                <li>
                    <a href="<?= Yii::app()->createUrl('atendimentos/savdelete', array('id'=>$data->ATD_IDATENDIMENTO)); ?>"
                       onclick="return confirm('Deseja realmente excluir este item?');">
                       <?= FaHtml::iconDelete(); ?>
                    </a>
                </li>
            <?php } ?>
        </ul>
    </div>
    <?php $last = 'odd'; ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="solicitacoes-view">
        <tr class="<?= $last = ($last=='even'?'odd':'even'); ?>">
            <td width="5%"><strong>Data</strong></td>
            <td width="15%"><?= $data->ATD_DTCADASTRO; ?></td>
            <td width="5%"><strong>Horário</strong></td>
            <td width="15%">
                <?php
                    echo substr($data->ATD_HORAINICIO, 0, 5);
                    if(isset($data->ATD_HORAFINAL)){
                        echo " às ".substr($data->ATD_HORAFINAL, 0, 5);
                    }
                ?>
            </td>
            <td width="10%"><strong>Total de Horas</strong></td>
            <td width="20%"><?= substr($data->ATD_TOTALHORAS, 0, 5); ?></td>
            <td width="5%"><strong>Vendedor</strong></td>
            <td width="25%"><?= $data->Atendente; ?></td>
        </tr>
        <tr class="<?= $last = ($last=='even'?'odd':'even'); ?>">
            <td><strong>Situação</strong></td>
            <td><?= Util::getSituacaoAtendimento($data->ATD_SITUACAO); ?></td>
            <td><strong>Motivo</strong></td>
            <td><?= $data->Motivo; ?></td>
            <td><strong>Contato</strong></td>
            <td><?= $data->ATD_CONTATO; ?></td>
            <td><strong>Autor</strong></td>
            <td><?= (empty($data->ATD_IDUSUARIO)) ? $data->Atendente : $data->Funcionario; ?></td>
        </tr>
        <tr class="<?= $last = ($last=='even'?'odd':'even'); ?>">
            <td><strong>Descrição</strong></td>
            <td colspan="7" class="overflow-break-word">
                <?= Util::niceTextAtendimentos($data->ATD_OBS); ?>
                <?php if (!empty($data->ATD_UPDATE)) { ?>
                    <a class="toggle_atendimentos_update" href="#" data-toggle="toggle_<?= $data->ATD_IDATENDIMENTO; ?>">
                        Atualizações<i class="fa fa-sort-desc"></i>
                    </a>
                <?php } ?>
            </td>
        </tr>
        <?php if (!empty($data->ATD_UPDATE)) { ?>
            <tr class="<?= $last = ($last=='even'?'odd':'even'); ?> toggle_atd toggle_<?= $data->ATD_IDATENDIMENTO; ?>">
                <td><strong>Atualizações</strong></td>
                <td colspan="7" class="overflow-break-word">
                    <?= Util::niceTextAtendimentos($data->ATD_UPDATE); ?>
                </td>
            </tr>
        <?php } ?>
        <?php if(!empty($data->Arquivos)) { ?>
            <tr class="<?= $last = ($last=='even'?'odd':'even'); ?>">
                <td><strong>Arquivos</strong></td>
                <td colspan="7">
                    <ul id="links" class="imagens tab-pane fade in active">
                        <?php foreach($data->Arquivos as $arquivo) { ?>
                            <li><?= $arquivo->getLink(); ?></li>
                        <?php } ?>
                    </ul>
                </td>
            </tr>
        <?php }?>
    </table>
</div>