<?php
namespace App\Form;
use App\Entity\MPekerjaan;
use App\Entity\TDiv;
use App\Entity\TPermohonan;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TPermohonanType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('nama', TextType::class, [
'label' => 'Nama',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Nama harus diisi!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('telepon', NumberType::class, [
'label' => 'Telepon',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Telepon harus diisi!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('email', EmailType::class, [
'label' => 'Email',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Email harus diisi!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('pekerjaan', EntityType::class, [
'class' => MPekerjaan::class,
'label' => 'Pekerjaan',
'placeholder' => '--Pilih Pekerjaan--',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Pekerjaan harus dipilih!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('desk_pekerjaan', TextType::class, [
'label' => 'Deskripsi Pekerjaan',
'attr' => [
'class' => 'form-control'
],
'required' =>false
])
->add('judul_data', TextType::class, [
'label' => 'Judul Dataset',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Judul Dataset harus diisi!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('div', EntityType::class, [
'class' => TDiv::class,
'label' => 'Perangkat Daerah',
'placeholder' => '--Pilih Perangkat Daerah--',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Perangkat Daerah harus dipilih!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('desk_kebutuhan', TextareaType::class, [
'label' => 'Deskripsi Kebutuhan Dataset',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Deskripsi Kebutuhan Dataset harus diisi!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('tujuan_data', TextareaType::class, [
'label' => 'Tujuan Penggunaan Dataset',
'attr' => [
'class' => 'form-control',
'oninvalid' => 'this.setCustomValidity("Tujuan Penggunaan Dataset harus diisi!")',
'oninput' => 'this.setCustomValidity("")'
]
])
->add('submit', SubmitType::class, [
'label' => 'Kirim',
'attr' => [
'class' => 'btn btn-light bg-green'
]
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => TPermohonan::class,
]);
}
}