add serie festival and expenses models

This commit is contained in:
Baptiste Lemoine 2018-08-22 16:42:21 +02:00
parent 5e5f481795
commit 1497570c1b
7 changed files with 436 additions and 1 deletions

View File

@ -0,0 +1,99 @@
{% extends 'base.html.twig' %}
{% trans_default_domain 'FOSUserBundle' %}
{% block body %}
<div id="wrapper">
<div class="previsionnel"
ng-app="caisse"
ng-controller="PrevisionnelCtrl as pCtrl"
>
<h1>Prévisionnel</h1>
<div class="row">
<div class="col-6 col-xs-12 col-sm-6">
<div class="config">
<h2>
Configuration
</h2>
Euros disponibles au départ:
<input type="number" ng-model="start">
</div>
<div class="postes">
<h2>Postes de dépenses</h2>
<p class="desc">
Indiquez les catégories de dépenses mensuelles que vous faites pour faire évoluer la simulation de budget restant dans plusieurs mois.
</p>
<table class="exepnse-table">
<thead>
<tr>
<td>
Nom
</td>
<td>
débute dans X mois
</td>
<td>
mois répétitions
</td>
<td>
prix répétitions
</td>
<td>
prix mensuel
</td>
<td>
prix annuel
</td>
</tr>
</thead>
<tbody>
</tbody>
<tr>
<td>
</td>
</tr>
</table>
<div class="well">
Exemple:
appartement
resto au boulot
courses
trucs de loisirs divers
gaz
elec
internet
serveur wouaibe
assurance voiture
transport en commun
abonnement protonmail VPN
abonnement service audio, vidéo
carburant véhicule
donations
médecin
chat
chien
licorne
</div>
</div>
</div>
<div class="col-6 col-xs-12 col-sm-6">
<h2>Simulation sur 5 ans (60 mois)</h2>
<table>
<thead>
</thead>
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -222,4 +222,15 @@ angular
$scope.init = (function () {
$scope.fetchProductsFromDB();
})();
}])
.controller('previsionnelCtrl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) {
// http related calls
$scope.fetchProductsFromDB = function () {
console.log('fetch products...');
$http.get('get-my-expenses').then((rep) => {
console.log('get-my-expenses',rep);
})
}
}]);

View File

@ -0,0 +1,178 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ExpenseKind
*
* @ORM\Table(name="expense_kind")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ExpenseKindRepository")
*/
class ExpenseKind
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var int|null
*
* @ORM\Column(name="delay", type="integer", nullable=true)
*/
private $delay;
/**
* @var int|null
*
* @ORM\Column(name="repeatitions", type="integer", nullable=true)
*/
private $repeatitions;
/**
* @var float
*
* @ORM\Column(name="amount", type="float")
*/
private $amount;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
*/
private $user;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* Set name.
*
* @param string $name
*
* @return ExpenseKind
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set delay.
*
* @param int|null $delay
*
* @return ExpenseKind
*/
public function setDelay($delay = null)
{
$this->delay = $delay;
return $this;
}
/**
* Get delay.
*
* @return int|null
*/
public function getDelay()
{
return $this->delay;
}
/**
* Set repeatitions.
*
* @param int|null $repeatitions
*
* @return ExpenseKind
*/
public function setRepeatitions($repeatitions = null)
{
$this->repeatitions = $repeatitions;
return $this;
}
/**
* Get repeatitions.
*
* @return int|null
*/
public function getRepeatitions()
{
return $this->repeatitions;
}
/**
* Set amount.
*
* @param float $amount
*
* @return ExpenseKind
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Get amount.
*
* @return float
*/
public function getAmount()
{
return $this->amount;
}
}

View File

@ -48,6 +48,10 @@ class Festival {
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\SerieFestival", inversedBy="festivals")
*/
private $serieFestival;
/**
* @var
@ -83,6 +87,22 @@ class Festival {
private $fraisRepas;
/**
* @return mixed
*/
public function getSerieFestival()
{
return $this->serieFestival;
}
/**
* @param mixed $serieFestival
*/
public function setSerieFestival($serieFestival)
{
$this->serieFestival = $serieFestival;
}
/**
* array usable by js
* @return array

View File

@ -0,0 +1,109 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="serieFestival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class SerieFestival {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="serieFestival")
*/
private $festivals;
/**
* @var \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getFestivals()
{
return $this->festivals;
}
/**
* @param mixed $festivals
*/
public function setFestivals($festivals)
{
$this->festivals = $festivals;
}
/**
* @return \DateTime
*/
public function getDateCreation()
{
return $this->dateCreation;
}
/**
* @param \DateTime $dateCreation
*/
public function setDateCreation($dateCreation)
{
$this->dateCreation = $dateCreation;
}
}

View File

@ -54,6 +54,11 @@ class User extends BaseUser {
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user")
*/
private $festivals;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ExpenseKind", mappedBy="user")
*/
private $expenses;
/**
* current festival we are recording sellings for

View File

@ -0,0 +1,13 @@
<?php
namespace AppBundle\Repository;
/**
* ExpenseKindRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ExpenseKindRepository extends \Doctrine\ORM\EntityRepository
{
}