Add jail's status + directorys history admin

This commit is contained in:
Xbird
2022-09-11 15:33:37 +00:00
parent 59c8fa4aa8
commit 1a52a91d7e
11 changed files with 108 additions and 1 deletions

View File

@@ -314,4 +314,21 @@ class DirectoryController extends AbstractController
'deletedDirectory' => $deleted
]);
}
#[Route('/history/{id}', name: 'history')]
public function history(Directory $Directory, EntityManagerInterface $em): Response
{
/**
* @var LogEntryRepository $logEntryRepository
*/
$logEntryRepository = $em->getRepository('Gedmo\Loggable\Entity\LogEntry');
$directoryHistory = $logEntryRepository->getLogEntries($Directory);
return $this->render('directory/history.html.twig', [
'controller_name' => 'DocumentController',
'directory' => $Directory,
'history' => $directoryHistory,
]);
}
}

View File

@@ -417,6 +417,7 @@ class Directory
/**
* @ORM\Column(type="boolean", options={"default":"1"})
* @Gedmo\Versioned
*/
private $wantedDisplay = true;
@@ -464,26 +465,31 @@ class Directory
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Gedmo\Versioned
*/
private $gangInfo;
/**
* @ORM\Column(type="boolean", options={"default":"0"})
* @Gedmo\Versioned
*/
private $hasNoPapers = false;
/**
* @ORM\Column(type="text", nullable=true)
* @Gedmo\Versioned
*/
private $medicalContact;
/**
* @ORM\Column(type="text", nullable=true)
* @Gedmo\Versioned
*/
private $medicaltrusted;
/**
* @ORM\Column(type="text", nullable=true)
* @Gedmo\Versioned
*/
private $medicalLastWish;

View File

@@ -50,6 +50,12 @@ class Jail extends Document
*/
private $medic = false;
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Versioned
*/
private $status;
public function __construct(User $user)
{
parent::__construct($user);
@@ -129,4 +135,15 @@ class Jail extends Document
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
}

View File

@@ -8,6 +8,7 @@ use App\Form\Type\ContentType;
use App\Form\Type\DateTimeVisionType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
class JailType extends DocumentType
@@ -38,6 +39,14 @@ class JailType extends DocumentType
->add('lawyer', CheckboxType::class, ['label' => 'form_label_asked_for_lawyer', 'required' => false])
->add('medic', CheckboxType::class, ['label' => 'form_label_asked_for_medic', 'required' => false])
->add('content', ContentType::class)
->add('status', ChoiceType::class, [
'choices' => [
'form_choice_jail_status_todo' => 'form_choice_jail_status_todo',
'form_choice_jail_status_inprogress' => 'form_choice_jail_status_inprogress',
],
'label' => 'form_label_jail_status',
'priority' => -800
])
;
}