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