<!-- wbjobdesc/index.phtml -->

<script type="text/javascript">
// use :
// <a href="/" id="confirm" class="confirm"> TEST2 </a>
$(document).ready(
    function() {
    $('a.confirm').click(function() {
        document.location = $(this).attr("href");
        return false;
    });

    $('a.confirm').confirm({
        msg:'<?php echo $this->translate->_("Are you sure?") ?>',
        timeout:10000,
        buttons: {
            wrapper:'<button></button>',
            ok:'<?php echo $this->translate->_("Delete") ?>',
            cancel:'<?php echo $this->translate->_("Cancel") ?>',
            separator:' '
        }
    });
});
</script>


<h1><?php echo $this->escape($this->title); ?></h1>

<div style="width: 200px; margin-top: 30px; margin-bottom: 20px;">
<form method="POST" action="<?php echo $this->baseUrl ?>/wbjobdesc/add">
    <input type="submit" name="name1" value="<?php print $this->translate->_("+ Add New Record"); ?>" class="ui-button ui-state-default ui-corner-all">
</form>
</div>

<?php if ($this->result): ?>

<table id="box-table-wbjobdesc" border="0"  width="70%">
<thead>
<tr>
    <th scope="col">&nbsp;</th>
    <th scope="col" width="35%"> <?php print $this->translate->_("Job Name"); ?> </th>
    <th scope="col"> <?php print $this->translate->_("Job Description"); ?> </th>
    <th scope="col" width="10%"> <?php print $this->translate->_("Retention period"); ?> </th>
    <th scope="col" width="50px">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php foreach($this->result as $line) : ?>
<tr>
    <td style="padding: 0px;">
        <?php
            if ( isset($line['name_job']) )    {
                // re-run button
                echo '<a href="';
                echo $this->baseUrl, '/job/run-job/jobname/', $this->escape($line['name_job']);
                echo '" title="', $this->translate->_("Run Job"), '">';
                echo '<img src="', $this->baseUrl, '/images/re-run-job.png" alt="', $this->translate->_("Run Job"), '" border="0" hspace="2">';
            }
        ?>
    </td>
    <td><?php echo $line['name_job'] ?></td>
    <td><?php echo $line['description'] ?></td>
    <td><?php echo $line['retention_period'] ?></td>
    <td>
        <a href="<?php echo $this->baseUrl ?>/wbjobdesc/modify/desc_id/<?php echo $line['desc_id'] ?>" title="<?php echo $this->translate->_("Modify record") ?>">
        <img src="<?php echo $this->baseUrl ?>/images/document-edit.png" alt="<?php echo $this->translate->_("Modify record") ?>" border="0" hspace="2">
        </a>

        <a href="<?php echo $this->baseUrl ?>/wbjobdesc/delete/desc_id/<?php echo $line['desc_id'] ?>" title="<?php echo $this->translate->_("Delete record") ?>" id="confirm" class="confirm">
            <img src="<?php echo $this->baseUrl ?>/images/edit-delete.png" alt="<?php echo $this->translate->_("Delete record") ?>" border="0" hspace="2">
        </a>
    </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

<?php else: ?>
<div class="ui-widget" style="width: 40%; margin-left: auto; margin-right: auto;">
	<div class="ui-state-highlight ui-corner-all" style="padding: 0pt 0.7em; margin-top: 20px;">
		<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: 0.3em;"></span>
		<strong><?php print $this->translate->_("No records found."); ?></strong></p>
	</div>
</div>
<?php endif; ?>