diff --git a/app/Resources/views/logged/angular/current.html.twig b/app/Resources/views/logged/angular/current.html.twig index ae5d4500..a4998456 100644 --- a/app/Resources/views/logged/angular/current.html.twig +++ b/app/Resources/views/logged/angular/current.html.twig @@ -31,13 +31,27 @@
-

Total: {{ CurrentSellingTotal() }}€

- -
-

Rendu: {{ CurrentSellingTotal() - paidAmount }}€

+
+
+

Total:

+
+
+ {{ CurrentSellingTotal() }}€
-
-

il manque: {{ CurrentSellingTotal() - paidAmount }}€

+
+
+
+ Le client paie: +
+
+ +
+
+
+

Rendu: {{ -1*(CurrentSellingTotal() - paidAmount) }} €

+
+
+

il manque: {{ CurrentSellingTotal() - paidAmount }} €

diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index dcd13f39..a9e067c1 100644 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -68,19 +68,24 @@ angular $scope.pausedSelling.splice(index, 1); }; $scope.clearCurrentSelling = function () { + $scope.paidAmount = 0; $scope.commentaire = ""; $scope.activeSelling = []; }; $scope.sendForm = function () { let lesParams = { + paidByClient : $scope.paidAmount, sellingComment: $scope.commentaire, activeSelling : $scope.activeSelling, activeFestival: $scope.activeFestival }; $http({ - method: 'POST', - url : '/add-selling', - data : lesParams // pass in data as strings + method : 'POST', + url : 'add-selling', + headers: { + 'Content-Type': 'application/json' + }, + data : lesParams // pass in data as strings }).then(function (rep) { console.log(rep); if (!rep.success) { diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php index 7d359b51..c5eb96e1 100644 --- a/src/AppBundle/Controller/DefaultController.php +++ b/src/AppBundle/Controller/DefaultController.php @@ -124,6 +124,18 @@ class DefaultController extends Controller { // setup dates // persist all // fetch back history of selling - return new JsonResponse( [ "message" => "ok", "dump" => $request->request ] ); + echo "
";
+		var_dump( $_POST );
+
+		echo "
"; + + return var_dump( $request->request ); +// return new JsonResponse( [ +// "message" => "ok", +// "recent_sellings" => [], +// "dump" => $request->request->get( 'sellingComment' ), +// "dump2" => $request->getMethod(), +// "dump3" => $request->request->get( 'data' ), +// ] ); } } diff --git a/src/AppBundle/Entity/SellRecord.php b/src/AppBundle/Entity/SellRecord.php index 23673be1..166681d7 100644 --- a/src/AppBundle/Entity/SellRecord.php +++ b/src/AppBundle/Entity/SellRecord.php @@ -32,9 +32,14 @@ class SellRecord { /** * total - * @ORM\Column(type="decimal", scale=2, nullable=true) + * @ORM\Column(type="decimal", scale=2, nullable=false) */ private $amount; + /** + * amount paid by client + * @ORM\Column(type="decimal", scale=2, nullable=true) + */ + private $paidByClient; /** * @var @@ -49,6 +54,20 @@ class SellRecord { private $user; + /** + * @return mixed + */ + public function getPaidByClient() { + return $this->paidByClient; + } + + /** + * @param mixed $paidByClient + */ + public function setPaidByClient( $paidByClient ) { + $this->paidByClient = $paidByClient; + } + /** * @return mixed */