major fixes

This commit is contained in:
2024-09-25 16:55:03 +02:00
parent e1cb68766e
commit 598acfd77c
12 changed files with 351 additions and 236 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ services:
- internal - internal
- myadmin - myadmin
www: www:
image: registry.docker.rhost.ovh/sprawozdania:0.2.0 image: registry.docker.rhost.ovh/sprawozdania:0.2.2
restart: on-failure restart: on-failure
build: build:
context: . context: .
@@ -0,0 +1,35 @@
import { Controller } from '@hotwired/stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
allCardsDiv;
connect() {
this.allCardsDiv = $('#allCardsReport .report-one');
}
showModal(){
const reportId = event.params.reportid, date = event.params.date;
$("#showReportModal").find('.modal-body').html(
this.findReport(reportId)
);
$("#showReportModal").find('.modal-title').html(date)
$("#showReportModal").modal('show');
}
findReport(id) {
for (const allCardsDivKey of this.allCardsDiv) {
const tmp = $(allCardsDivKey);
if (tmp.data('report_id') === id) {
return tmp;
}
}
}
}
+54 -40
View File
@@ -5,50 +5,50 @@ body {
.col { .col {
margin-bottom: 20px; margin-bottom: 20px;
} }
.report-one { }
.card-header { .report-one {
display: flex; .card-header {
.card-title { display: flex;
margin: auto; .card-title {
}
}
&.complete {
.card-header {
min-height: 52px;
}
}
margin-bottom: 10px;
.fa{
margin: auto; margin: auto;
font-size: 20px;
padding: 5px 20px;
} }
.btn-group { }
width: 100%; &.complete {
.card-header {
min-height: 52px;
} }
.report-number { }
position: absolute; margin-bottom: 10px;
right: 3px; .fa{
width: 25px; margin: auto;
height: 25px; font-size: 20px;
.badge { padding: 5px 20px;
font-size: 15px; }
} .btn-group {
width: 100%;
}
.report-number {
position: absolute;
right: 3px;
width: 25px;
height: 25px;
.badge {
font-size: 15px;
} }
.report-mark-uncompleted { }
width: 25px; .report-mark-uncompleted {
height: 25px; width: 25px;
cursor: pointer; height: 25px;
font-size: 12px; cursor: pointer;
position: absolute; font-size: 12px;
right: 2px; position: absolute;
top:26px; right: 2px;
.fa { top:26px;
padding: 0; .fa {
} padding: 0;
.badge { }
border: none; .badge {
} border: none;
} }
} }
} }
@@ -66,3 +66,17 @@ a {
top: 2px; top: 2px;
right: 2px; right: 2px;
} }
.card-footer {
.edit-client-group {
display: inline-flex;
margin: auto;
>div {
padding: 10px;
}
}
}
#allCardsReport{
display: none;
opacity: 0;
}
@@ -1,3 +1,3 @@
<?php // prod.DATABASE_PASSWORD.b77cc3 on Thu, 25 Jul 2024 14:54:39 +0200 <?php // prod.DATABASE_PASSWORD.b77cc3 on Wed, 21 Aug 2024 11:10:09 +0200
return "\x0FA\x82\x24\x0E\xC5I\x1Ep7\xA5A\x1Cx\x80\x18m\xB0\x17\x1B\x82B\x92\x99\xAF\x9APi\x24\x9B\x009\x15\xA4\x25k\xBE\x20\xE8t\xF9\xD1\xF9W\xD3\xC4\x25\xFFU\x7D\xAF\x04\xE9\xF9j\x7F\xFBFZ\x81\x0A\x254\x12"; return "u\x2C\x1D\xF4\x2CKm\x98\xCA\x01\x7C\xABJ\x3A\xA7\xCA\x1B\x94R\x98\xF5D\xC9\x25\xCDY\xDF\x5C\x23\x8DLK\xBD\x03jew\x5C9\x7B\x7F\x05\x5EE\x21Z\x9A\xB0\x87\xC9\xB8\xCES\xB7N\xE6\xFF\xA4\xB6\xDA\xFC\xC8\xB3\x94";
+15 -10
View File
@@ -36,18 +36,21 @@ class BaseController extends AbstractController
} }
return $this->redirectToRoute('app_base'); return $this->redirectToRoute('app_base');
} }
#[Route('/reports/{monthId}', name: 'app_base')] #[Route('/reports/{monthId}/{clientId}', name: 'app_base')]
#[IsGranted('reportView')] #[IsGranted('reportView')]
public function reportsIndex(EntityManagerInterface $entityManager, CacheInterface $cache, OverdueReports $overdueReports, int $monthId = 0) : Response public function reportsIndex(EntityManagerInterface $entityManager, CacheInterface $cache, OverdueReports $overdueReports, int $monthId = 0, int $clientId = 0) : Response
{ {
$client = null;
if ($clientId) {
$client = $entityManager->getRepository(Clients::class)->find($clientId);
}
$overdueReports->setClient($client);
$monthHelper = new MonthHelper($overdueReports); $monthHelper = new MonthHelper($overdueReports);
$isOverdue = false; $isOverdue = false;
$monthCurrentDate = $monthHelper->getCurrentMonthDate($monthId); $monthCurrentDate = $monthHelper->getCurrentMonthDate($monthId);
$reportsAll = $this->takeReportsAll($entityManager,$cache,$monthCurrentDate); $reportsAll = $this->takeReportsAll($entityManager, $clientId, $monthCurrentDate);
if ($monthId > -1) { if ($monthId < 0) {
$reportsAll = $entityManager->getRepository(Reports::class)->findAllInMonth($monthCurrentDate);
} else {
$isOverdue = true; $isOverdue = true;
} }
@@ -69,16 +72,18 @@ class BaseController extends AbstractController
'currentMonth' => $monthCurrentDate ?? null, 'currentMonth' => $monthCurrentDate ?? null,
'reportToDoList' => ReportTodoEnum::cases(), 'reportToDoList' => ReportTodoEnum::cases(),
'isOverdue' => $isOverdue, 'isOverdue' => $isOverdue,
'countOverdueLeft' => $overdueReports->getLeftCount() 'countOverdueLeft' => $overdueReports->getLeftCount(),
'client' => $client,
'clientId' => $clientId
]); ]);
} }
private function takeReportsAll(EntityManagerInterface $entityManager, CacheInterface $cache, ?\DateTime $monthCurrent = null) : array private function takeReportsAll(EntityManagerInterface $entityManager, int $clientId, ?\DateTime $monthCurrent = null) : array
{ {
if ($monthCurrent !== null) { if ($monthCurrent !== null) {
$ret = $entityManager->getRepository(Reports::class)->findAllInMonth($monthCurrent); $ret = $entityManager->getRepository(Reports::class)->findAllInMonth($monthCurrent,$clientId);
} else { } else {
$ret = $entityManager->getRepository(Reports::class)->findAllOverdue(); $ret = $entityManager->getRepository(Reports::class)->findAllOverdue($clientId);
} }
return $ret; return $ret;
+5 -2
View File
@@ -6,6 +6,8 @@ use App\Entity\Clients;
use App\Entity\Notes; use App\Entity\Notes;
use App\Entity\Reports; use App\Entity\Reports;
use App\Entity\Schedule; use App\Entity\Schedule;
use App\Enum\ReportStatus;
use App\Enum\ReportTodoEnum;
use App\Services\AddReports; use App\Services\AddReports;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -50,13 +52,14 @@ class ClientController extends AbstractController
$schedules = $entityManager->getRepository(Schedule::class)->findOneBy(["client" => $clients->getId()]); $schedules = $entityManager->getRepository(Schedule::class)->findOneBy(["client" => $clients->getId()]);
$reports = $entityManager->getRepository(Reports::class)->findBy(["client" => $clients->getId()],["number"=>"DESC"]); $reports = $entityManager->getRepository(Reports::class)->findBy(["client" => $clients->getId()],["number"=>"DESC"]);
$notes = $entityManager->getRepository(Notes::class)->findOneBy(["clientId" => $clients->getId()]); $notes = $entityManager->getRepository(Notes::class)->findOneBy(["clientId" => $clients->getId()]);
return $this->render('customers/show.html.twig', [ return $this->render('customers/show.html.twig', [
'client' => $clients, 'client' => $clients,
'schedules' => $schedules, 'schedules' => $schedules,
'reports' => $reports, 'reports' => $reports,
'notes' => $notes, 'notes' => $notes,
'backUrl' => $request->headers->get('referer') 'backUrl' => $request->headers->get('referer'),
'reportToDoList' => ReportTodoEnum::cases(),
'reportStatus' => ReportStatus::INSERT
]); ]);
} }
#[Route('/dodaj_klienta/{id}', name: 'app_add_client', defaults: ['id'=>0])] #[Route('/dodaj_klienta/{id}', name: 'app_add_client', defaults: ['id'=>0])]
+16 -8
View File
@@ -26,7 +26,7 @@ class ReportsRepository extends ServiceEntityRepository
return parent::findBy($criteria, $orderBy, $limit, $offset); // TODO: Change the autogenerated stub return parent::findBy($criteria, $orderBy, $limit, $offset); // TODO: Change the autogenerated stub
} }
public function findAllOverdue() public function findAllOverdue(int $clientId = 0)
{ {
$dateEnd = new \DateTime(); $dateEnd = new \DateTime();
$dateEnd->modify("last day of previous month"); $dateEnd->modify("last day of previous month");
@@ -36,7 +36,12 @@ class ReportsRepository extends ServiceEntityRepository
->andWhere('r.isDone = :isDone') ->andWhere('r.isDone = :isDone')
->setParameter('isDone', 0) ->setParameter('isDone', 0)
->setParameter('isDelete', 0) ->setParameter('isDelete', 0)
->setParameter('dateEnd', $dateEnd) ->setParameter('dateEnd', $dateEnd);
if ($clientId > 0) {
$reports->andWhere('r.client = :client');
$reports->setParameter('client', $clientId);
}
$reports = $reports
->orderBy("r.number","ASC") ->orderBy("r.number","ASC")
->getQuery() ->getQuery()
->getResult(); ->getResult();
@@ -48,8 +53,9 @@ class ReportsRepository extends ServiceEntityRepository
/** /**
* @return Reports[] Returns an array of Reports objects * @return Reports[] Returns an array of Reports objects
* @throws \DateMalformedStringException
*/ */
public function findAllInMonth(\DateTime $date): array public function findAllInMonth(\DateTime $date, int $clientId = 0): array
{ {
$dateStart = clone $date; $dateStart = clone $date;
$dateStart->modify("first day of this month"); $dateStart->modify("first day of this month");
@@ -61,13 +67,15 @@ class ReportsRepository extends ServiceEntityRepository
->andWhere('r.isDelete = :deleted') ->andWhere('r.isDelete = :deleted')
->setParameter('dateStart', $dateStart->format('Y-m-d')) ->setParameter('dateStart', $dateStart->format('Y-m-d'))
->setParameter('dateEnd', $dateEnd->format('Y-m-d')) ->setParameter('dateEnd', $dateEnd->format('Y-m-d'))
->setParameter('deleted', 0) ->setParameter('deleted', 0);
if ($clientId > 0) {
$reports->andWhere('r.client = :client');
$reports->setParameter('client', $clientId);
}
$reports = $reports
->orderBy("r.number","ASC") ->orderBy("r.number","ASC")
// ->setMaxResults(10)
->getQuery() ->getQuery()
->getResult() ->getResult();
;
// $this->countReport($reports); // $this->countReport($reports);
return $reports; return $reports;
+16 -4
View File
@@ -1,6 +1,7 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
namespace App\Services; namespace App\Services;
use App\Entity\Clients;
use App\Entity\Reports; use App\Entity\Reports;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
@@ -8,12 +9,14 @@ class OverdueReports
{ {
private array $list; private array $list;
private int $leftCount = 0; private int $leftCount = 0;
public function __construct(private readonly EntityManager $entity){ private ?Clients $client = null;
$this->list = $this->takeOverdueList(); public function __construct(private readonly EntityManager $entity){}
}
public function getList(): array public function getList(): array
{ {
if(!isset($this->list)){
$this->list = $this->takeOverdueList();
}
return $this->list; return $this->list;
} }
@@ -22,6 +25,11 @@ class OverdueReports
$this->leftCount = $leftCount; $this->leftCount = $leftCount;
} }
public function setClient(?Clients $client): void
{
$this->client = $client;
}
public function getLeftCount(): int public function getLeftCount(): int
{ {
return $this->leftCount; return $this->leftCount;
@@ -29,7 +37,11 @@ class OverdueReports
private function takeOverdueList() : array private function takeOverdueList() : array
{ {
$reports = $this->entity->getRepository(Reports::class)->findAllOverdue(); $clientId = 0;
if($this->client){
$clientId = $this->client->getId();
}
$reports = $this->entity->getRepository(Reports::class)->findAllOverdue($clientId);
if (!$reports) { if (!$reports) {
return []; return [];
} }
+156 -117
View File
@@ -1,132 +1,171 @@
{% import 'reports/listInclude.html.twig' as sets %}
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block body %} {% block body %}
{% if client.isComplete %} <div data-controller="customer-show">
<div class="alert alert-warning"><i class="fa-solid fa-circle-info"></i> Zakończono generowanie sprawozdań!</div> {% if client.isComplete %}
{% endif %} <div class="alert alert-warning"><i class="fa-solid fa-circle-info"></i> Zakończono generowanie sprawozdań!</div>
<div class="row row-cols-1 row-cols-md-2 g-2"> {% endif %}
<div class="col"> <div class="row row-cols-1 row-cols-md-2 g-2">
<div class="card text-center"> <div class="col">
<div class="card-header"> <div class="card text-center">
<h2>{{ client.strName }}</h2>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><span style="font-weight: bold">Adres: </span>{{ client.strAddress }}</li>
<li class="list-group-item"><span style="font-weight: bold">NIP: </span>{{ client.intNIP }}</li>
<li class="list-group-item"><span style="font-weight: bold">E-mail: </span>{{ client.strEmail }}</li>
<li class="list-group-item"><span style="font-weight: bold">Telefon: </span>{{ client.intPhone | phone }}</li>
<li class="list-group-item"><span style="font-weight: bold">Data prawomocności: </span>{{ client.dateLegitimacy | date("d-m-Y") }}</li>
<li class="list-group-item"><span style="font-weight: bold">Data obwieszczenia: </span>{{ client.dateProclamation | date("d-m-Y") }}</li>
{% if schedules %}
<li class="list-group-item list-group-item-{{ schedules.getStatus.backgroundColor }}">
<span style="font-weight: bold">Harmonogram: </span>
{% if schedules.isDone %}
wysłano: {{ schedules.getDateDone | date("d-m-Y H:i") }}
{% else %}
Pozostały czas: <span style="font-size: 1.2em">{{ schedules.getTimeLeft }}</span> dni
{% endif %}
</li>
{% endif %}
</ul>
<div class="card-footer" style="display: inline-flex;margin: auto;">
{% if is_granted('reportEdit') %}
<form action="{{ path('app_set_complete',{id: client.id}) }}" method="post" style="padding: 0 5px;">
<input type="hidden" name="isComplete" value="1">
<input type="hidden" name="token" value="{{ csrf_token("set-complete-item") }}">
<button class="btn btn-warning" type="submit">
{% if client.isComplete %}
Wznów
{% else %}
Zakończ
{% endif %}
</button>
</form>
{% endif %}
{% if not client.isComplete and is_granted('clientEdit') %}
<a href="{{ path('app_add_client',{id: client.id}) }}" class="btn btn-success">Edytuj</a>
{% endif %}
{% if is_granted('clientDelete') %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#removeConfirmModal">Usuń</button>
{% endif %}
</div>
</div>
{% if is_granted('reportView') %}
<div class="card text-center bg-light-subtle">
<div class="card-header"> <div class="card-header">
<h2>Sprawozdania</h2> <h2>{{ client.strName }}</h2>
{% if not client.isComplete and is_granted('reportEdit') %}
<form action="{{ path('app_add_next_report') }}" method="post">
<input type="hidden" name="clientId" value="{{ client.id }}">
<input type="hidden" name="token" value="{{ csrf_token('add-next-report') }}">
<button type="submit" class="btn btn-primary">Dodaj następne sprawozdanie</button>
</form>
{% endif %}
</div> </div>
<div class="card-body"> <ul class="list-group list-group-flush">
<ul class="list-group list-group-flush"> <li class="list-group-item"><span style="font-weight: bold">Adres: </span>{{ client.strAddress }}</li>
{% for report in reports %} <li class="list-group-item"><span style="font-weight: bold">NIP: </span>{{ client.intNIP }}</li>
<li class="list-group-item d-flex align-items-center"> <li class="list-group-item"><span style="font-weight: bold">E-mail: </span>{{ client.strEmail }}</li>
<span class="badge rounded-pill text-bg-primary">{{ report.number }}</span> <li class="list-group-item"><span style="font-weight: bold">Telefon: </span>{{ client.intPhone | phone }}</li>
<span class="badge rounded-pill text-bg-light">{{ report.getDateStart | date("Y-m-d") }}</span> <li class="list-group-item"><span style="font-weight: bold">Data prawomocności: </span>{{ client.dateLegitimacy | date("d-m-Y") }}</li>
<li class="list-group-item"><span style="font-weight: bold">Data obwieszczenia: </span>{{ client.dateProclamation | date("d-m-Y") }}</li>
{% if schedules %}
<li class="list-group-item list-group-item-{{ schedules.getStatus.backgroundColor }}">
<span style="font-weight: bold">Harmonogram: </span>
{% if schedules.isDone %}
wysłano: {{ schedules.getDateDone | date("d-m-Y H:i") }}
{% else %}
Pozostały czas: <span style="font-size: 1.2em">{{ schedules.getTimeLeft }}</span> dni
{% endif %}
</li>
{% endif %}
</ul>
<div class="card-footer">
<div class='edit-client-group'>
{% if is_granted('reportView') %}
<div>
<a href="{{ path('app_base',{clientId: client.id}) }}" class="btn btn-outline-info">Wyświetl sprawozdania</a>
</div>
{% endif %}
{% if is_granted('reportEdit') %}
<div>
<form action="{{ path('app_set_complete',{id: client.id}) }}" method="post">
<input type="hidden" name="isComplete" value="1">
<input type="hidden" name="token" value="{{ csrf_token("set-complete-item") }}">
<button class="btn btn-outline-warning" type="submit">
{% if client.isComplete %}
Wznów
{% else %}
Zakończ
{% endif %}
</button>
</form>
</div>
{% endif %}
{% for todo in report.getReportsTodos %} {% if not client.isComplete and is_granted('clientEdit') %}
{% if report.isReportsTodo(todo.getName) %} <div>
<span class="badge rounded-pill text-bg-{{ todo.getName.backgroundColor }}"> <a href="{{ path('app_add_client',{id: client.id}) }}" class="btn btn-outline-success">Edytuj</a>
</div>
{% endif %}
{% if is_granted('clientDelete') %}
<div>
<button class="btn btn-outline-danger" type="button" data-bs-toggle="modal" data-bs-target="#removeConfirmModal">Usuń</button>
</div>
{% endif %}
</div>
</div>
</div>
{% if is_granted('reportView') %}
<div class="card text-center bg-light-subtle">
<div class="card-header">
<h2>Sprawozdania</h2>
{% if not client.isComplete and is_granted('reportEdit') %}
<form action="{{ path('app_add_next_report') }}" method="post">
<input type="hidden" name="clientId" value="{{ client.id }}">
<input type="hidden" name="token" value="{{ csrf_token('add-next-report') }}">
<button type="submit" class="btn btn-outline-primary">Dodaj następne sprawozdanie</button>
</form>
{% endif %}
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
{% for report in reports %}
<li class="list-group-item d-flex align-items-center"
data-action="click->customer-show#showModal"
data-customer-show-reportid-param="{{ report.id }}"
data-customer-show-date-param="{{ report.getDateStart | date("Y-m-d") }}"
>
<span class="badge rounded-pill text-bg-primary">{{ report.number }}</span>
<span class="badge rounded-pill text-bg-light">{{ report.getDateStart | date("Y-m-d") }}</span>
{% for todo in report.getReportsTodos %}
{% if report.isReportsTodo(todo.getName) %}
<span class="badge rounded-pill text-bg-{{ todo.getName.backgroundColor }}">
<i class="fa fa-solid fa-{{ todo.getName.takeIcon }}"> </i> {{ todo.getName.takeLang }} <i class="fa fa-solid fa-{{ todo.getName.takeIcon }}"> </i> {{ todo.getName.takeLang }}
</span> </span>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</div>
{% endif %}
</div>
<div class="col">
<div class="card">
<div class="card-header text-center"><h2>Notatka</h2></div>
{% if notes %}
<div class="card-body">
<p>
{% apply markdown_to_html %}
{{ notes.description }}
{% endapply %}
</p>
</div>
{% endif %}
{% if not client.isComplete and is_granted('clientEdit') %}
<div class="card-footer text-center">
<a href="{{ path('app_edit_client_note',{clientId: client.id}) }}" class="btn btn-success">Edytuj</a>
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> <div class="col">
</div> <div class="card">
<div class="card-header text-center"><h2>Notatka</h2></div>
{% if notes %}
<div class="card-body">
<div class="modal fade" id="removeConfirmModal" tabindex="-1" aria-labelledby="removeConfirmModalLabel" aria-hidden="true"> <p>
<div class="modal-dialog"> {% apply markdown_to_html %}
<div class="modal-content"> {{ notes.description }}
<div class="modal-header"> {% endapply %}
<h1 class="modal-title fs-5" id="removeConfirmModalLabel">Czy na pewno chcesz usunąć tego klienta?</h1> </p>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div>
</div> {% endif %}
<div class="modal-body"> {% if not client.isComplete and is_granted('clientEdit') %}
Usunięcie klienta spowoduje wyczyszczenie wszystkich informacji z nim związanych (w tym sprawozdania, harmonogramy).<br> <div class="card-footer text-center">
<h3>Tej operacji nie można cofnąć!</h3> <a href="{{ path('app_edit_client_note',{clientId: client.id}) }}" class="btn btn-success">Edytuj</a>
</div> </div>
<div class="modal-footer"> {% endif %}
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<form action="{{ path('app_client',{id:client.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('delete-item') }}">
<input type="hidden" name="toDelete" value="1">
<input type="hidden" name="backUrl" value="{{ backUrl }}">
<button type="submit" class="btn btn-danger">Usuń</button>
</form>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="removeConfirmModal" tabindex="-1" aria-labelledby="removeConfirmModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="removeConfirmModalLabel">Czy na pewno chcesz usunąć tego klienta?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Usunięcie klienta spowoduje wyczyszczenie wszystkich informacji z nim związanych (w tym sprawozdania, harmonogramy).<br>
<h3>Tej operacji nie można cofnąć!</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<form action="{{ path('app_client',{id:client.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('delete-item') }}">
<input type="hidden" name="toDelete" value="1">
<input type="hidden" name="backUrl" value="{{ backUrl }}">
<button type="submit" class="btn btn-danger">Usuń</button>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="showReportModal" tabindex="-1" aria-labelledby="showReportModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="showReportModalLabel"></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
<div id="allCardsReport">
{% for report in reports %}
{{ sets.cardView(report, reportStatus, reportToDoList) }}
{% endfor %}
</div>
</div> </div>
{% endblock %} {% endblock %}
@@ -1,8 +1,18 @@
{% macro month_menu(routeName, months, currentMonth, countOverdueLeft) %} {% macro month_menu(routeName, months, currentMonth, countOverdueLeft, clientId, client) %}
{% if client %}
<div class="row justify-content-center">
<div class="alert alert-info col-3 text-center " role="alert">
<h5 class="alert-heading"><strong>{{ client.strName }}</strong></h5>
<p>
<a href="{{ path(routeName,{monthId: 0}) }}" class="btn btn-outline-warning">Wróć do wszystkich</a>
</p>
</div>
</div>
{% endif %}
<div class="row reports-months-all"> <div class="row reports-months-all">
<ul class="nav nav-underline nav-fill"> <ul class="nav nav-underline nav-fill">
<li class="nav-item position-relative"> <li class="nav-item position-relative">
<a href="{{ path(routeName, {monthId:-1}) }}" class="nav-link {% if currentMonth is null %}active{% endif %}">Zaległe</a> <a href="{{ path(routeName, {monthId:-1, clientId:clientId}) }}" class="nav-link {% if currentMonth is null %}active{% endif %}">Zaległe</a>
{% if countOverdueLeft > 0 %} {% if countOverdueLeft > 0 %}
<div class="spinner-grow spinner-grow-sm text-danger overdue"></div> <div class="spinner-grow spinner-grow-sm text-danger overdue"></div>
{% endif %} {% endif %}
@@ -15,7 +25,7 @@
data-toggle="tooltip" data-bs-placement="bottom" title="Zaległe sprawozdania do zrobienia" data-toggle="tooltip" data-bs-placement="bottom" title="Zaległe sprawozdania do zrobienia"
{% endif %} {% endif %}
> >
<a class="nav-link {% if isCurrent %} active{% endif %}" href="{{ path(routeName,{monthId: id}) }}"> <a class="nav-link {% if isCurrent %} active{% endif %}" href="{{ path(routeName,{monthId: id, clientId:clientId}) }}">
{% if routeName=='app_schedule' %} {% if routeName=='app_schedule' %}
{{ id }} {{ id }}
{% else %} {% else %}
+2 -36
View File
@@ -2,7 +2,7 @@
{% import 'navigation/switch_months.html.twig' as navigation %} {% import 'navigation/switch_months.html.twig' as navigation %}
{% import 'reports/listInclude.html.twig' as sets %} {% import 'reports/listInclude.html.twig' as sets %}
{% block body %} {% block body %}
{{ navigation.month_menu('app_base',months,currentMonth,countOverdueLeft) }} {{ navigation.month_menu('app_base',months,currentMonth,countOverdueLeft,clientId,client) }}
<div class=" <div class="
row row
d-flex d-flex
@@ -17,41 +17,7 @@
<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 }} report-one {{ reports.status.name | lower }}"> {{ sets.cardView(report, reports.status, reportToDoList) }}
<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>
{% if enum(reports.status, 'COMPLETE') and false %}
<div class="report-mark-uncompleted">
<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" data-toggle="tooltip" data-placement="bottom" title="Oznacz jako nie zakończone"><i class="fa fa-solid fa-remove"></i></button>
</form>
</div>
{% endif %}
<div class="card-header">
<h5 class="card-title">
{% if is_granted('clientView') %}
<a href="{{ path('app_client',{id: report.client.id}) }}" >{{ report.client.strName }}</a>
{% else %}
{{ report.client.strName }}
{% endif %}
</h5>
</div>
{# {% if not enum(reports.status, 'COMPLETE') %}#}
<div class="card-body">
<p class="card-text">{{ sets.statusForm(report, reportToDoList, reports.status) }}</p>
</div>
{# {% endif %}#}
{% if enum(reports.status, 'WORKING') %}
<div class="card-footer bg-transparent">
{{ sets.progress(report, reportToDoList|length) }}
</div>
{% endif %}
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
+36 -13
View File
@@ -4,19 +4,6 @@
<div class="btn-group" role="group" aria-label="Todos"> <div class="btn-group" role="group" aria-label="Todos">
{% for todo in reportToDoList %} {% for todo in reportToDoList %}
<button type="submit" class="btn-check" name="{{ todo.value }}" value='1' id="checkboxToDo{{ todo.value }}Id{{ report.id }}"></button> <button type="submit" class="btn-check" name="{{ todo.value }}" value='1' id="checkboxToDo{{ todo.value }}Id{{ report.id }}"></button>
{# <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 <label class="btn
{% if report.isReportsTodo(todo) %} {% if report.isReportsTodo(todo) %}
btn-{{ reportEnum.checkboxColor }} btn-{{ reportEnum.checkboxColor }}
@@ -47,3 +34,39 @@
</div> </div>
</div> </div>
{% endmacro %} {% endmacro %}
{% macro cardView(report, groupStatus, reportToDoList) %}
<div class="card text-{{ groupStatus.textColor }} report-one {{ groupStatus.name | lower }}" data-report_id="{{ report.id }}">
<div class="report-number">
<div class="badge bg-{{ groupStatus.takeBadgeBg }} text-dark" data-toggle="tooltip" data-placement="bottom" title="Numer sprawozdania">{{ report.number }}</div>
</div>
{% if enum(groupStatus, 'COMPLETE') and false %}
<div class="report-mark-uncompleted">
<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" data-toggle="tooltip" data-placement="bottom" title="Oznacz jako nie zakończone"><i class="fa fa-solid fa-remove"></i></button>
</form>
</div>
{% endif %}
<div class="card-header">
<h5 class="card-title">
{% if is_granted('clientView') %}
<a href="{{ path('app_client',{id: report.client.id}) }}" >{{ report.client.strName }}</a>
{% else %}
{{ report.client.strName }}
{% endif %}
</h5>
</div>
{# {% if not enum(groupStatus, 'COMPLETE') %}#}
<div class="card-body">
<p class="card-text">{{ _self.statusForm(report, reportToDoList, groupStatus) }}</p>
</div>
{# {% endif %}#}
{% if enum(groupStatus, 'WORKING') %}
<div class="card-footer bg-transparent">
{{ _self.progress(report, reportToDoList|length) }}
</div>
{% endif %}
</div>
{% endmacro %}