<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
<li class="<?php echo $this->additionalRowClass; ?>">
  <div id="as-package-<?php echo $this->id; ?>" class="package-block">
    <div class="package-icon">
        <a href="#" onclick='<?php echo $this->detailsOnClick; ?>'><?php echo $this->packageIcon;?></a>
    </div>
    <div class="package-actions">
        <?php if ($this->buyNowButtonAvailable): ?>
            <?php echo $this->partial('partials/button.phtml', [
                'id' => 'as-buy-' . $this->id,
                'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonBuy'),
                'description' => $this->lmsg('smb.components.forms.aps.catalog.buttonBuyTooltip'),
                'onclick' => 'Smb.ApsLicense.buy("' . Plesk_Base_Utils_String::safeForJs($this->purchaseCommandAction) . '"); return false;',
            ]); ?>
            <br>
        <?php endif; ?>
        <?php if ($this->showInstallButton): ?>
            <?php
            if ($this->hideQuickInstall) {
                echo $this->partial('partials/button.phtml', [
                    'id' => 'ad-advanced-install-' . $this->id,
                    'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstall'),
                    'description' => $this->lmsg('smb.components.forms.aps.catalog.buttonAdvancedInstallTooltip'),
                    'onclick' => $this->advancedInstallOnClick,
                ]);
            } else {
                echo $this->partial('partials/split-button.phtml', [
                    'id' => 'as-install-' . $this->id,
                    'renderTo' => new Zend_Json_Expr('document.querySelector("#as-package-' . $this->id . ' .package-actions")'),
                    'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstall'),
                    'description' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstallTooltip'),
                    'onclick' => $this->installOnClick,
                    'items' => [[
                        'id' => 'as-advanced-install-' . $this->id,
                        'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonAdvancedInstall'),
                        'descriptions' => $this->lmsg('smb.components.forms.aps.catalog.buttonAdvancedInstallTooltip'),
                        'onclick' => $this->advancedInstallOnClick,
                    ], [
                        'id' => 'as-install-old-version-' . $this->id,
                        'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstallOldVersion'),
                        'descriptions' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstallOldVersionTooltip'),
                        'submenu' => new Zend_Json_Expr('function(submenu) {apsCatalog.showAppVersions(' . $this->appData . ', submenu);}'),
                    ]],
                    'isMenuFlip' => true,
                ]);
            } ?>
        <?php endif; ?>
        <?php if ($this->downloadUrl): ?>
        <button class="btn" value="" type="submit" onclick="Jsw.redirect('<?php echo $this->downloadUrl; ?>'); return false;">
            <span><?php echo $this->lmsg('smb.components.forms.aps.catalog.buttonDownload'); ?></span>
        </button><br/>
        <?php endif; ?>
    </div>
    <h4><a href="#" onclick='<?php echo $this->detailsOnClick; ?>'><?php echo $this->name; ?> <span>v<?php echo $this->version; ?></span></a></h4>
    <div class="package-description"><?php echo $this->summary; ?></div>
  </div>
</li>
