expenses prevision page start with example
This commit is contained in:
parent
5acff1b274
commit
e371483c59
0
.gitmodules
vendored
Normal file → Executable file
0
.gitmodules
vendored
Normal file → Executable file
32
app/Resources/views/logged/previsionnel.html.twig
Normal file → Executable file
32
app/Resources/views/logged/previsionnel.html.twig
Normal file → Executable file
@ -1,7 +1,9 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
{% trans_default_domain 'FOSUserBundle' %}
|
{% trans_default_domain 'FOSUserBundle' %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id="wrapper">
|
{% verbatim %}
|
||||||
|
|
||||||
|
<div id="wrapper">
|
||||||
<div class="previsionnel"
|
<div class="previsionnel"
|
||||||
ng-app="caisse"
|
ng-app="caisse"
|
||||||
ng-controller="previsionnelCtrl as pCtrl"
|
ng-controller="previsionnelCtrl as pCtrl"
|
||||||
@ -18,9 +20,12 @@
|
|||||||
Dépenses mensuelles: {{ sumMonthlyExpenses }}
|
Dépenses mensuelles: {{ sumMonthlyExpenses }}
|
||||||
</div>
|
</div>
|
||||||
<div class="postes">
|
<div class="postes">
|
||||||
<h2>Postes de dépenses</h2>
|
<h2>Postes de dépenses
|
||||||
|
<button ng-click="addExpense()">+</button>
|
||||||
|
</h2>
|
||||||
<p class="desc">
|
<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.
|
Indiquez les catégories de dépenses mensuelles que vous faites pour faire évoluer la
|
||||||
|
simulation de budget restant dans plusieurs mois.
|
||||||
</p>
|
</p>
|
||||||
<table class="exepnse-table">
|
<table class="exepnse-table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -49,23 +54,24 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
<tr ng-repeat="e in pCtrl.expenses">
|
<tr ng-repeat="e in expenses">
|
||||||
<td>
|
<td>
|
||||||
{{ e.name }}
|
<input type="text" ng-model="e.name">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ e.delay }}débute dans X mois
|
|
||||||
|
<input type="text" ng-model="e.delay">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ e.repeat }}
|
<input type="text" ng-model="e.repeat">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="text-right padded">
|
||||||
{{ e.repeat * e.amount }}
|
{{ e.repeat * e.amount }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ e.amount }}
|
<input type="text" ng-model="e.amount">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="text-right padded">
|
||||||
{{ e.amount * 12 }}
|
{{ e.amount * 12 }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -103,6 +109,7 @@
|
|||||||
<div class="col-6 col-xs-12 col-sm-6">
|
<div class="col-6 col-xs-12 col-sm-6">
|
||||||
|
|
||||||
<h2>Simulation sur 5 ans (60 mois)</h2>
|
<h2>Simulation sur 5 ans (60 mois)</h2>
|
||||||
|
{{previsionTable.length}} lignes
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -142,5 +149,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endverbatim %}
|
||||||
|
{% endblock %}
|
@ -35,12 +35,12 @@ angular
|
|||||||
$scope.activeItemsSold = []; // list of products ID to sell
|
$scope.activeItemsSold = []; // list of products ID to sell
|
||||||
$scope.activeSelling = []; // list of products to sell
|
$scope.activeSelling = []; // list of products to sell
|
||||||
$scope.activeFestival = { // an event where selling take place
|
$scope.activeFestival = { // an event where selling take place
|
||||||
id : null,
|
id: null,
|
||||||
name : "le festival",
|
name: "le festival",
|
||||||
dateCreation : new Date(),
|
dateCreation: new Date(),
|
||||||
chiffreAffaire: 0,
|
chiffreAffaire: 0,
|
||||||
clientsCount : 0,
|
clientsCount: 0,
|
||||||
commentaire : ""
|
commentaire: ""
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* get the sum of products prices
|
* get the sum of products prices
|
||||||
@ -166,28 +166,28 @@ angular
|
|||||||
$scope.sendForm = function () {
|
$scope.sendForm = function () {
|
||||||
console.log('$scope.sellingComment', this.sellingComment);
|
console.log('$scope.sellingComment', this.sellingComment);
|
||||||
let lesParams = {
|
let lesParams = {
|
||||||
paidByClient : this.paidAmount,
|
paidByClient: this.paidAmount,
|
||||||
sellingComment: this.sellingComment,
|
sellingComment: this.sellingComment,
|
||||||
activeSelling : this.activeSelling,
|
activeSelling: this.activeSelling,
|
||||||
activeFestival: this.activeFestival
|
activeFestival: this.activeFestival
|
||||||
};
|
};
|
||||||
$scope.recentSellings.push({
|
$scope.recentSellings.push({
|
||||||
id : this.recentId++,
|
id: this.recentId++,
|
||||||
amount : this.CurrentSellingTotal(),
|
amount: this.CurrentSellingTotal(),
|
||||||
paidAmount: this.paidAmount,
|
paidAmount: this.paidAmount,
|
||||||
products :
|
products:
|
||||||
angular
|
angular
|
||||||
.copy(this.activeSelling)
|
.copy(this.activeSelling)
|
||||||
});
|
});
|
||||||
console.log('$scope.recentSellings', this.recentSellings);
|
console.log('$scope.recentSellings', this.recentSellings);
|
||||||
$scope.lesParams = lesParams;
|
$scope.lesParams = lesParams;
|
||||||
$http({
|
$http({
|
||||||
method : 'POST',
|
method: 'POST',
|
||||||
url : 'add-selling',
|
url: 'add-selling',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
data : lesParams // pass in data as strings
|
data: lesParams // pass in data as strings
|
||||||
}).then(function (rep) {
|
}).then(function (rep) {
|
||||||
$scope.clearCurrentSelling();
|
$scope.clearCurrentSelling();
|
||||||
// if successful, bind success message to message
|
// if successful, bind success message to message
|
||||||
@ -209,15 +209,15 @@ angular
|
|||||||
|
|
||||||
$scope.sellingOk = false;
|
$scope.sellingOk = false;
|
||||||
$scope.tempMessage = {};
|
$scope.tempMessage = {};
|
||||||
$scope.showTemporaryMessage = function(){
|
$scope.showTemporaryMessage = function () {
|
||||||
if($scope.sellingOk ){
|
if ($scope.sellingOk) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.sellingOk = true;
|
$scope.sellingOk = true;
|
||||||
$timeout.cancel($scope.tempMessage );
|
$timeout.cancel($scope.tempMessage);
|
||||||
$scope.tempMessage = $timeout(function(){
|
$scope.tempMessage = $timeout(function () {
|
||||||
$scope.sellingOk=false;
|
$scope.sellingOk = false;
|
||||||
},2000)
|
}, 2000)
|
||||||
};
|
};
|
||||||
$scope.init = (function () {
|
$scope.init = (function () {
|
||||||
$scope.fetchProductsFromDB();
|
$scope.fetchProductsFromDB();
|
||||||
@ -227,39 +227,39 @@ angular
|
|||||||
|
|
||||||
|
|
||||||
let exampleExpenses = [
|
let exampleExpenses = [
|
||||||
{name: "appart", amount: 600},
|
{name: "appart", amount: 600, delay: 0, repeat: 60},
|
||||||
{name: "assurance voiture", amount: 50},
|
{name: "assurance voiture", amount: 50, delay: 0, repeat: 60},
|
||||||
{name: "internet", amount: 20},
|
{name: "internet", amount: 20, delay: 0, repeat: 60},
|
||||||
{name: "elec", amount: 100},
|
{name: "elec", amount: 100, delay: 0, repeat: 60},
|
||||||
{name: "transports", amount: 70},
|
{name: "transports", amount: 70, delay: 0, repeat: 60},
|
||||||
{name: "chat", amount: 20},
|
{name: "chat", amount: 20, delay: 0, repeat: 60},
|
||||||
];
|
];
|
||||||
/**
|
/**
|
||||||
* expenses kind of the user
|
* expenses kind of the user
|
||||||
* @type {Array}
|
* @type {Array}
|
||||||
*/
|
*/
|
||||||
$scope.disponibility=5000;
|
$scope.disponibility = 5000;
|
||||||
// $scope.expenses=[];
|
// $scope.expenses=[];
|
||||||
$scope.expenses=exampleExpenses;
|
$scope.expenses = exampleExpenses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sum of all monthly expenses, ignoring delay
|
* sum of all monthly expenses, ignoring delay
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
$scope.sumMonthlyExpenses = ()=>{
|
$scope.sumMonthlyExpenses = () => {
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
$scope.expenses.forEach((elem)=>{
|
$scope.expenses.forEach((elem) => {
|
||||||
sum += elem.amount;
|
sum += elem.amount;
|
||||||
})
|
})
|
||||||
return sum;
|
return sum;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.previsionTable = ()=>{
|
$scope.previsionTable = () => {
|
||||||
let turns = 60;
|
let turns = 60;
|
||||||
let monthly = $scope.sumMonthlyExpenses();
|
let monthly = $scope.sumMonthlyExpenses();
|
||||||
let available = $scope.disponibility;
|
let available = $scope.disponibility;
|
||||||
let previsionTable=[];
|
let previsionTable = [];
|
||||||
for (let i=0;i<=turns;i++){
|
for (let i = 0; i <= turns; i++) {
|
||||||
// TODO take in account delays in expenses
|
// TODO take in account delays in expenses
|
||||||
let newLine = {
|
let newLine = {
|
||||||
expense: monthly,
|
expense: monthly,
|
||||||
@ -271,18 +271,26 @@ angular
|
|||||||
};
|
};
|
||||||
|
|
||||||
// http related calls
|
// http related calls
|
||||||
$scope.fetchExpenses = ()=>{
|
$scope.fetchExpenses = () => {
|
||||||
console.log('fetch expenses...');
|
console.log('fetch expenses...');
|
||||||
$http.get('get-my-expenses').then((rep) => {
|
$http.get('get-my-expenses').then((rep) => {
|
||||||
console.log('get-my-expenses',rep);
|
console.log('get-my-expenses', rep);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
// save
|
// save
|
||||||
$scope.save = ()=>{
|
$scope.save = () => {
|
||||||
console.log('update expenses...');
|
console.log('update expenses...');
|
||||||
$http.post('save-my-expenses', $scope.expenses)
|
$http.post('save-my-expenses', $scope.expenses)
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
console.log('save-my-expenses',rep);
|
console.log('save-my-expenses', rep);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
$scope.addExpense = () => {
|
||||||
|
$scope.expenses.push({
|
||||||
|
name: "",
|
||||||
|
repeat: 0,
|
||||||
|
delay: 0,
|
||||||
|
amount: 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
0
crowdin.yml
Normal file → Executable file
0
crowdin.yml
Normal file → Executable file
0
src/AppBundle/Entity/ExpenseKind.php
Normal file → Executable file
0
src/AppBundle/Entity/ExpenseKind.php
Normal file → Executable file
0
src/AppBundle/Entity/SerieFestival.php
Normal file → Executable file
0
src/AppBundle/Entity/SerieFestival.php
Normal file → Executable file
0
src/AppBundle/Repository/ExpenseKindRepository.php
Normal file → Executable file
0
src/AppBundle/Repository/ExpenseKindRepository.php
Normal file → Executable file
0
translations/de
Normal file → Executable file
0
translations/de
Normal file → Executable file
0
translations/en
Normal file → Executable file
0
translations/en
Normal file → Executable file
Loading…
Reference in New Issue
Block a user