The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
[% USE HTML %]
[% INCLUDE includes/errors %]

[% page.id = 'page-wishlist' %]
[% IF NOT wishlist %]
	[% page.title = c.localize('WISHLIST_NOT_FOUND') %]
[% ELSE %]
    [% page.title = wishlist.name -%]
	<ul>
	   <li><a href="[% c.uri_for_resource('mango/wishlists', 'edit', [wishlist.id]) %]/">[% c.localize('LINK_TEXT_EDIT') %]</a></li>
	</ul>
    [% c.forms('wishlists_delete').render(
        'action', c.uri_for_resource('mango/wishlists', 'delete', [wishlist.id]) _ '/'
    ) %]
    [% c.forms('wishlists_restore').render(
        'action', c.uri_for_resource('mango/wishlists', 'restore', [wishlist.id]) _ '/'
    ) %]
                    
    [% HTML.escape(wishlist.description) %]

    [% IF wishlist.count %]
        <table border="0" cellpadding="3" cellspacing="5">
            <tr>
                <th align="left">[% c.localize('LABEL_SKU') %]</th>
                <th align="left">[% c.localize('LABEL_DESCRIPTION') %]</th>
                <th align="center">[% c.localize('LABEL_QUANTITY') %]</th>
                <th align="right">[% c.localize('LABEL_UNIT_PRICE') %]</th>
                <th align="right">[% c.localize('LABEL_TOTAL') %]</th>
                <th colspan="2"></th>
            </tr>
	   [% FOREACH item = wishlist.items %]
            <tr>
	           <td align="left">[% HTML.escape(item.sku) %]</td>
	           <td align="left">[% HTML.escape(item.description) %]</td>
	           <td align="center">
		          [% SET form = c.forms('wishlists_items_update') %]
		          [% CALL form.id(form.id _ '_' _ item.id) %]
		          [% form.render('values', [item.quantity], 
		                         'action', c.uri_for_resource('mango/wishlists/items', 'update', [wishlist.id, item.id]) _ '/'
		          ) %]
	           </td>
	           <td align="right">[% HTML.escape(item.price.as_string('FMT_SYMBOL')) %]</td>
	           <td align="right">[% HTML.escape(item.total.as_string('FMT_SYMBOL')) %]</td>
	           <td></td>
	           <td>
		          [% SET form = c.forms('wishlists_items_delete') %]
		          [% CALL form.id(form.id _ '_' _ item.id) %]
		          [% form.render('values', [item.id, item.quantity], 
		                         'action', c.uri_for_resource('mango/wishlists/items', 'delete', [wishlist.id, item.id]) _ '/'
		          ) %]
	           </td>
            </tr>
	   [% END %]
            <tr>
                <td colspan="7"></td>
            </tr>
            <tr>
                <th colspan="4" align="right">[% c.localize('LABEL_SUBTOTAL') %]:</th>
                <td align="right">[% HTML.escape(wishlist.subtotal.as_string('FMT_SYMBOL')) %]</td>
                <td colspan="2"></td>
            </tr>
            <tr>
                <td colspan="6"></td>
                <td>
                    [% c.forms('wishlists_clear').render(
                        'action', c.uri_for_resource('mango/wishlists', 'clear', [wishlist.id]) _ '/'
                    ) %]
                </td>
            </tr>
        </table>
    [% ELSE %]
        <p>[% c.localize('WISHLIST_IS_EMPTY') %]</p>
    [% END %]
[% END %]