Compare commits

...

8 Commits

15 changed files with 576 additions and 32 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace App\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class AppFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
// $product = new Product();
// $manager->persist($product);
$manager->flush();
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\DataFixtures;
use App\Entity\MemberCase;
use App\Entity\ReferralSource;
use App\Entity\User;
use App\Entity\UserCase;
use App\Enums\CaseLevel;
use App\Enums\County;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
class MemberCaseFixture extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
return;
$sources = $manager->getRepository(ReferralSource::class)->findAll();
$users = $manager->getRepository(User::class)->findAll();
$gen = \Faker\Factory::create();
for ($x = 0; $x < 50; $x++) {
$case = new MemberCase();
$case->setCaseNumber($gen->numberBetween(1000000, 9999999))
->setDcsCaseId($gen->numberBetween(1000000, 9999999))
->setFirstName($gen->firstName())
->setLastName($gen->lastName())
->setCounty($gen->randomElement(County::class))
->setReferralSource($gen->randomElement($sources))
->setLevel($gen->randomElement(CaseLevel::class))
->setAdmitDate($gen->dateTimeBetween('-1 year', 'now'))
->setReferralType('DCS')
;
$uc = new UserCase();
$uc->setMemberCase($case);
$uc->setUser($gen->randomElement($users));
print "Adding member case {$case->getCaseNumber()}".PHP_EOL;
$manager->persist($case);
$manager->persist($uc);
}
$manager->flush();
}
public function getDependencies(): array
{
return [
ReferralSourceFixture::class,
UserFixture::class,
];
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace App\DataFixtures;
use App\Entity\Member;
use App\Entity\MemberCase;
use App\Enums\GenderType;
use App\Enums\RaceType;
use App\Enums\RelationshipType;
use App\Enums\State;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
class MemberFixture extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
return;
$gen = \Faker\Factory::create();
$cases = $manager->getRepository(MemberCase::class)->findAll();
foreach ($cases as $case) {
/** @var MemberCase $case */
$caseLastName = $case->getLastName();
print "Adding members for case {$case->getCaseName()}".PHP_EOL;
$memCount = $gen->numberBetween(0, 5);
for ($x = 0; $x < $memCount; $x++) {
$isChild = $gen->boolean();
$isParent = ($isChild ? false : $gen->boolean());
$isLegalGuardian = (!$isParent && !$isChild ? $gen->boolean() : false);
$dcsApproved = (!$isParent && !$isChild ? $gen->boolean() : false);
$sameLastName = $gen->boolean();
$mem = new Member();
$name = $gen->firstName().' '.$gen->lastName();
$username = strtolower(str_replace(' ', '.', $name));
$phone = substr(str_replace(['-', '+', ' ', '(', ')'], '', $gen->e164PhoneNumber()), -10);
$mem->setRelationship($gen->randomElement(RelationshipType::class))
->setPersonalId($gen->numberBetween(1000000, 9999999))
->setGender($gen->randomElement(GenderType::class))
->setRace($gen->randomElement(RaceType::class))
->setPhone($phone)
->setCellPhone($phone)
->setEmail($username.'@'.$gen->freeEmailDomain())
->setAddress($gen->streetAddress())
->setCity($gen->city())
->setState(State::IN->name)
->setZip($gen->postcode())
->setDob(
$gen->dateTimeBetween(
($isChild ? '-16 years' : '-50 years'),
($isParent || $isLegalGuardian ? '-16 years' : '-1 month')
)
)
->setFirstName($gen->firstName())
->setLastName($sameLastName ? $caseLastName : $gen->lastName())
->setChild($isChild)
->setParent($isParent)
->setLegalGuardian($isLegalGuardian)
->setAdultChild(false)
->setParentsLiveTogether(false)
->setDcsApproved($dcsApproved)
->setCaseId($case)
;
print "Adding member {$mem->getFirstName()} {$mem->getLastName()}".PHP_EOL;
$manager->persist($mem);
}
}
$manager->flush();
}
public function getDependencies(): array
{
return [
MemberCaseFixture::class,
ReferralFixture::class,
];
}
}

View File

@ -0,0 +1,110 @@
<?php
namespace App\DataFixtures;
use App\Entity\MemberCase;
use App\Entity\Referral;
use App\Entity\StandardNote;
use App\Entity\VisitNote;
use App\Enums\NoteLocation;
use App\Enums\NoteMethod;
use App\Enums\NoteStatus;
use App\Enums\ReferralServiceType;
use App\Enums\VisitQualityLevel;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
class NoteFixture extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
return;
$gen = \Faker\Factory::create();
$refs = $manager->getRepository(Referral::class)->findAll();
foreach ($refs as $ref) {
/** @var Referral $ref */
print "Adding notes for referral {$ref->getReferralId()}".PHP_EOL;
$noteCount = $gen->numberBetween(0, 10);
$case = $ref->getMemberCase();
$caseMembers = $case->getMembers();
for ($x = 0; $x < $noteCount; $x++) {
$startTime = $gen->dateTimeBetween('06:00:00', '14:00:00');
$endTime = $gen->dateTimeBetween('12:00:00', '21:00:00');
if ($startTime > $endTime) {
$tmp = clone $endTime;
$endTime = $startTime;
$startTime = $tmp;
}
if ($ref->getServiceCode() === ReferralServiceType::VS_THBB) {
$note = new VisitNote();
$note->setReferral($ref)
->setDate($gen->dateTimeBetween($case->getAdmitDate()->format('Y-m-d'), 'now'))
->setStartTime($startTime)
->setEndTime($endTime)
->setStatus($gen->randomElement(NoteStatus::class))
->setLocation($gen->randomElement(NoteLocation::class))
->setMethod(NoteMethod::BILLABLE_SUPERVISED_VISIT)
->setParentalRole($gen->randomElement(VisitQualityLevel::class))
->setChildDevelopment($gen->randomElement(VisitQualityLevel::class))
->setAppropriateResponse($gen->randomElement(VisitQualityLevel::class))
->setChildAheadOfSelf($gen->randomElement(VisitQualityLevel::class))
->setShowsEmpathy($gen->randomElement(VisitQualityLevel::class))
->setChildFocused($gen->randomElement(VisitQualityLevel::class))
->setNarrative($gen->text(100))
->setStrengths($gen->text(100))
->setIssues($gen->text(100))
->setRecommendation($gen->text(100))
// ->setMembers(
// (
// count($caseMembers) > 0
// ?
// $gen->randomElements($caseMembers, $gen->numberBetween(1, count($caseMembers)))
// :
// null
// )
// )
;
// dd($note);
} else {
$note = new StandardNote();
$note->setReferral($ref)
->setDate($gen->dateTimeBetween('-1 year', 'now'))
->setStartTime($startTime)
->setEndTime($endTime)
->setStatus($gen->randomElement(NoteStatus::class))
->setLocation($gen->randomElement(NoteLocation::class))
->setMethod(NoteMethod::BILLABLE)
->setNote($gen->text(100))
// ->setMembers(
// (
// count($caseMembers) > 0
// ?
// $gen->randomElements($caseMembers, $gen->numberBetween(1, count($caseMembers)))
// :
// null
// )
// )
;
}
$manager->persist($note);
}
}
$manager->flush();
}
public function getDependencies(): array
{
return [
MemberCaseFixture::class,
ReferralFixture::class,
];
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\DataFixtures;
use App\Entity\MemberCase;
use App\Entity\Referral;
use App\Enums\ReferralServiceType;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
class ReferralFixture extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
return;
$gen = \Faker\Factory::create();
$cases = $manager->getRepository(MemberCase::class)->findAll();
foreach ($cases as $case) {
print "Adding referrals for case {$case->getCaseNumber()}".PHP_EOL;
$refCount = $gen->numberBetween(0, 2);
for ($x = 0; $x < $refCount; $x++) {
$ref = new Referral();
$ref->setReferralId($gen->numberBetween(1000000, 9999999))
->setMemberCase($case)
->setServiceCode($gen->randomElement(ReferralServiceType::class))
->setEndDate($gen->dateTimeBetween('+1 month', '+1 year'))
->setHours($gen->numberBetween(1, 75))
;
print "Adding referral {$ref->getReferralId()}".PHP_EOL;
$manager->persist($ref);
}
}
$manager->flush();
}
public function getDependencies(): array
{
return [
MemberCaseFixture::class,
];
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\DataFixtures;
use App\Entity\ReferralSource;
use App\Enums\County;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Faker\Factory;
class ReferralSourceFixture extends Fixture
{
public function load(ObjectManager $manager): void
{
return;
$gen = Factory::create();
for ($x = 0; $x < 20; $x++) {
$src = new ReferralSource();
$name = "{$gen->firstName()} {$gen->lastName()}";
$username = strtolower(str_replace(' ', '.', $name));
$src->setName($name)
->setEmail("{$username}@dcs.in.gov")
->setCounty((string) $gen->randomElement(County::class)->name)
->setAgency('DCS')
->setPhone(str_replace(['-', '+'], '', $gen->phoneNumber()))
;
print "Adding referral source {$src->getName()}".PHP_EOL;
$manager->persist($src);
}
// $product = new Product();
// $manager->persist($product);
$manager->flush();
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\DataFixtures;
use App\Entity\Company;
use App\Entity\User;
use App\Enums\CaseLevel;
use App\Enums\RateType;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
class UserFixture extends Fixture
{
public function __construct(
private readonly UserPasswordHasherInterface $userPasswordHasher,
) {
}
public function load(ObjectManager $manager): void
{
return;
$comp = $manager->getRepository(Company::class)->findOneBy(['name' => 'Counseling Partners, LLC']);
$gen = \Faker\Factory::create();
for ($x = 0; $x < 20; $x++) {
$user = new User();
$name = $gen->firstName().' '.$gen->lastName();
$username = strtolower(str_replace(' ', '.', $name));
$cw = true;
$cm = $gen->boolean();
$t = $gen->boolean();
$su = $gen->boolean();
$roles = ['ROLE_USER', 'ROLE_CASE_WORKER'];
if ($cm) {
$roles[] = 'ROLE_CASE_MANAGER';
}
if ($t) {
$roles[] = 'ROLE_THERAPIST';
}
if ($su) {
$roles[] = 'ROLE_ADMIN';
}
$user->setName($name)
->setUsername($username)
->setEmail($username.'@counselingpartnersllc.com')
->setCaseManager($cm)
->setCaseWorker($cw)
->setTherapist($t)
->setSu($su)
->setRoles($roles)
->setRateType($gen->randomElement(RateType::class))
->setRate($gen->numberBetween(0, 100))
->setLevel($gen->randomElement(CaseLevel::class))
->setCompany($comp)
->setPassword($this->userPasswordHasher->hashPassword($user, 'password'))
;
print "Creating user $name - $username".PHP_EOL;
$manager->persist($user);
}
$manager->flush();
}
}

View File

@ -3,6 +3,7 @@
namespace App\Entity;
use App\Enums\County;
use App\Enums\ResourceType;
use App\Enums\State;
use App\Repository\CommunityResourceRepository;
use DateTime;
@ -99,6 +100,9 @@ class CommunityResource
#[ORM\Column(length: 255, nullable: true)]
private ?string $servicesAvailable = null;
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: ResourceType::class)]
private array $type = [];
public function __construct(
private DateTime $today
) {
@ -623,4 +627,19 @@ class CommunityResource
return $this;
}
/**
* @return ResourceType[]
*/
public function getType(): array
{
return $this->type;
}
public function setType(array $type): static
{
$this->type = $type;
return $this;
}
}

View File

@ -67,6 +67,7 @@ class Referral
{
$this->notes = new ArrayCollection();
$this->present = new ArrayCollection();
$this->hoursUsed = 0.0;
}
public function getId(): ?Uuid
@ -194,8 +195,8 @@ class Referral
{
$this->notes = $notes;
$this->hoursUsed = 0.0;
foreach($this->notes as $note) {
foreach ($this->notes as $note) {
$this->hoursUsed += ($note->calcTimeUsed() / 60);
}
}

View File

@ -44,7 +44,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(length: 45)]
private ?string $name = null;
#[ORM\Column(length: 45)]
#[ORM\Column(length: 64)]
private ?string $email = null;
#[ORM\Column(enumType: RateType::class)]

View File

@ -0,0 +1,12 @@
<?php
namespace App\Enums;
enum ResourceType: int
{
case FOOD_PANTRY = 0;
case CLOTHES_CLOSET = 1;
case JOB_OPENINGS = 2;
case HOUSING = 3;
case PARENT_SUPPORT = 4;
}

View File

@ -15,6 +15,7 @@ class NavList
'referral_sources' => 'nav-link text-dark',
'case_notes' => 'nav-link text-dark',
'community_resource' => 'nav-link text-dark',
'my_cases' => 'nav-link text-dark',
];
public const PRESENT_LINK = 'nav-link text-white active bg-gradient-dark';

View File

@ -16,24 +16,24 @@
<h6 class="text-white text-capitalize ps-3">Case List</h6>
</div>
{% if is_granted('ROLE_CASE_MANAGER') or is_granted('ROLE_ADMIN') %}
<div>
<button type="button" class="btn btn-block btn-light mb-3" onclick="window.open('{{ path('app_add_case') }}', '_self')">Add Case</button>
</div>
<div>
<button type="button" class="btn btn-block btn-light mb-3" onclick="window.open('{{ path('app_add_case') }}', '_self')">Add Case</button>
</div>
{% endif %}
</div>
</div>
<div class="card-body px-0 pb-2">
{% if is_granted('ROLE_ADMIN') %}
<div>
Filters:
<select onchange='filterCasesByUser(this.value)'>
<option value=''></option>
<div>
Filters:
<select onchange='filterCasesByUser(this.value)'>
<option value=''></option>
{% for w in workers %}
<option value='{{ w.id }}'>{{ w.name }}</option>
{% endfor %}
</select>
</div>
{% for w in workers %}
<option value='{{ w.id }}'>{{ w.name }}</option>
{% endfor %}
</select>
</div>
{% endif %}
<div class="table-responsive p-0">
<table class="table align-items-center mb-0">
@ -86,12 +86,12 @@
</td>
<td class='align-right'>
{% 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'>
<i class="material-symbols-rounded opacity-5">edit</i>
</a>
<a href='{{ path('app_assign_case', {id: c.id}) }}' class='' title='Assign Case Worker' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>badge</i>
</a>
<a href='{{ path('app_edit_case', {id: c.id}) }}' class='' title='Edit Case' data-toggle='tooltip'>
<i class="material-symbols-rounded opacity-5">edit</i>
</a>
<a href='{{ path('app_assign_case', {id: c.id}) }}' class='' title='Assign Case Worker' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>badge</i>
</a>
{% endif %}
<a href='{{ path('app_list_referrals', {id: c.id}) }}' class='' title='List Referrals' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>create_new_folder</i>
@ -104,14 +104,14 @@
</a>
</td>
</tr>
</td>
{% endfor %}
</tbody>
</tr>
{% endfor %}
</tbody>
</table>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></main>{% endblock %}
</main>
{% endblock %}

View File

@ -0,0 +1,84 @@
{% 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') }}
<div class="container-fluid py-2">
<div class="row">
<div class="col-12">
<div class="card my-4">
<div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
<div class="d-flex justify-content-between bg-gradient-dark shadow-dark border-radius-lg pt-4 pb-3 ps-3 p-2">
<div>
<h6 class="text-white text-capitalize ps-3">My Cases</h6>
</div>
</div>
</div>
<div class="card-body px-0 pb-2">
<div class="table-responsive p-0">
<table class="table align-items-center mb-0">
<thead>
<tr>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Name</th>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Case #</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">DCS Case ID</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Type/Source</th>
<th class='text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>County</th>
<th class='text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Referral Count</th>
<th class="text-secondary opacity-7"></th>
</tr>
</thead>
<tbody id='case-list'>
{% for c in cases %}
<tr>
<td>
<div class='d-flex px-2 py-1'>
<div class='d-flex flex-column justify-content-center'>
<h6 class='mb-0 text-small'>{{ c.caseName }}</h6>
</div>
</div>
</td>
<td>
<p class='text-xs font-weight-bold mb-0'>{{ c.caseNumber }}</p>
</td>
<td>
<p class='text-xs font-weight-bold mb-0'>{{ c.dcsCaseId }}</p>
</td>
<td>
<p class='text-xs font-weight-bold mb-0'>
{{ c.referralType }}/{{ c.referralSource.name }}<br/>
<a href='mailto:{{ c.referralSource.email }}'>{{ c.referralSource.email }}</a>
</p>
</td>
<td>
<p class='text-xs font-weight-bold mb-0'>{{ c.county.value }}</p>
</td>
<td>
<p class='text-center text-xs font-weight-bold mb-0'>{{ c.referrals|length }}</p>
</td>
<td class='align-right'>
<a href='{{ path('app_list_referrals', {id: c.id}) }}' class='' title='List Referrals' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>create_new_folder</i>
</a>
<a href='{{ path('app_case_members', {id: c.id}) }}' class='' title='List Members' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>group_add</i>
</a>
<a href='{{ path('app_case_notes', {id: c.id}) }}' class='' title='Show Notes' data-toggle='tooltip'>
<i class='material-symbols-rounded opacity-5'>clinical_notes</i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
{% endblock %}

View File

@ -38,6 +38,12 @@
<span class='nav-link-text ms-1'>Referral Sources</span>
</a>
</li>
<li class='nav-item'>
<a class='{{ case_list }}' href='{{ path('app_list_cases') }}'>
<i class='material-symbols-rounded opacity-5'>cases</i>
<span class='nav-link-text ms-1'>Case List</span>
</a>
</li>
{% endif %}
{% if is_granted('ROLE_CASE_MANAGER') or is_granted('ROLE_ADMIN') %}
@ -59,14 +65,14 @@
</a>
</li>
<li class='nav-item'>
<a class='{{ case_list }}' href='{{ path('app_list_cases') }}'>
<i class='material-symbols-rounded opacity-5'>cases</i>
<span class='nav-link-text ms-1'>Case List</span>
<a class='{{ my_cases }}' href='{{ path('app_my_cases') }}'>
<i class='material-symbols-rounded opacity-5'>business_center</i>
<span class='nav-link-text ms-1'>My Cases</span>
</a>
</li>
<li class='nav-item'>
<a class='{{ case_notes }}' href='{{ path('app_list_notes') }}'>
<i class='material-symbols-rounded opacity-5'></i>
<i class='material-symbols-rounded opacity-5'>note_add</i>
<span class='nav-link-text ms-1'>Case Notes</span>
</a>
</li>