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
4aaf9a64
Commit
4aaf9a64
authored
Nov 18, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create page to receive payments for prestataires
parent
c1b51736
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
0 deletions
+115
-0
UserController.php
src/Controller/UserController.php
+31
-0
EncaissementFormType.php
src/Form/Type/EncaissementFormType.php
+53
-0
MlcGlobalsExtension.php
src/Twig/MlcGlobalsExtension.php
+3
-0
admin_prestataire.html.twig
templates/themes/kohinos/block/admin_prestataire.html.twig
+4
-0
encaisser_paiement.html.twig
...tes/themes/kohinos/tav/block/encaisser_paiement.html.twig
+10
-0
encaissement_page.html.twig
templates/themes/kohinos/tav/encaissement_page.html.twig
+14
-0
No files found.
src/Controller/UserController.php
View file @
4aaf9a64
...
...
@@ -14,6 +14,7 @@ use App\Form\Type\CotiserFormType;
use
App\Form\Type\DonAdherentFormType
;
use
App\Form\Type\DonPrestataireFormType
;
use
App\Form\Type\UserInfosFormType
;
use
App\Form\Type\EncaissementFormType
;
use
App\Utils\CotisationUtils
;
use
App\Utils\OperationUtils
;
use
Doctrine\ORM\EntityManagerInterface
;
...
...
@@ -222,4 +223,34 @@ class UserController extends AbstractController
return
$this
->
redirectToRoute
(
'index'
);
}
/**
* @Route("/encaissement", name="encaissement")
* @IsGranted("ROLE_PRESTATAIRE")
*/
public
function
encaissementAction
(
Request
$request
)
{
$options
=
[];
$form
=
$this
->
createForm
(
EncaissementFormType
::
class
,
null
,
$options
);
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
())
{
$data
=
$form
->
getData
();
if
(
$form
->
isValid
())
{
// TODO redirect to page to ask for validation code
// TODO check if user has validation code / code is ok / user has enough
// ifok save transfer (transaction?)
}
else
{
$this
->
addFlash
(
'error'
,
$this
->
translator
->
trans
(
'Problème avec l\'encaissement !'
)
.
' '
.
$form
->
getErrors
()
);
}
}
return
$this
->
render
(
'@kohinos/tav/encaissement_page.html.twig'
,
[
'form'
=>
$form
->
createView
()
]);
}
}
src/Form/Type/EncaissementFormType.php
0 → 100644
View file @
4aaf9a64
<?php
namespace
App\Form\Type
;
use
Doctrine\ORM\EntityManagerInterface
;
use
Symfony\Component\Security\Core\Security
;
use
Symfony\Component\Form\AbstractType
;
use
Symfony\Component\Form\Extension\Core\Type\NumberType
;
use
Symfony\Component\Form\Extension\Core\Type\SubmitType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
App\Entity\Adherent
;
class
EncaissementFormType
extends
AbstractType
{
protected
$em
;
protected
$security
;
public
function
__construct
(
EntityManagerInterface
$em
,
Security
$security
)
{
$this
->
em
=
$em
;
$this
->
security
=
$security
;
}
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
{
$builder
->
add
(
'user'
,
EntityType
::
class
,
[
'class'
=>
Adherent
::
class
,
'choices'
=>
$this
->
em
->
getRepository
(
Adherent
::
class
)
->
findOrderByName
(),
'attr'
=>
[
'class'
=>
'form-control select2'
,
],
'placeholder'
=>
'Choisissez un adhérent'
,
'required'
=>
true
,
'label'
=>
'Adherent :'
,
'choice_label'
=>
'name'
])
->
add
(
'montant'
,
NumberType
::
class
,
[
'label'
=>
'Montant : '
,
'required'
=>
true
,
])
->
add
(
'save'
,
SubmitType
::
class
,
[
'label'
=>
'Valider'
])
;
}
public
function
getBlockPrefix
()
{
return
'formEncaissement'
;
}
}
src/Twig/MlcGlobalsExtension.php
View file @
4aaf9a64
...
...
@@ -28,6 +28,9 @@ class MlcGlobalsExtension extends AbstractExtension implements GlobalsInterface
if
(
!
isset
(
$arrayGlobals
[
'KOH_MAP_ZOOM'
]))
{
$arrayGlobals
[
'KOH_MAP_ZOOM'
]
=
'6'
;
}
if
(
!
isset
(
$arrayGlobals
[
'KOH_TAV'
]))
{
$arrayGlobals
[
'KOH_TAV'
]
=
$_ENV
[
"TAV_ENV"
];
}
// $solidoumeParam = $this->em->getRepository(SolidoumeParameter::class)->findTheOne();
// if (!empty($solidoumeParam)) {
...
...
templates/themes/kohinos/block/admin_prestataire.html.twig
View file @
4aaf9a64
{%
set
esoldelabel
=
'Solde e-mlc'
|
trans
%}
{%
include
'@kohinos/block/solde.html.twig'
with
{
'compte'
:
getCurrentPrestataire
()
.
emlcAccount.balance
,
'soldelabel'
:
esoldelabel
,
'currency'
:
'e'
~
(
KOH_MLC_SYMBOL
|
default
(
''
))
}
%}
{%
if
KOH_TAV
==
1
%}
{%
include
'@kohinos/tav/block/encaisser_paiement.html.twig'
%}
{%
endif
%}
{%
if
getCurrentPrestataire
()
.
mlc
==
false
%}
{%
include
'@kohinos/presta/block/infos.html.twig'
%}
{%
endif
%}
...
...
templates/themes/kohinos/tav/block/encaisser_paiement.html.twig
0 → 100644
View file @
4aaf9a64
{%
extends
'@kohinos/block/block_collapse.html.twig'
%}
{%
block
blocktitle
%}
<i
class=
"fa fa-shopping-basket mr-4"
></i>
{{
'Encaisser un paiement en Monnaie Solidaire'
|
trans
}}
{%
endblock
blocktitle
%}
{%
block
blockcontent
%}
<a
class=
'btn btn-xs btn-primary mt-2'
href=
'
{{
path
(
'encaissement'
)
}}
'
>
{{
'Encaisser'
|
trans
}}
</a>
{%
endblock
blockcontent
%}
templates/themes/kohinos/tav/encaissement_page.html.twig
0 → 100644
View file @
4aaf9a64
{%
extends
'@kohinos/common/layout.html.twig'
%}
{%
block
content
%}
<div
class=
'container'
style=
'max-width: 800px;'
>
{%
include
'@kohinos/block/breadcrumb.html.twig'
with
{
'label'
:
'Encaissement'
}
%}
<h2
class=
'text-center w-100 mt-4 mb-4'
>
{{
"Encaissement"
|
trans
}}
</h2>
<div
class=
'text-center mb-5'
>
{{
form_start
(
form
)
}}
{{
form_row
(
form.user
)
}}
{{
form_end
(
form
)
}}
</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