DetailsWidget.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Others;
  3. use ModulesGarden\Servers\ProxmoxCloudVps\Core\Traits\Lang;
  4. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Builder\BaseContainer;
  5. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\AjaxElementInterface;
  6. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\ResponseTemplates\RawDataJsonResponse;
  7. /**
  8. * Class DetailsWidget
  9. *
  10. * @author Artur Pilch <artur.pi@modulesgarden.com>
  11. */
  12. class DetailsWidget extends BaseContainer implements AjaxElementInterface
  13. {
  14. use Lang;
  15. protected $id = 'detailsWidget';
  16. protected $name = 'detailsWidget';
  17. protected $title = 'detailsWidget';
  18. protected $vueComponent = true;
  19. protected $defaultVueComponentName = 'mg-details-widget';
  20. public function initContent()
  21. {
  22. }
  23. public function prepareAjaxData()
  24. {
  25. }
  26. public function getParsedTitle()
  27. {
  28. if($this->getRawTitle())
  29. {
  30. return $this->getRawTitle();
  31. }
  32. if($this->getTitle())
  33. {
  34. $this->loadLang();
  35. return $this->lang->controlerContextTranslate($this->getId() ,$this->getTitle());
  36. }
  37. return '';
  38. }
  39. public function returnAjaxData()
  40. {
  41. $this->prepareAjaxData();
  42. return (new RawDataJsonResponse([
  43. 'title' => $this->getParsedTitle(),
  44. 'data' => $this->data
  45. ]));
  46. }
  47. }