<?php
/**
 * Copyright 2014 Zendesk.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
?>

<?php $tickets = $this->getList(); ?>

<?php if($tickets): ?>
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-account"><?php echo Mage::helper('zendesk')->__('Support Tickets') ?></h4>
        </div>
        <div class="grid">
            <div class="hor-scroll">
                <table cellspacing="0" class="data-table">
                    <thead>
                    <tr>
                        <th><?php echo Mage::helper('zendesk')->__('Subject') ?></th>
                        <th><?php echo Mage::helper('zendesk')->__('Requested') ?></th>
                        <th><?php echo Mage::helper('zendesk')->__('Updated') ?></th>
                        <th><?php echo Mage::helper('zendesk')->__('Status') ?></th>
                    </tr>
                    </thead>
                    <tbody class="odd">
                    <?php foreach($tickets as $ticket): ?>
                        <tr class="border">
                            <td><?php echo Mage::helper('zendesk')->getTicketUrl($ticket); ?></td>
                            <td><?php echo Mage::helper('core')->formatDate($ticket['created_at'], Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); ?></td>
                            <td><?php echo Mage::helper('core')->formatDate($ticket['updated_at'], Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); ?></td>
                            <td><?php echo ucwords($ticket['status']); ?></td>
                        </tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <?php else: ?>
    <div><?php echo $this->__('You dont have any tickets'); ?></div>
<?php endif; ?>
