Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/charter-page-inscription : #1139 - Déplace la page d'inscription #1516

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% extends ':admin/association/membership:_base.html.twig' %}

{% block page_title %}Formulaire d'inscription à l'AFUP{% endblock %}

{% block submenu %}
{{ render(controller(
'AppBundle\\Controller\\SecondaryMenuController::displayAction',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_ASSOCIATION') }
)) }}
{% endblock %}

{% block page_content %}
<article id="company-membership">
{{ form_start(form) }}
<fieldset>
<legend>Information</legend>
<div>
{{ form_errors(form) }}
{{ form_row(form.civility) }}
{{ form_row(form.userCommonInfo.lastName) }}
{{ form_row(form.userCommonInfo.firstName) }}
{{ form_row(form.userCommonInfo.username) }}
{{ form_row(form.userCommonInfo.email) }}
{{ form_row(form.userCommonInfo.address) }}
{{ form_row(form.userCommonInfo.zipcode) }}
{{ form_row(form.userCommonInfo.city) }}
{{ form_row(form.country) }}
{{ form_row(form.userCommonInfo.phone) }}
{{ form_row(form.mobilephone) }}
{{ form_row(form.nearestOffice) }}
<div>
{{ form_widget(form.userCommonInfo.password) }}
</div>
</div>
</fieldset>
<div class="right">
{{ form_widget(form.userCommonInfo.save, {attr: { "class": "button button--call-to-action"}}) }}
</div>
{{ form_end(form) }}
</article>
{% endblock %}
57 changes: 57 additions & 0 deletions app/Resources/views/form_theme.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% use 'form_div_layout.html.twig' %}

{% block form_row %}
{{ parent() }}
{% if form.vars.help ?? false %}
<div>
<label></label>
<span class="form-help">{{ form.vars.help }}</span>
</div>
{% endif %}
{% endblock form_row %}

{# TODO : A supprimer une fois monté de version suffisante pour que ce soit SF qu'ils fassent la gestion de "*" dans le cas où le champs est required #}
{% block form_label %}
{% if label is not same as(false) -%}
{% if not compound -%}
{% set label_attr = label_attr|merge({'for': id}) %}
{%- endif -%}
{% if required -%}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{%- endif -%}
{% if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>
{%- if translation_domain is same as(false) -%}
{{- label -}}
{%- else -%}
{{- label|trans({}, translation_domain) -}}
{%- endif -%}
{# OVERRIDE #}
{% if required -%}
*
{%- endif -%}
{# END OVERRIDE #}
</{{ element|default('label') }}>
{%- endif -%}
{% endblock form_label %}

{%- block form_errors -%}
{%- if errors|length > 0 -%}
{%- for error in errors -%}
<div>
<label></label>
<span style="color: red;">{{ error.message }}</span>
</div>
{%- endfor -%}
<label></label>
{%- endif -%}
{%- endblock form_errors -%}
13 changes: 0 additions & 13 deletions app/Resources/views/form_theme_errors.html.twig

This file was deleted.

11 changes: 0 additions & 11 deletions app/Resources/views/form_theme_help.html.twig

This file was deleted.

2 changes: 1 addition & 1 deletion app/Resources/views/site/become_member.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<tr>
<td class="argument-list__strong">
{{ membership_fee_natural_person }}€ TTC / an / pour une personne<br />
<a href="{{ url('legacy_inscription') }}" class="button button--call-to-action">Adhérer en tant que particulier</a>
<a href="{{ url('member_membership') }}" class="button button--call-to-action">Adhérer en tant que particulier</a>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<article id="company-membership">
<p>
Ce formulaire est réservé aux entreprises. Vous êtes un particulier ou un indépendant ?
Retrouvez le <a href="{{ url('legacy_inscription') }}">formulaire d'adhésion dédié</a>.
Retrouvez le <a href="{{ url('member_membership') }}">formulaire d'adhésion dédié</a>.
</p>
{{ form_start(form) }}
<fieldset>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% extends ':admin/association/membership:_base.html.twig' %}

{% form_theme form with [
'form_theme_errors.html.twig'
] %}

{% block submenu %}
{% include ':admin/association/membership:_company_menu.html.twig' with {
current: "public_profile"
Expand Down
2 changes: 1 addition & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ twig:
strict_variables: "%kernel.debug%"
globals:
photo_storage: '@AppBundle\CFP\PhotoStorage'
form_themes: ['form_theme_help.html.twig']
form_themes: ['form_theme.html.twig']

ting:
connections:
Expand Down
4 changes: 0 additions & 4 deletions app/config/routing/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ admin_login:
admin_logout:
path: /logout

legacy_inscription:
path: /register
defaults: {_controller: AppBundle:Legacy:register}

admin_password:
path: /password
defaults: {_controller: AppBundle\Controller\Admin\LostPasswordAction}
Expand Down
6 changes: 6 additions & 0 deletions app/config/routing/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ company_membership:
options:
sitemap: true

member_membership:
path: /adherer/particulier
defaults: {_controller: AppBundle:MemberShip:member}
options:
sitemap: true

company_membership_payment:
path: /adherer/entreprise/paiement-{invoiceNumber}-{token}
defaults: {_controller: AppBundle:MemberShip:payment}
Expand Down
3 changes: 3 additions & 0 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ services:
AppBundle\Association\Form\UserEditFormDataFactory:
autowire: true

AppBundle\Association\Factory\UserFactory:
autowire: true

AppBundle\Offices\OfficesCollection:
autowire: true

Expand Down
2 changes: 0 additions & 2 deletions htdocs/templates/administration/inscription.html

This file was deleted.

22 changes: 22 additions & 0 deletions sources/AppBundle/Association/Factory/UserFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace AppBundle\Association\Factory;

use AppBundle\Association\Model\User;

class UserFactory
{
public function createForRegister(): User
{
$user = new User();

return
$user
->setCivility(User::CIVILITE_M)
->setCountry('FR')
->setLevel(User::LEVEL_MEMBER)
->setStatus(User::STATUS_ACTIVE)
->setDirectoryLevel(User::LEVEL_MEMBER)
;
}
}
29 changes: 29 additions & 0 deletions sources/AppBundle/Association/Form/NearestOfficeChoiceType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace AppBundle\Association\Form;

use AppBundle\Offices\OfficesCollection;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class NearestOfficeChoiceType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);

$officesCollection = new OfficesCollection();
$offices = ['-Aucune-' => ''];
foreach ($officesCollection->getOrderedLabelsByKey() as $key => $label) {
$offices[$label] = $key;
}

$resolver->setDefaults(['choices' => $offices]);
}

public function getParent()
{
return ChoiceType::class;
}
}
51 changes: 51 additions & 0 deletions sources/AppBundle/Association/Form/RegisterUserType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace AppBundle\Association\Form;

use AppBundle\Association\Model\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class RegisterUserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('userCommonInfo', UserType::class, [
'inherit_data' => true,
'data_class' => User::class,
])
->add('country', CountryType::class, [
'label' => 'Pays',
'required' => true
])
->add('mobilephone', TelType::class, [
'label' => 'Portable',
'required' => false
])
->add('nearestOffice', NearestOfficeChoiceType::class, [
'required' => false
])
->add('civility', ChoiceType::class, [
'choices' => ['M.' => User::CIVILITE_M, 'Mme' => User::CIVILITE_MME],
'required' => true
])
;

$builder->get('userCommonInfo')->add('phone', TextType::class, [
'required' => false
]);
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => User::class,
]);
}
}
7 changes: 6 additions & 1 deletion sources/AppBundle/Association/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class User implements NotifyPropertyInterface, UserInterface, \Serializable, Not
const SLACK_INVITE_STATUS_NONE = 0;
const SLACK_INVITE_STATUS_REQUESTED = 1;

const CIVILITE_M = 0;
const CIVILITE_MME = 1;

/**
* @var int
*/
Expand Down Expand Up @@ -813,11 +816,13 @@ public function getDirectoryLevel()
return $this->levelModules[1];
}

public function setDirectoryLevel($level)
public function setDirectoryLevel($level): self
{
$oldLevelModules = $this->levelModules;
$this->levelModules[1] = $level;
$this->propertyChanged('levelModules', $oldLevelModules, $this->levelModules);

return $this;
}

public function getWebsiteLevel()
Expand Down
Loading