src/Form/VPN/Service/Service/LimitedOcServType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form\VPN\Service\Service;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  5. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  6. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class LimitedOcServType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('serviceType' HiddenType::class , [
  16.                 'data' => 'sized'
  17.             ])
  18.             ->add('protocol' HiddenType::class , [
  19.                 'data'  => 'ocserv'
  20.             ])
  21.             ->add('username' null , [
  22.                 'label' => 'نام انتخابی سرویس'
  23.             ])
  24.             ->add('password' null , [
  25.                 'label'=>'کلمه عبور انتخابی'
  26.             ])
  27.             ->add('clientId' NumberType::class , [
  28.                 'data' => $options['clientId'],
  29.                 'disabled' => true,
  30.                 'label' => 'شناسه یکتا سرویس'
  31.             ])
  32.             ->add('users' ChoiceType::class , [
  33.                 'attr' => ['class' => 'ajax-ocservLimited'],
  34.                 'label' => 'تعداد کاربر مورد نیاز',
  35.               'choices' => [
  36.                   'یک کاربر' => 1,
  37.                   'دو کاربر' => 2,
  38.                   'سه کاربر' => 3,
  39.                   'چهار کاربر' => 4,
  40.                   'پنج کاربر' => 5,
  41. //                  'بدون محدودیت کاربر' => 0,
  42.               ]
  43.             ])
  44.             ->add('size' ChoiceType::class , [
  45.                 'attr' => ['class' => 'ajax-ocservLimited'],
  46.                 'label' => 'حجم مورد نیاز',
  47.                 'choices' => [
  48.                     '10G' => 10,
  49.                     '20G' => 20,
  50.                     '30G' => 30,
  51.                     '40G' => 40,
  52.                     '50G' => 50,
  53.                     '60G' => 60,
  54.                     '70G' => 70,
  55.                     '80G' => 80,
  56.                     '90G' => 90,
  57.                     '100G' => 100,
  58.                     '200G' => 200,
  59.                     '300G' => 300,
  60.                 ]
  61.             ])
  62.             ->add('country' ChoiceType::class, [
  63.                 'label' => 'کشور',
  64.                 'choices' => ['تمام کشور های موجود' => 'all'] ,
  65.                 'mapped' => false,
  66.                 'required'=> true
  67.             ])
  68.             ->add('days' ChoiceType::class , [
  69.                 'attr' => ['class' => 'ajax-ocservLimited'],
  70.                 'label' => 'زمان مورد نیاز',
  71.                 'choices' => [
  72.                     'یک ماه' => 30,
  73.                     'دو ماه' => 60,
  74.                     'سه ماه' => 90,
  75.                     'شش ماه' => 180,
  76.                     'دوازده ماه' => 365,
  77.                 ]
  78.             ]) ->add('price' TextType::class , [
  79.                 'label' => 'هزینه بسته انتخابی',
  80.                 'disabled' => true ,
  81.                 'mapped' => false,
  82.                 'data' => 'ابتدا موارد بالا را انتخاب فرمایید',
  83.                 'attr' => ['class' => 'form-control text-warning border-warning']
  84.             ])
  85.         ;
  86.     }
  87.     public function configureOptions(OptionsResolver $resolver): void
  88.     {
  89.         $resolver->setDefaults([
  90.             'clientId' => null
  91.         ]);
  92.     }
  93. }