diff --git a/src/Controller/DocumentController.php b/src/Controller/DocumentController.php
index 61a2d20..a47ba1f 100644
--- a/src/Controller/DocumentController.php
+++ b/src/Controller/DocumentController.php
@@ -2,15 +2,17 @@
namespace App\Controller;
-use App\Entity\CaseDocument;
use App\Entity\CompanyDocument;
-use App\Entity\MemberCase;
+use App\Entity\Member;
+use App\Entity\MemberDocument;
use App\Entity\User;
+use App\Libs\Breadcrumb;
use App\Libs\NavList;
use App\Libs\Libs;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
@@ -23,22 +25,51 @@ class DocumentController extends AbstractController
$this->navLinks = NavList::LIST;
}
- #[Route('/case/{caseId}/doc/{docId}', name: 'app_display_case_doc')]
- public function displayCaseDocument(string $caseId, string $docId, #[CurrentUser()] User $user): Response
+ #[Route('/member/{memberId}', name: 'app_display_case_doc')]
+ public function displayCaseDocument(string $memberId, #[CurrentUser()] User $user): Response
{
- $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId);
- $doc = $this->entityManager->getRepository(CompanyDocument::class)->find($docId);
- $caseDoc = $this->entityManager->getRepository(CaseDocument::class)->getCaseDocument($case, $doc);
+ /** @var Member $member */
+ $member = $this->entityManager->getRepository(Member::class)->find($memberId);
+ $memberDocs = $this->entityManager->getRepository(MemberDocument::class)->findBy(['client' => $member]);
return $this->render(
- 'internal/cases/documents/display-case-doc.html.twig',
+ 'internal/cases/members/documents/list-member-docs.html.twig',
array_merge(
$this->navLinks,
[
- 'msgs' => Libs::getMessages($user, $this->entityManager),
- 'breadcrumbs' => []
+ 'notifications' => Libs::getMessages($user, $this->entityManager),
+ 'breadcrumbs' => [
+ new Breadcrumb($this->generateUrl('app_my_cases'), 'Cases'),
+ new Breadcrumb($this->generateUrl('app_case_members', ['id' => $member->getCaseId()->getId()->toString()]), 'Members'),
+ ],
+ 'docs' => $memberDocs,
]
)
);
}
+
+ #[Route('/member/{memberId}/document/{docId}/sign', name: 'app_member_sign_case_doc')]
+ public function signCaseDocument(string $memberId, string $docId, #[CurrentUser()] User $user): Response
+ {
+ /** @var Member $member */
+ $member = $this->entityManager->getRepository(Member::class)->find($memberId);
+ $doc = $this->entityManager->getRepository(CompanyDocument::class)->find($docId);
+
+ $memDoc = $this->entityManager->getRepository(MemberDocument::class)->findOneBy([
+ 'document' => $doc,
+ 'client' => $member,
+ 'caseWorker' => $user
+ ]);
+
+ if (!$memDoc) {
+ throw new NotFoundHttpException('Document not found');
+ }
+
+ return $this->render(
+ 'internal/cases/members/documents/sign-member-doc.html.twig', [
+ 'doc' => $memDoc,
+ 'caseWorkerSignature' => $user->getSignature(),
+ ]
+ );
+ }
}
\ No newline at end of file
diff --git a/templates/internal/cases/members/documents/list-member-docs.html.twig b/templates/internal/cases/members/documents/list-member-docs.html.twig
new file mode 100644
index 0000000..88ea67c
--- /dev/null
+++ b/templates/internal/cases/members/documents/list-member-docs.html.twig
@@ -0,0 +1,59 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}{% endblock %}
+
+{% block body %}
+ {{ block('nav', 'internal/libs/nav.html.twig') }}
+
+
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }}
+
+
+
+
+
+
+
+
+
+
+
+ Title |
+ Client Signed |
+ Case Worker Signed |
+ |
+
+
+
+ {% for d in docs %}
+
+ {{ d.document.title }} |
+ {% if d.clientSigned %}{{ d.clientSigned|date('M j, Y H:i:s', company_timezone) }}{% endif %} |
+ {% if d.workerSigned %}{{ d.workerSigned|date('M j, Y H:i:s', company_timezone) }}{% endif %} |
+
+
+ edit
+
+ |
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block page_js %}{% endblock %}
+
+{% block page_css %}{% endblock %}
diff --git a/templates/internal/cases/members/documents/sign-member-doc.html.twig b/templates/internal/cases/members/documents/sign-member-doc.html.twig
new file mode 100644
index 0000000..e50cdd5
--- /dev/null
+++ b/templates/internal/cases/members/documents/sign-member-doc.html.twig
@@ -0,0 +1,119 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}{% endblock %}
+
+{% block body %}
+
+
Sign Member Document
+
{{ doc.document.title }}
+
{{ doc.document.updated|date('M j, Y h:i:s a', company_timezone) }}
+
+
+
+{% endblock %}
+
+{% block page_js %}
+
+
+{% endblock %}
+
+{% block page_css %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/internal/cases/members/list-members.html.twig b/templates/internal/cases/members/list-members.html.twig
index 0062ab8..5bd4195 100644
--- a/templates/internal/cases/members/list-members.html.twig
+++ b/templates/internal/cases/members/list-members.html.twig
@@ -76,7 +76,7 @@
edit
-
+
content_copy