@@ -14,7 +14,8 @@
Configuration
Euros disponibles au départ:
-
+
+ Dépenses mensuelles: {{ sumMonthlyExpenses }}
Postes de dépenses
@@ -48,24 +49,46 @@
-
+
-
+ {{ e.name }}
+ |
+
+ {{ e.delay }}débute dans X mois
+ |
+
+ {{ e.repeat }}
+ |
+
+ {{ e.repeat * e.amount }}
+ |
+
+ {{ e.amount }}
+ |
+
+ {{ e.amount * 12 }}
|
- Exemple:
+
+ Exemples:
+
appartement
- resto au boulot
- courses
+ mutuelle
+ transport en commun
+ assurance voiture
+ assurance moto
trucs de loisirs divers
gaz
elec
internet
+ épargne
+ impots
+ cottisation URSSAF
+ resto au boulot
+ courses
serveur wouaibe
- assurance voiture
- transport en commun
abonnement protonmail VPN
abonnement service audio, vidéo
carburant véhicule
@@ -82,12 +105,36 @@
Simulation sur 5 ans (60 mois)
-
-
-
+
+ Month in the future
+ |
+
+ date
+ |
+
+ Dépenses
+ |
+
+ Disponibilité
+ |
+
+
+
+
+
+ {{ $index }}
+ |
+
+ -
+ |
+ {{ line.expense }}
+ |
+
+
+ {{ line.available }}
|
diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js
index 1821cc14..7dfa4989 100755
--- a/assets/js/parts/main.js
+++ b/assets/js/parts/main.js
@@ -226,11 +226,63 @@ angular
.controller('previsionnelCtrl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) {
+ let exampleExpenses = [
+ {name: "appart", amount: 600},
+ {name: "assurance voiture", amount: 50},
+ {name: "internet", amount: 20},
+ {name: "elec", amount: 100},
+ {name: "transports", amount: 70},
+ {name: "chat", amount: 20},
+ ];
+ /**
+ * expenses kind of the user
+ * @type {Array}
+ */
+ $scope.disponibility=5000;
+ // $scope.expenses=[];
+ $scope.expenses=exampleExpenses;
+
+ /**
+ * sum of all monthly expenses, ignoring delay
+ * @returns {number}
+ */
+ $scope.sumMonthlyExpenses = ()=>{
+ let sum = 0;
+ $scope.expenses.forEach((elem)=>{
+ sum += elem.amount;
+ })
+ return sum;
+ };
+
+ $scope.previsionTable = ()=>{
+ let turns = 60;
+ let monthly = $scope.sumMonthlyExpenses();
+ let available = $scope.disponibility;
+ let previsionTable=[];
+ for (let i=0;i<=turns;i++){
+ // TODO take in account delays in expenses
+ let newLine = {
+ expense: monthly,
+ available: available - monthly,
+ };
+ previsionTable.push(newLine);
+ }
+ return previsionTable;
+ };
+
// http related calls
- $scope.fetchProductsFromDB = function () {
- console.log('fetch products...');
+ $scope.fetchExpenses = ()=>{
+ console.log('fetch expenses...');
$http.get('get-my-expenses').then((rep) => {
console.log('get-my-expenses',rep);
})
- }
+ };
+ // save
+ $scope.save = ()=>{
+ console.log('update expenses...');
+ $http.post('save-my-expenses', $scope.expenses)
+ .then((rep) => {
+ console.log('save-my-expenses',rep);
+ })
+ };
}]);
diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php
index a6ad2758..f75480c6 100755
--- a/src/AppBundle/Controller/DefaultController.php
+++ b/src/AppBundle/Controller/DefaultController.php
@@ -424,6 +424,21 @@ class DefaultController extends Controller
]);
}
+ /**
+ * @Route("/previsionnel", name="previsionnel")
+ */
+ public function previsionnelAction()
+ {
+// $currentUser = $this->getUser();
+// $m = $this->getDoctrine()->getManager();
+// $sellingRepo = $m->getRepository('AppBundle:SellRecord');
+
+ return $this->render('logged/previsionnel.html.twig',
+ [
+ 'base_dir' => '',
+ ]);
+ }
+
/**
* import lots of products at once
* @Route("/mass-create", name="mass_create")