fix update after add selling
This commit is contained in:
parent
af4c5415dd
commit
f2ac806dc1
@ -1,11 +1,13 @@
|
|||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
<div class="current-selling">
|
<div class="current-selling">
|
||||||
|
|
||||||
<form action="#container">
|
<form >
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
|
|
||||||
Festival:
|
Festival:
|
||||||
<span class="badge badge-success">{{ activeFestival.chiffreAffaire }} €</span>
|
<span class="badge badge-success">{{ activeFestival.chiffreAffaire }} €</span>
|
||||||
|
<span class="badge badge-success">{{ activeFestival.clientsCount }} <i class="fa fa-user"></i></span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
|
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
|
||||||
@ -80,6 +82,7 @@
|
|||||||
<!--</button>-->
|
<!--</button>-->
|
||||||
<!--</div>-->
|
<!--</div>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<button class="btn btn-primary btn-block" id="validate_selling" ng-click="sendForm()"
|
<button class="btn btn-primary btn-block" id="validate_selling" ng-click="sendForm(event)"
|
||||||
ng-disabled="!paidAmount">
|
ng-disabled="!paidAmount">
|
||||||
<i class="fa fa-check"></i>
|
<i class="fa fa-check"></i>
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ angular
|
|||||||
name : "le festival",
|
name : "le festival",
|
||||||
dateCreation : new Date(),
|
dateCreation : new Date(),
|
||||||
chiffreAffaire: 0,
|
chiffreAffaire: 0,
|
||||||
|
clientsCount : 0,
|
||||||
commentaire : ""
|
commentaire : ""
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -92,6 +93,7 @@ angular
|
|||||||
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
||||||
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
||||||
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
||||||
|
$scope.activeFestival.clientsCount = rep.data.lastFestival.clientsCount;
|
||||||
//done
|
//done
|
||||||
$scope.initLoadDone = true;
|
$scope.initLoadDone = true;
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
@ -103,7 +105,7 @@ angular
|
|||||||
$scope.sendForm = function () {
|
$scope.sendForm = function () {
|
||||||
let lesParams = {
|
let lesParams = {
|
||||||
paidByClient : $scope.paidAmount,
|
paidByClient : $scope.paidAmount,
|
||||||
sellingComment: $scope.sellingComment,
|
sellingComment: angular.copy($scope.sellingComment),
|
||||||
activeSelling : $scope.activeSelling,
|
activeSelling : $scope.activeSelling,
|
||||||
activeFestival: $scope.activeFestival
|
activeFestival: $scope.activeFestival
|
||||||
};
|
};
|
||||||
@ -117,16 +119,14 @@ angular
|
|||||||
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
|
||||||
|
$scope.successMessage = rep.data.message;
|
||||||
|
$scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire;
|
||||||
|
$scope.activeFestival.clientsCount = rep.data.clientsCount;
|
||||||
console.log(rep);
|
console.log(rep);
|
||||||
if (!rep.success) {
|
if (!rep.success) {
|
||||||
// if not successful, bind errors to error variables
|
// if not successful, bind errors to error variables
|
||||||
$scope.errors = rep.errors;
|
$scope.errors = rep.errors;
|
||||||
} else {
|
|
||||||
// if successful, bind success message to message
|
|
||||||
$scope.successMessage = rep.data.message;
|
|
||||||
$scope.activeFestival.chiffreAffaire = rep.data.new_ca_festival;
|
|
||||||
// changer le type de bout de phrase demandé
|
|
||||||
$scope.formData["tykayn_portfoliobundle_cadexqphrasepart[type]"]["$viewValue"] = 'nouveauType';
|
|
||||||
}
|
}
|
||||||
}, function (rep) {
|
}, function (rep) {
|
||||||
console.log('nope! ', rep.data);
|
console.log('nope! ', rep.data);
|
||||||
|
@ -155,6 +155,7 @@ class DefaultController extends Controller {
|
|||||||
'commentaire' => $activeFestival->getComment(),
|
'commentaire' => $activeFestival->getComment(),
|
||||||
'dateCreation' => $activeFestival->getDateCreation(),
|
'dateCreation' => $activeFestival->getDateCreation(),
|
||||||
'chiffreAffaire' => $activeFestival->getChiffreAffaire(),
|
'chiffreAffaire' => $activeFestival->getChiffreAffaire(),
|
||||||
|
'clientsCount' => count( $activeFestival->getSellRecords() ),
|
||||||
'fondDeCaisseAvant' => $activeFestival->getFondDeCaisseAvant(),
|
'fondDeCaisseAvant' => $activeFestival->getFondDeCaisseAvant(),
|
||||||
'fondDeCaisseApres' => $activeFestival->getFondDeCaisseApres(),
|
'fondDeCaisseApres' => $activeFestival->getFondDeCaisseApres(),
|
||||||
],
|
],
|
||||||
@ -212,8 +213,8 @@ class DefaultController extends Controller {
|
|||||||
$newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
|
$newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
|
||||||
$newSellRecord->setComment( $json[ 'sellingComment' ] );
|
$newSellRecord->setComment( $json[ 'sellingComment' ] );
|
||||||
|
|
||||||
$festivalFound->recalculateChiffreAffaire();
|
|
||||||
|
|
||||||
|
$festivalFound->addSellRecord( $newSellRecord );
|
||||||
$currentUser->addSellRecords( $newSellRecord );
|
$currentUser->addSellRecords( $newSellRecord );
|
||||||
|
|
||||||
$m->persist( $newSellRecord );
|
$m->persist( $newSellRecord );
|
||||||
@ -221,6 +222,10 @@ class DefaultController extends Controller {
|
|||||||
$m->persist( $festivalFound );
|
$m->persist( $festivalFound );
|
||||||
$m->flush();
|
$m->flush();
|
||||||
|
|
||||||
|
$festivalFound->recalculateChiffreAffaire();
|
||||||
|
$m->persist( $festivalFound );
|
||||||
|
$m->flush();
|
||||||
|
|
||||||
// setup dates
|
// setup dates
|
||||||
|
|
||||||
// fetch back history of selling
|
// fetch back history of selling
|
||||||
@ -229,7 +234,8 @@ class DefaultController extends Controller {
|
|||||||
|
|
||||||
return new JsonResponse( [
|
return new JsonResponse( [
|
||||||
"message" => "ok",
|
"message" => "ok",
|
||||||
"new_ca_festival" => $festivalFound->getChiffreAffaire(),
|
"newChiffreAffaire" => $festivalFound->getChiffreAffaire(),
|
||||||
|
"clientsCount" => count( $festivalFound->getSellRecords() ),
|
||||||
"recent_sellings" => json_encode( $lastSellings ),
|
"recent_sellings" => json_encode( $lastSellings ),
|
||||||
"dump" => $json,
|
"dump" => $json,
|
||||||
], 200 );
|
], 200 );
|
||||||
|
Loading…
Reference in New Issue
Block a user