hopla$
This commit is contained in:
parent
2f16a34aa4
commit
af4c5415dd
@ -8,7 +8,9 @@
|
||||
Votre caisse mobile dynamique en ligne
|
||||
</div>
|
||||
<div class="try">
|
||||
<a class="btn btn-primary" href="{{ path('dashboard') }}" class="btn btn-primary">Essayez dès maintenant</a>
|
||||
<a class="btn btn-primary" href="{{ path('fos_user_security_login') }}" class="btn btn-primary">Essayez dès
|
||||
maintenant
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'default/description-app.html.twig' %}
|
||||
@ -26,7 +28,6 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
|
||||
<a class="btn btn-primary" href="{{ path('fos_user_registration_register') }}">
|
||||
<i class="fa fa-user"></i>
|
||||
Créer un compte
|
||||
|
@ -1,10 +1,13 @@
|
||||
{% verbatim %}
|
||||
<div class="current-selling">
|
||||
|
||||
<form action="#">
|
||||
<form action="#container">
|
||||
<h2>
|
||||
|
||||
Festival:</h2>
|
||||
Festival:
|
||||
<span class="badge badge-success">{{ activeFestival.chiffreAffaire }} €</span>
|
||||
</h2>
|
||||
|
||||
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
|
||||
<input type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">
|
||||
<hr>
|
||||
@ -13,7 +16,8 @@
|
||||
<i class="fa fa-user"></i> Client actuel:
|
||||
</h2>
|
||||
{{ activeSelling.length }} produit<span ng-if="activeSelling.length>1">s</span>
|
||||
<input class="input input-lg" type="text" ng-model="sellingComment" placeholder="nom ou commentaire">
|
||||
<input id="sellingComment" name="sellingComment" class="input input-lg" type="text" ng-model="sellingComment" placeholder="nom ou commentaire">
|
||||
{{ sellingComment }}
|
||||
<hr>
|
||||
<ul>
|
||||
<li ng-repeat="p in activeSelling track by $index">
|
||||
|
@ -5,7 +5,7 @@ angular
|
||||
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
|
||||
$scope.productsFromDB = []; // loaded products
|
||||
$scope.categories = []; // product categories
|
||||
$scope.sellingComment = ""; // comment about the client or the current selling
|
||||
$scope.sellingComment = "un gens"; // comment about the client or the current selling
|
||||
$scope.initLoadDone = false; // becames true after first init of product loading
|
||||
$scope.recentSellings = [];
|
||||
$scope.lesParams = {};
|
||||
@ -17,6 +17,7 @@ angular
|
||||
id : null,
|
||||
name : "le festival",
|
||||
dateCreation : new Date(),
|
||||
chiffreAffaire: 0,
|
||||
commentaire : ""
|
||||
};
|
||||
/**
|
||||
@ -42,9 +43,11 @@ angular
|
||||
|
||||
$scope.regenActiveSellingIds = function () {
|
||||
$scope.activeItemsSold = [];
|
||||
$scope.paidAmount = 0;
|
||||
for (let obj in $scope.activeSelling) {
|
||||
$scope.activeItemsSold.push(obj.id);
|
||||
}
|
||||
$scope.paidAmount += $scope.sumOfList($scope.activeSelling);
|
||||
};
|
||||
$scope.stuff = stuff;
|
||||
$scope.setActiveSelling = function (selling) {
|
||||
@ -56,6 +59,9 @@ angular
|
||||
$scope.addProduct = function (product) {
|
||||
$scope.activeSelling.push(product);
|
||||
$scope.activeItemsSold.push(product.id);
|
||||
$scope.regenActiveSellingIds();
|
||||
document.querySelector('#sellingComment').focus()
|
||||
|
||||
};
|
||||
$scope.pauseSelling = function () {
|
||||
$scope.pausedSelling.push(angular.copy($scope.activeSelling));
|
||||
@ -85,6 +91,7 @@ angular
|
||||
$scope.activeFestival.name = rep.data.lastFestival.name;
|
||||
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
||||
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
||||
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
||||
//done
|
||||
$scope.initLoadDone = true;
|
||||
}, (err) => {
|
||||
@ -117,6 +124,7 @@ angular
|
||||
} 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';
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ class DefaultController extends Controller {
|
||||
0,
|
||||
1 );
|
||||
}
|
||||
$lastFestival->recalculateChiffreAffaire();
|
||||
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
|
||||
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
|
||||
$categories = $categRepo->findAll();
|
||||
@ -153,6 +154,7 @@ class DefaultController extends Controller {
|
||||
'name' => $activeFestival->getName(),
|
||||
'commentaire' => $activeFestival->getComment(),
|
||||
'dateCreation' => $activeFestival->getDateCreation(),
|
||||
'chiffreAffaire' => $activeFestival->getChiffreAffaire(),
|
||||
'fondDeCaisseAvant' => $activeFestival->getFondDeCaisseAvant(),
|
||||
'fondDeCaisseApres' => $activeFestival->getFondDeCaisseApres(),
|
||||
],
|
||||
@ -210,10 +212,13 @@ class DefaultController extends Controller {
|
||||
$newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
|
||||
$newSellRecord->setComment( $json[ 'sellingComment' ] );
|
||||
|
||||
$festivalFound->recalculateChiffreAffaire();
|
||||
|
||||
$currentUser->addSellRecords( $newSellRecord );
|
||||
|
||||
$m->persist( $newSellRecord );
|
||||
$m->persist( $currentUser );
|
||||
$m->persist( $festivalFound );
|
||||
$m->flush();
|
||||
|
||||
// setup dates
|
||||
@ -224,6 +229,7 @@ class DefaultController extends Controller {
|
||||
|
||||
return new JsonResponse( [
|
||||
"message" => "ok",
|
||||
"new_ca_festival" => $festivalFound->getChiffreAffaire(),
|
||||
"recent_sellings" => json_encode( $lastSellings ),
|
||||
"dump" => $json,
|
||||
], 200 );
|
||||
|
@ -66,6 +66,19 @@ class Festival {
|
||||
*/
|
||||
private $chiffreAffaire;
|
||||
|
||||
|
||||
public function recalculateChiffreAffaire() {
|
||||
$sellings = $this->getSellRecords();
|
||||
$newChiffreAffaire = 0;
|
||||
foreach ( $sellings as $selling ) {
|
||||
$newChiffreAffaire += $selling->getAmount();
|
||||
}
|
||||
|
||||
$this->setChiffreAffaire( $newChiffreAffaire );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user