<?php

/**
 * Render Email Templates
 *
 * Echo form templates for visual styling in the browser
 *
 * @author Andrew Morgan <andrew.morgan@mtcmedia.co.uk>
 */

use Mtc\Modules\Members\Models\Member;

$path = '../../../';
require_once $path.'core/includes/header.inc.php';

$header_style = 'font-family: Helvetica,Arial,sans-serif;text-align:center;margin:40px 0 0;font-size:30px;';
?>
<h1 style="<?= $header_style ?>font-size:40px;margin-bottom:40px;">Members Emails</h1>

<?php

if (empty($_REQUEST['member_id'])) {
    $member = Member::inRandomOrder()->get();
} else {
    $member = Member::find((int) $_REQUEST['member_id']);
}

if (! empty($member)) {
    $options['member'] = $member;

    $filepath = 'emails/members/reset_password.twig';
    echo "<hr/><h1 style='".$header_style."'>Reset Password</h1>";
    echo "<pre style='text-align:center;'>".$filepath.'</pre>';
    echo $twig->render($filepath, $options);

    $filepath = 'emails/members/trade_register.twig';
    echo "<hr/><h1 style='".$header_style."'>Trade Registration</h1>";
    echo "<pre style='text-align:center;'>".$filepath.'</pre>';
    echo $twig->render($filepath, $options);
} else {
    echo 'No Member accounts have been created to show data for';
}
