diff --git a/app/DoctrineMigrations/Version20230825104026_opening_hour_kind_entity.php b/app/DoctrineMigrations/Version20230825104026_opening_hour_kind_entity.php new file mode 100644 index 000000000..4327fd5d3 --- /dev/null +++ b/app/DoctrineMigrations/Version20230825104026_opening_hour_kind_entity.php @@ -0,0 +1,37 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('CREATE TABLE opening_hour_kind (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, start_date DATE DEFAULT NULL, end_date DATE DEFAULT NULL, enabled TINYINT(1) DEFAULT \'0\' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_5AEDCF52B03A8386 (created_by_id), INDEX IDX_5AEDCF52896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC'); + $this->addSql('ALTER TABLE opening_hour_kind ADD CONSTRAINT FK_5AEDCF52B03A8386 FOREIGN KEY (created_by_id) REFERENCES fos_user (id)'); + $this->addSql('ALTER TABLE opening_hour_kind ADD CONSTRAINT FK_5AEDCF52896DBBDE FOREIGN KEY (updated_by_id) REFERENCES fos_user (id)'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('DROP TABLE opening_hour_kind'); + } +} diff --git a/app/DoctrineMigrations/Version20230825120912_opening_hour_kind.php b/app/DoctrineMigrations/Version20230825120912_opening_hour_kind.php new file mode 100644 index 000000000..9be4c9737 --- /dev/null +++ b/app/DoctrineMigrations/Version20230825120912_opening_hour_kind.php @@ -0,0 +1,39 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE opening_hour ADD opening_hour_kind_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE opening_hour ADD CONSTRAINT FK_969BD7659BA06AF0 FOREIGN KEY (opening_hour_kind_id) REFERENCES opening_hour_kind (id) ON DELETE SET NULL'); + $this->addSql('CREATE INDEX IDX_969BD7659BA06AF0 ON opening_hour (opening_hour_kind_id)'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE opening_hour DROP FOREIGN KEY FK_969BD7659BA06AF0'); + $this->addSql('DROP INDEX IDX_969BD7659BA06AF0 ON opening_hour'); + $this->addSql('ALTER TABLE opening_hour DROP opening_hour_kind_id'); + } +} diff --git a/app/Resources/views/admin/event/_partial/form.html.twig b/app/Resources/views/admin/event/_partial/form.html.twig new file mode 100644 index 000000000..e09959df6 --- /dev/null +++ b/app/Resources/views/admin/event/_partial/form.html.twig @@ -0,0 +1,56 @@ +{% set edit = edit ?? false %} + +
+ {{ form_errors(form) }} +
+
+
+ {{ form_row(form.title) }} +
+
+ {{ form_row(form.kind) }} +
+
+
+
+ {{ form_row(form.date) }} +
+
+ {{ form_row(form.end) }} +
+
+
+ {{ form_row(form.location) }} +
+
+ {{ form_row(form.description) }} +
+
+ {{ form_row(form.imgFile) }} +
+ +{% if edit %} +
Nécessite un vote ?
+
+
+ {{ form_errors(form.need_proxy) }} + +
+
+ {{ form_errors(form.anonymous_proxy) }} + +
+
+
+
+ {{ form_row(form.max_date_of_last_registration) }} +
+
+ {% include "admin/member/_partial/created_updated_card.html.twig" with { item: event } %} +{% endif %} diff --git a/app/Resources/views/admin/event/edit.html.twig b/app/Resources/views/admin/event/edit.html.twig index 6e5297ec3..c733f8464 100644 --- a/app/Resources/views/admin/event/edit.html.twig +++ b/app/Resources/views/admin/event/edit.html.twig @@ -13,79 +13,10 @@

Editer un événement

{{ form_start(form) }} -
- {{ form_errors(form) }} -
-
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.kind) }} -
-
-
-
- {{ form_row(form.date) }} -
-
- {{ form_row(form.end) }} -
-
-
- {{ form_row(form.location) }} -
-
- {{ form_row(form.description) }} -
-
-
-
- {{ form_errors(form.imgFile) }} -
-
- {{ form_widget(form.imgFile) }} - {{ form_label(form.imgFile) }} -
-
-
-
Nécessite un vote ?
-
-
- {{ form_errors(form.need_proxy) }} - -
-
- {{ form_errors(form.anonymous_proxy) }} - -
-
-
-
- {{ form_row(form.max_date_of_last_registration) }} -
-
-{% if event.createdBy or event.updatedBy %} -
- {% if event.createdBy %} - Création le {{ event.createdAt | date_fr_full_with_time }} par {% include "admin/member/_partial/member_or_user_link.html.twig" with { user: event.createdBy, target_blank: true } %} -
- {% endif %} - {% if event.updatedBy %} - Dernière modification le {{ event.updatedAt | date_fr_full_with_time }} par {% include "admin/member/_partial/member_or_user_link.html.twig" with { user: event.updatedBy, target_blank: true } %} - {% endif %} -
-{% endif %} -
-
- -
+{% include "/admin/event/_partial/form.html.twig" with { form: form, edit: true, event: event } %} + {{ form_end(form) }} {% if is_granted("ROLE_ADMIN") %} @@ -102,9 +33,9 @@ {{ form_start(delete_form) }} {{ form_widget(delete_form) }} -
- -
+ {{ form_end(delete_form) }} {% endif %} {% endblock %} diff --git a/app/Resources/views/admin/event/index.html.twig b/app/Resources/views/admin/event/index.html.twig index 9cac9d5dd..8c9569244 100644 --- a/app/Resources/views/admin/event/index.html.twig +++ b/app/Resources/views/admin/event/index.html.twig @@ -30,5 +30,5 @@ {% endif %}
addAjouter un événement -tuneGénérer un widget +tuneGénérer un widget {% endblock %} diff --git a/app/Resources/views/admin/event/kind/_partial/form.html.twig b/app/Resources/views/admin/event/kind/_partial/form.html.twig new file mode 100644 index 000000000..9c979a447 --- /dev/null +++ b/app/Resources/views/admin/event/kind/_partial/form.html.twig @@ -0,0 +1,6 @@ +
+ {{ form_errors(form) }} +
+
+ {{ form_row(form.name) }} +
diff --git a/app/Resources/views/admin/event/kind/edit.html.twig b/app/Resources/views/admin/event/kind/edit.html.twig index dae65e6b6..b0cb8f629 100644 --- a/app/Resources/views/admin/event/kind/edit.html.twig +++ b/app/Resources/views/admin/event/kind/edit.html.twig @@ -13,24 +13,18 @@

Editer un type d'événement

{{ form_start(form) }} -
- {{ form_errors(form) }} -
-
- {{ form_row(form.name) }} -
-
-
- -
+{% include "/admin/event/kind/_partial/form.html.twig" with { form: form } %} + {{ form_end(form) }} {% if is_granted("ROLE_ADMIN") %} {{ form_start(delete_form) }} {{ form_widget(delete_form) }} -
- -
+ {{ form_end(delete_form) }} {% endif %} {% endblock %} diff --git a/app/Resources/views/admin/event/kind/list.html.twig b/app/Resources/views/admin/event/kind/list.html.twig index 129f7b9be..f7e0d974d 100644 --- a/app/Resources/views/admin/event/kind/list.html.twig +++ b/app/Resources/views/admin/event/kind/list.html.twig @@ -25,7 +25,9 @@ {{ eventKind.name }} {{ eventKind.events | length }} - editEditer + + editEditer + {% endfor %} @@ -33,5 +35,7 @@
-addAjouter un type d'événement + + addAjouter un type d'événement + {% endblock %} diff --git a/app/Resources/views/admin/event/kind/new.html.twig b/app/Resources/views/admin/event/kind/new.html.twig index bb03c2549..d78b2b130 100644 --- a/app/Resources/views/admin/event/kind/new.html.twig +++ b/app/Resources/views/admin/event/kind/new.html.twig @@ -1,22 +1,23 @@ {% extends 'layout.html.twig' %} -{% block title %}Ajouter un événement - {{ site_name }}{% endblock %} +{% block title %}Ajouter un type d'événement - {{ site_name }}{% endblock %} {% block breadcrumbs %} homechevron_right build Administrationchevron_right -list Liste des types d'événementschevron_right +list Liste des types d'événementschevron_right add Ajouter {% endblock %} {% block content %} -

Nouveau type d'événement

+

Nouveau type d'événement

- {{ form_start(form) }} - {{ form_widget(form) }} -
-
- -
- {{ form_end(form) }} +{{ form_start(form) }} +{% include "/admin/event/kind/_partial/form.html.twig" with { form: form } %} + +{{ form_end(form) }} + +Annuler {% endblock %} diff --git a/app/Resources/views/admin/event/new.html.twig b/app/Resources/views/admin/event/new.html.twig index d72ad615f..ee59b0ee7 100644 --- a/app/Resources/views/admin/event/new.html.twig +++ b/app/Resources/views/admin/event/new.html.twig @@ -13,35 +13,11 @@

Nouvel événement

{{ form_start(form) }} -
- {{ form_errors(form) }} -
-
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.kind) }} -
-
-
-
- {{ form_row(form.date) }} -
-
- {{ form_row(form.end) }} -
-
-
- {{ form_row(form.location) }} -
-
- {{ form_row(form.description) }} -
-
- {{ form_row(form.imgFile) }} -
-Annuler - +{% include "/admin/event/_partial/form.html.twig" with { form: form } %} + {{ form_end(form) }} + +Annuler {% endblock %} diff --git a/app/Resources/views/admin/event/widget/generate.html.twig b/app/Resources/views/admin/event/widget_generator.html.twig similarity index 100% rename from app/Resources/views/admin/event/widget/generate.html.twig rename to app/Resources/views/admin/event/widget_generator.html.twig diff --git a/app/Resources/views/admin/index.html.twig b/app/Resources/views/admin/index.html.twig index 1444bc34d..138fdd005 100644 --- a/app/Resources/views/admin/index.html.twig +++ b/app/Resources/views/admin/index.html.twig @@ -83,6 +83,9 @@ scheduleHoraires d'ouverture + + scheduleTypes d'horaires d'ouverture + blockFermetures exceptionnelles diff --git a/app/Resources/views/admin/member/_partial/created_updated_card.html.twig b/app/Resources/views/admin/member/_partial/created_updated_card.html.twig new file mode 100644 index 000000000..868689add --- /dev/null +++ b/app/Resources/views/admin/member/_partial/created_updated_card.html.twig @@ -0,0 +1,11 @@ +{% if item.createdBy or item.updatedBy %} +
+ {% if item.createdBy %} + Création le {{ item.createdAt | date_fr_full_with_time }} par {% include "admin/member/_partial/member_or_user_link.html.twig" with { user: item.createdBy, target_blank: true } %} +
+ {% endif %} + {% if item.updatedBy %} + Dernière modification le {{ item.updatedAt | date_fr_full_with_time }} par {% include "admin/member/_partial/member_or_user_link.html.twig" with { user: item.updatedBy, target_blank: true } %} + {% endif %} +
+{% endif %} diff --git a/app/Resources/views/admin/openinghour/_partial/form.html.twig b/app/Resources/views/admin/openinghour/_partial/form.html.twig index 2e233fadd..92b9af220 100644 --- a/app/Resources/views/admin/openinghour/_partial/form.html.twig +++ b/app/Resources/views/admin/openinghour/_partial/form.html.twig @@ -30,3 +30,8 @@ +
+
+ {{ form_row(form.kind) }} +
+
diff --git a/app/Resources/views/admin/openinghour/_partial/widget.html.twig b/app/Resources/views/admin/openinghour/_partial/widget.html.twig index ee3fafe21..a5320f68d 100644 --- a/app/Resources/views/admin/openinghour/_partial/widget.html.twig +++ b/app/Resources/views/admin/openinghour/_partial/widget.html.twig @@ -2,7 +2,15 @@ {% block content %} {% if title %} -

Horaires d'ouverture :

+

Horaires d'ouverture

+{% endif %} +{% if kind_title %} +

+ {{ openingHourKind.name }} + {% if openingHourKind.startDate and openingHourKind.endDate %} + (du {{ openingHourKind.startDate | date_fr_long }} au {{ openingHourKind.endDate | date_fr_long }}) + {% endif %} +

{% endif %} {% if align == "left" %} {% include "/admin/openinghour/_partial/list.html.twig" with { openingHours: openingHours } %} diff --git a/app/Resources/views/admin/openinghour/edit.html.twig b/app/Resources/views/admin/openinghour/edit.html.twig index fba237f20..1ae1e3d4c 100644 --- a/app/Resources/views/admin/openinghour/edit.html.twig +++ b/app/Resources/views/admin/openinghour/edit.html.twig @@ -14,15 +14,15 @@ {{ form_start(form) }} {% include "/admin/openinghour/_partial/form.html.twig" with { form: form } %} -
- -
+ {{ form_end(form) }} {{ form_start(delete_form) }} {{ form_widget(delete_form) }} -
- -
+ {{ form_end(delete_form) }} {% endblock %} diff --git a/app/Resources/views/admin/openinghour/index.html.twig b/app/Resources/views/admin/openinghour/index.html.twig index be3e38c43..9a4da33a7 100644 --- a/app/Resources/views/admin/openinghour/index.html.twig +++ b/app/Resources/views/admin/openinghour/index.html.twig @@ -13,9 +13,11 @@ {% if openingHours %}
-
- {% include "/admin/openinghour/_partial/card.html.twig" with { openingHours: openingHours } %} -
+ {% for openingHourKind in openingHourKinds %} +
+ {% include "/admin/openinghour/kind/_partial/card.html.twig" with { openingHourKind: openingHourKind } %} +
+ {% endfor %}
{% else %}
@@ -31,6 +33,7 @@ Jour d'ouverture Heure de début Heure de fin + Type Actions @@ -40,6 +43,7 @@ {{ openingHour.dayOfWeekString | capitalize }} {{ openingHour.start | time_short }} {{ openingHour.end | time_short }} + {{ openingHour.kind }} edit Editer diff --git a/app/Resources/views/admin/openinghour/_partial/card.html.twig b/app/Resources/views/admin/openinghour/kind/_partial/card.html.twig similarity index 50% rename from app/Resources/views/admin/openinghour/_partial/card.html.twig rename to app/Resources/views/admin/openinghour/kind/_partial/card.html.twig index e1a20bde6..791e4f88a 100644 --- a/app/Resources/views/admin/openinghour/_partial/card.html.twig +++ b/app/Resources/views/admin/openinghour/kind/_partial/card.html.twig @@ -1,5 +1,6 @@ {% set openingHourJoinString = "&" %}
- {% include "/admin/openinghour/_partial/table.html.twig" with { openingHours: openingHours } %} +

{{ openingHourKind.name }}

+ {% include "/admin/openinghour/_partial/table.html.twig" with { openingHours: openingHourKind.openingHours } %}
diff --git a/app/Resources/views/admin/openinghour/kind/_partial/form.html.twig b/app/Resources/views/admin/openinghour/kind/_partial/form.html.twig new file mode 100644 index 000000000..ad59402e3 --- /dev/null +++ b/app/Resources/views/admin/openinghour/kind/_partial/form.html.twig @@ -0,0 +1,25 @@ +{% set edit = edit ?? false %} + +
+ {{ form_errors(form) }} +
+{{ form_row(form.name) }} +
+
+ {{ form_row(form.start_date) }} +
+
+ {{ form_row(form.end_date) }} +
+
+
+ {{ form_errors(form.enabled) }} + +
+ +{% if edit %} + {% include "admin/member/_partial/created_updated_card.html.twig" with { item: openingHourKind } %} +{% endif %} diff --git a/app/Resources/views/admin/openinghour/kind/edit.html.twig b/app/Resources/views/admin/openinghour/kind/edit.html.twig new file mode 100644 index 000000000..583b286ad --- /dev/null +++ b/app/Resources/views/admin/openinghour/kind/edit.html.twig @@ -0,0 +1,30 @@ +{% extends 'layout.html.twig' %} + +{% block title %}Editer un type d'horaire d'ouverture - {{ site_name }}{% endblock %} + +{% block breadcrumbs %} +
homechevron_right +build Administrationchevron_right +list Liste des types d'horaire d'ouvertureschevron_right +edit Editer +{% endblock %} + +{% block content %} +

Editer un type d'horaire d'ouverture

+ +{{ form_start(form) }} +{% include "/admin/openinghour/kind/_partial/form.html.twig" with { form: form, edit: true, openingHourKind: openingHourKind } %} + +{{ form_end(form) }} + +{% if is_granted("ROLE_ADMIN") %} + {{ form_start(delete_form) }} + {{ form_widget(delete_form) }} + + {{ form_end(delete_form) }} +{% endif %} +{% endblock %} diff --git a/app/Resources/views/admin/openinghour/kind/list.html.twig b/app/Resources/views/admin/openinghour/kind/list.html.twig new file mode 100644 index 000000000..5f65d1cb8 --- /dev/null +++ b/app/Resources/views/admin/openinghour/kind/list.html.twig @@ -0,0 +1,55 @@ +{% extends 'layout.html.twig' %} + +{% block title %}Liste des types d'horaires d'ouverture - {{ site_name }}{% endblock %} + +{% block breadcrumbs %} +homechevron_right +build Administrationchevron_right +list Liste des types d'horaires d'ouverture +{% endblock %} + +{% block content %} +

Liste des types d'horaires d'ouverture ({{ openingHourKinds | length }})

+ + + + + + + + + + + + + {% for openingHourKind in openingHourKinds %} + + + + + + + + {% endfor %} + +
EtatType d'horaire d'ouverturePériodeNombre d'horaires d'ouvertureActions
+ {% if not openingHourKind.enabled %} + close + {% else %} + check + {% endif %} + {{ openingHourKind.name }} + {% if openingHourKind.startDate and openingHourKind.endDate %} + {{ openingHourKind.startDate | date_fr_full }} - {{ openingHourKind.endDate | date_fr_full }} + {% endif %} + {{ openingHourKind.openingHours | length }} + + editEditer + +
+ +
+ + addAjouter un type d'horaire d'ouverture + +{% endblock %} diff --git a/app/Resources/views/admin/openinghour/kind/new.html.twig b/app/Resources/views/admin/openinghour/kind/new.html.twig new file mode 100644 index 000000000..5d4d50b1f --- /dev/null +++ b/app/Resources/views/admin/openinghour/kind/new.html.twig @@ -0,0 +1,23 @@ +{% extends 'layout.html.twig' %} + +{% block title %}Ajouter un type d'horaire d'ouverture - {{ site_name }}{% endblock %} + +{% block breadcrumbs %} +homechevron_right +build Administrationchevron_right +list Liste des types d'horaire d'ouvertureschevron_right +add Ajouter +{% endblock %} + +{% block content %} +

Nouveau type d'horaire d'ouverture

+ +{{ form_start(form) }} +{% include "/admin/openinghour/kind/_partial/form.html.twig" with { form: form } %} + +{{ form_end(form) }} + +Annuler +{% endblock %} diff --git a/app/Resources/views/admin/openinghour/new.html.twig b/app/Resources/views/admin/openinghour/new.html.twig index 8c182da36..54fd87ce3 100644 --- a/app/Resources/views/admin/openinghour/new.html.twig +++ b/app/Resources/views/admin/openinghour/new.html.twig @@ -14,8 +14,10 @@ {{ form_start(form) }} {% include "/admin/openinghour/_partial/form.html.twig" with { form: form } %} -
- -
+ {{ form_end(form) }} + +Annuler {% endblock %} diff --git a/app/Resources/views/admin/openinghour/widget_generator.html.twig b/app/Resources/views/admin/openinghour/widget_generator.html.twig index bce39d701..e5487a580 100644 --- a/app/Resources/views/admin/openinghour/widget_generator.html.twig +++ b/app/Resources/views/admin/openinghour/widget_generator.html.twig @@ -18,17 +18,24 @@
- {{ form.title.vars.label }} -
- -
+ {{ form_label(form.kind) }} + {{ form_widget(form.kind) }}
+
+ {{ form_errors(form.title) }} + +
+
+ {{ form_errors(form.kind_title) }} + +
{{ form_label(form.align) }} diff --git a/app/Resources/views/event/_partial/widget.html.twig b/app/Resources/views/event/_partial/widget.html.twig index 250076746..d2476ebb8 100644 --- a/app/Resources/views/event/_partial/widget.html.twig +++ b/app/Resources/views/event/_partial/widget.html.twig @@ -2,10 +2,11 @@ {% block content %} {% if title %} - liste des prochains événements - {% if eventKind %}{{ eventKind.name }}{% endif %} - {% if maxDate %}(jusqu'au {{ maxDate | date_short }}){% endif %} - : +

+ liste des prochains événements + {% if eventKind %}{{ eventKind.name }}{% endif %} + {% if maxDate %}(jusqu'au {{ maxDate | date_short }}){% endif %} +

{% endif %}