{if ($type=='template')}
    <div class="row">
        {volist name="data" id="v"}
        <div class="col-sm-6 col-md-4 col-lg-4 col-xl-3">
            <div class="card">
                {if isset($site[$module.'_theme']) && $site[$module.'_theme']==$v['name']}
                <div class="ribbon-wrapper">
                    <div class="ribbon bg-success">{:__("Current")}</div>
                </div>
                {/if}
                <div class="img-thumb">
                    <a href="{if isset($info[$v['name']]['url'])}{$info[$v['name']]['url']}{else /}{$v['website']|default=''}{/if}" target="_blank" data-toggle="tooltip" data-title="{:__('Click me to go to details')}">
                        <img src="{$v.image|default=''}" class="card-img-top">
                    </a>
                </div>
                <div class="card-body">
                    <h5 class="card-title" data-title="{$v.title}" data-toggle="tooltip">{$v.title}</h5>
                    <p class="card-text text-sm" data-title="{$v.description}" data-toggle="tooltip">{$v.description}</p>
                    <div class="d-flex justify-content-between align-items-center">
                        <div class="footer-fa">
                            {if !isset($v['db_install'])}
                                <div class="btn-group">
                                    {if !(isset($site[$module.'_theme']) && $site[$module.'_theme']==$v['name'])}
                                    <a href="{:url('/Appcenter/setTheme',['name'=>$v['name'],'module'=>$module])}" class="btn btn-primary btn-xs" data-name="{$v['name']}">{:__("Set as theme")}</a>
                                    {else /}
                                        {if $module=='admin'}
                                        <a class="btn btn-primary btn-xs" href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module])}')"><i class="fas fa-cogs"></i> {:__("Config")}</a>
                                        {else /}
                                        <a class="btn btn-primary btn-xs" onclick="cmsOpen('{:url('/appcenter/editTheme',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module,'t'=>'tpl'])}','{$v.title}');return false;" href="#">{:__("Manager")}</a>
                                        {/if}
                                    {/if}

                                    {if !(isset($site[$module.'_theme']) && $site[$module.'_theme']==$v['name'])}
                                        <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split btn-xs" data-toggle="dropdown" aria-expanded="false" title="{:__('More actions')}">
                                            <span class="sr-only">Toggle Dropdown</span>
                                        </button>
                                        <div class="dropdown-menu">
                                            <a class="dropdown-item" href="javascript:cmsOpen('{:url('/appcenter/editTheme',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module,'t'=>'tpl'])}','{$v.title}')"><i class="fa fa-folder"></i> {:__("Manager")}</a>
                                            {if $v['config']}
                                            <a class="dropdown-item" href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module])}')"><i class="fas fa-cogs"></i> {:__("Config")}</a>
                                            {/if}
                                            <a href="{:url('/appcenter/pack',['type'=>'template','module'=>$module,'name'=>$v['name']])}"  target="_blank" class="dropdown-item"><i class="fa fa-file-export"></i> {:__('Export')}</a>
                                            <div class="dropdown-divider"></div>
                                            <a href="#" class="dropdown-item btn-uninstall" data-type="template" data-module="{$module}" data-name="{$v['name']}" title="{:__("Uninstall")}"><i class="fas fa-trash-alt"></i> {:__("Uninstall")}</a>
                                        </div>
                                    {else /}

                                        <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split btn-xs" data-toggle="dropdown" aria-expanded="false" title="{:__('More actions')}">
                                            <span class="sr-only">Toggle Dropdown</span>
                                        </button>
                                        <div class="dropdown-menu">
                                            {if $v['config'] && $module!='admin'}
                                            <a class="dropdown-item" href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module])}')"><i class="fas fa-cogs"></i> {:__("Config")}</a>
                                            {/if}
                                            <a href="{:url('/appcenter/pack',['type'=>'template','module'=>$module,'name'=>$v['name']])}" class="dropdown-item" target="_blank"><i class="fa fa-file-export"></i> {:__('Export')}</a>
                                            {if $module!='admin'}
                                            <a href="#!" data-name="{$v['name']}" class="dropdown-item btn-exp"><i class="far fa-file-archive"></i> {:__('Export all')}</a>
                                            {/if}
                                        </div>
                                    {/if}
                                </div>
                            {else /}
                            <a href="#" class="btn btn-primary btn-xs btn-install-db" data-name="{$v.name}" data-type="template" data-module="{$module}">{:__('Install')}</a>
                            {/if}
                        </div>
                        <div class="footer-fa">
                            <span><i class="fas fa-user-alt"></i> {$v.author}</span>

                            {if isset($info) && $info!==false}
                                <?php $version_info = isset($info[$v['name']]['version_info'])?$info[$v['name']]['version_info']:'';?>
                                <?php $upgradeData = get_upgrade($v['version'], $version_info);?>
                                {if !empty($version_info) && $upgradeData!==false}
                                <a href="#" class="btn-upgrade text-primary" data-name="{$v['name']}" title="{:__('Update to')}{$upgradeData[0]}" data-trigger="hover" data-toggle="tooltip">{$v.version}</a>
                                {if count($upgradeData)>1}
                                <span class="dropdown-toggle" title="{:__('Update the specified version')}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
                                <div class="dropdown-menu">
                                    {volist name="upgradeData" id="vv"}
                                    <a class="dropdown-item btn-upgrade" href="#" data-name="{$v['name']}" data-version="{$vv}">{$vv}</a>
                                    {/volist}
                                </div>
                                {/if}
                                {else /}
                                <span><i class="fas fa-info-circle"></i> {$v.version}</span>
                                {/if}
                            {else /}
                            <span class="text-danger" title="{:__('Server returns abnormal data')}" data-trigger="hover" data-toggle="tooltip"><i class="fas fa-info-circle"></i> {$v.version}</span>
                            {/if}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {/volist}
    </div>
{else /}
<table class="table table-bordered table-hover table-striped">
    <thead>
        <tr>
            <th>
                <div class="th-inner ">{:__("SN")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Title")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Introduce")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Author")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Price")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Version")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Status")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:__("Operate")}</div>
                <div class="fht-cell"></div>
            </th>
        </tr>
    </thead>
    <tbody>
    {volist name="data" id="v"}
    <tr>
        <td>{$i}</td>
        <td><a href="{if isset($info[$v['name']]['url'])}{$info[$v['name']]['url']}{else /}#{/if}" class="text-primary" target="_blank">{$v.title|default=''}</a></td>
        <td>{$v.description|default=''}</td>
        <td>{$v.author|default=''}</td>
        <td>{:isset($v['price'])?$v['price']<=0?'<span class="text-primary">'.__("Free").'</span>':'<span class="text-danger">'.$v['price'].'</span>':'-'}</td>
        <td>
            {if isset($info) && $info===false}
            <span class="text-danger" title="{:__('Server returns abnormal data')}" data-trigger="hover" data-toggle="tooltip">{$v.version|default=''}</span>
            {else /}
            {$v.version|default=''}
            {/if}
        </td>
        <td>
            {if !isset($v['db_install'])}
            <div class="custom-control custom-switch custom-switch-on-teal" data-toggle="tooltip" data-trigger="hover" data-placement="top" title="{:__("Click to switch")}">
            <input type="checkbox" class="custom-control-input" data-name="{$v.name|default=''}" id="customSwitch{$v.name}" {$v.status==1?'checked':''} value="{$v.status}">
            <label class="custom-control-label" for="customSwitch{$v.name}"></label>
            </div>
            {/if}
        </td>
        <td>
            {if !isset($v['db_install'])}
                {if isset($v['config'])&&$v['config']&&$v['status']==1}
                <a href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>$v['type'],'popup'=>1])}')" class="btn btn-primary btn-xs"><i class="fas fa-cogs"></i>
                    {:__("Config")}</a>
                {/if}
                <a href="#" class="btn btn-danger btn-xs btn-uninstall" data-name="{$v.name}" data-type="{$v['type']}"><i class="fas fa-trash-alt"></i>
                    {:__("Uninstall")}</a>&nbsp;
                <a href="{:url('/appcenter/pack',['type'=>$v['type'],'name'=>$v['name']])}" target="_blank" class="btn btn-primary btn-xs"><i class="fas fa-file-archive"></i>
                    {:__("Pack")}</a>

                <!--更新-->
                {if isset($info) && $info!==false}
                    <?php $version_info = isset($info[$v['name']]['version_info'])?$info[$v['name']]['version_info']:'';?>
                    <?php $upgradeData = get_upgrade($v['version'], $version_info);?>
                    {if !empty($version_info) && $upgradeData!==false}
                    <div class="btn-group btn-group-xs" role="group" aria-label="Basic example">
                        <a href="#" class="btn btn-primary btn-upgrade btn-xs" data-name="{$v['name']}" title="{:__('Update to')}{$upgradeData[0]}" data-trigger="hover" data-toggle="tooltip">{:__("Update")}</a>
                        {if count($upgradeData)>1}
                        <button type="button" class="btn btn-primary dropdown-toggle btn-xs" title="{:__('Update the specified version')}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
                        <div class="dropdown-menu">
                            {volist name="upgradeData" id="vv"}
                            <a class="dropdown-item btn-upgrade" href="#" data-name="{$v['name']}" data-version="{$vv}">{$vv}</a>
                            {/volist}
                        </div>
                        {/if}
                    </div>
                    {/if}
                {/if}
            {else /}
            <a href="#" class="btn btn-primary btn-xs btn-install-db" data-name="{$v.name}" data-type="{$v['type']}">{:__('Install')}</a>
            {/if}
        </td>
    </tr>
    {/volist}
    {if empty($data)}
    <tr><td colspan="8">{:__("No data")}</td></tr>
    {/if}
    </tbody>
</table>
{/if}