diff --git a/app/Resources/views/event/ticket/ticket.html.twig b/app/Resources/views/event/ticket/ticket.html.twig index 206f44c8f..a60f0c54f 100644 --- a/app/Resources/views/event/ticket/ticket.html.twig +++ b/app/Resources/views/event/ticket/ticket.html.twig @@ -172,14 +172,25 @@
{{ 'Dans la limite des stocks disponibles.'|trans }}
-
- Dans le cadre de la certification LEAD ,
- nous devons vous demandez des informations à propos de votre venue,
- et-ce afin d'établir notre bilan carbone.
- Si vous n'êtes pas sûr·e de votre mode de transport, indiquez le plus probable.
-
+ Dans le cadre de la certification LEAD ,
+ nous devons vous demandez des informations à propos de votre venue,
+ et-ce afin d'établir notre bilan carbone.
+ Si vous n'êtes pas sûr·e de votre mode de transport, indiquez le plus probable.
+
{{ 'Merci de renseigner 3 tags (et/ou votre id Twitter) vous caractérisant, ces tags seront imprimés sur votre badge afin de faciliter le networking pendant l\'évènement'|trans }}
diff --git a/db/migrations/20240409212234_afup_forum_transport_information.php b/db/migrations/20240409212234_afup_forum_transport_information.php index 33642fbd6..11e8cbfc7 100644 --- a/db/migrations/20240409212234_afup_forum_transport_information.php +++ b/db/migrations/20240409212234_afup_forum_transport_information.php @@ -8,6 +8,6 @@ class AfupForumTransportInformation extends AbstractMigration public function change() { $this->execute("ALTER TABLE `afup_forum` ADD `transport_information_enabled` TINYINT DEFAULT 0"); - $this->execute("ALTER TABLE `afup_inscription_forum` ADD `transport_mode` VARCHAR(255), ADD `transport_distance` TINYINT"); + $this->execute("ALTER TABLE `afup_inscription_forum` ADD `transport_mode` TINYINT, ADD `transport_distance` TINYINT"); } } diff --git a/htdocs/css/tickets.css b/htdocs/css/tickets.css index 52616b161..957add256 100644 --- a/htdocs/css/tickets.css +++ b/htdocs/css/tickets.css @@ -212,18 +212,34 @@ div.sponsor--become-form label { div.tickets--errors{ border-color: #B0413E; } - +fieldset div.fieldset--inner > div.transport { + padding: 1em; + border: 1px #50a0dd solid; + background-color: #FEFEFE; +} +fieldset div.fieldset--inner > div.transport p { + padding-top: 0; +} +fieldset div.fieldset--inner > div.transport button { + color: rgb(76, 110, 175); + text-decoration: underline; + background-color: transparent; + border: 0; +} +fieldset div.fieldset--inner > div.transport button:hover { + text-decoration: none; +} @media(min-width: 460px) { - + ul.tickets--type-list{ margin-left:150px; } - + ul.tickets--type-list li { width: 600px; } - + ul.tickets--type-list hr{ width:600px; } @@ -236,11 +252,11 @@ div.tickets--errors{ top: 12px; left: -7px; } - + p.tickets--type-stock-limit{ margin-left:200px; } - + ul.tickets--errors, #fieldset--optin div{ margin-left:200px; } @@ -256,5 +272,5 @@ div.tickets--errors{ form { font-size:16px; } - + } \ No newline at end of file diff --git a/htdocs/js/inscription.js b/htdocs/js/inscription.js index 57afb242a..238d81f61 100644 --- a/htdocs/js/inscription.js +++ b/htdocs/js/inscription.js @@ -369,6 +369,35 @@ $(document).ready(function(){ $('#purchase_tickets_0_firstname').on('change', function(){copyValBetweenFields('purchase_tickets_0_firstname', 'purchase_firstname')}); $('#purchase_tickets_0_email').on('change', function(){copyValBetweenFields('purchase_tickets_0_email', 'purchase_email')}); + + // Mode de transport + var cloneTransport = function (nbInscriptions) { + let $button = $('#clone_transport'); + + if (nbInscriptions <= 1) { + $button.hide(); + } + $("#purchase_nbPersonnes").change(function () { + $button.show(); + var nb = parseInt($("#purchase_nbPersonnes").val(), 10); + if (nb <= 1) { + $button.hide(); + } + }); + + $button.on('click', function (e) { + e.preventDefault(); + let mode = $('#purchase_tickets_0_transportMode').val(); + let distance = $('#purchase_tickets_0_transportDistance').val(); + for (let i = 1; i < nbInscriptions; i++) { + $('#purchase_tickets_'+i+'_transportMode').val(mode).change(); + $('#purchase_tickets_'+i+'_transportDistance').val(distance).change(); + } + + return false; + }); + } + var init = function(){ if (storageAvailable('localStorage') && localStorage.getItem('tickets')) { try { @@ -400,6 +429,8 @@ $(document).ready(function(){ manageFieldSet(nbInscriptions); updateSummary(); + + cloneTransport(nbInscriptions); }; init(); diff --git a/htdocs/pages/administration/forum_inscriptions.php b/htdocs/pages/administration/forum_inscriptions.php index 45cf180df..de4eee3f7 100644 --- a/htdocs/pages/administration/forum_inscriptions.php +++ b/htdocs/pages/administration/forum_inscriptions.php @@ -321,7 +321,11 @@ function updateGlobalsForTarif( $groupe[] = $formulaire->createElement('radio', 'mail_partenaire', null, 'non', 0); $formulaire->addGroup($groupe, 'groupe_mail_partenaire', null, ' ', false); - $formulaire->addElement('header', 'boutons' , ''); + $formulaire->addElement('header', null, 'Transport'); + $formulaire->addElement('select', 'transport_mode', 'Quel est votre mode de transport ?', Ticket::TRANSPORT_MODES); + $formulaire->addElement('select', 'transport_distance', 'Quelle sera la distance parcourue ?', Ticket::TRANSPORT_DISTANCES); + + $formulaire->addElement('header', 'boutons' , ''); $formulaire->addElement('submit', 'soumettre', 'Soumettre'); // On ajoute les règles @@ -370,6 +374,8 @@ function updateGlobalsForTarif( $ticket->setComments($valeurs['commentaires']); $ticket->setStatus($valeurs['etat']); $ticket->setInvoiceStatus($valeurs['facturation']); + $ticket->setTransportMode($valeurs['transport_mode']); + $ticket->setTransportDistance($valeurs['transport_distance']); try { $ticketRepository->save($ticket); $ok = true; @@ -392,7 +398,9 @@ function updateGlobalsForTarif( $valeurs['mail_partenaire'], $valeurs['commentaires'], $valeurs['etat'], - $valeurs['facturation']); + $valeurs['facturation'], + $valeurs['transport_mode'], + $valeurs['transport_distance']); /** @var \AppBundle\Event\Model\Ticket $ticket */ $ticket = $ticketRepository->get($_GET['id']); diff --git a/sources/Afup/Bootstrap/commonStart.php b/sources/Afup/Bootstrap/commonStart.php index 66536c064..fb5ca74b1 100644 --- a/sources/Afup/Bootstrap/commonStart.php +++ b/sources/Afup/Bootstrap/commonStart.php @@ -90,7 +90,7 @@ define('AFUP_SIRET', '500 869 011 00022'); define('AFUP_NUMERO_TVA', 'FR27 500 869 011'); -// Ticket transport mode +// Ticket transport distance define('AFUP_TRANSPORT_DISTANCE_0', 0); define('AFUP_TRANSPORT_DISTANCE_25_50', 25); define('AFUP_TRANSPORT_DISTANCE_50_100', 50); @@ -98,6 +98,19 @@ define('AFUP_TRANSPORT_DISTANCE_500_1000', 500); define('AFUP_TRANSPORT_DISTANCE_1000', 1000); +// Ticket transport mode +define('AFUP_TRANSPORT_MODE_SEUL_THERMIQUE', 10); +define('AFUP_TRANSPORT_MODE_SEUL_ELECTRIQUE', 20); +define('AFUP_TRANSPORT_MODE_SEUL_HYBRIDE', 30); +define('AFUP_TRANSPORT_MODE_PASSAGERS_THERMIQUE', 40); +define('AFUP_TRANSPORT_MODE_PASSAGERS_ELECTRIQUE', 50); +define('AFUP_TRANSPORT_MODE_PASSAGERS_HYBRIDE', 60); +define('AFUP_TRANSPORT_MODE_BUS', 70); +define('AFUP_TRANSPORT_MODE_TRAIN', 80); +define('AFUP_TRANSPORT_MODE_AVION_ECO', 90); +define('AFUP_TRANSPORT_MODE_AVION_BUSINESS', 100); +define('AFUP_TRANSPORT_MODE_COMMUN', 110); + $AFUP_Tarifs_Forum = array( AFUP_FORUM_INVITATION => 0, AFUP_FORUM_ORGANISATION => 0, diff --git a/sources/Afup/Forum/Inscriptions.php b/sources/Afup/Forum/Inscriptions.php index 66508d4b2..6c53381d9 100644 --- a/sources/Afup/Forum/Inscriptions.php +++ b/sources/Afup/Forum/Inscriptions.php @@ -261,7 +261,8 @@ function obtenirListe($id_forum = null, function modifierInscription($id, $reference, $type_inscription, $civilite, $nom, $prenom, $email, $telephone, $coupon, $citer_societe, $newsletter_afup, - $newsletter_nexen, $mail_partenaire, $commentaires, $etat, $facturation) + $newsletter_nexen, $mail_partenaire, $commentaires, $etat, $facturation, + $transportMode, $transportDistance) { $requete = 'UPDATE '; $requete .= ' afup_inscription_forum '; @@ -281,7 +282,9 @@ function modifierInscription($id, $reference, $type_inscription, $civilite, $nom $requete .= ' mail_partenaire=' . $this->_bdd->echapper($mail_partenaire) . ','; $requete .= ' commentaires=' . $this->_bdd->echapper($commentaires) . ','; $requete .= ' etat=' . $this->_bdd->echapper($etat) . ','; - $requete .= ' facturation=' . $this->_bdd->echapper($facturation); + $requete .= ' facturation=' . $this->_bdd->echapper($facturation) . ','; + $requete .= ' transport_mode=' . $this->_bdd->echapper($transportMode) . ','; + $requete .= ' transport_distance=' . $this->_bdd->echapper($transportDistance); $requete .= 'WHERE'; $requete .= ' id=' . $id; diff --git a/sources/AppBundle/Event/Form/TicketType.php b/sources/AppBundle/Event/Form/TicketType.php index baa8ac6fd..3c0ad17d8 100644 --- a/sources/AppBundle/Event/Form/TicketType.php +++ b/sources/AppBundle/Event/Form/TicketType.php @@ -173,38 +173,19 @@ public function buildForm(FormBuilderInterface $builder, array $options) ; }); - $builder->add('transportMode', ChoiceType::class, [ - 'label' => 'Quel est votre mode de transport ?', - 'required' => true, - 'choices' => [ - '' => '', - 'Voiture seul·e' => 'Voiture seul·e', - 'Voiture seul·e électrique' => 'Voiture seul·e électrique', - 'Voiture seul·e hybride' => 'Voiture seul·e hybride', - 'Voiture avec passagers·ères' => 'Voiture avec passagers·ères', - 'Voiture avec passagers·ères électrique' => 'Voiture avec passagers·ères électrique', - 'Voiture avec passagers·ères hybride' => 'Voiture avec passagers·ères hybride', - 'Bus' => 'Bus', - 'Train' => 'Train', - 'Avion classe économique' => 'Avion classe économique', - 'Avion classe business' => 'Avion classe business', - 'Transports en commun' => 'Transports en commun' - ], - ]); - - $builder->add('transportDistance', ChoiceType::class, [ - 'label' => 'Quelle sera la distance parcourue ?', - 'required' => true, - 'choices' => [ - '' => '', - '< 25 km' => AFUP_TRANSPORT_DISTANCE_0, - 'entre 25 et 50 km' => AFUP_TRANSPORT_DISTANCE_25_50, - 'entre 50 et 100 km' => AFUP_TRANSPORT_DISTANCE_50_100, - 'entre 100 et 500 km' => AFUP_TRANSPORT_DISTANCE_100_500, - 'entre 500 et 1000 km' => AFUP_TRANSPORT_DISTANCE_500_1000, - '> 1000 km' => AFUP_TRANSPORT_DISTANCE_1000, - ], - ]); + if ($event->getTransportInformationEnabled()) { + $builder->add('transportMode', ChoiceType::class, [ + 'label' => 'Quel est votre mode de transport ?', + 'required' => true, + 'choices' => array_flip(Ticket::TRANSPORT_MODES), + ]); + + $builder->add('transportDistance', ChoiceType::class, [ + 'label' => 'Quelle sera la distance parcourue ?', + 'required' => true, + 'choices' => array_flip(Ticket::TRANSPORT_DISTANCES), + ]); + } $builder diff --git a/sources/AppBundle/Event/Model/Event.php b/sources/AppBundle/Event/Model/Event.php index 602be2e02..cec9293ef 100644 --- a/sources/AppBundle/Event/Model/Event.php +++ b/sources/AppBundle/Event/Model/Event.php @@ -116,6 +116,8 @@ class Event implements NotifyPropertyInterface private $accomodationEnabled; + private $transportInformationEnabled; + /** * @var string */ @@ -712,6 +714,29 @@ public function setWaitingListUrl($waitingListUrl) return $this; } + /** + * @return bool + */ + public function getTransportInformationEnabled() + { + return $this->transportInformationEnabled; + } + + /** + * @param bool $transportInformationEnabled + * + * @return $this + */ + public function setTransportInformationEnabled($transportInformationEnabled) + { + $transportInformationEnabled = (bool) $transportInformationEnabled; + + $this->propertyChanged('transportInformationEnabled', $this->transportInformationEnabled, $transportInformationEnabled); + $this->transportInformationEnabled = $transportInformationEnabled; + + return $this; + } + public function isOnline() { return false !== strpos($this->getPath(), 'enligne'); diff --git a/sources/AppBundle/Event/Model/Repository/EventRepository.php b/sources/AppBundle/Event/Model/Repository/EventRepository.php index d04b2c0cc..4895f8ee6 100644 --- a/sources/AppBundle/Event/Model/Repository/EventRepository.php +++ b/sources/AppBundle/Event/Model/Repository/EventRepository.php @@ -348,6 +348,11 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor 'fieldName' => 'waitingListUrl', 'type' => 'string', ]) + ->addField([ + 'columnName' => 'transport_information_enabled', + 'fieldName' => 'transportInformationEnabled', + 'type' => 'boolean', + ]) ; return $metadata; diff --git a/sources/AppBundle/Event/Model/Repository/TicketRepository.php b/sources/AppBundle/Event/Model/Repository/TicketRepository.php index 3d6e11892..50855c5e0 100644 --- a/sources/AppBundle/Event/Model/Repository/TicketRepository.php +++ b/sources/AppBundle/Event/Model/Repository/TicketRepository.php @@ -349,7 +349,7 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor ->addField([ 'columnName' => 'transport_mode', 'fieldName' => 'transportMode', - 'type' => 'string', + 'type' => 'int', ]) ->addField([ 'columnName' => 'transport_distance', diff --git a/sources/AppBundle/Event/Model/Ticket.php b/sources/AppBundle/Event/Model/Ticket.php index 6fd068c52..b651605a4 100644 --- a/sources/AppBundle/Event/Model/Ticket.php +++ b/sources/AppBundle/Event/Model/Ticket.php @@ -15,6 +15,31 @@ class Ticket implements NotifyPropertyInterface { use NotifyProperty; + const TRANSPORT_MODES = [ + '' => '', + AFUP_TRANSPORT_MODE_SEUL_THERMIQUE => 'Voiture seul·e', + AFUP_TRANSPORT_MODE_SEUL_ELECTRIQUE => 'Voiture seul·e électrique', + AFUP_TRANSPORT_MODE_SEUL_HYBRIDE => 'Voiture seul·e hybride', + AFUP_TRANSPORT_MODE_PASSAGERS_THERMIQUE=> 'Voiture avec passagers·ères', + AFUP_TRANSPORT_MODE_PASSAGERS_ELECTRIQUE => 'Voiture avec passagers·ères électrique', + AFUP_TRANSPORT_MODE_PASSAGERS_HYBRIDE => 'Voiture avec passagers·ères hybride', + AFUP_TRANSPORT_MODE_BUS => 'Bus', + AFUP_TRANSPORT_MODE_TRAIN => 'Train', + AFUP_TRANSPORT_MODE_AVION_ECO => 'Avion classe économique', + AFUP_TRANSPORT_MODE_AVION_BUSINESS => 'Avion classe business', + AFUP_TRANSPORT_MODE_COMMUN => 'Transports en commun' + ]; + + const TRANSPORT_DISTANCES = [ + '' => '', + AFUP_TRANSPORT_DISTANCE_0 => '< 25 km', + AFUP_TRANSPORT_DISTANCE_25_50 => 'entre 25 et 50 km', + AFUP_TRANSPORT_DISTANCE_50_100 => 'entre 50 et 100 km', + AFUP_TRANSPORT_DISTANCE_100_500 => 'entre 100 et 500 km', + AFUP_TRANSPORT_DISTANCE_500_1000 => 'entre 500 et 1000 km', + AFUP_TRANSPORT_DISTANCE_1000 => '> 1000 km', + ]; + const STATUS_CREATED = AFUP_FORUM_ETAT_CREE; const STATUS_CANCELLED = AFUP_FORUM_ETAT_ANNULE; const STATUS_ERROR = AFUP_FORUM_ETAT_ERREUR;