diff --git a/README.md b/README.md index aab0fbf..324c4bb 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ - Copy the file `.env` to `.env.local` and set configuration - `php bin/console -n doctrine:migrations:diff` - `php bin/console -n doctrine:migrations:migrate` +- `php bin/console cache:clear` @@ -23,5 +24,6 @@ - `composer install` or `php composer.phar install` - `php bin/console -n doctrine:migrations:diff` - `php bin/console -n doctrine:migrations:migrate` +- `php bin/console cache:clear` Or use `update.bat` diff --git a/changelog.md b/changelog.md index f59c4bc..377aaaf 100644 --- a/changelog.md +++ b/changelog.md @@ -5,20 +5,21 @@ | Date | Number | Type | Version | |-----------:|-------:|:--------|:----------------------------| | 2021-03-31 | 1 | Release | [v1.0.0](###Release-v1.0.0) | -| 2021-03-31 | 2 | Hotfix | [v1.0.1](###Release-v1.0.1) | -| 2021-03-31 | 3 | Hotfix | [v1.0.2](###Release-v1.0.2) | -| 2021-04-06 | 4 | Hotfix | [v1.0.3](###Release-v1.0.3) | +| 2021-03-31 | 2 | Hotfix | [v1.0.1](###Hotfix-v1.0.1) | +| 2021-03-31 | 3 | Hotfix | [v1.0.2](###Hotfix-v1.0.2) | +| 2021-04-06 | 4 | Release | [v1.0.3](###Release-v1.0.3) | +| 2021-04-13 | 5 | Release | [v1.0.3](###Release-v1.0.4) | ## Changes ### Release v1.0.0 First viable version -### Release v1.0.1 +### Hotfix v1.0.1 #### Fix - README update - update.bat -### Release v1.0.2 +### Hotfix v1.0.2 #### Fix - InvalidEnumKeyException namespace @@ -29,4 +30,16 @@ #### Fix - Activity form -- Typo on nav \ No newline at end of file +- Typo on nav + +### Release v1.0.4 +#### Feature +- Add date filter to activity view + +#### Improve +- Smaller text in table header +- Add postponed status + +#### Fix +- Cache clear in update.bat +- Cache clear in README \ No newline at end of file diff --git a/composer.lock b/composer.lock index 56c2493..935b7d0 100644 --- a/composer.lock +++ b/composer.lock @@ -669,16 +669,16 @@ }, { "name": "doctrine/doctrine-migrations-bundle", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineMigrationsBundle.git", - "reference": "d1248471734c62b94baac36cb18e9c635775eeb0" + "reference": "91f0a5e2356029575f3038432cc188b12f9d5da5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/d1248471734c62b94baac36cb18e9c635775eeb0", - "reference": "d1248471734c62b94baac36cb18e9c635775eeb0", + "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/91f0a5e2356029575f3038432cc188b12f9d5da5", + "reference": "91f0a5e2356029575f3038432cc188b12f9d5da5", "shasum": "" }, "require": { @@ -733,7 +733,7 @@ ], "support": { "issues": "https://github.com/doctrine/DoctrineMigrationsBundle/issues", - "source": "https://github.com/doctrine/DoctrineMigrationsBundle/tree/3.1.0" + "source": "https://github.com/doctrine/DoctrineMigrationsBundle/tree/3.1.1" }, "funding": [ { @@ -749,7 +749,7 @@ "type": "tidelift" } ], - "time": "2021-04-05T20:45:07+00:00" + "time": "2021-04-10T16:48:53+00:00" }, { "name": "doctrine/event-manager", @@ -1198,16 +1198,16 @@ }, { "name": "doctrine/orm", - "version": "2.8.3", + "version": "2.8.4", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "657a30f8ceef2a78c2ff36a9fe6c6a6717c1c448" + "reference": "a588555ecd837b8d7e89355d9a13902e54d529c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/657a30f8ceef2a78c2ff36a9fe6c6a6717c1c448", - "reference": "657a30f8ceef2a78c2ff36a9fe6c6a6717c1c448", + "url": "https://api.github.com/repos/doctrine/orm/zipball/a588555ecd837b8d7e89355d9a13902e54d529c7", + "reference": "a588555ecd837b8d7e89355d9a13902e54d529c7", "shasum": "" }, "require": { @@ -1279,9 +1279,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.8.3" + "source": "https://github.com/doctrine/orm/tree/2.8.4" }, - "time": "2021-04-01T21:16:53+00:00" + "time": "2021-04-05T18:38:36+00:00" }, { "name": "doctrine/persistence", @@ -2211,16 +2211,16 @@ }, { "name": "sensio/framework-extra-bundle", - "version": "v6.1.1", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "8ef75e99f20332f2725587896364f7079b53de95" + "reference": "676262b7a65a1033befbcf59e180d072df7504b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/8ef75e99f20332f2725587896364f7079b53de95", - "reference": "8ef75e99f20332f2725587896364f7079b53de95", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/676262b7a65a1033befbcf59e180d072df7504b6", + "reference": "676262b7a65a1033befbcf59e180d072df7504b6", "shasum": "" }, "require": { @@ -2283,9 +2283,9 @@ ], "support": { "issues": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues", - "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.1.1" + "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.1.2" }, - "time": "2021-02-23T11:50:58+00:00" + "time": "2021-04-09T16:14:11+00:00" }, { "name": "symfony/asset", diff --git a/config/packages/mapping/ActivityEntity.orm.xml b/config/packages/mapping/ActivityEntity.orm.xml index a8e0e3d..3857ed3 100644 --- a/config/packages/mapping/ActivityEntity.orm.xml +++ b/config/packages/mapping/ActivityEntity.orm.xml @@ -9,6 +9,6 @@ - + \ No newline at end of file diff --git a/public/styles/table.css b/public/styles/table.css index 242e973..f06acd3 100644 --- a/public/styles/table.css +++ b/public/styles/table.css @@ -8,7 +8,7 @@ background-color: var(--primary-light); color: var(--secondary); font-weight: bold; - font-size: 1.5rem; + font-size: 1.25rem; padding-left: 1rem; padding-right: 1rem; padding-top: 0.25rem; diff --git a/src/Entity/ActivityEntity.php b/src/Entity/ActivityEntity.php index 78f68f5..cb5ad03 100644 --- a/src/Entity/ActivityEntity.php +++ b/src/Entity/ActivityEntity.php @@ -17,6 +17,7 @@ StatusEnum::OPEN, StatusEnum::IN_PROGRESS, StatusEnum::WAITING, + StatusEnum::POSTPONED, StatusEnum::CLOSED, ]; diff --git a/src/Enum/StatusEnum.php b/src/Enum/StatusEnum.php index 570fb5a..ee0e473 100644 --- a/src/Enum/StatusEnum.php +++ b/src/Enum/StatusEnum.php @@ -18,17 +18,21 @@ /** @var string Actions are planified and nothing is happening before */ public const PLANIFIED = 'planified'; + + /** @var string Activity is postponed */ + public const POSTPONED = 'posetponed'; /** @var No more actions required, success or fail */ public const CLOSED = 'closed'; /** @var array Names of status */ public const STATUS_NAME = [ - 'open' => 'Ouvert', - 'inProgress' => 'En cours', - 'waiting' => 'En attente', - 'planified' => 'Planifié', - 'closed' => 'Clos', + self::OPEN => 'Ouvert', + self::IN_PROGRESS => 'En cours', + self::WAITING => 'En attente', + self::PLANIFIED => 'Planifié', + self::POSTPONED => 'Reporté', + self::CLOSED => 'Clos', ]; /** @var array Status considered active */ diff --git a/src/Form/Activity/ActivityFilterForm.php b/src/Form/Activity/ActivityFilterForm.php index c2f224a..17d7efe 100644 --- a/src/Form/Activity/ActivityFilterForm.php +++ b/src/Form/Activity/ActivityFilterForm.php @@ -14,6 +14,8 @@ use Doctrine\Common\Collections\Criteria; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\Extension\Core\Type\ResetType; class ActivityFilterForm extends AbstractFormManager { @@ -34,6 +36,9 @@ 'status' => null, 'active' => false, 'notClosed' => true, + + 'endAfter' => null, + 'startBefore' => null, ]); parent::__construct($formBuilder, $data, $usesToken); } @@ -75,6 +80,20 @@ ->neq('activity.status', StatusEnum::CLOSED)); } + // Filter dates + if (!is_null($data['endAfter'])) { + $criteria->andWhere($criteria->expr() + ->orX($criteria->expr() + ->isNull('activity.realEndDate'), $criteria->expr() + ->gt('activity.realEndDate', $data['endAfter']))); + } + if (!is_null($data['startBefore'])) { + $criteria->andWhere($criteria->expr() + ->orX($criteria->expr() + ->isNull('activity.realStartDate'), $criteria->expr() + ->lt('activity.realStartDate', $data['startBefore']))); + } + // Create query $query = $activityRepository->createQueryBuilder('activity'); $query->join(ActorEntity::class, 'actor', Join::WITH, 'activity.actor = actor'); @@ -132,7 +151,16 @@ 'required' => false, ]); + // Date filters + $formBuilder->add('endAfter', DateType::class, [ + 'required' => false, + 'widget' => 'single_text', + ])->add('startBefore', DateType::class, [ + 'required' => false, + 'widget' => 'single_text', + ]); + // Submit - $formBuilder->add('submit', SubmitType::class); + $formBuilder->add('submit', SubmitType::class)->add('reset', ResetType::class); } } \ No newline at end of file diff --git a/src/Repository/ActorRepository.php b/src/Repository/ActorRepository.php index 8fea04b..b096534 100644 --- a/src/Repository/ActorRepository.php +++ b/src/Repository/ActorRepository.php @@ -2,6 +2,7 @@ namespace App\Repository; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use App\Entity\ActorEntity; /** @@ -29,6 +30,19 @@ } return $this->findBy($critera, ActorRepository::DEFAULT_ORDER); } + + /** + * {@inheritdoc} + */ + public function createQueryBuilder($alias, $indexBy = null): QueryBuilder + { + $queryBuilder = parent::createQueryBuilder($alias, $indexBy); + foreach ($this::DEFAULT_ORDER as $field => $order) { + $queryBuilder->addOrderBy($alias . '.' . $field, $order); + } + + return $queryBuilder; + } /** * {@inheritdoc} diff --git a/templates/_includes/html/form/activity/filter.html.twig b/templates/_includes/html/form/activity/filter.html.twig index 7141b35..37e9dc9 100644 --- a/templates/_includes/html/form/activity/filter.html.twig +++ b/templates/_includes/html/form/activity/filter.html.twig @@ -24,6 +24,16 @@ {{ form_label(form.notClosed, 'Non clos') }} +
+
+ {{ form_label(form.endAfter, 'Terminé après', {label_attr: {class: 'input-text-label'}}) }} + {{ form_widget(form.endAfter, {attr: {class: 'w-100'}}) }} +
+
+ {{ form_label(form.startBefore, 'Commencé avant', {label_attr: {class: 'input-text-label'}}) }} + {{ form_widget(form.startBefore, {attr: {class: 'w-100'}}) }} +
+
@@ -31,6 +41,11 @@ {{ form_widget(form.submit, {attr: {class: 'w-100'}, label: 'Filtrer'}) }}
+
+
+ {{ form_widget(form.reset, {attr: {class: 'w-100'}, label: 'Réinitialiser'}) }} +
+

diff --git a/update.bat b/update.bat index b0d138b..aec3151 100644 --- a/update.bat +++ b/update.bat @@ -2,4 +2,5 @@ php composer.phar install php bin/console doctrine:migrations:diff -n php bin/console doctrine:migrations:migrate -n +php bin/console cache:clear pause \ No newline at end of file