<h2>Progress Tracker</h2>
{% if proxiesActive == false %}
<div class="error below-h2">
    <p><strong>Warning: </strong>Post tracking is disabled - there are no active proxies configured. 
        Go to <a href="{{ route('p1cm-proxies') }}">Proxies manager</a> to configure proxy servers.</p>
</div>
{% endif %}
<div class="frame-wrap">
	<div class="frame-sidebar">
		{% include '@p1cm/help.twig' %}
	</div>

	<div class="frame-content">
        <div class="frame-box">
            <h4>How to set up progress tracking</h4>
            <p>In order to set up the progress tracking of your posts, you need to either:</p>
            <p>- add the following line to the <i>crontab</i> on your server:
                <code>*/15 * * * * wget -o- -O- "{{ siteUrl }}/index.php?p1cm=tracker"</code><br/>
                <small>Your hosting company should provide you with instructions on how to perform that on your server.</small></p>
            <p>or: </p>
            <p>- use one of the many available online cron services (e.g.: <i>http://setcronjob.com</i>, <i>http://easycron.com</i>) to execute the following URL:
                <code>{{ siteUrl }}/index.php?p1cm=tracker</code></p>
        </div>

        <div class="frame-box">
            <div class="container p1cm-container">
                <div class="row p1cm-posts">
                    {% for post in posts %}
                        {% include '@p1cm/progress/post.twig' %}
                    {% endfor %}
                </div>
            </div>
        </div>
        
        {% if log %}
        <div class="frame-box p1cm-log">
            <h4>Progress Tracking Log</h4>
            <table class="table">
                <thead>
                    <tr>
                        <th>Post</th>
                        <th>Tracked Keyword</th>
                        <th>Date</th>
                        <th>Proxy Used</th>
                        <th>Result</th>
                    </tr>
                </thead>
                <tbody>
                    {% for entry in log %}
                    <tr class="{{ entry.result == 1 ? 'success' : 'warning' }}">
                        <td><a href="{{ entry.postEditLink }}">{{ entry.postTitle }}</a></td>
                        <td>{{ entry.keyword }}</td>
                        <td>{{ entry.time|date("Y-m-d H:i:s") }}</td>
                        <td>{{ entry.proxy.GetIp() }}</td>
                        <td>{{ entry.result == 1 ? 'Success' : 'Failure' }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% endif %}
	</div>
</div>
