/** * Creates a form to create a Consulta entity. * * @param Consulta $entity The entity * * @return \Symfony\Component\Form\Form The form */ private function createCreateForm(Consulta $entity, $tipo, $identidad, \DGPlusbelleBundle\Entity\Paciente $paciente) { if ($tipo == 1) { $form = $this->createForm(new ConsultaType(), $entity, array('action' => $this->generateUrl('admin_consulta_create', array('id' => 1, 'identidad' => $identidad, 'idpac' => $paciente->getId())), 'method' => 'POST')); } else { $form = $this->createForm(new ConsultaConPacienteType(), $entity, array('action' => $this->generateUrl('admin_consulta_create', array('id' => 2, 'identidad' => $identidad, $paciente, 'idpac' => $paciente->getId())), 'method' => 'POST')); //$paciente = $entity->getPaciente(); //var_dump($entity); $form->add('paciente', 'entity', array('label' => 'Paciente', 'class' => 'DGPlusbelleBundle:Paciente', 'query_builder' => function (EntityRepository $repositorio) use($paciente) { return $repositorio->createQueryBuilder('pa')->where('pa.id = :pac')->setParameter(':pac', $paciente->getId()); })); } $form->add('submit', 'submit', array('label' => 'Guardar', 'attr' => array('class' => 'btn btn-success btn-sm'))); return $form; }
/** * Creates a form to create a Consulta entity. * * @param Consulta $entity The entity * * @return \Symfony\Component\Form\Form The form */ private function createCreateForm(Consulta $entity, $tipo, $identidad, \DGPlusbelleBundle\Entity\Paciente $paciente) { if ($tipo == 1) { $form = $this->createForm(new ConsultaType(), $entity, array('action' => $this->generateUrl('admin_consulta_create', array('id' => 1, 'identidad' => $identidad, 'idpac' => $paciente->getId())), 'method' => 'POST')); $form->add('paciente', 'entity', array('label' => 'Paciente', 'required' => false, 'empty_value' => 'Seleccione un paciente...', 'class' => 'DGPlusbelleBundle:Paciente', 'attr' => array('class' => 'form-control input-sm pacienteConsulta'))); } elseif ($tipo == 2) { $form = $this->createForm(new ConsultaConPacienteType(), $entity, array('action' => $this->generateUrl('admin_consulta_create', array('id' => 2, 'identidad' => $identidad, $paciente, 'idpac' => $paciente->getId())), 'method' => 'POST')); //$paciente = $entity->getPaciente(); //var_dump($entity); $form->add('paciente', 'entity', array('label' => 'Paciente', 'class' => 'DGPlusbelleBundle:Paciente', 'query_builder' => function (EntityRepository $repositorio) use($paciente) { return $repositorio->createQueryBuilder('pa')->where('pa.id = :pac')->setParameter(':pac', $paciente->getId()); })); $form->add('sesiontratamiento', 'entity', array('required' => false, 'label' => 'Nombre', 'empty_value' => 'Seleccione una opcion', 'class' => 'DGPlusbelleBundle:Plantilla', 'query_builder' => function (EntityRepository $repository) { return $repository->obtenerRecetasActivo(); }, 'mapped' => false)); $form->add('registraReceta', 'choice', array('label' => 'Receta', 'choices' => array('1' => 'Sí', '0' => 'No'), 'multiple' => false, 'expanded' => 'true')); $form->add('reportePlantilla', 'choice', array('label' => 'Registro clínico', 'choices' => array('1' => 'Sí', '0' => 'No'), 'multiple' => false, 'expanded' => 'true')); $form->add('plantilla', 'entity', array('required' => false, 'label' => 'Historias clínicas', 'empty_value' => 'Seleccione una opcion', 'class' => 'DGPlusbelleBundle:Plantilla', 'query_builder' => function (EntityRepository $repository) { return $repository->otrosDocActivo(); }, 'mapped' => false)); } else { $form = $this->createForm(new ConsultaConPacienteType(), $entity, array('action' => $this->generateUrl('admin_consulta_create', array('id' => 3, 'identidad' => $identidad, 'idpac' => -1)), 'method' => 'POST')); // $form->add('paciente', 'choice', array( // 'label' => 'Paciente', // 'empty_value'=>'Seleccione un paciente', // 'choices' => array() // )); $form->add('reportePlantilla', 'choice', array('label' => 'Registro clínico', 'choices' => array('1' => 'Sí', '0' => 'No'), 'multiple' => false, 'expanded' => 'true')); $form->add('estetica', 'entity', array('required' => false, 'label' => 'Tipo de consulta de estetica', 'empty_value' => 'Seleccione una opcion', 'class' => 'DGPlusbelleBundle:Estetica', 'mapped' => false)); } $form->add('submit', 'submit', array('label' => 'Guardar', 'attr' => array('class' => 'btn btn-success btn-sm'))); return $form; }