minor change views; add opcache
This commit is contained in:
@@ -15,6 +15,4 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.reports-all .report-one .fa{
|
.reports-all .report-one .fa{
|
||||||
padding: 5px 20px;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
}
|
||||||
@@ -6,20 +6,50 @@ body {
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
.report-one {
|
.report-one {
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
.card-title {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.complete {
|
||||||
|
.card-header {
|
||||||
|
min-height: 52px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
margin-bottom: 10px;
|
||||||
.fa{
|
.fa{
|
||||||
margin: auto;
|
margin: auto;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
padding: 5px 20px;
|
||||||
}
|
}
|
||||||
.btn-group {
|
.btn-group {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.report-number {
|
.report-number {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 3px;
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
.badge {
|
.badge {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.report-mark-uncompleted {
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
position: absolute;
|
||||||
|
right: 2px;
|
||||||
|
top:26px;
|
||||||
|
.fa {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.badge {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.reports-months-all {
|
.reports-months-all {
|
||||||
|
|||||||
@@ -15,35 +15,42 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|||||||
|
|
||||||
class ReportsController extends AbstractController
|
class ReportsController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/set-status-todo', name: 'app_set_status_todo')]
|
#[Route('/set-status-todo/{id}', name: 'app_set_status_todo', methods: ['POST'])]
|
||||||
#[IsGranted('reportEdit')]
|
#[IsGranted('reportEdit')]
|
||||||
public function setStatusTodo(EntityManagerInterface $entityManager, AddReports $reportsService, Request $request): Response
|
public function setStatusTodo(EntityManagerInterface $entityManager, AddReports $reportsService, Request $request, Reports $report): Response
|
||||||
{
|
{
|
||||||
$reportId = $request->getPayload()->get('reportId');
|
$token = $request->get("token");
|
||||||
$token = $request->getPayload()->get("token");
|
if ($this->isCsrfTokenValid('report-status', $token)) {
|
||||||
if ($reportId && $this->isCsrfTokenValid('report-status', $token)) {
|
|
||||||
$report = $entityManager->getRepository(Reports::class)->find($reportId);
|
|
||||||
$reportsService->setClient($report->getClient());
|
$reportsService->setClient($report->getClient());
|
||||||
$isDone = false;
|
$isDone = false;
|
||||||
foreach (ReportTodoEnum::cases() as $case) {
|
if ($request->get("unDone")){
|
||||||
$todo = $entityManager->getRepository(ReportsTodo::class)->findOneBy([
|
$todo = $entityManager->getRepository(ReportsTodo::class)->findOneBy([
|
||||||
"report" => $report->getId(),
|
"report" => $report->getId(),
|
||||||
"name" => $case->value
|
"name" => ReportTodoEnum::COMPLETE
|
||||||
]);
|
]);
|
||||||
if (!$todo) {
|
$todo->setDeleted(true);
|
||||||
$todo = new ReportsTodo();
|
|
||||||
$todo->setReport($report);
|
|
||||||
$todo->setName($case);
|
|
||||||
}
|
|
||||||
if (isset($_POST[$case->value])){
|
|
||||||
$todo->setDeleted(false);
|
|
||||||
} else {
|
|
||||||
$todo->setDeleted(true);
|
|
||||||
}
|
|
||||||
if ($todo->getName() === ReportTodoEnum::COMPLETE && !$todo->isDeleted()) {
|
|
||||||
$isDone = true;
|
|
||||||
}
|
|
||||||
$entityManager->persist($todo);
|
$entityManager->persist($todo);
|
||||||
|
} else {
|
||||||
|
foreach (ReportTodoEnum::cases() as $case) {
|
||||||
|
$todo = $entityManager->getRepository(ReportsTodo::class)->findOneBy([
|
||||||
|
"report" => $report->getId(),
|
||||||
|
"name" => $case->value
|
||||||
|
]);
|
||||||
|
if (!$todo) {
|
||||||
|
$todo = new ReportsTodo();
|
||||||
|
$todo->setReport($report);
|
||||||
|
$todo->setName($case);
|
||||||
|
}
|
||||||
|
if ($request->get($case->value) !== null) {
|
||||||
|
$todo->setDeleted(false);
|
||||||
|
} else {
|
||||||
|
$todo->setDeleted(true);
|
||||||
|
}
|
||||||
|
if ($todo->getName() === ReportTodoEnum::COMPLETE && !$todo->isDeleted()) {
|
||||||
|
$isDone = true;
|
||||||
|
}
|
||||||
|
$entityManager->persist($todo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$report->setDone($isDone);
|
$report->setDone($isDone);
|
||||||
$entityManager->persist($report);
|
$entityManager->persist($report);
|
||||||
|
|||||||
@@ -65,4 +65,15 @@ enum ReportStatus: int {
|
|||||||
{
|
{
|
||||||
return ReportStatus::tryFrom($this->value+1);
|
return ReportStatus::tryFrom($this->value+1);
|
||||||
}
|
}
|
||||||
|
public function tryFromName(string $name): ?ReportStatus
|
||||||
|
{
|
||||||
|
$name = strtoupper($name);
|
||||||
|
foreach (self::cases() as $v) {
|
||||||
|
if ($name === $v->name) {
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -35,4 +35,16 @@ enum ReportTodoEnum: int {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tryFromName(string $name): ?ReportTodoEnum
|
||||||
|
{
|
||||||
|
$name = strtoupper($name);
|
||||||
|
foreach (self::cases() as $v) {
|
||||||
|
if ($name === $v->name) {
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace App\Twig;
|
|||||||
|
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFilter;
|
use Twig\TwigFilter;
|
||||||
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class AppExtension extends AbstractExtension
|
class AppExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
@@ -14,6 +15,13 @@ class AppExtension extends AbstractExtension
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFunctions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new TwigFunction('enum', [$this, 'enumChecker']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function formatPhone(?int $phoneNumber): string
|
public function formatPhone(?int $phoneNumber): string
|
||||||
{
|
{
|
||||||
if (!$phoneNumber) {
|
if (!$phoneNumber) {
|
||||||
@@ -22,4 +30,9 @@ class AppExtension extends AbstractExtension
|
|||||||
|
|
||||||
return number_format($phoneNumber, 0,"."," ");
|
return number_format($phoneNumber, 0,"."," ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enumChecker(mixed $currentEnum, string $needEnumName): bool
|
||||||
|
{
|
||||||
|
return $currentEnum->name === $needEnumName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
{% import 'navigation/switch_months.html.twig' as navigation %}
|
{% import 'navigation/switch_months.html.twig' as navigation %}
|
||||||
|
{% import 'reports/listInclude.html.twig' as sets %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{{ navigation.month_menu('app_base',months,currentMonth) }}
|
{{ navigation.month_menu('app_base',months,currentMonth) }}
|
||||||
<div class="
|
<div class="
|
||||||
@@ -11,15 +12,28 @@
|
|||||||
reports-all"
|
reports-all"
|
||||||
>
|
>
|
||||||
{% for id,reports in reportsGroup %}
|
{% for id,reports in reportsGroup %}
|
||||||
<div class="status-row" style="{% if isOverdue and id == 3 %}display:none{% endif %}">
|
<div class="status-row" style="{% if isOverdue and enum(reports.status, 'COMPLETE') %}display:none{% endif %}">
|
||||||
<div class="card border-{{ reports.status.backgroundColor }} ">
|
<div class="card border-{{ reports.status.backgroundColor }}">
|
||||||
<h3 class="card-header">{{ reports.status.takeLang }}</h3>
|
<h3 class="card-header">{{ reports.status.takeLang }}</h3>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% for report in reports.reports %}
|
{% for report in reports.reports %}
|
||||||
<div class="card text-{{ reports.status.textColor }} border-dark report-one">
|
<div class="card text-{{ reports.status.textColor }} border-dark report-one {{ reports.status.name | lower }}">
|
||||||
<div class="report-number">
|
<div class="report-number">
|
||||||
<div class="badge bg-{{ reports.status.takeBadgeBg }} text-dark" data-toggle="tooltip" data-placement="bottom" title="Numer sprawozdania">{{ report.number }}</div>
|
<div class="badge bg-{{ reports.status.takeBadgeBg }} text-dark" data-toggle="tooltip" data-placement="bottom" title="Numer sprawozdania">{{ report.number }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if enum(reports.status, 'COMPLETE') %}
|
||||||
|
<div class="report-mark-uncompleted">
|
||||||
|
{# <div class="badge bg-danger text-dark" data-toggle="tooltip" data-placement="bottom" title="Oznacz jako nie zakończone">#}
|
||||||
|
|
||||||
|
<form action="{{ path('app_set_status_todo',{id:report.id}) }}" method="post">
|
||||||
|
<input type="hidden" name="token" value="{{ csrf_token('report-status') }}">
|
||||||
|
<input type="hidden" name="unDone" value="1">
|
||||||
|
<button type="submit" class="badge bg-danger text-dark" data-toggle="tooltip" data-placement="bottom" title="Oznacz jako nie zakończone"><i class="fa fa-solid fa-remove"></i></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{# </div>#}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h5 class="card-title">
|
<h5 class="card-title">
|
||||||
{% if is_granted('clientView') %}
|
{% if is_granted('clientView') %}
|
||||||
@@ -29,50 +43,16 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
{% if not enum(reports.status, 'COMPLETE') %}
|
||||||
<p class="card-text">
|
<div class="card-body">
|
||||||
<form action="{{ path('app_set_status_todo') }}" method="post">
|
<p class="card-text">{{ sets.statusForm(report, reportToDoList, reports.status) }}</p>
|
||||||
<input type="hidden" name="reportId" value="{{ report.id }}">
|
|
||||||
<input type="hidden" name="token" value="{{ csrf_token('report-status') }}">
|
|
||||||
<div class="btn-group" role="group" aria-label="Todos">
|
|
||||||
{% for todo in reportToDoList %}
|
|
||||||
<input onchange="this.form.submit()"
|
|
||||||
name="{{ todo.value }}"
|
|
||||||
type="checkbox"
|
|
||||||
class="btn-check"
|
|
||||||
id="checkboxToDo{{ todo.value }}Id{{ report.id }}"
|
|
||||||
{% if report.isReportsTodo(todo) %}
|
|
||||||
checked="checked"
|
|
||||||
{% endif %}
|
|
||||||
{% if not is_granted('reportEdit') %}
|
|
||||||
disabled
|
|
||||||
{% endif %}
|
|
||||||
autocomplete="off"
|
|
||||||
>
|
|
||||||
<label class="btn btn-outline-{{ reports.status.checkboxColor }} d-flex align-items-center"
|
|
||||||
for="checkboxToDo{{ todo.value }}Id{{ report.id }}"
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ todo.takeLang }}">
|
|
||||||
<i class="fa fa-solid fa-{{ todo.takeIcon }}"> </i>
|
|
||||||
</label>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer bg-transparent">
|
|
||||||
<div class="progress">
|
|
||||||
{% set percentageProgress = report.isDone ? 100 : report.countTodoReports / reportToDoList|length * 100 %}
|
|
||||||
<div class="progress-bar progress-bar-striped bg-info"
|
|
||||||
role="progressbar"
|
|
||||||
aria-valuenow="{{ report.countTodoReports }}"
|
|
||||||
aria-valuemin="0"
|
|
||||||
aria-valuemax="{{ reportToDoList|length }}"
|
|
||||||
style="width: {{ percentageProgress }}%"
|
|
||||||
>
|
|
||||||
<strong>{{ percentageProgress }}%</strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
|
{% if enum(reports.status, 'WORKING') %}
|
||||||
|
<div class="card-footer bg-transparent">
|
||||||
|
{{ sets.progress(report, reportToDoList|length) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{% macro statusForm(report,reportToDoList,reportEnum) %}
|
||||||
|
<form action="{{ path('app_set_status_todo',{id:report.id}) }}" method="post">
|
||||||
|
<input type="hidden" name="token" value="{{ csrf_token('report-status') }}">
|
||||||
|
<div class="btn-group" role="group" aria-label="Todos">
|
||||||
|
{% for todo in reportToDoList %}
|
||||||
|
<input onchange="this.form.submit()"
|
||||||
|
name="{{ todo.value }}"
|
||||||
|
type="checkbox"
|
||||||
|
class="btn-check"
|
||||||
|
id="checkboxToDo{{ todo.value }}Id{{ report.id }}"
|
||||||
|
{% if report.isReportsTodo(todo) %}
|
||||||
|
checked="checked"
|
||||||
|
{% endif %}
|
||||||
|
{% if not is_granted('reportEdit') %}
|
||||||
|
disabled
|
||||||
|
{% endif %}
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
<label class="btn btn-outline-{{ reportEnum.checkboxColor }} d-flex align-items-center"
|
||||||
|
for="checkboxToDo{{ todo.value }}Id{{ report.id }}"
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="{{ todo.takeLang }}">
|
||||||
|
<i class="fa fa-solid fa-{{ todo.takeIcon }}"> </i>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro progress(report, countAllTodos) %}
|
||||||
|
<div class="progress">
|
||||||
|
{% set percentageProgress = report.isDone ? 100 : report.countTodoReports / countAllTodos * 100 %}
|
||||||
|
<div class="progress-bar progress-bar-striped bg-info"
|
||||||
|
role="progressbar"
|
||||||
|
aria-valuenow="{{ report.countTodoReports }}"
|
||||||
|
aria-valuemin="0"
|
||||||
|
aria-valuemax="{{ countAllTodos }}"
|
||||||
|
style="width: {{ percentageProgress }}%"
|
||||||
|
>
|
||||||
|
<strong>{{ percentageProgress }}%</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[Opcache]
|
||||||
|
opcache.enable=1
|
||||||
@@ -23,9 +23,10 @@ RUN apt-get install -y \
|
|||||||
&& docker-php-ext-install zip intl
|
&& docker-php-ext-install zip intl
|
||||||
RUN apt-get install -y libgd3 libgd-dev && rm -rf /var/lib/apt/lists/*
|
RUN apt-get install -y libgd3 libgd-dev && rm -rf /var/lib/apt/lists/*
|
||||||
RUN docker-php-ext-configure gd --with-jpeg
|
RUN docker-php-ext-configure gd --with-jpeg
|
||||||
RUN docker-php-ext-install pdo pdo_mysql mysqli
|
RUN docker-php-ext-install pdo pdo_mysql mysqli opcache
|
||||||
RUN docker-php-ext-install -j$(nproc) gd
|
RUN docker-php-ext-install -j$(nproc) gd
|
||||||
RUN docker-php-ext-enable zip
|
RUN docker-php-ext-enable zip
|
||||||
|
RUN docker-php-ext-enable opcache
|
||||||
|
|
||||||
COPY services/config/foreground.sh /etc/foreground.sh
|
COPY services/config/foreground.sh /etc/foreground.sh
|
||||||
|
|
||||||
@@ -50,7 +51,6 @@ RUN composer dump-autoload --optimize
|
|||||||
RUN mv .env.prod .env
|
RUN mv .env.prod .env
|
||||||
COPY services/config/nginx-site.conf /etc/nginx/sites-enabled/default
|
COPY services/config/nginx-site.conf /etc/nginx/sites-enabled/default
|
||||||
|
|
||||||
#CMD ["/etc/foreground.sh"]
|
|
||||||
ENTRYPOINT ["/etc/foreground.sh"]
|
ENTRYPOINT ["/etc/foreground.sh"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user