From 09e69b714d4f53eba0fe5751d70627bc68e77e98 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 1 May 2024 08:28:32 +0200
Subject: [PATCH 01/19] 1280: Simplified planning form. Added default value
---
.env | 1 +
CHANGELOG.md | 2 +
config/services.yaml | 1 +
src/Controller/PlanningController.php | 51 +---
src/Form/PlanningType.php | 1 -
templates/planning/index.html.twig | 247 +++++++++++++++++-
templates/planning/planning-sprints.html.twig | 199 --------------
templates/planning/planning-weeks.html.twig | 237 +----------------
8 files changed, 256 insertions(+), 483 deletions(-)
delete mode 100644 templates/planning/planning-sprints.html.twig
diff --git a/.env b/.env
index 4b82ab45..8446720f 100644
--- a/.env
+++ b/.env
@@ -27,6 +27,7 @@ APP_INVOICE_SUPPLIER_ACCOUNT=APP_INVOICE_SUPPLIER_ACCOUNT
APP_INVOICE_RECEIVER_DEFAULT_ACCOUNT=APP_INVOICE_DEFAULT_RECEIVER_ACCOUNT
APP_INVOICE_DESCRIPTION_TEMPLATE="Spørgsmål vedrørende fakturaen rettes til %name%, %email%."
APP_PROJECT_BILLING_DEFAULT_DESCRIPTION=
+APP_DEFAULT_PLANNING_DATA_PROVIDER=
###< Planning ###
###> itk-dev/openid-connect-bundle ###
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e0484e57..ee9c7a84 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+* [PR-112](https://github.com/itk-dev/economics/pull/112)
+ 1280: Simplified planning form. Added default value.
* [PR-110](https://github.com/itk-dev/economics/pull/110)
1209: No cost invoices
* [PR-111](https://github.com/itk-dev/economics/pull/111)
diff --git a/config/services.yaml b/config/services.yaml
index e513281c..c393dd81 100644
--- a/config/services.yaml
+++ b/config/services.yaml
@@ -23,6 +23,7 @@ services:
$invoiceSupplierAccount: '%env(string:APP_INVOICE_SUPPLIER_ACCOUNT)%'
$invoiceDefaultReceiverAccount: '%env(string:APP_INVOICE_RECEIVER_DEFAULT_ACCOUNT)%'
$projectBillingDefaultDescription: '%env(string:APP_PROJECT_BILLING_DEFAULT_DESCRIPTION)%'
+ $planningDefaultDataProvider: '%env(string:APP_DEFAULT_PLANNING_DATA_PROVIDER)%'
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
diff --git a/src/Controller/PlanningController.php b/src/Controller/PlanningController.php
index 4f446bd7..140d03e3 100644
--- a/src/Controller/PlanningController.php
+++ b/src/Controller/PlanningController.php
@@ -24,8 +24,8 @@ class PlanningController extends AbstractController
public function __construct(
private readonly DataProviderService $dataProviderService,
private readonly DataProviderRepository $dataProviderRepository,
- private readonly TranslatorInterface $translator,
private readonly ViewService $viewService,
+ private readonly ?int $planningDefaultDataProvider,
) {
}
@@ -39,6 +39,9 @@ public function index(Request $request): Response
$planningFormData = new PlanningFormData();
$form = $this->createForm(PlanningType::class, $planningFormData);
+ $dataProviders = $this->dataProviderRepository->findAll();
+ $defaultProvider = $this->dataProviderRepository->find($this->planningDefaultDataProvider);
+
$form->add('dataProvider', EntityType::class, [
'class' => DataProvider::class,
'required' => true,
@@ -48,56 +51,24 @@ public function index(Request $request): Response
'class' => 'form-element',
],
'help' => 'planning.data_provider_helptext',
- 'choices' => $this->dataProviderRepository->findAll(),
- ]);
-
- $form->add('viewType', ChoiceType::class, [
- 'required' => true,
- 'label' => 'planning.view_type',
- 'label_attr' => ['class' => 'label'],
- 'attr' => [
- 'class' => 'form-element',
- ],
- 'help' => 'planning.data_provider_helptext',
- 'choices' => $this->getTypeChoices(),
+ 'data' => $this->dataProviderRepository->find($this->planningDefaultDataProvider),
+ 'choices' => $dataProviders,
]);
$form->handleRequest($request);
- $planningData = null;
- $template = 'planning/index.html.twig';
-
if ($form->isSubmitted() && $form->isValid()) {
$service = $this->dataProviderService->getService($planningFormData->dataProvider);
- $viewType = $form->getData()->viewType;
-
- switch ($viewType) {
- case 'week':
- $planningData = $service->getPlanningDataWeeks();
- $template = 'planning/planning-weeks.html.twig';
- break;
- case 'sprint':
- $planningData = $service->getPlanningDataSprints();
- $template = 'planning/planning-sprints.html.twig';
- break;
- default:
- $planningData = $service->getPlanningDataSprints();
- break;
- }
+ } else {
+ $service = $this->dataProviderService->getService($defaultProvider);
}
- return $this->render($template, $this->viewService->addView([
+ $planningData = $service->getPlanningDataWeeks();
+
+ return $this->render('planning/index.html.twig', $this->viewService->addView([
'controller_name' => 'PlanningController',
'planningData' => $planningData,
'form' => $form,
]));
}
-
- private function getTypeChoices()
- {
- return [
- $this->translator->trans('planning.week_view') => 'week',
- $this->translator->trans('planning.sprint_view') => 'sprint',
- ];
- }
}
diff --git a/src/Form/PlanningType.php b/src/Form/PlanningType.php
index d89b9b90..dbc98bf5 100644
--- a/src/Form/PlanningType.php
+++ b/src/Form/PlanningType.php
@@ -13,7 +13,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('dataProvider')
- ->add('viewType')
;
}
diff --git a/templates/planning/index.html.twig b/templates/planning/index.html.twig
index 87932843..cbdf6174 100644
--- a/templates/planning/index.html.twig
+++ b/templates/planning/index.html.twig
@@ -5,12 +5,245 @@
{% block content %}
{{ 'planning.title'|trans }}
- {{ form_start(form) }}
- {{ form_row(form.dataProvider) }}
- {{ form_row(form.viewType) }}
-
- {{ 'planning.search'|trans }}
-
- {{ form_end(form) }}
+ {{ form_start(form) }}
+ {{ form_row(form.dataProvider) }}
+
+ {{ 'planning.search'|trans }}
+
+ {{ form_end(form) }}
+
+ {% if planningData is not null %}
+
+
+
+ {% set svg_expand %}
+
+
+
+ {% endset %}
+ {% set svg_hide %}
+
+
+
+ {% endset %}
+
+ {% set weeks = planningData.weeks %}
+ {% set assignees = planningData.assignees %}
+ {% set projects = planningData.projects %}
+
{{ 'planning.assignees'|trans }}
+
+
+
+
+
+
+ {% for week in weeks %}
+ {{ week.displayName }}
+ {% endfor %}
+
+
+ {% for assignee in assignees %}
+
+
+
+ {{ assignee.displayName }}
+
+ {{ svg_hide }}
+
+
+ {{ svg_expand }}
+
+
+
+ {% for week in weeks %}
+ {% set res = null %}
+
+ {% for week_number in week.weekCollection %}
+ {% if assignee.sprintSums.containsKey(week_number) %}
+ {% set res = assignee.sprintSums.get(week_number).sumHours %}
+ {% endif %}
+ {% endfor %}
+
+ {{ res }}
+
+ {% endfor %}
+
+ {% for project in assignee.projects %}
+
+
+ {{ project.displayName }}
+
+ {{ svg_expand }}
+
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if project.sprintSums.containsKey(week_number) %}
+ {{ project.sprintSums.get(week_number).sumHours }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% for issue in project.issues %}
+
+
+
+ #{{ issue.key }}
+ {{ issue.displayName }}
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if issue.sprintId == week_number %}
+ {{ issue.remainingHours ?? 'UE' }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% endfor %}
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+ {{ 'planning.hidden-entries'|trans }}:
+
+
+
+
+
{{ 'planning.projects'|trans }}
+
+
+
+
+
+
+ {% for week in weeks %}
+ {{ week.displayName }}
+ {% endfor %}
+
+
+ {% for project in projects %}
+
+
+
+ {{ project.displayName }}
+
+ {{ svg_expand }}
+
+
+
+ {% for week in weeks %}
+
+ {% set res = null %}
+ {% for week_number in week.weekCollection %}
+ {% if project.sprintSums.containsKey(week_number) %}
+ {% set res = (res + project.sprintSums.get(week_number).sumHours) %}
+ {% endif %}
+ {% endfor %}
+ {{ res }}
+
+ {% endfor %}
+
+ {% for assignee in project.assignees %}
+
+
+
+ {{ assignee.displayName }}
+
+ {{ svg_expand }}
+
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if assignee.sprintSums.containsKey(week_number) %}
+ {{ assignee.sprintSums.get(week_number).sumHours }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% for issue in assignee.issues %}
+
+
+
+ #{{ issue.key }}
+
+ {{ issue.displayName }}
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if issue.sprintId == week_number %}
+ {{ issue.remainingHours ?? 'UE' }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% endfor %}
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+ {% endif %}
{% endblock %}
diff --git a/templates/planning/planning-sprints.html.twig b/templates/planning/planning-sprints.html.twig
deleted file mode 100644
index 56c2498e..00000000
--- a/templates/planning/planning-sprints.html.twig
+++ /dev/null
@@ -1,199 +0,0 @@
-{% extends 'base.html.twig' %}
-
-{% block title %}
- {{ 'planning.title'|trans }}
-{% endblock %}
-
-{% block content %}
- {{ 'planning.title'|trans }}
-
- {% if planningData is not null %}
-
-
-
- {% set svg_expand %}
-
-
-
- {% endset %}
- {% set svg_hide %}
-
-
-
- {% endset %}
-
- {% set sprints = planningData.sprints %}
- {% set assignees = planningData.assignees %}
- {% set projects = planningData.projects %}
-
-
{{ 'planning.assignees'|trans }}
-
-
-
-
-
-
- {% for sprint in sprints %}
- {{ sprint.displayName }}
- {% endfor %}
-
-
- {% for assignee in assignees %}
-
-
-
- {{ assignee.displayName }}
-
-
- {{ svg_hide }}
-
-
- {{ svg_expand }}
-
-
-
-
- {% for sprint in sprints %}
- {% if assignee.sprintSums.containsKey(sprint.sprintId) %}
- {% set res = assignee.sprintSums.get(sprint.sprintId).sumHours %}
-
- {{ res }}
-
- {% else %}
-
- {% endif %}
- {% endfor %}
-
- {% for project in assignee.projects %}
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
-
- {% for sprint in sprints %}
- {% if project.sprintSums.containsKey(sprint.sprintId) %}
-
- {{ project.sprintSums.get(sprint.sprintId).sumHours }}
-
- {% else %}
-
- {% endif %}
- {% endfor %}
-
- {% for issue in project.issues %}
-
-
-
- {{ issue.key }} :
- {{ issue.displayName }}
-
- {% for sprint in sprints %}
- {% if issue.sprintId == sprint.sprintId %}
-
- {{ issue.remainingHours ?? 'UE' }}
-
- {% else %}
-
- {% endif %}
- {% endfor %}
-
- {% endfor %}
- {% endfor %}
-
- {% endfor %}
-
-
-
- {{ 'planning.hidden-entries'|trans }}:
-
-
-
-
-
{{ 'planning.projects'|trans }}
-
-
-
-
-
-
- {% for sprint in sprints %}
- {{ sprint.displayName }}
- {% endfor %}
-
-
- {% for project in projects %}
-
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
-
-
- {% for sprint in sprints %}
- {% if project.sprintSums.containsKey(sprint.sprintId) %}
- {% set res = project.sprintSums.get(sprint.sprintId).sumHours %}
-
- {{ res }}
-
- {% else %}
-
- {% endif %}
- {% endfor %}
-
- {% for assignee in project.assignees %}
-
-
-
- {{ assignee.displayName }}
-
- {{ svg_expand }}
-
-
- {% for sprint in sprints %}
- {% if assignee.sprintSums.containsKey(sprint.sprintId) %}
-
- {{ assignee.sprintSums.get(sprint.sprintId).sumHours }}
-
- {% else %}
-
- {% endif %}
- {% endfor %}
-
- {% for issue in assignee.issues %}
-
-
-
- {{ issue.key }} :
- {{ issue.displayName }}
-
- {% for sprint in sprints %}
- {% if issue.sprintId == sprint.sprintId %}
-
- {{ issue.remainingHours ?? 'UE' }}
-
- {% else %}
-
- {% endif %}
- {% endfor %}
-
- {% endfor %}
- {% endfor %}
-
- {% endfor %}
-
-
-
- {% endif %}
-{% endblock %}
diff --git a/templates/planning/planning-weeks.html.twig b/templates/planning/planning-weeks.html.twig
index 3ffa1e7a..9ba782dd 100644
--- a/templates/planning/planning-weeks.html.twig
+++ b/templates/planning/planning-weeks.html.twig
@@ -1,244 +1,9 @@
-{% extends 'base.html.twig' %}
+a{% extends 'base.html.twig' %}
{% block title %}
{{ 'planning.title'|trans }}
{% endblock %}
{% block content %}
- {{ 'planning.title'|trans }}
- {% if planningData is not null %}
-
-
-
- {% set svg_expand %}
-
-
-
- {% endset %}
- {% set svg_hide %}
-
-
-
- {% endset %}
-
- {% set weeks = planningData.weeks %}
- {% set assignees = planningData.assignees %}
- {% set projects = planningData.projects %}
-
-
{{ 'planning.assignees'|trans }}
-
-
-
-
-
-
- {% for week in weeks %}
- {{ week.displayName }}
- {% endfor %}
-
-
- {% for assignee in assignees %}
-
-
-
- {{ assignee.displayName }}
-
- {{ svg_hide }}
-
-
- {{ svg_expand }}
-
-
-
- {% for week in weeks %}
- {% set res = null %}
-
- {% for week_number in week.weekCollection %}
- {% if assignee.sprintSums.containsKey(week_number) %}
- {% set res = assignee.sprintSums.get(week_number).sumHours %}
- {% endif %}
- {% endfor %}
-
- {{ res }}
-
- {% endfor %}
-
- {% for project in assignee.projects %}
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if project.sprintSums.containsKey(week_number) %}
- {{ project.sprintSums.get(week_number).sumHours }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% for issue in project.issues %}
-
-
-
- #{{ issue.key }}
- {{ issue.displayName }}
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if issue.sprintId == week_number %}
- {{ issue.remainingHours ?? 'UE' }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% endfor %}
- {% endfor %}
-
- {% endfor %}
-
-
-
- {{ 'planning.hidden-entries'|trans }}:
-
-
-
-
-
{{ 'planning.projects'|trans }}
-
-
-
-
-
-
- {% for week in weeks %}
- {{ week.displayName }}
- {% endfor %}
-
-
- {% for project in projects %}
-
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
-
-
- {% for week in weeks %}
-
- {% set res = null %}
- {% for week_number in week.weekCollection %}
- {% if project.sprintSums.containsKey(week_number) %}
- {% set res = (res + project.sprintSums.get(week_number).sumHours) %}
- {% endif %}
- {% endfor %}
- {{ res }}
-
- {% endfor %}
-
- {% for assignee in project.assignees %}
-
-
-
- {{ assignee.displayName }}
-
- {{ svg_expand }}
-
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if assignee.sprintSums.containsKey(week_number) %}
- {{ assignee.sprintSums.get(week_number).sumHours }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% for issue in assignee.issues %}
-
-
-
- #{{ issue.key }}
-
- {{ issue.displayName }}
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if issue.sprintId == week_number %}
- {{ issue.remainingHours ?? 'UE' }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% endfor %}
- {% endfor %}
-
- {% endfor %}
-
-
-
- {% endif %}
{% endblock %}
From d62a476c052568298dbb8382a822245297ad6a27 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 1 May 2024 08:53:52 +0200
Subject: [PATCH 02/19] 1280: Fixed issues with automatic reviews
---
src/Controller/PlanningController.php | 8 ++++----
src/DataFixtures/AppFixtures.php | 11 +++++------
templates/planning/planning-weeks.html.twig | 9 ---------
3 files changed, 9 insertions(+), 19 deletions(-)
delete mode 100644 templates/planning/planning-weeks.html.twig
diff --git a/src/Controller/PlanningController.php b/src/Controller/PlanningController.php
index 140d03e3..b049e2a4 100644
--- a/src/Controller/PlanningController.php
+++ b/src/Controller/PlanningController.php
@@ -12,11 +12,9 @@
use App\Service\ViewService;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
-use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
-use Symfony\Contracts\Translation\TranslatorInterface;
#[Route('/admin/planning')]
class PlanningController extends AbstractController
@@ -57,13 +55,15 @@ public function index(Request $request): Response
$form->handleRequest($request);
+ $service = null;
+
if ($form->isSubmitted() && $form->isValid()) {
$service = $this->dataProviderService->getService($planningFormData->dataProvider);
- } else {
+ } elseif (null !== $defaultProvider) {
$service = $this->dataProviderService->getService($defaultProvider);
}
- $planningData = $service->getPlanningDataWeeks();
+ $planningData = $service?->getPlanningDataWeeks();
return $this->render('planning/index.html.twig', $this->viewService->addView([
'controller_name' => 'PlanningController',
diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php
index acd6a8f8..ba6c898d 100644
--- a/src/DataFixtures/AppFixtures.php
+++ b/src/DataFixtures/AppFixtures.php
@@ -27,8 +27,6 @@ public function load(ObjectManager $manager): void
$dataProvider1->setUrl('http://localhost/');
$dataProvider1->setSecret('Not so secret');
- $manager->persist($dataProvider1);
-
$dataProviders[] = $dataProvider1;
$dataProvider2 = new DataProvider();
@@ -38,11 +36,11 @@ public function load(ObjectManager $manager): void
$dataProvider2->setUrl('http://localhost/');
$dataProvider2->setSecret('Not so secret');
- $manager->persist($dataProvider2);
-
$dataProviders[] = $dataProvider2;
foreach ($dataProviders as $key => $dataProvider) {
+ $manager->persist($dataProvider);
+
for ($c = 0; $c < 2; ++$c) {
$client = new Client();
$client->setName("client $key-$c");
@@ -126,8 +124,9 @@ public function load(ObjectManager $manager): void
$manager->flush();
}
}
- }
- $manager->flush();
+ $manager->flush();
+ $manager->clear();
+ }
}
}
diff --git a/templates/planning/planning-weeks.html.twig b/templates/planning/planning-weeks.html.twig
deleted file mode 100644
index 9ba782dd..00000000
--- a/templates/planning/planning-weeks.html.twig
+++ /dev/null
@@ -1,9 +0,0 @@
-a{% extends 'base.html.twig' %}
-
-{% block title %}
- {{ 'planning.title'|trans }}
-{% endblock %}
-
-{% block content %}
-
-{% endblock %}
From 093f643a2b53af92bb1712eb46cb114ffc812735 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 1 May 2024 09:21:13 +0200
Subject: [PATCH 03/19] 1280: Fixed default provider issue
---
src/Controller/PlanningController.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/Controller/PlanningController.php b/src/Controller/PlanningController.php
index b049e2a4..6ce10d42 100644
--- a/src/Controller/PlanningController.php
+++ b/src/Controller/PlanningController.php
@@ -23,7 +23,7 @@ public function __construct(
private readonly DataProviderService $dataProviderService,
private readonly DataProviderRepository $dataProviderRepository,
private readonly ViewService $viewService,
- private readonly ?int $planningDefaultDataProvider,
+ private readonly ?string $planningDefaultDataProvider,
) {
}
@@ -40,6 +40,10 @@ public function index(Request $request): Response
$dataProviders = $this->dataProviderRepository->findAll();
$defaultProvider = $this->dataProviderRepository->find($this->planningDefaultDataProvider);
+ if (null === $defaultProvider && count($dataProviders) > 0) {
+ $defaultProvider = $dataProviders[0];
+ }
+
$form->add('dataProvider', EntityType::class, [
'class' => DataProvider::class,
'required' => true,
From 4d857eacbb934ef034a2334671c07fcf0fd1490a Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 1 May 2024 09:41:11 +0200
Subject: [PATCH 04/19] 1280: Added error message when data provider does not
support supplying planning data
---
src/Controller/PlanningController.php | 8 +++++++-
templates/planning/index.html.twig | 3 +++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/Controller/PlanningController.php b/src/Controller/PlanningController.php
index 6ce10d42..1bf3e4cf 100644
--- a/src/Controller/PlanningController.php
+++ b/src/Controller/PlanningController.php
@@ -67,11 +67,17 @@ public function index(Request $request): Response
$service = $this->dataProviderService->getService($defaultProvider);
}
- $planningData = $service?->getPlanningDataWeeks();
+ try {
+ $planningData = $service?->getPlanningDataWeeks();
+ } catch (\Exception $e) {
+ $error = $e->getMessage();
+ $planningData = null;
+ }
return $this->render('planning/index.html.twig', $this->viewService->addView([
'controller_name' => 'PlanningController',
'planningData' => $planningData,
+ 'error' => $error ?? null,
'form' => $form,
]));
}
diff --git a/templates/planning/index.html.twig b/templates/planning/index.html.twig
index cbdf6174..f6469b3c 100644
--- a/templates/planning/index.html.twig
+++ b/templates/planning/index.html.twig
@@ -12,6 +12,9 @@
{{ form_end(form) }}
+ {% if error is not null %}
+ {% include 'components/alert.html.twig' with {level: "danger", text: error} %}
+ {% endif %}
{% if planningData is not null %}
-
- {% set svg_expand %}
-
-
-
- {% endset %}
- {% set svg_hide %}
-
-
-
- {% endset %}
-
- {% set weeks = planningData.weeks %}
- {% set assignees = planningData.assignees %}
- {% set projects = planningData.projects %}
-
-
{{ 'planning.assignees'|trans }}
-
-
-
-
-
-
- {% for week in weeks %}
- {{ week.displayName }}
- {% endfor %}
-
-
- {% for assignee in assignees %}
-
-
-
- {{ assignee.displayName }}
-
- {{ svg_hide }}
-
-
- {{ svg_expand }}
-
-
-
- {% for week in weeks %}
- {% set res = null %}
-
- {% for week_number in week.weekCollection %}
- {% if assignee.sprintSums.containsKey(week_number) %}
- {% set res = assignee.sprintSums.get(week_number).sumHours %}
- {% endif %}
- {% endfor %}
-
- {{ res }}
-
- {% endfor %}
-
- {% for project in assignee.projects %}
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if project.sprintSums.containsKey(week_number) %}
- {{ project.sprintSums.get(week_number).sumHours }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% for issue in project.issues %}
-
-
-
- #{{ issue.key }}
- {{ issue.displayName }}
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if issue.sprintId == week_number %}
- {{ issue.remainingHours ?? 'UE' }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% endfor %}
- {% endfor %}
-
- {% endfor %}
-
-
-
- {{ 'planning.hidden-entries'|trans }}:
-
-
-
+
+
+ {{ 'planning.description'|trans }}
+
-
{{ 'planning.projects'|trans }}
-
-
-
-
-
-
- {% for week in weeks %}
- {{ week.displayName }}
- {% endfor %}
-
-
- {% for project in projects %}
-
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
-
-
- {% for week in weeks %}
-
- {% set res = null %}
- {% for week_number in week.weekCollection %}
- {% if project.sprintSums.containsKey(week_number) %}
- {% set res = (res + project.sprintSums.get(week_number).sumHours) %}
- {% endif %}
- {% endfor %}
- {{ res }}
-
- {% endfor %}
-
- {% for assignee in project.assignees %}
-
-
-
- {{ assignee.displayName }}
-
- {{ svg_expand }}
-
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if assignee.sprintSums.containsKey(week_number) %}
- {{ assignee.sprintSums.get(week_number).sumHours }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% for issue in assignee.issues %}
-
-
-
- #{{ issue.key }}
-
- {{ issue.displayName }}
-
- {% for week in weeks %}
-
- {% for week_number in week.weekCollection %}
- {% if issue.sprintId == week_number %}
- {{ issue.remainingHours ?? 'UE' }}
- {% endif %}
- {% endfor %}
-
- {% endfor %}
-
- {% endfor %}
- {% endfor %}
-
- {% endfor %}
-
-
+
- {% endif %}
+
{% endblock %}
diff --git a/templates/planning/planning.html.twig b/templates/planning/planning.html.twig
new file mode 100644
index 00000000..3c1485c7
--- /dev/null
+++ b/templates/planning/planning.html.twig
@@ -0,0 +1,90 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}{{ 'planning.title'|trans }}{% endblock %}
+
+{% block content %}
+
{{ 'planning.title'|trans }}
+
+ {{ form_start(form) }}
+ {{ form_row(form.dataProvider) }}
+
+ {{ 'planning.search'|trans }}
+
+ {{ form_end(form) }}
+
+ {% if error is not null %}
+ {% include 'components/alert.html.twig' with {level: "danger", text: error} %}
+ {% endif %}
+ {% if planningData is not null %}
+
+
+
+ {% set svg_expand %}
+
+
+
+ {% endset %}
+ {% set svg_hide %}
+
+
+
+ {% endset %}
+
+ {% set weeks = planningData.weeks %}
+ {% set assignees = planningData.assignees %}
+ {% set projects = planningData.projects %}
+
+ {% if mode is defined %}
+ {% include 'planning/' ~ mode ~ '.html.twig' %}
+ {% endif %}
+
+ {% endif %}
+{% endblock %}
diff --git a/templates/planning/projects.html.twig b/templates/planning/projects.html.twig
new file mode 100644
index 00000000..89b5a09e
--- /dev/null
+++ b/templates/planning/projects.html.twig
@@ -0,0 +1,77 @@
+
{{ 'planning.projects'|trans }}
+
+
+
+
+
+
+ {% for week in weeks %}
+ {{ week.displayName }}
+ {% endfor %}
+
+
+ {% for project in projects %}
+
+
+
+ {{ project.displayName }}
+
+ {{ svg_expand }}
+
+
+
+ {% for week in weeks %}
+
+ {% set res = null %}
+ {% for week_number in week.weekCollection %}
+ {% if project.sprintSums.containsKey(week_number) %}
+ {% set res = (res + project.sprintSums.get(week_number).sumHours) %}
+ {% endif %}
+ {% endfor %}
+ {{ res }}
+
+ {% endfor %}
+
+ {% for assignee in project.assignees %}
+
+
+
+ {{ assignee.displayName }}
+
+ {{ svg_expand }}
+
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if assignee.sprintSums.containsKey(week_number) %}
+ {{ assignee.sprintSums.get(week_number).sumHours }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% for issue in assignee.issues %}
+
+
+
+ #{{ issue.key }}
+
+ {{ issue.displayName }}
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if issue.sprintId == week_number %}
+ {{ issue.remainingHours ?? 'UE' }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% endfor %}
+ {% endfor %}
+
+ {% endfor %}
+
+
diff --git a/templates/planning/users.html.twig b/templates/planning/users.html.twig
new file mode 100644
index 00000000..3ab1dc7a
--- /dev/null
+++ b/templates/planning/users.html.twig
@@ -0,0 +1,87 @@
+
{{ 'planning.assignees'|trans }}
+
+
+
+
+
+
+ {% for week in weeks %}
+ {{ week.displayName }}
+ {% endfor %}
+
+
+ {% for assignee in assignees %}
+
+
+
+ {{ assignee.displayName }}
+
+ {{ svg_hide }}
+
+
+ {{ svg_expand }}
+
+
+
+ {% for week in weeks %}
+ {% set res = null %}
+
+ {% for week_number in week.weekCollection %}
+ {% if assignee.sprintSums.containsKey(week_number) %}
+ {% set res = assignee.sprintSums.get(week_number).sumHours %}
+ {% endif %}
+ {% endfor %}
+
+ {{ res }}
+
+ {% endfor %}
+
+ {% for project in assignee.projects %}
+
+
+ {{ project.displayName }}
+
+ {{ svg_expand }}
+
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if project.sprintSums.containsKey(week_number) %}
+ {{ project.sprintSums.get(week_number).sumHours }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% for issue in project.issues %}
+
+
+
+ #{{ issue.key }}
+ {{ issue.displayName }}
+
+ {% for week in weeks %}
+
+ {% for week_number in week.weekCollection %}
+ {% if issue.sprintId == week_number %}
+ {{ issue.remainingHours ?? 'UE' }}
+ {% endif %}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% endfor %}
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+ {{ 'planning.hidden-entries'|trans }}:
+
+
+
diff --git a/translations/messages.da.yaml b/translations/messages.da.yaml
index df3a03fa..39beac91 100644
--- a/translations/messages.da.yaml
+++ b/translations/messages.da.yaml
@@ -55,6 +55,8 @@ navigation:
admin: "Admin"
management_report: "Hent ledelsesrapport"
team_report: "Hent teamrapport"
+ planning_users: 'Brugere'
+ planning_projects: 'Projekter'
planning:
title: "Planlægning"
@@ -67,6 +69,7 @@ planning:
view_type: "Vælg visningstype"
week_view: "Ugevisning"
sprint_view: "Sprintvisning"
+ description: 'Vælg visning'
client:
title: "Kunder"
From 43a2084ef94bcef07c7dc301213ea0ee2d344911 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 1 May 2024 10:39:31 +0200
Subject: [PATCH 07/19] 1280: Added redirect from planning index. Removed icons
from navigation submenues
---
src/Controller/PlanningController.php | 6 +-----
templates/components/navigation.html.twig | 14 +++++++-------
templates/planning/index.html.twig | 18 ------------------
3 files changed, 8 insertions(+), 30 deletions(-)
delete mode 100644 templates/planning/index.html.twig
diff --git a/src/Controller/PlanningController.php b/src/Controller/PlanningController.php
index bae9450a..362122d3 100644
--- a/src/Controller/PlanningController.php
+++ b/src/Controller/PlanningController.php
@@ -27,14 +27,10 @@ public function __construct(
) {
}
- /**
- * @throws UnsupportedDataProviderException
- * @throws EconomicsException
- */
#[Route('/', name: 'app_planning')]
public function index(Request $request): Response
{
- return $this->render('planning/index.html.twig');
+ return $this->redirectToRoute('app_planning_users');
}
/**
diff --git a/templates/components/navigation.html.twig b/templates/components/navigation.html.twig
index 6bd49764..4b9393f4 100644
--- a/templates/components/navigation.html.twig
+++ b/templates/components/navigation.html.twig
@@ -17,8 +17,8 @@
{{ 'navigation.planning'|trans }}
{% endif %}
@@ -45,11 +45,11 @@
{{ 'navigation.admin'|trans }}
{% elseif is_granted('ROLE_PRODUCT_MANAGER') %}
diff --git a/templates/planning/index.html.twig b/templates/planning/index.html.twig
deleted file mode 100644
index 443d0936..00000000
--- a/templates/planning/index.html.twig
+++ /dev/null
@@ -1,18 +0,0 @@
-{% extends 'base.html.twig' %}
-
-{% block title %}{{ 'planning.title'|trans }}{% endblock %}
-
-{% block content %}
-
{{ 'planning.title'|trans }}
-
-
-
- {{ 'planning.description'|trans }}
-
-
-
-
-{% endblock %}
From cbb450113a7ccac8dfab3927fd110a6fb57ff217 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 1 May 2024 11:06:51 +0200
Subject: [PATCH 08/19] 1280: Added active class for current sprint
---
src/Model/Planning/Weeks.php | 1 +
src/Service/LeantimeApiService.php | 13 ++++++++++++-
templates/planning/planning.html.twig | 3 +++
templates/planning/projects.html.twig | 2 +-
templates/planning/users.html.twig | 8 ++++----
5 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/Model/Planning/Weeks.php b/src/Model/Planning/Weeks.php
index d850a712..6ef1c1a5 100644
--- a/src/Model/Planning/Weeks.php
+++ b/src/Model/Planning/Weeks.php
@@ -13,6 +13,7 @@ class Weeks
public float $weekGoalHigh;
public string $displayName;
public string $dateSpan;
+ public ?bool $activeSprint;
public function __construct()
{
diff --git a/src/Service/LeantimeApiService.php b/src/Service/LeantimeApiService.php
index 03a5ad36..17993518 100644
--- a/src/Service/LeantimeApiService.php
+++ b/src/Service/LeantimeApiService.php
@@ -17,7 +17,6 @@
use App\Model\Planning\Issue;
use App\Model\Planning\PlanningData;
use App\Model\Planning\Project;
-use App\Model\Planning\Sprint;
use App\Model\Planning\SprintSum;
use App\Model\Planning\Weeks;
use App\Model\SprintReport\SprintReportData;
@@ -378,6 +377,7 @@ public function getPlanningDataWeeks(): PlanningData
$weeks = $planning->weeks;
$currentYear = (int) (new \DateTime())->format('Y');
+ $currentWeek = (int) (new \DateTime())->format('W');
for ($weekNumber = 1; $weekNumber <= 52; ++$weekNumber) {
$date = (new \DateTime())->setISODate($currentYear, $weekNumber);
@@ -394,12 +394,19 @@ public function getPlanningDataWeeks(): PlanningData
$supportWeek->weekGoalHigh = $this->weekGoalHigh;
$supportWeek->displayName = (string) $week;
$supportWeek->dateSpan = $weekFirstDay.' - '.$weekLastDay;
+ if ($week == $currentWeek) {
+ $supportWeek->activeSprint = true;
+ }
$weeks->add($supportWeek);
} else {
if (isset($regularWeek)) {
$regularWeek->weekCollection->add($week);
++$regularWeek->weeks;
$regularWeek->displayName .= '-'.$week;
+ if ($week == $currentWeek) {
+ $regularWeek->activeSprint = true;
+ }
+
if (3 === count($regularWeek->weekCollection)) {
$regularWeek->dateSpan .= ' - '.$weekLastDay;
$weeks->add($regularWeek);
@@ -413,6 +420,9 @@ public function getPlanningDataWeeks(): PlanningData
$regularWeek->weekGoalHigh = $this->weekGoalHigh * 3;
$regularWeek->displayName = (string) $week;
$regularWeek->dateSpan = $weekFirstDay;
+ if ($week == $currentWeek) {
+ $regularWeek->activeSprint = true;
+ }
}
}
}
@@ -433,6 +443,7 @@ public function getPlanningDataWeeks(): PlanningData
$weekIssues['unscheduled'][] = $issue;
}
}
+
foreach ($weekIssues as $week => $issues) {
foreach ($issues as $issueData) {
if ('0' !== $issueData->status) { // excludes done issues.
diff --git a/templates/planning/planning.html.twig b/templates/planning/planning.html.twig
index 3c1485c7..9a429f65 100644
--- a/templates/planning/planning.html.twig
+++ b/templates/planning/planning.html.twig
@@ -18,6 +18,9 @@
{% if planningData is not null %}
{% set svg_expand %}
diff --git a/templates/planning/users.html.twig b/templates/planning/users.html.twig
index 80052973..646c7055 100644
--- a/templates/planning/users.html.twig
+++ b/templates/planning/users.html.twig
@@ -1,28 +1,31 @@
-{{ 'planning.assignees'|trans }}
+{{ 'planning.assignees'|trans }}
+
-
+
-
-
-
- {% for week in weeks %}
- {{ week.displayName }}
- {% endfor %}
-
+
+ {{ 'User'|trans }}
+ {% for week in weeks %}
+ {{ week.displayName }}
+ {% endfor %}
+
{% for assignee in assignees %}
-
-
- {{ assignee.displayName }}
-
- {{ svg_hide }}
-
-
- {{ svg_expand }}
-
+
+
+
+
+ {{ assignee.displayName }}
+
+
+ {{ svg_hide }}
+
+
+ {{ svg_expand }}
+
+
-
{% for week in weeks %}
{% set res = null %}
@@ -31,24 +34,35 @@
{% set res = assignee.sprintSums.get(week_number).sumHours %}
{% endif %}
{% endfor %}
-
+
{{ res }}
{% endfor %}
{% for project in assignee.projects %}
-
-
- {{ project.displayName }}
-
- {{ svg_expand }}
-
+
+
+
+
+ {{ project.displayName }}
+
+
+ {{ svg_expand }}
+
+
{% for week in weeks %}
-
+
{% for week_number in week.weekCollection %}
{% if project.sprintSums.containsKey(week_number) %}
{{ project.sprintSums.get(week_number).sumHours }}
@@ -59,13 +73,11 @@
{% for issue in project.issues %}
-
-
- #{{ issue.key }}
- {{ issue.displayName }}
+
+ {{ issue.displayName }} #{{ issue.key }}
{% for week in weeks %}
-
+
{% for week_number in week.weekCollection %}
{% if issue.sprintId == week_number %}
{{ issue.remainingHours ?? 'UE' }}
@@ -80,7 +92,7 @@
{% endfor %}
-
+
{{ 'planning.hidden-entries'|trans }}:
From e8a72049bb55d3026970928dc4e3d6c815cdfc82 Mon Sep 17 00:00:00 2001
From: Jesper Pedersen
Date: Thu, 2 May 2024 10:41:28 +0200
Subject: [PATCH 10/19] Change colors
---
templates/planning/users.html.twig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/planning/users.html.twig b/templates/planning/users.html.twig
index 646c7055..35048f3a 100644
--- a/templates/planning/users.html.twig
+++ b/templates/planning/users.html.twig
@@ -6,7 +6,7 @@
{{ 'User'|trans }}
{% for week in weeks %}
- {{ week.displayName }}
+ {{ week.displayName }}
{% endfor %}
@@ -35,7 +35,7 @@
{% endif %}
{% endfor %}
From 41fd03729c45642473f7b44a773693f951a6a0db Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Thu, 2 May 2024 11:32:08 +0200
Subject: [PATCH 11/19] 1258: Setup font awesome icon loader
---
assets/app.js | 7 ++++--
.../fontawesome-icons_controller.js | 23 -------------------
assets/fontawesome.js | 10 ++++++++
3 files changed, 15 insertions(+), 25 deletions(-)
delete mode 100644 assets/controllers/fontawesome-icons_controller.js
create mode 100644 assets/fontawesome.js
diff --git a/assets/app.js b/assets/app.js
index 6f23110f..07a4dd09 100644
--- a/assets/app.js
+++ b/assets/app.js
@@ -5,8 +5,11 @@
* (and its CSS file) in your base layout (base.html.twig).
*/
-// any CSS you import will output into a single css file (app.css in this case)
+// Any CSS you import will output into a single css file (app.css in this case)
import "./styles/app.css";
-// start the Stimulus application
+// Start the Stimulus application
import "./bootstrap";
+
+// Start the Font Awesome icon to svg replacements
+import "./fontawesome";
diff --git a/assets/controllers/fontawesome-icons_controller.js b/assets/controllers/fontawesome-icons_controller.js
deleted file mode 100644
index c863040d..00000000
--- a/assets/controllers/fontawesome-icons_controller.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-// Add fontawesome icons
-*/
-// Import the stimulus controller
-import { Controller } from "@hotwired/stimulus";
-
-// Import the svg core library
-import { library } from '@fortawesome/fontawesome-svg-core'
-
-// To keep the package size as small as possible we only import icons we use
-// Import the icons from the free solid package.
-import {
- faMaximize,
-} from '@fortawesome/free-solid-svg-icons'
-
-export default class extends Controller {
- // Add the icons to the library for replacing with the intended svg.
- connect() {
- library.add([
- faMaximize,
- ])
- }
-}
diff --git a/assets/fontawesome.js b/assets/fontawesome.js
new file mode 100644
index 00000000..02b2744d
--- /dev/null
+++ b/assets/fontawesome.js
@@ -0,0 +1,10 @@
+// Import the svg core library
+import { library, dom } from '@fortawesome/fontawesome-svg-core'
+
+// Import the icons from the free solid package.
+import {
+ faMaximize,
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(faMaximize);
+dom.i2svg()
From d3edd2de58505a032ce16c588e9e3e833f42e702 Mon Sep 17 00:00:00 2001
From: Jesper Pedersen
Date: Thu, 2 May 2024 11:34:44 +0200
Subject: [PATCH 12/19] Styling
---
templates/planning/users.html.twig | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/templates/planning/users.html.twig b/templates/planning/users.html.twig
index 35048f3a..213257fc 100644
--- a/templates/planning/users.html.twig
+++ b/templates/planning/users.html.twig
@@ -1,31 +1,29 @@
-{{ 'planning.assignees'|trans }}
-
-
-
+
+
- {{ 'User'|trans }}
+ {{ 'planning.assignees'|trans }}
{% for week in weeks %}
- {{ week.displayName }}
+ {{ week.displayName }}
{% endfor %}
{% for assignee in assignees %}
-
+
{{ assignee.displayName }}
-
+
{{ svg_hide }}
-
+
{{ svg_expand }}
-
+
{% for week in weeks %}
{% set res = null %}
@@ -35,6 +33,9 @@
{% endif %}
{% endfor %}
el.dataset.active);
+
+ if (!activeColumn) {
+ return;
+ }
+
+ const activeIndex = activeColumn.dataset.index;
+ const scrollToIndex = Math.max(0, activeIndex - 1);
+ const scrollToColumn = this.columnTargets.find((el) => el.dataset.index == scrollToIndex );
+ const firstColumn = this.columnTargets.find((el) => el.dataset.index == 1 );
+
+ if (!scrollToColumn || !firstColumn) {
+ return;
+ }
+
+ const { x } = scrollToColumn.getBoundingClientRect()
+ const { x: firstColumnX } = firstColumn.getBoundingClientRect()
+
+ scrollContainer.scrollTo(x - firstColumnX, 0);
+ }
+}
diff --git a/templates/planning/users.html.twig b/templates/planning/users.html.twig
index 213257fc..7a7d3461 100644
--- a/templates/planning/users.html.twig
+++ b/templates/planning/users.html.twig
@@ -1,10 +1,21 @@
-