51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Entity\Case;
|
|
|
|
use App\Enums\Case\ReferralServiceType;
|
|
use App\Repository\Case\StandardNoteRepository;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use JsonSerializable;
|
|
|
|
#[ORM\Entity(repositoryClass: StandardNoteRepository::class)]
|
|
class StandardNote extends Note implements JsonSerializable
|
|
{
|
|
#[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;
|
|
}
|
|
|
|
public function jsonSerialize(): array
|
|
{
|
|
$members = [];
|
|
foreach ($this->getMembers() as $member) {
|
|
/** @var Member $member */
|
|
$members[] = $member->getName();
|
|
}
|
|
return [
|
|
'id' => $this->getId()->toString(),
|
|
'date' => $this->getDate()->format('M j, Y'),
|
|
'startTime' => $this->getStartTime()->format('g:i a'),
|
|
'endTime' => $this->getEndTime()->format('g:i a'),
|
|
'serviceCode' => $this->getReferral()->getServiceCode()->value,
|
|
'noteType' => ($this->getReferral()->getServiceCode() == ReferralServiceType::VS_THBB ? 'visit' : 'standard'),
|
|
'status' => $this->getStatus()->value,
|
|
'location' => $this->getLocation()->value,
|
|
'method' => ucwords(str_replace('_', ' ', strtolower($this->getMethod()->name))),
|
|
'members' => implode(', ', $members),
|
|
'duration' => $this->calcTimeUsed(),
|
|
];
|
|
}
|
|
}
|