<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="margin:0; padding:0; background-color:#f0eeea; font-family:Arial,sans-serif;">

<table width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f0eeea; padding:20px 0;">
<tr><td align="center">
<table width="600" cellpadding="0" cellspacing="0" border="0" style="max-width:600px; background:#ffffff;">

    <!-- Header -->
    <tr>
        <td style="height:4px; background:#e94560; font-size:0; line-height:0;">&nbsp;</td>
    </tr>
    <tr>
        <td style="background:#1a1a2e; padding:18px 30px;">
            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td style="width:36px; height:36px; background:#e94560; text-align:center; vertical-align:middle;">
                                    <span style="font-family:Georgia,serif; font-size:18px; font-weight:bold; color:#ffffff;">N</span>
                                </td>
                                <td style="padding-left:12px;">
                                    <span style="font-family:Georgia,serif; font-size:17px; font-weight:bold; color:#f8f7f4; letter-spacing:1px;">NICC</span><br>
                                    <span style="font-family:Arial,sans-serif; font-size:10px; color:#a0a0b8; letter-spacing:1px; text-transform:uppercase;">Resumen Semanal</span>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td align="right" valign="middle">
                        <span style="font-family:Arial,sans-serif; font-size:10px; font-weight:bold; color:#f59e0b; letter-spacing:1px; text-transform:uppercase; border:1px solid rgba(245,158,11,0.4); padding:4px 10px;">Semanal</span>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

    <!-- Body -->
    <tr>
        <td style="background:#f8f7f4; padding:28px 30px;">

<?php if (count($tpl->get('issues')) > 0): ?>
<h2 style="font-size:15px; color:#1a1a2e; margin:0 0 12px 0; border-bottom:2px solid #e94560; padding-bottom:8px;">Sus proyectos activos</h2>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom:24px;">
    <tr>
        <th style="text-align:left; background:#1a1a2e; color:#f8f7f4; padding:8px 10px; font-size:12px;">No.</th>
        <th style="text-align:left; background:#1a1a2e; color:#f8f7f4; padding:8px 10px; font-size:12px;">Tipo</th>
        <th style="text-align:left; background:#1a1a2e; color:#f8f7f4; padding:8px 10px; font-size:12px;">Titulo</th>
        <th style="text-align:left; background:#1a1a2e; color:#f8f7f4; padding:8px 10px; font-size:12px;">Creado</th>
        <th style="text-align:left; background:#1a1a2e; color:#f8f7f4; padding:8px 10px; font-size:12px;">Tareas cerradas</th>
    </tr>
<?php foreach ($tpl->get('issues') as $issue): ?>
<?php
$color = "#ffffff";
switch($issue->priority) {
    case '2':
        $color = "#fce4ec";
        break;
    case '1':
        $color = "#fff8e1";
        break;
    case '0':
        $color = "#e8f5e9";
        break;
}
?>
    <tr style="background-color:<?php echo $color ?>">
        <td style="padding:8px 10px; border-bottom:1px solid #f0eeea; font-size:13px;">
            <a href="<?php echo $tpl->url('thread', 'id', $issue->id) ?>" style="color:#e94560; font-weight:bold; text-decoration:none;">#<?php echo $issue->id ?></a>
        </td>
        <td style="padding:8px 10px; border-bottom:1px solid #f0eeea; font-size:13px; color:#1a1a2e;"><?php echo $issue->label_name ?></td>
        <td style="padding:8px 10px; border-bottom:1px solid #f0eeea; font-size:13px; color:#1a1a2e;"><?php echo $issue->title ?></td>
        <td style="padding:8px 10px; border-bottom:1px solid #f0eeea; font-size:12px; color:#7a7a8e;"><?php echo $issue->create_date ?> (<?php echo $tpl->date_fuzzy_age($issue->create_date) ?>)</td>
        <td style="padding:8px 10px; border-bottom:1px solid #f0eeea; font-size:13px; color:#1a1a2e; font-weight:bold;"><?php echo $issue->task_count_closed ?>/<?php echo $issue->task_count ?></td>
    </tr>
<?php endforeach ?>
</table>
<?php endif ?>

<?php if (count($tpl->get('outdated_tasks')) > 0): ?>
    <h2 style="font-size:15px; color:#e94560; margin:0 0 12px 0; border-bottom:2px solid #e94560; padding-bottom:8px;">Tareas vencidas</h2>
    <?php $tpl->set('tasks', $tpl->get('outdated_tasks')) ?>
    <?php include 'weekly-message-tasks.php' ?>
<?php endif ?>

<?php if (count($tpl->get('coming_tasks')) > 0): ?>
    <h2 style="font-size:15px; color:#f59e0b; margin:0 0 12px 0; border-bottom:2px solid #f59e0b; padding-bottom:8px;">Tareas proximas</h2>
    <?php $tpl->set('tasks', $tpl->get('coming_tasks')) ?>
    <?php include 'weekly-message-tasks.php' ?>
<?php endif ?>

        </td>
    </tr>

</table>

<?php include __DIR__ . "/../mail/footer.php" ?>

</td></tr>
</table>

</body>
</html>
