<?php
namespace App\Form\VPN\Service\Service;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class UnlimitedV2rayType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('serviceType', HiddenType::class, [
'data' => 'unlimited'
])
->add('protocol', HiddenType::class, [
'data' => 'v2ray'
])
->add('username' , null , [
'label' => 'نام انتخابی سرویس'
])
->add('password' , null , [
'label'=>'کلمه عبور انتخابی'
])
->add('clientId', NumberType::class, [
'data' => $options['clientId'],
'disabled' => true,
'label' => 'شناسه یکتا سرویس'
])
->add('users', ChoiceType::class, [
'attr' => ['class' => 'ajax-v2rayUnLimited'],
'label' => 'تعداد کاربر مورد نیاز',
'choices' => [
'یک کاربر' => 1,
'دو کاربر' => 2,
'سه کاربر' => 3,
'چهار کاربر' => 4,
'پنج کاربر' => 5,
// 'بدون محدودیت کاربر' => 0,
]
])
->add('size', HiddenType::class, [
'data' => 0
])
->add('country' , ChoiceType::class, [
'attr' => ['class' => 'ajax-v2rayUnLimited'],
'label' => 'کشور',
'choices' => $options['locations'] ,
// 'choices' => [
// 'تمام کشور های موجود' => 'all'
// ] ,
'mapped' => false,
'required'=> true
])
->add('days', ChoiceType::class, [
'attr' => ['class' => 'ajax-v2rayUnLimited'],
'label' => 'زمان مورد نیاز',
'choices' => [
'یک ماه' => 30,
// 'دو ماه' => 60,
// 'سه ماه' => 90,
// 'شش ماه' => 180,
// 'دوازده ماه' => 365,
]
]) ->add('price' , TextType::class , [
'label' => 'هزینه بسته انتخابی',
'disabled' => true ,
'mapped' => false,
'data' => 'ابتدا موارد بالا را انتخاب فرمایید',
'attr' => ['class' => 'form-control text-warning border-warning']
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'clientId' => null,
'locations' => []
]);
}
}