EditGeneralSection.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Sections;
  3. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository\ClassOfServices;
  4. use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
  5. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\FreeFieldsSection;
  6. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  7. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  8. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  10. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  11. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Validators\Decimal;
  12. /**
  13. *
  14. * Created by PhpStorm.
  15. * User: ThurData
  16. * Date: 12.11.19
  17. * Time: 13:52
  18. * Class EditGeneralSection
  19. */
  20. class EditGeneralSection extends FreeFieldsSection
  21. {
  22. protected $id = 'editGeneralSection';
  23. protected $name = 'editGeneralSection';
  24. use FormExtendedTrait;
  25. public function initContent()
  26. {
  27. /**
  28. * add fields
  29. */
  30. $field = new Hidden('id');
  31. $this->addField($field);
  32. $this->generateDoubleSection([new Text('firstname'), new Text('lastname')]);
  33. $email =new InputGroup('usernameGroup');
  34. $email->addInputComponent((new InputGroupElements\Text('username'))->addHtmlAttribute('readonly','true'));
  35. $email->addInputAddon('emailSign', false, '@');
  36. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  37. $this->addSection($email);
  38. $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
  39. $quota = new Text('quota');
  40. $quota->setDescription('description');
  41. $quota->addValidator(new Decimal(0));
  42. $this->generateDoubleSection([$quota, new Select('unit')]);
  43. if($productManager->get('cos_name') === ClassOfServices::CLASS_OF_SERVICE_QUOTA)
  44. {
  45. $field = new Hidden('currentCosId');
  46. $this->addField($field);
  47. $field = new Select('cosId');
  48. $this->addField($field);
  49. }
  50. }
  51. }