src/Form/ApplicantType.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Applicant;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  8. use Symfony\Component\Form\Extension\Core\Type\FileType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  11. use Symfony\Component\Validator\Constraints\File;
  12. class ApplicantType extends AbstractType
  13. {
  14.     public function buildForm(FormBuilderInterface $builder, array $options): void
  15.     {
  16.         $builder
  17.          ->add('Division'ChoiceType::class, [
  18.             'choices' => [
  19.                 'Body Imaging'=> 'Body'
  20.                'Musculoskeletal Imaging' => 'MSK',  
  21.                 'Breast Imaging' => 'Breast',   
  22.                 'Magnetic Resonance Imaging' => 'MRI',
  23.                 'Women Imaging' => 'Women',
  24.                 'Cardiothoracic Imaging' => 'Chest',
  25.             ],
  26.             ])
  27.             ->add('Name')
  28.             ->add('Email')
  29.             ->add('Address')
  30.             ->add('Degree')
  31.             ->add('CurrentPosition')
  32.             ->add('Phone')
  33.            
  34.             ->add('appForm'FileType::class, [
  35.                 'label' => 'Application Form (PDF file)',
  36.                 // unmapped means that this field is not associated to any entity property
  37.                 'mapped' => false,
  38.                 // make it optional so you don't have to re-upload the PDF file
  39.                 // every time you edit the Product details
  40.                 'required' => false,
  41.                 // unmapped fields can't define their validation using annotations
  42.                 // in the associated entity, so you can use the PHP constraint classes
  43.                 'constraints' => [
  44.                     new File([
  45.                         'maxSize' => '6072k',
  46.                         'mimeTypes' => [
  47.                             'application/pdf',
  48.                             'application/x-pdf',
  49.                         ],
  50.                         'mimeTypesMessage' => 'Please upload a valid PDF document',
  51.                     ])
  52.                 ],
  53.             ])
  54.             ->add('PersonalStat'FileType::class, [
  55.                 'label' => 'Personal Statment (PDF file)',
  56.                 // unmapped means that this field is not associated to any entity property
  57.                 'mapped' => false,
  58.                 // make it optional so you don't have to re-upload the PDF file
  59.                 // every time you edit the Product details
  60.                 'required' => false,
  61.                 // unmapped fields can't define their validation using annotations
  62.                 // in the associated entity, so you can use the PHP constraint classes
  63.                 'constraints' => [
  64.                     new File([
  65.                         'maxSize' => '6072k',
  66.                         'mimeTypes' => [
  67.                             'application/pdf',
  68.                             'application/x-pdf',
  69.                         ],
  70.                         'mimeTypesMessage' => 'Please upload a valid PDF document',
  71.                     ])
  72.                 ],
  73.             ])
  74.             ->add('CVLink'FileType::class, [
  75.                 'label' => 'CV (PDF file)',
  76.                 // unmapped means that this field is not associated to any entity property
  77.                 'mapped' => false,
  78.                 // make it optional so you don't have to re-upload the PDF file
  79.                 // every time you edit the Product details
  80.                 'required' => false,
  81.                 // unmapped fields can't define their validation using annotations
  82.                 // in the associated entity, so you can use the PHP constraint classes
  83.                 'constraints' => [
  84.                     new File([
  85.                         'maxSize' => '6072k',
  86.                         'mimeTypes' => [
  87.                             'application/pdf',
  88.                             'application/x-pdf',
  89.                         ],
  90.                         'mimeTypesMessage' => 'Please upload a valid PDF document',
  91.                     ])
  92.                 ],
  93.             ])
  94.             ->add('usfile'FileType::class, [
  95.                 'label' => 'USMLE (PDF file)',
  96.                 // unmapped means that this field is not associated to any entity property
  97.                 'mapped' => false,
  98.                 // make it optional so you don't have to re-upload the PDF file
  99.                 // every time you edit the Product details
  100.                 'required' => false,
  101.                 // unmapped fields can't define their validation using annotations
  102.                 // in the associated entity, so you can use the PHP constraint classes
  103.                 'constraints' => [
  104.                     new File([
  105.                         'maxSize' => '6072k',
  106.                         'mimeTypes' => [
  107.                             'application/pdf',
  108.                             'application/x-pdf',
  109.                         ],
  110.                         'mimeTypesMessage' => 'Please upload a valid PDF document',
  111.                     ])
  112.                 ],
  113.             ])
  114.             ->add('dlFile'FileType::class, [
  115.                 'label' => 'Dean Letter (PDF file), *See Note Below',
  116.                 // unmapped means that this field is not associated to any entity property
  117.                 'mapped' => false,
  118.                 // make it optional so you don't have to re-upload the PDF file
  119.                 // every time you edit the Product details
  120.                 'required' => false,
  121.                 // unmapped fields can't define their validation using annotations
  122.                 // in the associated entity, so you can use the PHP constraint classes
  123.                 'constraints' => [
  124.                     new File([
  125.                         'maxSize' => '7072k',
  126.                         'mimeTypes' => [
  127.                             'application/pdf',
  128.                             'application/x-pdf',
  129.                         ],
  130.                         'mimeTypesMessage' => 'Please upload a valid PDF document',
  131.                     ])
  132.                 ],
  133.             ])
  134.             ->add('mdFile'FileType::class, [
  135.                 'label' => 'Medical School Diploma (PDF file)',
  136.                 // unmapped means that this field is not associated to any entity property
  137.                 'mapped' => false,
  138.                 // make it optional so you don't have to re-upload the PDF file
  139.                 // every time you edit the Product details
  140.                 'required' => false,
  141.                 // unmapped fields can't define their validation using annotations
  142.                 // in the associated entity, so you can use the PHP constraint classes
  143.                 'constraints' => [
  144.                     new File([
  145.                         'maxSize' => '6072k',
  146.                         'mimeTypes' => [
  147.                             'application/pdf',
  148.                             'application/x-pdf',
  149.                         ],
  150.                         'mimeTypesMessage' => 'Please upload a valid PDF document',
  151.                     ])
  152.                 ],
  153.             ])
  154.             ->add('Ref1Name',TextType::class, ['label'=>'Reference #1 Name' ])
  155.             ->add('Ref1Email',TextType::class, ['label'=>'Reference #1 Email' ])
  156.             ->add('Ref1Letter',TextType::class, ['label'=>'Reference #1 Job Title' ])
  157.             ->add('Ref2Name',TextType::class, ['label'=>'Reference #2 Name' ])
  158.             ->add('Ref2Email',TextType::class, ['label'=>'Reference #2 Email' ])
  159.             ->add('Ref2Letter',TextType::class, ['label'=>'Reference #2 Job Title' ])
  160.             ->add('Ref3Name',TextType::class, ['label'=>'Reference #3 Name' ])
  161.             ->add('Ref3Email',TextType::class, ['label'=>'Reference #3 Email' ])
  162.             ->add('Ref3Letter',TextType::class, ['label'=>'Reference #3 Job Title' ])
  163.             ->add('Status',ChoiceType::class, ['label'=>'Status for OFFICE Use Only'
  164.             'required' => false,
  165.             'choices' => [
  166.                 'For OFFICE Use Only'=> 'Office'
  167.                 'Withdrew' => 'Withdrew',
  168.                 'Under Consideration'=>'Under Consideration',
  169.                 'Withdrew Before Interview' =>'Withdrew Before Interview',
  170.                 'Interviewed'=>'Interviewed',
  171.                 'Withdrew After Interview'=>'Withdrew After Interview',
  172.                 'Offer Extended'=>'Offer Extended',
  173.                 'Declined Offer'=>'Declined Offer',
  174.                 'Offer Accepted'=>'Offer Accepted',
  175.             ],
  176.             ])
  177.             ->add('Notes',TextareaType::class, ['label'=>'Notes for OFFICE Use Only''required' => false,
  178.             ])
  179.         ;
  180.     }
  181.     public function configureOptions(OptionsResolver $resolver): void
  182.     {
  183.         $resolver->setDefaults([
  184.             'data_class' => Applicant::class,
  185.         ]);
  186.     }
  187. }