Commit e5c4d0a6 by Julien Jorry

Debugs + first installation + fixture empty + start import + carte amap marche

parent c23552c0
...@@ -241,6 +241,14 @@ sonata_admin: ...@@ -241,6 +241,14 @@ sonata_admin:
- admin.transfert.gerer - admin.transfert.gerer
- admin.transaction.gerer - admin.transaction.gerer
- admin.reconversion.gerer - admin.reconversion.gerer
sonata.admin.import:
keep_open: false
on_top: true
label: "Import"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-upload"></i>'
items:
- admin.import
sonata.admin.group.menu_builder: sonata.admin.group.menu_builder:
keep_open: false keep_open: false
on_top: true on_top: true
......
...@@ -28,6 +28,9 @@ sonata_media: ...@@ -28,6 +28,9 @@ sonata_media:
document: document:
providers: providers:
- sonata.media.provider.file - sonata.media.provider.file
import:
providers:
- sonata.media.provider.csv
comptoir: comptoir:
providers: providers:
- sonata.media.provider.image - sonata.media.provider.image
...@@ -59,7 +62,6 @@ sonata_media: ...@@ -59,7 +62,6 @@ sonata_media:
small: { width: 100 , quality: 95} small: { width: 100 , quality: 95}
big: { width: 500 , quality: 90} big: { width: 500 , quality: 90}
cdn: cdn:
server: server:
path: /upload/media path: /upload/media
......
...@@ -146,18 +146,6 @@ services: ...@@ -146,18 +146,6 @@ services:
calls: calls:
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
# admin.prestataire.gerer:
# class: App\Admin\PrestataireoldAdmin
# arguments: [~, App\Entity\User, 'App\Controller\CRUD\CRUDController']
# tags:
# - name: sonata.admin
# manager_type: orm
# group: "Prestataire"
# label: "Gérer"
# public: true
# calls:
# - [ setUserManager, ['@fos_user.user_manager']]
admin.prestataire.gerer: admin.prestataire.gerer:
class: App\Admin\PrestataireAdmin class: App\Admin\PrestataireAdmin
arguments: [~, App\Entity\Prestataire, ~] arguments: [~, App\Entity\Prestataire, ~]
...@@ -333,6 +321,29 @@ services: ...@@ -333,6 +321,29 @@ services:
calls: calls:
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
admin.import:
class: App\Admin\ImportAdmin
arguments: [~, ~, App\Controller\ImportController]
tags:
- name: sonata.admin
manager_type: orm
group: "Pages"
label: "Pages"
show_mosaic_button: false
public: true
sonata.media.provider.csv:
class: App\Admin\ImportProvider
tags:
- { name: sonata.media.provider }
arguments:
- 'sonata.media.provider.csv'
- '@sonata.media.filesystem.local'
- '@sonata.media.cdn.server'
- '@sonata.media.generator.default'
- '@sonata.media.thumbnail.format'
- ['csv', 'txt']
- ['text/csv', 'application/vnd.ms-excel', 'text/plain', 'text/x-csv', 'application/csv', 'text/comma-separated-values', 'text/x-comma-separated-values', 'text/tab-separated-values']
# admin.flux.gerer: # admin.flux.gerer:
# class: App\Admin\FluxAdmin # class: App\Admin\FluxAdmin
# arguments: [~, App\Entity\Transaction, ~] # arguments: [~, App\Entity\Transaction, ~]
......
# Configuration des données initiales # Configuration des données initiales
App\Entity\Siege:
siege_1:
name: 'Siege MLC'
content: 'MLC'
compte: '<randomFloat(2, 10000, 20000)>'
App\Entity\TypePrestataire: App\Entity\TypePrestataire:
typepresta1: typepresta1:
name: 'Prestataire' name: 'Prestataire'
...@@ -99,526 +93,6 @@ App\Entity\Usergroup: ...@@ -99,526 +93,6 @@ App\Entity\Usergroup:
usergroup_superadmin: usergroup_superadmin:
__construct: ['Super Admin', ['ROLE_SUPER_ADMIN']] __construct: ['Super Admin', ['ROLE_SUPER_ADMIN']]
App\Entity\Groupe:
groupe{1..10}:
name: '<text(10)>'
content: '<text(200)>'
compte: '<randomFloat(2, 1000, 2000)>'
siege: '@siege_1'
App\Entity\Geoloc:
geoloc{1..70}:
adresse: '<address()>'
# cpostal: <postcode()>
ville: '<city()>'
lat: '<randomFloat(6, 45, 46)>'
lon: '<randomFloat(6, 2, 5)>'
enabled: true
App\Entity\Comptoir:
comptoir{1..50}:
name: '<text(10)>'
enabled: true
tel: '<phoneNumber()>'
email: '<email()>'
compte: '<randomFloat(2, 1000, 2000)>'
groupe: '@groupe<numberBetween(1,10)>'
geoloc (unique): '@geoloc<numberBetween(1,70)>'
App\Entity\Groupeprestataire:
grppresta1:
name: 'AMAP de test'
type: 'amap'
horaires: 'Tous les Jeudis de 12h à 14h'
groupe: '@groupe1'
grppresta2:
name: 'AMAP de test 2'
type: 'amap'
horaires: 'Tous les Mercredis de 12h à 14h'
groupe: '@groupe<numberBetween(1,10)>'
grppresta3:
name: 'Marché de test'
type: 'marche'
horaires: 'Tous les Dimanches de 8h à 12h'
groupe: '@groupe1'
grppresta4:
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)>'
App\Entity\Adherent:
adherent{1..11}:
ecompte: '<randomFloat(2, 1000, 2000)>'
groupe: '@groupe<numberBetween(1, 10)>'
# user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire:
prestataire{1..21}:
compte: '<randomFloat(2, 1000, 2000)>'
description: '<text(150)>'
raison: '<text(10)>'
responsable: '<text(10)>'
metier: '<text(10)>'
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)>'
groupe: '@groupe<numberBetween(1, 10)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
prestataire{22..32}:
compte: '<randomFloat(2, 1000, 2000)>'
description: '<text(150)>'
raison: <text(10)>
responsable: <text(10)>
metier: <text(10)>
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)>'
groupeprestataires: '2x @grppresta<numberBetween(1, 4)>'
groupe: '@groupe<numberBetween(1, 4)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
# App\Entity\Rubrique:
# rubrique{1..20}:
# name: <text(10)>
# content: <text(50)>
# enabled: true
# prestataires: '<numberBetween(1, 8)>x @prestataire<numberBetween(1, 32)>'
App\Entity\Faq:
faq{1..12}:
name: 'FAQ : <text(15)>'
content: <text(80)>
user: '@userredacteur'
App\Entity\News:
news{1..12}:
name: 'News <text(5)>'
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'
debut: '<dateTimeBetween("-1 days", "now")>'
fin: '<dateTimeBetween("+1 years", "+2 years")>'
recu: 'true'
cotisationInfos{2..44}:
annee: '2019'
debut: '<dateTimeBetween("-15 days", "now")>'
fin: '<dateTimeBetween("+1 years", "+2 years")>'
recu: 'true'
App\Entity\CotisationAdherent:
cotisation1:
operateur: '@useradherent'
parenttype: 'cotisation'
type: 'cotisation_adherent'
cotisationInfos: '@cotisationInfos1'
montant: '10'
moyen: 'espece'
expediteur: '@adherent1'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
cotisation{2..11}:
operateur: '@usera<current()>'
parenttype: 'cotisation'
type: 'cotisation_adherent'
cotisationInfos: '@cotisationInfos<current()>'
montant: '10'
moyen: 'cb'
expediteur: '@adherent<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
App\Entity\CotisationPrestataire:
cotisationp{2..32}:
operateur: '@userp<current()>'
parenttype: 'cotisation'
type: 'cotisation_prestataire'
cotisationInfos: '@cotisationInfos<numberBetween(12, 43)>'
montant: '10'
moyen: 'cb'
expediteur: '@prestataire<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
App\Entity\User:
usersuperadmin:
username: 'adminuser'
email: 'julien.jorry@gmail.com'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_superadmin']
roles: ['ROLE_SUPER_ADMIN']
usercontact:
username: 'user_contact'
email: 'contact@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_contact']
roles: ['ROLE_CONTACT']
groupesgere: '@groupe1'
usercomptoir:
username: 'user_comptoir'
email: 'comptoir@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_comptoir']
roles: ['ROLE_COMPTOIR']
comptoirsgere: '@comptoir1'
usergestiongroupe:
username: 'user_gestiongroupe'
email: 'groupe@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_gestiongroupe']
roles: ['ROLE_GESTION_GROUPE']
groupesgere: '@groupe1'
usertresorier:
username: 'user_tresorier'
email: 'tresorier@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_tresorier']
roles: ['ROLE_TRESORIER']
userredacteur:
username: 'user_redacteur'
email: 'redacteur@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_redacteur']
roles: ['ROLE_REDACTEUR']
usercontroleur:
username: 'user_controleur'
email: 'controleur@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_controleur']
roles: ['ROLE_CONTROLEUR']
useradminsiege:
username: 'user_adminsiege'
email: 'siege@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adminsiege']
roles: ['ROLE_ADMIN_SIEGE']
userprestataire:
username: 'user_prestataire'
email: 'prestataire@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire: '@prestataire1'
useradherent:
firstname: 'firstname adherent'
lastname: 'lastname adherent'
phone: '012345789'
username: 'user_adherent'
email: 'adherent@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent: '@adherent1'
usera{2..11}:
username: 'a<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent: '@adherent<current()>'
userp{2..32}:
username: 'p<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire: '@prestataire<current()>'
# TEST DE TRANSACTIONS / TRANSFERTS !
App\Entity\TransactionAdherentPrestataire:
tro_adh_pre{2..11}:
operateur: '@usera<current()>'
type: 'adherent_prestataire'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@adherent<current()>'
destinataire: '@prestataire<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionAdherentAdherent:
tro_adh_adh{2..5}:
operateur: '@usera<current()>'
type: 'adherent_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@adherent<current()>'
destinataire: '@adherent<numberBetween(6, 11)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestataireAdherent:
tro_pre_adh{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@adherent<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestatairePrestataire:
tro_pre_pre{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_prestataire'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@prestataire<numberBetween(11, 21)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransfertComptoirAdherent:
tre_cpt_adh{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@adherent<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertComptoirGroupe:
tre_cpt_grp{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_groupe'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@groupe<numberBetween(1,10)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertComptoirPrestataire:
tre_cpt_pre{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_prestataire'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@prestataire<numberBetween(1,32)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertGroupeComptoir:
tre_grp_cpt{1..10}:
operateur: '@usergestiongroupe'
type: 'groupe_comptoir'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@groupe<numberBetween(1,10)>'
destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertPrestataireComptoir:
tre_pre_cpt{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_comptoir'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertPrestataireSiege:
tre_pre_sie{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_siege'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertSiegeGroupe:
tre_sie_grp{1..10}:
operateur: '@useradminsiege'
type: 'siege_groupe'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@siege_1'
destinataire: '@groupe<numberBetween(1,10)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
Prodigious\Sonata\MenuBundle\Entity\Menu: Prodigious\Sonata\MenuBundle\Entity\Menu:
menu_main: menu_main:
name: 'Main menu' name: 'Main menu'
......
App\Entity\Siege:
siege_1:
name: 'Siege MLC'
content: 'MLC'
compte: '<randomFloat(2, 10000, 20000)>'
App\Entity\Groupe:
groupe{1..10}:
name: '<text(10)>'
content: '<text(200)>'
compte: '<randomFloat(2, 1000, 2000)>'
siege: '@siege_1'
App\Entity\Geoloc:
geoloc{1..70}:
adresse: '<address()>'
# cpostal: <postcode()>
ville: '<city()>'
lat: '<randomFloat(6, 45, 46)>'
lon: '<randomFloat(6, 2, 5)>'
enabled: true
App\Entity\Comptoir:
comptoir{1..50}:
name: '<text(10)>'
enabled: true
tel: '<phoneNumber()>'
email: '<email()>'
compte: '<randomFloat(2, 1000, 2000)>'
groupe: '@groupe<numberBetween(1,10)>'
geoloc (unique): '@geoloc<numberBetween(1,70)>'
App\Entity\Groupeprestataire:
grppresta1:
name: 'AMAP de test'
type: 'amap'
horaires: 'Tous les Jeudis de 12h à 14h'
groupe: '@groupe1'
grppresta2:
name: 'AMAP de test 2'
type: 'amap'
horaires: 'Tous les Mercredis de 12h à 14h'
groupe: '@groupe<numberBetween(1,10)>'
grppresta3:
name: 'Marché de test'
type: 'marche'
horaires: 'Tous les Dimanches de 8h à 12h'
groupe: '@groupe1'
grppresta4:
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)>'
App\Entity\Adherent:
adherent{1..11}:
ecompte: '<randomFloat(2, 1000, 2000)>'
groupe: '@groupe<numberBetween(1, 10)>'
# user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire:
prestataire{1..21}:
compte: '<randomFloat(2, 1000, 2000)>'
description: '<text(150)>'
raison: '<text(10)>'
responsable: '<text(10)>'
metier: '<text(10)>'
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)>'
groupe: '@groupe<numberBetween(1, 10)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
prestataire{22..32}:
compte: '<randomFloat(2, 1000, 2000)>'
description: '<text(150)>'
raison: <text(10)>
responsable: <text(10)>
metier: <text(10)>
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)>'
groupeprestataires: '2x @grppresta<numberBetween(1, 4)>'
groupe: '@groupe<numberBetween(1, 4)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
# App\Entity\Rubrique:
# rubrique{1..20}:
# name: <text(10)>
# content: <text(50)>
# enabled: true
# prestataires: '<numberBetween(1, 8)>x @prestataire<numberBetween(1, 32)>'
App\Entity\Faq:
faq{1..12}:
name: 'FAQ : <text(15)>'
content: <text(80)>
user: '@userredacteur'
App\Entity\News:
news{1..12}:
name: 'News <text(5)>'
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'
debut: '<dateTimeBetween("-1 days", "now")>'
fin: '<dateTimeBetween("+1 years", "+2 years")>'
recu: 'true'
cotisationInfos{2..44}:
annee: '2019'
debut: '<dateTimeBetween("-15 days", "now")>'
fin: '<dateTimeBetween("+1 years", "+2 years")>'
recu: 'true'
App\Entity\CotisationAdherent:
cotisation1:
operateur: '@useradherent'
parenttype: 'cotisation'
type: 'cotisation_adherent'
cotisationInfos: '@cotisationInfos1'
montant: '10'
moyen: 'espece'
expediteur: '@adherent1'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
cotisation{2..11}:
operateur: '@usera<current()>'
parenttype: 'cotisation'
type: 'cotisation_adherent'
cotisationInfos: '@cotisationInfos<current()>'
montant: '10'
moyen: 'cb'
expediteur: '@adherent<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
App\Entity\CotisationPrestataire:
cotisationp{2..32}:
operateur: '@userp<current()>'
parenttype: 'cotisation'
type: 'cotisation_prestataire'
cotisationInfos: '@cotisationInfos<numberBetween(12, 43)>'
montant: '10'
moyen: 'cb'
expediteur: '@prestataire<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
App\Entity\User:
usersuperadmin:
username: 'adminuser'
email: 'julien.jorry@gmail.com'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_superadmin']
roles: ['ROLE_SUPER_ADMIN']
usercontact:
username: 'user_contact'
email: 'contact@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_contact']
roles: ['ROLE_CONTACT']
groupesgere: '@groupe1'
usercomptoir:
username: 'user_comptoir'
email: 'comptoir@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_comptoir']
roles: ['ROLE_COMPTOIR']
comptoirsgere: '@comptoir1'
usergestiongroupe:
username: 'user_gestiongroupe'
email: 'groupe@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_gestiongroupe']
roles: ['ROLE_GESTION_GROUPE']
groupesgere: '@groupe1'
usertresorier:
username: 'user_tresorier'
email: 'tresorier@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_tresorier']
roles: ['ROLE_TRESORIER']
userredacteur:
username: 'user_redacteur'
email: 'redacteur@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_redacteur']
roles: ['ROLE_REDACTEUR']
usercontroleur:
username: 'user_controleur'
email: 'controleur@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_controleur']
roles: ['ROLE_CONTROLEUR']
useradminsiege:
username: 'user_adminsiege'
email: 'siege@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adminsiege']
roles: ['ROLE_ADMIN_SIEGE']
userprestataire:
username: 'user_prestataire'
email: 'prestataire@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire: '@prestataire1'
useradherent:
firstname: 'firstname adherent'
lastname: 'lastname adherent'
phone: '012345789'
username: 'user_adherent'
email: 'adherent@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent: '@adherent1'
usera{2..11}:
username: 'a<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_adherent']
roles: ['ROLE_ADHERENT']
adherent: '@adherent<current()>'
userp{2..32}:
username: 'p<userName()>'
email: <email()>
plainPassword: 'test'
enabled: true
groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE']
prestataire: '@prestataire<current()>'
# TEST DE TRANSACTIONS / TRANSFERTS !
App\Entity\TransactionAdherentPrestataire:
tro_adh_pre{2..11}:
operateur: '@usera<current()>'
type: 'adherent_prestataire'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@adherent<current()>'
destinataire: '@prestataire<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionAdherentAdherent:
tro_adh_adh{2..5}:
operateur: '@usera<current()>'
type: 'adherent_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@adherent<current()>'
destinataire: '@adherent<numberBetween(6, 11)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestataireAdherent:
tro_pre_adh{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@adherent<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestatairePrestataire:
tro_pre_pre{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_prestataire'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@prestataire<numberBetween(11, 21)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransfertComptoirAdherent:
tre_cpt_adh{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@adherent<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertComptoirGroupe:
tre_cpt_grp{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_groupe'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@groupe<numberBetween(1,10)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertComptoirPrestataire:
tre_cpt_pre{2..11}:
operateur: '@usercomptoir'
type: 'comptoir_prestataire'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@comptoir<numberBetween(1,50)>'
destinataire: '@prestataire<numberBetween(1,32)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertGroupeComptoir:
tre_grp_cpt{1..10}:
operateur: '@usergestiongroupe'
type: 'groupe_comptoir'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@groupe<numberBetween(1,10)>'
destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertPrestataireComptoir:
tre_pre_cpt{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_comptoir'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertPrestataireSiege:
tre_pre_sie{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_siege'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertSiegeGroupe:
tre_sie_grp{1..10}:
operateur: '@useradminsiege'
type: 'siege_groupe'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2,1,2)>'
expediteur: '@siege_1'
destinataire: '@groupe<numberBetween(1,10)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
...@@ -30,6 +30,12 @@ use Symfony\Component\Form\FormEvents; ...@@ -30,6 +30,12 @@ use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des adhérents
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class AdherentAdmin extends AbstractAdmin class AdherentAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'adherent'; protected $baseRouteName = 'adherent';
......
<?php
namespace App\Admin;
use App\Entity\Adherent;
use App\Entity\Geoloc;
use App\Entity\Usergroup;
use Knp\Menu\ItemInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class AdherentAdminold extends UserAdmin
{
protected $baseRouteName = 'adherento';
protected $baseRoutePattern = 'adherento';
protected $datagridValues = [
// reverse order (default = 'ASC')
'_sort_order' => 'DESC',
// name of the ordered field (default = the model's id field, if any)
'_sort_by' => 'ecompte',
// '_page' => 1,
// '_per_page' => 32
];
public function configure()
{
parent::configure();
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper): void
{
parent::configureFormFields($formMapper);
// Initialize adherent
$user = $this->getSubject();
$groupe = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Usergroup::class)->findOneByName('Adherent');
$user->setEnabled(true);
$user->addGroup($groupe);
$user->addRole('ROLE_ADHERENT');
$adherent = new Adherent();
$user->setAdherent($adherent);
}
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
parent::configureDatagridFilters($datagridMapper);
}
protected function configureListFields(ListMapper $listMapper): void
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('username')
->addIdentifier('email')
->addIdentifier('adherent.ecompte', null, array('label' => 'Ecompte'))
->add('groups')
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
// ->addIdentifier('createdAt')
;
if ($this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
$listMapper
->addIdentifier('impersonating', 'string', ['template' => '@SonataUser/Admin/Field/impersonating.html.twig'])
;
}
}
protected function configureRoutes(RouteCollection $collection)
{
// $collection->remove('delete');
}
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$role = 'ROLE_ADHERENT';
// $query->andWhere($query->getRootAliases()[0] . '.adherent IS NOT NULL');
$query->leftJoin($query->getRootAliases()[0] . '.groups', 'g')
->where($query->expr()->orX(
$query->expr()->like($query->getRootAliases()[0] . '.roles', ':roles'),
$query->expr()->like('g.roles', ':roles')
))
->setParameter('roles', '%"'.$role.'"%');
return $query;
}
}
...@@ -13,6 +13,12 @@ use Sonata\AdminBundle\Show\ShowMapper; ...@@ -13,6 +13,12 @@ use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des comptoirs
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class ComptoirAdmin extends AbstractAdmin class ComptoirAdmin extends AbstractAdmin
{ {
protected $security; protected $security;
......
...@@ -12,6 +12,12 @@ use Sonata\AdminBundle\Show\ShowMapper; ...@@ -12,6 +12,12 @@ use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
/**
* Administration des cotisations des adhérents
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class CotisationAdherentAdmin extends CotisationAdmin class CotisationAdherentAdmin extends CotisationAdmin
{ {
protected $baseRouteName = 'cotisation_adherent'; protected $baseRouteName = 'cotisation_adherent';
......
...@@ -20,6 +20,12 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; ...@@ -20,6 +20,12 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType; use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des cotisations
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class CotisationAdmin extends AbstractAdmin class CotisationAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'cotisation'; protected $baseRouteName = 'cotisation';
......
...@@ -13,6 +13,12 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; ...@@ -13,6 +13,12 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
/**
* Administration des cotisations des prestataires
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class CotisationPrestataireAdmin extends CotisationAdmin class CotisationPrestataireAdmin extends CotisationAdmin
{ {
protected $baseRouteName = 'cotisation_prestataire'; protected $baseRouteName = 'cotisation_prestataire';
......
...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType; ...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
/**
* Administration des documents
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class DocumentAdmin extends AbstractAdmin class DocumentAdmin extends AbstractAdmin
{ {
/** /**
......
...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType; ...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
/**
* Administration des FAQ
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class FaqAdmin extends AbstractAdmin class FaqAdmin extends AbstractAdmin
{ {
......
...@@ -14,6 +14,12 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; ...@@ -14,6 +14,12 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
/**
* Administration des Flux
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class FluxAdmin extends AbstractAdmin class FluxAdmin extends AbstractAdmin
{ {
protected $translator; protected $translator;
......
...@@ -18,6 +18,12 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType; ...@@ -18,6 +18,12 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
/**
* Administration des groupes locaux
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class GroupeAdmin extends AbstractAdmin class GroupeAdmin extends AbstractAdmin
{ {
protected $datagridValues = [ protected $datagridValues = [
......
...@@ -19,6 +19,12 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType; ...@@ -19,6 +19,12 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des groupe de prestataires (amap, marche)
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class GroupeprestataireAdmin extends AbstractAdmin class GroupeprestataireAdmin extends AbstractAdmin
{ {
protected $security; protected $security;
......
<?php
namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface;
/**
* Import de données
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class ImportAdmin extends AbstractAdmin
{
protected $baseRoutePattern = 'importdata';
protected $baseRouteName = 'importdata';
/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
$collection->clearExcept('list');
}
protected function configureListFields(ListMapper $listMapper): void
{
parent::configureListFields($listMapper);
unset($this->listModes['mosaic']);
}
public function getBatchActions()
{
$actions = parent::getBatchActions();
unset($actions['delete']);
return $actions;
}
}
<?php
namespace App\Admin;
use Sonata\MediaBundle\Model\MediaInterface;
use Sonata\MediaBundle\Provider\FileProvider;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\HttpFoundation\File\File;
/**
* Import provider
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class ImportProvider extends FileProvider
{
/**
* @param MediaInterface $media
*/
protected function doTransform(MediaInterface $media)
{
// ...
}
/**
* {@inheritdoc}
*/
public function generatePublicUrl(MediaInterface $media, $format)
{
// new logic
}
/**
* {@inheritdoc}
*/
public function postPersist(MediaInterface $media)
{
}
/**
* {@inheritdoc}
*/
public function postUpdate(MediaInterface $media)
{
}
}
\ No newline at end of file
...@@ -5,6 +5,12 @@ use Sonata\AdminBundle\Object\Metadata; ...@@ -5,6 +5,12 @@ use Sonata\AdminBundle\Object\Metadata;
use Sonata\MediaBundle\Admin\ORM\MediaAdmin as BaseMediaAdmin; use Sonata\MediaBundle\Admin\ORM\MediaAdmin as BaseMediaAdmin;
use Sonata\MediaBundle\Provider\MediaProviderInterface; use Sonata\MediaBundle\Provider\MediaProviderInterface;
/**
* Administration des medias (image, document...)
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class MediaAdmin extends BaseMediaAdmin class MediaAdmin extends BaseMediaAdmin
{ {
/** /**
......
...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType; ...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
/**
* Administration des news
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class NewsAdmin extends AbstractAdmin class NewsAdmin extends AbstractAdmin
{ {
protected $translator; protected $translator;
......
...@@ -17,6 +17,12 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -17,6 +17,12 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des pages
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class PageAdmin extends AbstractAdmin class PageAdmin extends AbstractAdmin
{ {
protected $security; protected $security;
......
...@@ -35,6 +35,12 @@ use Symfony\Component\Form\FormEvents; ...@@ -35,6 +35,12 @@ use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des prestataires
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class PrestataireAdmin extends AbstractAdmin class PrestataireAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'prestataire'; protected $baseRouteName = 'prestataire';
...@@ -231,11 +237,11 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -231,11 +237,11 @@ class PrestataireAdmin extends AbstractAdmin
)) ))
->add('siret', TextType::class, array( ->add('siret', TextType::class, array(
'label' => 'SIRET :', 'label' => 'SIRET :',
'required' => false 'required' => true
)) ))
->add('iban', TextType::class, array( ->add('iban', TextType::class, array(
'label' => 'IBAN :', 'label' => 'IBAN :',
'required' => false 'required' => true
)) ))
->add('responsable', TextType::class, array( ->add('responsable', TextType::class, array(
'label' => 'Responsable :', 'label' => 'Responsable :',
...@@ -259,7 +265,10 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -259,7 +265,10 @@ class PrestataireAdmin extends AbstractAdmin
$formMapper $formMapper
->with('Cotisation', ['class' => 'col-md-5']) ->with('Cotisation', ['class' => 'col-md-5'])
->add('user.cotisations.last.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y'))) ->add('user.cotisations.last.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
->add('user.cotisations.last.montant', TextType::class, array('label' => 'Montant')) ->add('user.cotisations.last.montant', TextType::class, array(
'label' => 'Montant',
'data' => $this->getConfigurationPool()->getContainer()->getParameter('cotisation_montant')
))
->add('user.cotisations.last.moyen', ChoiceType::class, array( ->add('user.cotisations.last.moyen', ChoiceType::class, array(
'required' => true, 'required' => true,
'label' => 'Moyen :', 'label' => 'Moyen :',
...@@ -268,7 +277,10 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -268,7 +277,10 @@ class PrestataireAdmin extends AbstractAdmin
return MoyenEnum::getTypeName($choice); return MoyenEnum::getTypeName($choice);
}, },
)) ))
->add('user.cotisations.last.cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu')) ->add('user.cotisations.last.cotisationInfos.recu', CheckboxType::class, array(
'label' => 'Reçu',
'required' => false
))
->end(); ->end();
if (!$this->isCurrentRoute('create')) { if (!$this->isCurrentRoute('create')) {
$formMapper $formMapper
...@@ -368,7 +380,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -368,7 +380,7 @@ class PrestataireAdmin extends AbstractAdmin
$bytes = random_bytes(64); $bytes = random_bytes(64);
$password = rtrim(strtr(base64_encode($bytes), '+/', '-_'), '='); $password = rtrim(strtr(base64_encode($bytes), '+/', '-_'), '=');
$prestataire->getUser()->setPassword($password); $prestataire->getUser()->setPassword($password);
// send email to user // TODO : send email to user
} }
$this->userManager->updateUser($prestataire->getUser()); $this->userManager->updateUser($prestataire->getUser());
$prestataire->getUser()->createEmailToken(); $prestataire->getUser()->createEmailToken();
......
<?php
namespace App\Admin;
use App\Admin\UserAdmin;
use App\Entity\Geoloc;
use App\Entity\Prestataire;
use App\Entity\Usergroup;
use FOS\UserBundle\Model\UserManagerInterface;
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\TextType;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class PrestataireoldAdmin extends UserAdmin
{
protected $baseRouteName = 'prestataireo';
protected $baseRoutePattern = 'prestataireo';
public function configure()
{
parent::configure();
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper): void
{
// Initialize prestataire
$user = $this->getSubject();
$groupe = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Usergroup::class)->findOneByName('Prestataire');
$user->setEnabled(true);
$user->addGroup($groupe);
$user->addRole('ROLE_PRESTATAIRE');
$presta = new Prestataire();
$presta->setGeoloc(new Geoloc());
$user->setPrestataire($presta);
// get the current Image instance
$imageHelp = null;
if (!empty($user->getPrestataire()) && !empty($user->getPrestataire()->getMedia())) {
$image = $user->getPrestataire()->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" />';
}
}
$formMapper
->tab('Prestataire')
->with('General', ['class' => 'col-md-7'])
->add('prestataire.raison', TextType::class, array(
'label' => 'Raison :',
'required' => true
))
->add('prestataire.statut', TextType::class, array(
'label' => 'Statut :',
'required' => false
))
->add('prestataire.siret', TextType::class, array(
'label' => 'SIRET :',
'required' => true
))
->add('prestataire.iban', TextType::class, array(
'label' => 'IBAN :',
'required' => true
))
->end()
->with('Responsable', ['class' => 'col-md-5'])
->add('prestataire.metier', TextType::class, array(
'label' => 'Métier :',
'required' => true
))
->add('prestataire.responsable', TextType::class, array(
'label' => 'Responsable :',
'required' => false
))
->end()
->with('Addresse', ['class' => 'col-md-7'])
->add('prestataire.geoloc.adresse', TextType::class, array(
'label' => 'Addresse :',
'required' => false
))
->add('prestataire.geoloc.cpostal', TextType::class, array(
'label' => 'Code postal :',
'required' => false
))
->add('prestataire.geoloc.ville', TextType::class, array(
'label' => 'Ville :',
'required' => false
))
->add('prestataire.geoloc.lat', TextType::class, array(
'label' => 'Latitude :',
'required' => false
))
->add('prestataire.geoloc.lon', TextType::class, array(
'label' => 'Longitude :',
'required' => false
))
->end()
->with('Image', ['class' => 'col-md-5'])
->add('prestataire.media', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'prestataire',
'help' => $imageHelp
))
->end()
->end()
;
parent::configureFormFields($formMapper);
}
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
parent::configureDatagridFilters($datagridMapper);
$datagridMapper
->add('prestataire.raison')
->add('prestataire.statut')
;
}
/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager): void
{
$this->userManager = $userManager;
}
/**
* @return UserManagerInterface
*/
public function getUserManager()
{
return $this->userManager;
}
protected function configureListFields(ListMapper $listMapper): void
{
unset($this->listModes['mosaic']);
$listMapper
->addIdentifier('username')
->addIdentifier('email')
->addIdentifier('prestataire.raison')
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
->addIdentifier('createdAt')
;
if ($this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
$listMapper
->addIdentifier('impersonating', 'string', ['template' => '@SonataUser/Admin/Field/impersonating.html.twig'])
;
}
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
}
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0] . '.prestataire IS NOT NULL');
return $query;
}
}
...@@ -15,6 +15,12 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; ...@@ -15,6 +15,12 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
/**
* Administration des reconversions (transfert d'un prestataire au siège)
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class ReconversionAdmin extends FluxAdmin class ReconversionAdmin extends FluxAdmin
{ {
protected $security; protected $security;
......
...@@ -18,6 +18,12 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; ...@@ -18,6 +18,12 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
/**
* Administration des rubriques
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class RubriqueAdmin extends AbstractAdmin class RubriqueAdmin extends AbstractAdmin
{ {
protected $security; protected $security;
......
...@@ -5,7 +5,10 @@ use Sonata\AdminBundle\Admin\AbstractAdmin; ...@@ -5,7 +5,10 @@ use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
/** /**
* TRADUCTION ADMIN * Administration des traductions
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/ */
class TraductionAdmin extends AbstractAdmin class TraductionAdmin extends AbstractAdmin
{ {
......
...@@ -5,6 +5,12 @@ namespace App\Admin; ...@@ -5,6 +5,12 @@ namespace App\Admin;
use App\Admin\FluxAdmin; use App\Admin\FluxAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
/**
* Administration des transactions
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class TransactionAdmin extends FluxAdmin class TransactionAdmin extends FluxAdmin
{ {
protected $translator; protected $translator;
......
...@@ -15,6 +15,12 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; ...@@ -15,6 +15,12 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
/**
* Administration des transferts
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class TransfertAdmin extends FluxAdmin class TransfertAdmin extends FluxAdmin
{ {
protected $security; protected $security;
......
...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -13,6 +13,12 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
/**
* Administration des utilisateurs
*
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class UserAdmin extends SonataUserAdmin class UserAdmin extends SonataUserAdmin
{ {
protected $baseRouteName = 'user'; protected $baseRouteName = 'user';
......
...@@ -4,13 +4,13 @@ namespace App\Controller; ...@@ -4,13 +4,13 @@ namespace App\Controller;
use App\Entity\TransfertPrestataireSiege; use App\Entity\TransfertPrestataireSiege;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/// @ Route ("/admina", name="admina_")
class AdminController extends Controller class AdminController extends Controller
{ {
private $em; private $em;
...@@ -21,7 +21,8 @@ class AdminController extends Controller ...@@ -21,7 +21,8 @@ class AdminController extends Controller
} }
/** /**
* @Route("/setenable/{type}/{id}", name="setenable") * @Route("/admin/setenable/{type}/{id}", name="setenable")
* @IsGranted("ROLE_ADMIN")
*/ */
public function setEnableAction($type, $id, Request $request) public function setEnableAction($type, $id, Request $request)
{ {
...@@ -48,7 +49,7 @@ class AdminController extends Controller ...@@ -48,7 +49,7 @@ class AdminController extends Controller
} }
/** /**
* @Route("/setreconverti/{id}", name="setreconverti") * @Route("/admin/setreconverti/{id}", name="setreconverti")
*/ */
public function setReconvertiAction($id, Request $request) public function setReconvertiAction($id, Request $request)
{ {
...@@ -73,16 +74,4 @@ class AdminController extends Controller ...@@ -73,16 +74,4 @@ class AdminController extends Controller
} }
return new JsonResponse(array('status' => $status, 'newvalue' => ($object->getReconverti()?'true':'false'))); return new JsonResponse(array('status' => $status, 'newvalue' => ($object->getReconverti()?'true':'false')));
} }
// /**
// * Voir tous les dashboards
// * Route admin_index
// * @Route("/a", name="settings")
// */
// public function settings()
// {
// return $this->render('admin/settings.html.twig', [
// 'controller_name' => 'AdminController',
// ]);
// }
} }
...@@ -9,6 +9,11 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; ...@@ -9,6 +9,11 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
/**
* LOCO : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class GroupePrestaController extends AbstractController class GroupePrestaController extends AbstractController
{ {
private $em; private $em;
...@@ -19,17 +24,25 @@ class GroupePrestaController extends AbstractController ...@@ -19,17 +24,25 @@ class GroupePrestaController extends AbstractController
} }
/** /**
* @Route("/prestataires/groupe/{type}/{slug}", name="show_groupeprestataire")
*/
public function showGroupeAction(Groupeprestataire $groupe)
{
return $this->render('groupepresta/show.html.twig', array(
'groupe' => $groupe
));
}
/**
* @Route("/groupe/prestataires/{type}/liste", name="groupepresta_liste") * @Route("/groupe/prestataires/{type}/liste", name="groupepresta_liste")
*/ */
public function listeGroupePrestaAction($type, Request $request) public function listeGroupePrestaAction($type, Request $request)
{ {
$groupe = $this->em->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true)); $groupe = $this->em->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true));
if (empty($groupes)) {
return $this->redirectToRoute('index');
}
return $this->render('groupepresta/liste.html.twig', array( return $this->render('groupepresta/liste.html.twig', array(
'groupes' => $groupes 'groupes' => $groupes,
'groupetype' => $type
)); ));
} }
...@@ -39,12 +52,10 @@ class GroupePrestaController extends AbstractController ...@@ -39,12 +52,10 @@ class GroupePrestaController extends AbstractController
public function carteGroupePrestaAction($type, Request $request) public function carteGroupePrestaAction($type, Request $request)
{ {
$groupes = $this->em->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true)); $groupes = $this->em->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true));
if (empty($groupes)) {
return $this->redirectToRoute('index');
}
return $this->render('groupepresta/carte.html.twig', array( return $this->render('groupepresta/carte.html.twig', array(
'groupes' => $groupes 'groupes' => $groupes,
'groupetype' => $type
)); ));
} }
} }
<?php
namespace App\Controller;
use App\Entity\Import;
use App\Form\Type\ImportFormType;
use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Util\UserManipulator;
use Sonata\AdminBundle\Controller\CRUDController;
use Symfony\Component\HttpFoundation\Response;
class ImportController extends CRUDController
{
public function listAction()
{
$import = new Import();
$import->setUser($this->getUser());
$form = $this->createForm(ImportFormType::class, $import);
$form->handleRequest($this->getRequest());
if ($form->isSubmitted() && $form->isValid()) {
$import = $form->getData();
$media = $import->getMedia();
$provider = $this->getProvider($media);
$this->em->persist($import);
$this->em->flush();
// TODO : finir import data from file
$data = $this->parseCSV($provider->generatePath($media), $media->getProviderReference());
$batchSize = 20;
$cptLigne = 1;
$errors = [];
// Processing on each row of data
foreach ($data as $row) {
// @TODO
}
if (empty($errors)) {
$import->setEnabled(true);
$this->em->persist($import);
$this->em->flush();
$this->addFlash(
'success',
'Import effectué avec succès !'
);
$referer = $this->getRequest()->headers->get('referer');
if ($referer && !$this->getRequest()->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$this->getRequest()->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
} else {
$this->addFlash(
'error',
'Import effectué avec succès !'
);
}
}
return $this->renderWithExtraParams('admin/import.html.twig', array(
'action' => 'list',
'form' => $form->createView()
));
}
private function parseCSV($filePath, $fileName, $ignoreFirstLine = false)
{
$finder = new Finder();
$finder->files()
->in($filePath)
->name($fileName)
;
foreach ($finder as $file) { $csv = $file; }
$rows = array();
if (($handle = fopen($csv->getRealPath(), "r")) !== FALSE) {
$i = 0;
while (($data = fgetcsv($handle, null, ";")) !== FALSE) {
$i++;
if ($ignoreFirstLine && $i == 1) { continue; }
$rows[] = $data;
}
fclose($handle);
}
return $rows;
}
}
...@@ -7,11 +7,13 @@ use App\Entity\Cotisation; ...@@ -7,11 +7,13 @@ use App\Entity\Cotisation;
use App\Entity\Faq; use App\Entity\Faq;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\Page; use App\Entity\Page;
use App\Entity\Siege;
use App\Entity\User; use App\Entity\User;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Form\Type\AdhererFormType; use App\Form\Type\AdhererFormType;
use App\Form\Type\ContactFormType; use App\Form\Type\ContactFormType;
use App\Form\Type\InstallFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentPrestataireFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Event\FilterUserResponseEvent; use FOS\UserBundle\Event\FilterUserResponseEvent;
...@@ -35,6 +37,7 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; ...@@ -35,6 +37,7 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security as Secur; use Symfony\Component\Security\Core\Security as Secur;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
...@@ -42,13 +45,15 @@ class IndexController extends AbstractController ...@@ -42,13 +45,15 @@ class IndexController extends AbstractController
private $em; private $em;
private $userManager; private $userManager;
private $tokenManager; private $tokenManager;
private $guard;
public function __construct(EventDispatcherInterface $eventDispatcher, EntityManagerInterface $em, UserManagerInterface $userManager, CsrfTokenManagerInterface $tokenManager = null) public function __construct(EventDispatcherInterface $eventDispatcher, EntityManagerInterface $em, UserManagerInterface $userManager, CsrfTokenManagerInterface $tokenManager = null, GuardAuthenticatorHandler $guard)
{ {
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
$this->em = $em; $this->em = $em;
$this->userManager = $userManager; $this->userManager = $userManager;
$this->tokenManager = $tokenManager; $this->tokenManager = $tokenManager;
$this->guard = $guard;
} }
/** /**
...@@ -66,6 +71,11 @@ class IndexController extends AbstractController ...@@ -66,6 +71,11 @@ class IndexController extends AbstractController
// array('%name%' => $user->getName()) // array('%name%' => $user->getName())
// ); // );
/* Pour la première installation */
$siege = $this->em->getRepository(Siege::class)->findAll();
if ($siege == null || empty($siege)) {
return $this->redirectToRoute('installation');
}
/* Pour la modale de login => SecurityController loginAction */ /* Pour la modale de login => SecurityController loginAction */
/** @var $session Session */ /** @var $session Session */
$session = $request->getSession(); $session = $request->getSession();
...@@ -84,6 +94,53 @@ class IndexController extends AbstractController ...@@ -84,6 +94,53 @@ class IndexController extends AbstractController
} }
/** /**
* @Route("/installation", name="installation")
*/
public function installationAction(Request $request)
{
$siege = $this->em->getRepository(Siege::class)->findOneById(1);
if (!empty($siege)) {
return $this->redirectToRoute('index');
}
$user = $this->userManager->createUser();
$repogroup = $this->em->getRepository(Usergroup::class);
$group = $repogroup->findOneBy(array('name' => 'Super Admin'));
$user->setEnabled(true);
$user->addGroup($group);
$user->addRole('ROLE_SUPER_ADMIN');
$form = $this->createForm(InstallFormType::class, ['user' => $user]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$siege = $form['siege']->getData();
$user = $form['user']->getData();
$this->userManager->updateUser($user);
$this->em->persist($siege);
$this->em->persist($user);
// TODO : send mail
$this->addFlash(
'success',
'BRAVO ! Vous avez créer le siège et le premier utilisateur'
);
// if (null === $response = $event->getResponse()) {
$url = $this->generateUrl('fos_user_registration_confirmed');
$response = new RedirectResponse($url);
// }
$this->eventDispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($user, $request, $response));
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->render('installation.html.twig', array(
'form' => $form->createView()
));
}
/**
* @Route("/adherer", name="adherer") * @Route("/adherer", name="adherer")
*/ */
public function adhererAction(Request $request) public function adhererAction(Request $request)
......
...@@ -27,6 +27,7 @@ class Groupeprestataire ...@@ -27,6 +27,7 @@ class Groupeprestataire
use NameSlugContentEntityTrait, use NameSlugContentEntityTrait,
TimestampableEntity, TimestampableEntity,
GeolocEntityTrait, GeolocEntityTrait,
ContactEmailTelTrait,
EnablableEntityTrait; EnablableEntityTrait;
/** /**
......
<?php
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="import")
*/
class Import
{
use EnablableEntityTrait,
TimestampableEntity;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="User", inversedBy="documents", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
private $user;
public function __construct()
{
$this->setEnabled(false);
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return null|User
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* @param null|User $user
* @return $this
*/
public function setUser(?User $user)
{
$this->user = $user;
return $this;
}
/**
* Get media
* @return
*/
public function getMedia()
{
return $this->media;
}
/**
* Set media
* @return $this
*/
public function setMedia($media)
{
$this->media = $media;
return $this;
}
public function __toString(): string
{
return 'Import du '.$this->getCreatedAt()?$this->getCreatedAt()->format('d/m/Y H:i'):'?';
}
}
\ No newline at end of file
...@@ -59,7 +59,7 @@ class Prestataire ...@@ -59,7 +59,7 @@ class Prestataire
/** /**
* @var string * @var string
* *
* @ORM\Column(name="metier", type="string", length=100) * @ORM\Column(name="metier", type="string", length=100, nullable=true)
*/ */
private $metier; private $metier;
...@@ -106,14 +106,6 @@ class Prestataire ...@@ -106,14 +106,6 @@ class Prestataire
private $accept = false; private $accept = false;
/** /**
* @var bool
*
* @ORM\Column(name="partenaire", type="boolean", nullable=false)
*/
private $partenaire = false;
/**
* @var null|string (champ libre) * @var null|string (champ libre)
* *
* @ORM\Column(name="horaires", type="string", length=255, nullable=true) * @ORM\Column(name="horaires", type="string", length=255, nullable=true)
...@@ -345,24 +337,6 @@ class Prestataire ...@@ -345,24 +337,6 @@ class Prestataire
} }
/** /**
* @return bool
*/
public function isPartenaire(): bool
{
return $this->partenaire;
}
/**
* @param bool $partenaire
* @return Prestataire
*/
public function setPartenaire(bool $partenaire)
{
$this->partenaire = $partenaire;
return $this;
}
/**
* @return User * @return User
*/ */
public function getUser(): ?User public function getUser(): ?User
......
...@@ -175,9 +175,6 @@ class FormFactory ...@@ -175,9 +175,6 @@ class FormFactory
throw new \Exception("[FORM 10] Opération impossible !"); throw new \Exception("[FORM 10] Opération impossible !");
} }
$entity = new TransfertPrestataireSiege(); $entity = new TransfertPrestataireSiege();
// $entity->setReconverti(false);
// $entity->setMoyen(MoyenEnum::MOYEN_MLC); //TODO : MOYEN_MLC correct ?
// $entity->setOperateur($user);
$entity->setExpediteur($user->getPrestataire()); $entity->setExpediteur($user->getPrestataire());
$form = $this->ff->create(TransfertPrestataireSiegeFormType::class, $entity, array('action' => $this->router->generate('transactionPrestataireSiege'))); $form = $this->ff->create(TransfertPrestataireSiegeFormType::class, $entity, array('action' => $this->router->generate('transactionPrestataireSiege')));
...@@ -190,9 +187,6 @@ class FormFactory ...@@ -190,9 +187,6 @@ class FormFactory
throw new \Exception("[FORM 11] Opération impossible !"); throw new \Exception("[FORM 11] Opération impossible !");
} }
$entity = new TransfertPrestataireComptoir(); $entity = new TransfertPrestataireComptoir();
// $entity->setReconverti(false);
// $entity->setMoyen(MoyenEnum::MOYEN_MLC); //TODO : MOYEN_MLC correct ?
// $entity->setOperateur($user);
$entity->setDestinataire($user->getComptoirsgere()); $entity->setDestinataire($user->getComptoirsgere());
$form = $this->ff->create(TransfertPrestataireComptoirFormType::class, $entity, array('action' => $this->router->generate('transfertPrestataireComptoir'))); $form = $this->ff->create(TransfertPrestataireComptoirFormType::class, $entity, array('action' => $this->router->generate('transfertPrestataireComptoir')));
......
...@@ -25,6 +25,7 @@ class CotisationFormType extends FluxFormType ...@@ -25,6 +25,7 @@ class CotisationFormType extends FluxFormType
)) ))
->add('montant', MoneyType::class, array( ->add('montant', MoneyType::class, array(
'label' => 'Montant', 'label' => 'Montant',
'data' => $this->container->getParameter('cotisation_montant')
)) ))
->add('moyen', ChoiceType::class, array( ->add('moyen', ChoiceType::class, array(
'required' => true, 'required' => true,
......
<?php
namespace App\Form\Type;
use App\Entity\Import;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ImportFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.file',
'context' => 'import',
'label' => 'Fichier (.csv)'
))
->add('user', HiddenType::class, array(
'label' => false
))
->add('save', SubmitType::class, ['label' => "Importer les données"])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Import::class,
'cascade_validation' => true
]);
}
public function getBlockPrefix()
{
return 'formImport';
}
}
<?php
namespace App\Form\Type;
use App\Entity\Usergroup;
use App\Form\Type\RegistrationFormType;
use App\Form\Type\SiegeFormType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
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;
class InstallFormType extends AbstractType
{
protected $container;
protected $em;
public function __construct(ContainerInterface $container, EntityManagerInterface $em)
{
$this->container = $container;
$this->em = $em;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('siege', SiegeFormType::class, array(
'label' => 'Siège :',
'required' => true
))
->add('user', RegistrationFormType::class, array(
'label' => 'UTILISATEUR SUPER ADMIN :',
'required' => true
))
->add('save', SubmitType::class, ['label' => "Installer le système"])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => null,
'cascade_validation' => true
]);
}
public function getBlockPrefix()
{
return 'formInstallation';
}
}
<?php
namespace App\Form\Type;
use App\Entity\Siege;
use Doctrine\ORM\EntityManagerInterface;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
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;
class SiegeFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, array(
'label' => 'Nom :',
'required' => true
))
->add('compte', NumberType::class, array(
'label' => 'Solde de monnaie actuellement au siège :',
'required' => true
))
// ->add('content', CKEditorType::class, array(
// 'label' => 'Description :',
// 'required' => false
// ))
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Siege::class,
'cascade_validation' => true
]);
}
public function getBlockPrefix()
{
return 'formSiege';
}
}
<?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 Version20190308224025 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 prestataire DROP partenaire');
}
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 prestataire ADD partenaire TINYINT(1) NOT NULL');
}
}
<?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 Version20190309000129 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 groupeprestaire ADD tel VARCHAR(20) DEFAULT NULL, ADD email VARCHAR(100) DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire CHANGE metier metier VARCHAR(100) DEFAULT NULL');
}
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 groupeprestaire DROP tel, DROP email');
$this->addSql('ALTER TABLE prestataire CHANGE metier metier VARCHAR(100) NOT NULL COLLATE utf8mb4_unicode_ci');
}
}
<?php
namespace App\Repository;
use App\Entity\Import;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* @method Import|null find($id, $lockMode = null, $lockVersion = null)
* @method Import|null findOneBy(array $criteria, array $orderBy = null)
* @method Import[] findAll()
* @method Import[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ImportRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Import::class);
}
// /**
// * @return Import[] Returns an array of Import objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('i')
->andWhere('i.exampleField = :val')
->setParameter('val', $value)
->orderBy('i.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Import
{
return $this->createQueryBuilder('i')
->andWhere('i.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
...@@ -5,6 +5,7 @@ namespace App\Twig; ...@@ -5,6 +5,7 @@ namespace App\Twig;
use App\Entity\Comptoir; use App\Entity\Comptoir;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Groupeprestataire;
use App\Entity\News; use App\Entity\News;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
...@@ -34,6 +35,7 @@ class AppExtension extends AbstractExtension ...@@ -34,6 +35,7 @@ class AppExtension extends AbstractExtension
new \Twig_SimpleFunction('getSiege', array($this, 'getSiege')), new \Twig_SimpleFunction('getSiege', array($this, 'getSiege')),
new \Twig_SimpleFunction('getLastNews', array($this, 'getLastNews')), new \Twig_SimpleFunction('getLastNews', array($this, 'getLastNews')),
new \Twig_SimpleFunction('getAllPrestataires', array($this, 'getAllPrestataires')), new \Twig_SimpleFunction('getAllPrestataires', array($this, 'getAllPrestataires')),
new \Twig_SimpleFunction('getAllGroupePrestataires', array($this, 'getAllGroupePrestataires')),
new \Twig_SimpleFunction('getAllComptoirs', array($this, 'getAllComptoirs')), new \Twig_SimpleFunction('getAllComptoirs', array($this, 'getAllComptoirs')),
new \Twig_SimpleFunction('getAllRubriques', array($this, 'getAllRubriques')), new \Twig_SimpleFunction('getAllRubriques', array($this, 'getAllRubriques')),
new \Twig_SimpleFunction('getAllGroupes', array($this, 'getAllGroupes')), new \Twig_SimpleFunction('getAllGroupes', array($this, 'getAllGroupes')),
...@@ -60,6 +62,11 @@ class AppExtension extends AbstractExtension ...@@ -60,6 +62,11 @@ class AppExtension extends AbstractExtension
return $this->container->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true)); return $this->container->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true));
} }
public function getAllGroupePrestataires($type = '')
{
return $this->container->get('doctrine')->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true));
}
public function getAllComptoirs() public function getAllComptoirs()
{ {
return $this->container->get('doctrine')->getRepository(Comptoir::class)->findBy(array('enabled' => true)); return $this->container->get('doctrine')->getRepository(Comptoir::class)->findBy(array('enabled' => true));
......
{% 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 %}
{{ 'Import de données'|trans }}
{% endblock %}
{% block navbar_title %}
{{ block('title') }}
{% endblock %}
{% block content %}
<div class="col-xs-12 col-md-12 p-4">
{{form_start(form)}}
{{ form_row(form.media) }}
{{ form_row(form.user) }}
{{ form_row(form.save) }}
{{form_end(form)}}
</div>
{% endblock %}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="card-header"><h3>{{'Carte des comptoirs :'|trans}}</h3></div> <div class="card-header"><h3>{{'Carte des comptoirs :'|trans}}</h3></div>
<div class="card-body"> <div class="card-body">
<div class="card-text"> <div class="card-text">
{% include 'presta/block/carte.html.twig' with {id: 'comptoirid', style:"height: 400px;"} %} {% include 'presta/block/carte.html.twig' with {title: 'Situer les comptoirs', id: 'comptoirid', style:"height: 400px;"} %}
</div> </div>
</div> </div>
</div> </div>
......
{% set idmap = id|default('mapid') %}
<script type="text/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip()
if ($('#{{idmap}}').length) {
var mymap = L.map('{{idmap}}').setView({{parameter('map_center')}}, {{parameter('map_zoom')}});
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox.streets',
accessToken: '{{parameter('map_token')}}'
}).addTo(mymap);
{# AJOUTER LES MARQUEURS SUR LA CARTE #}
{% set groupegroupeprestataires = getAllGroupePrestataires(groupetype) %}
{% set count = 1 %}
{% for groupepresta in groupegroupeprestataires %}
{% if groupepresta.geoloc != null and groupepresta.geoloc.lat != null and groupepresta.geoloc.lon != null%}
var marker_{{count}} = L.marker([{{groupepresta.geoloc.lat}}, {{groupepresta.geoloc.lon}}]).addTo(mymap);
marker_{{count}}.bindPopup("{% if groupepresta.media != null %}{% thumbnail groupepresta.media, 'small' %}<br/><br/>{% endif %}{% spaceless %}
<a href='{{ path('show_groupeprestataire', {'slug': groupepresta.slug}) }}'>
<strong>{{groupepresta.__toString()}}</strong>
</a>
<br/>{% endspaceless %}
{% for rubrique in groupepresta.rubriques %}
{% spaceless %}<a class='maprubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name|replace({"\n": '<br/>'})}}</a> {% endspaceless %}
{% endfor %}");
{% set count = count+1 %}
{% endif %}
{% endfor %}
}
})
</script>
{% extends 'common/layout.html.twig' %} {% extends 'common/layout.html.twig' %}
{% block content %} {% block content %}
Carte groupe de prestataire : <div class='container prestalist mt-2'>
<div class='card'>
<div class="card-header"><h3>{{'Carte des'|trans}} {{groupetype|upper}} :</h3></div>
<div class="card-body">
<div class="card-text">
{% include 'presta/block/carte.html.twig' with {title: 'Situer les '~groupetype|upper, id: 'groupeid', style:"height: 400px;"} %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
{% include 'groupepresta/block/cartejs.html.twig' with {id: 'groupeid'} %}
{% endblock %} {% endblock %}
{% extends 'common/layout.html.twig' %}
{% block content %}
<div class='container grouprestashow mt-2'>
<div class="my-2 p-3 bg-white rounded box-shadow">
<div class="contentgroupresta p-4 mt-2">
<div class="card mb-2">
<div class="card-header"><h1>{{groupepresta.name}}</h1></div>
<div class="card-body">
{% if groupepresta.groupe != null %}
<h4 class="card-subtitle mb-3">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': groupepresta.groupe.slug}) }}'>{{groupepresta.groupe.__toString()}}</a></h4>
{% endif %}
{% if groupepresta.horaires != null %}
<h5 class="card-subtitle mb-3">{{'Horaires'|trans}} : {{groupepresta.horaires}}</h5>
{% endif %}
{% if groupepresta.tel != null %}
<h5 class="card-subtitle mb-3">{{'Téléphone'|trans}} : {{groupepresta.tel}}</h5>
{% endif %}
{% if groupepresta.email != null %}
<h6 class="card-subtitle mb-3">{{'Email'|trans}} : {{ groupepresta.email|safe_email|raw }}</h6>
{% endif %}
{% if groupepresta.getFullAddresse() != null %}
<h6 class="card-title text-muted mb-3">{{groupepresta.getFullAddresse()}}</h6>
{% endif %}
<div class="card-text">
{{groupepresta.content|raw}}
</div>
</div>
<div class="card-header"><h2>{{ groupepresta.groupe.prestataires|length }} {{'prestataires'|trans}} :</h2></div>
<ul class="list-group list-group-flush">
{% for presta in groupepresta.groupe.prestataires %}
<li class="list-group-item">
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>{{presta.raison}}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endblock %}
{% extends 'common/layout.html.twig' %}
{% block content %}
<div class='container homepage'>
<div class="card mx-auto mt-5" style="max-width:600px;">
<div class="card-header">PREMIERE INSTALLATION</div>
<div class="card-body">
<div class="card-text">
{{form_start(form)}}
{{ form_row(form.siege) }}
{{ form_row(form.user) }}
{{ form_row(form.save) }}
{{form_end(form)}}
</div>
</div>
</div>
</div>
{% endblock %}
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
{% set style = style|default('') %} {% set style = style|default('') %}
{% set title = title|default('Carte') %} {% set title = title|default('Carte') %}
<div class='cartetitle mb-3'> <div class='cartetitle mb-3'>
<h4><i class="fa fa-map"></i> Situer les Prestataires</h4> <h4><i class="fa fa-map"></i> {{title}}</h4>
</div> </div>
<div id="{{id}}" style="{{style}}" class='my-3'></div> <div id="{{id}}" style="{{style}}" class='my-3'></div>
\ No newline at end of file
...@@ -41,7 +41,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase ...@@ -41,7 +41,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
public function testADMINPageIsSuccessful($url) public function testADMINPageIsSuccessful($url)
{ {
$client = static::createClient([], [ $client = static::createClient([], [
'PHP_AUTH_USER' => 'adminuser', 'PHP_AUTH_USER' => 'julien.jorry@gmail.com',
'PHP_AUTH_PW' => 'test', 'PHP_AUTH_PW' => 'test',
]); ]);
$client->request('GET', $url); $client->request('GET', $url);
......
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