diff --git a/src/Entity/CompanyDocument.php b/src/Entity/CompanyDocument.php new file mode 100644 index 0000000..e956b16 --- /dev/null +++ b/src/Entity/CompanyDocument.php @@ -0,0 +1,125 @@ +id; + } + + public function getCompany(): ?Company + { + return $this->company; + } + + public function setCompany(?Company $company): static + { + $this->company = $company; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(string $title): static + { + $this->title = $title; + + return $this; + } + + public function getText(): ?string + { + return $this->text; + } + + public function setText(?string $text): static + { + $this->text = $text; + + return $this; + } + + public function getUpdated(): ?\DateTimeInterface + { + return $this->updated; + } + + public function setUpdated(\DateTimeInterface $updated): static + { + $this->updated = $updated; + + return $this; + } + + public function getExtras(): array + { + return $this->extras; + } + + public function setExtras(array $extras): static + { + $this->extras = $extras; + + return $this; + } + + public function inExtras(DocumentExtras $field): bool + { + return in_array($field, $this->extras); + } + + public function renderHtml(): string + { + $text = $this->text; + if ($this->inExtras(DocumentExtras::EMAIL)) { + $text = str_replace('{{ email }}', "", $text); + $text = str_replace('{{ checkbox|email }}', "", $text); + } + + if ($this->inExtras(DocumentExtras::PHONE)) { + $text = str_replace('{{ phone }}', "", $text); + $text = str_replace('{{ checkbox|phone }}', "", $text); + $text = str_replace('{{ checkbox|text }}', "", $text); + } + + return << + */ +class CompanyDocumentRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, CompanyDocument::class); + } + + // /** + // * @return CompanyDocument[] Returns an array of CompanyDocument objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('c.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?CompanyDocument + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/templates/internal/admin/company/docs/add-document.html.twig b/templates/internal/admin/company/docs/add-document.html.twig new file mode 100644 index 0000000..9579a07 --- /dev/null +++ b/templates/internal/admin/company/docs/add-document.html.twig @@ -0,0 +1,103 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+ +
+
+

Add New Document

+

+
+
+
+ {{ form_errors(form) }} + + {{ form_start(form) }} +
+
+
+ + +
+ +
+ {#{{ form_row(form.extras) }}#} + {% for e in enum('App\\Enums\\DocumentExtras').cases() %} + + + {% endfor %} +
+ +
+ +
+
+
+
+
+ +
+
+ {{ form_end(form) }} +
+
+
+
+
+{% endblock %} + +{% block page_js %} + + +{% endblock %} + +{% block page_css %} + + +{% endblock %} diff --git a/templates/internal/admin/company/docs/display-document.html.twig b/templates/internal/admin/company/docs/display-document.html.twig new file mode 100644 index 0000000..8247753 --- /dev/null +++ b/templates/internal/admin/company/docs/display-document.html.twig @@ -0,0 +1,50 @@ + + + + + + + + +
+
+
+ + + \ No newline at end of file diff --git a/templates/internal/admin/company/docs/edit-document.html.twig b/templates/internal/admin/company/docs/edit-document.html.twig new file mode 100644 index 0000000..774759a --- /dev/null +++ b/templates/internal/admin/company/docs/edit-document.html.twig @@ -0,0 +1,109 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+ +
+
+

Edit Document

+

+
+
+
+ {{ form_errors(form) }} + + {{ form_start(form) }} +
+
+
+ + +
+ +
+ {{ form_row(form.extras) }} + {# for e in enum('App\\Enums\\DocumentExtras').cases %} + + + {% endfor #} +
+ +
+ +
+
+
+
+
+ +
+
+ {{ form_end(form) }} +
+
+
+
+
+{% endblock %} + +{% block page_js %} + + +{% endblock %} + +{% block page_css %} + + +{% endblock %} diff --git a/templates/internal/admin/company/docs/list-documents.html.twig b/templates/internal/admin/company/docs/list-documents.html.twig new file mode 100644 index 0000000..ad9e4aa --- /dev/null +++ b/templates/internal/admin/company/docs/list-documents.html.twig @@ -0,0 +1,66 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+
+
+
+
+
+
+
Document List
+
+ {% if is_granted('ROLE_ADMIN') %} +
+ +
+ {% endif %} +
+
+
+
+ + + + + + + + + + {% for d in docs %} + + + + + + {% endfor %} + +
TitleLast Update
+
+
+
{{ d.title }}
+
+
+
+

{{ d.updated|date('F j, Y', company_timezone) }}

+
+ {% if is_granted('ROLE_ADMIN') %} + + edit + + {% endif %} +
+
+
+
+
+
+
+
+{% endblock %}