| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace ModulesGarden\Servers\ProxmoxCloudVps\App\Http\Client;
- use ModulesGarden\ProxmoxAddon\App\Services\ApiService;
- use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ProductService;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\Helpers\AppParams;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\Helpers\ProxmoxAddonValidator;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Graph\Pages\ServiceCpuGraph;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Graph\Pages\VmSmallGraphs;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Home\Pages\AccountSummary;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Home\Pages\AccountSummaryBars;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Home\Pages\ServiceActions;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Home\Pages\ServiceDetails;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Vm\Pages\VmTabs;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmCreate\Forms\VmCreateForm;
- use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmUpdate\Forms\VmUpdateForm;
- use ModulesGarden\Servers\ProxmoxCloudVps\Core\Http\AbstractClientController;
- use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Traits\WhmcsParams;
- use function ModulesGarden\Servers\ProxmoxCloudVps\Core\Helper\sl;
- use function ModulesGarden\Servers\ProxmoxCloudVps\Core\Helper\view;
- class Vm extends AbstractClientController
- {
- use WhmcsParams;
- use ProductService;
- use BaseClientController;
- use ApiService;
- /**
- * details
- */
- public function index()
- {
- if ($this->getWhmcsParamByKey('status') != 'Active')
- {
- return;
- }
- $this->initVm();
- (new AppParams())->initFromWhmcsParams();
- $this->api();
- if (!ProxmoxAddonValidator::isInstalled())
- {
- ProxmoxAddonValidator::isInstalledOrFail();
- }
- else
- {
- if (!$this->isVmCreated(\ModulesGarden\ProxmoxAddon\Core\Helper\sl('Vm')->getVmModel()))
- {
- return $this->onVpsBuild();
- }
- }
- $view = view();
- $view->initCustomAssetFiles();
- $view->addElement(ServiceDetails::class);
- $view->addElement(ServiceActions::class);
- $view->addElement(VmTabs::class);
- return $view;
- }
- public function create()
- {
- sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChild("vmcreate")->setActive(true);
- (new AppParams())->initFromWhmcsParams();
- $view = view();
- $view->initCustomAssetFiles();
- /**
- * @deprecated
- * $view->addElement(\ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmCreate\Sections\AccountSummary::class);
- */
- return $view->addElement(VmCreateForm::class);
- }
- public function update()
- {
- // sl("sidebar")->getSidebar("virtualMachinesProxmoxCloudVps")->getChild("vmupdate")->setActive(true);
- $this->initVm();
- (new AppParams())->initFromWhmcsParams();
- $this->api();
- return view()->addElement(VmUpdateForm::class);
- }
- }
|