This commit is contained in:
2024-08-02 13:37:48 +02:00
parent 9b549fa9e7
commit fa3b766634
3 changed files with 81 additions and 60 deletions
+5 -5
View File
@@ -119,6 +119,11 @@ class Reports
return $return;
}
public function isDone(): bool
{
return $this->isReportsTodo(ReportTodoEnum::COMPLETE);
}
public function countTodoReports(): int
{
$count = 0;
@@ -171,11 +176,6 @@ class Reports
$this->numberOfReport = $numberOfReport;
}
public function isDone(): bool
{
return $this->isDone;
}
public function setDone(bool $isDone): static
{
$this->isDone = $isDone;
+15 -6
View File
@@ -8,6 +8,7 @@ enum ReportStatus: int {
public function checkboxColor() : string
{
return 'primary';
return match ($this)
{
ReportStatus::INSERT => 'primary',
@@ -19,8 +20,8 @@ enum ReportStatus: int {
{
return match ($this)
{
ReportStatus::INSERT => 'light',
ReportStatus::WORKING => 'warning',
ReportStatus::INSERT => 'info',
ReportStatus::WORKING => 'primary',
ReportStatus::COMPLETE => 'success',
};
}
@@ -29,8 +30,7 @@ enum ReportStatus: int {
{
return match ($this)
{
ReportStatus::WORKING, ReportStatus::INSERT => 'dark',
ReportStatus::COMPLETE => 'white',
ReportStatus::WORKING, ReportStatus::INSERT, ReportStatus::COMPLETE => 'dark',
};
}
@@ -38,8 +38,7 @@ enum ReportStatus: int {
{
return match ($this)
{
ReportStatus::WORKING, ReportStatus::INSERT => 'dark',
ReportStatus::COMPLETE => 'light',
ReportStatus::WORKING, ReportStatus::INSERT, ReportStatus::COMPLETE => 'dark',
};
}
@@ -52,6 +51,16 @@ enum ReportStatus: int {
};
}
public function takeBadgeBg(): string
{
return 'info';
return match ($this) {
ReportStatus::INSERT => 'info',
ReportStatus::WORKING => 'primary',
ReportStatus::COMPLETE => 'info'
};
}
public function next() : ?ReportStatus
{
return ReportStatus::tryFrom($this->value+1);
+61 -49
View File
@@ -12,59 +12,71 @@
>
{% for id,reports in reportsGroup %}
<div class="status-row" style="{% if isOverdue and id == 3 %}display:none{% endif %}">
<div class="col">
<div class="card text-center text-white bg-dark">
<div class="card-title"><h2>{{ reports.status.takeLang }}</h2></div>
</div>
</div>
{% for report in reports.reports %}
<div class="col">
<div class="card text-{{ reports.status.textColor }} bg-{{ reports.status.backgroundColor }} report-one">
<div class="report-number">
<div class="badge bg-info text-dark" data-toggle="tooltip" data-placement="bottom" title="Numer sprawozdania">{{ report.number }}</div>
</div>
{# <img src="..." class="card-img-top" alt="...">#}
<div class="card-body">
<h5 class="card-title">
{% if is_granted('clientView') %}
<a href="{{ path('app_client',{id: report.client.id}) }}" class="link-{{ reports.status.linkColor }}">{{ report.client.strName }}</a>
{% else %}
{{ report.client.strName }}
{% endif %}
</h5>
{# <h6 class="card-subtitle text-muted">Numer sprawozdania: </h6>#}
<div class="card-text">
<form action="{{ path('app_set_status_todo') }}" method="post">
<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 class="card border-{{ reports.status.backgroundColor }} ">
<h3 class="card-header">{{ reports.status.takeLang }}</h3>
<div class="card-body">
{% for report in reports.reports %}
<div class="card text-{{ reports.status.textColor }} border-dark report-one">
<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>
<div class="card-header">
<h5 class="card-title">
{% if is_granted('clientView') %}
<a href="{{ path('app_client',{id: report.client.id}) }}" class="link-{{ reports.status.linkColor }}">{{ report.client.strName }}</a>
{% else %}
{{ report.client.strName }}
{% endif %}
</h5>
</div>
<div class="card-body">
<p class="card-text">
<form action="{{ path('app_set_status_todo') }}" method="post">
<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>
</form>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>