<?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 LimitedOcServType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('serviceType' , HiddenType::class , [
'data' => 'sized'
])
->add('protocol' , HiddenType::class , [
'data' => 'ocserv'
])
->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-ocservLimited'],
'label' => 'تعداد کاربر مورد نیاز',
'choices' => [
'یک کاربر' => 1,
'دو کاربر' => 2,
'سه کاربر' => 3,
'چهار کاربر' => 4,
'پنج کاربر' => 5,
// 'بدون محدودیت کاربر' => 0,
]
])
->add('size' , ChoiceType::class , [
'attr' => ['class' => 'ajax-ocservLimited'],
'label' => 'حجم مورد نیاز',
'choices' => [
'10G' => 10,
'20G' => 20,
'30G' => 30,
'40G' => 40,
'50G' => 50,
'60G' => 60,
'70G' => 70,
'80G' => 80,
'90G' => 90,
'100G' => 100,
'200G' => 200,
'300G' => 300,
]
])
->add('country' , ChoiceType::class, [
'label' => 'کشور',
'choices' => ['تمام کشور های موجود' => 'all'] ,
'mapped' => false,
'required'=> true
])
->add('days' , ChoiceType::class , [
'attr' => ['class' => 'ajax-ocservLimited'],
'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
]);
}
}