Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
686c2aba
Commit
686c2aba
authored
Jan 13, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front : prestataire liste : order by groupe or name + show presta by groupe
parent
9c8f0142
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
3 deletions
+106
-3
PrestatairesController.php
src/Controller/PrestatairesController.php
+29
-2
PrestataireRepository.php
src/Repository/PrestataireRepository.php
+28
-0
liste_prestataires.html.twig
templates/themes/kohinos/presta/liste_prestataires.html.twig
+6
-1
liste_prestataires_bygroupelocal.html.twig
...kohinos/presta/liste_prestataires_bygroupelocal.html.twig
+43
-0
No files found.
src/Controller/PrestatairesController.php
View file @
686c2aba
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Controller
;
namespace
App\Controller
;
use
App\Entity\Groupe
;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\Rubrique
;
use
App\Entity\Rubrique
;
use
Doctrine\ORM\EntityManagerInterface
;
use
Doctrine\ORM\EntityManagerInterface
;
...
@@ -39,13 +40,22 @@ class PrestatairesController extends FrontController
...
@@ -39,13 +40,22 @@ class PrestatairesController extends FrontController
}
}
/**
/**
* @Route("/prestataires/liste
", name="liste_prestataire"
)
* @Route("/prestataires/liste
/{order}", name="liste_prestataire", defaults={"order": "raison"}
)
*/
*/
public
function
listePrestaAction
()
public
function
listePrestaAction
(
$order
=
'raison'
)
{
{
if
(
!
$this
->
isFrontActivated
())
{
if
(
!
$this
->
isFrontActivated
())
{
return
$this
->
redirectToRoute
(
'index'
);
return
$this
->
redirectToRoute
(
'index'
);
}
}
if
(
$order
==
'groupelocal'
)
{
$prestas
=
$this
->
em
->
getRepository
(
Prestataire
::
class
)
->
findDefault
(
'prestataire'
,
'groupelocal'
);
return
$this
->
render
(
'@kohinos/presta/liste_prestataires_bygroupelocal.html.twig'
,
[
'prestas'
=>
$prestas
,
'type'
=>
'Prestataires'
,
]);
}
$prestas
=
$this
->
em
->
getRepository
(
Prestataire
::
class
)
->
findDefault
(
'prestataire'
);
$prestas
=
$this
->
em
->
getRepository
(
Prestataire
::
class
)
->
findDefault
(
'prestataire'
);
return
$this
->
render
(
'@kohinos/presta/liste_prestataires.html.twig'
,
[
return
$this
->
render
(
'@kohinos/presta/liste_prestataires.html.twig'
,
[
...
@@ -55,6 +65,23 @@ class PrestatairesController extends FrontController
...
@@ -55,6 +65,23 @@ class PrestatairesController extends FrontController
}
}
/**
/**
* @Route("/prestataires/groupe/{slug}/liste", name="liste_presta_by_groupe")
*/
public
function
listePrestaByGroupeAction
(
Groupe
$groupe
)
{
if
(
!
$this
->
isFrontActivated
())
{
return
$this
->
redirectToRoute
(
'index'
);
}
$prestas
=
$this
->
em
->
getRepository
(
Prestataire
::
class
)
->
findByGroupe
(
$groupe
);
return
$this
->
render
(
'@kohinos/presta/liste_prestataires.html.twig'
,
[
'prestas'
=>
$prestas
,
'type'
=>
'Prestataires du groupe local '
.
$groupe
->
getName
(),
]);
}
/**
* @Route("/partenaires/liste", name="liste_partenaire")
* @Route("/partenaires/liste", name="liste_partenaire")
*/
*/
public
function
listePartnerAction
()
public
function
listePartnerAction
()
...
...
src/Repository/PrestataireRepository.php
View file @
686c2aba
...
@@ -31,7 +31,13 @@ class PrestataireRepository extends ServiceEntityRepository
...
@@ -31,7 +31,13 @@ class PrestataireRepository extends ServiceEntityRepository
{
{
$qb
=
$this
->
createQueryBuilder
(
'p'
);
$qb
=
$this
->
createQueryBuilder
(
'p'
);
$qb
=
$this
->
addDefaultFilter
(
$qb
);
$qb
=
$this
->
addDefaultFilter
(
$qb
);
if
(
$orderBy
==
'groupelocal'
&&
!
empty
(
$direction
)
&&
(
'ASC'
===
$direction
||
'DESC'
===
$direction
))
{
$qb
->
leftJoin
(
'p.groupe'
,
'g'
)
->
orderBy
(
'g.name'
,
$direction
)
->
addOrderBy
(
'p.raison'
,
'ASC'
);
}
else
if
(
!
empty
(
$orderBy
)
&&
!
empty
(
$direction
)
&&
(
'ASC'
===
$direction
||
'DESC'
===
$direction
))
{
$qb
->
orderBy
(
'p.'
.
$orderBy
,
$direction
);
$qb
->
orderBy
(
'p.'
.
$orderBy
,
$direction
);
}
if
(
null
!=
$limit
)
{
if
(
null
!=
$limit
)
{
$qb
->
limit
(
$limit
);
$qb
->
limit
(
$limit
);
}
}
...
@@ -198,6 +204,28 @@ class PrestataireRepository extends ServiceEntityRepository
...
@@ -198,6 +204,28 @@ class PrestataireRepository extends ServiceEntityRepository
}
}
/**
/**
* For Prestataire front search.
*
* @return Prestataire[] Returns an array of Prestataire objects
*/
public
function
findByGroupe
(
Groupe
$groupe
)
{
$qb
=
$this
->
createQueryBuilder
(
'p'
);
$qb
=
$this
->
addDefaultFilter
(
$qb
);
return
$qb
->
andWhere
(
'p.groupe = :groupe'
)
->
setParameter
(
'groupe'
,
$groupe
)
->
orderBy
(
'p.raison'
,
'ASC'
)
->
leftJoin
(
'p.typeprestataire'
,
't'
)
->
andWhere
(
't.name = :nametype OR t.name IS NULL'
)
->
setParameter
(
'nametype'
,
'prestataire'
)
->
getQuery
()
->
getResult
()
;
}
/**
* For Prestataire Admin search.
* For Prestataire Admin search.
*
*
* @return Prestataire[] Returns an array of Prestataire objects
* @return Prestataire[] Returns an array of Prestataire objects
...
...
templates/themes/kohinos/presta/liste_prestataires.html.twig
View file @
686c2aba
...
@@ -3,7 +3,12 @@
...
@@ -3,7 +3,12 @@
{%
block
content
%}
{%
block
content
%}
<div
class=
'container prestalist mt-2'
>
<div
class=
'container prestalist mt-2'
>
{%
include
'@kohinos/block/breadcrumb.html.twig'
with
{
'label'
:
type
}
%}
{%
include
'@kohinos/block/breadcrumb.html.twig'
with
{
'label'
:
type
}
%}
<h1
class=
'pagetitle'
>
{{
type
}}
:
</h1>
<div
class=
"d-flex justify-content-center"
>
<div
class=
"btn-group text-center mb-2"
role=
"group"
aria-label=
"Basic example"
>
<a
href=
'#'
type=
"button"
class=
"btn btn-primary"
>
Par nom
</a>
<a
href=
'
{{
path
(
'liste_prestataire'
,
{
'order'
:
'groupelocal'
}
)
}}
'
type=
"button"
class=
"btn btn-secondary"
>
Par groupe local
</a>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
{%
for
presta
in
prestas
%}
{%
for
presta
in
prestas
%}
<div
class=
"col-12 col-md-6 mb-2"
>
<div
class=
"col-12 col-md-6 mb-2"
>
...
...
templates/themes/kohinos/presta/liste_prestataires_bygroupelocal.html.twig
0 → 100644
View file @
686c2aba
{%
extends
'@kohinos/common/layout.html.twig'
%}
{%
block
content
%}
<div
class=
'container prestalist mt-2'
>
{%
include
'@kohinos/block/breadcrumb.html.twig'
with
{
'label'
:
type
}
%}
<div
class=
"d-flex justify-content-center"
>
<div
class=
"btn-group text-center mb-2"
role=
"group"
aria-label=
"Basic example"
>
<a
href=
'#'
type=
"button"
class=
"btn btn-secondary"
>
Par nom
</a>
<a
href=
'
{{
path
(
'liste_prestataire'
,
{
'order'
:
'groupelocal'
}
)
}}
'
type=
"button"
class=
"btn btn-primary"
>
Par groupe local
</a>
</div>
</div>
{%
set
groupe
=
''
%}
{%
set
groupePrestaHtml
=
[]
%}
{%
for
presta
in
prestas
%}
{%
if
groupe
!=
presta.groupe.name
%}
{%
if
loop.index
!=
1
%}
</div>
</div>
{%
endif
%}
{%
set
groupe
=
presta.groupe.name
%}
<h5
class=
"w-100 card-header mb-3 text-primary border border-primary"
style=
'cursor:pointer;'
>
<a
class=
'd-inline'
href=
'
{{
path
(
'liste_presta_by_groupe'
,
{
'slug'
:
presta.groupe.slug
}
)
}}
'
>
GROUPE LOCAL :
{{
presta.groupe.name
|
upper
}}
</a>
<a
href=
'#'
class=
'nounderline d-inline float-right'
tyle=
'cursor:pointer;'
data-toggle=
"collapse"
data-target=
"#collapsepresta
{{
presta.groupe.id
}}
"
aria-expanded=
"false"
aria-controls=
"collapsepresta
{{
presta.groupe.id
}}
"
><i
class=
"fa fa-caret-down ml-2"
aria-hidden=
"true"
></i></a>
</h5>
<div
id=
"collapsepresta
{{
presta.groupe.id
}}
"
class=
'collapse show'
>
{%
if
loop.index
!=
1
%}
<div
class=
'row'
>
{%
endif
%}
{%
endif
%}
{%
if
loop.index
==
1
%}
<div
class=
"row"
>
{%
endif
%}
<div
class=
"col-12 col-md-6 mb-2"
>
{%
include
'@kohinos/presta/onepresta.html.twig'
%}
</div>
{%
if
loop.index
%
2
==
0
%}
</div>
<div
class=
"row"
>
{%
endif
%}
{%
endfor
%}
</div>
</div>
{%
endblock
%}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment