src/Form/VPN/Service/Service/LimitedVipType.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 LimitedVipType 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' => 'vip'
  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.                 'label' => 'تعداد کاربر مورد نیاز',
  34.                 'attr' => ['class' => 'ajax-v2rayLimited'],
  35.                 'choices' => [
  36.                     'یک کاربر' => 1,
  37.                     'دو کاربر' => 2,
  38.                     'سه کاربر' => 3,
  39.                     'چهار کاربر' => 4,
  40.                     'پنج کاربر' => 5,
  41. //                    'بدون محدودیت کاربر' => 0,
  42.                 ]
  43.             ])
  44.             ->add('size'ChoiceType::class, [
  45.                 'label' => 'حجم مورد نیاز',
  46.                 'attr' => ['class' => 'ajax-vipLimited'],
  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.                 'attr' => ['class' => 'ajax-vipLimited'],
  65.                 'choices' => ['تمام کشور های موجود' => 'all'] ,
  66.                 'mapped' => false,
  67.                 'required'=> true
  68.             ])
  69.             ->add('days'ChoiceType::class, [
  70.                 'label' => 'زمان مورد نیاز',
  71.                 'attr' => ['class' => 'ajax-vipLimited'],
  72.                 'choices' => [
  73.                     'یک ماه' => 30,
  74.                     'دو ماه' => 60,
  75.                     'سه ماه' => 90,
  76.                     'شش ماه' => 180,
  77.                     'دوازده ماه' => 365,
  78.                 ]
  79.             ]) ->add('price' TextType::class , [
  80.                 'label' => 'هزینه بسته انتخابی',
  81.                 'attr' => ['readonly' => 'true'],
  82.                 'mapped' => false,
  83.                 'data' => 'ابتدا موارد بالا را انتخاب فرمایید',
  84.                 'attr' => ['class' => 'form-control text-warning border-warning']
  85.             ]);
  86.     }
  87.     public function configureOptions(OptionsResolver $resolver): void
  88.     {
  89.         $resolver->setDefaults([
  90.             'clientId' => null
  91.         ]);
  92.     }
  93. }