Updated code
This commit is contained in:
parent
7e820f8138
commit
bbaa084ae0
@ -38,6 +38,7 @@
|
|||||||
"symfony/string": "6.4.*",
|
"symfony/string": "6.4.*",
|
||||||
"symfony/translation": "6.4.*",
|
"symfony/translation": "6.4.*",
|
||||||
"symfony/twig-bundle": "6.4.*",
|
"symfony/twig-bundle": "6.4.*",
|
||||||
|
"symfony/uid": "6.4.*",
|
||||||
"symfony/ux-turbo": "^2.16",
|
"symfony/ux-turbo": "^2.16",
|
||||||
"symfony/validator": "6.4.*",
|
"symfony/validator": "6.4.*",
|
||||||
"symfony/web-link": "6.4.*",
|
"symfony/web-link": "6.4.*",
|
||||||
|
@ -4,7 +4,6 @@ namespace App\Controller;
|
|||||||
|
|
||||||
use App\Entity\Bible;
|
use App\Entity\Bible;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeZone;
|
|
||||||
|
|
||||||
use App\Entity\Series;
|
use App\Entity\Series;
|
||||||
use App\Entity\Speaker;
|
use App\Entity\Speaker;
|
||||||
@ -150,7 +149,7 @@ class AjaxController extends AbstractController
|
|||||||
|
|
||||||
$ref = new Reference();
|
$ref = new Reference();
|
||||||
$ref->setType($data->type);
|
$ref->setType($data->type);
|
||||||
if((int) $data->book) {
|
if(is_numeric($data->book)) {
|
||||||
$ref->setNdx($data->book);
|
$ref->setNdx($data->book);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +166,10 @@ class AjaxController extends AbstractController
|
|||||||
'creed' => ReferenceController::retrieveCreed($data->book)
|
'creed' => ReferenceController::retrieveCreed($data->book)
|
||||||
};
|
};
|
||||||
|
|
||||||
$res->setContent(json_encode(['text' => $ret->getContent(), 'title' => "{$ret->getLabel()}"]));
|
$res->setContent(json_encode([
|
||||||
|
'text' => $ret->getContent(),
|
||||||
|
'title' => "{$ret->getLabel()}",
|
||||||
|
]));
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
@ -242,15 +244,18 @@ class AjaxController extends AbstractController
|
|||||||
$note->setId($data->id);
|
$note->setId($data->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$note->setTitle($data->title);
|
$refs = json_decode(json_encode($data->refs), true);
|
||||||
$note->setDate(new DateTime($data->date));
|
|
||||||
|
|
||||||
$series = $emi->getRepository(Series::class)->find($data->series);
|
$series = $emi->getRepository(Series::class)->find($data->series);
|
||||||
$speaker = $emi->getRepository(Speaker::class)->find($data->speaker);
|
$speaker = $emi->getRepository(Speaker::class)->find($data->speaker);
|
||||||
$note->setSeries($series);
|
|
||||||
$note->setSpeaker($speaker);
|
$note->setTitle($data->title)
|
||||||
$note->setText($data->note);
|
->setDate(new DateTime($data->date))
|
||||||
$note->setPassage($data->passage);
|
->setSeries($series)
|
||||||
|
->setSpeaker($speaker)
|
||||||
|
->setText($data->note)
|
||||||
|
->setPassage($data->passage)
|
||||||
|
->setRefs($refs);
|
||||||
|
|
||||||
$emi->persist($note);
|
$emi->persist($note);
|
||||||
$emi->flush();
|
$emi->flush();
|
||||||
|
@ -11,6 +11,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\Uid\Uuid;
|
||||||
|
|
||||||
class DefaultController extends AbstractController
|
class DefaultController extends AbstractController
|
||||||
{
|
{
|
||||||
@ -20,14 +21,14 @@ class DefaultController extends AbstractController
|
|||||||
$speakers = $emi->getRepository(Speaker::class)->findAll();
|
$speakers = $emi->getRepository(Speaker::class)->findAll();
|
||||||
$series = $emi->getRepository(Series::class)->findAll();
|
$series = $emi->getRepository(Series::class)->findAll();
|
||||||
$templates = $emi->getRepository(Template::class)->findAll();
|
$templates = $emi->getRepository(Template::class)->findAll();
|
||||||
$note = $emi->getRepository(Notes::class)->findLastNote();
|
$uuid = Uuid::v4();
|
||||||
|
|
||||||
return $this->render('default/index.html.twig', [
|
return $this->render('default/index.html.twig', [
|
||||||
'controller_name' => 'DefaultController',
|
'controller_name' => 'DefaultController',
|
||||||
'speakers' => $speakers,
|
'speakers' => $speakers,
|
||||||
'series' => $series,
|
'series' => $series,
|
||||||
'templates' => $templates,
|
'templates' => $templates,
|
||||||
'noteId' => ($note->getId() + 1)
|
'id' => $uuid,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class Notes implements JsonSerializable
|
class Notes implements JsonSerializable
|
||||||
{
|
{
|
||||||
#[ORM\Id()]
|
#[ORM\Id()]
|
||||||
#[ORM\Column(type: Types::INTEGER)]
|
#[ORM\Column(type: Types::STRING, length: 64)]
|
||||||
private ?int $id = null;
|
private ?string $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255)]
|
||||||
private ?string $title = null;
|
private ?string $title = null;
|
||||||
@ -33,12 +33,15 @@ class Notes implements JsonSerializable
|
|||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $passage = null;
|
private ?string $passage = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::JSON, nullable: true)]
|
||||||
|
private ?array $refs = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the ID of the object.
|
* Retrieves the ID of the object.
|
||||||
*
|
*
|
||||||
* @return int|null The ID of the object, or null if it is not set.
|
* @return string|null The ID of the object, or null if it is not set.
|
||||||
*/
|
*/
|
||||||
public function getId(): ?int
|
public function getId(): ?string
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
@ -46,10 +49,10 @@ class Notes implements JsonSerializable
|
|||||||
/**
|
/**
|
||||||
* Sets the ID of the object.
|
* Sets the ID of the object.
|
||||||
*
|
*
|
||||||
* @param int $id The ID to set.
|
* @param string $id The ID to set.
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setId(int $id): static
|
public function setId(string $id): static
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
@ -139,6 +142,18 @@ class Notes implements JsonSerializable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRefs(): ?array
|
||||||
|
{
|
||||||
|
return $this->refs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRefs(?array $refs): static
|
||||||
|
{
|
||||||
|
$this->refs = $refs;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function jsonSerialize(): array
|
public function jsonSerialize(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -148,6 +163,7 @@ class Notes implements JsonSerializable
|
|||||||
'series' => $this->series,
|
'series' => $this->series,
|
||||||
'text' => $this->text,
|
'text' => $this->text,
|
||||||
'passage' => $this->passage,
|
'passage' => $this->passage,
|
||||||
|
'references' => $this->refs,
|
||||||
'date' => $this->date->format('Y-m-d'),
|
'date' => $this->date->format('Y-m-d'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
use App\Repository\ReferenceRepository;
|
use App\Repository\ReferenceRepository;
|
||||||
@ -21,7 +22,7 @@ class Reference implements JsonSerializable
|
|||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255)]
|
||||||
private ?string $name = null;
|
private ?string $name = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 10)]
|
#[ORM\Column(length: 10, unique: true)]
|
||||||
private ?string $label = null;
|
private ?string $label = null;
|
||||||
|
|
||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
|
@ -20,29 +20,4 @@ class ReferenceRepository extends ServiceEntityRepository
|
|||||||
{
|
{
|
||||||
parent::__construct($registry, Reference::class);
|
parent::__construct($registry, Reference::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return Reference[] Returns an array of Reference objects
|
|
||||||
// */
|
|
||||||
// public function findByExampleField($value): array
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('r')
|
|
||||||
// ->andWhere('r.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->orderBy('r.id', 'ASC')
|
|
||||||
// ->setMaxResults(10)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function findOneBySomeField($value): ?Reference
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('r')
|
|
||||||
// ->andWhere('r.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getOneOrNullResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<section class="top-tab">
|
<section class="top-tab">
|
||||||
<i class="fa fa-bars hamburger" aria-hidden="true"></i>
|
<i class="fa fa-bars hamburger" aria-hidden="true"></i>
|
||||||
<ul class="hamburger-list" style="display: none">
|
<ul class="hamburger-list" style="display: none">
|
||||||
<li><a href="#">New Note</a></li>
|
<li><a href="#" onclick='newNote()'>New Note</a></li>
|
||||||
<li><a href="#" onclick='showSearchNote(event)'>Open Note</a></li>
|
<li><a href="#" onclick='showSearchNote(event)'>Open Note</a></li>
|
||||||
<li><a href="#" onclick="saveNote();link.click();">Save Note</a></li>
|
<li><a href="#" onclick="saveNote();link.click();">Save Note</a></li>
|
||||||
<li><a href='#' onclick='discardNote()'>Discard Note</a></li>
|
<li><a href='#' onclick='discardNote()'>Discard Note</a></li>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='fields-container'>
|
<div id='fields-container'>
|
||||||
<input type="hidden" id="noteId" value="{{ noteId }}" />
|
<input type="hidden" id="noteId" value="{{ id }}" />
|
||||||
<input type="text" id="noteTitle" placeholder="Title..." />
|
<input type="text" id="noteTitle" placeholder="Title..." />
|
||||||
<input type='date' id='noteDate' />
|
<input type='date' id='noteDate' />
|
||||||
<input type='text' id='newSpeaker' placeholder='Name...' onkeyup='saveSpeaker(event)' />
|
<input type='text' id='newSpeaker' placeholder='Name...' onkeyup='saveSpeaker(event)' />
|
||||||
|
Loading…
Reference in New Issue
Block a user