Commit 36fc65fd by Julien Jorry

in dev

parent e6d936db
......@@ -16,7 +16,7 @@ $('#flash-messages').flashNotification('init');
$(document).ready(function() {
var mapMarkers = [];
$('.searchLatLon').on('click', function (e) {
$(document).on('click', '.searchLatLon', function (e) {
e.preventDefault();
var self = $(this);
$.ajax({
......@@ -75,7 +75,7 @@ $(document).ready(function() {
if (data.newvalue == 'false') {
self.text('non');
self.data('value', 'false');
self.addClass(' ');
self.addClass('label-danger');
self.removeClass('label-success');
} else {
self.data('value', 'true');
......
......@@ -19,6 +19,7 @@ fos_ck_editor:
Blockquote, -, Image, Link, Unlink, Table]
- [Format, Maximize, Source]
enterMode: CKEDITOR.ENTER_BR
filebrowserBrowseRoute: admin_sonata_media_media_ckeditor_browser
filebrowserImageBrowseRoute: admin_sonata_media_media_ckeditor_browser
# Display images by default when clicking the image dialog browse button
......
jms_serializer:
visitors:
json: # TODO: will crash in prod
json_serialization:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
......@@ -93,7 +93,8 @@ security:
ROLE_GESTION_GROUPE: [ROLE_USER, ROLE_ADMIN]
ROLE_COMPTOIR: [ROLE_USER, ROLE_ADMIN]
ROLE_CONTACT: [ROLE_USER, ROLE_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_SONATA_ADMIN, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
......@@ -109,6 +110,7 @@ security:
# Secured part of the site
# This config requires being logged for the whole site and having the admin role for the admin part.
# Change these rules to adapt them to your needs
- { path: ^/admin/, role: [ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_CONTROLEUR, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] }
# - { path: ^/admin/, role: [ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_CONTROLEUR, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] }
- { path: ^/admin/, role: [ROLE_ADMIN] }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
......@@ -21,17 +21,18 @@ sonata_user:
sonata_block:
default_contexts: [sonata_page_bundle]
blocks:
sonata.block.service.text:
contexts: [admin]
sonata.admin.block.stats:
contexts: [admin]
# sonata.block.service.text:
# contexts: [admin]
# sonata.admin.block.stats:
# contexts: [admin]
sonata.admin.block.admin_list:
contexts: [admin]
sonata.admin.block.search_result:
contexts: [admin]
sonata.formatter.block.formatter:
contexts: [admin]
# sonata.admin.block.search_result:
# contexts: [admin]
# sonata.formatter.block.formatter:
# contexts: [admin]
admin.block.dashboard:
contexts: [admin]
sonata_formatter:
default_formatter: text
......
sonata_admin:
security:
handler: sonata.admin.security.handler.role
# handler: sonata.admin.security.handler.role
handler: app.security.handler.role
role_admin: ROLE_ADMIN
role_super_admin: ROLE_SUPER_ADMIN
title: 'MLC Admin'
......@@ -88,10 +89,18 @@ sonata_admin:
# BOTTOM BOTTOM BOTTOM
blocks:
-
class: col-xs-12 col-md-6
class: col-xs-12 col-md-12
position: top
type: admin.block.dashboard
-
class: col-xs-12 col-md-12
position: center
type: sonata.admin.block.admin_list
# -
# class: col-xs-12 col-md-6
# position: center
# type: sonata.admin.block.admin_list
# -
# class: col-xs-4 col-md-3
# position: top
# type: sonata.admin.block.stats
......@@ -196,6 +205,8 @@ sonata_admin:
- admin.prestataire.gerer
- admin.prestataire.cotisations
- admin.groupepresta.gerer
- admin.etatpresta.gerer
- admin.rubrique.gerer
sonata.admin.group.groupe:
on_top: true
label: "Groupes locaux"
......@@ -210,6 +221,17 @@ sonata_admin:
icon: '<i class="fa fa-home"></i>'
items:
- admin.comptoir.gerer
sonata.admin.group.flux:
keep_open: false
label: "Flux"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-euro-sign"></i>'
items:
- admin.flux.gerer
- admin.all.cotisations
- admin.transfert.gerer
- admin.transaction.gerer
- admin.reconversion.gerer
# sonata.admin.group.compta:
# keep_open: false
# on_top: true
......@@ -242,14 +264,6 @@ sonata_admin:
icon: '<i class="fa fa-pager"></i>'
items:
- admin.page.gerer
sonata.admin.group.rubrique:
keep_open: false
on_top: true
label: "Rubriques"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-list"></i>'
items:
- admin.rubrique.gerer
sonata.admin.group.faq:
keep_open: false
on_top: true
......@@ -266,17 +280,6 @@ sonata_admin:
icon: '<i class="fa fa-flag"></i>'
items:
- admin.traduction.gerer
sonata.admin.group.flux:
keep_open: false
label: "Flux"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-euro-sign"></i>'
items:
- admin.flux.gerer
- admin.all.cotisations
- admin.transfert.gerer
- admin.transaction.gerer
- admin.reconversion.gerer
sonata.admin.group.menu_builder:
keep_open: false
on_top: true
......@@ -310,4 +313,3 @@ sonata_admin:
# items:
# - app.admin.post
# roles: [ ROLE_ONE, ROLE_TWO ]
......@@ -45,6 +45,14 @@ sonata_media:
formats:
small: { width: 100 , quality: 95}
big: { width: 500 , quality: 90}
rubrique:
providers:
- sonata.media.provider.image
formats:
preview: { width: 50, quality: 90}
small: { width: 100 , quality: 90}
big: { width: 400 , quality: 90}
prestataire:
providers:
- sonata.media.provider.image
......
......@@ -4,4 +4,5 @@ twig:
strict_variables: '%kernel.debug%'
form_themes:
- 'bootstrap_4_layout.html.twig'
- '@SonataFormatter/Form/formatter.html.twig'
\ No newline at end of file
- '@SonataFormatter/Form/formatter.html.twig'
- 'rubrique/media_widgets.html.twig'
\ No newline at end of file
......@@ -150,6 +150,19 @@ services:
- { name: form.type_extension }
# - { name: form.type_extension, extended_type: Sonata\MediaBundle\Form\Type\MediaType }
app.security.handler.role:
class: App\Security\Handler\VoterSecurityHandler
arguments:
- '@security.authorization_checker'
- [ROLE_SUPER_ADMIN]
admin.block.dashboard:
class: App\Block\DashboardKohinosBlock
arguments:
- '@twig'
tags:
- { name: sonata.block }
###### Configuration de l'admin ######
admin.adherent.gerer:
......@@ -252,6 +265,18 @@ services:
calls:
- [ setSecurity, ['@security.helper']]
admin.etatpresta.gerer:
class: App\Admin\EtatprestataireAdmin
arguments: [~, App\Entity\EtatPrestataire, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Prestataire"
label: "Tags"
public: true
calls:
- [ setSecurity, ['@security.helper']]
admin.news.gerer:
class: App\Admin\NewsAdmin
arguments: [~, App\Entity\News, ~]
......
# Configuration des données initiales
App\Entity\EtatPrestataire:
etatSuspendu:
enabled: true
name: 'Suspendu'
content: 'Prestataires suspendus pour diverses raisons'
etatRappel:
enabled: true
name: 'Rappel'
content: 'Prestataires à rappeler'
etatAnnule:
enabled: true
name: 'Annulé'
content: 'Prestataires annulé'
etatProspect:
enabled: true
name: 'Prospects'
content: 'Prospects'
App\Entity\TypePrestataire:
typepresta1:
name: 'Prestataire'
......@@ -228,3 +246,488 @@ Prodigious\Sonata\MenuBundle\Entity\MenuItem:
target: 0
enabled: 1
App\Application\Sonata\MediaBundle\Entity\Media:
media6:
name: 'wosmpl-marker-icon17-produits-de-lagriculture-et-elevage.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: e5d9701e23fcfa5822d7c93092a522f82cf970ad.png
provider_metadata: {"filename":"wosmpl-marker-icon17-produits-de-lagriculture-et-elevage.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 29446
context: 'rubrique'
media7:
name: 'wosmpl-marker-icon3-metier-darts-creation.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 3b56c41033edbc04176b2bc943716820b8d5859e.png
provider_metadata: {"filename":"wosmpl-marker-icon3-metier-darts-creation.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 38284
context: 'rubrique'
media8:
name: 'wosmpl-marker-icon-commerce-alimentaire.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 3f7b75fef4df63756fd425d23fe90fce04757011.png
provider_metadata: {"filename":"wosmpl-marker-icon-commerce-alimentaire.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 33137
context: 'rubrique'
media9:
name: 'wosmpl-marker-icon2-restaurant-bar-traiteur.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 6eaa4bbdf1225932d30c5ae54fb9996658836d7d.png
provider_metadata: {"filename":"wosmpl-marker-icon2-restaurant-bar-traiteur.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 32622
context: 'rubrique'
media10:
name: 'wosmpl-marker-icon4-habillement-mode-accessoires.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 91f22423eaf61b22e7365250d902efecdce698fc.png
provider_metadata: {"filename":"wosmpl-marker-icon4-habillement-mode-accessoires.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 24911
context: 'rubrique'
media11:
name: 'wosmpl-marker-icon5-higiene-beaute.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 749a4285560be42315ac3c4c888557eedc76e81d.png
provider_metadata: {"filename":"wosmpl-marker-icon5-higiene-beaute.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 25898
context: 'rubrique'
media12:
name: 'wosmpl-marker-icon6-Papeterie-librairie-presse-édition.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: aab9d557c3f77b9682ee6726c059badd89eb9ed8.png
provider_metadata: {"filename":"wosmpl-marker-icon6-Papeterie-librairie-presse-e\u0301dition.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 37730
context: 'rubrique'
media13:
name: 'wosmpl-marker-icon9-sortie-culturelle.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 978c0d269d054f0e4f2e88de31eae8d0f0b44bfa.png
provider_metadata: {"filename":"wosmpl-marker-icon9-sortie-culturelle.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 32317
context: 'rubrique'
media14:
name: 'wosmpl-marker-icon11-santé-bien-etre.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: cf4510e313a050931ffae55a7c72651e765e4145.png
provider_metadata: {"filename":"wosmpl-marker-icon11-sante\u0301-bien-etre.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 36273
context: 'rubrique'
media15:
name: 'wosmpl-marker-icon14-Web-multimédia-communication-imprimerie.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 6286598dea47116e34b4e9635eccf05a3fb9368f.png
provider_metadata: {"filename":"wosmpl-marker-icon14-Web-multime\u0301dia-communication-imprimerie.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 29416
context: 'rubrique'
media16:
name: 'wosmpl-marker-icon15-sport-et-loisirs.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 1ecae95f3729865d8f249b17146d7aaef9d9b5c3.png
provider_metadata: {"filename":"wosmpl-marker-icon15-sport-et-loisirs.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 43002
context: 'rubrique'
media17:
name: 'wosmpl-marker-icon16-formation-education.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 72609fa54f78962259708e4e3ff3da37239b224e.png
provider_metadata: {"filename":"wosmpl-marker-icon16-formation-education.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 31656
context: 'rubrique'
media18:
name: 'wosmpl-marker-icon19-immobillier.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: c1a399604ae2599ffbc5701a1d138830d2ececb7.png
provider_metadata: {"filename":"wosmpl-marker-icon19-immobillier.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 28576
context: 'rubrique'
media19:
name: 'wosmpl-marker-icon21-divers.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 434524af87d1e989f8fd476a838fb6d0243a34f3.png
provider_metadata: {"filename":"wosmpl-marker-icon21-divers.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 25092
context: 'rubrique'
media20:
name: 'wosmpl-marker-icon22-marche-amap.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 348b65dcd5ed271c94bf28eb353b12c6bf4d45ac.png
provider_metadata: {"filename":"wosmpl-marker-icon22-marche-amap.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 34804
context: 'rubrique'
media21:
name: 'wosmpl-marker-icon23-Artisanat-constructions-réparations.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: fc1af9dfa9da71e26464879365203a7d9158bc90.png
provider_metadata: {"filename":"wosmpl-marker-icon23-Artisanat-constructions-re\u0301parations.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 25215
context: 'rubrique'
media22:
name: 'wosmpl-marker-icon20-service-a-la-personne.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: b48e9ed9bf500aabfca8cd70445d2b9274587dfe.png
provider_metadata: {"filename":"wosmpl-marker-icon20-service-a-la-personne.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 34234
context: 'rubrique'
media23:
name: 'wosmpl-marker-icon7-decoration-ameublement-bricolage-jardin.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: e1ea5c5d2a395a0d947ed736a3289fea3fdb821b.png
provider_metadata: {"filename":"wosmpl-marker-icon7-decoration-ameublement-bricolage-jardin.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 39650
context: 'rubrique'
media24:
name: 'wosmpl-marker-icon8-Commerces-divers.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 3433854a2e8d5bf720db32631533afe54600ec87.png
provider_metadata: {"filename":"wosmpl-marker-icon8-Commerces-divers.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 35621
context: 'rubrique'
media25:
name: 'wosmpl-marker-icon10-Informatique-Electronique.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: 7a313aa2622f4db659d526e76b24322f64c4f910.png
provider_metadata: {"filename":"wosmpl-marker-icon10-Informatique-Electronique.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 25964
context: 'rubrique'
media26:
name: 'wosmpl-marker-icon13-transports-livraison.png'
enabled: true
provider_name: 'sonata.media.provider.image'
provider_status: true
provider_reference: ca83dd7189873cf07639668b48e4d6e940745dda.png
provider_metadata: {"filename":"wosmpl-marker-icon13-transports-livraison.png"}
width: 512
height: 512
content_type: 'image/png'
content_size: 31625
context: 'rubrique'
App\Entity\Rubrique:
rubrique1:
name: "Produit de l'agriculture et élevage"
content: ""
enabled: true
media: '@media6'
rubrique2:
name: "Sports et loisirs"
content: ""
enabled: true
media: '@media16'
rubrique3:
name: "Commerce alimentaire"
content: ""
enabled: true
media: '@media8'
rubrique4:
name: "Restaurant, bar, traiteur"
content: ""
enabled: true
media: '@media9'
rubrique5:
name: "Commerces divers"
content: ""
enabled: true
media: '@media24'
rubrique6:
name: "Métiers d'art, créations"
content: ""
enabled: true
media: '@media7'
rubrique7:
name: "Habillement, mode, accessoires"
content: ""
enabled: true
media: '@media10'
rubrique8:
name: "Papeterie, librairie, presse, édition"
content: ""
enabled: true
media: '@media12'
rubrique9:
name: "Marchés, AMAP"
content: ""
enabled: true
media: '@media20'
rubrique10:
name: "Web, multimédia, communication, imprimerie"
content: ""
enabled: true
media: '@media15'
rubrique11:
name: "Sorties culturelles"
content: ""
enabled: true
media: '@media13'
rubrique12:
name: "Informatique, Electronique"
content: ""
enabled: true
media: '@media25'
rubrique13:
name: "Décoration, ameublement, bricolage, jardin"
content: ""
enabled: true
media: '@media23'
rubrique14:
name: "Artisanat, constructions, réparations"
content: ""
enabled: true
media: '@media21'
rubrique15:
name: "Transports, Livraisons"
content: ""
enabled: true
media: '@media26'
rubrique16:
name: "Divers"
content: ""
enabled: true
media: '@media19'
rubrique17:
name: "Hygiène, beauté"
content: ""
enabled: true
media: '@media11'
rubrique18:
name: "Santé, bien-être"
content: ""
enabled: true
media: '@media14'
rubrique19:
name: "Immobilier"
content: ""
enabled: true
media: '@media18'
rubrique20:
name: "Services à la personne"
content: ""
enabled: true
media: '@media22'
rubrique21:
name: "Formation, éducation"
content: ""
enabled: true
media: '@media17'
# Rubrique de la doume
# App\Entity\Rubrique:
# rubrique1:
# name: 'Animaux'
# content: <text(50)>
# enabled: true
# rubrique2:
# name: 'Artisanat créatif'
# content: <text(50)>
# enabled: true
# rubrique0:
# name: 'Artisans de bouche'
# content: <text(50)>
# enabled: true
# rubrique3:
# name: 'Arts'
# content: <text(50)>
# enabled: true
# rubrique4:
# name: 'Bières'
# content: <text(50)>
# enabled: true
# rubrique5:
# name: 'Bistrot'
# content: <text(50)>
# enabled: true
# rubrique6:
# name: 'Communication, conception graphique, photographie'
# content: <text(50)>
# enabled: true
# rubrique7:
# name: 'Construction, bâtiment'
# content: <text(50)>
# enabled: true
# rubrique8:
# name: 'Edition, librairie, écrivain public, reprographie'
# content: <text(50)>
# enabled: true
# rubrique9:
# name: 'Elevage'
# content: <text(50)>
# enabled: true
# rubrique10:
# name: 'Energie, bois'
# content: <text(50)>
# enabled: true
# rubrique11:
# name: 'Entretien, hygiène'
# content: <text(50)>
# enabled: true
# rubrique12:
# name: 'Epicerie, distribution'
# content: <text(50)>
# enabled: true
# rubrique13:
# name: 'Finance'
# content: <text(50)>
# enabled: true
# rubrique14:
# name: 'Formation, éducation'
# content: <text(50)>
# enabled: true
# rubrique15:
# name: 'Fromage'
# content: <text(50)>
# enabled: true
# rubrique16:
# name: 'Habillement, couture'
# content: <text(50)>
# enabled: true
# rubrique17:
# name: 'Informatique'
# content: <text(50)>
# enabled: true
# rubrique18:
# name: 'Jeux et Collections'
# content: <text(50)>
# enabled: true
# rubrique19:
# name: 'Maison et jardin'
# content: <text(50)>
# enabled: true
# rubrique20:
# name: 'Musique et Spectacles'
# content: <text(50)>
# enabled: true
# rubrique21:
# name: 'Production agricole'
# content: <text(50)>
# enabled: true
# rubrique22:
# name: 'Récupération, recyclage'
# content: <text(50)>
# enabled: true
# rubrique23:
# name: 'Réparation (mécanique, cordonnerie, électroménager)'
# content: <text(50)>
# enabled: true
# rubrique24:
# name: 'Restauration, hébergement '
# content: <text(50)>
# enabled: true
# rubrique25:
# name: 'Santé, sport, bien-être'
# content: <text(50)>
# enabled: true
# rubrique26:
# name: 'Soins du corps, beauté'
# content: <text(50)>
# enabled: true
# rubrique27:
# name: 'Thérapeutes'
# content: <text(50)>
# enabled: true
# rubrique28:
# name: 'Transport et déménagement'
# content: <text(50)>
# enabled: true
# rubrique29:
# name: 'Vins'
# content: <text(50)>
# enabled: true
App\Entity\GlobalParameter:
gp1:
name: "COTISATION_MONTANT"
gp11:
name: "COTISATION_ADHERENT"
value: '10'
mandatory: 1
gp12:
name: "COTISATION_PRESTATAIRE"
value: '10'
mandatory: 1
gp13:
name: "RECONVERSION_ADHERENT"
value: '0'
mandatory: 1
gp1:
name: "RECONVERSION_PRESTATAIRE"
value: '0'
mandatory: 1
gp2:
name: "MLC_TITLE"
value: 'KOHINOS : Outil de gestion de monnaie locale complémentaire'
......@@ -27,10 +39,10 @@ App\Entity\GlobalParameter:
name: "MAP_ZOOM"
value: '9'
mandatory: 1
gp8:
name: "FAVICON_URL"
value: '/images/favicon.png'
mandatory: 1
# gp8:
# name: "FAVICON_URL"
# value: '/images/favicon.png'
# mandatory: 1
gp9:
name: "MLC_DESCRIPTION"
value: 'Kohinos : outil de gestion de monnaie locale'
......@@ -56,8 +68,8 @@ App\Entity\Groupe:
App\Entity\Geoloc:
geoloc{1..70}:
adresse: '<address()>'
# cpostal: <postcode()>
adresse: '<streetAddress()>'
cpostal: <postcode()>
ville: '<city()>'
lat: '<randomFloat(6, 45, 46)>'
lon: '<randomFloat(6, 2, 5)>'
......@@ -83,7 +95,7 @@ App\Entity\Groupeprestataire:
name: 'AMAP de test 2'
type: 'amap'
horaires: 'Tous les Mercredis de 12h à 14h'
groupe: '@groupe<numberBetween(1,10)>'
groupe: '@groupe2'
grppresta3:
name: 'Marché de test'
type: 'marche'
......@@ -93,7 +105,7 @@ App\Entity\Groupeprestataire:
name: 'Marché de test 2'
type: 'marche'
horaires: 'Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h'
groupe: '@groupe<numberBetween(1,10)>'
groupe: '@groupe3'
App\Entity\Adherent:
adherent{1..11}:
......@@ -102,6 +114,28 @@ App\Entity\Adherent:
# user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire:
prestatairemlc:
mlc: true
enabled: true
raison: 'Monnaie locale'
description: 'Association gérant la monnaie locale et recevant les cotisations'
users: ['@usersuperadmin']
siret: ' '
prestataireuser:
compte: '<randomFloat(2, 1000, 2000)>'
ecompte: '<randomFloat(2, 1000, 2000)>'
description: '<text(150)>'
raison: 'Prestataire de test'
responsable: '<text(10)>'
metier: '<text(10)>'
iban: '<text(10)>'
statut: '<text(10)>'
siret: '<text(10)>'
users: ['@user_prestataire']
typeprestataire: '@typepresta<numberBetween(1,2)>'
rubriques: '1x @rubrique<numberBetween(1,21)>'
groupe: '@groupe<numberBetween(1, 10)>'
horaires: "<dayOfWeek()> de <date('H')>h à <date('H')>h"
prestataire{1..21}:
compte: '<randomFloat(2, 1000, 2000)>'
ecompte: '<randomFloat(2, 1000, 2000)>'
......@@ -112,9 +146,8 @@ App\Entity\Prestataire:
iban: '<text(10)>'
statut: '<text(10)>'
siret: '<text(10)>'
geoloc (unique): '@geoloc<numberBetween(1,70)>'
# user (unique): '@user<numberBetween(11,30)>'
typeprestataire: '@typepresta<numberBetween(1,2)>'
rubriques: '1x @rubrique<numberBetween(1,21)>'
groupe: '@groupe<numberBetween(1, 10)>'
horaires: "<dayOfWeek()> de <date('H')>h à <date('H')>h"
prestataire{22..32}:
......@@ -127,13 +160,21 @@ App\Entity\Prestataire:
iban: <text(10)>
statut: <text(10)>
siret: <text(10)>
geoloc (unique): '@geoloc<numberBetween(1,70)>'
# geoloc (unique): '@geoloc<numberBetween(1,70)>'
# user (unique): '@user<numberBetween(11,30)>'
typeprestataire: '@typepresta<numberBetween(1,2)>'
groupeprestataires: '2x @grppresta<numberBetween(1, 4)>'
rubriques: '1x @rubrique<numberBetween(1,21)>'
groupe: '@groupe<numberBetween(1, 4)>'
horaires: "<dayOfWeek()> de <date('H')>h à <date('H')>h"
App\Entity\GeolocPrestataire:
geolocp{1..32}:
name: <text(10)>
geoloc (unique): '@geoloc<numberBetween(1,70)>'
prestataire: '@prestataire<current()>'
enabled: true
App\Entity\Faq:
faq{1..12}:
name: 'FAQ : <text(15)>'
......@@ -146,158 +187,6 @@ App\Entity\News:
content: <text(80)>
user: '@userredacteur'
App\Entity\Rubrique:
rubrique1:
name: 'Animaux'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique2:
name: 'Artisanat créatif'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique0:
name: 'Artisans de bouche'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique3:
name: 'Arts'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique4:
name: 'Bières'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique5:
name: 'Bistrot'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique6:
name: 'Communication, conception graphique, photographie'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique7:
name: 'Construction, bâtiment'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique8:
name: 'Edition, librairie, écrivain public, reprographie'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique9:
name: 'Elevage'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique10:
name: 'Energie, bois'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique11:
name: 'Entretien, hygiène'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique12:
name: 'Epicerie, distribution'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique13:
name: 'Finance'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique14:
name: 'Formation, éducation'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique15:
name: 'Fromage'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique16:
name: 'Habillement, couture'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique17:
name: 'Informatique'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique18:
name: 'Jeux et Collections'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique19:
name: 'Maison et jardin'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique20:
name: 'Musique et Spectacles'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique21:
name: 'Production agricole'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique22:
name: 'Récupération, recyclage'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique23:
name: 'Réparation (mécanique, cordonnerie, électroménager)'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique24:
name: 'Restauration, hébergement '
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique25:
name: 'Santé, sport, bien-être'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique26:
name: 'Soins du corps, beauté'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique27:
name: 'Thérapeutes'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique28:
name: 'Transport et déménagement'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
rubrique29:
name: 'Vins'
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 5)>x @prestataire<numberBetween(1, 32)>'
App\Entity\CotisationInfos:
cotisationInfos1:
annee: '2019'
......@@ -313,6 +202,7 @@ App\Entity\CotisationInfos:
App\Entity\CotisationAdherent:
cotisation1:
operateur: '@useradherent'
role: 'Adherent'
parenttype: 'cotisation'
type: 'cotisation_adherent'
cotisationInfos: '@cotisationInfos1'
......@@ -323,6 +213,7 @@ App\Entity\CotisationAdherent:
createdAt: '<dateTimeBetween("-200 days", "now")>'
cotisation{2..11}:
operateur: '@usera<current()>'
role: 'Adherent'
parenttype: 'cotisation'
type: 'cotisation_adherent'
cotisationInfos: '@cotisationInfos<current()>'
......@@ -334,6 +225,7 @@ App\Entity\CotisationAdherent:
App\Entity\CotisationPrestataire:
cotisationp{2..32}:
operateur: '@userp<current()>'
role: 'Prestataire'
parenttype: 'cotisation'
type: 'cotisation_prestataire'
cotisationInfos: '@cotisationInfos<numberBetween(12, 43)>'
......@@ -349,8 +241,8 @@ App\Entity\User:
email: 'julien.jorry@gmail.com'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_superadmin']
roles: ['ROLE_SUPER_ADMIN']
groups: ['@usergroup_superadmin', '@usergroup_prestataire']
roles: ['ROLE_SUPER_ADMIN', 'ROLE_PRESTATAIRE']
usercontact:
username: 'user_contact'
email: 'contact@doume.test'
......
......@@ -2,20 +2,20 @@
"entrypoints": {
"app": {
"js": [
"/build/runtime.6cf710cd.js",
"/build/app.43b7b3f6.js"
"/build/runtime.js",
"/build/app.js"
],
"css": [
"/build/app.0d65a23b.css"
"/build/app.css"
]
},
"admin": {
"js": [
"/build/runtime.6cf710cd.js",
"/build/admin.62757d63.js"
"/build/runtime.js",
"/build/admin.js"
],
"css": [
"/build/admin.48a381da.css"
"/build/admin.css"
]
}
}
......
{
"build/admin.css": "/build/admin.48a381da.css",
"build/admin.js": "/build/admin.62757d63.js",
"build/app.css": "/build/app.0d65a23b.css",
"build/app.js": "/build/app.43b7b3f6.js",
"build/runtime.js": "/build/runtime.6cf710cd.js",
"build/admin.css": "/build/admin.css",
"build/admin.js": "/build/admin.js",
"build/app.css": "/build/app.css",
"build/app.js": "/build/app.js",
"build/runtime.js": "/build/runtime.js",
"build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js",
"build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js",
"build/ckeditor/config.js": "/build/ckeditor/config.js",
......
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
\ No newline at end of file
......@@ -76,17 +76,15 @@ class AdherentAdmin extends AbstractAdmin
->innerJoin($query->getRootAliases()[0] .'.user', 'u')
->addSelect('u')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgeres();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.groupe', ':group'))
// ->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupes)
;
}
} else {
$query
->andWhere($query->getRootAliases()[0].'.groupe = :groupe')
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
;
}
return $query;
}
......@@ -151,7 +149,7 @@ class AdherentAdmin extends AbstractAdmin
'label' => false
))
->end()
->with('Addresse', ['class' => 'col-md-5'])
->with('Adresse', ['class' => 'col-md-5'])
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => false
......@@ -295,7 +293,8 @@ class AdherentAdmin extends AbstractAdmin
'advanced_filter' => false
])
->add('user.email', null, [
'label' => "Email"
'label' => "Email",
'advanced_filter' => false
])
;
}
......
......@@ -44,17 +44,15 @@ class ComptoirAdmin extends AbstractAdmin
{
$query = parent::createQuery($context);
$user = $this->security->getUser();
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
} else {
$groupes = $user->getGroupesgeres();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.groupe', ':group'))
// ->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupes)
;
}
} else {
$query
->andWhere($query->getRootAliases()[0].'.groupe = :groupe')
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
;
}
return $query;
}
......@@ -72,9 +70,7 @@ class ComptoirAdmin extends AbstractAdmin
}
$formMapper
->with('Comptoir', ['class' => 'col-md-8']);
if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && !empty($user->getGroupesgeres())) {
$em = $this->modelManager->getEntityManager(Groupe::class);
if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) {
$formMapper->add('groupe', null, array(
'label' => 'Groupe local',
'required' => true,
......
......@@ -3,6 +3,7 @@
namespace App\Admin;
use App\Entity\Adherent;
use App\Entity\GlobalParameter;
use App\Entity\User;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
......@@ -11,6 +12,7 @@ use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
/**
* Administration des cotisations des adhérents
......@@ -39,22 +41,22 @@ class CotisationAdherentAdmin extends CotisationAdmin
->andWhere($query->getRootAliases()[0] .".type='cotisation_adherent'")
// ->andWhere('u.adherent IS NOT NULL')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
} else {
$groupe = $this->session->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$adhTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN '.$adhTable.' a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$adhTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN '.$adhTable.' a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
return $query;
}
......@@ -83,6 +85,7 @@ class CotisationAdherentAdmin extends CotisationAdmin
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$cotisation = $this->getSubject();
$expediteurInfos = array(
'label' => 'Expéditeur',
'class' => Adherent::class,
......@@ -96,6 +99,10 @@ class CotisationAdherentAdmin extends CotisationAdmin
}
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('montant', MoneyType::class, array(
'label' => 'Montant',
'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT))
))
->add('reference', HiddenType::class, array(
'data' => 'cotisation_adherent'
))
......@@ -128,9 +135,6 @@ class CotisationAdherentAdmin extends CotisationAdmin
->addIdentifier('expediteur', null, array(
'label' => 'Adherent'
))
->addIdentifier('expediteur.user.email', null, array(
'label' => 'Email'
))
;
parent::configureListFields($listMapper);
}
......
......@@ -84,10 +84,6 @@ class CotisationAdmin extends AbstractAdmin
->add('cotisationInfos.annee', null, array(
'label' => 'Année',
))
->add('montant', MoneyType::class, array(
'label' => 'Montant',
'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_MONTANT))
))
->add('moyen', ChoiceType::class, array(
'required' => true,
'choices' => MoyenEnum::getAvailableTypes(),
......
......@@ -3,6 +3,7 @@
namespace App\Admin;
use App\Entity\Flux;
use App\Entity\GlobalParameter;
use App\Entity\Prestataire;
use App\Entity\User;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
......@@ -13,6 +14,7 @@ use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
/**
* Administration des cotisations des prestataires
......@@ -41,23 +43,23 @@ class CotisationPrestataireAdmin extends CotisationAdmin
->andWhere($query->getRootAliases()[0] .".type='cotisation_prestataire'")
// ->andWhere('u.prestataire IS NOT NULL')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
} else {
$groupe = $this->session->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
$prestaTable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM '.$fluxTable.' f INNER JOIN '.$prestaTable.' a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
$prestaTable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM '.$fluxTable.' f INNER JOIN '.$prestaTable.' a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
return $query;
}
......@@ -87,6 +89,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$cotisation = $this->getSubject();
$expediteurInfos = array(
'label' => 'Expéditeur',
'class' => Prestataire::class,
......@@ -100,6 +103,10 @@ class CotisationPrestataireAdmin extends CotisationAdmin
}
$formMapper
->with('Cotisation', ['class' => 'col-md-8'])
->add('montant', MoneyType::class, array(
'label' => 'Montant',
'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_PRESTATAIRE))
))
->add('reference', HiddenType::class, array(
'data' => 'cotisation_prestataire'
))
......@@ -129,8 +136,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('expediteur', null, array('label' => 'Prestataire'))
->addIdentifier('expediteur.user.email', null, array('label' => 'Email'));
->addIdentifier('expediteur', null, array('label' => 'Prestataire'));
parent::configureListFields($listMapper);
}
}
<?php
namespace App\Admin;
use App\Entity\Prestataire;
use App\Enum\GroupePrestaEnum;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Security\Core\Security;
/**
* Administration des tags/états des prestataires (rappel, suspendus, ...)
*
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class EtatprestataireAdmin extends AbstractAdmin
{
protected $security;
protected $datagridValues = [
// reverse order (default = 'ASC')
'_sort_order' => 'DESC',
// name of the ordered field (default = the model's id field, if any)
'_sort_by' => 'name',
];
public function configure()
{
parent::configure();
}
public function setSecurity(Security $security)
{
$this->security = $security;
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC'));
$groupepresta = $this->getSubject();
$formMapper
->with('Informations', ['class' => 'col-md-7'])
->add('name', TextType::class, array(
'label' => 'Nom :',
'required' => true
))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
// 'config' => ['enterMode' => 'CKEDITOR.ENTER_BR'],
'required' => false
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
->end()
;
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array(
'label' => 'Nom'
))
->addIdentifier('content', null, array(
'label' => 'Description'
))
->addIdentifier('enabled', null, array(
'label' => 'Activé',
'datatype' => 'App.EtatPrestataire',
'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'
))
;
}
protected function configureRoutes(RouteCollection $collection)
{
parent::configureRoutes($collection);
$collection->remove('delete');
}
public function getBatchActions()
{
$actions = parent::getBatchActions();
unset($actions['delete']);
return $actions;
}
public function getDashboardActions()
{
$actions = parent::getDashboardActions();
// unset($actions['list']);
return $actions;
}
}
......@@ -157,7 +157,7 @@ class GroupeAdmin extends AbstractAdmin
'getPrestatairesCount',
null,
[
'label' => 'Nb prestataires',
'label' => 'Nombre de prestas',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
......
......@@ -52,16 +52,15 @@ class GroupeprestataireAdmin extends AbstractAdmin
{
$user = $this->security->getUser();
$query = parent::createQuery($context);
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
} else {
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.groupe', ':groupe'))
// ->andWhere($query->getRootAliases()[0].'.groupe = :groupe')
->setParameter('groupe', $user->getGroupesgeres())
;
}
} else {
$query
->andWhere($query->getRootAliases()[0].'.groupe = :groupe')
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
;
}
// @TODO : NE FONCTIONNE PAS : pour pouvoir classer par nombre de prestataires !
// voir https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/297
......@@ -89,7 +88,6 @@ class GroupeprestataireAdmin extends AbstractAdmin
protected function configureFormFields(FormMapper $formMapper)
{
$user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC'));
$groupepresta = $this->getSubject();
$formMapper
......@@ -106,9 +104,10 @@ class GroupeprestataireAdmin extends AbstractAdmin
'required' => true
))
;
if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && !empty($this->security->getUser()->getGroupesgeres())) {
//TODO : check request !
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'groupe' => $this->security->getUser()->getGroupesgeres()), array('raison'=> 'ASC'));
if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) {
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findByGroupeLocal($this->getRequest()->getSession()->get('_groupegere'));
} else {
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC'));
}
if ($user->isGranted('ROLE_SUPER_ADMIN') || $user->isGranted('ROLE_ADMIN_SIEGE')) {
$formMapper
......@@ -124,7 +123,7 @@ class GroupeprestataireAdmin extends AbstractAdmin
'required' => false
))
->add('content', CKEditorType::class, array(
'label' => 'Texte',
'label' => 'Description',
'required' => false,
))
->add('enabled', CheckboxType::class, array(
......@@ -184,15 +183,10 @@ class GroupeprestataireAdmin extends AbstractAdmin
'strip' => true,
'truncate' => 50
))
->add(
'getPrestatairesCount',
null,
[
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
]
)
->add('getPrestatairesCount', null, array(
'label' => 'Nombre de prestas',
'sortable' => false,
))
->addIdentifier('enabled', null, array(
'label' => 'Activé',
'datatype' => 'App.Groupeprestataire',
......
......@@ -6,15 +6,19 @@ use App\Admin\UserAdmin;
use App\Entity\Adherent;
use App\Entity\Cotisation;
use App\Entity\CotisationPrestataire;
use App\Entity\EtatPrestataire;
use App\Entity\Geoloc;
use App\Entity\Groupe;
use App\Entity\Prestataire;
use App\Entity\Rubrique;
use App\Entity\User;
use App\Entity\Usergroup;
use App\Enum\MoyenEnum;
use App\Form\Type\ContactPrestataireFormType;
use App\Form\Type\CotisationFormType;
use App\Form\Type\GeolocFormType;
use App\Form\Type\GeolocPrestataireFormType;
use App\Form\Type\UserFormType;
use App\Form\Type\UserInfosFormType;
use Doctrine\ORM\Query;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use FOS\UserBundle\Model\UserManagerInterface;
......@@ -92,15 +96,12 @@ class PrestataireAdmin extends AbstractAdmin
// ->addSelect('u')
// ;
if ($user->hasRole('ROLE_GESTION_GROUPE') || $user->hasRole('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
$query->andWhere('false');
} else {
// TODO : check request !
$groupes = $user->getGroupesgeres();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.groupe', ':group'))
// ->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupes)
->andWhere($query->getRootAliases()[0].'.groupe = :group')
->setParameter('group', $this->getRequest()->getSession()->get('_groupegere'))
;
}
}
......@@ -143,31 +144,9 @@ class PrestataireAdmin extends AbstractAdmin
{
// Initialize prestataire
$presta = $this->getSubject();
$user = $this->security->getUser();
// $user = $this->security->getUser();
$now = new \DateTime();
$cotisation = null;
if ($this->isCurrentRoute('create')) {
if ($user->isGranted('ROLE_CONTACT') or $user->isGranted('ROLE_COMPTOIR')) {
$user->setEnabled(false);
} else {
$user->setEnabled(true);
}
// On crée un compte adhérent en même temps que le prestataire
$adh = new Adherent();
$user->setAdherent($adh);
$user = $this->userManager->createUser();
$groupeAdh = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Usergroup::class)->findOneByName('Adherent');
$groupePresta = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Usergroup::class)->findOneByName('Prestataire');
$user->addGroup($groupeAdh);
$user->addGroup($groupePresta);
$user->addRole('ROLE_PRESTATAIRE');
$user->addRole('ROLE_ADHERENT');
$presta->addUser($user);
}
if ($presta->getGeoloc() == null) {
$presta->setGeoloc(new Geoloc());
}
// get the current Image instance
$imageHelp = null;
......@@ -184,7 +163,7 @@ class PrestataireAdmin extends AbstractAdmin
$formMapper
->tab('Prestataire')
->with('Prestataire', ['class' => 'col-md-7'])
->with('Prestataire', ['class' => 'col-md-6'])
->add('typeprestataire', null, array(
'label' => 'Type :',
'required' => true,
......@@ -230,13 +209,47 @@ class PrestataireAdmin extends AbstractAdmin
'required' => false
))
->end()
->with('Addresse', ['class' => 'col-md-5'])
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => false
->with('Contact(s)', ['class' => 'col-md-6'])
->add('contacts', CollectionType::class, array(
'entry_type' => ContactPrestataireFormType::class,
'entry_options' => array('label' => false),
'required' => false,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'label' => false
))
->end()
->with('Adresse(s)', ['class' => 'col-md-6'])
->add('geolocs', CollectionType::class, array(
'entry_type' => GeolocPrestataireFormType::class,
'entry_options' => array('label' => false),
'required' => false,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'label' => false
))
->end()
->with('Image', ['class' => 'col-md-5'])
->with('Classification', ['class' => 'col-md-6'])
->add('etats', EntityType::class, array(
'class' => EtatPrestataire::class,
'multiple' => true,
'required' => false,
'by_reference' => false,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(EtatPrestataire::class)->findBy(array('enabled' => true)),
'label' => 'Tags'
))
->add('rubriques', EntityType::class, array(
'class' => Rubrique::class,
'multiple' => true,
'required' => false,
'by_reference' => false,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Rubrique::class)->findBy(array('enabled' => true)),
'label' => 'Rubriques'
))
->end()
->with('Image', ['class' => 'col-md-6'])
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'prestataire',
......@@ -244,18 +257,35 @@ class PrestataireAdmin extends AbstractAdmin
'required' => false
))
->end()
->with('Gestionnaire', ['class' => 'col-md-7'])
->add('users', null, array(
'label' => false,
'by_reference' => false,
->with('Gestionnaire(s)', ['class' => 'col-md-6'])
->add('users', EntityType::class, array(
// 'mapped' => false,
'class' => User::class,
'multiple' => true,
'required' => false,
'label' => 'Associer à un(des) utilisateur(s) existant :',
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(User::class)->findAll(),
'choice_label' => 'username',
'placeholder' => 'Choisir un utilisateur',
))
->add('newusers', CollectionType::class, array(
'mapped' => false,
'required' => false,
'label' => 'Nouvel Utilisateur/Adhérent',
'entry_type' => UserFormType::class,
'entry_options' => array(
'required' => false,
'label' => false),
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true
))
->end()
;
// if ($cotisation != null) {
// //@TODO : cotisationS
// $formMapper
// ->with('Cotisation', ['class' => 'col-md-5'])
// ->with('Cotisation', ['class' => 'col-md-6'])
// ->add('user.cotisations.last.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => intval($now->format('Y'))))
// ->add('user.cotisations.last.montant', MoneyType::class, array(
// 'label' => 'Montant',
......@@ -275,7 +305,7 @@ class PrestataireAdmin extends AbstractAdmin
// ->end();
// if (!$this->isCurrentRoute('create')) {
// $formMapper
// ->with('Date', ['class' => 'col-md-5'])
// ->with('Date', ['class' => 'col-md-6'])
// ->add('user.cotisations.last.cotisationInfos.debut', DateType::class, array(
// 'label' => 'Date de début',
// 'data' => new \DateTime(),
......@@ -321,7 +351,7 @@ class PrestataireAdmin extends AbstractAdmin
// }
// $formMapper
// ->tab('Cotisation '.$cotisation->getAnnee())
// ->with('Cotisation', ['class' => 'col-md-5'])
// ->with('Cotisation', ['class' => 'col-md-6'])
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
// ->add('user.cotisations.get('.$cnt.').montant', TextType::class, array('label' => 'Montant'))
// ->add('user.cotisations.get('.$cnt.').moyen', ChoiceType::class, array(
......@@ -334,7 +364,7 @@ class PrestataireAdmin extends AbstractAdmin
// ))
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'))
// ->end()
// ->with('Date', ['class' => 'col-md-5'])
// ->with('Date', ['class' => 'col-md-6'])
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.debut', DateType::class, array(
// 'label' => 'Date de début',
// 'data' => new \DateTime(),
......@@ -356,51 +386,43 @@ class PrestataireAdmin extends AbstractAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($em) {
$prestataire = $event->getData();
$user = $prestataire->getUsers()[0];
// dump($user);
// exit();
if (!$user || null === $user->getId()) {
$repo = $em->getRepository(User::class);
$emailExist = $repo->findBy(array('email' => $user->getEmail()));
if (count($emailExist) > 0) {
$event->getForm()->get('user__email')->addError(new FormError('Courriel déjà utilisé !'));
} else {
$user->setUsername($user->getEmail());
$users = null;
/* Permet d'ajouter le nouvel utilisateur crée (newusers) aux gestionnaires du presta */
if ($event->getForm()->get('users')->getData() != null) {
$users = $event->getForm()->get('users')->getData();
}
if ($event->getForm()->get('newusers')->getData() != null) {
$users = array_merge($users, $event->getForm()->get('newusers')->getData());
}
if ($users != null) {
// On crée un compte adhérent en même temps que le prestataire
foreach ($users as $user) {
if ($user->getId() == null) {
$emailExist = $em->getRepository(User::class)->findBy(array('email' => $user->getEmail()));
if (count($emailExist) > 0) {
$event->getForm()->get('newusers')->addError(new FormError('Courriel déjà utilisé !'));
break;
}
$user->setUsername($user->getEmail());
$adh = new Adherent();
$user->setAdherent($adh);
$groupeAdh = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Usergroup::class)->findOneByName('Adherent');
$groupePresta = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Usergroup::class)->findOneByName('Prestataire');
$user->addGroup($groupeAdh);
$user->addGroup($groupePresta);
$this->userManager->updateUser($user);
// $user->addRole('ROLE_PRESTATAIRE');
// $user->addRole('ROLE_ADHERENT');
}
$prestataire->addUser($user);
}
} else {
$event->getForm()->get('users')->addError(new FormError('Veuillez séléctionner un utilisateur ou en créer un nouveau !'));
}
});
parent::configureFormFields($formMapper);
}
public function preUpdate($prestataire)
{
$this->prePersist($prestataire);
}
public function prePersist($prestataire)
{
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$user = $prestataire->getUsers()[0];
if (empty($user->getUsername())) {
$user->setUsername($user->getEmail());
}
if (empty($user->getPassword())) {
// $tokenGenerator = $this->getConfigurationPool()->getContainer()->get('fos_user.util.token_generator');
// $password = substr($tokenGenerator->generateToken(), 0, 12);
$bytes = random_bytes(64);
$password = rtrim(strtr(base64_encode($bytes), '+/', '-_'), '=');
$user->setPassword($password);
// TODO : send email to user
}
$this->userManager->updateUser($user);
$user->createEmailToken();
$em->persist($user);
$em->persist($prestataire);
$em->flush();
// TODO : envoyer un mail au nouvel utilisateur avec l'emailtoken via le dispatch d'un event
// $this->eventDispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($adherent->getUser(), $this->getRequest(), $response));
}
/**
* {@inheritdoc}
*/
......@@ -420,8 +442,14 @@ class PrestataireAdmin extends AbstractAdmin
'show_filter' => true,
'advanced_filter' => false
])
->add('etats', null, [
'label' => "Tags",
'show_filter' => true,
'advanced_filter' => false
])
->add('typeprestataire', null, [
'label' => "Type"
'label' => "Type",
'advanced_filter' => false
])
;
}
......@@ -468,10 +496,11 @@ class PrestataireAdmin extends AbstractAdmin
protected function configureListFields(ListMapper $listMapper): void
{
// unset($this->listModes['mosaic']);
unset($this->listModes['mosaic']);
$user = $this->security->getUser();
$listMapper
->addIdentifier('raison')
->add('rubriques', null)
->addIdentifier('groupe', null, array(
'label' => 'Groupe',
'sortable' => true,
......@@ -479,21 +508,13 @@ class PrestataireAdmin extends AbstractAdmin
'sort_parent_association_mappings' => array(array('fieldName' => 'groupe'))
))
->addIdentifier('users', null, array('label' => 'Gestionnaires'))
->addIdentifier('etats', null, array('label' => 'Tags'))
->addIdentifier('enabled', null, array(
'label' => 'Activé',
'datatype' => 'App.Groupeprestataire',
'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'
))
;
// if ($user->isGranted('ROLE_GESTION_GROUPE')) {
// $listMapper
// ->addIdentifier('user.enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
// ;
// }
// $listMapper
// ->addIdentifier('user.createdAt')
// ;
// if ($this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
// $listMapper
// ->addIdentifier('user.impersonating', 'string', ['template' => '@SonataUser/Admin/Field/impersonating.html.twig'])
// ;
// }
}
protected function configureRoutes(RouteCollection $collection)
......@@ -529,9 +550,12 @@ class PrestataireAdmin extends AbstractAdmin
{
return [
'Id' => 'id',
'Raion' => 'raison',
'Raison' => 'raison',
'Groupe' => 'groupe.name',
'E-compte' => 'ecompte'
'E-compte' => 'ecompte',
'Rubriques' => 'rubriquesString',
'Gestionnaires' => 'usersString',
'Tags' => 'etatsString'
];
}
}
......@@ -5,12 +5,16 @@ namespace App\Admin;
use App\Entity\Comptoir;
use App\Entity\Prestataire;
use App\Entity\Siege;
use App\Entity\Rubrique;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Sonata\MediaBundle\Provider\Pool;
use Sonata\MediaBundle\Provider\MediaProviderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
......@@ -29,7 +33,7 @@ class RubriqueAdmin extends AbstractAdmin
protected $security;
protected $datagridValues = [
'_sort_order' => 'ASC',
'_sort_by' => 'name',
'_sort_by' => 'id',
];
public function configure()
......@@ -45,17 +49,41 @@ class RubriqueAdmin extends AbstractAdmin
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query
->leftJoin($query->getRootAliases()[0] .'.media', 'm')
->addSelect('m')
;
return $query;
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$rubrique = $this->getSubject();
$user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC'));
// TODO : ?
// if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && $this->security->getUser()->getGroupesgere() != null) {
// $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'groupe' => $this->security->getUser()->getGroupesgere()), array('raison'=> 'ASC'));
// }
// get the current Image instance
$imageHelp = null;
if (!empty($rubrique) && !empty($rubrique->getMedia())) {
$image = $rubrique->getMedia();
if ($image && ($webPath = $image->getWebPath())) {
// get the container so the full path to the image can be set
$container = $this->getConfigurationPool()->getContainer();
$fullPath = $container->get('request_stack')->getCurrentRequest()->getBasePath().'/'.$webPath;
// add a 'help' option containing the preview's img tag
$imageHelp = '<img src="'.$fullPath.'" class="admin-preview" />';
}
}
$groupe = $this->getSubject();
$formMapper
->with("Création d'une rubrique")
->with("Contenu", ['class' => 'col-md-6'])
->add('name', TextType::class, array(
'label' => 'Nom :',
'required' => true
......@@ -64,8 +92,24 @@ class RubriqueAdmin extends AbstractAdmin
'label' => 'Description :',
'required' => false,
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
->end()
->with('Image', ['class' => 'col-md-6'])
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'rubrique',
// 'help' => $imageHelp,
'label' => false,
'required' => false
))
->end()
->with('Prestataires', ['class' => 'col-md-6'])
->add('prestataires', CollectionType::class, array(
'label' => 'Prestataires',
'label' => false,
'entry_type' => EntityType::class,
'entry_options' => array(
'class' => Prestataire::class,
......@@ -78,18 +122,13 @@ class RubriqueAdmin extends AbstractAdmin
'allow_add' => true,
'allow_delete' => true
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
->end()
;
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
// $collection->remove('delete');
}
// public function getBatchActions()
......@@ -107,19 +146,21 @@ class RubriqueAdmin extends AbstractAdmin
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->addIdentifier('file', null, array('label' => 'Icône', 'template' => '@SonataAdmin/Image/preview_image_o.html.twig'))
->add('name', null, array('editable' => true, 'truncate' => array('length' => 80), 'label' => 'Nom du groupe'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->add(
'getPrestatairesCount',
null,
[
'label' => 'Nb prestataires',
'sortable' => true,
'sort_field_mapping' => ['fieldName' => 'id'],
'sort_parent_association_mappings' => [],
]
)
->add('getPrestatairesCount', null, array(
'label' => 'Nombre de prestas',
'sortable' => false,
))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
// You may also specify the actions you want to be displayed in the list
->add('_action', null, [
'actions' => [
'edit' => [],
'delete' => [],
]
])
;
}
}
......@@ -68,10 +68,10 @@ class TransfertAdmin extends FluxAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
if ($this->rolecheck->isGranted('ROLE_GESTION_GROUPE') || $this->rolecheck->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgeres())) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
$query->andWhere('false');
} else {
$groupe = $this->session->get('_groupegere');
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection();
$prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$statement = $connection->prepare('SELECT f.id FROM '.$fluxtable.' f WHERE f.groupe_id = '.$groupe->getId().' OR (f.type = \'prestataire_siege\' AND f.prestataire_id IN (SELECT p.id FROM '.$fluxtable.' p WHERE p.groupe_id = '.$groupe->getId().'))');
......
......@@ -85,7 +85,14 @@ class UserAdmin extends SonataUserAdmin
{
parent::configureDatagridFilters($datagridMapper);
$datagridMapper
->add('enabled')
->add('email', null, [
'label' => "Email",
'advanced_filter' => false
])
->add('enabled', null, array(
'label' => 'Activé ?',
'advanced_filter' => false
))
;
}
......
......@@ -37,4 +37,16 @@ class Media extends BaseMedia
{
return $this->id;
}
protected function getUploadDir()
{
return '/uploads';
}
public function getWebPath()
{
// return null === $this->path
// ? 'null'
// : $this->getUploadDir().'/'.$this->path;
}
}
<?php
namespace App\Block;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\BlockBundle\Block\AbstractBlockService;
use Sonata\BlockBundle\Block\BaseBlockService;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\CoreBundle\Validator\ErrorElement;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DashboardKohinosBlock extends AbstractBlockService
{
/**
* {@inheritdoc}
*/
public function execute(BlockContextInterface $blockContext, Response $response = null)
{
// $end = new \DateTime();
// $start = new \DateTime('7 days ago');
// $chart = $this->chartBuilder->getRegistrationsChart($start, $end);
return $this->renderResponse($blockContext->getTemplate(), array(
// 'chart' => $chart,
'block' => $blockContext->getBlock(),
'settings' => $blockContext->getSettings(),
), $response);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Dashboard';
}
/**
* {@inheritdoc}
*/
public function configureSettings(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'title' => 'Dashboard',
'summaries' => false,
'template' => 'block/dashboard_kohinos.html.twig',
));
}
}
......@@ -135,7 +135,7 @@ class AdminController extends Controller
$httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = Nominatim::withOpenStreetMapServer($httpClient, 'Mozilla/5.0');
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr');
// Query geocoding from complete addresse
// Query geocoding from complete address
$result = $geocoder->geocodeQuery(GeocodeQuery::create($request->get('adresse').' '.$request->get('cpostal').' '.$request->get('ville')));
if (count($result) > 0) {
$coords = $result->first()->getCoordinates();
......
......@@ -139,7 +139,8 @@ class IndexController extends AbstractController
$presta->setEnabled(true);
$presta->setIban(' ');
$presta->setSiret(' ');
$user->addRole('ROLE_PRESTATAIRE');
$groupePresta = $repogroup->findOneBy(array('name' => 'Prestataire'));
$user->addGroup($groupePresta);
$presta->addUser($user);
$presta->setGroupe($groupe);
......
<?php
namespace App\Controller;
use App\Entity\Prestataire;
use App\Entity\Rubrique;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Sonata\MediaBundle\Provider\ImageProvider;
class MapController extends AbstractController
{
protected $imageProvider;
private $em;
public function __construct(ImageProvider $imageProvider, EntityManagerInterface $em)
{
$this->imageProvider = $imageProvider;
$this->em = $em;
}
/**
* @Route("/map/json/prestataire", name="map_prestataire_json", defaults={"rubrique": null})
* @Route("/map/json/prestataire/{id}", name="map_prestataire_json_rubrique")
*/
public function getJsonPrestataireMap(Rubrique $rubrique = null)
{
$points = [];
$filtered_cat = null;
if ($rubrique != null) {
$prestataires = $this->em->getRepository(Prestataire::class)->findByRubrique($rubrique);
} else {
$prestataires = $this->em->getRepository(Prestataire::class)->findBy(['enabled' => true]);
}
dump($rubrique);
dump($prestataires);
foreach ($prestataires as $presta) {
dump($presta->getGeolocs()->toArray());
// if ($rubrique === null || $presta->getRubriques()->contains($rubrique)) {
$geolocs = array_map(function ($geoloc) {
if ($geoloc->isEnabled()) {
return $geoloc;
}
}, $presta->getGeolocs()->toArray());
if (count($geolocs) > 0) {
dump('yeah');
$geoloc = $geolocs[0];
// list($lat, $lon) = explode(',', $presta->latlon);
if ($geoloc->getGeoloc()->getLon() != null and $geoloc->getGeoloc()->getLat() != null) {
dump('yeah2');
$p = new \StdClass();
$p->type = "Feature";
$p->geometry = [
'type'=>'Point',
'coordinates' => [$geoloc->getGeoloc()->getLon(),$geoloc->getGeoloc()->getLat()]
];
// $cat = [];
// foreach ($geo_cats as $gc) {
// if ($gc['id'] == $c->cat) {
// $cat = $gc;
// }
// }
$p->cat = array_map(function ($rubrique) {
// $provider = $this->container->get($rubrique->getMedia()->getProviderName());
return [
'name' => $rubrique->getName(),
'icon' => (($rubrique->getMedia() != null)?$this->imageProvider->generatePublicUrl($rubrique->getMedia(), 'preview'):null),
'content' => $rubrique->getContent()
];
}, $presta->getRubriques()->toArray());
$properties = [
'name' => $presta->__toString(),
'popupContent'=>$presta->getMapContent(),
];
// if (isset($cat['id'])) {
// $properties['cat'] = $cat['id'];
// }
$p->properties = $properties;
$points[] = $p;
}
}
// }
}
dump($points);
exit();
return new JsonResponse($points);
}
}
......@@ -79,7 +79,7 @@ class Adherent
* @param null|Groupe $groupe
* @return $this
*/
public function setGroupe(?Groupe $groupe)
public function setGroupe(?Groupe $groupe): self
{
$this->groupe = $groupe;
return $this;
......
......@@ -26,8 +26,6 @@ class Comptoir
ContactEmailTelTrait,
HasCompteEntity;
const UPLOAD_DIR = "comptoir";
/**
* @var int
*
......
<?php
namespace App\Entity;
use App\Entity\Prestataire;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="contact_prestataire")
*/
class ContactPrestataire
{
use NameSlugContentEntityTrait,
TimestampableEntity,
EnablableEntityTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Prestataire
*
* @ORM\ManyToOne(targetEntity="Prestataire", cascade={"persist"}, inversedBy="contacts")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=false)
*/
private $prestataire;
public function getId(): ?int
{
return $this->id;
}
/**
* Get prestataire
* @return
*/
public function getPrestataire(): Prestataire
{
return $this->prestataire;
}
/**
* Set prestataire
* @return $this
*/
public function setPrestataire($prestataire): self
{
$this->prestataire = $prestataire;
return $this;
}
}
......@@ -35,7 +35,7 @@ class Cotisation extends Flux
$this->cotisationInfos = new CotisationInfos();
}
public function operate()
public function operate($em)
{
$compteExp = $this->getExpediteur()->getEcompte() - $this->getMontant();
if ($this->getMoyen() == MoyenEnum::MOYEN_MLC) {
......
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\EtatPrestataireRepository")
*/
class EtatPrestataire
{
use NameSlugContentEntityTrait,
TimestampableEntity,
EnablableEntityTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var ArrayCollection|EtatPrestataire[]
*
* @ORM\ManyToMany(targetEntity="Prestataire", inversedBy="etats", cascade={"persist"})
* @ORM\JoinTable(name="etats_prestataires")
*/
protected $prestataires;
public function __construct()
{
$this->prestataires = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Prestataire[]|ArrayCollection
*/
public function getPrestataires()
{
return $this->prestataires;
}
/**
* @param Prestataire $prestataire
* @return $this
*/
public function addPrestataire(Prestataire $prestataire): self
{
if (!$this->prestataires->contains($prestataire)) {
$this->prestataires[] = $prestataire;
}
return $this;
}
/**
* @param Prestataire $prestataire
* @return $this
*/
public function removePrestataire(Prestataire $prestataire): self
{
if ($this->prestataires->contains($prestataire)) {
$this->prestataires->removeElement($prestataire);
}
return $this;
}
}
......@@ -116,7 +116,7 @@ abstract class Flux
* Effectuer l'opération (transfert, transaction, vente, retrait...)
* @return array Tableau des entité(s) à persister (siege, comptoir, groupe, presta, adherent...)
*/
abstract public function operate();
abstract public function operate($em);
/**
* Obtenir la liste des utilisateurs à notifier
......@@ -331,8 +331,7 @@ abstract class Flux
public function prePersist(LifecycleEventArgs $event)
{
$flux = $event->getEntity();
$tmphash = password_hash($flux->getAllInfosUncrypted(), PASSWORD_BCRYPT, ['cost' => 12]);
$flux->setHash($tmphash);
$flux->setHash('tmp');
}
/**
......
<?php
namespace App\Entity;
use App\Entity\Prestataire;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="geoloc_prestataire")
*/
class GeolocPrestataire
{
use NameSlugContentEntityTrait,
TimestampableEntity,
EnablableEntityTrait,
GeolocEntityTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Prestataire
*
* @ORM\ManyToOne(targetEntity="Prestataire", cascade={"persist"}, inversedBy="geolocs")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=false)
*/
private $prestataire;
public function getId(): ?int
{
return $this->id;
}
/**
* Get prestataire
* @return
*/
public function getPrestataire(): Prestataire
{
return $this->prestataire;
}
/**
* Set prestataire
* @return $this
*/
public function setPrestataire($prestataire): self
{
$this->prestataire = $prestataire;
return $this;
}
}
......@@ -11,16 +11,19 @@ use Symfony\Component\Validator\Constraints as Assert;
class GlobalParameter
{
// Default global parameters for MLC
const MLC_TITLE = 'MLC_TITLE';
const MLC_DESCRIPTION = 'MLC_DESCRIPTION';
const MLC_KEYWORDS = 'MLC_KEYWORDS';
const MLC_NAME = 'MLC_NAME';
const MLC_NAME_SMALL = 'MLC_NAME_SMALL';
const MLC_NOTIF_EMAIL = 'MLC_NOTIF_EMAIL';
const COTISATION_MONTANT= 'COTISATION_MONTANT';
const MAP_CENTER = 'MAP_CENTER';
const MAP_ZOOM = 'MAP_ZOOM';
const FAVICON_URL = 'FAVICON_URL';
const MLC_TITLE = 'MLC_TITLE';
const MLC_DESCRIPTION = 'MLC_DESCRIPTION';
const MLC_KEYWORDS = 'MLC_KEYWORDS';
const MLC_NAME = 'MLC_NAME';
const MLC_NAME_SMALL = 'MLC_NAME_SMALL';
const MLC_NOTIF_EMAIL = 'MLC_NOTIF_EMAIL';
const COTISATION_ADHERENT = 'COTISATION_ADHERENT';
const COTISATION_PRESTATAIRE = 'COTISATION_PRESTATAIRE';
const RECONVERSION_ADHERENT = 'RECONVERSION_ADHERENT';
const RECONVERSION_PRESTATAIRE = 'RECONVERSION_PRESTATAIRE';
// const MAP_CENTER = 'MAP_CENTER';
// const MAP_ZOOM = 'MAP_ZOOM';
// const FAVICON_URL = 'FAVICON_URL';
/**
* @ORM\Id()
......
......@@ -20,8 +20,6 @@ class News
NameSlugContentEntityTrait,
EnablableEntityTrait;
const UPLOAD_DIR = "news";
/**
* @var int
*
......
......@@ -3,7 +3,6 @@
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\HasCompteEntity;
use App\Entity\EntityTrait\HasEcompteEntity;
use App\Entity\Groupeprestataire;
......@@ -23,7 +22,6 @@ class Prestataire
{
use EnablableEntityTrait,
TimestampableEntity,
GeolocEntityTrait,
HasCompteEntity,
HasEcompteEntity;
......@@ -81,7 +79,7 @@ class Prestataire
/**
* @ORM\Column(name="iban", type="string", length=100, nullable=true)
* @Assert\Iban(message="L'IBAN(International Bank Account Number) est invalide.")
* Assert\Iban(message="L'IBAN(International Bank Account Number) est invalide.")
*/
private $iban;
......@@ -126,7 +124,6 @@ class Prestataire
/**
* @var ArrayCollection|Rubrique[]
* @ORM\ManyToMany(targetEntity="Rubrique", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
* @ORM\JoinTable(name="rubrique_prestataire")
*/
private $rubriques;
......@@ -138,6 +135,18 @@ class Prestataire
protected $media;
/**
* @var ArrayCollection|GeolocPrestataire[]
* @ORM\OneToMany(targetEntity="GeolocPrestataire", cascade={"persist"}, mappedBy="prestataire")
*/
private $geolocs;
/**
* @var ArrayCollection|ContactPrestataire[]
* @ORM\OneToMany(targetEntity="ContactPrestataire", cascade={"persist"}, mappedBy="prestataire")
*/
private $contacts;
/**
* @var ArrayCollection|User[]
*
* @ORM\ManyToMany(targetEntity="User", inversedBy="prestataires", cascade={"persist"})
......@@ -159,11 +168,20 @@ class Prestataire
* @ORM\JoinTable(name="groupes_prestataires")
*/
private $groupeprestataires;
/**
* EtatPrestataire $etats
* @var ArrayCollection|EtatPrestataire[]
* @ORM\ManyToMany(targetEntity="EtatPrestataire", cascade={"persist"}, mappedBy="prestataires", fetch="EXTRA_LAZY")
*/
private $etats;
public function __construct()
{
$this->users = new ArrayCollection();
$this->groupeprestataires = new ArrayCollection();
$this->geolocs = new ArrayCollection();
$this->etats = new ArrayCollection();
$this->rubriques = new ArrayCollection();
}
......@@ -187,7 +205,7 @@ class Prestataire
* @param string $raison
* @return Prestataire
*/
public function setRaison(string $raison)
public function setRaison(string $raison): self
{
$this->raison = $raison;
return $this;
......@@ -198,7 +216,7 @@ class Prestataire
return $this->slug;
}
public function setSlug(?string $slug)
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
......@@ -227,7 +245,7 @@ class Prestataire
* @param string $metier
* @return Prestataire
*/
public function setMetier(string $metier)
public function setMetier(string $metier): self
{
$this->metier = $metier;
return $this;
......@@ -245,7 +263,7 @@ class Prestataire
* @param null|string $statut
* @return Prestataire
*/
public function setStatut(?string $statut)
public function setStatut(?string $statut): self
{
$this->statut = $statut;
return $this;
......@@ -263,7 +281,7 @@ class Prestataire
* @param null|string $responsable
* @return Prestataire
*/
public function setResponsable(?string $responsable)
public function setResponsable(?string $responsable): self
{
$this->responsable = $responsable;
return $this;
......@@ -281,7 +299,7 @@ class Prestataire
* @param string $iban
* @return Prestataire
*/
public function setIban(?string $iban)
public function setIban(?string $iban): self
{
$this->iban = $iban;
return $this;
......@@ -299,7 +317,7 @@ class Prestataire
* @param string $siret
* @return Prestataire
*/
public function setSiret(?string $siret)
public function setSiret(?string $siret): self
{
$this->siret = $siret;
return $this;
......@@ -317,7 +335,7 @@ class Prestataire
* @param null|string $web
* @return Prestataire
*/
public function setWeb(?string $web)
public function setWeb(?string $web): self
{
$this->web = $web;
return $this;
......@@ -335,25 +353,122 @@ class Prestataire
* @param bool $mlc
* @return Prestataire
*/
public function setMlc(bool $mlc)
public function setMlc(bool $mlc): self
{
$this->mlc = $mlc;
return $this;
}
/**
* getgeolocs
* @return ArrayCollection geoloc
*/
public function getGeolocs()
{
return $this->geolocs;
}
/**
* setGeolocs
* @param [type] $geolocs [description]
*/
public function setGeolocs($geolocs): self
{
$this->geolocs = $geolocs;
return $this;
}
/**
* @param Geoloc $geoloc
* @return $this
*/
public function addGeoloc(Geoloc $geoloc): self
{
if (!$this->geolocs->contains($geoloc)) {
$this->geolocs[] = $geoloc;
$geoloc->setPrestataire($this);
}
return $this;
}
/**
* @param Geoloc $geoloc
* @return $this
*/
public function removeGeoloc(Geoloc $geoloc): self
{
if ($this->geolocs->contains($geoloc)) {
$this->geolocs->removeElement($geoloc);
$geoloc->setPrestataire(null);
}
return $this;
}
/**
* getcontacts
* @return ArrayCollection contact
*/
public function getContacts()
{
return $this->contacts;
}
/**
* setContacts
* @param [type] $contacts [description]
*/
public function setContacts($contacts): self
{
$this->contacts = $contacts;
return $this;
}
/**
* @param ContactPrestataire $contact
* @return $this
*/
public function addContact(ContactPrestataire $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts[] = $contact;
$contact->setPrestataire($this);
}
return $this;
}
/**
* @param ContactPrestataire $contact
* @return $this
*/
public function removeContact(ContactPrestataire $contact): self
{
if ($this->contacts->contains($contact)) {
$this->contacts->removeElement($contact);
$contact->setPrestataire(null);
}
return $this;
}
/**
* @return ArrayCollection[]|User
*/
public function getUsers()
{
return $this->users;
}
public function getUsersString()
{
return join(' - ', array_map(function ($user) {
return $user->getName().':'.$user->getEmail();
}, $this->users->getValues()));
}
/**
* @param User $user
* @return $this
*/
public function addUser(User $user)
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
......@@ -389,7 +504,7 @@ class Prestataire
* @param null|Groupe $groupe
* @return $this
*/
public function setGroupe(?Groupe $groupe)
public function setGroupe(?Groupe $groupe): self
{
$this->groupe = $groupe;
return $this;
......@@ -416,7 +531,7 @@ class Prestataire
* Set typeprestataire
* @return $this
*/
public function setTypeprestataire($typeprestataire)
public function setTypeprestataire($typeprestataire): self
{
$this->typeprestataire = $typeprestataire;
return $this;
......@@ -430,11 +545,18 @@ class Prestataire
return $this->rubriques;
}
public function getRubriquesString(): ?string
{
return join(' - ', array_map(function ($rubrique) {
return $rubrique->getName();
}, $this->rubriques->getValues()));
}
/**
* @param Rubrique $rubrique
* @return $this
*/
public function addRubrique(Rubrique $rubrique)
public function addRubrique(Rubrique $rubrique): self
{
if (!$this->rubriques->contains($rubrique)) {
$this->rubriques[] = $rubrique;
......@@ -447,7 +569,7 @@ class Prestataire
* @param Rubrique $rubrique
* @return $this
*/
public function removeRubrique(Rubrique $rubrique)
public function removeRubrique(Rubrique $rubrique): self
{
if ($this->rubriques->contains($rubrique)) {
$this->rubriques->removeElement($rubrique);
......@@ -468,7 +590,7 @@ class Prestataire
* @param Amap[]|ArrayCollection
* @return this
*/
public function setGroupeprestataires($groupeprestataires)
public function setGroupeprestataires($groupeprestataires): self
{
$this->groupeprestataires = $groupeprestataires;
return $this;
......@@ -478,7 +600,7 @@ class Prestataire
* @param Amap $amap
* @return $this
*/
public function addGroupeprestataire(Groupeprestataire $groupeprestataire)
public function addGroupeprestataire(Groupeprestataire $groupeprestataire): self
{
if (!$this->groupeprestataires->contains($groupeprestataire)) {
$this->groupeprestataires[] = $groupeprestataire;
......@@ -491,7 +613,7 @@ class Prestataire
* @param Amap $amap
* @return $this
*/
public function removeGroupeprestataire(Groupeprestataire $groupeprestataires)
public function removeGroupeprestataire(Groupeprestataire $groupeprestataire): self
{
if ($this->groupeprestataires->contains($groupeprestataire)) {
$this->groupeprestataires->removeElement($groupeprestataire);
......@@ -501,6 +623,57 @@ class Prestataire
}
/**
* @return EtatPrestataire[]|ArrayCollection
*/
public function getEtats()
{
return $this->etats;
}
public function getEtatsString(): ?string
{
return join(' - ', array_map(function ($etat) {
return $etat->getName();
}, $this->etats->getValues()));
}
/**
* @param EtatPrestataire[]|ArrayCollection
* @return this
*/
public function setEtats($etats): self
{
$this->etats = $etats;
return $this;
}
/**
* @param EtatPrestataire $etat
* @return $this
*/
public function addEtat(EtatPrestataire $etat): self
{
if (!$this->etats->contains($etat)) {
$this->etats[] = $etat;
$etat->addPrestataire($this);
}
return $this;
}
/**
* @param Etat Prestataire $etat
* @return $this
*/
public function removeEtat(EtatPrestataire $etat): self
{
if ($this->etats->contains($etat)) {
$this->etats->removeElement($etat);
$etat->removePrestataire($this);
}
return $this;
}
/**
* Get horaires
* @return string Horaires
*/
......@@ -532,7 +705,7 @@ class Prestataire
* Set media
* @return $this
*/
public function setMedia($media)
public function setMedia($media): self
{
$this->media = $media;
return $this;
......@@ -540,6 +713,11 @@ class Prestataire
public function __toString(): string
{
return ($this->raison?$this->raison:'Prestataire');
return ($this->raison?$this->raison:'Prestataire '.$this->id);
}
public function getMapContent(): ?string
{
return 'mapcontentpresta';
}
}
......@@ -30,7 +30,7 @@ abstract class Retrait extends Flux
return self::TYPE_RETRAIT;
}
public function operate()
public function operate($em)
{
$compteExp = $this->getExpediteur()->getCompte() - $this->getMontant();
if ($compteExp < 0) {
......
......@@ -34,6 +34,13 @@ class Rubrique
*/
private $prestataires;
/**
* @var \App\Application\Sonata\MediaBundle\Entity\Media
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="EAGER")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id", nullable=true)
*/
protected $media;
public function __construct()
{
$this->prestataires = new ArrayCollection();
......@@ -48,6 +55,25 @@ class Rubrique
}
/**
* Get media
* @return
*/
public function getMedia()
{
return $this->media;
}
/**
* Set media
* @return $this
*/
public function setMedia($media): self
{
$this->media = $media;
return $this;
}
/**
* @return Prestataire[]|ArrayCollection
*/
public function getPrestataires()
......
......@@ -32,7 +32,7 @@ abstract class Transaction extends Flux
return self::TYPE_TRANSACTION;
}
public function operate()
public function operate($em)
{
$compteExp = $this->getExpediteur()->getEcompte() - $this->getMontant();
if ($compteExp < 0) {
......
......@@ -35,7 +35,7 @@ abstract class Transfert extends Flux
return self::TYPE_TRANSFERT;
}
public function operate()
public function operate($em)
{
$compteExp = $this->getExpediteur()->getCompte() - $this->getMontant();
if ($compteExp < 0) {
......
......@@ -32,7 +32,7 @@ class TransfertPrestataireComptoir extends Transfert
return 'prestataire_comptoir';
}
public function operate()
public function operate($em)
{
$this->getExpediteur()->addEcompte($this->getMontant());
$this->getDestinataire()->addCompte($this->getMontant());
......
......@@ -2,6 +2,8 @@
namespace App\Entity;
use App\Entity\GlobalParameter;
use App\Entity\Prestataire;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
......@@ -57,9 +59,13 @@ class TransfertPrestataireSiege extends Transfert
return 'prestataire_siege'; //reconversion
}
public function operate()
public function operate($em)
{
$this->getExpediteur()->removeEcompte($this->getMontant());
// @TODO : gérer le taux de reconversion
// $taux = $em->getRepository(Prestataire::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE);
// $taux = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE);
// $montantAjoute = $this->getMontant() - ($this->getMontant()*($taux/100));
$this->getDestinataire()->addCompte($this->getMontant());
$this->getDestinataire()->removeCompteNantie($this->getMontant());
......
......@@ -144,6 +144,9 @@ class User extends BaseUser
public function __construct()
{
parent::__construct();
$this->imports = new ArrayCollection();
$this->faqs = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->cotisations = new ArrayCollection();
$this->flux = new ArrayCollection();
$this->emailTokens = new ArrayCollection();
......@@ -152,8 +155,10 @@ class User extends BaseUser
$this->comptoirsgeres = new ArrayCollection();
$this->faqs = new ArrayCollection();
$this->news = new ArrayCollection();
$this->pages = new ArrayCollection();
$this->alertemailflux = true;
$this->createApiKey();
$this->createEmailToken();
}
/**
......
......@@ -30,7 +30,7 @@ abstract class Vente extends Flux
return self::TYPE_VENTE;
}
public function operate()
public function operate($em)
{
$compteExp = $this->getExpediteur()->getCompte() - $this->getMontant();
if ($compteExp < 0) {
......
......@@ -34,7 +34,7 @@ class GeolocListener
$provider = Nominatim::withOpenStreetMapServer($httpClient, 'Mozilla/5.0');
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr');
$fullAddress = $entity->getAdresse().' '.$entity->getCpostal().' '.$entity->getVille();
// Query geocoding from complete addresse
// Query geocoding from complete address
$result = $geocoder->geocodeQuery(GeocodeQuery::create($fullAddress));
if (count($result) > 0) {
$coords = $result->first()->getCoordinates();
......
......@@ -5,6 +5,7 @@ namespace App\Form\Extension;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
......@@ -16,6 +17,7 @@ class MediaTypeExtension extends AbstractTypeExtension
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefined(['show_unlink' => true]);
$resolver->setDefaults(['show_unlink' => true]);
}
/**
......@@ -40,4 +42,4 @@ class MediaTypeExtension extends AbstractTypeExtension
// return FormType::class to modify (nearly) every field in the system
return [MediaType::class];
}
}
\ No newline at end of file
}
<?php
namespace App\Form\Type;
use App\Entity\ContactPrestataire;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\RouterInterface;
class ContactPrestataireFormType extends AbstractType
{
private $router;
public function __construct(RouterInterface $router)
{
$this->router = $router;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$geoloc = null;
if (!empty($options['data'])) {
$geoloc = $options['data'];
}
$builder
->add('name', TextType::class, array(
'label' => "Nom du contact / description :",
'required' => true,
))
->add('content', TextType::class, array(
'label' => "Téléphone :",
'required' => true,
))
->add('enabled', CheckboxType::class, array(
'label' => 'Public ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
;
}
public function configureOptions(OptionsResolver $resolver)
{
// $resolver->setRequired(['with_latlon']);
$resolver->setDefaults([
'data_class' => ContactPrestataire::class
]);
}
public function getBlockPrefix()
{
return 'formContactPrestataire';
}
}
......@@ -26,7 +26,7 @@ class FirstComptoirFormType extends AbstractType
'required' => true
))
->add('compte', NumberType::class, array(
'label' => 'Solde de monnaie actuellement au comptoir :',
'label' => 'Solde de monnaie papier actuellement au comptoir :',
'required' => true
))
;
......
......@@ -21,7 +21,7 @@ class FirstGroupeFormType extends AbstractType
'required' => true
))
->add('compte', NumberType::class, array(
'label' => 'Solde de monnaie actuellement au groupe :',
'label' => 'Solde de monnaie papier actuellement au groupe :',
'required' => true
))
;
......
......@@ -29,7 +29,7 @@ class GeolocFormType extends AbstractType
}
$builder
->add('adresse', TextType::class, array(
'label' => 'Addresse :',
'label' => 'Adresse :',
'required' => $options['required']
))
->add('cpostal', TextType::class, array(
......
<?php
namespace App\Form\Type;
use App\Entity\GeolocPrestataire;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\RouterInterface;
class GeolocPrestataireFormType extends AbstractType
{
private $router;
public function __construct(RouterInterface $router)
{
$this->router = $router;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$geoloc = null;
if (!empty($options['data'])) {
$geoloc = $options['data'];
}
$builder
->add('name', TextType::class, array(
'label' => "Nom de l'adresse :",
'required' => true,
))
->add('enabled', CheckboxType::class, array(
'label' => 'Visible sur la carte ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
->add('geoloc', GeolocFormType::class, array(
'label' => false
))
;
}
public function configureOptions(OptionsResolver $resolver)
{
// $resolver->setRequired(['with_latlon']);
$resolver->setDefaults([
'data_class' => GeolocPrestataire::class
]);
}
public function getBlockPrefix()
{
return 'formGeolocPrestataire';
}
}
......@@ -45,9 +45,9 @@ class GlobalConfigurationFormType extends AbstractType
new EmailConstraint(['message' => 'Email invalide !'])
],
))
->add('mlccotisation', GlobalParameterType::class, array(
'label' => 'Montant par défaut des cotisations:',
'name_param' => GlobalParameter::COTISATION_MONTANT,
->add('mlccotisationadh', GlobalParameterType::class, array(
'label' => 'Montant par défaut des cotisations des adhérents :',
'name_param' => GlobalParameter::COTISATION_ADHERENT,
'help' => 'Ne pas utiliser de virgule ",", utiliser le point "."',
'required' => true,
'_placeholder' => '10',
......@@ -55,30 +55,60 @@ class GlobalConfigurationFormType extends AbstractType
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
],
))
->add('mapcenter', GlobalParameterType::class, array(
'label' => 'Coordonnées du centre de la carte (Format [lat,long], exemple : [45.7,3.2]):',
'name_param' => GlobalParameter::MAP_CENTER,
->add('mlccotisationpresta', GlobalParameterType::class, array(
'label' => 'Montant par défaut des cotisations des prestataires :',
'name_param' => GlobalParameter::COTISATION_PRESTATAIRE,
'help' => 'Ne pas utiliser de virgule ",", utiliser le point "."',
'required' => true,
'_placeholder' => '[45.7,3.2]',
'_placeholder' => '10',
'constraints_param' => [
new RegexConstraint(['pattern' => '/^\[[0-9]+\.[0-9]+,[0-9]+\.[0-9]+\]/', 'message' => 'Coordonnées invalide, format attendu : [45.7,3.2]'])
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
],
))
->add('mapzoom', GlobalParameterType::class, array(
'label' => 'Zoom de la carte (nombre entre 1 et 15) :',
'name_param' => GlobalParameter::MAP_ZOOM,
->add('mlcreconversionadh', GlobalParameterType::class, array(
'label' => 'Taux de reconversion des adhérents :',
'name_param' => GlobalParameter::RECONVERSION_ADHERENT,
'help' => 'Ne pas utiliser de virgule ",", utiliser le point "."',
'required' => true,
'_placeholder' => '9',
'_placeholder' => '0',
'constraints_param' => [
new RegexConstraint(['pattern' => '/^[0-9]{1,2}$/', 'message' => 'Le zoom doit être un nombre entre 0 et 15 !'])
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
],
))
->add('mlcfavicon', GlobalParameterType::class, array(
'label' => 'Chemin du favicon :',
'_data' => '/images/favicon.png',
'name_param' => GlobalParameter::FAVICON_URL,
->add('mlcreconversionpresta', GlobalParameterType::class, array(
'label' => 'Taux de reconversion des prestataires :',
'name_param' => GlobalParameter::RECONVERSION_PRESTATAIRE,
'help' => 'Ne pas utiliser de virgule ",", utiliser le point "."',
'required' => true,
'_placeholder' => '0',
'constraints_param' => [
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
],
))
// ->add('mapcenter', GlobalParameterType::class, array(
// 'label' => 'Coordonnées du centre de la carte (Format [lat,long], exemple : [45.7,3.2]):',
// 'name_param' => GlobalParameter::MAP_CENTER,
// 'required' => true,
// '_placeholder' => '[45.7,3.2]',
// 'constraints_param' => [
// new RegexConstraint(['pattern' => '/^\[[0-9]+\.[0-9]+,[0-9]+\.[0-9]+\]/', 'message' => 'Coordonnées invalide, format attendu : [45.7,3.2]'])
// ],
// ))
// ->add('mapzoom', GlobalParameterType::class, array(
// 'label' => 'Zoom de la carte (nombre entre 1 et 15) :',
// 'name_param' => GlobalParameter::MAP_ZOOM,
// 'required' => true,
// '_placeholder' => '9',
// 'constraints_param' => [
// new RegexConstraint(['pattern' => '/^[0-9]{1,2}$/', 'message' => 'Le zoom doit être un nombre entre 0 et 15 !'])
// ],
// ))
// ->add('mlcfavicon', GlobalParameterType::class, array(
// 'label' => 'Chemin du favicon :',
// '_data' => '/images/favicon.png',
// 'name_param' => GlobalParameter::FAVICON_URL,
// 'required' => true,
// ))
->add('mlctitle', GlobalParameterType::class, array(
'label' => '[SEO] Titre par défaut des pages du site web :',
'name_param' => GlobalParameter::MLC_TITLE,
......@@ -106,6 +136,6 @@ class GlobalConfigurationFormType extends AbstractType
public function getBlockPrefix()
{
return 'formSiege';
return 'formGlobalConfiguration';
}
}
......@@ -34,7 +34,7 @@ class ImportFormType extends AbstractType
'provider' => 'sonata.media.provider.file',
'context' => 'import',
'label' => 'Fichier .csv',
// 'show_unlink' => false
'show_unlink' => false
))
->add('user', HiddenType::class, array(
......
......@@ -76,9 +76,14 @@ class PrestataireInfosFormType extends AbstractType
'choice_label' => 'name',
'placeholder' => 'Choisir un groupe',
))
->add('geoloc', GeolocFormType::class, array(
'label' => 'ADRESSE',
'required' => false
->add('geolocs', CollectionType::class, array(
'entry_type' => GeolocPrestataireFormType::class,
'entry_options' => array('label' => false),
'required' => false,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'label' => false
))
->add('rubriques', CollectionType::class, array(
'label' => 'Rubriques',
......
......@@ -26,12 +26,13 @@ class SiegeFormType extends AbstractType
'required' => true
))
->add('compte', NumberType::class, array(
'label' => 'Solde de monnaie actuellement au siège :',
'label' => 'Solde de monnaie papier actuellement au siège :',
'required' => true
))
->add('compteNantie', NumberType::class, array(
'label' => 'Compte de monnaie nantie :',
'required' => true
'required' => true,
'help' => '(montant du fond de garantie)'
))
;
}
......
......@@ -52,6 +52,9 @@ class UserFormType extends AbstractType
'label' => 'Téléphone mobile :',
'required' => false
))
->add('enabled', null, array(
'label' => 'Activé ?'
))
;
}
......
......@@ -33,7 +33,7 @@ class FluxListener implements EventSubscriber
foreach ($inserted as $entity) {
if ($entity instanceof Flux) {
$topersists = $entity->operate();
$topersists = $entity->operate($em);
foreach ($topersists as $topersist) {
$class = $em->getClassMetadata(get_class($topersist));
$em->persist($topersist);
......
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200403104008 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() 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('CREATE TABLE etat_prestataire (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_DD6CC57989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE etats_prestataires (etat_prestataire_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_5D68706574D12AB (etat_prestataire_id), INDEX IDX_5D687065BE3DB2B7 (prestataire_id), PRIMARY KEY(etat_prestataire_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE etats_prestataires ADD CONSTRAINT FK_5D68706574D12AB FOREIGN KEY (etat_prestataire_id) REFERENCES etat_prestataire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE etats_prestataires ADD CONSTRAINT FK_5D687065BE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id) ON DELETE CASCADE');
}
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 etats_prestataires DROP FOREIGN KEY FK_5D68706574D12AB');
$this->addSql('DROP TABLE etat_prestataire');
$this->addSql('DROP TABLE etats_prestataires');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200406151406 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() 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('CREATE TABLE geoloc_prestataire (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, geoloc_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_7A6F2D1F989D9B62 (slug), INDEX IDX_7A6F2D1FBE3DB2B7 (prestataire_id), UNIQUE INDEX UNIQ_7A6F2D1FEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE geoloc_prestataire ADD CONSTRAINT FK_7A6F2D1FBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id)');
$this->addSql('ALTER TABLE geoloc_prestataire ADD CONSTRAINT FK_7A6F2D1FEF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480EF390162');
$this->addSql('DROP INDEX UNIQ_60A26480EF390162 ON prestataire');
$this->addSql('ALTER TABLE prestataire DROP geoloc_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 geoloc_prestataire');
$this->addSql('ALTER TABLE prestataire ADD geoloc_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480EF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_60A26480EF390162 ON prestataire (geoloc_id)');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200406170822 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() 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('CREATE TABLE contact_prestataire (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_E0EDB3E989D9B62 (slug), INDEX IDX_E0EDB3EBE3DB2B7 (prestataire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE contact_prestataire ADD CONSTRAINT FK_E0EDB3EBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (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 contact_prestataire');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200408160435 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() 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 rubrique ADD media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE rubrique ADD CONSTRAINT FK_8FA4097CEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_8FA4097CEA9FDD75 ON rubrique (media_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 rubrique DROP FOREIGN KEY FK_8FA4097CEA9FDD75');
$this->addSql('DROP INDEX IDX_8FA4097CEA9FDD75 ON rubrique');
$this->addSql('ALTER TABLE rubrique DROP media_id');
}
}
<?php
namespace App\Repository;
use App\Entity\EtatPrestataire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
/**
* @method EtatPrestataire|null find($id, $lockMode = null, $lockVersion = null)
* @method EtatPrestataire|null findOneBy(array $criteria, array $orderBy = null)
* @method EtatPrestataire[] findAll()
* @method EtatPrestataire[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class EtatPrestataireRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, EtatPrestataire::class);
}
// /**
// * @return EtatPrestataire[] Returns an array of EtatPrestataire objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('e')
->andWhere('e.exampleField = :val')
->setParameter('val', $value)
->orderBy('e.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?EtatPrestataire
{
return $this->createQueryBuilder('e')
->andWhere('e.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
......@@ -100,6 +100,50 @@ class FluxRepository extends ServiceEntityRepository
}
/**
* @param Comptoir $comptoir [description]
* @return Query Returns a query fo finding an array of Flux
*/
public function getQueryByComptoirParams(Comptoir $comptoir, $params)
{
$sql = "SELECT f.id FROM {$this->tableName} f WHERE f.comptoir_id = :id";
if (isset($param['parenttype'])) {
$sql.= ' AND f.parenttype = :parenttype';
}
if (isset($param['type'])) {
$sql.= ' AND f.type = :type';
}
if (isset($param['start'])) {
$sql.= ' AND f.created_at > :start';
}
if (isset($param['end'])) {
$sql.= ' AND f.created_at < :end';
}
$statement = $this->connection->prepare($sql);
$statement->bindValue('id', $comptoir->getId());
if (isset($param['parenttype'])) {
$statement->bindValue('parenttype', $param['parenttype']);
}
if (isset($param['type'])) {
$statement->bindValue('type', $param['type']);
}
if (isset($param['start'])) {
$statement->bindValue('start', $param['start']);
}
if (isset($param['end'])) {
$statement->bindValue('end', $param['end']);
}
$statement->execute();
$results = $statement->fetchAll();
$qb = $this->createQueryBuilder('f');
return $qb
->where($qb->expr()->in('f.id', ':ids'))
->setParameter('ids', $results)
->orderBy('f.createdAt', 'DESC')
->getQuery()
;
}
/**
* @param Groupe $groupe [description]
* @return Query Returns a query fo finding an array of Flux
*/
......
......@@ -29,6 +29,7 @@ class GlobalParameterRepository extends ServiceEntityRepository
$item = (array) $item;
$key = $item['name'];
$value = $item['value'];
// @TODO : mettre le prefixe 'KOH_' en parametre (conf yaml)
$result['KOH_'.$key] = $value;
return $result;
......
......@@ -2,8 +2,10 @@
namespace App\Repository;
use App\Entity\Groupe;
use App\Entity\Groupeprestataire;
use App\Entity\Prestataire;
use App\Entity\Rubrique;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
......@@ -23,6 +25,40 @@ class PrestataireRepository extends ServiceEntityRepository
/**
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findByRubrique(Rubrique $rubrique)
{
$qb = $this->createQueryBuilder('p');
return $qb
->where($qb->expr()->isMemberOf(':rubrique', 'p.rubriques'))
->andWhere('p.enabled = :enabled')
->setParameter('rubrique', $rubrique)
->setParameter('enabled', true)
->orderBy('p.raison', 'ASC')
->getQuery()
->getResult()
;
}
/**
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findByGroupeLocal(Groupe $groupe)
{
$qb = $this->createQueryBuilder('p');
return $qb
->where('p.groupe = :groupe')
->andWhere('p.enabled = :enabled')
->setParameter('groupe', $groupe)
->setParameter('enabled', true)
->orderBy('p.raison', 'ASC')
->getQuery()
->getResult()
;
}
/**
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findByGroupeprestataire(Groupeprestataire $groupe)
{
$qb = $this->createQueryBuilder('p');
......
<?php
namespace App\Security\Handler;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Security\Handler\RoleSecurityHandler;
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
class VoterSecurityHandler extends RoleSecurityHandler
{
/**
* {@inheritdoc}
*/
public function isGranted(AdminInterface $admin, $attributes, $object = null)
{
// dump($admin);
// dump($attributes);
// dump($object);
if (!\is_array($attributes)) {
$attributes = [$attributes];
}
foreach ($attributes as $pos => $attribute) {
$attributes[$pos] = sprintf($this->getBaseRole($admin), $attribute);
}
$allRole = sprintf($this->getBaseRole($admin), 'ALL');
// dump($attributes);
// exit();
try {
return $this->authorizationChecker->isGranted($this->superAdminRoles)
|| $this->authorizationChecker->isGranted($attributes, $object)
|| $this->authorizationChecker->isGranted([$allRole], $object);
} catch (AuthenticationCredentialsNotFoundException $e) {
return false;
}
}
}
{% extends base_template %}
{% block actions %}
{% endblock %}
{% block breadcrumb %}{% endblock %}
{%- block tab_menu -%}
{{ knp_menu_render(admin.sidemenu(action), {
'currentClass': 'active',
'template': get_global_template('tab_menu_template')
}, 'twig') }}
{%- endblock -%}
{% block title %}
{{ 'TABLEAU DE BORD'|trans }}
{% endblock %}
{% block navbar_title %}
{{ block('title') }}
{% endblock %}
{% block content %}
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{ 'GLOBAL'|trans }}</h3>
</div>
<div class="box-body">
<h4>Solde de MLC en circulation : 12345 {{KOH_MLC_NAME_SMALL}}</h4>
<h4>Solde de Monnaie Nantie : 12345 {{KOH_MLC_NAME_SMALL}}</h4>
</div>
</div>
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{ 'GROUPES'|trans }}</h3>
</div>
<div class="box-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Nom</th>
<th>Compte</th>
</tr>
</thead>
<tbody>
{% for groupe in getAllGroupes() %}
<tr>
<td>{{groupe.name}}</td>
<td>{{groupe.compte}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{ 'COMPTOIRS'|trans }}</h3>
</div>
<div class="box-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Nom</th>
<th>Compte</th>
</tr>
</thead>
<tbody>
{% for comptoir in getAllComptoirs() %}
<tr>
<td>{{comptoir.name}}</td>
<td>{{comptoir.compte}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{ 'COTISATIONS'|trans }}</h3>
</div>
<div class="box-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th colspan='6'>Cotisations des adhérents</th>
</tr>
<tr>
<th>Espèces</th>
<th>Chèques</th>
<th>CB</th>
<th>MLC</th>
<th>Autre</th>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{# <div class="p-4">
<h4><u>{{ "Exemples d'importations possible (Fichiers .csv uniquement):"|trans }}</u></h4>
<div class='mb-5'>
{% for key, csvparam in csvparams %}
<h5><strong>{{ key|capitalize }} : </strong><a class='ml-4' target='_blank' href='{{ csvparam.file }}'>Télécharger un exemple</a></h5>
<p class='ml-4'><i>{{ csvparam.header }}</i></p>
<p class='ml-4 mb-4'><i>{{ 'Exemple'|trans }} :</i> {{ csvparam.example }}</p>
{% endfor %}
</div>
{{form_start(form)}}
{{ form_row(form.media) }}
{{ form_row(form.user) }}
{{ form_row(form.save) }}
{{form_end(form)}}
{% if errors is defined and errors|length > 0 %}
<div class='container bg-danger w-100 py-4 row'>
{% if errors['error'] is defined %}
{{ errors['error'] }}
{% else %}
{{ macros.show_error(errors) }}
{% endif %}
</div>
{% endif %}
{% if warnings is defined and warnings|length > 0 %}
<div class='container bg-warning w-100 py-4 row'>
{{ macros.show_error(warnings) }}
</div>
{% endif %}
{% if success is defined and success|length > 0 %}
<div class='container bg-success w-100 py-4 row'>
{{ macros.show_error(success) }}
</div>
{% endif %}
{% if linkcsverror is defined and linkcsverror != null %}
<div class='py-4'>
<a href='{{ linkcsverror }}' role="button" class="btn-primary btn">{{ 'Télécharger CSV avec lignes en erreurs'|trans }}</a>
</div>
{% endif %}
</div> #}
{% endblock %}
\ No newline at end of file
{% extends sonata_block.templates.block_base %}
{% block block %}
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{ 'ADMINISTRATION'|trans }}</h3>
</div>
<div class="box-body">
{% include 'block/useradmin.html.twig' with {'routeName': 'sonata_admin_dashboard'}%}
</div>
</div>
{% endblock %}
\ No newline at end of file
......@@ -3,4 +3,20 @@
{% set icon = icon|default('fa-coins'|trans) %}
<div class="card mb-3">
<div class="card-header"><i class="fa {{icon}} mr-4"></i> {{soldelabel}} : <b>{{compte}}</b></div>
</div>
\ No newline at end of file
</div>
<!-- small box -->
{# <div class="small-box blue">
<div class="inner">
<h3>{{compte}}</h3>
<p>
{{soldelabel}}
</p>
</div>
<div class="icon">
<i class="fa {{ icon }}"></i>
</div>
<a href="#" class="small-box-footer">
{{ 'stats_view_more'|trans({}, 'SonataAdminBundle') }} <i class="fa fa-arrow-circle-right" aria-hidden="true"></i>
</a>
</div> #}
\ No newline at end of file
{# UNIQUEMENT POUR LES TESTS => fixture de dev #}
{% if app.environment == 'dev' and is_granted('ROLE_ADMIN') and isDevFixture() %}
{% set routeName = routeName|default('index')%}
{% if app.environment == 'dev' and isDevFixture() and (is_granted('ROLE_ADMIN') or is_granted('ROLE_PREVIOUS_ADMIN')) %}
{% set routeName = routeName|default('index') %}
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<div class='w-100 text-center mb-2'>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=_exit'>
{{ 'RETOUR SUPER ADMIN'|trans }}
</a>
</div>
{% elseif is_granted('ROLE_SUPER_ADMIN') %}
{% elseif isCurrentRoleGranted('ROLE_SUPER_ADMIN') %}
<div class='mb-2 group text-center'>
{% if isDevFixture('user_prestataire') %}
<a class='btn btn-xs m-1 btn-primary' href='{{path('index', [], true)}}?_switch_user=user_prestataire'>
......
......@@ -2,5 +2,5 @@
{% block field%}
{# <img src="{{ vich_uploader_asset(object, 'file') }}" alt="" style="max-height: 50px; max-width: 50px;" /> #}
{% thumbnail object.media, 'small' %}
{% thumbnail object.media, 'preview' %}
{% endblock %}
\ No newline at end of file
......@@ -15,16 +15,6 @@ file that was distributed with this source code.
{% block breadcrumb %}{% endblock %}
{% block content %}
{# AJOUT POUR LA MLC #}
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{ 'ADMINISTRATION'|trans }}</h3>
</div>
<div class="box-body">
{% include 'block/useradmin.html.twig' with {'routeName': 'sonata_admin_dashboard'}%}
</div>
</div>
{% set has_left = false %}
{% for block in blocks.left %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
......
......@@ -25,13 +25,18 @@ Modified for MLC from Sonata package.
{% block meta_tags %}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
{% if KOH_FAVICON_URL is defined %}
{% block favicon %}
<link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/images/favicon/site.webmanifest">
{% endblock favicon %}
{# {% if KOH_FAVICON_URL is defined %}
<link rel="shortcut icon" href="{{KOH_FAVICON_URL}}" type="image/x-icon" />
{% endif %}
{% endif %} #}
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
{% endblock %}
{% endblock meta_tags %}
<link rel="stylesheet" href="/leaflet/leaflet.css">
<meta data-sonata-admin='{{ {
config: {
CONFIRM_EXIT: sonata_admin.adminPool.getOption('confirm_exit'),
......@@ -47,6 +52,7 @@ Modified for MLC from Sonata package.
>
{% block stylesheets %}
<link rel="stylesheet" href="/leaflet/leaflet.css">
{% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %}
<link rel="stylesheet" href="{{ asset(stylesheet) }}">
{% endfor %}
......
......@@ -13,9 +13,15 @@
<meta name="keywords" content="{{ keywords|default(KOH_MLC_KEYWORDS is defined ? KOH_MLC_KEYWORDS : '') }}" />
{# FAVICON #}
{% if KOH_FAVICON_URL is defined %}
{% block favicon %}
<link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/images/favicon/site.webmanifest">
{% endblock favicon %}
{# {% if KOH_FAVICON_URL is defined %}
<link rel="shortcut icon" href="{{KOH_FAVICON_URL}}" type="image/x-icon" />
{% endif %}
{% endif %} #}
{# UTILISER LES FONT AWESOME POUR L'ICONOGRAPHIE #}
<link rel="stylesheet" href="/fontawesome/css/all.min.css">
{# UTILISER LEAFLET POUR LA CARTE #}
......
......@@ -4,28 +4,16 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="roleGroupeModalLongTitle">{{ 'Choix du rôle'|trans }}</h5>
{# <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button> #}
</div>
<div class="modal-body">
<div class='row'>
{% if app.user %}
{#
TODO : choisir le rôle ainsi que le groupe/comptoir/presta si l'utilisateur en gère plusieurs
PRESTA => choisir le presta
GESTIONNAIRE GROUPE => choisir le groupe
CONTACT => choisir le groupe
TRESORIER => choisir le groupe
GESTIONNAIRE COMPTOIR => choisir le comptoir
#}
{% for group in app.user.groups %}
{% for role in group.roles %}
{% if role == 'ROLE_PRESTATAIRE' %}
{% for presta in app.user.prestataires %}
<div class='col-6 text-center p-2'>
<a role="button" class="btn btn-secondary" href='{{path('presta_choice', {'prestaid' : presta.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - azaiuhzaiuh aziuzah iuzah iazhazihiuhazuihazi za za{{presta}} </a>
<a role="button" class="btn btn-secondary" href='{{path('presta_choice', {'prestaid' : presta.id, 'usergrpid': group.id})}}'>{{ group.name|trans }} - {{presta}} </a>
</div>
{% endfor %}
{% elseif role == 'ROLE_COMPTOIR' %}
......@@ -50,10 +38,6 @@
{% endif %}
</div>
</div>
{# <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'Fermer'|trans }}</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div> #}
</div>
</div>
</div>
\ No newline at end of file
......@@ -2,10 +2,11 @@
{% block content %}
<div class='container homepage'>
<div class="card mx-auto mt-5" style="max-width:600px;">
<div class="card-header">{{ 'PREMIERE INSTALLATION'|trans }}</div>
<div class="card mx-auto mt-5" style="max-width: 600px;">
<div class="card-header">{{ 'CONFIGURATION DU KOHINOS'|trans }}</div>
<div class="card-body">
<div class="card-text">
<em>Toutes les informations demandées ci-dessous sont obligatoires mais sont modifiables ensuite dans l'interface d'administration...</em><br/><br/>
{{form_start(form)}}
{{ form_row(form.config) }}
{{ form_row(form.groupe) }}
......
......@@ -11,18 +11,35 @@
{% set prestataires = getAllPrestataires() %}
{% set count = 1 %}
{% for presta in prestataires %}
{% if presta.geoloc != null and presta.geoloc.lat != null and presta.geoloc.lon != null %}
var marker_{{count}} = L.marker([{{presta.geoloc.lat}}, {{presta.geoloc.lon}}]).addTo(mymap);
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% thumbnail presta.media, 'small' %}<br/><br/>{% endif %}
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>
<strong>{{presta.__toString()}}</strong>
</a>
<br/>
{% for rubrique in presta.rubriques %}
<a class='maprubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name|replace({"\n": '<br/>'})}}</a>
{% endfor %}
{% endspaceless %}");
{% set count = count+1 %}
{% if presta.geolocs|length > 0 %}
{% for geolocp in presta.geolocs %}
{% if geolocp.enabled and geolocp.geoloc.lat != null and geolocp.geoloc.lon != null %}
{% if presta.rubriques.first.media is not null %}
var icon = L.icon({
iconSize: [50, 50],
iconAnchor: [50,25],
className: 'kohino-map-icon',
iconUrl : '{% path presta.rubriques.first.media, "preview" %}'
});
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}], {icon: icon}).addTo(mymap);
{% else %}
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap);
{% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% thumbnail presta.media, 'small' %}<br/><br/>{% endif %}
<a target='_blank' href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>
<strong style='font-size:16px;'>{{presta.__toString()}}</strong>
</a>
<br/>
{% if presta.horaires is not null %}
<p>{{presta.horaires}}</p>
{% endif %}
{% for rubrique in presta.rubriques %}
<a class='maprubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name|replace({"\n": '<br/>'})}}</a>{% if not loop.last %} - {% endif %}
{% endfor %}
{% endspaceless %}");
{% set count = count+1 %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
}
......
......@@ -17,8 +17,9 @@
{{ form_row(form.metier) }}
{{ form_row(form.metier) }}
{{ form_row(form.description) }}
{# @TODO : faire les formulaires pour ajouter des adresses / contacts (/ rubriques ?) #}
{{ form_row(form.rubriques) }}
{{ form_row(form.geoloc) }}
{{ form_row(form.geolocs) }}
{{ form_row(form.save) }}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
......@@ -7,7 +7,7 @@
{% for presta in prestas %}
<div class="col-12 col-md-6 mb-2">
<div class='card'>
<div class="card-header"><h2>{{presta.raison}}</h2></div>
<div class="card-header"><h2><a href="{{ path('show_prestataire', {'slug': presta.slug}) }}">{{presta.raison}}</a></h2></div>
<div class="card-body">
<h4 class="card-title">{{presta.statut}}</h4>
<h6 class="card-title">{{ 'Responsable'|trans }} : {{presta.responsable}} ({{presta.metier}})</h6>
......
......@@ -5,39 +5,63 @@
<div class="my-2 p-3 bg-white rounded box-shadow">
<div class="contentpresta p-4 mt-2">
<div class="card mb-2">
<div class="card-header"><h1>{{presta.raison}}</h1></div>
<div class="card-body">
{% if presta.statut != null %}
<h6 class="card-title text-muted mb-3">{{presta.statut}}</h6>
{% endif %}
{% if presta.groupe != null %}
<h4 class="card-subtitle mb-3">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': presta.groupe.slug}) }}'>{{presta.groupe.__toString()}}</a></h4>
{% endif %}
{% if presta.siret != null %}
<h5 class="card-subtitle mb-3">{{'SIRET'|trans}} : {{presta.siret}}</h5>
{% endif %}
{% if presta.horaires != null %}
<h6 class="card-subtitle text-muted mb-3">{{'Horaires'|trans}} : {{presta.horaires}}</h6>
{% endif %}
{% if presta.web != null %}
<h6 class="card-subtitle mb-3">{{'Site web'|trans}} : <a href='{{presta.web}}' target='_blank'>{{presta.web}}</a></h6>
{% endif %}
{% if presta.responsable != null and presta.metier != null %}
<h6 class="card-title my-3">Responsable : {{presta.responsable}} ({{presta.metier}})</h6>
{% endif %}
{% if presta.user != null and presta.user.email != null %}
<h6 class="card-subtitle text-muted mb-3">{{'Email'|trans}} : {{ presta.user.email|safe_email|raw }}</h6>
{% endif %}
{% if presta.user != null and presta.user.phone != null %}
<h6 class="card-subtitle text-muted mb-3">{{'Téléphone'|trans}} : {{ presta.user.phone }}</h6>
{% endif %}
<div class="card-text">
<div class="card-header"><h1>{{presta.raison}}</h1></div>
<div class="card-body">
{% if presta.statut != null %}
<h6 class="card-title text-muted mb-3">{{presta.statut}}</h6>
{% endif %}
{% if presta.groupe != null %}
<h4 class="card-subtitle mb-3">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': presta.groupe.slug}) }}'>{{presta.groupe.__toString()}}</a></h4>
{% endif %}
{% if presta.siret != null %}
<h5 class="card-subtitle mb-3">{{'SIRET'|trans}} : {{presta.siret}}</h5>
{% endif %}
{% if presta.horaires != null %}
<h6 class="card-subtitle text-muted mb-3">{{'Horaires'|trans}} : {{presta.horaires}}</h6>
{% endif %}
{% if presta.web != null %}
<h6 class="card-subtitle mb-3">{{'Site web'|trans}} : <a href='{{presta.web}}' target='_blank'>{{presta.web}}</a></h6>
{% endif %}
{% if presta.responsable != null and presta.metier != null %}
<h6 class="card-title my-3">Responsable : {{presta.responsable}} ({{presta.metier}})</h6>
{% endif %}
<div class="card-text">
{{presta.description|raw}}
</div>
</div>
{% if presta.geolocs|length > 0%}
<div class="card-header"><h2>{{ 'Adresse(s)'|trans }} :</h2></div>
<ul class="list-group list-group-flush">
{% for geoloc in presta.geolocs %}
<li class="list-group-item">
{{geoloc.geoloc}}
</li>
{% endfor %}
</ul>
{% endif %}
{% if presta.contacts|length > 0%}
<div class="card-header"><h2>{{ 'Contact(s)'|trans }} :</h2></div>
<ul class="list-group list-group-flush">
{% for contact in presta.contacts %}
<li class="list-group-item">
{{contact.name}} : {{contact.content}}
</li>
{% endfor %}
</ul>
{% endif %}
{% if presta.rubriques|length > 0%}
<div class="card-header"><h2>{{ 'Rubrique(s)'|trans }} :</h2></div>
<ul class="list-group list-group-flush">
{% for rubrique in presta.rubriques %}
<li class="list-group-item">
<a class='rubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
......
......@@ -4,6 +4,9 @@
<div class='container newslist mt-5'>
<h1>{{rubrique.name}}</h1>
<div class="my-3 p-3 bg-white rounded box-shadow">
{% if rubrique.media is not null %}
{% thumbnail rubrique.media, 'small' %}
{% endif %}
<p>{{rubrique.content|raw}}</p>
<h3>{{ 'Prestataires'|trans }} : </h3>
{% for prestataire in rubrique.prestataires %}
......
{% block sonata_media_type_widget %}
{# <div class="row">
<div class="col-md-4 pull-left">
{% if value is not empty and value.providerReference %}
{% if sonata_admin_enabled is defined and sonata_admin_enabled and sonata_admin.admin is not same as(false) %}
<a href="{{ sonata_admin.admin.getConfigurationPool().adminByAdminCode('sonata.media.admin.media').generateObjectUrl('edit', value) }}">
<strong>{{ value.name }}</strong>
</a>
{% else %}
<strong>{{ value.name }}</strong>
{% endif %}
{% else %}
<strong>{{ 'no_linked_media'|trans({}, 'SonataMediaBundle') }}</strong>
{% endif %}
</div>
<div class="col-md-3 pull-left"><strong>{{ 'widget_headline_information'|trans({}, 'SonataMediaBundle') }}</strong></div>
<div class="col-md-2 pull-left"><strong>{{ 'link_media'|trans({}, 'SonataMediaBundle') }}</strong></div>
</div> #}
<div class="row">
<div class="col-md-4 pull-left">
{% if value is not empty and value.providerReference %}
<div class="pull-left" style="margin-right: 5px">
{% thumbnail value, 'small' with {'class': 'img-polaroid media-object'} %}
</div>
{% else %}
<div class="pull-left" style="margin-right: 5px">
{# <img src="{{ asset('bundles/sonatamedia/grey.png') }}" class="img-polaroid media-object" style="width: 85px; height: 85px"/> #}
</div>
{% endif %}
</div>
{# <div class="col-md-3 pull-left">
{% if value is not empty and value.providerReference %}
<strong>{{ 'widget_label_type'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ value.providerName|trans({}, 'SonataMediaBundle') }}</span>
<br />
<strong>{{ 'widget_label_context'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ value.context|trans({}, 'SonataMediaBundle') }}</span>
{% else %}
<strong>{{ 'widget_label_type'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ form.vars['provider']|trans({}, 'SonataMediaBundle') }}</span>
<br />
<strong>{{ 'widget_label_context'|trans({}, 'SonataMediaBundle') }}:</strong> <span type="label">{{ form.vars['context']|trans({}, 'SonataMediaBundle') }}</span>
{% endif %}
</div> #}
<div class="col-md-2 pull-left">
{{ block('form_widget') }}
</div>
</div>
{% endblock sonata_media_type_widget %}
......@@ -585,6 +585,22 @@
<source>Total</source>
<target>Total</target>
</trans-unit>
<trans-unit id="GD4sMRO" resname="Adresse(s)">
<source>Adresse(s)</source>
<target>Adresse(s)</target>
</trans-unit>
<trans-unit id="xhRsuyx" resname="Contact(s)">
<source>Contact(s)</source>
<target>Contact(s)</target>
</trans-unit>
<trans-unit id="VcvpS5y" resname="Rubrique(s)">
<source>Rubrique(s)</source>
<target>Rubrique(s)</target>
</trans-unit>
<trans-unit id="2HIDqBM" resname="CONFIGURATION DU KOHINOS">
<source>CONFIGURATION DU KOHINOS</source>
<target>CONFIGURATION DU KOHINOS</target>
</trans-unit>
</body>
</file>
</xliff>
......@@ -601,6 +601,22 @@
<source>Total</source>
<target>Total</target>
</trans-unit>
<trans-unit id="GD4sMRO" resname="Adresse(s)">
<source>Adresse(s)</source>
<target>Adresse(s)</target>
</trans-unit>
<trans-unit id="xhRsuyx" resname="Contact(s)">
<source>Contact(s)</source>
<target>Contact(s)</target>
</trans-unit>
<trans-unit id="VcvpS5y" resname="Rubrique(s)">
<source>Rubrique(s)</source>
<target>Rubrique(s)</target>
</trans-unit>
<trans-unit id="2HIDqBM" resname="CONFIGURATION DU KOHINOS">
<source>CONFIGURATION DU KOHINOS</source>
<target>CONFIGURATION DU KOHINOS</target>
</trans-unit>
</body>
</file>
</xliff>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment