From 1cb6bedb5c5fd3413ae9d68c632377e968dd5821 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sat, 11 Jan 2025 22:30:54 -0500 Subject: [PATCH] add docs for the case --- config/packages/twig.yaml | 2 + public/index.php | 10 ++ src/Controller/AdminController.php | 23 +-- src/Controller/CaseController.php | 92 ++--------- .../CommunityResourceController.php | 31 +--- src/Controller/CompanyController.php | 16 +- src/Controller/DefaultController.php | 127 ++++++++++++--- src/Controller/DocumentController.php | 10 +- src/Controller/ItineraryController.php | 112 +------------ src/Controller/MemberController.php | 19 +-- src/Controller/MessageController.php | 2 - src/Controller/NoteController.php | 73 +-------- .../internal/admin/cases/list-cases.html.twig | 2 +- templates/internal/dashboard.html.twig | 132 +++++++++++++++ templates/internal/libs/nav.html.twig | 2 +- templates/internal/libs/top-nav.html.twig | 6 +- templates/internal/profile.html.twig | 153 ++++++++++++------ templates/libs/nav.html.twig | 8 +- 18 files changed, 398 insertions(+), 422 deletions(-) diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index d70f5f7..136e68c 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -3,6 +3,8 @@ twig: globals: mileage_rate: '%env(MILEAGE_RATE)%' company_timezone: '%env(COMPANY_TIMEZONE)%' + company_image_path: '%env(COMPANY_IMAGE_PATH)%' + user_image_path: '%env(USER_IMAGE_PATH)%' when@test: twig: diff --git a/public/index.php b/public/index.php index 9982c21..d831ba0 100644 --- a/public/index.php +++ b/public/index.php @@ -2,6 +2,16 @@ use App\Kernel; +if (preg_match("/theme\//", $_SERVER['REQUEST_URI'])) { + print file_get_contents(dirname(__FILE__).$_SERVER['REQUEST_URI']); + exit; +} + +if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + $_SERVER['HTTPS'] = 'on'; + $_SERVER['SERVER_PORT'] = 443; +} + require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; return function (array $context) { diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 498c32f..956a63f 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -2,18 +2,16 @@ namespace App\Controller; -use App\Entity\CompanyDocument; -use App\Entity\Messages; use App\Entity\Supervision; use App\Entity\User; use App\Factory\MessageFactory; -use App\Form\CompanyDocumentFormType; use App\Form\EditUserFormType; use App\Form\SupervisorFormType; use App\Form\UserFormType; use App\Libs\Breadcrumb; use App\Libs\NavList; use App\Libs\Libs; +use App\Libs\PageParameters; use App\Repository\UserRepository; use DateTime; use DateTimeZone; @@ -30,12 +28,10 @@ use Symfony\Component\String\Slugger\SluggerInterface; #[IsGranted('ROLE_ADMIN')] class AdminController extends AbstractController { - private array $msgs; - public function __construct( private readonly EntityManagerInterface $entityManager, private readonly UserPasswordHasherInterface $userPasswordHasher, - private array $navLinks = [] + private array $navLinks = [], ) { $this->navLinks = NavList::LIST; } @@ -45,7 +41,6 @@ class AdminController extends AbstractController { $this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->navLinks['admin_dashboard'] = NavList::PRESENT_LINK; - $this->msgs = Libs::getMessages($user, $this->entityManager); return $this->render( 'internal/admin/admin-dashboard.html.twig', @@ -55,7 +50,7 @@ class AdminController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_admin_dashboard'), 'Admin Dashboard') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -65,7 +60,6 @@ class AdminController extends AbstractController public function listUsers(#[CurrentUser()] User $user): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); - $this->msgs = Libs::getMessages($user, $this->entityManager); /** @var UserRepository $repo */ $repo = $this->entityManager->getRepository(User::class); @@ -89,7 +83,7 @@ class AdminController extends AbstractController new Breadcrumb($this->generateUrl('app_list_users'), 'List Users') ], 'users' => $users, - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -102,7 +96,6 @@ class AdminController extends AbstractController SluggerInterface $slugger ): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); - $this->msgs = Libs::getMessages($admin, $this->entityManager); $user = new User(); $form = $this->createForm(UserFormType::class, $user); @@ -183,7 +176,7 @@ class AdminController extends AbstractController new Breadcrumb($this->generateUrl('app_add_user'), 'Add User') ], 'form' => $form, - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($admin, $this->entityManager), ] ) ); @@ -194,7 +187,6 @@ class AdminController extends AbstractController { /** @var UserRepository $userRepo */ $userRepo = $this->entityManager->getRepository(User::class); - $this->msgs = Libs::getMessages($admin, $this->entityManager); /** @var User $user */ $user = $userRepo->find($id); @@ -231,7 +223,7 @@ class AdminController extends AbstractController ], 'data' => $user, 'form' => $form, - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($admin, $this->entityManager), ] ) ); @@ -242,7 +234,6 @@ class AdminController extends AbstractController { /** @var UserRepository $userRepo */ $userRepo = $this->entityManager->getRepository(User::class); - $this->msgs = Libs::getMessages($admin, $this->entityManager); /** @var User $user */ $user = $userRepo->find($id); @@ -286,7 +277,7 @@ class AdminController extends AbstractController 'user' => $user, 'form' => $form, 'supervisors' => $userRepo->getCaseManagers($admin->getCompany()), - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($admin, $this->entityManager), ] ) ); diff --git a/src/Controller/CaseController.php b/src/Controller/CaseController.php index 6c07ef8..b6808cf 100644 --- a/src/Controller/CaseController.php +++ b/src/Controller/CaseController.php @@ -8,7 +8,6 @@ use App\Entity\CompanyDocument; use App\Entity\Location; use App\Entity\Member; use App\Entity\MemberCase; -use App\Entity\Messages; use App\Entity\ReferralSource; use App\Entity\User; use App\Entity\UserCase; @@ -29,13 +28,6 @@ use Symfony\Component\Security\Http\Attribute\CurrentUser; class CaseController extends AbstractController { - /** - * Variable to store unread notification messages - * - * @var array - */ - private array $msgs; - public function __construct( private EntityManagerInterface $entityManager, private array $navLinks = [] @@ -48,10 +40,9 @@ class CaseController extends AbstractController public function myCases(#[CurrentUser()] User $user, Request $request): Response { $this->navLinks['my_cases'] = NavList::PRESENT_LINK; - $this->navLinks['case_list'] = 'nav-link text-dark'; + $this->navLinks['case_list'] = NavList::DEFAULT; $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); - $this->msgs = Libs::getMessages($user, $this->entityManager); $cases = []; foreach ($ucs as $uc) { @@ -71,7 +62,7 @@ class CaseController extends AbstractController : new Breadcrumb($this->generateUrl('app_my_cases'), 'My Cases') ), ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'cases' => $cases, ] ) @@ -85,7 +76,6 @@ class CaseController extends AbstractController $cases = $this->entityManager->getRepository(MemberCase::class)->findAll(); $workers = $this->entityManager->getRepository(User::class)->getCaseWorkers(); - $this->msgs = Libs::getMessages($user, $this->entityManager); return $this->render( 'internal/admin/cases/list-cases.html.twig', @@ -95,7 +85,7 @@ class CaseController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'cases' => $cases, 'workers' => $workers, ] @@ -115,8 +105,6 @@ class CaseController extends AbstractController $compDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $user->getCompany()]); $sources = $this->entityManager->getRepository(ReferralSource::class)->findAll(); - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser()); - return $this->render( 'internal/cases/view-case.html.twig', array_merge( @@ -130,7 +118,7 @@ class CaseController extends AbstractController new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), new Breadcrumb($this->generateUrl('app_view_case', ['caseId' => $case->getId()]), 'View Case') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -140,7 +128,6 @@ class CaseController extends AbstractController public function addCase(Request $request, #[CurrentUser()] User $admin): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $companyDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $admin->getCompany()]); $case = new MemberCase(); @@ -169,7 +156,7 @@ class CaseController extends AbstractController new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), new Breadcrumb($this->generateUrl('app_add_case'), 'Add Case') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($admin, $this->entityManager), 'form' => $form, 'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(), 'docs' => $companyDocs, @@ -182,7 +169,6 @@ class CaseController extends AbstractController public function editCase(Request $request, #[CurrentUser()] User $admin, string $id): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $case = $this->entityManager->getRepository(MemberCase::class)->find($id); $form = $this->createForm(MemberCaseFormType::class, $case); @@ -208,7 +194,7 @@ class CaseController extends AbstractController new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), new Breadcrumb($this->generateUrl('app_edit_case', ['id' => $id]), 'Edit Case') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($admin, $this->entityManager), 'form' => $form, 'case' => $case, 'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(), @@ -221,7 +207,6 @@ class CaseController extends AbstractController public function assignCase(string $id, Request $request, #[CurrentUser()] User $admin): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $caseWorkers = $this->entityManager->getRepository(User::class)->getCaseWorkers(); $case = $this->entityManager->getRepository(MemberCase::class)->find($id); @@ -263,7 +248,7 @@ class CaseController extends AbstractController new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), new Breadcrumb($this->generateUrl('app_assign_case', ['id' => $id]), 'Assign User') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($admin, $this->entityManager), 'case' => $case, 'form' => $form, 'id' => $id, @@ -281,7 +266,6 @@ class CaseController extends AbstractController $this->navLinks['case_list'] = 'nav-link text-dark'; $addresses = $this->entityManager->getRepository(Location::class)->getUserLocations($user); - $this->msgs = Libs::getMessages($user, $this->entityManager); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $cases = []; @@ -300,7 +284,7 @@ class CaseController extends AbstractController new Breadcrumb($this->generateUrl('app_my_cases'), 'My Cases'), new Breadcrumb($this->generateUrl('app_list_case_addresses'), 'List Case Addresses') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'addresses' => $addresses, 'cases' => $cases, ] @@ -314,8 +298,6 @@ class CaseController extends AbstractController $this->navLinks['case_itinerary'] = NavList::PRESENT_LINK; $this->navLinks['case_list'] = 'nav-link text-dark'; - $this->msgs = Libs::getMessages($user, $this->entityManager); - $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $cases = []; @@ -365,7 +347,7 @@ class CaseController extends AbstractController new Breadcrumb($this->generateUrl('app_list_case_addresses'), 'List Addresses'), new Breadcrumb($this->generateUrl('app_case_add_address'), 'Add Case Address') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'form' => $form, 'cases' => $cases, ] @@ -374,13 +356,11 @@ class CaseController extends AbstractController } #[Route('/addresses/edit/{id}', name: 'app_case_edit_address')] - public function editCaseAddress(Request $request, string $id): Response + public function editCaseAddress(Request $request, string $id, #[CurrentUser()] User $user): Response { $this->navLinks['case_itinerary'] = NavList::PRESENT_LINK; $this->navLinks['case_list'] = 'nav-link text-dark'; - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser()); - $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $this->getUser()]); $lcs = $this->entityManager->getRepository(CaseLocation::class)->findBy(['location' => $id]); @@ -424,7 +404,7 @@ class CaseController extends AbstractController 'cases' => $cases, 'inCases' => $inCases, 'form' => $form, - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -433,7 +413,6 @@ class CaseController extends AbstractController #[Route('/assign-case-doc/{caseId}/{memberId}', name: 'app_assign_case_documents')] public function assignCaseDocument(string $caseId, string $memberId, Request $request, #[CurrentUser()] User $user): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); $member = $this->entityManager->getRepository(Member::class)->find($memberId); $companyDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $user->getCompany()]); @@ -457,7 +436,7 @@ class CaseController extends AbstractController array_merge( $this->navLinks, [ - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_dashboard'), 'Dashboard'), new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), @@ -470,8 +449,6 @@ class CaseController extends AbstractController ] ) ); - - return new Response(); } #[Route('/sign-case-doc/{caseId}/{docId}/{memberId}', name: 'app_display_case_document')] @@ -479,49 +456,4 @@ class CaseController extends AbstractController { return new Response(); } - - #[Route('/api/filter-address-by-case/{caseId}', name: 'ajax_filter_address_by_case')] - public function filterAddressByCase(string $caseId, Request $request): Response - { - $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); - $addresses = $this->entityManager->getRepository(Location::class)->getLocationsByCase($case); - - return $this->json($addresses); - } - - #[Route('/api/case/{caseId}/user/{userId}', name: 'ajax_case_user_level_check')] - public function checkUserCaseLevel(string $caseId, string $userId) : Response - { - $ret = true; - - $user = $this->entityManager->getRepository(User::class)->find($userId); - $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); - - $res = UserCase::checkLevel($user, $case); - - if (!$res) { - $ret = [ - 'userLevel' => ucwords(str_replace('_', ' ', strtolower($user->getLevel()->name))), - 'caseLevel' => ucwords(str_replace('_', ' ', strtolower($case->getLevel()->name))), - ]; - } - - return $this->json($ret); - } - - #[Route('/api/filter-cases-by-user', name: 'ajax_filter_cases_by_user')] - public function filterCasesByUser(Request $request): Response - { - /** @var User $user */ - $user = $this->entityManager->getRepository(User::class)->find($request->query->get('userId')); - /** @var UserCase[] $ucs */ - $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); - - $ret = []; - foreach ($ucs as $uc) { - $ret[] = $uc->getMemberCase(); - } - - return $this->json($ret); - } } diff --git a/src/Controller/CommunityResourceController.php b/src/Controller/CommunityResourceController.php index a756e04..2b94703 100644 --- a/src/Controller/CommunityResourceController.php +++ b/src/Controller/CommunityResourceController.php @@ -22,13 +22,6 @@ use Symfony\UX\Map\Point; class CommunityResourceController extends AbstractController { - /** - * Variable to store unread notification messages - * - * @var array - */ - private array $msgs; - public function __construct( private readonly EntityManagerInterface $entityManager, private array $navLinks = [] @@ -41,7 +34,6 @@ class CommunityResourceController extends AbstractController public function list(#[CurrentUser()] User $user): Response { $rsc = $this->entityManager->getRepository(CommunityResource::class)->findAll(); - $this->msgs = Libs::getMessages($user, $this->entityManager); return $this->render( 'internal/community_resource/list.html.twig', @@ -52,7 +44,7 @@ class CommunityResourceController extends AbstractController new Breadcrumb('#', 'Community Resources') ], 'resources' => $rsc, - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -61,8 +53,6 @@ class CommunityResourceController extends AbstractController #[Route('/resource/map', name: 'app_community_resource_map')] public function map(#[CurrentUser()] User $user): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - $rcs = $this->entityManager->getRepository(CommunityResource::class)->findAll(); $map = new Map('default'); @@ -94,7 +84,7 @@ class CommunityResourceController extends AbstractController new Breadcrumb($this->generateUrl('app_community_resource'), 'List Resources'), new Breadcrumb('#', 'Community Resources') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -103,8 +93,6 @@ class CommunityResourceController extends AbstractController #[Route('/resource/add', name: 'app_community_resource_add')] public function add(#[CurrentUser()] User $user, Request $request): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - $form = $this->createForm(ResourceFormType::class); $form->handleRequest($request); @@ -142,7 +130,7 @@ class CommunityResourceController extends AbstractController new Breadcrumb($this->generateUrl('app_community_resource'), 'List Resources'), new Breadcrumb('#', 'Add Resource') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -152,8 +140,6 @@ class CommunityResourceController extends AbstractController #[Route('/resource/edit/{id}', name: 'app_community_resource_edit')] public function edit(string $id, #[CurrentUser()] User $user, Request $request): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - $rsc = $this->entityManager->getRepository(CommunityResource::class)->find($id); $form = $this->createForm(ResourceFormType::class, $rsc); @@ -189,7 +175,7 @@ class CommunityResourceController extends AbstractController new Breadcrumb($this->generateUrl('app_community_resource'), 'List Resources'), new Breadcrumb('#', 'Edit Resource') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -217,13 +203,4 @@ class CommunityResourceController extends AbstractController 'Content-Transfer-Encoding' => 'binary' ]); } - - #[Route('/api/filter-resource-by-county', name: 'app_api_filter_resource_by_county')] - public function filterResourceByCounty(Request $request): Response - { - $data = json_decode($request->getContent(), true); - $county = $data['county']; - $resources = $this->entityManager->getRepository(CommunityResource::class)->findBy(['county' => $county]); - return $this->json($resources); - } } diff --git a/src/Controller/CompanyController.php b/src/Controller/CompanyController.php index 508440f..c5221a8 100644 --- a/src/Controller/CompanyController.php +++ b/src/Controller/CompanyController.php @@ -24,8 +24,6 @@ use Symfony\Component\String\Slugger\SluggerInterface; #[IsGranted('ROLE_ADMIN')] class CompanyController extends AbstractController { - private array $msgs; - public function __construct( private EntityManagerInterface $entityManager, private array $navLinks = [] @@ -40,7 +38,6 @@ class CompanyController extends AbstractController SluggerInterface $slugger ): Response { $this->navLinks['company_nav'] = NavList::PRESENT_LINK; - $this->msgs = Libs::getMessages($user, $this->entityManager); $company = $user->getCompany(); $form = $this->createForm(InternalCompanyFormType::class, $company); @@ -78,7 +75,7 @@ class CompanyController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_admin_dashboard'), "Admin Dashboard"), ], - 'msgs' => $this->msgs, + 'msgs' => Libs::getMessages($user, $this->entityManager), ] ) ); @@ -89,7 +86,6 @@ class CompanyController extends AbstractController { $this->navLinks['company_nav'] = NavList::PRESENT_LINK; - $this->msgs = Libs::getMessages($user, $this->entityManager); $companyDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $user->getCompany()], ['title' => 'ASC']); return $this->render( @@ -98,7 +94,7 @@ class CompanyController extends AbstractController $this->navLinks, [ 'breadcrumbs' => [], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'docs' => $companyDocs, ] ) @@ -109,7 +105,6 @@ class CompanyController extends AbstractController public function addCompanyDocument(Request $request, #[CurrentUser()] User $user): Response { $this->navLinks['company_nav'] = NavList::PRESENT_LINK; - $this->msgs = Libs::getMessages($user, $this->entityManager); $form = $this->createForm(CompanyDocumentFormType::class); @@ -134,7 +129,7 @@ class CompanyController extends AbstractController $this->navLinks, [ 'breadcrumbs' => [], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'form' => $form, ] ) @@ -147,8 +142,7 @@ class CompanyController extends AbstractController $companyDoc = $this->entityManager->getRepository(CompanyDocument::class)->find($docId); $this->navLinks['company_nav'] = NavList::PRESENT_LINK; - $this->msgs = Libs::getMessages($user, $this->entityManager); - + checkdate(1, 1, 1); $form = $this->createForm(CompanyDocumentFormType::class, $companyDoc); $form->handleRequest($request); @@ -171,7 +165,7 @@ class CompanyController extends AbstractController $this->navLinks, [ 'breadcrumbs' => [], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'form' => $form, 'doc' => $companyDoc, 'docText' => str_replace("\r\n", "", $companyDoc->getText()) diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index ac157da..0755220 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -2,18 +2,23 @@ namespace App\Controller; -use App\Entity\Messages; +use App\Entity\CaseItinerary; use App\Entity\User; use App\Libs\Breadcrumb; +use App\Libs\Libs; use App\Libs\NavList; +use DateInterval; use DateTime; +use DateTimeZone; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TelType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\Request; @@ -22,19 +27,9 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Http\Attribute\CurrentUser; use Symfony\Component\String\Slugger\SluggerInterface; -use Vich\UploaderBundle\Entity\File; class DefaultController extends AbstractController { - /** - * Variable to store unread notification messages - * - * @var array - */ - private array $msgs; - - private int $notificationCount = 0; - public function __construct( private readonly EntityManagerInterface $entityManager, private readonly UserPasswordHasherInterface $userPasswordHasher, @@ -47,13 +42,61 @@ class DefaultController extends AbstractController public function dashboard(Request $request, #[CurrentUser()] ?User $user): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); - $this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); - + if (!$user->getCompany()) { return $this->redirectToRoute('app_register_step', ['step' => RegistrationController::REGISTER_STEP_TWO]); } + $ytdtravel = $this->entityManager->getRepository(CaseItinerary::class)->getYTDTravel($user); + $last30days = $this->entityManager->getRepository(CaseItinerary::class)->getTravelLast30Days($user); + $ytdMiles = 0; + $milesTravelled30Days = 0; + $caseMileageYTD = 0; + $caseMileage30Days = 0; + $totalTimeTravelledYTD = new DateInterval('PT0S'); + $totalTimeTravelled30Days = new DateInterval('PT0S'); + + if ($ytdtravel) { + $timeTravelled = new DateTime('00:00:00'); + $timeTravelYTDStart = new DateTime('00:00:00'); + foreach ($ytdtravel as $travel) { + /** @var CaseItinerary $travel */ + $ytdMiles += $travel->getDistance(); + $timeTravelled->add($travel->getDuration()); + + if ($travel->isCaseMileage()) { + $caseMileageYTD += $travel->getDistance(); + } + } + + $totalTimeTravelledYTD = $timeTravelled->diff($timeTravelYTDStart); + } + + if ($last30days) { + $timeTravelled30Days = new DateTime('00:00:00'); + $timeTravel30DaysStart = new DateTime('00:00:00'); + foreach ($last30days as $travel) { + /** @var CaseItinerary $travel */ + $milesTravelled30Days += $travel->getDistance(); + $timeTravelled30Days->add($travel->getDuration()); + + if ($travel->isCaseMileage()) { + $caseMileage30Days += $travel->getDistance(); + } + } + + $totalTimeTravelled30Days = $timeTravelled30Days->diff($timeTravel30DaysStart); + } + + $activeCases = 0; + $totalCases = 0; + foreach ($user->getUserCases() as $uc) { + $totalCases++; + if (!$uc->getMemberCase()->getCloseDate()) { + $activeCases++; + } + } + $this->navLinks['user_dashboard'] = NavList::PRESENT_LINK; return $this->render( @@ -64,10 +107,15 @@ class DefaultController extends AbstractController 'breadcrumbs' => [ new Breadcrumb('', 'Dashboard') ], - 'notifications' => $this->msgs, - 'notificationCount' => $this->notificationCount, - 'milesTravelledYTD' => 0, - 'milesTravelled30Days' => 0, + 'notifications' => Libs::getMessages($user, $this->entityManager), + 'milesTravelledYTD' => $ytdMiles, + 'milesTravelled30Days' => $milesTravelled30Days, + 'totalTimeTravelledYTD' => $totalTimeTravelledYTD, + 'totalTimeTravelled30Days' => $totalTimeTravelled30Days, + 'activeCases' => $activeCases, + 'totalCases' => $totalCases, + 'caseMileageYTD' => $caseMileageYTD, + 'caseMileage30Days' => $caseMileage30Days, ] ) ); @@ -80,9 +128,7 @@ class DefaultController extends AbstractController SluggerInterface $slugger ): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY'); - $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); - $this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); - + $this->navLinks['profile'] = NavList::PRESENT_LINK; $form = $this->createFormBuilder($user) @@ -104,11 +150,18 @@ class DefaultController extends AbstractController 'first_options' => ['label' => 'Password', 'label_attr' => ['class' => 'form-label']], 'second_options' => ['label' => 'Repeat Password', 'label_attr' => ['class' => 'form-label']], ]) + ->add('personalPhone', TelType::class, [ + 'label' => 'Personal Phone', + ]) + ->add('workPhone', TelType::class, [ + 'label' => 'Work Phone', + ]) ->add('imageName', FileType::class, [ 'label' => 'Profile Picture', 'required' => false, 'mapped' => false ]) + ->add('signature', HiddenType::class) ->add('submit', SubmitType::class, [ 'label' => 'Save Profile', 'attr' => ['class' => 'btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0'] @@ -119,6 +172,11 @@ class DefaultController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + if ($form->get('signature')->getData()) { + $signature = $form->get('signature')->getData(); + $user->setSignature($signature); + } + $firstPassword = $form->get('password')['first']->getData(); $secondPassword = $form->get('password')['second']->getData(); @@ -136,7 +194,7 @@ class DefaultController extends AbstractController $plainPassword ) ); - $user->setPasswordChanged(new DateTime()) + $user->setPasswordChanged(new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))); } if ($form['imageName']->getData()) { @@ -158,6 +216,16 @@ class DefaultController extends AbstractController $user->setImageName($newFilename); } + if ($form['personalPhone']->getData()) { + $phone = Libs::Phone($form['personalPhone']->getData()); + $user->setPersonalPhone($phone); + } + + if ($form['workPhone']->getData()) { + $phone = Libs::Phone($form['workPhone']->getData()); + $user->setWorkPhone($phone); + } + $this->entityManager->persist($user); $this->entityManager->flush(); @@ -174,18 +242,25 @@ class DefaultController extends AbstractController 'breadcrumbs' => [ new Breadcrumb('', 'Profile') ], - 'notifications' => $this->msgs, - 'notificationCount' => $this->notificationCount, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'currentUser' => $user, + 'signaturePresent' => ($user->getSignature() ? true : false), + 'signature' => $user->getSignature(), 'form' => $form->createView(), ] ) ); } - #[Route('/uploads/user_images/{imageName}', name: 'app_user_image')] + #[Route('/uploads/user_images/{imageName}', name: 'app_user_profile_image')] public function displayUserImage(string $imageName): Response { - return new BinaryFileResponse($this->getParameter('kernel.project_dir')."/public/uploads/user_images/{$imageName}"); + return new BinaryFileResponse("{$this->getParameter('kernel.project_dir')}/public/{$_ENV['USER_IMAGE_PATH']}/{$imageName}"); + } + + #[Route('/uploads/company_images/{companyLogo}', name: 'app_company_logo')] + public function displayCompanyLogo(string $companyLogo): Response + { + return new BinaryFileResponse("{$this->getParameter('kernel.project_dir')}/public/{$_ENV['COMPANY_IMAGE_PATH']}/{$companyLogo}"); } } diff --git a/src/Controller/DocumentController.php b/src/Controller/DocumentController.php index 8af1018..61a2d20 100644 --- a/src/Controller/DocumentController.php +++ b/src/Controller/DocumentController.php @@ -2,11 +2,14 @@ namespace App\Controller; +use App\Entity\CaseDocument; +use App\Entity\CompanyDocument; +use App\Entity\MemberCase; +use App\Entity\User; use App\Libs\NavList; use App\Libs\Libs; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Attribute\CurrentUser; @@ -23,8 +26,6 @@ class DocumentController extends AbstractController #[Route('/case/{caseId}/doc/{docId}', name: 'app_display_case_doc')] public function displayCaseDocument(string $caseId, string $docId, #[CurrentUser()] User $user): Response { - $msgs = Libs::getMessages($user, $this->entityManager); - $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); @@ -34,8 +35,7 @@ class DocumentController extends AbstractController array_merge( $this->navLinks, [ - 'msgs' => $msgs, - 'notificationCount' => count($msgs), + 'msgs' => Libs::getMessages($user, $this->entityManager), 'breadcrumbs' => [] ] ) diff --git a/src/Controller/ItineraryController.php b/src/Controller/ItineraryController.php index 818b8fa..6b0a3df 100644 --- a/src/Controller/ItineraryController.php +++ b/src/Controller/ItineraryController.php @@ -6,7 +6,6 @@ use App\Entity\CaseItinerary; use App\Entity\CaseLocation; use App\Entity\Location; use App\Entity\MemberCase; -use App\Entity\Messages; use App\Entity\User; use App\Entity\UserCase; use App\Libs\Breadcrumb; @@ -29,8 +28,6 @@ use Symfony\UX\Map\Polyline; class ItineraryController extends AbstractController { - private array $msgs = []; - public function __construct( private EntityManagerInterface $entityManager, private array $navLinks = [] @@ -43,8 +40,6 @@ class ItineraryController extends AbstractController { $this->navLinks['case_itinerary'] = NavList::PRESENT_LINK; - $this->msgs = Libs::getMessages($user, $this->entityManager); - $itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel( $user ); @@ -64,7 +59,7 @@ class ItineraryController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_dashboard'), 'Dashboard'), ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'itineraries' => $itineraries, 'cases' => $cases ] @@ -93,8 +88,6 @@ class ItineraryController extends AbstractController new DateTime($request->getPayload()->get('endDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE'])) : null); - - $this->msgs = Libs::getMessages($user, $this->entityManager); $itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel($user, [ 'case' => $case, @@ -160,7 +153,7 @@ class ItineraryController extends AbstractController new Breadcrumb($this->generateUrl('app_my_cases'), 'My Cases'), new Breadcrumb($this->generateUrl('app_report_itinerary'), 'Itinerary Report'), ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'map' => $map, 'total_distance' => $total_distance, 'total_duration' => $di->format("%H:%i'%s''"), @@ -168,105 +161,4 @@ class ItineraryController extends AbstractController ) ); } - - #[Route('/api/get-case-locations/{caseId}', name: 'get_case_locations')] - public function createItinerary(string $caseId): Response - { - $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); - $cls = $this->entityManager->getRepository(CaseLocation::class)->getCaseLocations($case); - - $locations = []; - foreach ($cls as $cl) { - /** @var CaseLocation $cl */ - $locations[] = $cl->getLocation(); - } - - return $this->json($locations); - } - - #[Route('/api/add-location-to-itinerary', name: 'add_location_to_itinerary')] - public function addLocationToItinerary(Request $request, Session $session): Response - { - $case = $this->entityManager->getRepository(MemberCase::class)->find($request->getPayload()->get('caseId')); - $origin = $this->entityManager->getRepository(Location::class)->find($request->getPayload()->get('origin')); - $destination = $this->entityManager->getRepository(Location::class)->find($request->getPayload()->get('destination')); - $departure = $request->getPayload()->get('departure'); - $arrival = $request->getPayload()->get('arrival'); - $caseMileage = (bool) $request->getPayload()->get('caseMileage'); - $date = new DateTime($request->getPayload()->get('date'), new DateTimeZone($_ENV['COMPANY_TIMEZONE'])); - - $route = Libs::getRouteDistance($origin, $destination); - - if (!$route) { - return $this->json(['success' => false, 'message' => 'No route found']); - } - - $ci = new CaseItinerary(); - $ci->setMemberCase($case) - ->setDate($date) - ->setCaseMileage($caseMileage) - ->setOriginLocation($origin) - ->setDestLocation($destination) - ->setDeparture(new \DateTimeImmutable($departure)) - ->setArrival(new \DateTimeImmutable($arrival)) - ->setDistance($route->getDistance()) - ->setDuration($route->getDuration()) - ->setGpsRoute($route->getGeometry()) - ; - - $this->entityManager->persist($ci); - $this->entityManager->flush(); - - $session->getFlashBag()->add( - 'success', - 'Location added to itinerary' - ); - return $this->json(['success' => true, 'message' => 'Location added to itinerary']); - } - - #[Route('/api/filter-itinerary-by-case', name: 'ajax_filter_itinerary_by_case')] - public function filterItineraryByCase(Request $request, #[CurrentUser()] ?User $user): Response - { - $case = null; - $startDate = null; - $endDate = null; - - //dd($request->getPayload()); - - if ($request->getPayload()->get('caseId')) { - $caseId = $request->getPayload()->get('caseId'); - $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); - } - - if ($request->getPayload()->get('startDate')) { - $startDate = new DateTime($request->getPayload()->get('startDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE'])); - } - - if ($request->getPayload()->get('endDate')) { - $endDate = new DateTime($request->getPayload()->get('endDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE'])); - } - - $itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel($user, [ - 'case' => $case, - 'from' => $startDate, - 'to' => $endDate, - ]); - - $ret = []; - - foreach ($itineraries as $itinerary) { - /** @var CaseItinerary $itinerary */ - $ret[] = [ - 'id' => $itinerary->getId()->toString(), - 'date' => $itinerary->getDate()->format('F j, Y'), - 'origin' => $itinerary->getOriginLocation(), - 'destination' => $itinerary->getDestLocation(), - 'distance' => $itinerary->getDistance(), - 'duration' => $itinerary->getDuration()->format("%h:%i'%s''"), - 'case' => $itinerary->getMemberCase()->getCaseName(), - ]; - } - - return $this->json($ret); - } } diff --git a/src/Controller/MemberController.php b/src/Controller/MemberController.php index 1b5d0dd..6bf034f 100644 --- a/src/Controller/MemberController.php +++ b/src/Controller/MemberController.php @@ -19,13 +19,6 @@ use Symfony\Component\Security\Http\Attribute\CurrentUser; class MemberController extends AbstractController { - /** - * Variable to store unread notification messages - * - * @var array - */ - private array $msgs; - public function __construct( private EntityManagerInterface $entityManager, private array $navLinks = [], @@ -37,8 +30,6 @@ class MemberController extends AbstractController #[Route('/list-members/{id}', name: 'app_case_members')] public function listMembers(Request $request, #[CurrentUser()] User $user, string $id): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - $case = $this->entityManager->getRepository(MemberCase::class)->find($id); $members = $this->entityManager->getRepository(Member::class)->getCaseMembersByName($case); @@ -51,7 +42,7 @@ class MemberController extends AbstractController new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), new Breadcrumb($this->generateUrl('app_case_members', ['id' => $id]), 'List Members'), ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'case' => $case, 'members' => $members, ] @@ -62,8 +53,6 @@ class MemberController extends AbstractController #[Route('/add-member/{id}', name: 'app_case_add_member')] public function addMember(Request $request, #[CurrentUser()] User $user, string $id): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - /** @var MemberCase $case */ $case = $this->entityManager->getRepository(MemberCase::class)->find($id); @@ -123,7 +112,7 @@ class MemberController extends AbstractController new Breadcrumb($this->generateUrl('app_case_members', ['id' => $id]), 'List Members'), new Breadcrumb($this->generateUrl('app_case_add_member', ['id' => $id]), 'Add Member'), ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'case' => $case, 'form' => $form->createView(), ] @@ -134,8 +123,6 @@ class MemberController extends AbstractController #[Route('/case/{caseId}/edit-member/{memberId}', name: 'app_case_edit_member')] public function editMember(Request $request, #[CurrentUser()] User $user, string $caseId, string $memberId): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - $member = $this->entityManager->getRepository(Member::class)->find($memberId); $form = $this->createForm(MemberFormType::class, $member); @@ -190,7 +177,7 @@ class MemberController extends AbstractController new Breadcrumb($this->generateUrl('app_case_members', ['id' => $caseId]), 'List Members'), new Breadcrumb($this->generateUrl('app_case_edit_member', ['caseId' => $caseId, 'memberId' => $memberId]), 'Edit Member'), ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'member' => $member, 'form' => $form->createView(), 'caseId' => $caseId, diff --git a/src/Controller/MessageController.php b/src/Controller/MessageController.php index dbaade8..1d32a3f 100644 --- a/src/Controller/MessageController.php +++ b/src/Controller/MessageController.php @@ -49,8 +49,6 @@ class MessageController extends AbstractController $message->setMessage($data['message']); $message->setType(MessageType::GENERAL); - //dd($message); - $this->entityManager->persist($message); $this->entityManager->flush(); diff --git a/src/Controller/NoteController.php b/src/Controller/NoteController.php index 4d4811c..317ff26 100644 --- a/src/Controller/NoteController.php +++ b/src/Controller/NoteController.php @@ -4,7 +4,6 @@ namespace App\Controller; use App\Entity\Member; use App\Entity\MemberCase; -use App\Entity\Messages; use App\Entity\Referral; use App\Entity\StandardNote; use App\Entity\StandardNoteMember; @@ -31,13 +30,6 @@ use Symfony\Component\Security\Http\Attribute\CurrentUser; class NoteController extends AbstractController { - /** - * Variable to store unread notification messages - * - * @var array - */ - private array $msgs; - public function __construct( private EntityManagerInterface $entityManager, private array $navLinks = [], @@ -49,8 +41,6 @@ class NoteController extends AbstractController #[Route('/list-notes/{caseId?null}', name: 'app_list_notes')] public function listNotes(string $caseId = null, #[CurrentUser()] User $user, Request $request): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - /** @var UserCase[] $cases */ $cases = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $caseNotes = null; @@ -78,7 +68,7 @@ class NoteController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_list_notes'), 'List Notes') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'cases' => $cases, 'caseNotes' => $caseNotes, 'case' => $case, @@ -93,7 +83,6 @@ class NoteController extends AbstractController /** @var Referral $referral */ $referral = $this->entityManager->getRepository(Referral::class)->find($referralId); $this->entityManager->getRepository(Referral::class)->populateNotes($referral); - $this->msgs = Libs::getMessages($user, $this->entityManager); $members = $this->entityManager->getRepository(Member::class)->findBy(['caseId' => $referral->getMemberCase()]); $defaultMethod = NoteMethod::BILLABLE; @@ -135,7 +124,7 @@ class NoteController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_list_notes'), 'List Notes') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'referral' => $referral, 'form' => $form, 'default_method' => $defaultMethod, @@ -148,8 +137,6 @@ class NoteController extends AbstractController #[Route('/edit-note/{noteType}/{noteId}', name: 'app_edit_note')] public function editNote(string $noteId, string $noteType, #[CurrentUser()] User $user, Request $request): Response { - $this->msgs = Libs::getMessages($user, $this->entityManager); - $form = null; /** @var VisitNote|StandardNote $note */ @@ -171,7 +158,7 @@ class NoteController extends AbstractController 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_list_notes'), 'List Notes') ], - 'notifications' => $this->msgs, + 'notifications' => Libs::getMessages($user, $this->entityManager), 'note' => $note, 'referral' => $note->getReferral(), 'form' => $form, @@ -180,58 +167,4 @@ class NoteController extends AbstractController ) ); } - - #[Route('/api/filter-notes', name: 'api_filter_notes')] - public function filterNotes(#[CurrentUser()] User $user, Request $request): Response - { - $startDate = null; - $endDate = null; - $referral = null; - $case = null; - - if ($request->getPayload()->get('startDate')) { - $startDate = new DateTime($request->getPayload()->get('startDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE'])); - } - - if ($request->getPayload()->get('endDate')) { - $endDate = new DateTime($request->getPayload()->get('endDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE'])); - } - - if ($request->getPayload()->get('referral')) { - $referral = $this->entityManager->getRepository(Referral::class)->find($request->getPayload()->get('referral')); - } - - if ($request->getPayload()->get('case')) { - $case = $this->entityManager->getRepository(MemberCase::class)->find($request->getPayload()->get('case')); - } - - $params = [ - 'startDate' => $startDate, - 'endDate' => $endDate, - 'referral' => $referral, - 'case' => $case, - ]; - - $notes = array_merge( - $this->entityManager->getRepository(VisitNote::class)->filterNotes($user, $params), - $this->entityManager->getRepository(StandardNote::class)->filterNotes($user, $params), - ); - - foreach ($notes as $idx => $note) { - /** @var VisitNote|StandardNote $note */ - - /** @var VisitNoteMember[]|StandardNoteMember[] $members */ - if ($note instanceof VisitNote) { - $members = $this->entityManager->getRepository(VisitNoteMembers::class)->findBy(['note' => $note]); - } elseif ($note instanceof StandardNote) { - $members = $this->entityManager->getRepository(StandardNoteMember::class)->findBy(['note' => $note]); - } else { - continue; - } - - $notes[$idx]->setMembers($members); - } - - return new Response(json_encode($notes, 0, 3)); - } } diff --git a/templates/internal/admin/cases/list-cases.html.twig b/templates/internal/admin/cases/list-cases.html.twig index 65eab61..4ce0e59 100644 --- a/templates/internal/admin/cases/list-cases.html.twig +++ b/templates/internal/admin/cases/list-cases.html.twig @@ -99,7 +99,7 @@ group_add - + clinical_notes diff --git a/templates/internal/dashboard.html.twig b/templates/internal/dashboard.html.twig index 4ca0071..2cbb8e6 100644 --- a/templates/internal/dashboard.html.twig +++ b/templates/internal/dashboard.html.twig @@ -8,5 +8,137 @@
{{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+
+
+

Dashboard

+
+ +
+
+
+
+
+

Miles Travelled

+

+ {{ milesTravelled30Days }} + mi / + {{ milesTravelledYTD }} + mi +

+
+
+ weekend +
+
+
+
+ +
+
+
+
+
+
+
+

Time Travelled

+

+ {{ totalTimeTravelled30Days|date("%d:%H:%i'%s''") }} + / + {{ totalTimeTravelledYTD|date("%d:%H:%i'%s''") }} +

+
+
+ weekend +
+
+
+
+ +
+
+
+
+
+
+
+

Case Mileage

+

+ {{ caseMileage30Days }} / {{ caseMileageYTD }} +

+
+
+ weekend +
+
+
+
+ +
+
+
+
+
+
+
+

Miles Travelled

+

+
+
+ weekend +
+
+
+
+ +
+
+
+ +
+
+
+
+
Website Views
+

Last Campaign Performance

+
+
+ +
+
+
+
+ schedule +

+ campaign sent 2 days ago +

+
+
+
+
+
+
{% endblock %} diff --git a/templates/internal/libs/nav.html.twig b/templates/internal/libs/nav.html.twig index 88a5e61..13d304c 100644 --- a/templates/internal/libs/nav.html.twig +++ b/templates/internal/libs/nav.html.twig @@ -4,7 +4,7 @@ {% if app.user.company.companyLogo %} - main_logo + main_logo {% else %} main_logo {% endif %} diff --git a/templates/internal/libs/top-nav.html.twig b/templates/internal/libs/top-nav.html.twig index ebe1db4..2642f98 100644 --- a/templates/internal/libs/top-nav.html.twig +++ b/templates/internal/libs/top-nav.html.twig @@ -15,8 +15,8 @@
- - + +