mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 06:14:59 +00:00
Feature: allow to administrate budget resources and charges from the admin
This commit is contained in:
@@ -39,6 +39,12 @@ class Charge extends AbstractElement implements HasCentersInterface
|
||||
self::HELP_NOT_RELEVANT,
|
||||
];
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ChargeKind::class, inversedBy="AbstractElement")
|
||||
* @ORM\JoinColumn
|
||||
*/
|
||||
private ?ChargeKind $charge = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(name="help", type="string", nullable=true)
|
||||
@@ -66,6 +72,11 @@ class Charge extends AbstractElement implements HasCentersInterface
|
||||
return $this->getHousehold()->getCurrentPersons()->map(static fn (Person $p) => $p->getCenter())->toArray();
|
||||
}
|
||||
|
||||
public function getCharge(): ?ChargeKind
|
||||
{
|
||||
return $this->charge;
|
||||
}
|
||||
|
||||
public function getHelp()
|
||||
{
|
||||
return $this->help;
|
||||
@@ -91,6 +102,13 @@ class Charge extends AbstractElement implements HasCentersInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setCharge(?ChargeKind $charge): self
|
||||
{
|
||||
$this->charge = $charge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHelp($help)
|
||||
{
|
||||
$this->help = $help;
|
||||
|
108
src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php
Normal file
108
src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Chill\BudgetBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Type of charge.
|
||||
*
|
||||
* @ORM\Table(name="chill_budget.charge_type")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class ChargeKind
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": true})
|
||||
*/
|
||||
private bool $isActive = true;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false)
|
||||
*/
|
||||
private string $kind = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", length=255, options={"default": "[]"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", options={"default": 0.00})
|
||||
*/
|
||||
private float $ordering = 0.00;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", length=255, options={"default": "[]"})
|
||||
*/
|
||||
private array $tags = [];
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getIsActive(): bool
|
||||
{
|
||||
return $this->isActive;
|
||||
}
|
||||
|
||||
public function getKind(): ?string
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function getName(): ?array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
public function setIsActive(bool $isActive): self
|
||||
{
|
||||
$this->isActive = $isActive;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setKind(?string $kind): self
|
||||
{
|
||||
$this->kind = $kind;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrdering(float $ordering): ChargeKind
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -31,6 +31,12 @@ class Resource extends AbstractElement implements HasCentersInterface
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ResourceKind::class, inversedBy="AbstractElement")
|
||||
* @ORM\JoinColumn
|
||||
*/
|
||||
private ?ResourceKind $resource = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setStartDate(new DateTimeImmutable('today'));
|
||||
@@ -55,6 +61,11 @@ class Resource extends AbstractElement implements HasCentersInterface
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getResource(): ?ResourceKind
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
public function isCharge(): bool
|
||||
{
|
||||
return false;
|
||||
@@ -64,4 +75,11 @@ class Resource extends AbstractElement implements HasCentersInterface
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setResource(?ResourceKind $resource): self
|
||||
{
|
||||
$this->resource = $resource;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
108
src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php
Normal file
108
src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Chill\BudgetBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Type of resource.
|
||||
*
|
||||
* @ORM\Table(name="chill_budget.resource_type")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class ResourceKind
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": true})
|
||||
*/
|
||||
private bool $isActive = true;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $kind = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", length=255, options={"default": "[]"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", options={"default": 0.00})
|
||||
*/
|
||||
private float $ordering = 0.00;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", length=255, options={"default": "[]"})
|
||||
*/
|
||||
private array $tags = [];
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getIsActive(): bool
|
||||
{
|
||||
return $this->isActive;
|
||||
}
|
||||
|
||||
public function getKind(): ?string
|
||||
{
|
||||
return $this->kind;
|
||||
}
|
||||
|
||||
public function getName(): ?array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
public function setIsActive(bool $isActive): self
|
||||
{
|
||||
$this->isActive = $isActive;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setKind(?string $kind): self
|
||||
{
|
||||
$this->kind = $kind;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOrdering(float $ordering): self
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user