month preview no money and enable lines
This commit is contained in:
parent
70ad259885
commit
7a3171c15f
|
@ -25,6 +25,12 @@
|
|||
<input type="number" ng-model="config.averageMonthlyEarnings">
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
Gérer délais
|
||||
<input type="checkbox" ng-model="config.showDelays">
|
||||
Gérer répétitions
|
||||
<input type="checkbox" ng-model="config.showRepeats">
|
||||
</p>
|
||||
|
||||
<strong>
|
||||
Dépenses mensuelles: {{ sumMonthlyExpenses() }} €
|
||||
|
@ -55,13 +61,13 @@
|
|||
<td class="padded" >
|
||||
Nom
|
||||
</td>
|
||||
<td class="padded" >
|
||||
<td class="padded" ng-if="config.showDelays">
|
||||
débute dans X mois
|
||||
</td>
|
||||
<td class="padded" >
|
||||
<td class="padded" ng-if="config.showRepeats">
|
||||
mois répétitions
|
||||
</td>
|
||||
<td class="padded" >
|
||||
<td class="padded" ng-if="config.showRepeats">
|
||||
prix répétitions
|
||||
</td>
|
||||
<td class="padded" >
|
||||
|
@ -83,14 +89,14 @@
|
|||
<td>
|
||||
<input type="text" ng-model="e.name">
|
||||
</td>
|
||||
<td>
|
||||
<td ng-if="config.showDelays">
|
||||
|
||||
<input type="number" ng-model="e.delay">
|
||||
</td>
|
||||
<td>
|
||||
<td ng-if="config.showRepeats">
|
||||
<input type="number" ng-model="e.repeat">
|
||||
</td>
|
||||
<td class="text-right padded">
|
||||
<td ng-if="config.showRepeats" class="text-right padded">
|
||||
{{ e.repeat * e.amount }}
|
||||
</td>
|
||||
<td>
|
||||
|
@ -146,6 +152,9 @@
|
|||
<div class="col-5 col-xs-12 col-sm-5">
|
||||
|
||||
<h2>Simulation sur {{config.lines}} mois</h2>
|
||||
<div class="well" ng-if="config.monthsBeforeNoMoney < config.lines">
|
||||
Ce sera la dèche dans {{config.monthsBeforeNoMoney}} mois
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr >
|
||||
|
|
|
@ -232,7 +232,10 @@ angular
|
|||
*/
|
||||
disponibility: 5000,
|
||||
averageMonthlyEarnings: 600,
|
||||
warningThershold: 2000
|
||||
warningThershold: 2000,
|
||||
showDelays: false,
|
||||
showRepeats: false,
|
||||
monthsBeforeNoMoney: null,
|
||||
};
|
||||
|
||||
let exampleExpenses = [
|
||||
|
@ -266,6 +269,7 @@ angular
|
|||
let monthly = $scope.sumMonthlyExpenses();
|
||||
let available = $scope.config.disponibility;
|
||||
let previsionTable = [];
|
||||
let changedNoMoneyConfig = false;
|
||||
for (let i = 0; i <= turns; i++) {
|
||||
// TODO take in account delays in expenses
|
||||
available = available - monthly + $scope.config.averageMonthlyEarnings;
|
||||
|
@ -273,6 +277,10 @@ angular
|
|||
expense: monthly,
|
||||
available: available,
|
||||
};
|
||||
if (available <= 0 && !changedNoMoneyConfig) {
|
||||
$scope.config.monthsBeforeNoMoney = i;
|
||||
changedNoMoneyConfig = true;
|
||||
}
|
||||
previsionTable.push(newLine);
|
||||
}
|
||||
return previsionTable;
|
||||
|
|
Loading…
Reference in New Issue