mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
101 lines
2.4 KiB
PHP
101 lines
2.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Chill is a software for social workers.
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*
|
|
* @see https://www.champs-libres.coop/
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\AMLI\BudgetBundle\Controller;
|
|
|
|
use Chill\AMLI\BudgetBundle\Entity\Charge;
|
|
use Chill\AMLI\BudgetBundle\Form\ChargeType;
|
|
use Chill\PersonBundle\Entity\Person;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
class ChargeController extends AbstractElementController
|
|
{
|
|
/**
|
|
* @Route(
|
|
* "{_locale}/budget/charge/{id}/delete",
|
|
* name="chill_budget_charge_delete"
|
|
* )
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function deleteAction(Request $request, Charge $charge)
|
|
{
|
|
return $this->_delete(
|
|
$charge,
|
|
$request,
|
|
'@ChillAMLIBudget/Charge/confirm_delete.html.twig',
|
|
'Charge deleted'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @Route(
|
|
* "{_locale}/budget/charge/{id}/edit",
|
|
* name="chill_budget_charge_edit"
|
|
* )
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function editAction(Request $request, Charge $charge)
|
|
{
|
|
return $this->_edit(
|
|
$charge,
|
|
$request,
|
|
'@ChillAMLIBudget/Charge/edit.html.twig',
|
|
'Charge updated'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @Route(
|
|
* "{_locale}/budget/charge/by-person/{id}/new",
|
|
* name="chill_budget_charge_new"
|
|
* )
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function newAction(Request $request, Person $person)
|
|
{
|
|
return $this->_new(
|
|
$person,
|
|
$request,
|
|
'@ChillAMLIBudget/Charge/new.html.twig',
|
|
'Charge created'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @Route(
|
|
* "{_locale}/budget/charge/{id}/view",
|
|
* name="chill_budget_charge_view"
|
|
* )
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function viewAction(Charge $charge)
|
|
{
|
|
return $this->_view($charge, '@ChillAMLIBudget/Charge/view.html.twig');
|
|
}
|
|
|
|
protected function createNewElement()
|
|
{
|
|
return new Charge();
|
|
}
|
|
|
|
protected function getType()
|
|
{
|
|
return ChargeType::class;
|
|
}
|
|
}
|