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
5d8738cb
Commit
5d8738cb
authored
Mar 12, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
7ba7843f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
UserController.php
src/Controller/UserController.php
+32
-0
operations.html.twig
templates/themes/kohinos/block/operations.html.twig
+14
-0
No files found.
src/Controller/UserController.php
View file @
5d8738cb
...
...
@@ -242,6 +242,38 @@ class UserController extends AbstractController
return
$this
->
redirectToRoute
(
'index'
);
}
/**
* @param Request $request
* @param TransactionAdherentPrestataire $transactionAdherentPrestataire
* @return void
* @Security("is_granted('ROLE_PRESTATAIRE') or is_granted('ROLE_CAISSIER')")
* @Route("/cancel-transaction-adherent-prestataire/{id}", name="cancel_transaction_adherent_prestataire")
*/
public
function
cancelTransactionAdherentPrestataireAction
(
Request
$request
,
TransactionAdherentPrestataire
$transactionAdherentPrestataire
)
{
//Make sure current user is destinataire of transaction
if
(
!
in_array
(
$this
->
getUser
(),
$transactionAdherentPrestataire
->
getDestinataire
()
->
getUsers
()))
{
$this
->
addFlash
(
'error'
,
"Vous n'êtes pas autorisé à annuler cette transaction."
);
return
$this
->
redirectToRoute
(
'index'
);
}
// Check prestataire has enough funds
$balance
=
$transactionAdherentPrestataire
->
getDestinataire
()
->
getEmlcAccount
()
->
getBalance
();
//I think this is unlikely in real situation but we need to make sure prestataire has enough founds
if
(
$balance
<
$transactionAdherentPrestataire
->
getMontant
())
{
$this
->
addFlash
(
'error'
,
'Fonds insuffisants pour annuler cette transaction.'
);
return
$this
->
redirectToRoute
(
'index'
);
}
//TODO: Save transaction
}
/**
* @Route("/encaissement", name="encaissement")
* @IsGranted({"ROLE_CAISSIER", "ROLE_PRESTATAIRE"})
...
...
templates/themes/kohinos/block/operations.html.twig
View file @
5d8738cb
...
...
@@ -17,6 +17,11 @@
<th
scope=
"col"
>
Type
</th>
<th
scope=
"col"
>
Operation
</th>
<th
scope=
"col"
>
Montant
</th>
{# Display column to store btn to cancel transaction adherent prestataire #}
{%
if
operation.flux.type
=
constant
(
'App\\Entity\\Transaction::TYPE_TRANSACTION_ADHERENT_PRESTATAIRE'
)
and
app.user
in
operation.flux.destinataire
%}
<th
scope=
"col"
></th>
{%
endif
%}
</tr>
</thead>
<tbody>
...
...
@@ -56,6 +61,15 @@
</div>
</td>
<td
class=
'text-right'
><span
class=
'font-weight-bold
{{
(
operation.montant
<
0
)
?
''
:
'text-primary'
}}
'
>
{{
(
operation.montant
<
0
)
?
'- '
:
'+ '
}}
{{
operation.montant
|
abs
|
number_format
(
2
)
}}
{{
getCurrencyName
(
operation.currency
)
}}
</span></td>
{# Display btn to cancel transaction adherent prestataire #}
{%
if
operation.flux.type
=
constant
(
'App\\Entity\\Transaction::TYPE_TRANSACTION_ADHERENT_PRESTATAIRE'
)
and
app.user
in
operation.flux.destinataire
%}
<td>
<a
href=
"
{{
path
(
'cancel_transactio_adherent_prestataire'
,
{
'id'
:
operation.flux.id
}
)
}}
"
type=
"button"
class=
"button button-danger"
>
<i
class=
"fa fa-remove"
aria-hidden=
"true"
></i>
</a>
</td>
{%
endif
%}
</tr>
{%
endfor
%}
</tbody>
...
...
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