<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
<li class="<?php echo $this->additionalRowClass; ?>">
  <div id="mas-package-<?php echo $this->id; ?>" class="package-block">
    <div class="package-content clearfix">
        <div class="package-icon">
            <a href="#" onclick='<?php echo $this->detailsOnClick; ?>'><?php echo $this->packageIcon;?></a>
        </div>
        <div class="package-info">
            <h4><a href="#" onclick='<?php echo $this->detailsOnClick; ?>'><?php echo $this->name; ?></a></h4>
            <div class="package-description"><?php echo $this->summary; ?></div>
        </div>
    </div>
    <div class="package-actions">
        <?php if ($this->buyNowButtonAvailable): ?>
            <?php echo $this->partial('partials/button.phtml', [
                'id' => 'mas-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;',
            ]); ?>
        <?php elseif ($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' => 'mas-install-' . $this->id,
                    'renderTo' => new Zend_Json_Expr('document.querySelector("#mas-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' => 'mas-advanced-install-' . $this->id,
                        'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonAdvancedInstall'),
                        'description' => $this->lmsg('smb.components.forms.aps.catalog.buttonAdvancedInstallTooltip'),
                        'onclick' => $this->advancedInstallOnClick,
                    ], [
                        'id' => 'mas-install-old-version-' . $this->id,
                        'title' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstallOldVersion'),
                        'description' => $this->lmsg('smb.components.forms.aps.catalog.buttonInstallOldVersionTooltip'),
                        'submenu' => new Zend_Json_Expr('function(submenu) {apsCatalog.showAppVersions(' . $this->appData . ', submenu);}'),
                    ]],
                    'isMenuFlip' => $this->evenItem,
                ]);
            } ?>
        <?php endif; ?>
    </div>
  </div>
</li>
