<tr>

    <td class="i-update-icon">

        {* ICON *}

        {if $item_type eq 'app' &&  !empty($item.icons.48)}

            <img src="{$item.icons.48|default:$item.icons.16}" alt="">
        {else}
            &nbsp;
        {/if}
    </td>

    <td class="i-update-name">

        {* PRODUCT NAME *}

        {if $item_type eq 'plugin' ||  $item_type eq 'theme' || $item_type eq 'widget' }

            {* theme or plugin *}

            {if !empty($item.icons) && false}
                <img src="{$item.icons.16}" alt="">
            {else}
                <i class="icon16 {if $item_type eq 'plugin'}plugins{elseif $item_type eq 'widget'}widgets{else}design{/if}"></i>
            {/if}

            {if $item_type eq 'plugin'}
                {sprintf('[`Plugin "<strong>%s</strong>"`]',{$item.name|default:$item_id|escape})}
            {elseif $item_type eq 'theme' }
                {sprintf('[`Theme "<strong>%s</strong>"`]',{$item.name|default:$item_id|escape})}
            {elseif $item_type eq 'widget' }
                {sprintf('[`Widget "<strong>%s</strong>"`]',{$item.name|default:$item_id|escape})}
            {else}
                {$item.name|default:$item_id|escape}
            {/if}
        {else}

            {* apps and system plugins *}

            {if $item_type eq 'systemplugin'}
                <strong>{sprintf('[`Plugin "<strong>%s</strong>"`]',{$item.name|default:$item_id|escape})}</strong>
            {else}
                <strong class="large">{$item.name|default:$item_id|escape}</strong>
            {/if}

        {/if}

        {if !empty($item.vendor_name)}
            <span class="hint">{$item.vendor_name|escape}</span>
        {/if}
    </td>

    <td class="i-update-data">

        {* UPDATE INFO & CHANGELOG *}

        {if !empty($item.version)}
            <strong class="i-new-version-info">
                <span class="i-version">{$item.version}</span>
                {if $item.beta_test|default:false}
                    <span class="i-beta-test small">([`beta version`])</span>
                {else if !empty($item.update_datetime)}
                    <span class="small" style="padding: 0 10px;">{$item.update_datetime|wa_date:'humandate'}</span>
                {/if}
            </strong>
        {/if}

        {if !empty($item.installed.version)}
            {$_version = $item.installed.version}
            {if $_version|substr:-2 === '.p'}
                {$_version = $_version|substr:0:-2}
            {/if}
            <span class="hint">{$_version|string_format:'[`Your current version is %s.`]'}</span>
        {/if}

        {* changelog text *}
        {if !empty($item.changelog)}
            <div class="js-changelog">
                {foreach $item.changelog as $record}
                    <h4 class="gray"{if $record@first} style="display:none;"{/if}>{$record.version|default:'no-version'}{if !empty($record.datetime)} <span class="hint">{$record.datetime|wa_date:'humandate'|escape}</span>{/if}</h4>
                    {$record.content|nl2br}
                    {if !$record@last}<br><br>{/if}
                    {if $record@first && !$record@last}
                        <a class="inline-link js-changelog-more" href="#"><b><i>[`more`]</i></b></a>
                        <span style="display: none;">
                    {/if}
                    {if !$record@first && $record@last}
                        </span>
                    {/if}
                {/foreach}
            </div>
        {/if}

    </td>

    <td class="i-update-button">

        {* UPDATE BUTTON *}

        {if !empty($item.applicable) && in_array($item.action, [
        waInstallerApps::ACTION_UPDATE,
        waInstallerApps::ACTION_CRITICAL_UPDATE,
        waInstallerApps::ACTION_INSTALL
        ], true) }
            {if !empty($item.commercial) && empty($item.purchased)}

                {* not allowed to install the app, i.e. expired *}

                <p class="small red">[`License is either expired or not valid for this installation`]</p>

                {if $item_type eq 'app'}
                    {$link="app/{$item.id|escape}"}
                {elseif $item_type eq 'theme'}
                    {$link="theme/{$item.id|escape}"}
                {elseif $item_type eq 'widget'}
                    {$link="widget/`$item.app`/{$item.id|escape}"}
                {elseif $item_type eq 'plugin'}
                    {if strpos($item.slug,'wa-plugins/') === 0}
                        {$_plugins_slug = str_replace('wa-plugins/','',$item.slug|escape)}
                        {$_plugins_slug = str_replace('plugins/','',$_plugins_slug)}
                        {$link = "plugin/{$_plugins_slug}"}
                    {else}
                        {$link = "plugin/{$item.app|default:''}/{$item.id|escape}"}
                    {/if}
                {/if}

                <a href="{$wa_app_url}store/{$link}/" {*class="button2 white small"*}>[`Get license`]</a>

            {elseif !empty($item.inbuilt)}

                <p class="hint">{sprintf("[`This widget will be updated automatically when you update %s app.`]",$app.name|default:$item.app|default:''|escape)}</p>

                <input type="hidden" name="app_id[{$item.slug}]"
                    value="{$item.vendor}{if isset($item.edition) && $item.edition}:{$item.edition}{/if}"
                    id="checkbox_{$item.slug|replace:'/':'___'}" data-app="{$item.app|default:''|escape}">

            {else}

                <input type="hidden" name="app_id[{$item.slug}]"
                       value="{$item.vendor}{if isset($item.edition) && $item.edition}:{$item.edition}{/if}"
                       id="checkbox_{$item.slug|replace:'/':'___'}">
                <input {*class="button2 small"*} type="submit" id="update_{$item.slug|replace:'/':'___'}" value="[`Install update`]">

            {/if}
        {/if}

        {include file="../../includes-legacy/requirements.html" inline}
    </td>

</tr>
