diff --git a/data/database.sqlite b/data/database.sqlite
index 6804099..d2a0270 100755
Binary files a/data/database.sqlite and b/data/database.sqlite differ
diff --git a/src/Controller/ContratoAdmController.php b/src/Controller/ContratoAdmController.php
new file mode 100644
index 0000000..21ed402
--- /dev/null
+++ b/src/Controller/ContratoAdmController.php
@@ -0,0 +1,109 @@
+usuario = $usuarioService;
+ $this->imovel = $imovelService;
+ $this->contratoAdm = $contratoAdm;
+
+ }
+
+
+ /**
+ * @Route("/contrato/listar", name="contrato_adm_index")
+ */
+ public function index(ContratoAdmRepository $contratoAdmRepository): Response
+ {
+ return $this->render('contratoAdm.html.twig', [
+ 'contrato_adms' => $contratoAdmRepository->findAll(),
+ ]);
+ }
+
+ /**
+ * @Route("/contrato/cadastro", name="contrato_adm_cadastro", methods={"GET","POST"})
+ */
+ public function cadastro(Request $request): Response
+ {
+ $contratoAdm = new ContratoAdm();
+ $form = $this->createForm(ContratoAdmType::class, $contratoAdm);
+
+ $form->handleRequest($request);
+
+ if ($form->isSubmitted()) {
+
+ $this->contratoAdm->salvar($contratoAdm);
+// $entityManager = $this->getDoctrine()->getManager();
+// $entityManager->persist($contratoAdm);
+// $entityManager->flush();
+
+ return $this->redirectToRoute('contrato_adm_index');
+ }
+
+ return $this->render('contratoAdm_cadastro.html.twig', [
+ 'contrato_adm' => $contratoAdm,
+ 'form' => $form->createView(),
+ ]);
+ }
+
+ /**
+ * @Route("/contrato/{id}", name="contrato_adm_show", methods={"GET"})
+ */
+ public function show(ContratoAdm $contratoAdm): Response
+ {
+ return $this->render('contrato_adm/show.html.twig', [
+ 'contrato_adm' => $contratoAdm,
+ ]);
+ }
+
+ /**
+ * @Route("/contratoEditar/{id}", name="contrato_adm_editar")
+ */
+ public function editar(Request $request, ContratoAdm $contratoAdm): Response
+ {
+ $form = $this->createForm(ContratoAdmType::class, $contratoAdm);
+ $form->handleRequest($request);
+
+ if ($form->isSubmitted()) {
+ $this->getDoctrine()->getManager()->flush();
+
+ return $this->redirectToRoute('contrato_adm_index', [
+ 'id' => $contratoAdm->getId(),
+ ]);
+ }
+
+ return $this->render('contratoAdm_editar.html.twig', [
+ 'contrato_adm' => $contratoAdm,
+ 'form' => $form->createView(),
+ ]);
+ }
+
+ /**
+ * @Route("/contratoDeletar/{id}", name="contrato_adm_delete")
+ */
+ public function delete(Request $request, ContratoAdm $contratoAdm): Response
+ {
+ $this->contratoAdm->deletar($contratoAdm->getId());
+
+ return $this->redirectToRoute('contrato_adm_index');
+ }
+}
diff --git a/src/Controller/ImovelController.php b/src/Controller/ImovelController.php
index 5cbf296..e8b5e9c 100644
--- a/src/Controller/ImovelController.php
+++ b/src/Controller/ImovelController.php
@@ -6,6 +6,7 @@
use App\Entity\Imovel;
use App\Forms\ImovelType;
+use App\Services\ImovelService;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
@@ -13,6 +14,13 @@
class ImovelController extends AbstractController
{
+ private $imovelService;
+
+ public function __construct(ImovelService $imovelService)
+ {
+ $this->imovelService = $imovelService;
+ }
+
/**
* @Route("/imovel/cadastro", name="cadasto_imovel")
*
@@ -28,11 +36,10 @@ public function cadastroImovel(Request $request)
if ($form->isSubmitted()) {
$imovel = $form->getData();
- $em = $this->getDoctrine()->getManager();
- $em->persist($imovel);
- $em->flush();
+ $this->imovelService->salvar($imovel);
- return $this->redirectToRoute('index');
+ //redirect
+ return $this->redirectToRoute('listar_imoveis');
}
return $this->render('imovel_cadastro.html.twig', [
@@ -46,8 +53,7 @@ public function cadastroImovel(Request $request)
*/
public function listarImoveis()
{
- $em = $this->getDoctrine()->getManager();
- $imoveis = $em->getRepository(Imovel::class)->findAll();
+ $imoveis = $this->imovelService->listar();
return $this->render('listar_imoveis.html.twig', [
'imoveis' => $imoveis
@@ -81,6 +87,57 @@ public function imovelVisualizar(Request $request)
]);
}
+ /**
+ * @Route("/editarImovel/{id}", name="editar_imovel")
+ */
+ public function editarImovel(int $id, Request $request)
+ {
+ //pegando o imovel a ser editado
+ $em = $this->getDoctrine()->getManager();
+ $imovel = $em->getRepository(Imovel::class)->find($id);
+
+ if (!$imovel) {
+ throw new \Exception('Imovel não encontrado');
+ }
+
+ //criando o form
+ $form = $this->createForm(ImovelType::class, $imovel);
+
+
+ //renderizando o form
+ $form->handleRequest($request);
+
+ if($form->isSubmitted())
+ {
+ $imovel = $form->getData();
+ $this->imovelService->editar($imovel);
+ //msg
+ $this->addFlash('success', 'Imovel editado com sucesso!!!');
+
+ //redirect
+ return $this->redirectToRoute('listar_imoveis');
+ }
+
+ return $this->render('imovel_cadastro.html.twig', ['form' => $form->createView()]);
+ }
+
+
+ /**
+ * @Route("/deletarImovel/{id}", name="deletar_imovel")
+ */
+ public function deletarImovel(int $id, Request $request)
+ {
+
+ $this->imovelService->deletar($id);
+
+ $this->addFlash('success', 'Imovel deletado com sucesso!!!');
+
+ //redirect
+ return $this->redirectToRoute('listar_imoveis');
+ }
+
+
+
}
\ No newline at end of file
diff --git a/src/Controller/UsuarioController.php b/src/Controller/UsuarioController.php
index f1facd9..6dd35db 100644
--- a/src/Controller/UsuarioController.php
+++ b/src/Controller/UsuarioController.php
@@ -6,6 +6,7 @@
use App\Entity\Corretor;
use App\Forms\UsuarioType;
use App\Entity\Usuario;
+use App\Services\UsuarioService;
use phpDocumentor\Reflection\DocBlock\Tags\Throws;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -21,10 +22,10 @@ class UsuarioController extends AbstractController
{
/**
- *@IsGranted("ROLE_ADMIN")
+ *
* @Route("/usuario", name="usuario_novo")
*/
- public function cadastroUsuario(Request $request)
+ public function cadastroUsuario(Request $request, UsuarioService $usuarioService)
{
$usuario = new Usuario();
$form = $this->createForm(UsuarioType::class, $usuario);
@@ -32,9 +33,8 @@ public function cadastroUsuario(Request $request)
if ($form->isSubmitted()) {
$usuario = $form->getData();
- $em = $this->getDoctrine()->getManager();
- $em->persist($usuario);
- $em->flush();
+ //enviando para o serviço
+ $usuarioService->salvar($usuario);
return $this->redirectToRoute('index');
}
@@ -59,7 +59,6 @@ public function listarUsuarios(Request $request)
$em->flush();
-
$em = $this->getDoctrine()->getManager();
$usuarios = $em->getRepository(Usuario::class)->findAll();
@@ -69,7 +68,7 @@ public function listarUsuarios(Request $request)
}
/**
- * @Route("/editar/{id}", name="editar_usuario")
+ * @Route("/editarUsuario/{id}", name="editar_usuario")
*/
public function editarUsuario(int $id, Request $request)
{
@@ -81,7 +80,6 @@ public function editarUsuario(int $id, Request $request)
}
$form = $this->createForm(UsuarioType::class, $usuario);
-
$form->handleRequest($request);
if ($form->isSubmitted()) {
@@ -94,19 +92,16 @@ public function editarUsuario(int $id, Request $request)
}
return $this->render('usuario_cadastro.html.twig', [
- 'form' => $form->createView()
- ]);
+ 'form' => $form->createView()]);
}
/**
* @Route("/deletar/{id}", name="deletar_usuario")
*/
- public function deletarUsuario(int $id, Request $request)
+ public function deletarUsuario(int $id, Request $request, UsuarioService $usuarioService)
{
- $em = $this->getDoctrine()->getManager();
- $usuario = $em->getRepository(Usuario::class)->find($id);
- $em->remove($usuario);
- $em->flush();
+ $usuarioService->deletar($id);
+
$this->addFlash('success', 'Usuario de id:'.$id.' deletado com sucesso!!!');
return $this->redirectToRoute('listar_usuarios');
diff --git a/src/Entity/ContratoAdm.php b/src/Entity/ContratoAdm.php
new file mode 100644
index 0000000..5c6a753
--- /dev/null
+++ b/src/Entity/ContratoAdm.php
@@ -0,0 +1,93 @@
+id;
+ }
+
+ public function getDtCadastro(): ?\DateTimeInterface
+ {
+ return $this->dtCadastro;
+ }
+
+ public function setDtCadastro(\DateTimeInterface $dtCadastro): self
+ {
+ $this->dtCadastro = $dtCadastro;
+
+ return $this;
+ }
+
+ public function getClausulaContratual(): ?string
+ {
+ return $this->clausulaContratual;
+ }
+
+ public function setClausulaContratual(?string $clausulaContratual): self
+ {
+ $this->clausulaContratual = $clausulaContratual;
+
+ return $this;
+ }
+
+ public function getUsuario(): ?Usuario
+ {
+ return $this->usuario;
+ }
+
+ public function setUsuario(?Usuario $usuario): self
+ {
+ $this->usuario = $usuario;
+
+ return $this;
+ }
+
+ public function getImovel(): ?Imovel
+ {
+ return $this->imovel;
+ }
+
+ public function setImovel(?Imovel $imovel): self
+ {
+ $this->imovel = $imovel;
+
+ return $this;
+ }
+}
diff --git a/src/Entity/Endereco.php b/src/Entity/Endereco.php
index e78e8ea..f43f9ed 100644
--- a/src/Entity/Endereco.php
+++ b/src/Entity/Endereco.php
@@ -52,22 +52,22 @@ class Endereco
private $uf;
/**
- * @ORM\Column(type="integer", length=9, nullable=true)
+ * @ORM\Column(type="string", length=9, nullable=true)
*/
private $telefone;
/**
- * @ORM\Column(type="integer", name="ddd_telefone", length=2, nullable=true)
+ * @ORM\Column(type="string", name="ddd_telefone", length=2, nullable=true)
*/
private $dddTelefone;
/**
- * @ORM\Column(type="integer", name="celular", length=9, nullable=true)
+ * @ORM\Column(type="string", name="celular", length=9, nullable=true)
*/
private $celular;
/**
- * @ORM\Column(type="integer", name="ddd_celular", length=2, nullable=true)
+ * @ORM\Column(type="string", name="ddd_celular", length=2, nullable=true)
*/
private $dddCelular;
diff --git a/src/Entity/Imovel.php b/src/Entity/Imovel.php
index e50f78c..1e1f027 100644
--- a/src/Entity/Imovel.php
+++ b/src/Entity/Imovel.php
@@ -2,6 +2,8 @@
namespace App\Entity;
+use Doctrine\Common\Collections\ArrayCollection;
+use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@@ -47,6 +49,16 @@ class Imovel
*/
private $endereco;
+ /**
+ * @ORM\OneToMany(targetEntity="App\Entity\ContratoAdm", mappedBy="imovel")
+ */
+ private $contratosAdm;
+
+ public function __construct()
+ {
+ $this->contratosAdm = new ArrayCollection();
+ }
+
/**
@@ -161,6 +173,37 @@ public function setEndereco($endereco): void
$this->endereco = $endereco;
}
+ /**
+ * @return Collection|ContratoAdm[]
+ */
+ public function getContratosAdm(): Collection
+ {
+ return $this->contratosAdm;
+ }
+
+ public function addContratosAdm(ContratoAdm $contratosAdm): self
+ {
+ if (!$this->contratosAdm->contains($contratosAdm)) {
+ $this->contratosAdm[] = $contratosAdm;
+ $contratosAdm->setImovel($this);
+ }
+
+ return $this;
+ }
+
+ public function removeContratosAdm(ContratoAdm $contratosAdm): self
+ {
+ if ($this->contratosAdm->contains($contratosAdm)) {
+ $this->contratosAdm->removeElement($contratosAdm);
+ // set the owning side to null (unless already changed)
+ if ($contratosAdm->getImovel() === $this) {
+ $contratosAdm->setImovel(null);
+ }
+ }
+
+ return $this;
+ }
+
// /**
// * @ORM\OneToMany(targetEntity="Entity\contratoLocacao", mappedBy="imovel")
// */
diff --git a/src/Entity/Usuario.php b/src/Entity/Usuario.php
index 692db37..7af6f07 100644
--- a/src/Entity/Usuario.php
+++ b/src/Entity/Usuario.php
@@ -1,6 +1,8 @@
contratosAdm = new ArrayCollection();
+ }
+
/**
* @return mixed
*/
@@ -213,34 +225,49 @@ public function setContratoLocacao($contratoLocacao): void
}
/**
- * @return mixed
+ * @return string
*/
- public function getContratoAdm()
+ public function getTipoUsuario(): ?string
{
- return $this->contratoAdm;
+ return $this->tipoUsuario;
}
/**
- * @param mixed $contratoAdm
+ * @param string $tipoUsuario
*/
- public function setContratoAdm($contratoAdm): void
+ public function setTipoUsuario(string $tipoUsuario): void
{
- $this->contratoAdm = $contratoAdm;
+ $this->tipoUsuario = $tipoUsuario;
}
/**
- * @return string
+ * @return Collection|ContratoAdm[]
*/
- public function getTipoUsuario(): ?string
+ public function getContratosAdm(): Collection
{
- return $this->tipoUsuario;
+ return $this->contratosAdm;
}
- /**
- * @param string $tipoUsuario
- */
- public function setTipoUsuario(string $tipoUsuario): void
+ public function addContratosAdm(ContratoAdm $contratosAdm): self
{
- $this->tipoUsuario = $tipoUsuario;
+ if (!$this->contratosAdm->contains($contratosAdm)) {
+ $this->contratosAdm[] = $contratosAdm;
+ $contratosAdm->setUsuario($this);
+ }
+
+ return $this;
+ }
+
+ public function removeContratosAdm(ContratoAdm $contratosAdm): self
+ {
+ if ($this->contratosAdm->contains($contratosAdm)) {
+ $this->contratosAdm->removeElement($contratosAdm);
+ // set the owning side to null (unless already changed)
+ if ($contratosAdm->getUsuario() === $this) {
+ $contratosAdm->setUsuario(null);
+ }
+ }
+
+ return $this;
}
}
diff --git a/src/EventListener/ExceptionListener.php b/src/EventListener/ExceptionListener.php
index 40bc24b..8000d54 100644
--- a/src/EventListener/ExceptionListener.php
+++ b/src/EventListener/ExceptionListener.php
@@ -63,8 +63,8 @@ public function onException(GetResponseForExceptionEvent $event)
*/
private function handleException(Exception $exception)
{
- $this->container->get('session')->getFlashBag()->add('error', $exception->getMessage());
- $this->saveLogger($exception);
+ //$this->container->get('session')->getFlashBag()->add('error', $exception->getMessage());
+ //$this->saveLogger($exception);
}
/**
diff --git a/src/Forms/ContratoAdmType.php b/src/Forms/ContratoAdmType.php
new file mode 100644
index 0000000..c054185
--- /dev/null
+++ b/src/Forms/ContratoAdmType.php
@@ -0,0 +1,63 @@
+usuarioService = $usuarioService;
+ $this->imovelService = $imovelService;
+ }
+
+ public function buildForm(FormBuilderInterface $builder, array $options)
+ {
+ $builder
+ ->add('dtCadastro', DateType::class, [
+ 'label' => 'Data de Cadastro',
+ 'widget' => 'single_text',
+ 'attr' => ['class' => 'js-datepicker'],
+ ])
+ ->add('clausulaContratual')
+ ->add('usuario', ChoiceType::class, [
+ 'choices' => $this->usuarioService->listar(),
+ 'choice_value' => function(Usuario $usuario = null) {
+ return $usuario ? $usuario->getId() : '';
+ },
+ 'choice_label' => function(Usuario $usuario) {
+ return $usuario->getNome();
+ },
+ ])
+ ->add('imovel', ChoiceType::class, [
+ 'choices' => $this->imovelService->listar(),
+ 'choice_value' => function(Imovel $imovel = null) {
+ return $imovel ? $imovel->getId() : '';
+ },
+ 'choice_label' => function(Imovel $imovel) {
+ return $imovel->getCaracteristicas() . ' - ' . $imovel->getTipoImovel();
+ },
+ ])
+ ;
+ }
+
+ public function configureOptions(OptionsResolver $resolver)
+ {
+ $resolver->setDefaults([
+ 'data_class' => ContratoAdm::class,
+ ]);
+ }
+}
diff --git a/src/Forms/EnderecoType.php b/src/Forms/EnderecoType.php
index 2689962..ed50aac 100755
--- a/src/Forms/EnderecoType.php
+++ b/src/Forms/EnderecoType.php
@@ -92,8 +92,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->add('telefone', TelType::class, [
'label' => 'Telefone:',
'attr' => [
- 'data-mask' => '000-0000',
- 'placeholder' => '_ _ _ - _ _ _ _'
+ 'data-mask' => '0000-0000',
+ 'placeholder' => '_ _ _ _ - _ _ _ _'
]
])
->add('dddCelular', TextType::class, [
diff --git a/src/Forms/ImovelType.php b/src/Forms/ImovelType.php
index 14fb62a..f422a1d 100755
--- a/src/Forms/ImovelType.php
+++ b/src/Forms/ImovelType.php
@@ -37,6 +37,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'Vistoria' => 'Vistoria',
'Sem Cotrato Adm' => 'Sem Cotrato Adm',
'Sem Contrato de Locação' => 'Sem Contrato de Locação'
+ ],
+ 'attr' => [
+ 'style' => 'width: 250px'
]
])
@@ -47,6 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'Observações Geral',
])
->add('tipoImovel', ChoiceType::class, [
+ 'label' => 'Tipo',
'empty_data' => 'Casa',
'choices' => [
'Casa' => 'Casa',
@@ -55,6 +59,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'Terreno' => 'Terreno',
'Prédio Comercial' => 'Prédio Comercial',
'Loja em Shopping' => 'Loja em Shopping'
+ ],
+ 'attr' => [
+ 'style' => 'width: 250px'
]
])
->add('dtCadastro', DateType::class, [
diff --git a/src/Repository/ContratoAdmRepository.php b/src/Repository/ContratoAdmRepository.php
new file mode 100644
index 0000000..2edce8a
--- /dev/null
+++ b/src/Repository/ContratoAdmRepository.php
@@ -0,0 +1,92 @@
+createQueryBuilder('c')
+ ->andWhere('c.exampleField = :val')
+ ->setParameter('val', $value)
+ ->orderBy('c.id', 'ASC')
+ ->setMaxResults(10)
+ ->getQuery()
+ ->getResult()
+ ;
+ }
+ */
+
+ /*
+ public function findOneBySomeField($value): ?ContratoAdm
+ {
+ return $this->createQueryBuilder('c')
+ ->andWhere('c.exampleField = :val')
+ ->setParameter('val', $value)
+ ->getQuery()
+ ->getOneOrNullResult()
+ ;
+ }
+ */
+
+
+ /**
+ * @param ContratoAdm $contratoAdm
+ * @throws \Doctrine\ORM\ORMException
+ * @throws \Doctrine\ORM\OptimisticLockException
+ */
+
+ public function salvar(ContratoAdm $contratoAdm)
+ {
+ $em = $this->getEntityManager();
+ $em->persist($contratoAdm);
+ $em->flush();
+
+ }
+
+ /**
+ * @param Int $id
+ * @throws \Doctrine\ORM\ORMException
+ * @throws \Doctrine\ORM\OptimisticLockException
+ */
+ public function deletar(int $id)
+ {
+ $em = $this->getEntityManager();
+ $contratoAdm = $em->getRepository(ContratoAdm::class)->find($id);
+ $em->remove($contratoAdm);
+ $em->flush();
+ }
+
+ public function listar()
+ {
+ $em = $this->getEntityManager();
+ return $em->getRepository(ContratoAdm::class)->findAll();
+ }
+
+ public function editar(ContratoAdm $contratoAdm)
+ {
+ $em = $this->getEntityManager();
+ $em->merge($contratoAdm);
+ $em->flush();
+ }
+
+}
diff --git a/src/Repository/ImovelRepository.php b/src/Repository/ImovelRepository.php
new file mode 100644
index 0000000..a265e54
--- /dev/null
+++ b/src/Repository/ImovelRepository.php
@@ -0,0 +1,58 @@
+getEntityManager();
+ $em->persist($imovel);
+ $em->flush();
+
+ }
+
+ /**
+ * @param Int $id
+ * @throws \Doctrine\ORM\ORMException
+ * @throws \Doctrine\ORM\OptimisticLockException
+ */
+ public function deletar(int $id)
+ {
+ $em = $this->getEntityManager();
+ $imovel = $em->getRepository(Imovel::class)->find($id);
+ $em->remove($imovel);
+ $em->flush();
+ }
+
+ public function listar()
+ {
+ $em = $this->getEntityManager();
+ return $em->getRepository(Imovel::class)->findAll();
+ }
+
+ public function editar(Imovel $imovel)
+ {
+ $em = $this->getEntityManager();
+ $em->merge($imovel);
+ $em->flush();
+ }
+
+}
\ No newline at end of file
diff --git a/src/Repository/UsuarioRepository.php b/src/Repository/UsuarioRepository.php
new file mode 100644
index 0000000..0fe00ef
--- /dev/null
+++ b/src/Repository/UsuarioRepository.php
@@ -0,0 +1,45 @@
+getEntityManager();
+ $em->persist($user);
+ $em->flush();
+ }
+
+ /**
+ * @param Int $id
+ * @throws \Doctrine\ORM\ORMException
+ * @throws \Doctrine\ORM\OptimisticLockException
+ */
+
+ public function deletar(int $id)
+ {
+ $em = $this->getEntityManager();
+ $usuario = $em->getRepository(Usuario::class)->find($id);
+ $em->remove($usuario);
+ $em->flush();
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/Services/ContratoAdmService.php b/src/Services/ContratoAdmService.php
new file mode 100644
index 0000000..6b00d65
--- /dev/null
+++ b/src/Services/ContratoAdmService.php
@@ -0,0 +1,47 @@
+contratoAdmRepository = $contratoAdmRepositoryController;
+ }
+
+ public function salvar(ContratoAdm $contratoAdm)
+ {
+ $this->contratoAdmRepository->salvar($contratoAdm);
+ }
+
+ public function deletar(int $id)
+ {
+ $this->contratoAdmRepository->deletar($id);
+ }
+
+ public function listar()
+ {
+ return $this->contratoAdmRepository->listar();
+ }
+
+ public function editar(ContratoAdm $contratoAdm)
+ {
+ return $this->contratoAdmRepository->editar($contratoAdm);
+ }
+
+ public function buscarPorId(int $id)
+ {
+ return $this->contratoAdmRepository->find($id);
+ }
+
+}
\ No newline at end of file
diff --git a/src/Services/ImovelService.php b/src/Services/ImovelService.php
new file mode 100644
index 0000000..c0a9de0
--- /dev/null
+++ b/src/Services/ImovelService.php
@@ -0,0 +1,46 @@
+imovelRepository = $imovelRepositoryController;
+ }
+
+ public function salvar(Imovel $imovel)
+ {
+ $this->imovelRepository->salvar($imovel);
+ }
+
+ public function deletar(int $id)
+ {
+ $this->imovelRepository->deletar($id);
+ }
+
+ public function listar()
+ {
+ return $this->imovelRepository->listar();
+ }
+
+ public function editar(Imovel $imovel)
+ {
+ return $this->imovelRepository->editar($imovel);
+ }
+
+ public function buscarPorId(int $id)
+ {
+ return $this->imovelRepository->find($id);
+ }
+}
diff --git a/src/Services/UsuarioService.php b/src/Services/UsuarioService.php
new file mode 100644
index 0000000..15dbf6b
--- /dev/null
+++ b/src/Services/UsuarioService.php
@@ -0,0 +1,41 @@
+usuarioRepository = $userRepository;
+ }
+
+ public function salvar(Usuario $user)
+ {
+ $this->usuarioRepository->salvar($user);
+ }
+
+ public function deletar(int $id)
+ {
+ $this->usuarioRepository->deletar($id);
+ }
+
+ public function listar()
+ {
+ return $this->usuarioRepository->findAll();
+ }
+
+ public function buscarPorId(int $id)
+ {
+ return $this->usuarioRepository->find($id);
+ }
+}
diff --git a/templates/base.html.twig b/templates/base.html.twig
index 6d8013b..40a6bb5 100755
--- a/templates/base.html.twig
+++ b/templates/base.html.twig
@@ -59,7 +59,7 @@
@@ -74,7 +74,7 @@
diff --git a/templates/contratoAdm.html.twig b/templates/contratoAdm.html.twig
new file mode 100644
index 0000000..0521277
--- /dev/null
+++ b/templates/contratoAdm.html.twig
@@ -0,0 +1,59 @@
+{% include "base.html.twig" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | # |
+ Data |
+ Clausula |
+ Ações |
+
+
+
+ {% for contrato_adm in contrato_adms %}
+
+ | {{ contrato_adm.id }} |
+ {{ contrato_adm.dtCadastro ? contrato_adm.dtCadastro|date('d/m/Y') : '' }} |
+ {{ contrato_adm.clausulaContratual }} |
+
+
+
+
+
+
+ |
+
+ {% else %}
+
+ | no records found |
+
+ {% endfor %}
+
+
+
+
Novo Contrato
+
+
+
+
+
+
+
+
+
+
+ {% include "footer.html.twig" %}
+
+
+
diff --git a/templates/contratoAdm_cadastro.html.twig b/templates/contratoAdm_cadastro.html.twig
new file mode 100644
index 0000000..44de77a
--- /dev/null
+++ b/templates/contratoAdm_cadastro.html.twig
@@ -0,0 +1,49 @@
+{% include 'base.html.twig' %}
+
+
+
+
+
+
+
+
Cadastro de Contrato
+
+ {{ form_start(form) }}
+
+
+
+ {{ form_row(form.clausulaContratual) }}
+
+
+ {{ form_row(form.dtCadastro) }}
+
+
+
+
Usuario
+
+
+ {{ form_row(form.usuario) }}
+
+
+
+
Imovel
+
+
+ {{ form_row(form.imovel) }}
+
+
+
+
+
+
+
+
+
+
+
+
+{% include "footer.html.twig" %}s
diff --git a/templates/contratoAdm_editar.html.twig b/templates/contratoAdm_editar.html.twig
new file mode 100644
index 0000000..bd1cdf8
--- /dev/null
+++ b/templates/contratoAdm_editar.html.twig
@@ -0,0 +1,49 @@
+{% include 'base.html.twig' %}
+
+
+
+
+
+
+
+
Editar de Contrato
+
+ {{ form_start(form) }}
+
+
+
+ {{ form_row(form.clausulaContratual) }}
+
+
+ {{ form_row(form.dtCadastro) }}
+
+
+
+
Usuario
+
+
+ {{ form_row(form.usuario) }}
+
+
+
+
Imovel
+
+
+ {{ form_row(form.imovel) }}
+
+
+
+
+
+
+
+
+
+
+
+
+{% include "footer.html.twig" %}s
diff --git a/templates/imovel_cadastro.html.twig b/templates/imovel_cadastro.html.twig
index 9e378da..4fa3612 100644
--- a/templates/imovel_cadastro.html.twig
+++ b/templates/imovel_cadastro.html.twig
@@ -6,15 +6,88 @@
Cadastro de Imóveis
-
{{ form_start(form) }}
- {{ form_widget(form) }}
-
+
+
+ {{ form_row(form.caracteristicas) }}
+
+
+ {{ form_row(form.status) }}
+
+
+
+
+
+ {{ form_row(form.observacao) }}
+
+
+ {{ form_row(form.tipoImovel) }}
+
+
+
+
+ {{ form_row(form.dtCadastro) }}
+
+
+
Endereço
+
+
+ {{ form_row(form.endereco.logradouro) }}
+
+
+ {{ form_row(form.endereco.numero) }}
+
+
+
+
+ {{ form_row(form.endereco.bairro) }}
+
+
+ {{ form_row(form.endereco.cep) }}
+
+
+
+
+ {{ form_row(form.endereco.cidade) }}
+
+
+ {{ form_row(form.endereco.uf) }}
+
+
+
+
+ {{ form_row(form.endereco.complemento) }}
+
+
+
+
+ {{ form_row(form.endereco.dddTelefone) }}
+
+
+ {{ form_row(form.endereco.telefone) }}
+
+
+
+
+ {{ form_row(form.endereco.dddCelular) }}
+
+
+ {{ form_row(form.endereco.celular) }}
+
+
+
+
+
+
{{ form_end(form) }}
-
+
diff --git a/templates/listar_imoveis.html.twig b/templates/listar_imoveis.html.twig
index 6af1973..ce545d5 100644
--- a/templates/listar_imoveis.html.twig
+++ b/templates/listar_imoveis.html.twig
@@ -45,9 +45,13 @@
{{ imovel.dtCadastro|date("m/d/Y") }} |
{{ imovel.endereco.bairro }} |
{{ imovel.endereco.logradouro }} |
-
+ |
- |
+
+
+
+
+
{% endfor %}
@@ -80,7 +84,7 @@
-{% include "footer.html.twig" %}s
+{% include "footer.html.twig" %}
diff --git a/templates/listar_usuarios.html.twig b/templates/listar_usuarios.html.twig
index c103c0b..124a418 100644
--- a/templates/listar_usuarios.html.twig
+++ b/templates/listar_usuarios.html.twig
@@ -31,7 +31,6 @@
+