Add NoteController and associated templates, entities, repository.
This commit is contained in:
199
src/Entity/Note.php
Normal file
199
src/Entity/Note.php
Normal file
@ -0,0 +1,199 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enums\NoteLocation;
|
||||
use App\Enums\NoteMethod;
|
||||
use App\Enums\NoteStatus;
|
||||
use App\Repository\NoteRepository;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\ORM\Mapping\MappedSuperclass;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[MappedSuperclass(NoteRepository::class)]
|
||||
class Note
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: UuidType::NAME, unique: true)]
|
||||
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
||||
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
||||
private ?Uuid $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $date = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'notes')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Referral $referral = null;
|
||||
|
||||
#[ORM\Column(type: Types::TIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $startTime = null;
|
||||
|
||||
#[ORM\Column(type: Types::TIME_MUTABLE)]
|
||||
private ?\DateTimeInterface $endTime = null;
|
||||
|
||||
#[ORM\Column(enumType: NoteStatus::class)]
|
||||
private ?NoteStatus $status = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Member>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Member::class, mappedBy: 'note')]
|
||||
public Collection $members;
|
||||
|
||||
#[ORM\Column(enumType: NoteLocation::class)]
|
||||
private ?NoteLocation $location = null;
|
||||
|
||||
#[ORM\Column(enumType: NoteMethod::class)]
|
||||
private ?NoteMethod $method = null;
|
||||
|
||||
public function getId(): ?UUid
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
public function setDate(\DateTimeInterface $date): static
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReferral(): ?Referral
|
||||
{
|
||||
return $this->referral;
|
||||
}
|
||||
|
||||
public function setReferral(?Referral $referral): static
|
||||
{
|
||||
$this->referral = $referral;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStartTime(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->startTime;
|
||||
}
|
||||
|
||||
public function setStartTime(\DateTimeInterface $startTime): static
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEndTime(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->endTime;
|
||||
}
|
||||
|
||||
public function setEndTime(\DateTimeInterface $endTime): static
|
||||
{
|
||||
$this->endTime = $endTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus(): ?NoteStatus
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(NoteStatus $status): static
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Member>
|
||||
*/
|
||||
public function getMembers(): Collection
|
||||
{
|
||||
return $this->members;
|
||||
}
|
||||
|
||||
public function addUser(Member $member): static
|
||||
{
|
||||
if (!$this->members->contains($member)) {
|
||||
$this->members->add($member);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeUser(Member $member): static
|
||||
{
|
||||
$this->members->removeElement($member);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLocation(): ?NoteLocation
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function setLocation(NoteLocation $location): static
|
||||
{
|
||||
$this->location = $location;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMethod(): ?NoteMethod
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
public function setMethod(NoteMethod $method): static
|
||||
{
|
||||
$this->method = $method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to calculate the number of minutes used for a visit rounded to the nearest 15 min increment
|
||||
*
|
||||
* @param int $precision
|
||||
* The number of minutes to round the time to defaulted to 15
|
||||
*
|
||||
* @return int
|
||||
* The number of minutes calculated
|
||||
*/
|
||||
public function calcTimeUsed(int $precision = 15): int
|
||||
{
|
||||
// get the number of seconds between the two times
|
||||
$timestamp = $this->endTime->getTimestamp() - $this->startTime->getTimestamp();
|
||||
|
||||
// find out how many increments of precision there are between these two increments
|
||||
$increments = ($timestamp / 60) / $precision;
|
||||
|
||||
// if the number of increments is a float that means there is a difference
|
||||
if (is_float($increments)) {
|
||||
// calculate the modulo
|
||||
$mod = ($timestamp / 60) % $precision;
|
||||
// if the modulo is higher than half the precision increment increase the increments by 1
|
||||
if ($mod >= ($precision / 2)) {
|
||||
$increments++;
|
||||
}
|
||||
// convert the increments to an integer
|
||||
$increments = (int) $increments;
|
||||
}
|
||||
|
||||
// return the number of increments times the precision to the partials
|
||||
return $increments * $precision;
|
||||
}
|
||||
}
|
26
src/Entity/StandardNote.php
Normal file
26
src/Entity/StandardNote.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\StandardNoteRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StandardNoteRepository::class)]
|
||||
class StandardNote extends Note
|
||||
{
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $note = null;
|
||||
|
||||
public function getNote(): ?string
|
||||
{
|
||||
return $this->note;
|
||||
}
|
||||
|
||||
public function setNote(?string $note): static
|
||||
{
|
||||
$this->note = $note;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
162
src/Entity/VisitNote.php
Normal file
162
src/Entity/VisitNote.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enums\VisitQualityLevel;
|
||||
use App\Repository\VisitNoteRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: VisitNoteRepository::class)]
|
||||
class VisitNote extends Note
|
||||
{
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $narrative = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $strengths = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $issues = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $recommendation = null;
|
||||
|
||||
#[ORM\Column(enumType: VisitQualityLevel::class)]
|
||||
private ?VisitQualityLevel $parentalRole = null;
|
||||
|
||||
#[ORM\Column(enumType: VisitQualityLevel::class)]
|
||||
private ?VisitQualityLevel $childDevelopment = null;
|
||||
|
||||
#[ORM\Column(enumType: VisitQualityLevel::class)]
|
||||
private ?VisitQualityLevel $appropriateResponse = null;
|
||||
|
||||
#[ORM\Column(enumType: VisitQualityLevel::class)]
|
||||
private ?VisitQualityLevel $childAheadOfSelf = null;
|
||||
|
||||
#[ORM\Column(enumType: VisitQualityLevel::class)]
|
||||
private ?VisitQualityLevel $showsEmpathy = null;
|
||||
|
||||
#[ORM\Column(enumType: VisitQualityLevel::class)]
|
||||
private ?VisitQualityLevel $childFocused = null;
|
||||
|
||||
public function getNarrative(): ?string
|
||||
{
|
||||
return $this->narrative;
|
||||
}
|
||||
|
||||
public function setNarrative(string $narrative): static
|
||||
{
|
||||
$this->narrative = $narrative;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStrengths(): ?string
|
||||
{
|
||||
return $this->strengths;
|
||||
}
|
||||
|
||||
public function setStrengths(string $strengths): static
|
||||
{
|
||||
$this->strengths = $strengths;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIssues(): ?string
|
||||
{
|
||||
return $this->issues;
|
||||
}
|
||||
|
||||
public function setIssues(string $issues): static
|
||||
{
|
||||
$this->issues = $issues;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRecommendation(): ?string
|
||||
{
|
||||
return $this->recommendation;
|
||||
}
|
||||
|
||||
public function setRecommendation(string $recommendation): static
|
||||
{
|
||||
$this->recommendation = $recommendation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParentalRole(): ?VisitQualityLevel
|
||||
{
|
||||
return $this->parentalRole;
|
||||
}
|
||||
|
||||
public function setParentalRole(VisitQualityLevel $parentalRole): static
|
||||
{
|
||||
$this->parentalRole = $parentalRole;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChildDevelopment(): ?VisitQualityLevel
|
||||
{
|
||||
return $this->childDevelopment;
|
||||
}
|
||||
|
||||
public function setChildDevelopment(VisitQualityLevel $childDevelopment): static
|
||||
{
|
||||
$this->childDevelopment = $childDevelopment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAppropriateResponse(): ?VisitQualityLevel
|
||||
{
|
||||
return $this->appropriateResponse;
|
||||
}
|
||||
|
||||
public function setAppropriateResponse(VisitQualityLevel $appropriateResponse): static
|
||||
{
|
||||
$this->appropriateResponse = $appropriateResponse;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChildAheadOfSelf(): ?VisitQualityLevel
|
||||
{
|
||||
return $this->childAheadOfSelf;
|
||||
}
|
||||
|
||||
public function setChildAheadOfSelf(VisitQualityLevel $childAheadOfSelf): static
|
||||
{
|
||||
$this->childAheadOfSelf = $childAheadOfSelf;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShowsEmpathy(): ?VisitQualityLevel
|
||||
{
|
||||
return $this->showsEmpathy;
|
||||
}
|
||||
|
||||
public function setShowsEmpathy(VisitQualityLevel $showsEmpathy): static
|
||||
{
|
||||
$this->showsEmpathy = $showsEmpathy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChildFocused(): ?VisitQualityLevel
|
||||
{
|
||||
return $this->childFocused;
|
||||
}
|
||||
|
||||
public function setChildFocused(VisitQualityLevel $childFocused): static
|
||||
{
|
||||
$this->childFocused = $childFocused;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user