diff --git a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php new file mode 100644 index 000000000..4f87cc300 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php @@ -0,0 +1,10 @@ + '@ChillMain/User/edit.html.twig' ] ] - ] + ], + [ + 'class' => LocationType::class, + 'name' => 'main_location_type', + 'base_path' => '/admin/main/location-type', + 'base_role' => 'ROLE_ADMIN', + 'form_class' => LocationTypeType::class, + 'controller' => LocationTypeController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/LocationType/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/LocationType/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/LocationType/edit.html.twig', + ] + ] + ], ], 'apis' => [ [ diff --git a/src/Bundle/ChillMainBundle/Form/LocationTypeType.php b/src/Bundle/ChillMainBundle/Form/LocationTypeType.php new file mode 100644 index 000000000..a720c6f8d --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/LocationTypeType.php @@ -0,0 +1,46 @@ +add('title', TranslatableStringFormType::class, + [ + 'label' => 'Name', + ]) + ->add('availableForUsers', ChoiceType::class, + [ + 'choices' => [ + 'Yes' => true, + 'No' => false + ], + 'expanded' => true + ]) + ->add('addressRequired', ChoiceType::class, + [ + 'choices' => [ + 'optional' => LocationType::STATUS_OPTIONAL, + 'required' => LocationType::STATUS_REQUIRED, + 'never' => LocationType::STATUS_NEVER, + ], + 'expanded' => true + ]) + ->add('contactData', ChoiceType::class, + [ + 'choices' => [ + 'optional' => LocationType::STATUS_OPTIONAL, + 'required' => LocationType::STATUS_REQUIRED, + 'never' => LocationType::STATUS_NEVER, + ], + 'expanded' => true + ]); + } +} diff --git a/src/Bundle/ChillMainBundle/Resources/views/LocationType/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/LocationType/edit.html.twig new file mode 100644 index 000000000..ad0a38f73 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/LocationType/edit.html.twig @@ -0,0 +1,14 @@ +{% extends '@ChillMain/Admin/layout.html.twig' %} + +{% block title %} +{% include('@ChillMain/CRUD/_edit_title.html.twig') %} +{% endblock %} + +{% block admin_content %} +{# {% as we are in the admin layout, we override the admin content with the CRUD content %} #} +{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {# we do not have "view" page. We empty the corresponding block #} + {% block content_form_actions_view %}{% endblock %} + {% block content_form_actions_save_and_show %}{% endblock %} +{% endembed %} +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig new file mode 100644 index 000000000..16d264097 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig @@ -0,0 +1,47 @@ +{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} + +{% block admin_content %} +
{{ 'Title'|trans }} | +{{ 'Available for users'|trans }} | +{{ 'Address required'|trans }} | +{{ 'Contact data'|trans }} | +|
---|---|---|---|---|
{{ entity.title | localize_translatable_string }} | ++ {%- if entity.availableForUsers -%} + + {%- else -%} + + {%- endif -%} + | +{{ entity.addressRequired|trans }} | +{{ entity.contactData|trans }} | ++ + | +