Compare commits

..

26 Commits

Author SHA1 Message Date
458ba42644 couple updates 2025-01-10 15:09:44 +00:00
6687dc1401 add signature_pad and tinymce libraries 2025-01-10 15:09:01 +00:00
dc3fec7eff add company logo to form 2025-01-10 15:08:31 +00:00
acee114ccf add link to company documents if in company editor and replace links with path calls to route name 2025-01-10 15:07:59 +00:00
5f0ce69a47 remove notifcationCount variable and limit displayed notifications to 5 2025-01-10 15:06:03 +00:00
d2f8bc7cbf use company logo if available and add link to company data 2025-01-10 15:05:22 +00:00
b7b0c8e6c4 add block for assigning documents to a case, use company timezone, update anchor tag class 2025-01-10 15:03:53 +00:00
722954d0d0 remove message returning limit 2025-01-10 14:56:08 +00:00
57e002916c fix error 2025-01-10 14:55:43 +00:00
178f44fd2d add methods to get travel info 2025-01-10 14:55:14 +00:00
7b4da30342 add default const to simplify setting and resetting the list 2025-01-10 14:54:22 +00:00
03cbbc0db6 add formatPhone and getMessages methods. Also, add method to autocomplete addresses 2025-01-10 14:53:33 +00:00
f454888a6f add company form for updating the company 2025-01-10 14:51:44 +00:00
dce5dcab2f add document controller for document actions 2025-01-10 14:50:03 +00:00
75cffad2ea add company controller for company actions 2025-01-10 14:49:08 +00:00
cd8cbcf6ba add documentextras enum for documntation creation 2025-01-10 14:47:55 +00:00
6956256341 add signature block 2025-01-10 14:47:17 +00:00
42fcb7b2f5 add company logo 2025-01-10 14:46:35 +00:00
351cc7c3ac add infowindow method for mapping, convert datetime creation to use company timezone 2025-01-10 14:46:19 +00:00
e1e4c12801 add InfoWindow data methods for mapping 2025-01-10 14:44:59 +00:00
6260b13df0 convert datetime to use company timezone 2025-01-10 14:39:31 +00:00
02fcb0cc54 remove notificationCount, convert to use Libs::getMessages method, change datetime creation to use company timezone 2025-01-10 13:33:33 +00:00
2d7b7e6d12 remove notificationCount, convert to Libs::getMessages method, change datetime creation to add company timezone, remove CaseController::showCaseNotes 2025-01-10 12:44:37 +00:00
604f693c45 add company timezone 2025-01-10 12:37:16 +00:00
be80563038 add css to remove underlines in anchor tags 2025-01-10 12:36:14 +00:00
04d5e88820 javascript for various functions 2025-01-10 12:34:49 +00:00
60 changed files with 1364 additions and 306 deletions

View File

@ -19,7 +19,7 @@ export function filterAddressesByCase() {
addressList.innerHTML = ''; addressList.innerHTML = '';
origin.innerHTML += '<option value="">-- Origin --</option>'; origin.innerHTML += '<option value="">-- Origin --</option>';
destination.innerHTML += '<option value="0">-- Destination --</option>'; destination.innerHTML += '<option value="">-- Destination --</option>';
result.forEach(a => { result.forEach(a => {
origin.innerHTML += `<option value='${a.id}'>${a.name}</option>`; origin.innerHTML += `<option value='${a.id}'>${a.name}</option>`;
@ -38,7 +38,7 @@ export function filterAddressesByCase() {
<td>${a.formattedAddress}</td> <td>${a.formattedAddress}</td>
<td class='align-middle text-center text-xs'>${a.lat}/${a.lon}</td> <td class='align-middle text-center text-xs'>${a.lat}/${a.lon}</td>
<td class='align-middle'> <td class='align-middle'>
<a href='/index.php/addresses/edit/${a.id}' title='Edit Address'> <a href='/addresses/edit/${a.id}' class='text-secondary' title='Edit Address'>
<i class='material-symbols-rounded opacity-5'>edit</i> <i class='material-symbols-rounded opacity-5'>edit</i>
</a> </a>
</td> </td>
@ -51,7 +51,7 @@ export function filterItineraryByCase() {
let caseId = null; let caseId = null;
let startDate = null; let startDate = null;
let endDate = null; let endDate = null;
if (document.getElementById('case-filter').value) { if (document.getElementById('case-filter').value) {
caseId = document.getElementById('case-filter').value; caseId = document.getElementById('case-filter').value;
} }
@ -79,7 +79,6 @@ export function filterItineraryByCase() {
.then(result => { .then(result => {
const itineraryList = document.getElementById('itineraryList'); const itineraryList = document.getElementById('itineraryList');
itineraryList.innerHTML = ''; itineraryList.innerHTML = '';
console.log(result);
result.forEach(i => { result.forEach(i => {
itineraryList.innerHTML += ` itineraryList.innerHTML += `

View File

@ -21,19 +21,19 @@ export function addLocationToItinerary() {
let caseMileage = document.getElementById('case-mileage').checked; let caseMileage = document.getElementById('case-mileage').checked;
let caseId = document.getElementById('case-filter').value; let caseId = document.getElementById('case-filter').value;
fetch('/index.php/api/add-location-to-itinerary', { fetch('/api/add-location-to-itinerary', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
caseId: caseId,
date: date, date: date,
origin: origin, origin: origin,
destination: destination, destination: destination,
departure: departure, departure: departure,
arrival: arrival, arrival: arrival,
caseMileage: caseMileage, caseMileage: caseMileage
caseId: caseId
}) })
}) })
.then(response => response.json()) .then(response => response.json())

32
assets/js/app/message.js Normal file
View File

@ -0,0 +1,32 @@
export function messageSupervisor() {
let btn = document.getElementById('message-supervisor');
btn.setAttribute('data-bs-toggle', 'modal');
btn.setAttribute('data-bs-target', '#message-modal');
btn.click();
}
export function openMessage() {
let btn = document.getElementById('open-message');
btn.setAttribute('data-bs-toggle', 'modal');
btn.setAttribute('data-bs-target', '#message-modal');
btn.click();
}
export function sendMessage() {
fetch('/api/send-message', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
case: document.getElementById('my-cases').value,
message: document.getElementById('message').value
})
})
.then(response => response.json())
.then(data => {
if (data.success === true) {
$('#close-modal').click();
}
});
}

46
assets/js/app/notes.js Normal file
View File

@ -0,0 +1,46 @@
export function filterNotes()
{
let referralId = document.getElementById('referralList').value;
let startDate = document.getElementById('startDate').value;
let endDate = document.getElementById('endDate').value;
let caseId = null;
if (referralId.substr(0, 5) == 'case-') {
caseId = referralId.substr(5);
referralId = null;
}
fetch('/api/filter-notes', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'referral': referralId,
'startDate': startDate,
'endDate': endDate,
'case': caseId
})
})
.then(response => response.json())
.then(data => {
const noteList = document.getElementById('note-list');
noteList.innerHTML = '';
data.forEach(i => {
noteList.innerHTML += `
<tr>
<td>${i.date}<br/>
${i.startTime}-${i.endTime} (${i.duration})</td>
<td class='text-center'>${i.location}</td>
<td class='text-center'>${i.method}</td>
<td'>${i.members}</td>
<td style='text-align: right;'>
<a href='/edit-note/${i.noteType}/${i.id}' class='text-secondary' title='Edit Note'>
<i class="material-symbols-rounded opacity-5">edit</i>
</a>
</td>
</tr>`;
})
});
}

21
assets/js/app/user.js Normal file
View File

@ -0,0 +1,21 @@
export function createSignatureBlock() {
pad = new SignaturePad(document.getElementById('signature_pad'));
const ratio = Math.max(window.devicePixelRatio || 1, 1);
canvas.width = canvas.offsetWidth * ratio;
canvas.height = canvas.offsetHeight * ratio;
canvas.getContext("2d").scale(ratio, ratio);
//pad.clear(); // otherwise isEmpty() might return incorrect value
}
export function clearSignatureBlock() {
//const pad = new SignaturePad(document.getElementById('signature_pad'));
pad.clear();
}
export function saveSignatureBlock() {
//const pad = new SignaturePad(document.getElementById('signature_pad'));
const data = pad.toData();
document.getElementById('signature').value = data;
return true;
}

View File

@ -7,4 +7,8 @@
background-color: red; background-color: red;
color: white; color: white;
font-size: 6pt; font-size: 6pt;
}
a {
text-decoration: none !important;
} }

View File

@ -2,6 +2,7 @@ twig:
file_name_pattern: '*.twig' file_name_pattern: '*.twig'
globals: globals:
mileage_rate: '%env(MILEAGE_RATE)%' mileage_rate: '%env(MILEAGE_RATE)%'
company_timezone: '%env(COMPANY_TIMEZONE)%'
when@test: when@test:
twig: twig:

View File

@ -82,4 +82,10 @@ return [
'chartjs' => [ 'chartjs' => [
'version' => '0.3.24', 'version' => '0.3.24',
], ],
'signature_pad' => [
'version' => '5.0.4',
],
'tinymce' => [
'version' => '7.6.0',
],
]; ];

View File

@ -2,17 +2,21 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\CompanyDocument;
use App\Entity\Messages; use App\Entity\Messages;
use App\Entity\Supervision; use App\Entity\Supervision;
use App\Entity\User; use App\Entity\User;
use App\Factory\MessageFactory; use App\Factory\MessageFactory;
use App\Form\CompanyDocumentFormType;
use App\Form\EditUserFormType; use App\Form\EditUserFormType;
use App\Form\SupervisorFormType; use App\Form\SupervisorFormType;
use App\Form\UserFormType; use App\Form\UserFormType;
use App\Libs\Breadcrumb; use App\Libs\Breadcrumb;
use App\Libs\NavList; use App\Libs\NavList;
use App\Libs\Libs;
use App\Repository\UserRepository; use App\Repository\UserRepository;
use DateTime; use DateTime;
use DateTimeZone;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -28,8 +32,6 @@ class AdminController extends AbstractController
{ {
private array $msgs; private array $msgs;
private int $notificationCount = 0;
public function __construct( public function __construct(
private readonly EntityManagerInterface $entityManager, private readonly EntityManagerInterface $entityManager,
private readonly UserPasswordHasherInterface $userPasswordHasher, private readonly UserPasswordHasherInterface $userPasswordHasher,
@ -43,8 +45,7 @@ class AdminController extends AbstractController
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->navLinks['admin_dashboard'] = NavList::PRESENT_LINK; $this->navLinks['admin_dashboard'] = NavList::PRESENT_LINK;
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
return $this->render( return $this->render(
'internal/admin/admin-dashboard.html.twig', 'internal/admin/admin-dashboard.html.twig',
@ -55,7 +56,6 @@ class AdminController extends AbstractController
new Breadcrumb($this->generateUrl('app_admin_dashboard'), 'Admin Dashboard') new Breadcrumb($this->generateUrl('app_admin_dashboard'), 'Admin Dashboard')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -65,8 +65,7 @@ class AdminController extends AbstractController
public function listUsers(#[CurrentUser()] User $user): Response public function listUsers(#[CurrentUser()] User $user): Response
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
/** @var UserRepository $repo */ /** @var UserRepository $repo */
$repo = $this->entityManager->getRepository(User::class); $repo = $this->entityManager->getRepository(User::class);
@ -91,7 +90,6 @@ class AdminController extends AbstractController
], ],
'users' => $users, 'users' => $users,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -104,8 +102,7 @@ class AdminController extends AbstractController
SluggerInterface $slugger SluggerInterface $slugger
): Response { ): Response {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $this->msgs = Libs::getMessages($admin, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($admin);
$user = new User(); $user = new User();
$form = $this->createForm(UserFormType::class, $user); $form = $this->createForm(UserFormType::class, $user);
@ -146,7 +143,7 @@ class AdminController extends AbstractController
->setRate($form->get('rate')->getData()) ->setRate($form->get('rate')->getData())
->setLevel($form->get('level')->getData()) ->setLevel($form->get('level')->getData())
->setCompany($admin->getCompany()) ->setCompany($admin->getCompany())
->setPasswordChanged(new DateTime()) ->setPasswordChanged(new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE'])))
; ;
if ($form->get('imageName')->getData()) { if ($form->get('imageName')->getData()) {
@ -187,7 +184,6 @@ class AdminController extends AbstractController
], ],
'form' => $form, 'form' => $form,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -198,8 +194,7 @@ class AdminController extends AbstractController
{ {
/** @var UserRepository $userRepo */ /** @var UserRepository $userRepo */
$userRepo = $this->entityManager->getRepository(User::class); $userRepo = $this->entityManager->getRepository(User::class);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $this->msgs = Libs::getMessages($admin, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($admin);
/** @var User $user */ /** @var User $user */
$user = $userRepo->find($id); $user = $userRepo->find($id);
@ -237,7 +232,6 @@ class AdminController extends AbstractController
'data' => $user, 'data' => $user,
'form' => $form, 'form' => $form,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -248,8 +242,7 @@ class AdminController extends AbstractController
{ {
/** @var UserRepository $userRepo */ /** @var UserRepository $userRepo */
$userRepo = $this->entityManager->getRepository(User::class); $userRepo = $this->entityManager->getRepository(User::class);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $this->msgs = Libs::getMessages($admin, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($admin);
/** @var User $user */ /** @var User $user */
$user = $userRepo->find($id); $user = $userRepo->find($id);
@ -294,7 +287,6 @@ class AdminController extends AbstractController
'form' => $form, 'form' => $form,
'supervisors' => $userRepo->getCaseManagers($admin->getCompany()), 'supervisors' => $userRepo->getCaseManagers($admin->getCompany()),
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );

View File

@ -2,14 +2,18 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\CaseDocument;
use App\Entity\CaseLocation; use App\Entity\CaseLocation;
use App\Entity\CompanyDocument;
use App\Entity\Location; use App\Entity\Location;
use App\Entity\Member;
use App\Entity\MemberCase; use App\Entity\MemberCase;
use App\Entity\Messages; use App\Entity\Messages;
use App\Entity\ReferralSource; use App\Entity\ReferralSource;
use App\Entity\User; use App\Entity\User;
use App\Entity\UserCase; use App\Entity\UserCase;
use App\Factory\MessageFactory; use App\Factory\MessageFactory;
use App\Form\CaseDocumentFormType;
use App\Form\LocationFormType; use App\Form\LocationFormType;
use App\Form\MemberCaseFormType; use App\Form\MemberCaseFormType;
use App\Form\UserCaseFormType; use App\Form\UserCaseFormType;
@ -32,8 +36,6 @@ class CaseController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private array $navLinks = [] private array $navLinks = []
@ -49,9 +51,8 @@ class CaseController extends AbstractController
$this->navLinks['case_list'] = 'nav-link text-dark'; $this->navLinks['case_list'] = 'nav-link text-dark';
$ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$cases = []; $cases = [];
foreach ($ucs as $uc) { foreach ($ucs as $uc) {
/** @var UserCase $uc */ /** @var UserCase $uc */
@ -72,7 +73,6 @@ class CaseController extends AbstractController
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'cases' => $cases, 'cases' => $cases,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -85,8 +85,7 @@ class CaseController extends AbstractController
$cases = $this->entityManager->getRepository(MemberCase::class)->findAll(); $cases = $this->entityManager->getRepository(MemberCase::class)->findAll();
$workers = $this->entityManager->getRepository(User::class)->getCaseWorkers(); $workers = $this->entityManager->getRepository(User::class)->getCaseWorkers();
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
return $this->render( return $this->render(
'internal/admin/cases/list-cases.html.twig', 'internal/admin/cases/list-cases.html.twig',
@ -99,24 +98,24 @@ class CaseController extends AbstractController
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'cases' => $cases, 'cases' => $cases,
'workers' => $workers, 'workers' => $workers,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
} }
#[Route('/case/{caseId}', name: 'app_view_case')] #[Route('/case/{caseId}', name: 'app_view_case')]
public function showCase(Request $request, string $caseId): Response public function showCase(Request $request, #[CurrentUser()] User $user, string $caseId): Response
{ {
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId);
$caseDocs = $this->entityManager->getRepository(CaseDocument::class)->getDocumentsByCase($case);
$compDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $user->getCompany()]);
$sources = $this->entityManager->getRepository(ReferralSource::class)->findAll(); $sources = $this->entityManager->getRepository(ReferralSource::class)->findAll();
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser()); $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser());
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($this->getUser());
return $this->render( return $this->render(
'internal/cases/view-case.html.twig', 'internal/cases/view-case.html.twig',
@ -124,13 +123,14 @@ class CaseController extends AbstractController
$this->navLinks, $this->navLinks,
[ [
'case' => $case, 'case' => $case,
'caseDocs' => $caseDocs,
'compDocs' => $compDocs,
'sources' => $sources, 'sources' => $sources,
'breadcrumbs' => [ 'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'),
new Breadcrumb($this->generateUrl('app_view_case', ['caseId' => $case->getId()]), 'View Case') new Breadcrumb($this->generateUrl('app_view_case', ['caseId' => $case->getId()]), 'View Case')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -141,10 +141,10 @@ class CaseController extends AbstractController
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($admin);
$companyDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $admin->getCompany()]);
$case = new MemberCase(); $case = new MemberCase();
$form = $this->createForm(MemberCaseFormType::class, $case); $form = $this->createForm(MemberCaseFormType::class, $case, ['docs' => $companyDocs]);
$form->handleRequest($request); $form->handleRequest($request);
@ -170,9 +170,9 @@ class CaseController extends AbstractController
new Breadcrumb($this->generateUrl('app_add_case'), 'Add Case') new Breadcrumb($this->generateUrl('app_add_case'), 'Add Case')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'form' => $form, 'form' => $form,
'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(), 'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(),
'docs' => $companyDocs,
] ]
) )
); );
@ -183,7 +183,6 @@ class CaseController extends AbstractController
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($admin);
$case = $this->entityManager->getRepository(MemberCase::class)->find($id); $case = $this->entityManager->getRepository(MemberCase::class)->find($id);
$form = $this->createForm(MemberCaseFormType::class, $case); $form = $this->createForm(MemberCaseFormType::class, $case);
@ -210,7 +209,6 @@ class CaseController extends AbstractController
new Breadcrumb($this->generateUrl('app_edit_case', ['id' => $id]), 'Edit Case') new Breadcrumb($this->generateUrl('app_edit_case', ['id' => $id]), 'Edit Case')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'form' => $form, 'form' => $form,
'case' => $case, 'case' => $case,
'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(), 'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(),
@ -224,7 +222,6 @@ class CaseController extends AbstractController
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin); $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($admin);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($admin);
$caseWorkers = $this->entityManager->getRepository(User::class)->getCaseWorkers(); $caseWorkers = $this->entityManager->getRepository(User::class)->getCaseWorkers();
$case = $this->entityManager->getRepository(MemberCase::class)->find($id); $case = $this->entityManager->getRepository(MemberCase::class)->find($id);
@ -267,7 +264,6 @@ class CaseController extends AbstractController
new Breadcrumb($this->generateUrl('app_assign_case', ['id' => $id]), 'Assign User') new Breadcrumb($this->generateUrl('app_assign_case', ['id' => $id]), 'Assign User')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'case' => $case, 'case' => $case,
'form' => $form, 'form' => $form,
'id' => $id, 'id' => $id,
@ -278,13 +274,6 @@ class CaseController extends AbstractController
); );
} }
#[Route('/case-notes/{id}', name: 'app_case_notes')]
public function showCaseNotes(Request $request, string $id): Response
{
$case = $this->entityManager->getRepository(MemberCase::class)->find($id);
return new Response();
}
#[Route('/addresses/list', name: 'app_list_case_addresses')] #[Route('/addresses/list', name: 'app_list_case_addresses')]
public function listCaseAddresses(Request $request, #[CurrentUser()] User $user): Response public function listCaseAddresses(Request $request, #[CurrentUser()] User $user): Response
{ {
@ -292,9 +281,8 @@ class CaseController extends AbstractController
$this->navLinks['case_list'] = 'nav-link text-dark'; $this->navLinks['case_list'] = 'nav-link text-dark';
$addresses = $this->entityManager->getRepository(Location::class)->getUserLocations($user); $addresses = $this->entityManager->getRepository(Location::class)->getUserLocations($user);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]);
$cases = []; $cases = [];
foreach ($ucs as $uc) { foreach ($ucs as $uc) {
@ -313,7 +301,6 @@ class CaseController extends AbstractController
new Breadcrumb($this->generateUrl('app_list_case_addresses'), 'List Case Addresses') new Breadcrumb($this->generateUrl('app_list_case_addresses'), 'List Case Addresses')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'addresses' => $addresses, 'addresses' => $addresses,
'cases' => $cases, 'cases' => $cases,
] ]
@ -327,8 +314,8 @@ class CaseController extends AbstractController
$this->navLinks['case_itinerary'] = NavList::PRESENT_LINK; $this->navLinks['case_itinerary'] = NavList::PRESENT_LINK;
$this->navLinks['case_list'] = 'nav-link text-dark'; $this->navLinks['case_list'] = 'nav-link text-dark';
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]);
$cases = []; $cases = [];
@ -379,7 +366,6 @@ class CaseController extends AbstractController
new Breadcrumb($this->generateUrl('app_case_add_address'), 'Add Case Address') new Breadcrumb($this->generateUrl('app_case_add_address'), 'Add Case Address')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'form' => $form, 'form' => $form,
'cases' => $cases, 'cases' => $cases,
] ]
@ -394,7 +380,6 @@ class CaseController extends AbstractController
$this->navLinks['case_list'] = 'nav-link text-dark'; $this->navLinks['case_list'] = 'nav-link text-dark';
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser()); $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser());
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($this->getUser());
$ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $this->getUser()]); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $this->getUser()]);
$lcs = $this->entityManager->getRepository(CaseLocation::class)->findBy(['location' => $id]); $lcs = $this->entityManager->getRepository(CaseLocation::class)->findBy(['location' => $id]);
@ -440,12 +425,61 @@ class CaseController extends AbstractController
'inCases' => $inCases, 'inCases' => $inCases,
'form' => $form, 'form' => $form,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
} }
#[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()]);
$form = $this->createForm(CaseDocumentFormType::class, null, ['docs' => $companyDocs]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$docs = $form['document']->getData();
dd($docs);
$this->entityManager->persist($cd);
$this->entityManager->flush();
$this->redirectToRoute('app_case_members', ['id' => $caseId]);
}
return $this->render(
'internal/cases/members/assign-document.html.twig',
array_merge(
$this->navLinks,
[
'notifications' => $this->msgs,
'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_dashboard'), 'Dashboard'),
new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'),
new Breadcrumb($this->generateUrl('app_case_members', ['id' => $caseId]), 'Case Members')
],
'form' => $form,
'case' => $case,
'member' => $member,
'docs' => $companyDocs,
]
)
);
return new Response();
}
#[Route('/sign-case-doc/{caseId}/{docId}/{memberId}', name: 'app_display_case_document')]
public function displayCaseDocument(string $caseId, string $docId, Request $request, #[CurrentUser()] User $user): Response
{
return new Response();
}
#[Route('/api/filter-address-by-case/{caseId}', name: 'ajax_filter_address_by_case')] #[Route('/api/filter-address-by-case/{caseId}', name: 'ajax_filter_address_by_case')]
public function filterAddressByCase(string $caseId, Request $request): Response public function filterAddressByCase(string $caseId, Request $request): Response
{ {
@ -487,9 +521,7 @@ class CaseController extends AbstractController
foreach ($ucs as $uc) { foreach ($ucs as $uc) {
$ret[] = $uc->getMemberCase(); $ret[] = $uc->getMemberCase();
} }
dump($ret);
die;
return $this->json($ret); return $this->json($ret);
} }
} }

View File

@ -29,8 +29,6 @@ class CommunityResourceController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private readonly EntityManagerInterface $entityManager, private readonly EntityManagerInterface $entityManager,
private array $navLinks = [] private array $navLinks = []
@ -43,8 +41,7 @@ class CommunityResourceController extends AbstractController
public function list(#[CurrentUser()] User $user): Response public function list(#[CurrentUser()] User $user): Response
{ {
$rsc = $this->entityManager->getRepository(CommunityResource::class)->findAll(); $rsc = $this->entityManager->getRepository(CommunityResource::class)->findAll();
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
return $this->render( return $this->render(
'internal/community_resource/list.html.twig', 'internal/community_resource/list.html.twig',
@ -56,7 +53,6 @@ class CommunityResourceController extends AbstractController
], ],
'resources' => $rsc, 'resources' => $rsc,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -65,8 +61,7 @@ class CommunityResourceController extends AbstractController
#[Route('/resource/map', name: 'app_community_resource_map')] #[Route('/resource/map', name: 'app_community_resource_map')]
public function map(#[CurrentUser()] User $user): Response public function map(#[CurrentUser()] User $user): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$rcs = $this->entityManager->getRepository(CommunityResource::class)->findAll(); $rcs = $this->entityManager->getRepository(CommunityResource::class)->findAll();
@ -81,7 +76,7 @@ class CommunityResourceController extends AbstractController
position: new Point($rsc->getLat(), $rsc->getLon()), position: new Point($rsc->getLat(), $rsc->getLon()),
title: $rsc->getName(), title: $rsc->getName(),
infoWindow: new InfoWindow( infoWindow: new InfoWindow(
content: "{$rsc->getName()}<br>{$rsc->getAddress()}, {$rsc->getCity()}, {$rsc->getState()->value} {$rsc->getZip()}<br>Services: " . $rsc->getServicesAvailable() content: $rsc->_toInfoWindow()
), ),
extra: [ extra: [
'type' => '' 'type' => ''
@ -100,7 +95,6 @@ class CommunityResourceController extends AbstractController
new Breadcrumb('#', 'Community Resources') new Breadcrumb('#', 'Community Resources')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -109,9 +103,8 @@ class CommunityResourceController extends AbstractController
#[Route('/resource/add', name: 'app_community_resource_add')] #[Route('/resource/add', name: 'app_community_resource_add')]
public function add(#[CurrentUser()] User $user, Request $request): Response public function add(#[CurrentUser()] User $user, Request $request): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$form = $this->createForm(ResourceFormType::class); $form = $this->createForm(ResourceFormType::class);
$form->handleRequest($request); $form->handleRequest($request);
@ -150,7 +143,6 @@ class CommunityResourceController extends AbstractController
new Breadcrumb('#', 'Add Resource') new Breadcrumb('#', 'Add Resource')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -160,9 +152,8 @@ class CommunityResourceController extends AbstractController
#[Route('/resource/edit/{id}', name: 'app_community_resource_edit')] #[Route('/resource/edit/{id}', name: 'app_community_resource_edit')]
public function edit(string $id, #[CurrentUser()] User $user, Request $request): Response public function edit(string $id, #[CurrentUser()] User $user, Request $request): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$rsc = $this->entityManager->getRepository(CommunityResource::class)->find($id); $rsc = $this->entityManager->getRepository(CommunityResource::class)->find($id);
$form = $this->createForm(ResourceFormType::class, $rsc); $form = $this->createForm(ResourceFormType::class, $rsc);
@ -199,7 +190,6 @@ class CommunityResourceController extends AbstractController
new Breadcrumb('#', 'Edit Resource') new Breadcrumb('#', 'Edit Resource')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );

View File

@ -0,0 +1,182 @@
<?php
namespace App\Controller;
use App\Entity\Company;
use App\Entity\CompanyDocument;
use App\Entity\User;
use App\Form\CompanyDocumentFormType;
use App\Form\InternalCompanyFormType;
use App\Libs\Breadcrumb;
use App\Libs\NavList;
use App\Libs\Libs;
use DateTime;
use DateTimeZone;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
use Symfony\Component\Security\Http\Attribute\IsGranted;
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 = []
){
$this->navLinks = NavList::LIST;
}
#[Route('/company', name: 'app_company')]
public function editCompanyInfo(
#[CurrentUser()] User $user,
Request $request,
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);
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid()) {
/** @var Company $company */
$company = $form->getData();
if ($form->get('companyLogo')->getData()) {
$file = $form['companyLogo']->getData();
$destination = $this->getParameter('kernel.project_dir').'/public/uploads/company/';
$originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
$newFilename = $slugger->slug($originalFilename).'-'.uniqid().'.'.$file->guessExtension();
$file->move(
$destination,
$newFilename
);
$company->setCompanyLogo($newFilename);
}
$this->entityManager->flush();
return $this->redirectToRoute('app_admin_dashboard');
}
return $this->render(
'internal/admin/company/company-info.html.twig',
array_merge(
$this->navLinks,
[
'form' => $form,
'company' => $company,
'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_admin_dashboard'), "Admin Dashboard"),
],
'msgs' => $this->msgs,
]
)
);
}
#[Route('/docs/list', name: 'app_list_documents')]
public function listDocs(#[CurrentUser()] User $user): Response
{
$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(
'internal/admin/company/docs/list-documents.html.twig',
array_merge(
$this->navLinks,
[
'breadcrumbs' => [],
'notifications' => $this->msgs,
'docs' => $companyDocs,
]
)
);
}
#[Route('/docs/add', name: 'app_add_doc')]
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);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var CompanyDocument $doc */
$doc = $form->getData();
$doc->setCompany($user->getCompany());
$doc->setUpdated(new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE'])));
$this->entityManager->persist($doc);
$this->entityManager->flush();
return $this->redirectToRoute('app_list_documents');
}
return $this->render(
'internal/admin/company/docs/add-document.html.twig',
array_merge(
$this->navLinks,
[
'breadcrumbs' => [],
'notifications' => $this->msgs,
'form' => $form,
]
)
);
}
#[Route('/docs/edit/{docId}', name: 'app_edit_doc')]
public function editCompanyDocument(string $docId, Request $request, #[CurrentUser()] User $user): Response
{
$companyDoc = $this->entityManager->getRepository(CompanyDocument::class)->find($docId);
$this->navLinks['company_nav'] = NavList::PRESENT_LINK;
$this->msgs = Libs::getMessages($user, $this->entityManager);
$form = $this->createForm(CompanyDocumentFormType::class, $companyDoc);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var CompanyDocument $doc */
$doc = $form->getData();
$doc->setUpdated(new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE'])));
$this->entityManager->persist($doc);
$this->entityManager->flush();
return $this->redirectToRoute('app_list_documents');
}
return $this->render(
'internal/admin/company/docs/edit-document.html.twig',
array_merge(
$this->navLinks,
[
'breadcrumbs' => [],
'notifications' => $this->msgs,
'form' => $form,
'doc' => $companyDoc,
'docText' => str_replace("\r\n", "", $companyDoc->getText())
]
)
);
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Controller;
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;
class DocumentController extends AbstractController
{
public function __construct(
private EntityManagerInterface $entityManager,
private array $navLinks = []
) {
$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
{
$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);
return $this->render(
'internal/cases/documents/display-case-doc.html.twig',
array_merge(
$this->navLinks,
[
'msgs' => $msgs,
'notificationCount' => count($msgs),
'breadcrumbs' => []
]
)
);
}
}

View File

@ -13,6 +13,7 @@ use App\Libs\Breadcrumb;
use App\Libs\Libs; use App\Libs\Libs;
use App\Libs\NavList; use App\Libs\NavList;
use DateTime; use DateTime;
use DateTimeZone;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -30,8 +31,6 @@ class ItineraryController extends AbstractController
{ {
private array $msgs = []; private array $msgs = [];
private int $notificationCount = 0;
public function __construct( public function __construct(
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private array $navLinks = [] private array $navLinks = []
@ -44,9 +43,8 @@ class ItineraryController extends AbstractController
{ {
$this->navLinks['case_itinerary'] = NavList::PRESENT_LINK; $this->navLinks['case_itinerary'] = NavList::PRESENT_LINK;
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel( $itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel(
$user $user
); );
@ -67,7 +65,6 @@ class ItineraryController extends AbstractController
new Breadcrumb($this->generateUrl('app_dashboard'), 'Dashboard'), new Breadcrumb($this->generateUrl('app_dashboard'), 'Dashboard'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'itineraries' => $itineraries, 'itineraries' => $itineraries,
'cases' => $cases 'cases' => $cases
] ]
@ -84,12 +81,21 @@ class ItineraryController extends AbstractController
if ($request->getPayload()->get('caseId')) { if ($request->getPayload()->get('caseId')) {
$case = $this->entityManager->getRepository(MemberCase::class)->find($request->getPayload()->get('caseId')); $case = $this->entityManager->getRepository(MemberCase::class)->find($request->getPayload()->get('caseId'));
} }
$startDate = ($request->getPayload()->get('startDate') ?new DateTime($request->getPayload()->get('startDate')) : null); $startDate = (
$endDate = ($request->getPayload()->get('endDate') ? new DateTime($request->getPayload()->get('endDate')) : null); $request->getPayload()->get('startDate')
?
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); new DateTime($request->getPayload()->get('startDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']))
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); :
null);
$endDate = (
$request->getPayload()->get('endDate')
?
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, [ $itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel($user, [
'case' => $case, 'case' => $case,
'from' => $startDate, 'from' => $startDate,
@ -113,7 +119,7 @@ class ItineraryController extends AbstractController
), ),
title: $itinerary->getOriginLocation()->getName(), title: $itinerary->getOriginLocation()->getName(),
infoWindow: new InfoWindow( infoWindow: new InfoWindow(
content: $itinerary->getOriginLocation()->getName(), content: $itinerary->originInfoWindow(),
) )
)); ));
@ -124,7 +130,7 @@ class ItineraryController extends AbstractController
), ),
title: $itinerary->getDestLocation()->getName(), title: $itinerary->getDestLocation()->getName(),
infoWindow: new InfoWindow( infoWindow: new InfoWindow(
content: $itinerary->getDestLocation()->getName(), content: $itinerary->destinationInfoWindow(),
) )
)); ));
@ -155,7 +161,6 @@ class ItineraryController extends AbstractController
new Breadcrumb($this->generateUrl('app_report_itinerary'), 'Itinerary Report'), new Breadcrumb($this->generateUrl('app_report_itinerary'), 'Itinerary Report'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'map' => $map, 'map' => $map,
'total_distance' => $total_distance, 'total_distance' => $total_distance,
'total_duration' => $di->format("%H:%i'%s''"), 'total_duration' => $di->format("%H:%i'%s''"),
@ -188,7 +193,7 @@ class ItineraryController extends AbstractController
$departure = $request->getPayload()->get('departure'); $departure = $request->getPayload()->get('departure');
$arrival = $request->getPayload()->get('arrival'); $arrival = $request->getPayload()->get('arrival');
$caseMileage = (bool) $request->getPayload()->get('caseMileage'); $caseMileage = (bool) $request->getPayload()->get('caseMileage');
$date = new DateTime($request->getPayload()->get('date')); $date = new DateTime($request->getPayload()->get('date'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
$route = Libs::getRouteDistance($origin, $destination); $route = Libs::getRouteDistance($origin, $destination);
@ -234,11 +239,11 @@ class ItineraryController extends AbstractController
} }
if ($request->getPayload()->get('startDate')) { if ($request->getPayload()->get('startDate')) {
$startDate = new DateTime($request->getPayload()->get('startDate')); $startDate = new DateTime($request->getPayload()->get('startDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
} }
if ($request->getPayload()->get('endDate')) { if ($request->getPayload()->get('endDate')) {
$endDate = new DateTime($request->getPayload()->get('endDate')); $endDate = new DateTime($request->getPayload()->get('endDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
} }
$itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel($user, [ $itineraries = $this->entityManager->getRepository(CaseItinerary::class)->getRecentTravel($user, [

View File

@ -8,6 +8,7 @@ use App\Entity\MemberCase;
use App\Entity\Messages; use App\Entity\Messages;
use App\Form\MemberFormType; use App\Form\MemberFormType;
use App\Libs\Breadcrumb; use App\Libs\Breadcrumb;
use App\Libs\Libs;
use App\Libs\NavList; use App\Libs\NavList;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -25,8 +26,6 @@ class MemberController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private array $navLinks = [], private array $navLinks = [],
@ -38,8 +37,7 @@ class MemberController extends AbstractController
#[Route('/list-members/{id}', name: 'app_case_members')] #[Route('/list-members/{id}', name: 'app_case_members')]
public function listMembers(Request $request, #[CurrentUser()] User $user, string $id): Response public function listMembers(Request $request, #[CurrentUser()] User $user, string $id): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$case = $this->entityManager->getRepository(MemberCase::class)->find($id); $case = $this->entityManager->getRepository(MemberCase::class)->find($id);
$members = $this->entityManager->getRepository(Member::class)->getCaseMembersByName($case); $members = $this->entityManager->getRepository(Member::class)->getCaseMembersByName($case);
@ -56,7 +54,6 @@ class MemberController extends AbstractController
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'case' => $case, 'case' => $case,
'members' => $members, 'members' => $members,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -65,9 +62,8 @@ class MemberController extends AbstractController
#[Route('/add-member/{id}', name: 'app_case_add_member')] #[Route('/add-member/{id}', name: 'app_case_add_member')]
public function addMember(Request $request, #[CurrentUser()] User $user, string $id): Response public function addMember(Request $request, #[CurrentUser()] User $user, string $id): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
/** @var MemberCase $case */ /** @var MemberCase $case */
$case = $this->entityManager->getRepository(MemberCase::class)->find($id); $case = $this->entityManager->getRepository(MemberCase::class)->find($id);
@ -130,7 +126,6 @@ class MemberController extends AbstractController
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'case' => $case, 'case' => $case,
'form' => $form->createView(), 'form' => $form->createView(),
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -139,9 +134,8 @@ class MemberController extends AbstractController
#[Route('/case/{caseId}/edit-member/{memberId}', name: 'app_case_edit_member')] #[Route('/case/{caseId}/edit-member/{memberId}', name: 'app_case_edit_member')]
public function editMember(Request $request, #[CurrentUser()] User $user, string $caseId, string $memberId): Response public function editMember(Request $request, #[CurrentUser()] User $user, string $caseId, string $memberId): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$member = $this->entityManager->getRepository(Member::class)->find($memberId); $member = $this->entityManager->getRepository(Member::class)->find($memberId);
$form = $this->createForm(MemberFormType::class, $member); $form = $this->createForm(MemberFormType::class, $member);
@ -197,7 +191,6 @@ class MemberController extends AbstractController
new Breadcrumb($this->generateUrl('app_case_edit_member', ['caseId' => $caseId, 'memberId' => $memberId]), 'Edit Member'), new Breadcrumb($this->generateUrl('app_case_edit_member', ['caseId' => $caseId, 'memberId' => $memberId]), 'Edit Member'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'member' => $member, 'member' => $member,
'form' => $form->createView(), 'form' => $form->createView(),
'caseId' => $caseId, 'caseId' => $caseId,

View File

@ -3,13 +3,16 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\Messages; use App\Entity\Messages;
use App\Entity\Supervision;
use App\Entity\User; use App\Entity\User;
use App\Enums\MessageType;
use App\Libs\Libs;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Security\Http\Attribute\CurrentUser;
class MessageController extends AbstractController class MessageController extends AbstractController
{ {
@ -32,4 +35,28 @@ class MessageController extends AbstractController
'link' => $message->getLink(), 'link' => $message->getLink(),
]); ]);
} }
#[Route('/api/send-message', name: 'app_send_message')]
public function sendMessage(Request $request, #[CurrentUser()] User $user): Response
{
$sup = $this->entityManager->getRepository(Supervision::class)->getSupervisorByWorker($user);
$data = json_decode($request->getContent(), true);
$message = new Messages();
$message->setSender($user);
$message->setSent(new \DateTimeImmutable());
$message->setRecipient($sup);
$message->setTitle('New Message');
$message->setMessage($data['message']);
$message->setType(MessageType::GENERAL);
//dd($message);
$this->entityManager->persist($message);
$this->entityManager->flush();
return $this->json([
'success' => true,
'message' => 'Message sent',
]);
}
} }

View File

@ -18,6 +18,7 @@ use App\Enums\ReferralServiceType;
use App\Form\StandardNoteFormType; use App\Form\StandardNoteFormType;
use App\Form\VisitNoteFormType; use App\Form\VisitNoteFormType;
use App\Libs\Breadcrumb; use App\Libs\Breadcrumb;
use App\Libs\Libs;
use App\Libs\NavList; use App\Libs\NavList;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
@ -37,8 +38,6 @@ class NoteController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private array $navLinks = [], private array $navLinks = [],
@ -47,14 +46,29 @@ class NoteController extends AbstractController
$this->navLinks['case_notes'] = NavList::PRESENT_LINK; $this->navLinks['case_notes'] = NavList::PRESENT_LINK;
} }
#[Route('/list-notes/', name: 'app_list_notes')] #[Route('/list-notes/{caseId?null}', name: 'app_list_notes')]
public function listNotes(#[CurrentUser()] User $user, Request $request): Response public function listNotes(string $caseId = null, #[CurrentUser()] User $user, Request $request): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
/** @var UserCase[] $cases */ /** @var UserCase[] $cases */
$cases = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $cases = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]);
$caseNotes = null;
$case = null;
if ($caseId != 'null') {
$case = $this->entityManager->getRepository(MemberCase::class)->find($caseId);
$params = [
'case' => $case,
'referral' => null,
'startDate' => null,
'endDate' => null,
];
$caseNotes = array_merge(
$this->entityManager->getRepository(VisitNote::class)->filterNotes($user, $params),
$this->entityManager->getRepository(StandardNote::class)->filterNotes($user, $params),
);
}
return $this->render( return $this->render(
'internal/cases/notes/list-notes.html.twig', 'internal/cases/notes/list-notes.html.twig',
@ -66,7 +80,8 @@ class NoteController extends AbstractController
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'cases' => $cases, 'cases' => $cases,
'notificationCount' => $this->notificationCount, 'caseNotes' => $caseNotes,
'case' => $case,
] ]
) )
); );
@ -78,8 +93,7 @@ class NoteController extends AbstractController
/** @var Referral $referral */ /** @var Referral $referral */
$referral = $this->entityManager->getRepository(Referral::class)->find($referralId); $referral = $this->entityManager->getRepository(Referral::class)->find($referralId);
$this->entityManager->getRepository(Referral::class)->populateNotes($referral); $this->entityManager->getRepository(Referral::class)->populateNotes($referral);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$members = $this->entityManager->getRepository(Member::class)->findBy(['caseId' => $referral->getMemberCase()]); $members = $this->entityManager->getRepository(Member::class)->findBy(['caseId' => $referral->getMemberCase()]);
$defaultMethod = NoteMethod::BILLABLE; $defaultMethod = NoteMethod::BILLABLE;
@ -126,7 +140,6 @@ class NoteController extends AbstractController
'form' => $form, 'form' => $form,
'default_method' => $defaultMethod, 'default_method' => $defaultMethod,
'default_location' => $defaultLocation, 'default_location' => $defaultLocation,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -135,8 +148,8 @@ class NoteController extends AbstractController
#[Route('/edit-note/{noteType}/{noteId}', name: 'app_edit_note')] #[Route('/edit-note/{noteType}/{noteId}', name: 'app_edit_note')]
public function editNote(string $noteId, string $noteType, #[CurrentUser()] User $user, Request $request): Response public function editNote(string $noteId, string $noteType, #[CurrentUser()] User $user, Request $request): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$form = null; $form = null;
/** @var VisitNote|StandardNote $note */ /** @var VisitNote|StandardNote $note */
@ -159,7 +172,6 @@ class NoteController extends AbstractController
new Breadcrumb($this->generateUrl('app_list_notes'), 'List Notes') new Breadcrumb($this->generateUrl('app_list_notes'), 'List Notes')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'note' => $note, 'note' => $note,
'referral' => $note->getReferral(), 'referral' => $note->getReferral(),
'form' => $form, 'form' => $form,
@ -178,11 +190,11 @@ class NoteController extends AbstractController
$case = null; $case = null;
if ($request->getPayload()->get('startDate')) { if ($request->getPayload()->get('startDate')) {
$startDate = new DateTime($request->getPayload()->get('startDate'), new DateTimeZone('America/Indiana/Indianapolis')); $startDate = new DateTime($request->getPayload()->get('startDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
} }
if ($request->getPayload()->get('endDate')) { if ($request->getPayload()->get('endDate')) {
$endDate = new DateTime($request->getPayload()->get('endDate'), new DateTimeZone('America/Indiana/Indianapolis')); $endDate = new DateTime($request->getPayload()->get('endDate'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
} }
if ($request->getPayload()->get('referral')) { if ($request->getPayload()->get('referral')) {

View File

@ -10,6 +10,7 @@ use App\Entity\UserCase;
use App\Factory\MessageFactory; use App\Factory\MessageFactory;
use App\Form\ReferralFormType; use App\Form\ReferralFormType;
use App\Libs\Breadcrumb; use App\Libs\Breadcrumb;
use App\Libs\Libs;
use App\Libs\NavList; use App\Libs\NavList;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -27,8 +28,6 @@ class ReferralController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private array $navLinks = [] private array $navLinks = []
@ -44,8 +43,7 @@ class ReferralController extends AbstractController
#[Route('/list-referrals/{id}', name: 'app_list_referrals')] #[Route('/list-referrals/{id}', name: 'app_list_referrals')]
public function listReferrals(#[CurrentUser()] User $user, string $id, Request $request): Response public function listReferrals(#[CurrentUser()] User $user, string $id, Request $request): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$case = $this->entityManager->getRepository(MemberCase::class)->find($id); $case = $this->entityManager->getRepository(MemberCase::class)->find($id);
$openReferrals = $this->entityManager->getRepository(Referral::class)->getActiveReferrals($case); $openReferrals = $this->entityManager->getRepository(Referral::class)->getActiveReferrals($case);
@ -65,7 +63,6 @@ class ReferralController extends AbstractController
new Breadcrumb($this->generateUrl('app_list_referrals', ['id' => $case->getId()]), 'Referrals'), new Breadcrumb($this->generateUrl('app_list_referrals', ['id' => $case->getId()]), 'Referrals'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'case' => $case, 'case' => $case,
'openReferrals' => $openReferrals, 'openReferrals' => $openReferrals,
'closedReferrals' => $closedReferrals, 'closedReferrals' => $closedReferrals,
@ -78,9 +75,8 @@ class ReferralController extends AbstractController
public function addReferral(Request $request, #[CurrentUser()] User $user, string $id): Response public function addReferral(Request $request, #[CurrentUser()] User $user, string $id): Response
{ {
$this->denyAccessUnlessGranted(['ROLE_ADMIN', 'ROLE_CASE_MANAGER']); $this->denyAccessUnlessGranted(['ROLE_ADMIN', 'ROLE_CASE_MANAGER']);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$case = $this->entityManager->getRepository(MemberCase::class)->find($id); $case = $this->entityManager->getRepository(MemberCase::class)->find($id);
/** @var UserCase $uc */ /** @var UserCase $uc */
$uc = $this->entityManager->getRepository(UserCase::class)->findBy(['memberCase' => $case]); $uc = $this->entityManager->getRepository(UserCase::class)->findBy(['memberCase' => $case]);
@ -114,7 +110,6 @@ class ReferralController extends AbstractController
new Breadcrumb($this->generateUrl('app_case_add_referral', ['id' => $case->getId()]), 'Add Referral') new Breadcrumb($this->generateUrl('app_case_add_referral', ['id' => $case->getId()]), 'Add Referral')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'case' => $case, 'case' => $case,
'form' => $form, 'form' => $form,
] ]
@ -126,9 +121,8 @@ class ReferralController extends AbstractController
public function editReferral(Request $request, #[CurrentUser()] User $user, string $caseId, string $referralId): Response public function editReferral(Request $request, #[CurrentUser()] User $user, string $caseId, string $referralId): Response
{ {
$this->denyAccessUnlessGranted(['ROLE_ADMIN', 'ROLE_CASE_MANAGER']); $this->denyAccessUnlessGranted(['ROLE_ADMIN', 'ROLE_CASE_MANAGER']);
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$referral = $this->entityManager->getRepository(Referral::class)->find($referralId); $referral = $this->entityManager->getRepository(Referral::class)->find($referralId);
$case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId);
/** @var UserCase $uc */ /** @var UserCase $uc */
@ -159,7 +153,6 @@ class ReferralController extends AbstractController
new Breadcrumb($this->generateUrl('app_case_edit_referral', ['caseId' => $case->getId(), 'referralId' => $referral->getId()]), 'Edit Referral'), new Breadcrumb($this->generateUrl('app_case_edit_referral', ['caseId' => $case->getId(), 'referralId' => $referral->getId()]), 'Edit Referral'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'case' => $case, 'case' => $case,
'form' => $form, 'form' => $form,
'referral' => $referral, 'referral' => $referral,

View File

@ -7,6 +7,7 @@ use App\Entity\ReferralSource;
use App\Entity\User; use App\Entity\User;
use App\Form\ReferralSourceFormType; use App\Form\ReferralSourceFormType;
use App\Libs\Breadcrumb; use App\Libs\Breadcrumb;
use App\Libs\Libs;
use App\Libs\NavList; use App\Libs\NavList;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -24,8 +25,6 @@ class ReferralSourceController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private array $navList = [] private array $navList = []
@ -38,9 +37,8 @@ class ReferralSourceController extends AbstractController
public function listReferralSources(#[CurrentUser()] User $user): Response public function listReferralSources(#[CurrentUser()] User $user): Response
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$sources = $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(); $sources = $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList();
return $this->render( return $this->render(
@ -50,7 +48,6 @@ class ReferralSourceController extends AbstractController
[ [
'sources' => $sources, 'sources' => $sources,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'breadcrumbs' => [ 'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources') new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources')
] ]
@ -63,9 +60,8 @@ class ReferralSourceController extends AbstractController
public function addSource(Request $request, #[CurrentUser()] User $user): Response public function addSource(Request $request, #[CurrentUser()] User $user): Response
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$rs = new ReferralSource(); $rs = new ReferralSource();
$form = $this->createForm(ReferralSourceFormType::class, $rs); $form = $this->createForm(ReferralSourceFormType::class, $rs);
@ -89,7 +85,6 @@ class ReferralSourceController extends AbstractController
[ [
'form' => $form, 'form' => $form,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'breadcrumbs' => [ 'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources'), new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources'),
new Breadcrumb($this->generateUrl('app_add_source'), 'Add Source') new Breadcrumb($this->generateUrl('app_add_source'), 'Add Source')
@ -103,9 +98,8 @@ class ReferralSourceController extends AbstractController
public function editSource(Request $request, #[CurrentUser()] User $user, string $id): Response public function editSource(Request $request, #[CurrentUser()] User $user, string $id): Response
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$rs = $this->entityManager->getRepository(ReferralSource::class)->find($id); $rs = $this->entityManager->getRepository(ReferralSource::class)->find($id);
$form = $this->createForm(ReferralSourceFormType::class, $rs); $form = $this->createForm(ReferralSourceFormType::class, $rs);
@ -130,7 +124,6 @@ class ReferralSourceController extends AbstractController
'form' => $form, 'form' => $form,
'rs' => $rs, 'rs' => $rs,
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
'breadcrumbs' => [ 'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources'), new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources'),
new Breadcrumb($this->generateUrl('app_edit_source', ['id' => $id]), 'Edit Source') new Breadcrumb($this->generateUrl('app_edit_source', ['id' => $id]), 'Edit Source')

View File

@ -12,6 +12,7 @@ use App\Factory\MessageFactory;
use App\Form\StaffNoteFormType; use App\Form\StaffNoteFormType;
use App\Form\SupervisorStaffNoteFormType; use App\Form\SupervisorStaffNoteFormType;
use App\Libs\Breadcrumb; use App\Libs\Breadcrumb;
use App\Libs\Libs;
use App\Libs\NavList; use App\Libs\NavList;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -29,8 +30,6 @@ class StaffController extends AbstractController
*/ */
private array $msgs; private array $msgs;
private int $notificationCount;
public function __construct( public function __construct(
private readonly EntityManagerInterface $entityManager, private readonly EntityManagerInterface $entityManager,
private array $navLinks = [] private array $navLinks = []
@ -42,8 +41,7 @@ class StaffController extends AbstractController
#[Route('/staff-dashboard', name: 'app_staff_dashboard')] #[Route('/staff-dashboard', name: 'app_staff_dashboard')]
public function staffDashboard(#[CurrentUser()] User $user): Response public function staffDashboard(#[CurrentUser()] User $user): Response
{ {
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$sups = $this->entityManager->getRepository(Supervision::class)->findBy(['supervisor' => $user]); $sups = $this->entityManager->getRepository(Supervision::class)->findBy(['supervisor' => $user]);
$staff = []; $staff = [];
@ -62,7 +60,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Staff Dashboard') new Breadcrumb('', 'Staff Dashboard')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -74,11 +71,11 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->navLinks['staff_dashboard'] = NavList::DEFAULT;
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); $this->navLinks['staff_notes'] = NavList::PRESENT_LINK;
$this->msgs = Libs::getMessages($user, $this->entityManager);
$sup = $this->entityManager->getRepository(Supervision::class)->findOneBy(['worker' => $user]); $sup = $this->entityManager->getRepository(Supervision::class)->findOneBy(['worker' => $user]);
$ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $user]);
$cases = []; $cases = [];
$this->navLinks['staff_dashboard'] = 'nav-link text-dark'; $this->navLinks['staff_dashboard'] = 'nav-link text-dark';
@ -101,7 +98,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Staff Cases') new Breadcrumb('', 'Staff Cases')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -113,8 +109,7 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$staff = $this->entityManager->getRepository(User::class)->find($staffId); $staff = $this->entityManager->getRepository(User::class)->find($staffId);
$ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $staff]); $ucs = $this->entityManager->getRepository(UserCase::class)->findBy(['user' => $staff]);
@ -137,7 +132,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Staff Cases') new Breadcrumb('', 'Staff Cases')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -149,8 +143,9 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); $this->navLinks['staff_dashboard'] = NavList::DEFAULT;
$this->navLinks['staff_notes'] = NavList::PRESENT_LINK;
$isWorker = ($staffId == $user->getId()->toString()); $isWorker = ($staffId == $user->getId()->toString());
$staff = $this->entityManager->getRepository(User::class)->find($staffId); $staff = $this->entityManager->getRepository(User::class)->find($staffId);
@ -179,7 +174,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'List Notes') new Breadcrumb('', 'List Notes')
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -191,8 +185,9 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); $this->navLinks['staff_dashboard'] = NavList::DEFAULT;
$this->navLinks['staff_notes'] = NavList::PRESENT_LINK;
$case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId);
$form = $this->createForm(StaffNoteFormType::class); $form = $this->createForm(StaffNoteFormType::class);
@ -242,7 +237,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Add Note'), new Breadcrumb('', 'Add Note'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -254,8 +248,9 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); $this->navLinks['staff_dashboard'] = NavList::DEFAULT;
$this->navLinks['staff_notes'] = NavList::PRESENT_LINK;
$note = $this->entityManager->getRepository(StaffNote::class)->find($noteId); $note = $this->entityManager->getRepository(StaffNote::class)->find($noteId);
$case = $note->getMemberCase(); $case = $note->getMemberCase();
@ -289,7 +284,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Edit Note'), new Breadcrumb('', 'Edit Note'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -301,8 +295,9 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); $this->navLinks['staff_dashboard'] = NavList::DEFAULT;
$this->navLinks['staff_notes'] = NavList::PRESENT_LINK;
$note = $this->entityManager->getRepository(StaffNote::class)->find($noteId); $note = $this->entityManager->getRepository(StaffNote::class)->find($noteId);
$case = $note->getMemberCase(); $case = $note->getMemberCase();
@ -340,7 +335,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Sign Note'), new Breadcrumb('', 'Sign Note'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -352,8 +346,7 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
$note = $this->entityManager->getRepository(StaffNote::class)->find($noteId); $note = $this->entityManager->getRepository(StaffNote::class)->find($noteId);
$case = $note->getMemberCase(); $case = $note->getMemberCase();
@ -392,7 +385,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'Sign Note'), new Breadcrumb('', 'Sign Note'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );
@ -404,8 +396,9 @@ class StaffController extends AbstractController
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->msgs = Libs::getMessages($user, $this->entityManager);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); $this->navLinks['staff_dashboard'] = NavList::DEFAULT;
$this->navLinks['staff_notes'] = NavList::PRESENT_LINK;
$note = $this->entityManager->getRepository(StaffNote::class)->find($noteId); $note = $this->entityManager->getRepository(StaffNote::class)->find($noteId);
@ -421,7 +414,6 @@ class StaffController extends AbstractController
new Breadcrumb('', 'View Note'), new Breadcrumb('', 'View Note'),
], ],
'notifications' => $this->msgs, 'notifications' => $this->msgs,
'notificationCount' => $this->notificationCount,
] ]
) )
); );

View File

@ -6,6 +6,7 @@ use App\Entity\MemberCase;
use App\Entity\StaffNote; use App\Entity\StaffNote;
use App\Enums\ReferralServiceType; use App\Enums\ReferralServiceType;
use DateTime; use DateTime;
use DateTimeZone;
use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager; use Doctrine\Persistence\ObjectManager;
@ -24,7 +25,7 @@ class StaffNoteFixture extends Fixture implements DependentFixtureInterface
foreach ($cases as $case) { foreach ($cases as $case) {
/** @var MemberCase $case */ /** @var MemberCase $case */
$note = new StaffNote(); $note = new StaffNote();
$admitDate = new DateTime($case->getAdmitDate()?->format('Y-m-d').' '.$gen->time('H:i:s')); $admitDate = new DateTime($case->getAdmitDate()?->format('Y-m-d').' '.$gen->time('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
$admitDate->add(\DateInterval::createFromDateString('7 day')); $admitDate->add(\DateInterval::createFromDateString('7 day'));
$note->setDate($admitDate); $note->setDate($admitDate);
$note->setMemberCase($case); $note->setMemberCase($case);

View File

@ -191,4 +191,22 @@ class CaseItinerary
} }
return $points; return $points;
} }
public function originInfoWindow(): string
{
return <<<EOL
{$this->originLocation->getName()}<br/>
<a href='http://maps.google.com/?q={$this->originLocation->getLat()},{$this->originLocation->getLon()}'>{$this->originLocation->getFormattedAddress()}</a><br/>
{$this->departure->format("g:i a")}
EOL;
}
public function destinationInfoWindow(): string
{
return <<<EOL
{$this->destLocation->getName()}<br/>
<a href='http://maps.google.com/?q={$this->destLocation->getLat()},{$this->destLocation->getLon()}'>{$this->destLocation->getFormattedAddress()}</a><br/>
{$this->arrival->format("g:i a")}
EOL;
}
} }

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Enums\County; use App\Enums\County;
use App\Enums\ResourceType; use App\Enums\ResourceType;
use App\Enums\State; use App\Enums\State;
use App\Libs\Libs;
use App\Repository\CommunityResourceRepository; use App\Repository\CommunityResourceRepository;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
@ -258,7 +259,7 @@ class CommunityResource
public function getContactCard(): ?string public function getContactCard(): ?string
{ {
$formattedPhone = ($this->phone ? '(' . substr($this->phone, 0, 3) . ') ' . substr($this->phone, 3, 3) . '-' . substr($this->phone, 6) : ''); $formattedPhone = ($this->phone ? Libs::formatPhone($this->phone) : '');
return ($this->email ? "<a href='mailto:$this->email'>$this->email</a><br/>" : '') . return ($this->email ? "<a href='mailto:$this->email'>$this->email</a><br/>" : '') .
($this->phone ? "<a href='tel:$this->phone'>$formattedPhone</a>" : ''); ($this->phone ? "<a href='tel:$this->phone'>$formattedPhone</a>" : '');
} }
@ -309,8 +310,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime()) { if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
return 'C'; return 'C';
} }
@ -347,8 +348,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime()) { if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
return 'C'; return 'C';
} }
@ -385,9 +386,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
if ($closeAt <= new DateTime("now", new DateTimeZone('America/Indiana/Indianapolis'))) {
return 'C'; return 'C';
} }
@ -424,8 +424,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime()) { if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
return 'C'; return 'C';
} }
@ -462,8 +462,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime()) { if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
return 'C'; return 'C';
} }
@ -500,8 +500,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime()) { if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
return 'C'; return 'C';
} }
@ -538,8 +538,8 @@ class CommunityResource
return 'C'; return 'C';
} }
$closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'), new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
if ($closeAt <= new DateTime()) { if ($closeAt <= new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']))) {
return 'C'; return 'C';
} }
@ -548,7 +548,7 @@ class CommunityResource
public function getHours(): ?string public function getHours(): ?string
{ {
$this->today = new DateTime('now', new DateTimeZone('America/Indiana/Indianapolis')); $this->today = new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
switch ($this->today->format('w')) { switch ($this->today->format('w')) {
case 0: case 0:
return $this->sun(); return $this->sun();
@ -672,4 +672,15 @@ class CommunityResource
return $this; return $this;
} }
public function _toInfoWindow(): string
{
return <<<EOL
{$this->name}<br/>
<a href='http://maps.google.com/?q={$this->lat},{$this->lon}'>{$this->address}<br/>
{$this->city}, {$this->state->value} {$this->zip}</a><br/>
{$this->servicesAvailable}<br/>
{$this->getContactCard()}
EOL;
}
} }

View File

@ -5,9 +5,12 @@ namespace App\Entity;
use App\Repository\CompanyRepository; use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid; use Symfony\Component\Uid\Uuid;
use Vich\UploaderBundle\Entity\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: CompanyRepository::class)] #[ORM\Entity(repositoryClass: CompanyRepository::class)]
class Company class Company
@ -42,6 +45,12 @@ class Company
#[ORM\Column(length: 255, nullable: true)] #[ORM\Column(length: 255, nullable: true)]
private ?string $url = null; private ?string $url = null;
#[Vich\UploadableField(mapping: 'profile_image', fileNameProperty: 'imageName', size: 'size', mimeType: 'mimeType', originalName: 'originalName', dimensions: 'dimensions')]
private ?File $imageFile = null;
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $companyLogo = null;
/** /**
* @var Collection<int, User> * @var Collection<int, User>
*/ */
@ -200,6 +209,30 @@ class Company
return $this; return $this;
} }
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageFile(?File $imageFile): static
{
$this->imageFile = $imageFile;
return $this;
}
public function getCompanyLogo(): ?string
{
return $this->companyLogo;
}
public function setCompanyLogo(?string $companyLogo): static
{
$this->companyLogo = $companyLogo;
return $this;
}
public function __toString(): string public function __toString(): string
{ {
$url = ($this->url ? "<br/><a href='$this->url' target='_blank'>$this->url</a>" : ''); $url = ($this->url ? "<br/><a href='$this->url' target='_blank'>$this->url</a>" : '');

View File

@ -98,6 +98,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(length: 15)] #[ORM\Column(length: 15)]
private ?string $workPhone = null; private ?string $workPhone = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $signature = null;
public function __construct() public function __construct()
{ {
$this->userCases = new ArrayCollection(); $this->userCases = new ArrayCollection();
@ -439,4 +442,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $ret; return $ret;
} }
public function getSignature(): ?string
{
return $this->signature;
}
public function setSignature(?string $signature): static
{
$this->signature = $signature;
return $this;
}
} }

View File

@ -0,0 +1,19 @@
<?php
namespace App\Enums;
enum DocumentExtras: int
{
case CLIENT_NAME = 0;
case CLIENT_SIGNATURE = 1;
case NAMES = 2;
case EMAIL = 3;
case PHONE = 4;
case RELATIONSHIP = 5;
case DATE = 6;
case EVENT_DETAILS = 7;
case ACTION_TAKEN = 8;
case COMMENTS = 9;
case PROVIDER_NAME = 10;
case PROVIDER_SIGNATURE = 11;
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Form;
use App\Entity\CaseDocument;
use App\Entity\CompanyDocument;
use App\Entity\Member;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CaseDocumentFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$docs = $options['docs'];
$builder
->add('document', EntityType::class, [
'class' => CompanyDocument::class,
'choices' => $docs,
'multiple' => true,
'expanded' => true,
'choice_label' => 'title',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => CaseDocument::class,
'docs' => [],
]);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Form;
use App\Enums\DocumentExtras;
use App\Entity\Company;
use App\Entity\CompanyDocument;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CompanyDocumentFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('title')
->add('text', TextareaType::class)
->add('extras', EnumType::class, [
'class' => DocumentExtras::class,
'multiple' => true,
'expanded' => true,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => CompanyDocument::class,
]);
}
}

View File

@ -5,6 +5,7 @@ namespace App\Form;
use App\DataTransferObject\CompanyDetailsDto; use App\DataTransferObject\CompanyDetailsDto;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
@ -41,8 +42,9 @@ class CompanyFormType extends AbstractType
]) ])
->add('email', EmailType::class, [ ->add('email', EmailType::class, [
'required' => true 'required' => true
]) ])
->add('url', UrlType::class) ->add('url', UrlType::class)
->add('companyLogo', FileType::class)
; ;
} }

View File

@ -0,0 +1,51 @@
<?php
namespace App\Form;
use App\Entity\Company;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class InternalCompanyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class, [
'required' => true,
'attr' => [
'placeholder' => 'Company Name',
'class' => 'form-control',
'autofocus' => true,
'autocomplete' => 'off'
]
])
->add('address', TextType::class)
->add('city', TextType::class)
->add('state', TextType::class)
->add('zip', TextType::class)
->add('phone', TextType::class)
->add('email', EmailType::class)
->add('url', UrlType::class, ['required' => false])
->add('companyLogo', FileType::class, [
'required' => false,
'mapped' => false
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Company::class,
'csrf_protection' => true,
'csrf_field_name' => '_token',
'csrf_token_id' => 'company',
]);
}
}

View File

@ -2,12 +2,14 @@
namespace App\Form; namespace App\Form;
use App\Entity\CompanyDocument;
use App\Entity\MemberCase; use App\Entity\MemberCase;
use App\Entity\ReferralSource; use App\Entity\ReferralSource;
use App\Enums\CaseLevel; use App\Enums\CaseLevel;
use App\Enums\County; use App\Enums\County;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
@ -60,6 +62,11 @@ class MemberCaseFormType extends AbstractType
->add('county', EnumType::class, [ ->add('county', EnumType::class, [
'class' => County::class, 'class' => County::class,
]) ])
->add('docs', ChoiceType::class, [
'data_class' => CompanyDocument::class,
'multiple' => true,
'expanded' => true,
])
; ;
} }
@ -67,6 +74,7 @@ class MemberCaseFormType extends AbstractType
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => MemberCase::class, 'data_class' => MemberCase::class,
'docs' => [],
'csrf_protection' => true, 'csrf_protection' => true,
'csrf_field_name' => '_token', 'csrf_field_name' => '_token',
'csrf_token_id' => 'member_case', 'csrf_token_id' => 'member_case',

View File

@ -3,8 +3,13 @@
namespace App\Libs; namespace App\Libs;
use App\Entity\Location; use App\Entity\Location;
use App\Entity\Messages;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class Libs class Libs extends AbstractController
{ {
public static function getLatLonFromGeoapify($address): ?array public static function getLatLonFromGeoapify($address): ?array
{ {
@ -61,6 +66,27 @@ class Libs
return null; return null;
} }
#[Route('/api/autocomplete-address/{searchText}', name: 'app_api_autocomplete_address')]
public function autocompleteAddress(string $searchText): Response
{
$params = [
'text' => $searchText,
'format' => 'json',
'apiKey' => $_ENV['GEOAPIFY_API_KEY']
];
$url = "https://api.geoapify.com/v1/autocomplete?".http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
curl_close($ch);
return AbstractController::json($result);
}
public static function Phone(string $phone): string public static function Phone(string $phone): string
{ {
$phone = preg_replace('/[^0-9]/', '', $phone); $phone = preg_replace('/[^0-9]/', '', $phone);
@ -69,4 +95,17 @@ class Libs
} }
return $phone; return $phone;
} }
public static function formatPhone(string $phone): string
{
$phone = self::Phone($phone);
return "(".substr($phone, 0, 3).") ".substr($phone, 3, 3)."-".substr($phone, 6);
}
public static function getMessages(User $user, EntityManagerInterface $em): array
{
$msgs = $em->getRepository(Messages::class)->getUnreadMessages($user);
return $msgs;
}
} }

View File

@ -4,20 +4,23 @@ namespace App\Libs;
class NavList class NavList
{ {
public const DEFAULT = 'nav-link text-dark';
public const LIST = [ public const LIST = [
'admin_dashboard' => 'nav-link text-dark', 'admin_dashboard' => self::DEFAULT,
'user_dashboard' => 'nav-link text-dark', 'user_dashboard' => self::DEFAULT,
'profile' => 'nav-link text-dark', 'profile' => self::DEFAULT,
'user_list' => 'nav-link text-dark', 'user_list' => self::DEFAULT,
'staff_dashboard' => 'nav-link text-dark', 'staff_dashboard' => self::DEFAULT,
'case_list' => 'nav-link text-dark', 'case_list' => self::DEFAULT,
'add_user' => 'nav-link text-dark', 'add_user' => self::DEFAULT,
'referral_sources' => 'nav-link text-dark', 'referral_sources' => self::DEFAULT,
'case_notes' => 'nav-link text-dark', 'case_notes' => self::DEFAULT,
'community_resources' => 'nav-link text-dark', 'community_resources' => self::DEFAULT,
'my_cases' => 'nav-link text-dark', 'my_cases' => self::DEFAULT,
'staff_notes' => 'nav-link text-dark', 'staff_notes' => self::DEFAULT,
'case_itinerary' => 'nav-link text-dark', 'case_itinerary' => self::DEFAULT,
'company_nav' => self::DEFAULT,
]; ];
public const PRESENT_LINK = 'nav-link text-white active bg-gradient-dark'; public const PRESENT_LINK = 'nav-link text-white active bg-gradient-dark';

View File

@ -6,6 +6,8 @@ use App\Entity\CaseItinerary;
use App\Entity\MemberCase; use App\Entity\MemberCase;
use App\Entity\User; use App\Entity\User;
use App\Entity\UserCase; use App\Entity\UserCase;
use DateTime;
use DateTimeZone;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
@ -21,8 +23,6 @@ class CaseItineraryRepository extends ServiceEntityRepository
public function getRecentTravel(User $user, ?array $params = null): ?array public function getRecentTravel(User $user, ?array $params = null): ?array
{ {
//dd($params);
$query = $this->createQueryBuilder('ci') $query = $this->createQueryBuilder('ci')
->leftJoin(UserCase::class, 'uc', 'WITH', 'uc.memberCase = ci.memberCase') ->leftJoin(UserCase::class, 'uc', 'WITH', 'uc.memberCase = ci.memberCase')
->andWhere('uc.user = :user') ->andWhere('uc.user = :user')
@ -49,6 +49,40 @@ class CaseItineraryRepository extends ServiceEntityRepository
return $query->getQuery()->getResult(); return $query->getQuery()->getResult();
} }
public function getYTDTravel(User $user): ?array
{
$startDate = new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
$query = $this->createQueryBuilder('ci')
->leftJoin(UserCase::class, 'uc', 'WITH', 'uc.memberCase = ci.memberCase')
->andWhere('uc.user = :user')
->setParameter('user', $user->getId()->toBinary())
->andWhere('ci.date >= :from')
->setParameter('from', $startDate->format('Y-01-01'))
->orderBy('ci.date', 'DESC')
->addOrderBy('ci.arrival', 'DESC')
;
return $query->getQuery()->getResult();
}
public function getTravelLast30Days(User $user): ?array
{
$startDate = new DateTime('now', new DateTimeZone($_ENV['COMPANY_TIMEZONE']));
$query = $this->createQueryBuilder('ci')
->leftJoin(UserCase::class, 'uc', 'WITH', 'uc.memberCase = ci.memberCase')
->andWhere('uc.user = :user')
->setParameter('user', $user->getId()->toBinary())
->andWhere('ci.date >= :from')
->setParameter('from', $startDate->modify('-30 days')->format('Y-m-d'))
->orderBy('ci.date', 'DESC')
->addOrderBy('ci.arrival', 'DESC')
;
return $query->getQuery()->getResult();
}
// /** // /**
// * @return CaseLocation[] Returns an array of CaseLocation objects // * @return CaseLocation[] Returns an array of CaseLocation objects
// */ // */

View File

@ -20,7 +20,7 @@ class MemberRepository extends ServiceEntityRepository
public function getCaseMembersByName(MemberCase $case): array public function getCaseMembersByName(MemberCase $case): array
{ {
return $this->createQueryBuilder('m') return $this->createQueryBuilder('m')
->andWhere('m.caseId = :case') ->andWhere('m.memberCase = :case')
->setParameter('case', $case->getId()->toBinary()) ->setParameter('case', $case->getId()->toBinary())
->orderBy('m.lastName, m.firstName', 'ASC') ->orderBy('m.lastName, m.firstName', 'ASC')
->getQuery() ->getQuery()

View File

@ -24,7 +24,6 @@ class MessagesRepository extends ServiceEntityRepository
->andWhere('m.received IS NULL') ->andWhere('m.received IS NULL')
->setParameter('recipient', $user->getId()->toBinary()) ->setParameter('recipient', $user->getId()->toBinary())
->orderBy('m.sent', 'ASC') ->orderBy('m.sent', 'ASC')
->setMaxResults(5)
->getQuery() ->getQuery()
->getResult() ->getResult()
; ;

View File

@ -81,6 +81,15 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div class='input-group input-group-outline mb-3'>
{% for d in docs %}
<span class='check'>
<input type='checkbox' name='{{ field_name(form.docs) }}[]' id='{{ d.title|replace({' ': '-'}) }}' value='{{ d.id }}'/>
<label for='{{ d.title|replace({' ': '-'}) }}'>{{ d.title }}</label>
</span>
{% endfor %}
</div>
</div> </div>
<div class='col'> <div class='col'>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>
@ -151,3 +160,11 @@
</section> </section>
</main> </main>
{% endblock %} {% endblock %}
{% block page_css %}
<style type='text/css'>
.check {
margin: 0 5px;
}
</style>
{% endblock %}

View File

@ -31,12 +31,12 @@
<div class='input-group input-group-outline mb-3 is-filled'> <div class='input-group input-group-outline mb-3 is-filled'>
<label for='case_form_admitDate' class='form-label'>Admit Date</label> <label for='case_form_admitDate' class='form-label'>Admit Date</label>
<input type='date' name='{{ field_name(form.admitDate) }}' id='case_form_admitDate' value='{{ case.admitDate|date('Y-m-d') }}' class='form-control'/> <input type='date' name='{{ field_name(form.admitDate) }}' id='case_form_admitDate' value='{{ case.admitDate|date('Y-m-d', company_timezone) }}' class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3{% if case.closeDate %} is-filled{% endif %}'> <div class='input-group input-group-outline mb-3{% if case.closeDate %} is-filled{% endif %}'>
<label for='case_form_closeDate' class='form-label'>Close Date</label> <label for='case_form_closeDate' class='form-label'>Close Date</label>
<input type='date' name='{{ field_name(form.closeDate) }}' id='case_form_closeDate' value='{% if case.closeDate %}{{ case.closeDate|date('Y-m-d') }}{% endif %}' class='form-control'/> <input type='date' name='{{ field_name(form.closeDate) }}' id='case_form_closeDate' value='{% if case.closeDate %}{{ case.closeDate|date('Y-m-d', company_timezone) }}{% endif %}' class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>

View File

@ -86,20 +86,20 @@
</td> </td>
<td class='align-right'> <td class='align-right'>
{% if is_granted('ROLE_CASE_MANAGER') or is_granted('ROLE_ADMIN') %} {% if is_granted('ROLE_CASE_MANAGER') or is_granted('ROLE_ADMIN') %}
<a href='{{ path('app_edit_case', {id: c.id}) }}' class='' title='Edit Case' data-toggle='tooltip'> <a href='{{ path('app_edit_case', {id: c.id}) }}' class='text-secondary ' title='Edit Case' data-toggle='tooltip'>
<i class="material-symbols-rounded opacity-5">edit</i> <i class="material-symbols-rounded opacity-5">edit</i>
</a> </a>
<a href='{{ path('app_assign_case', {id: c.id}) }}' class='' title='Assign Case Worker' data-toggle='tooltip'> <a href='{{ path('app_assign_case', {id: c.id}) }}' class='text-secondary ' title='Assign Case Worker' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>badge</i> <i class='material-symbols-rounded opacity-5'>badge</i>
</a> </a>
{% endif %} {% endif %}
<a href='{{ path('app_list_referrals', {id: c.id}) }}' class='' title='List Referrals' data-toggle='tooltip'> <a href='{{ path('app_list_referrals', {id: c.id}) }}' class='text-secondary ' title='List Referrals' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>create_new_folder</i> <i class='material-symbols-rounded opacity-5'>create_new_folder</i>
</a> </a>
<a href='{{ path('app_case_members', {id: c.id}) }}' class='' title='List Members' data-toggle='tooltip'> <a href='{{ path('app_case_members', {id: c.id}) }}' class='text-secondary ' title='List Members' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>group_add</i> <i class='material-symbols-rounded opacity-5'>group_add</i>
</a> </a>
<a href='{{ path('app_case_notes', {id: c.id}) }}' class='' title='Show Notes' data-toggle='tooltip'> <a href='{{ path('app_case_notes', {id: c.id}) }}' class='text-secondary ' title='Show Notes' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>clinical_notes</i> <i class='material-symbols-rounded opacity-5'>clinical_notes</i>
</a> </a>
</td> </td>

View File

@ -58,7 +58,9 @@
{{ src.phone }} {{ src.phone }}
</td> </td>
<td class='align-middle'> <td class='align-middle'>
<a href="{{ path('app_edit_source', {id: src.id}) }}" class='text-secondary font-weight-bold text-xs' data-toggle='tooltip' data-original-title='Edit Source'>Edit</a> <a href="{{ path('app_edit_source', {id: src.id}) }}" class='text-secondary font-weight-bold text-xs'>
<i class='material-symbols-rounded opacity-5'>edit</i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -49,9 +49,7 @@
<td> <td>
<div class='d-flex px-2 py-1'> <div class='d-flex px-2 py-1'>
<div class='d-flex flex-column justify-content-center'> <div class='d-flex flex-column justify-content-center'>
<h6 class='mb-0 text-small'> <h6 class='mb-0 text-small'>{{ l.name }}</h6>
{{ l.name }}
</h6>
</div> </div>
</div> </div>
</td> </td>
@ -62,7 +60,7 @@
{{ l.lat }}/{{ l.lon }} {{ l.lat }}/{{ l.lon }}
</td> </td>
<td class='align-middle'> <td class='align-middle'>
<a href='{{ path('app_case_edit_address', {id: l.id}) }}' title='Edit Location'> <a href='{{ path('app_case_edit_address', {id: l.id}) }}' class='text-secondary' title='Edit Location'>
<i class="material-symbols-rounded opacity-5">edit</i> <i class="material-symbols-rounded opacity-5">edit</i>
</a> </a>
</td> </td>

View File

@ -55,7 +55,7 @@
<tbody id='itineraryList'> <tbody id='itineraryList'>
{% for i in itineraries %} {% for i in itineraries %}
<tr> <tr>
<td>{{ i.date|date('F j, Y') }}</td> <td>{{ i.date|date('F j, Y', company_timezone) }}</td>
<td>{{ i.memberCase.caseName }}</td> <td>{{ i.memberCase.caseName }}</td>
<td>{{ i.originLocation.name }}</td> <td>{{ i.originLocation.name }}</td>
<td>{{ i.destLocation.name }}</td> <td>{{ i.destLocation.name }}</td>

View File

@ -73,9 +73,12 @@
{% endif %} {% endif %}
</td> </td>
<td class='align-middle'> <td class='align-middle'>
<a href='{{ path('app_case_edit_member', {caseId: case.id, memberId: member.id}) }}' title='Edit Member'> <a href='{{ path('app_case_edit_member', {caseId: case.id, memberId: member.id}) }}' class='text-secondary' title='Edit Member'>
<i class="material-symbols-rounded opacity-5">edit</i> <i class="material-symbols-rounded opacity-5">edit</i>
</a> </a>
<a href='{{ path('app_assign_case_documents', {caseId: case.id, memberId: member.id}) }}' class='text-secondary' title='Assign Case Document'>
<i class='material-symbols-rounded opacity-5'>content_copy</i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -60,16 +60,16 @@
<p class='text-center text-xs font-weight-bold mb-0'>{{ c.referrals|length }}</p> <p class='text-center text-xs font-weight-bold mb-0'>{{ c.referrals|length }}</p>
</td> </td>
<td class='align-right'> <td class='align-right'>
<a href='{{ path('app_view_case', {caseId: c.id}) }}' title='View Case'> <a href='{{ path('app_view_case', {caseId: c.id}) }}' class='text-secondary' title='View Case'>
<i class='material-symbols-rounded opacity-5'>visibility</i> <i class='material-symbols-rounded opacity-5'>visibility</i>
</a> </a>
<a href='{{ path('app_list_referrals', {id: c.id}) }}' title='List Referrals'> <a href='{{ path('app_list_referrals', {id: c.id}) }}' class='text-secondary' title='List Referrals'>
<i class='material-symbols-rounded opacity-5'>create_new_folder</i> <i class='material-symbols-rounded opacity-5'>create_new_folder</i>
</a> </a>
<a href='{{ path('app_case_members', {id: c.id}) }}' title='List Members'> <a href='{{ path('app_case_members', {id: c.id}) }}' class='text-secondary' title='List Members'>
<i class='material-symbols-rounded opacity-5'>group_add</i> <i class='material-symbols-rounded opacity-5'>group_add</i>
</a> </a>
<a href='{{ path('app_case_notes', {id: c.id}) }}' title='Show Notes'> <a href='{{ path('app_list_notes', {caseId: c.id}) }}' class='text-secondary' title='Show Notes'>
<i class='material-symbols-rounded opacity-5'>clinical_notes</i> <i class='material-symbols-rounded opacity-5'>clinical_notes</i>
</a> </a>
</td> </td>

View File

@ -32,7 +32,7 @@
</span> </span>
<span class='col {{ endDateWarning }}'> <span class='col {{ endDateWarning }}'>
Expiration Date: Expiration Date:
{{ referral.endDate|date('M j, Y') }} {{ referral.endDate|date('M j, Y', company_timezone) }}
</span> </span>
</div> </div>
<div class='row' style='margin-top:10px;'> <div class='row' style='margin-top:10px;'>

View File

@ -32,7 +32,7 @@
</span> </span>
<span class='col {{ endDateWarning }}'> <span class='col {{ endDateWarning }}'>
Expiration Date: Expiration Date:
{{ referral.endDate|date('M j, Y') }} {{ referral.endDate|date('M j, Y', company_timezone) }}
</span> </span>
</div> </div>
<div class='row' style='margin-top:10px;'> <div class='row' style='margin-top:10px;'>

View File

@ -0,0 +1,292 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
{{ block('topnav', 'internal/libs/top-nav.html.twig') }}
{% if noteType == 'visit' %}
<section>
<div class="card card-plain">
<div class="card-header">
<h4 class="font-weight-bolder">Edit Referral Note</h4>
<p class="mb-0">{{ referral.memberCase.caseName }}</p>
</div>
<div class="card-body">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class='container'>
<div class='row'>
{% set endDateWarning = '' %}
{% if date("+28 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-warning' %}
{% elseif date("+14 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-danger text-white' %}
{% endif %}
<span class='col{% if referral.getHoursRemaining() < 40 %} bg-gradient-danger text-white{% endif %}'>
Hours:
{{ referral.hours }}
/
Remaining:
{{ referral.getHoursRemaining() }}
</span>
<span class='col {{ endDateWarning }}'>
Expiration Date:
{{ referral.endDate|date('M j, Y', company_timezone) }}
</span>
</div>
<div class='row' style='margin-top:10px;'>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_date'></label>
<input type='date' name='{{ field_name(form.date) }}' value='{{ field_value(form.date) }}' id='note_form_date' class='form-control' title='Visit Date'/>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_startTime'></label>
<input type='time' name='{{ field_name(form.startTime) }}' value='{{ field_value(form.startTime) }}' id='note_form_startTime' onchange='calcTime()' class='form-control' title='Start Time'/>&nbsp;&nbsp;
<label for='note_form_endTime'></label>
<input type='time' name='{{ field_name(form.endTime) }}' value='{{ field_value(form.endTime) }}' id='note_form_endTime' onchange='calcTime()' class='form-control' title='End Time'/>
</div>
<div class='input-group input-group-outline mb-3'>
<input type='text' id='case-mins' style='width:49%;margin-right:5px;' disabled='disabled' title='Case Minutes'/>
<input type='text' id='case-hours' style='width:49%;margin-left:5px;' disabled='disabled' title='Case Hours'/>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.status) }}' id='note_form_status' class='form-control'>
<option value=''>-- Status --</option>
{% for s in enum('App\\Enums\\NoteStatus').cases() %}
<option value='{{ s.value }}' {% if s.value == note.status.value %} selected='selected' {% endif %}>{{ s.value|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.location) }}' id='note_form_location' class='form-control'>
<option value=''>-- Location --</option>
{% for l in enum('App\\Enums\\NoteLocation').cases() %}
<option value='{{ l.value }}' {% if l.value == note.location.value %} selected='selected' {% endif %}>{{ l.value }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.method) }}' id='note_form_method' class='form-control'>
<option value=''>-- Method --</option>
{% for m in enum('App\\Enums\\NoteMethod').cases() %}
<option value='{{ m.value }}' {% if m.value == note.method.value %} selected='selected' {% endif %}>{{ m.name|replace({'_': ' '})|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_parentalRole'>Parental Role</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.parentalRole) }}' id='note_form_parentalRole' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q.value == note.parentalRole.value %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_childDevelopment'>Child Development</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.childDevelopment) }}' id='note_form_childDevelopment' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q.value == note.childDevelopment.value %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_appropriateResponse'>Appropriate Response</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.appropriateResponse) }}' id='note_form_appropriateResponse' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q.value == note.appropriateResponse.value %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_childAheadOfSelf'>Child Ahead Of Self</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.childAheadOfSelf) }}' id='note_form_childAheadOfSelf' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q.value == note.childAheadOfSelf.value %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_showsEmpathy'>Shows Empathy</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.showsEmpathy) }}' id='note_form_showsEmpathy' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q.value == note.showsEmpathy.value %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_childFocused'>Child Focused</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.childFocused) }}' id='note_form_childFocused' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q.value == note.childFocused.value %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
</div>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
{{ form_row(form.members, {
'label': 'Members Present',
'label_attr': {'class': ''},
'attr': {'class': 'form-control'}
}) }}
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_narrative'>Observed Narrative</label>
<textarea name='{{ field_name(form.narrative) }}' id='note_form_narrative' class='form-control' style='width:100%;height:200px;'>{{ field_value(form.narrative) }}</textarea>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_strengths'>Observed Strengths</label>
<textarea name='{{ field_name(form.strengths) }}' id='note_form_strengths' class='form-control' style='width:100%;height:200px;'>{{ field_value(form.strengths) }}</textarea>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_issues'>Observed Issues</label>
<textarea name='{{ field_name(form.issues) }}' id='note_form_issues' class='form-control' style='width:100%;height:100px;'>{{ field_value(form.issues) }}</textarea>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_recommendation'>Recommendation</label>
<textarea name='{{ field_name(form.recommendation) }}' id='note_form_recommendation' class='form-control' style='width:100%;height:100px;'>{{ field_value(form.recommendation) }}</textarea>
</div>
</div>
</div>
<div class='row'>
<div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Save Note</button>
</div>
</div>
</div>
{{ form_end(form) }}
</div>
</div>
</section>
{% elseif noteType == 'standard' %}
<section>
<div class="card card-plain">
<div class="card-header">
<h4 class="font-weight-bolder">Add Referral Note</h4>
<p class="mb-0">{{ referral.memberCase.caseName }}</p>
</div>
<div class="card-body">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class='container'>
<div class='row'>
{% set endDateWarning = '' %}
{% if date("+28 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-warning' %}
{% elseif date("+14 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-danger text-white' %}
{% endif %}
<span class='col{% if referral.hours < 40 %} bg-gradient-danger text-white{% endif %}'>
Hours:
{{ referral.hours }}
/
Remaining:
{{ referral.getHoursRemaining() }}
</span>
<span class='col {{ endDateWarning }}'>
Expiration Date:
{{ referral.endDate|date('M j, Y', company_timezone) }}
</span>
</div>
<div class='row' style='margin-top:10px;'>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_date'></label>
<input type='date' name='{{ field_name(form.date) }}' id='note_form_date' class='form-control' title='Visit Date'/>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_startTime'></label>
<input type='time' name='{{ field_name(form.startTime) }}' id='note_form_startTime' onchange='calcTime()' class='form-control' title='Start Time'/>&nbsp;&nbsp;
<label for='note_form_endTime'></label>
<input type='time' name='{{ field_name(form.endTime) }}' id='note_form_endTime' onchange='calcTime()' class='form-control' title='End Time'/>
</div>
<div class='input-group input-group-outline mb-3'>
<input type='text' id='case-mins' style='width:49%;margin-right:5px;' disabled='disabled' title='Case Minutes'/>
<input type='text' id='case-hours' style='width:49%;margin-left:5px;' disabled='disabled' title='Case Hours'/>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.status) }}' id='note_form_status' class='form-control'>
<option value=''>-- Status --</option>
{% for s in enum('App\\Enums\\NoteStatus').cases() %}
<option value='{{ s.value }}'>{{ s.value|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.location) }}' id='note_form_location' class='form-control'>
<option value=''>-- Location --</option>
{% for l in enum('App\\Enums\\NoteLocation').cases() %}
<option value='{{ l.value }}' {% if l == default_location %} selected='selected' {% endif %}>{{ l.value }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.method) }}' id='note_form_method' class='form-control'>
<option value=''>-- Method --</option>
{% for m in enum('App\\Enums\\NoteMethod').cases() %}
<option value='{{ m.value }}' {% if m == default_method %} selected='selected' {% endif %}>{{ m.name|replace({'_': ' '})|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
</div>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
{{ form_row(form.members, {
'label': 'Members Present',
'label_attr': {'class': ''},
'attr': {'class': 'form-control'}
}) }}
</div>
<div class='input-group input-group-outline mb-3'>
<label for='case_note_note' class='form-label'>Notes</label>
<textarea name='{{ field_name(form.note) }}' id='case_note_note' class='form-control' style='width:100%;height:300px;'></textarea>
</div>
</div>
</div>
<div class='row'>
<div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Save Note</button>
</div>
</div>
</div>
{{ form_end(form) }}
</div>
</div>
</section>
{% endif %}
</main>
{% endblock %}

View File

@ -16,21 +16,6 @@
<h6 class="text-white text-capitalize ps-3">Referral Note List</h6> <h6 class="text-white text-capitalize ps-3">Referral Note List</h6>
</div> </div>
<div> <div>
<select id='referralList' onchange='filterNotes()'>
<option value=''>-- Select Referral --</option>
{% for c in cases %}
<optgroup label='{{ c.memberCase.caseName }}'>
{% for r in c.memberCase.referrals %}
<option value='{{ r.id }}'>
{{ r.referralId }}
/
{{ r.serviceCode.value }}
</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>&nbsp;&nbsp;
<button type="button" class="btn btn-block btn-light mb-3" onclick="window.open('/index.php/add-note/'+document.getElementById('referralList').value, '_self')">Add Note</button> <button type="button" class="btn btn-block btn-light mb-3" onclick="window.open('/index.php/add-note/'+document.getElementById('referralList').value, '_self')">Add Note</button>
</div> </div>
</div> </div>
@ -38,15 +23,33 @@
<div class="card-body px-0 pb-2"> <div class="card-body px-0 pb-2">
<div> <div>
Filter:&nbsp;&nbsp; Filter:&nbsp;&nbsp;
<input type='date' id='startDate' onchange='filterNotes()' title='Start Date'/>&nbsp;&nbsp; <select id='referralList'>
<input type='date' id='endDate' onchange='filterNotes()' title='End Date'/> <option value=''>-- Select Referral --</option>
{% for c in cases %}
<optgroup label='{{ c.memberCase.caseName }}'>
<option value='case-{{ c.memberCase.id }}' {% if case and case.id == c.memberCase.id %} selected='selected' {% endif %}>{{ c.memberCase.caseName }} All Referrals</option>
{% for r in c.memberCase.referrals %}
<option value='{{ r.id }}'>
{{ c.memberCase.caseName }}
/
{{ r.referralId }}
/
{{ r.serviceCode.value }}
</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>&nbsp;&nbsp;
<input type='date' id='startDate' title='Start Date'/>&nbsp;&nbsp;
<input type='date' id='endDate' title='End Date'/>&nbsp;&nbsp;
<button name='filter-notes' id='filter-notes'>Filter Notes</button>
</div> </div>
<div class="table-responsive p-0"> <div class="table-responsive p-0">
<table class="table align-items-center mb-0"> <table class="table align-items-center mb-0">
<thead> <thead>
<tr> <tr>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">DOS</th> <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">DOS</th>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Service</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Location</th> <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Location</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Method</th> <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Method</th>
<th class='text-right text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Members Present</th> <th class='text-right text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Members Present</th>
@ -54,22 +57,22 @@
</tr> </tr>
</thead> </thead>
<tbody id='note-list'> <tbody id='note-list'>
{% for note in notes %} {% if caseNotes %}
{% set members = note.getMembers() %} {% for n in caseNotes %}
<tr> <tr>
<td> <td>{{ n.date|date("F j, Y", company_timezone) }}<br/>
{{ note.date|date('M j, Y') }}<br/> {{ n.startTime|date("g:i a", company_timezone) }}-{{ n.endTime|date("g:i a", company_timezone) }} ({{ n.calcTimeUsed() }})</td>
{{ note.startTime|date('g:i a') }}-{{ note.endTime|date('g:i a') }} <td class='text-center'>{{ n.location.value }}</td>
</td> <td class='text-center'>{{ n.method.name|lower|replace({"_": " "})|capitalize }}</td>
<td>{{ note.referral.serviceCode.value }}</td> <td></td>
<td class='text-center'>{{ note.location.value }}</td> <td style='text-align: right;'>
<td>{{ note.method.name|replace({'_': ' '})|lower|capitalize }}</td> <a href='/edit-note/{{ n.id }}' class='text-secondary' title='Edit Note'>
<td> <i class="material-symbols-rounded opacity-5">edit</i>
{{ dump(members) }} </a>
</td> </td>
<td></td> </tr>
</tr> {% endfor %}
{% endfor %} {% endif %}
</tbody> </tbody>
</table> </table>
</div> </div>
@ -80,3 +83,15 @@
</div> </div>
</main> </main>
{% endblock %} {% endblock %}
{% block page_js %}
<script type='module'>
import $ from "{{ asset('vendor/jquery/jquery.index.js') }}";
import {filterNotes} from "{{ asset('js/app/notes.js') }}";
window.$ = $;
$(function () {
$('#filter-notes').click(filterNotes);
});
</script>
{% endblock %}

View File

@ -41,7 +41,7 @@
<div class='input-group input-group-outline mb-3 is-filled'> <div class='input-group input-group-outline mb-3 is-filled'>
<label for='referral_form_endDate' class='form-label'></label> <label for='referral_form_endDate' class='form-label'></label>
<input type='date' name='{{ field_name(form.endDate) }}' id='referral_form_endDate' value='{{ referral.endDate|date("Y-m-d") }}' class='form-control'/> <input type='date' name='{{ field_name(form.endDate) }}' id='referral_form_endDate' value='{{ referral.endDate|date("Y-m-d", company_timezone) }}' class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>

View File

@ -113,7 +113,7 @@
<p class='text-xs font-weight-bold mb-0'>{{ r.dischargeReason.value }}</p> <p class='text-xs font-weight-bold mb-0'>{{ r.dischargeReason.value }}</p>
</td> </td>
<td> <td>
<p class='text-xs font-weight-bold mb-0'>{{ r.dischargeDate|date("F j, Y") }}</p> <p class='text-xs font-weight-bold mb-0'>{{ r.dischargeDate|date("F j, Y", company_timezone) }}</p>
</td> </td>
<td class='align-right'></td> <td class='align-right'></td>
</tr> </tr>

View File

@ -28,12 +28,12 @@
<div class='input-group input-group-outline mb-3 is-filled'> <div class='input-group input-group-outline mb-3 is-filled'>
<label for='case_form_admitDate' class='form-label'>Admit Date</label> <label for='case_form_admitDate' class='form-label'>Admit Date</label>
<input type='date' name='admitDate' id='case_form_admitDate' value='{{ case.admitDate|date('Y-m-d') }}' class='form-control'/> <input type='date' name='admitDate' id='case_form_admitDate' value='{{ case.admitDate|date('Y-m-d', company_timezone) }}' class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3{% if case.closeDate %} is-filled{% endif %}'> <div class='input-group input-group-outline mb-3{% if case.closeDate %} is-filled{% endif %}'>
<label for='case_form_closeDate' class='form-label'></label> <label for='case_form_closeDate' class='form-label'></label>
<input type='date' name='closeDate' id='case_form_closeDate' value='{% if case.closeDate %}{{ case.closeDate|date('Y-m-d') }}{% endif %}' class='form-control'/> <input type='date' name='closeDate' id='case_form_closeDate' value='{% if case.closeDate %}{{ case.closeDate|date('Y-m-d', company_timezone) }}{% endif %}' class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>

View File

@ -4,7 +4,7 @@
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{% set today = date("now", "America/Indiana/Indianapolis") %} {% set today = date("now", company_timezone) %}
{{ block('nav', 'internal/libs/nav.html.twig') }} {{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg "> <main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
@ -61,10 +61,10 @@
<td>{{ r.getHours() }}</td> <td>{{ r.getHours() }}</td>
<td>{{ r.lat|number_format(6) }}/{{ r.lon|number_format(6) }}</td> <td>{{ r.lat|number_format(6) }}/{{ r.lon|number_format(6) }}</td>
<td class='align-right'> <td class='align-right'>
<a href='{{ path('app_community_resource_edit', {id: r.id}) }}' title='Edit Resource'> <a href='{{ path('app_community_resource_edit', {id: r.id}) }}' class='text-secondary' title='Edit Resource'>
<i class="material-symbols-rounded opacity-5">edit</i> <i class="material-symbols-rounded opacity-5">edit</i>
</a> </a>
<a href='{{ path('app_community_resource_download', {id: r.id}) }}' title='Download vCard'> <a href='{{ path('app_community_resource_download', {id: r.id}) }}' class='text-secondary' title='Download vCard'>
<i class="material-symbols-rounded opacity-5">import_contacts</i> <i class="material-symbols-rounded opacity-5">import_contacts</i>
</a> </a>
</td> </td>

View File

@ -4,7 +4,7 @@
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{% set today = date("now", "America/Indiana/Indianapolis") %} {% set today = date("now", company_timezone) %}
{{ block('nav', 'internal/libs/nav.html.twig') }} {{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg "> <main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">

View File

@ -3,7 +3,11 @@
<div class="sidenav-header"> <div class="sidenav-header">
<i class="fas fa-times p-3 cursor-pointer text-dark opacity-5 position-absolute end-0 top-0 d-none d-xl-none" aria-hidden="true" id="iconSidenav"></i> <i class="fas fa-times p-3 cursor-pointer text-dark opacity-5 position-absolute end-0 top-0 d-none d-xl-none" aria-hidden="true" id="iconSidenav"></i>
<a class="navbar-brand px-4 py-3 m-0" href="{{ path('app_dashboard') }}"> <a class="navbar-brand px-4 py-3 m-0" href="{{ path('app_dashboard') }}">
<img src="{{ asset('img/logo-ct-dark.png') }}" class="navbar-brand-img" width="26" height="26" alt="main_logo"> {% if app.user.company.companyLogo %}
<img src="/uploads/company/{{ app.user.company.companyLogo }}" class="navbar-brand-img" width="30" height="30" alt="main_logo">
{% else %}
<img src="{{ asset('img/logo-ct-dark.png') }}" class="navbar-brand-img" width="30" height="30" alt="main_logo">
{% endif %}
<span class="ms-1 text-sm text-dark">CM Tracker</span> <span class="ms-1 text-sm text-dark">CM Tracker</span>
</a> </a>
</div> </div>
@ -26,6 +30,12 @@
<span class="nav-link-text ms-1">Admin Dashboard</span> <span class="nav-link-text ms-1">Admin Dashboard</span>
</a> </a>
</li> </li>
<li class='nav-item'>
<a class='{{ company_nav }}' href='{{ path('app_company') }}'>
<i class='material-symbols-rounded opacity-5'>folder_open</i>
<span class='nav-link-text ms-1'>Company</span>
</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a class="{{ user_list }}" href="{{ path('app_list_users') }}"> <a class="{{ user_list }}" href="{{ path('app_list_users') }}">
<i class="material-symbols-rounded opacity-5">assignment</i> <i class="material-symbols-rounded opacity-5">assignment</i>

View File

@ -39,10 +39,10 @@
<li class="nav-item dropdown pe-3 d-flex align-items-center" title="Notifications"> <li class="nav-item dropdown pe-3 d-flex align-items-center" title="Notifications">
<a href="javascript:;" class="nav-link text-body p-0 notification" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false"> <a href="javascript:;" class="nav-link text-body p-0 notification" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
<i class="material-symbols-rounded">notifications</i> <i class="material-symbols-rounded">notifications</i>
<span class='badge' {% if notificationCount == 0 %} style='display:none;' {% endif %}>{{ notificationCount }}</span> <span class='badge' {% if (notifications|length) == 0 %} style='display:none;' {% endif %}>{{ notifications|length }}</span>
</a> </a>
<ul class="dropdown-menu dropdown-menu-end px-2 py-3 me-sm-n4" aria-labelledby="dropdownMenuButton"> <ul class="dropdown-menu dropdown-menu-end px-2 py-3 me-sm-n4" aria-labelledby="dropdownMenuButton">
{% for note in notifications %} {% for note in notifications|slice(0, 4) %}
<li class='mb-2'> <li class='mb-2'>
<a class='dropdown-item border-radius-md' href="javascript:openNotification('{{ note.id }}');"> <a class='dropdown-item border-radius-md' href="javascript:openNotification('{{ note.id }}');">
<div class='d-flex py-1'> <div class='d-flex py-1'>

View File

@ -39,41 +39,41 @@
<td> <td>
<div class='d-flex px-2 py-1'> <div class='d-flex px-2 py-1'>
<div class='d-flex flex-column justify-content-center'> <div class='d-flex flex-column justify-content-center'>
<h6 class='mb-0 text-small'>{{ n.date|date('F j, Y') }}</h6> <h6 class='mb-0 text-small'>{{ n.date|date('F j, Y', company_timezone) }}</h6>
</div> </div>
</div> </div>
</td> </td>
<td> <td>
{% if n.supervisorSignDateTime %} {% if n.supervisorSignDateTime %}
{{ n.supervisorSignDateTime|date('F j, Y h:i a') }} {{ n.supervisorSignDateTime|date('F j, Y h:i a', company_timezone) }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if n.workerSignDatetime %} {% if n.workerSignDatetime %}
{{ n.workerSignDatetime|date('F j, Y h:i a') }} {{ n.workerSignDatetime|date('F j, Y h:i a', company_timezone) }}
{% endif %} {% endif %}
</td> </td>
<td class='align-right'> <td class='align-right'>
{% if isWorker and not n.workerSignDatetime %} {% if isWorker and not n.workerSignDatetime %}
<a href='{{ path('app_staff_edit_note', {noteId: n.id}) }}' title='Edit Note'> <a href='{{ path('app_staff_edit_note', {noteId: n.id}) }}' class='text-secondary' title='Edit Note'>
<i class='material-symbols-rounded opacity-5'>edit</i> <i class='material-symbols-rounded opacity-5'>edit</i>
</a> </a>
<a href='{{ path('app_staff_sign_my_note', {noteId: n.id}) }}' title='Sign Note'> <a href='{{ path('app_staff_sign_my_note', {noteId: n.id}) }}' class='text-secondary' title='Sign Note'>
<i class='material-symbols-rounded opacity-5'>draw</i> <i class='material-symbols-rounded opacity-5'>draw</i>
</a> </a>
{% endif %} {% endif %}
{% if isWorker and n.workerSignDatetime %} {% if isWorker and n.workerSignDatetime %}
<a href='{{ path('app_staff_view_note', {noteId: n.id}) }}' title='View Note'> <a href='{{ path('app_staff_view_note', {noteId: n.id}) }}' class='text-secondary' title='View Note'>
<i class='material-symbols-rounded opacity-5'>visibility</i> <i class='material-symbols-rounded opacity-5'>visibility</i>
</a> </a>
{% endif %} {% endif %}
{% if not isWorker and not n.supervisorSignDateTime %} {% if not isWorker and not n.supervisorSignDateTime %}
<a href='{{ path('app_staff_sign_worker_note', {noteId: n.id}) }}' title='Sign Note'> <a href='{{ path('app_staff_sign_worker_note', {noteId: n.id}) }}' class='text-secondary' title='Sign Note'>
<i class='material-symbols-rounded opacity-5'>draw</i> <i class='material-symbols-rounded opacity-5'>draw</i>
</a> </a>
{% endif %} {% endif %}
{% if not isWorker and n.supervisorSignDateTime %} {% if not isWorker and n.supervisorSignDateTime %}
<a href='{{ path('app_staff_view_note', {noteId: n.id}) }}' title='View Note'> <a href='{{ path('app_staff_view_note', {noteId: n.id}) }}' class='text-secondary' title='View Note'>
<i class='material-symbols-rounded opacity-5'>visibility</i> <i class='material-symbols-rounded opacity-5'>visibility</i>
</a> </a>
{% endif %} {% endif %}

View File

@ -19,17 +19,17 @@
<div class='col'> <div class='col'>
<div> <div>
<div>Supervisor: <div>Supervisor:
{{ note.supervisorSignDateTime|date("F j, Y h:i a") }}</div> {{ note.supervisorSignDateTime|date("F j, Y h:i a", company_timezone) }}</div>
<div>Case Worker: <div>Case Worker:
{% if note.workerSignDatetime %} {% if note.workerSignDatetime %}
{{ note.workerSignDatetime|date("F j, Y h:i a") }}{% else %}Unsigned {{ note.workerSignDatetime|date("F j, Y h:i a", company_timezone) }}{% else %}Unsigned
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class='input-group input-group-outline mb-3'> <div class='input-group input-group-outline mb-3'>
<label for='note_form_date'></label> <label for='note_form_date'></label>
<input type='date' name='date' id='note_form_date' value='{{ note.date|date("Y-m-d") }}' disabled="disabled" class='form-control'/> <input type='date' name='date' id='note_form_date' value='{{ note.date|date("Y-m-d", company_timezone) }}' disabled="disabled" class='form-control'/>
</div> </div>
<div class='input-group input-group-outline mb-3 is-filled'> <div class='input-group input-group-outline mb-3 is-filled'>

View File

@ -19,7 +19,8 @@
<div> <div>
<h4 class='mb-0'>{{ s.name }}</h4> <h4 class='mb-0'>{{ s.name }}</h4>
<p class='text-sm mb-0 text-capitalize'> <p class='text-sm mb-0 text-capitalize'>
<a href='tel:'></a> <a href='mailto:{{ s.email }}'>{{ s.email }}</a><br />
{% if s.workPhone %}<a href='tel:{{ s.workPhone }}'>{{ s.getFormattedPhone() }}</a>{% endif %}
</p> </p>
</div> </div>
<div class="icon icon-md icon-shape bg-gradient-dark shadow-dark shadow text-center border-radius-lg"> <div class="icon icon-md icon-shape bg-gradient-dark shadow-dark shadow text-center border-radius-lg">
@ -30,8 +31,9 @@
<hr class='dark horizontal my-0'> <hr class='dark horizontal my-0'>
<div class='card-footer p-2 ps-3'> <div class='card-footer p-2 ps-3'>
<p class='mb-0 text-sm'> <p class='mb-0 text-sm'>
<span class='text-info font-weight-bolder'> <span class='font-weight-bolder'>
<a href='{{ path('app_staff_cases', {staffId: s.id}) }}'>Staff Cases</a> <button class='btn btn-primary bg-gradient-dark' onclick='window.location.href="{{ path('app_staff_cases', {staffId: s.id}) }}"'>Staff Cases</button>
<button class='btn btn-primary bg-gradient-dark' id='send-message' data-user-id='{{ s.id }}'>Send Message</button>
</span> </span>
</p> </p>
</div> </div>
@ -40,5 +42,43 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<div class='modal fade' id='message-modal' tabindex='-1' role='dialog' aria-labelledby='message-modal-title'>
<div class='modal-dialog modal-dialog-centered' role='document'>
<div class='modal-content'>
<div class="modal-header">
<h6 class="modal-title font-weight-normal" id="message-modal-label">Message Staff</h6>
<button type="button" class="btn-close text-dark" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class='modal-body'>
<form>
<input type='hidden' id='my-case' value=''/>
<div class='input-group input-group-outline my-3'>
<textarea name='message' id='message' style='width:100%;height:100px;'></textarea>
</div>
</form>
</div>
<div class='modal-footer'>
<button type='button' id='close-modal' class='btn bg-gradient-secondary' data-bs-dismiss='modal'>Close</button>
<button type='button' id='send-message' class='btn bg-gradient-primary'>Send Message</button>
</div>
</div>
</div>
</div>
</main> </main>
{% endblock %} {% endblock %}
{% block page_js %}
<script type='module'>
import $ from "{{ asset('vendor/jquery/jquery.index.js') }}";
import {openMessage, sendMessage} from '{{ asset("js/app/message.js") }}';
window.$ = $;
$(function () {
document.getElementById('open-message').addEventListener('click', openMessage);
document.getElementById('send-message').addEventListener('click', sendMessage);
});
</script>
{% endblock %}

View File

@ -2,7 +2,7 @@
<!-- Navbar --> <!-- Navbar -->
<nav class="navbar navbar-expand-lg blur border-radius-xl top-0 z-index-3 shadow position-absolute my-3 py-2 start-0 end-0 mx-4"> <nav class="navbar navbar-expand-lg blur border-radius-xl top-0 z-index-3 shadow position-absolute my-3 py-2 start-0 end-0 mx-4">
<div class="container-fluid ps-2 pe-0"> <div class="container-fluid ps-2 pe-0">
<a class="navbar-brand font-weight-bolder ms-lg-0 ms-3 " href="/index.php/dashboard"> <a class="navbar-brand font-weight-bolder ms-lg-0 ms-3 " href="{{ path('app_dashboard') }}">
CM Tracker CM Tracker
</a> </a>
<button class="navbar-toggler shadow-none ms-2" type="button" data-bs-toggle="collapse" data-bs-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler shadow-none ms-2" type="button" data-bs-toggle="collapse" data-bs-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation">
@ -15,16 +15,23 @@
<div class="collapse navbar-collapse" id="navigation"> <div class="collapse navbar-collapse" id="navigation">
<ul <ul
class="navbar-nav mx-auto"> class="navbar-nav mx-auto">
<!-- @todo only display when logged in --> {% if company is defined %}
<li class='nav-item'>
<a class='nav-link d-flex align-items-center me-2' href='{{ path('app_list_documents') }}'>
<i class='material-symbols-rounded opacity-5'>content_copy</i>
Company Documents
</a>
</li>
{% endif %}
{% if app.user %} {% if app.user %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link d-flex align-items-center me-2 active" aria-current="page" href="/index.php/dashboard"> <a class="nav-link d-flex align-items-center me-2 active" aria-current="page" href="{{ path('app_dashboard') }}">
<i class="fa fa-chart-pie opacity-6 text-dark me-1"></i> <i class="fa fa-chart-pie opacity-6 text-dark me-1"></i>
Dashboard Dashboard
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link me-2" href="/index.php/profile"> <a class="nav-link me-2" href="{{ path('app_profile') }}">
<i class="fa fa-user opacity-6 text-dark me-1"></i> <i class="fa fa-user opacity-6 text-dark me-1"></i>
Profile Profile
</a> </a>
@ -32,13 +39,13 @@
{% endif %} {% endif %}
{% if not app.user %} {% if not app.user %}
<li class='nav-item'> <li class='nav-item'>
<a class='nav-link me-2' href='/index.php/register'> <a class='nav-link me-2' href='{{ path('app_register') }}'>
<i class='fas fa-key opacity-6 text-dark me-1'></i> <i class='fas fa-key opacity-6 text-dark me-1'></i>
Register Register
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link me-2" href="/index.php/"> <a class="nav-link me-2" href="{{ path('app_login') }}">
<i class="fas fa-key opacity-6 text-dark me-1"></i> <i class="fas fa-key opacity-6 text-dark me-1"></i>
Sign In Sign In
</a> </a>

View File

@ -11,7 +11,7 @@
</div> </div>
</div> </div>
</div> </div>
<main class="main-content mt-0"> <main class="main-content mt-0">
<section> <section>
<div class="page-header min-vh-100"> <div class="page-header min-vh-100">
<div class="container"> <div class="container">
@ -61,6 +61,9 @@
<label for="registration_form_url" class="form-label">URL</label> <label for="registration_form_url" class="form-label">URL</label>
<input type="text" name="{{ field_name(form.url) }}" class="form-control"/> <input type="text" name="{{ field_name(form.url) }}" class="form-control"/>
</div> </div>
<div class='input-group input-group-outline mb-3' id='company-logo'>
{{ form_row(form.companyLogo) }}
</div>
<div class="text-center"> <div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Next</button> <button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Next</button>
</div> </div>