up to sf 7

This commit is contained in:
Tykayn 2025-02-09 16:45:35 +01:00 committed by tykayn
parent a39b6239b0
commit 501795a8fa
16586 changed files with 19384005 additions and 0 deletions

22
v1/old/.gitignore vendored Executable file
View file

@ -0,0 +1,22 @@
/.web-server-pid
/app/config/parameters.yml
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/.idea/
/web/build/
/node_modules/
/yarn-error.log
caisse-bliss-frontend

16
v1/old/.gitlab-ci.yml Executable file
View file

@ -0,0 +1,16 @@
code_quality:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [gl-code-quality-report.json]

3
v1/old/.gitmodules vendored Executable file
View file

@ -0,0 +1,3 @@
[submodule "caisse-bliss-frontend"]
path = caisse-bliss-frontend
url = https://framagit.org/tykayn/caisse-bliss-frontend.git

View file

@ -0,0 +1,648 @@
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\ExpenseKind;
use AppBundle\Entity\Product;
use AppBundle\Entity\ProductCategory;
use AppBundle\Entity\ProductSold;
use AppBundle\Entity\SellRecord;
use AppBundle\Service\OwnerService;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
class DefaultController extends Controller {
private $ownerService;
private $tokenManager;
public function __construct( CsrfTokenManagerInterface $tokenManager = null, OwnerService $ownerService ) {
$this->tokenManager = $tokenManager;
$this->ownerService = $ownerService;
}
/**
* @Route("/", name="homepage")
*/
public function indexAction( Request $request ) {
$m = $this->getDoctrine()->getManager();
$userRepo = $m->getRepository( 'AppBundle:User' );
$allUsers = $userRepo->findAll();
// replace this example code with whatever you need
return $this->render( 'default/index.html.twig',
[
'usersCount' => count( $allUsers ),
'base_dir' => realpath( $this->getParameter( 'kernel.project_dir' ) ) . DIRECTORY_SEPARATOR,
] );
}
/**
* @Route("/dashboard", name="dashboard")
*/
public function dashboardAction( Request $request ) {
$m = $this->getDoctrine()->getManager();
$currentUser = $this->getUser();
// TODO on first login set default values
$lastFestival = $currentUser->getActiveFestival();
if ( ! $lastFestival ) {
$lastFestival = $m->getRepository( 'AppBundle:Festival' )
->findOneBy( [ 'user' => $this->getUser()->getId() ],
[ 'id' => 'desc' ],
0,
1 );
}
if ( $lastFestival ) {
$lastFestival->recalculateChiffreAffaire();
}
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$categories = $categRepo->findAll();
$recentSells = $sellingRepo->findBy( [ 'user' => $currentUser->getId() ], [ 'id' => 'desc' ], 0, 5 );
return $this->render( 'logged/dashboard.html.twig',
[
'lastFestival' => $lastFestival,
'categories' => $categories,
'currentUser' => $currentUser,
'recentSells' => $recentSells,
'base_dir' => realpath( $this->getParameter( 'kernel.project_dir' ) ) . DIRECTORY_SEPARATOR,
] );
}
/**
* envoyer un email
*/
public function emailAction() {
$name = "noble barbare";
$message = \Swift_Message::newInstance()
->setSubject( 'Hello Email' )
->setFrom( 'test-symfony-tykayn@caisse.ciperbliss.com' )
->setTo( 'tykayn@gmail.com' )
->setBody( $this->renderView( 'default/test-email.html.twig' ),
'text/html' );
$this->get( 'mailer' )->send( $message );
//return 'yay test de mail';
return $this->render(
'default/test-email.html.twig',
[
]
);
}
/**
* get user products
* @return JsonResponse
*/
public function getMyProductsAction() {
$m = $this->getDoctrine()->getManager();
$currentUser = $this->getUser();
if ( ! $currentUser ) {
return new JsonResponse( [
'categories' => [ [] ],
'recentSells' => [ [ '' ] ],
] );
}
$ownerService = $this->ownerService;
$ownerService->setupNewFestival( $currentUser );
$activeFestival = $currentUser->getActiveFestival();
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$categories = $ownerService->serializeCategoriesOfUser( $currentUser );
$recentSells = $sellingRepo->findBy( [ 'user' => $currentUser->getId() ], [ 'id' => 'desc' ], 0, 5 );
return new JsonResponse( [
'categories' => $categories,
'recentSells' => count( $recentSells ),
'lastFestival' => $activeFestival->makeArray(),
] );
}
/**
* get user expenses
* @return JsonResponse
*/
public function getMyExpensesAction() {
$m = $this->getDoctrine()->getManager();
$currentUser = $this->getUser();
if ( ! $currentUser ) {
return new JsonResponse( [
'expenses' => [ [] ],
] );
}
$ownerService = $this->ownerService;
$ownerService->setupNewFestival( $currentUser );
$expensesOfUser = $ownerService->serializeExpensesOfUser( $currentUser );
return new JsonResponse( [
'expenses' => $expensesOfUser,
'disponibility' => $currentUser->getDisponibility(),
'averageMonthlyEarnings' => $currentUser->getAverageMonthlyEarnings(),
] );
}
/**
* recieve the json containing the expanse config of a user
*
* @param Request $request
*
* @return JsonResponse the list of expanses
*/
public function saveMyExpensesAction( Request $request ) {
$json = json_decode( $request->getContent(), true );
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$myExpenses = $currentUser->getExpenses();
$categoriesByID = [];
foreach ( $myExpenses as $expense ) {
$categoriesByID[ $expense->getId() ] = $expense;
}
// loop on the json config for expanse
// save the user configuration
foreach ( $json[ 'expenses' ] as $expens ) {
if ( isset( $expens[ 'id' ] ) ) {
$foundExpense = $categoriesByID[ $expens[ 'id' ] ];
if ( $foundExpense ) {
// update existing expenses of logged in user
$foundExpense->setName( $expens[ 'name' ] );
$foundExpense->setAmount( $expens[ 'amount' ] );
$foundExpense->setDelay( $expens[ 'delay' ] );
$foundExpense->setRepeatitions( $expens[ 'repeat' ] );
$foundExpense->setEnabled( $expens[ 'enabled' ] );
$m->persist( $foundExpense );
}
} else {
// create new expense for user
$newExpense = new ExpenseKind();
$newExpense->setUser( $currentUser );
$newExpense->setName( $expens[ 'name' ] );
$newExpense->setDelay( $expens[ 'delay' ] );
$newExpense->setAmount( $expens[ 'amount' ] );
$newExpense->setRepeatitions( $expens[ 'repeat' ] );
$newExpense->setEnabled( $expens[ 'enabled' ] );
$m->persist( $newExpense );
}
}
$currentUser->setDisponibility( $json[ 'config' ][ 'disponibility' ] );
$currentUser->setAverageMonthlyEarnings( $json[ 'config' ][ 'averageMonthlyEarnings' ] );
$m->persist( $currentUser );
$m->flush();
$ownerService = $this->ownerService;
$expensesOfUser = $ownerService->serializeExpensesOfUser( $currentUser );
return new JsonResponse( [
'expenses' => $expensesOfUser,
'disponibility' => $currentUser->getDisponibility(),
'averageMonthlyEarnings' => $currentUser->getAverageMonthlyEarnings(),
] );
}
/**
* @param Request $request
* add a selling record corresponding to one client
*
* @return JsonResponse
*/
public function addSellingAction( Request $request ) {
$json = json_decode( $request->getContent(), true );
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$newSellRecord = new SellRecord();
// sort user categories
$myCategories = $currentUser->getCategories();
$categoriesByID = [];
foreach ( $myCategories as $my_category ) {
$categoriesByID[ $my_category->getId() ] = $my_category;
}
$productsModels = $m->getRepository( 'AppBundle:Product' )->findAll();
$productsModelsByID = [];
foreach ( $productsModels as $product ) {
$productsModelsByID[ $product->getId() ] = $product;
}
$sumAmount = 0;
foreach ( $json[ 'activeSelling' ] as $record ) {
$productModel = $productsModelsByID[ $record[ 'id' ] ];
$newProductSold = new ProductSold();
$newProductSold->setName( $record[ 'name' ] );
$newProductSold->setImage( "image mock" );
$newProductSold->setUser( $currentUser );
$newProductSold->setPrice( $record[ 'price' ] );
$newProductSold->setComment( $json[ 'sellingComment' ] );
$newProductSold->setProduct( $productModel );
$newProductSold->setSellRecords( $newSellRecord );
// link selling record with user, festival
$currentUser->addProductsSold( $newProductSold );
// persist all
$productModel->setStockCount( $productModel->getStockCount() - 1 );
$m->persist( $productModel );
$m->persist( $newProductSold );
$m->persist( $newProductSold );
$sumAmount += $record[ 'price' ];
}
$festivalFound = $m->getRepository( 'AppBundle:Festival' )->find( $json[ 'activeFestival' ][ 'id' ] );
$newSellRecord->setFestival( $festivalFound );
$newSellRecord->setAmount( $sumAmount );
$newSellRecord->setDate( new \DateTime() );
$newSellRecord->setUser( $currentUser );
$newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
$newSellRecord->setComment( $json[ 'sellingComment' ] );
$festivalFound->addSellRecord( $newSellRecord );
$currentUser->addSellRecords( $newSellRecord );
$m->persist( $newSellRecord );
$m->persist( $currentUser );
$m->persist( $festivalFound );
$m->flush();
$festivalFound->recalculateChiffreAffaire();
$m->persist( $festivalFound );
$m->flush();
// setup dates
// fetch back history of selling
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$lastSellings = $sellingRepo->findBy( [ 'user' => $currentUser->getId() ], [ 'id' => 'desc' ], 0, 3 );
return new JsonResponse( [
"message" => "ok",
"activeFestival" => $festivalFound->makeArray(),
"newChiffreAffaire" => $festivalFound->getChiffreAffaire(),
"clientsCount" => count( $festivalFound->getSellRecords() ),
"recent_sellings" => json_encode( $lastSellings ),
"dump" => $json,
], 200 );
}
/**
* get the history of user's sellings
* @Route("/history", name="history")
*/
public function historyAction() {
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$allSellingList = $sellingRepo->findBy( [ 'user' => $currentUser->getId() ], [ 'id' => 'desc' ] );
$mySellings = array_splice( $allSellingList, 0, 15 );
$chiffreAffaires = 0;
$myFestivals = $currentUser->getFestivals();
$statisticsFestivals = [
];
foreach ( $myFestivals as $festival ) {
$statisticsFestivals[] = [
'date' => $festival->getDateCreation(),
'name' => $festival->getName(),
'clients_count' => count( $festival->getSellRecords() ),
'chiffreAffaire' => $festival->getChiffreAffaire(),
];
}
$statisticsSoldProducts = [
// ['name' => 'bidule', 'count' => 0, 'value' => 0],
];
$statsForFestivalMock = [
[ 'name' => 'festoche bidule', 'clients_count' => 125, 'chiffreAffaire' => 236, 'date' => new \DateTime() ],
];
foreach ( $allSellingList as $client ) {
foreach ( $client->getProductsSold() as $product ) {
$chiffreAffaires += $product->getPrice();
}
}
foreach ( $mySellings as $client ) {
foreach ( $client->getProductsSold() as $product ) {
$chiffreAffaires += $product->getPrice();
if ( ! isset( $statisticsSoldProducts[ $product->getName() ] ) ) {
$statisticsSoldProducts[ $product->getName() ] =
[
'name' => $product->getName(),
'count' => 0,
'value' => 0,
];
}
$statisticsSoldProducts[ $product->getName() ][ 'count' ] ++;
$statisticsSoldProducts[ $product->getName() ][ 'value' ] = $statisticsSoldProducts[ $product->getName() ][ 'value' ] + intval( $product->getPrice() );
}
}
return $this->render( 'logged/history.html.twig',
[
// 'statisticsFestivals' => $statsForFestivalMock, // mock of festival stats
'statisticsFestivals' => $statisticsFestivals,
'statisticsSoldProducts' => $statisticsSoldProducts,
'chiffreAffaires' => $chiffreAffaires,
'recentSells' => $mySellings,
'allSellings' => count( $mySellings ),
'base_dir' => realpath( $this->getParameter( 'kernel.project_dir' ) ) . DIRECTORY_SEPARATOR,
] );
}
/**
* export user data in JSON
* @return JsonResponse
* @Route("/logged/export-all-json", name="export_all_json")
*/
public function exportJsonAction() {
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$encoders = [ new XmlEncoder(), new JsonEncoder() ];
$normalizers = [ new ObjectNormalizer() ];
$serializer = new Serializer( $normalizers, $encoders );
$mySellings = $sellingRepo->findByUser( $currentUser->getId() );
$export = [
'export_version' => '1.0',
'user' => $serializer->normalize( $currentUser,
null,
[ 'attributes' => [ 'id', 'username', 'email', 'salt', 'password' ] ] ),
'products' => $serializer->normalize( $currentUser->getProducts(),
null,
[ 'attributes' => [ 'id', 'name', 'price' ] ] ),
'categories' => $serializer->normalize( $currentUser->getCategories(),
null,
[ 'attributes' => [ 'id', 'name' ] ] ),
'series_festivals' => $serializer->normalize( $currentUser->getSeriesFestivals(),
null, ['attributes'=> [
'id', 'name',
]]),
'festivals' => $serializer->normalize( $currentUser->getFestivals(),
null,
[ 'attributes' => [ 'id', 'name', 'chiffreAffaire','fraisInscription','fraisHebergement','fraisTransport','fraisRepas' ] ] ),
'sellings' => $serializer->normalize( $mySellings,
null,
[ 'attributes' => [ 'id', 'amount', 'paidByClient', 'comment', 'gender' ] ] ),
];
return new JsonResponse( $export );
}
/**
* export all clients
* @Route("/export-all", name="export_all")
*/
public function exportAllAction() {
// TODO
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$mySellings = $sellingRepo->findByUser( $currentUser->getId() );
$fileName = "export_caisse-cipherbliss_" . $currentUser->getUsername() . '_' . date( 'Y-m-d_H-i-s' );
$handle = fopen( 'php://memory', 'r+' );
$firstLine = [
'product sold id',
'date',
'hour',
'min',
'sec',
'client comment',
'client paid',
'product name',
'product image',
'product category id',
'product category name',
'product price',
'festival id',
'festival name',
'festival creation date',
'caisse before',
'caisse after',
'festival ca',
'festival comment',
];
// save the column headers
fputcsv( $handle,
$firstLine );
$chiffreAffaires = 0;
foreach ( $mySellings as $sellRecord ) {
foreach ( $sellRecord->getProductsSold() as $productSold ) {
$chiffreAffaires += $productSold->getPrice();
// add a line to the csv file
fputcsv( $handle,
[
$productSold->getId(),
$sellRecord->getDate()->format( 'c' ),
$sellRecord->getDate()->format( 'H' ),
$sellRecord->getDate()->format( 'i' ),
$sellRecord->getDate()->format( 's' ),
$sellRecord->getComment(),
$sellRecord->getPaidByClient(),
$productSold->getName(),
$productSold->getImage(),
$productSold->getProduct()->getCategory()->getId(),
$productSold->getProduct()->getCategory()->getName(),
$productSold->getPrice(),
] );
if ( $sellRecord->getFestival() ) {
fputcsv( $handle,
[
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
$sellRecord->getFestival()->getId(),
$sellRecord->getFestival()->getName(),
$sellRecord->getFestival()->getDateCreation()->format( 'c' ),
$sellRecord->getFestival()->getFondDeCaisseAvant(),
$sellRecord->getFestival()->getFondDeCaisseApres(),
$sellRecord->getFestival()->getChiffreAffaire(),
$sellRecord->getFestival()->getComment(),
] );
}
}
}
rewind( $handle );
$content = stream_get_contents( $handle );
fclose( $handle );
return new Response(
$content, 200, [
'Content-Type' => 'application/force-download',
'Content-Disposition' => 'attachment; filename="' . $fileName . '.csv"',
]
);
}
/**
* @Route("/set-active-festival/{id}", name="set_active_festival")
*/
public function setActiveFestivalAction( $id ) {
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$repo = $m->getRepository( 'AppBundle:Festival' );
$currentUser->setActiveFestival( $repo->find( $id ) );
$m->persist( $currentUser );
$m->flush();
// replace this example code with whatever you need
return $this->redirectToRoute( 'festival_index' );
}
/**
* @Route("/import", name="import")
*/
public function importAction() {
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
return $this->render( 'logged/import.html.twig',
[
'base_dir' => '',
] );
}
/**
* @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")
*/
public function massCreateAction( Request $request ) {
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$myCategories = $currentUser->getCategories();
$myCategoriesByName = [];
$myProductsByName = [];
$currentCategory = new ProductCategory();
$currentCategory
->addUser( $currentUser )
->setName( 'default category' );
foreach ( $myCategories as $my_category ) {
$myCategoriesByName [ $my_category->getName() ] = $my_category;
foreach ( $my_category->getProducts() as $product ) {
$myProductsByName[ $product->getName() ] = $product;
}
$currentCategory = $my_category;
}
$massLines = $request->request->get( 'produits' );
if ( $request->getMethod() == 'POST' ) {
$lines = preg_split( '/$\R?^/m', trim( $massLines ) );
foreach ( $lines as $line ) {
if ( strpos( $line, ':' ) ) {
// manage catgegories
$boom = explode( ':', trim( $line ) );
$firstPart = $boom[ 0 ];
$value = $boom[ 1 ];
if ( $firstPart === 'catégorie' && $value ) {
// look for category by name
if ( ! isset( $myCategoriesByName[ $value ] ) ) {
$newCateg = new ProductCategory();
$newCateg
->addUser( $currentUser )
->setName( $value );
$currentUser->addCategory( $newCateg );
$m->persist( $newCateg );
$currentCategory = $newCateg; // associate further categories with the newly created one
} else {
// echo " la catégorie existe déjà";
}
}
} else {
// manage product
$boom = explode( ';', $line );
$productName = $boom[ 0 ];
$price = 0;
if ( $boom[ 1 ] ) {
$price = intval( str_replace( '€', '', $boom[ 1 ] ) );// removing euro symbol
}
// or create new product
if ( $productName && ! isset( $myProductsByName[ $productName ] ) ) {
$newProduct = new Product();
$newProduct->setCategory( $currentCategory )
->setName( $productName )
->setStockCount( 500 )
->setUser( $currentUser )
->setPrice( $price );
$currentUser->addProduct( $newProduct );
$m->persist( $newProduct );
}// look for existing products
else {
$myProductsByName[ $productName ]->setPrice( $price );
}
}
$m->persist( $currentUser );
}
// check with existing categories and products, sort them by name.
// save all
$m->flush();
}
return $this->render( 'logged/import.html.twig',
[] );
}
}

View file

@ -0,0 +1,141 @@
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Festival;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* Festival controller.
*
* @Route("festival")
*/
class FestivalController extends Controller {
/**
* Lists all festival entities.
*
* @Route("/", name="festival_index")
* @Method("GET")
*/
public function indexAction() {
$festivals = $this->getUser()->getFestivals();
return $this->render( 'festival/index.html.twig',
[
'festivals' => $festivals,
] );
}
/**
* Creates a new festival entity.
*
* @Route("/new", name="festival_new")
* @Method({"GET", "POST"})
*/
public function newAction( Request $request ) {
$festival = new Festival();
$festival->setUser( $this->getUser() );
$festival->setDateCreation( new \DateTime() );
$form = $this->createForm( 'AppBundle\Form\FestivalType', $festival );
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
$em = $this->getDoctrine()->getManager();
$em->persist( $festival );
$em->persist( $this->getUser() );
$em->flush();
return $this->redirectToRoute( 'festival_show', [ 'id' => $festival->getId() ] );
}
return $this->render( 'festival/new.html.twig',
[
'festival' => $festival,
'form' => $form->createView(),
] );
}
/**
* Finds and displays a festival entity.
*
* @Route("/{id}", name="festival_show")
* @Method("GET")
*/
public function showAction( Festival $festival ) {
$deleteForm = $this->createDeleteForm( $festival );
if ( $festival->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
return $this->render( 'festival/show.html.twig',
[
'festival' => $festival,
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Displays a form to edit an existing festival entity.
*
* @Route("/{id}/edit", name="festival_edit")
* @Method({"GET", "POST"})
*/
public function editAction( Request $request, Festival $festival ) {
$deleteForm = $this->createDeleteForm( $festival );
$editForm = $this->createForm( 'AppBundle\Form\FestivalType', $festival );
$editForm->handleRequest( $request );
if ( $editForm->isSubmitted() && $editForm->isValid() ) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute( 'festival_edit', [ 'id' => $festival->getId() ] );
}
return $this->render( 'festival/edit.html.twig',
[
'festival' => $festival,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Deletes a festival entity.
*
* @Route("/{id}", name="festival_delete")
* @Method("DELETE")
*/
public function deleteAction( Request $request, Festival $festival ) {
if ( $festival->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$form = $this->createDeleteForm( $festival );
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
$em = $this->getDoctrine()->getManager();
$em->remove( $festival );
$em->flush();
}
return $this->redirectToRoute( 'festival_index' );
}
/**
* Creates a form to delete a festival entity.
*
* @param Festival $festival The festival entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm( Festival $festival ) {
return $this->createFormBuilder()
->setAction( $this->generateUrl( 'festival_delete', [ 'id' => $festival->getId() ] ) )
->setMethod( 'DELETE' )
->getForm();
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
class LegalController extends Controller {
private $tokenManager;
public function __construct( CsrfTokenManagerInterface $tokenManager = null ) {
$this->tokenManager = $tokenManager;
}
/**
* @Route("/tos", name="tos")
*/
public function tosAction( Request $request ) {
return $this->render( 'legal/tos.html.twig',
[] );
}
/**
* @Route("/privacy", name="privacy")
*/
public function privacyAction( Request $request ) {
// replace this example code with whatever you need
return $this->render( 'legal/privacy.html.twig',
[] );
}
}

View file

@ -0,0 +1,152 @@
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\ProductCategory;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* Productcategory controller.
*
* @Route("productcategory")
*/
class ProductCategoryController extends Controller {
/**
* Lists all productCategory entities.
*
* @Route("/", name="productcategory_index")
* @Method("GET")
*/
public function indexAction() {
$currentUser = $this->getUser();
$productCategories = $currentUser->getCategories();
return $this->render( 'productcategory/index.html.twig',
[
'productCategories' => $productCategories,
] );
}
/**
* Creates a new productCategory entity.
*
* @Route("/new", name="productcategory_new")
* @Method({"GET", "POST"})
*/
public function newAction( Request $request ) {
$productCategory = new Productcategory();
$currentUser = $this->getUser();
$currentUser->addCategory( $productCategory );
$productCategory->setUsers( [ $currentUser ] );
$form = $this->createForm( 'AppBundle\Form\ProductCategoryType', $productCategory );
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
$em = $this->getDoctrine()->getManager();
$em->persist( $productCategory );
$em->persist( $currentUser );
$em->flush();
return $this->redirectToRoute( 'productcategory_index' );
}
return $this->render( 'productcategory/new.html.twig',
[
'productCategory' => $productCategory,
'form' => $form->createView(),
] );
}
/**
* Finds and displays a productCategory entity.
*
* @Route("/{id}", name="productcategory_show")
* @Method("GET")
*/
public function showAction( ProductCategory $productCategory ) {
if ( $productCategory->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$deleteForm = $this->createDeleteForm( $productCategory );
return $this->render( 'productcategory/show.html.twig',
[
'productCategory' => $productCategory,
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Displays a form to edit an existing productCategory entity.
*
* @Route("/{id}/edit", name="productcategory_edit")
* @Method({"GET", "POST"})
*/
public function editAction( Request $request, ProductCategory $productCategory ) {
if ( ! $productCategory->hasUser( $this->getUser()->getId() ) ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$deleteForm = $this->createDeleteForm( $productCategory );
$currentUser = $this->getUser();
$productCategory->setUsers( [ $currentUser ] );
$editForm = $this->createForm( 'AppBundle\Form\ProductCategoryType', $productCategory );
$editForm->handleRequest( $request );
if ( $editForm->isSubmitted() && $editForm->isValid() ) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute( 'productcategory_edit', [ 'id' => $productCategory->getId() ] );
}
return $this->render( 'productcategory/edit.html.twig',
[
'productCategory' => $productCategory,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Deletes a productCategory entity.
*
* @Route("/{id}", name="productcategory_delete")
* @Method("DELETE")
*/
public function deleteAction( Request $request, ProductCategory $productCategory ) {
if ( $productCategory->hasUser( $this->getUser()->getId() ) ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$form = $this->createDeleteForm( $productCategory );
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
if ( ! $productCategory->hasUser( $this->getUser()->getId() ) ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$em = $this->getDoctrine()->getManager();
$em->remove( $productCategory );
$em->flush();
}
return $this->redirectToRoute( 'productcategory_index' );
}
/**
* Creates a form to delete a productCategory entity.
*
* @param ProductCategory $productCategory The productCategory entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm( ProductCategory $productCategory ) {
return $this->createFormBuilder()
->setAction( $this->generateUrl( 'productcategory_delete', [ 'id' => $productCategory->getId() ] ) )
->setMethod( 'DELETE' )
->getForm();
}
}

View file

@ -0,0 +1,159 @@
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Product;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* Product controller.
*
* @Route("product")
*/
class ProductController extends Controller {
/**
* Lists all product entities.
*
* @Route("/", name="product_index")
* @Method("GET")
*/
public function indexAction() {
$products = $this->getUser()->getProducts();
return $this->render( 'product/index.html.twig',
[
'products' => $products,
] );
}
/**
* Creates a new product entity.
*
* @Route("/new", name="product_new")
* @Method({"GET", "POST"})
*/
public function newAction( Request $request ) {
$user = $this->getUser();
$product = new Product();
$product->setUser( $user );
$product->setPrice( 1 );
$product->setStockCount( 500 );
$form = $this->createForm( 'AppBundle\Form\ProductType', $product );
$form->handleRequest( $request );
$user = $this->getUser();
if ( $user && $user->getCategories() ) {
$product->setCategory( $user->getCategories()[ 0 ] );
}
if ( $form->isSubmitted() && $form->isValid() ) {
$em = $this->getDoctrine()->getManager();
$em->persist( $product );
$em->flush();
return $this->redirectToRoute( 'product_show', [ 'id' => $product->getId() ] );
}
return $this->render( 'product/new.html.twig',
[
'product' => $product,
'form' => $form->createView(),
] );
}
/**
* Finds and displays a product entity.
*
* @Route("/{id}", name="product_show")
* @Method("GET")
*/
public function showAction( Product $product ) {
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$deleteForm = $this->createDeleteForm( $product );
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
return $this->render( 'product/show.html.twig',
[
'product' => $product,
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Displays a form to edit an existing product entity.
*
* @Route("/{id}/edit", name="product_edit")
* @Method({"GET", "POST"})
*/
public function editAction( Request $request, Product $product ) {
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$deleteForm = $this->createDeleteForm( $product );
$editForm = $this->createForm( 'AppBundle\Form\ProductType', $product );
$editForm->handleRequest( $request );
if ( $editForm->isSubmitted() && $editForm->isValid() ) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute( 'product_edit', [ 'id' => $product->getId() ] );
}
return $this->render( 'product/edit.html.twig',
[
'product' => $product,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Deletes a product entity.
*
* @Route("/{id}", name="product_delete")
* @Method("DELETE")
*/
public function deleteAction( Request $request, Product $product ) {
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$form = $this->createDeleteForm( $product );
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
if ( $product->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$em = $this->getDoctrine()->getManager();
$em->remove( $product );
$em->flush();
}
return $this->redirectToRoute( 'product_index' );
}
/**
* Creates a form to delete a product entity.
*
* @param Product $product The product entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm( Product $product ) {
return $this->createFormBuilder()
->setAction( $this->generateUrl( 'product_delete', [ 'id' => $product->getId() ] ) )
->setMethod( 'DELETE' )
->getForm();
}
}

View file

@ -0,0 +1,141 @@
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\SellRecord;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
/**
* Sellrecord controller.
*
* @Route("sellrecord")
*/
class SellRecordController extends Controller {
/**
* Lists all sellRecord entities.
*
* @Route("/", name="sellrecord_index")
* @Method("GET")
*/
public function indexAction() {
$sellRecords = $this->getUser()->getProductsSold();
return $this->render( 'sellrecord/index.html.twig',
[
'sellRecords' => $sellRecords,
] );
}
/**
* Creates a new sellRecord entity.
*
* @Route("/new", name="sellrecord_new")
* @Method({"GET", "POST"})
*/
public function newAction( Request $request ) {
$sellRecord = new Sellrecord();
$sellRecord->setUser( $this->getUser() );
$form = $this->createForm( 'AppBundle\Form\SellRecordType', $sellRecord );
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
$em = $this->getDoctrine()->getManager();
$em->persist( $sellRecord );
$em->flush();
return $this->redirectToRoute( 'sellrecord_show', [ 'date' => $sellRecord->getDate() ] );
}
return $this->render( 'sellrecord/new.html.twig',
[
'sellRecord' => $sellRecord,
'form' => $form->createView(),
] );
}
/**
* Finds and displays a sellRecord entity.
*
* @Route("/{date}", name="sellrecord_show")
* @Method("GET")
*/
public function showAction( SellRecord $sellRecord ) {
if ( $sellRecord->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$deleteForm = $this->createDeleteForm( $sellRecord );
if ( ! $sellRecord->getUser() == $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
return $this->render( 'sellrecord/show.html.twig',
[
'sellRecord' => $sellRecord,
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Displays a form to edit an existing sellRecord entity.
*
* @Route("/{date}/edit", name="sellrecord_edit")
* @Method({"GET", "POST"})
*/
public function editAction( Request $request, SellRecord $sellRecord ) {
if ( ! $sellRecord->getUser() == $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$deleteForm = $this->createDeleteForm( $sellRecord );
$editForm = $this->createForm( 'AppBundle\Form\SellRecordType', $sellRecord );
$editForm->handleRequest( $request );
if ( $editForm->isSubmitted() && $editForm->isValid() ) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute( 'sellrecord_edit', [ 'date' => $sellRecord->getDate() ] );
}
return $this->render( 'sellrecord/edit.html.twig',
[
'sellRecord' => $sellRecord,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
] );
}
/**
* Deletes a sellRecord entity.
*
* @Route("/delete/{id}", name="sellrecord_delete")
*/
public function deleteAction( Request $request, SellRecord $id) {
$sellRecord = $id;
if ( $sellRecord->getUser()->getId() !== $this->getUser()->getId() ) {
$this->denyAccessUnlessGranted( 'ROLE_ADMIN' );
}
$em = $this->getDoctrine()->getManager();
$em->remove( $sellRecord );
$em->flush();
return $this->redirectToRoute( 'history' );
}
/**
* Creates a form to delete a sellRecord entity.
*
* @param SellRecord $sellRecord The sellRecord entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm( SellRecord $sellRecord ) {
return $this->createFormBuilder()
->setAction( $this->generateUrl( 'sellrecord_delete', [ 'date' => $sellRecord->getDate() ] ) )
->setMethod( 'DELETE' )
->getForm();
}
}

View file

@ -0,0 +1,140 @@
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\SerieFestival;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
/**
* Seriefestival controller.
*
* @Route("seriefestival")
*/
class SerieFestivalController extends Controller
{
/**
* Lists all serieFestival entities.
*
* @Route("/", name="seriefestival_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$serieFestivals = $em->getRepository('AppBundle:SerieFestival')->findAll();
return $this->render('seriefestival/index.html.twig', array(
'serieFestivals' => $serieFestivals,
));
}
/**
* Creates a new serieFestival entity.
*
* @Route("/new", name="seriefestival_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$usr= $this->getUser();
$serieFestival = new Seriefestival();
$serieFestival->setUser($usr);
$form = $this->createForm('AppBundle\Form\SerieFestivalType', $serieFestival);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($serieFestival);
$em->flush();
return $this->redirectToRoute('seriefestival_show', array('id' => $serieFestival->getId()));
}
return $this->render('seriefestival/new.html.twig', array(
'serieFestival' => $serieFestival,
'form' => $form->createView(),
));
}
/**
* Finds and displays a serieFestival entity.
*
* @Route("/{id}", name="seriefestival_show")
* @Method("GET")
*/
public function showAction(SerieFestival $serieFestival)
{
$deleteForm = $this->createDeleteForm($serieFestival);
return $this->render('seriefestival/show.html.twig', array(
'serieFestival' => $serieFestival,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing serieFestival entity.
*
* @Route("/{id}/edit", name="seriefestival_edit")
* @Method({"GET", "POST"})
*/
public function editAction(Request $request, SerieFestival $serieFestival)
{
$deleteForm = $this->createDeleteForm($serieFestival);
$editForm = $this->createForm('AppBundle\Form\SerieFestivalType', $serieFestival);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('seriefestival_edit', array('id' => $serieFestival->getId()));
}
return $this->render('seriefestival/edit.html.twig', array(
'serieFestival' => $serieFestival,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a serieFestival entity.
*
* @Route("/{id}", name="seriefestival_delete")
* @Method("DELETE")
*/
public function deleteAction(Request $request, SerieFestival $serieFestival)
{
$form = $this->createDeleteForm($serieFestival);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($serieFestival);
$em->flush();
}
return $this->redirectToRoute('seriefestival_index');
}
/**
* Creates a form to delete a serieFestival entity.
*
* @param SerieFestival $serieFestival The serieFestival entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(SerieFestival $serieFestival)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('seriefestival_delete', array('id' => $serieFestival->getId())))
->setMethod('DELETE')
->getForm()
;
}
}

View file

@ -0,0 +1,200 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ExpenseKind, for previsional compta
*
* @ORM\Table(name="expense_kind")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ExpenseKindRepository")
*/
class ExpenseKind
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var int|null
*
* @ORM\Column(name="delay", type="integer", nullable=true)
*/
private $delay;
/**
* line enabled to calculate on
*
* @ORM\Column(name="enabled", type="boolean", nullable=true)
*/
private $enabled;
/**
* @var int|null
*
* @ORM\Column(name="repeatitions", type="integer", nullable=true)
*/
private $repeatitions;
/**
* @var float
*
* @ORM\Column(name="amount", type="float")
*/
private $amount;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="expenses")
*/
private $user;
/**
* @return int|null
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* @param int|null $enabled
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* Set name.
*
* @param string $name
*
* @return ExpenseKind
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set delay.
*
* @param int|null $delay
*
* @return ExpenseKind
*/
public function setDelay($delay = null)
{
$this->delay = $delay;
return $this;
}
/**
* Get delay.
*
* @return int|null
*/
public function getDelay()
{
return $this->delay;
}
/**
* Set repeatitions.
*
* @param int|null $repeatitions
*
* @return ExpenseKind
*/
public function setRepeatitions($repeatitions = null)
{
$this->repeatitions = $repeatitions;
return $this;
}
/**
* Get repeatitions.
*
* @return int|null
*/
public function getRepeatitions()
{
return $this->repeatitions;
}
/**
* Set amount.
*
* @param float $amount
*
* @return ExpenseKind
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Get amount.
*
* @return float
*/
public function getAmount()
{
return $this->amount;
}
}

View file

@ -0,0 +1,200 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ExpenseKind, for previsional compta
*
* @ORM\Table(name="expense_kind")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ExpenseKindRepository")
*/
class ExpenseKind
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var int|null
*
* @ORM\Column(name="delay", type="integer", nullable=true)
*/
private $delay;
/**
* line enabled to calculate on
*
* @ORM\Column(name="enabled", type="boolean", nullable=true)
*/
private $enabled;
/**
* @var int|null
*
* @ORM\Column(name="repeatitions", type="integer", nullable=true)
*/
private $repeatitions;
/**
* @var float
*
* @ORM\Column(name="amount", type="float")
*/
private $amount;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="expenses")
*/
private $user;
/**
* @return int|null
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* @param int|null $enabled
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* Set name.
*
* @param string $name
*
* @return ExpenseKind
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set delay.
*
* @param int|null $delay
*
* @return ExpenseKind
*/
public function setDelay($delay = null)
{
$this->delay = $delay;
return $this;
}
/**
* Get delay.
*
* @return int|null
*/
public function getDelay()
{
return $this->delay;
}
/**
* Set repeatitions.
*
* @param int|null $repeatitions
*
* @return ExpenseKind
*/
public function setRepeatitions($repeatitions = null)
{
$this->repeatitions = $repeatitions;
return $this;
}
/**
* Get repeatitions.
*
* @return int|null
*/
public function getRepeatitions()
{
return $this->repeatitions;
}
/**
* Set amount.
*
* @param float $amount
*
* @return ExpenseKind
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Get amount.
*
* @return float
*/
public function getAmount()
{
return $this->amount;
}
}

430
v1/old/Entity/Festival.php Normal file
View file

@ -0,0 +1,430 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="festival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class Festival {
use Commentable;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @var \stdClass
*
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival", cascade={"remove"})
*/
private $sellRecords;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\SerieFestival", inversedBy="festivals")
*/
private $serieFestival;
/**
* @var
* @ORM\Column(name="fond_de_caisse_avant", type="float")
*/
private $fondDeCaisseAvant;
/**
* @var
* @ORM\Column(name="fond_de_caisse_apres", type="float")
*/
private $fondDeCaisseApres;
/**
* @var
* @ORM\Column(name="chiffre_affaire", type="float")
*/
private $chiffreAffaire;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisInscription;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisHebergement;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisTransport;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisRepas;
public function __toString() {
return $this->getName();
}
/**
* @return mixed
*/
public function getSerieFestival()
{
return $this->serieFestival;
}
/**
* @param mixed $serieFestival
*/
public function setSerieFestival($serieFestival)
{
$this->serieFestival = $serieFestival;
}
/**
* array usable by js
* @return array
*/
public function makeArray(){
$sellRecords = $this->getSellRecords();
$soldItems = [];
foreach ( $sellRecords as $sell_record ) {
foreach ( $sell_record->getProductsSold() as $sold ) {
if(!isset($soldItems[$sold->getProduct()->getId()])){
$soldItems[$sold->getProduct()->getId()] = 0;
}
$soldItems[$sold->getProduct()->getId()]++;
}
}
return [
'id' => $this->getId(),
'name' => $this->getName(),
'commentaire' => $this->getComment(),
'dateCreation' => $this->getDateCreation(),
'chiffreAffaire' => $this->getChiffreAffaire(),
'clientsCount' => count($this->getSellRecords()),
'fondDeCaisseAvant' => $this->getFondDeCaisseAvant(),
'fondDeCaisseApres' => $this->getFondDeCaisseApres(),
'sold' => $soldItems,
];
}
public function recalculateChiffreAffaire() {
$sellings = $this->getSellRecords();
$newChiffreAffaire = 0;
foreach ( $sellings as $selling ) {
$newChiffreAffaire += $selling->getAmount();
}
$this->setChiffreAffaire( $newChiffreAffaire );
return $this;
}
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Festival
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set dateCreation
*
* @param \DateTime $dateCreation
*
* @return Festival
*/
public function setDateCreation( $dateCreation ) {
$this->dateCreation = $dateCreation;
return $this;
}
/**
* Get dateCreation
*
* @return \DateTime
*/
public function getDateCreation() {
return $this->dateCreation;
}
/**
* Set sellRecords
*
* @param \stdClass $sellRecords
*
* @return Festival
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords
*
* @return \stdClass
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Constructor
*/
public function __construct() {
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return Festival
*/
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords->removeElement( $sellRecord );
}
/**
* Set user.
*
* @param \AppBundle\Entity\User|null $user
*
* @return Festival
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return \AppBundle\Entity\User|null
*/
public function getUser() {
return $this->user;
}
/**
* Set fondDeCaisseAvant.
*
* @param float $fondDeCaisseAvant
*
* @return Festival
*/
public function setFondDeCaisseAvant( $fondDeCaisseAvant ) {
$this->fondDeCaisseAvant = $fondDeCaisseAvant;
return $this;
}
/**
* Get fondDeCaisseAvant.
*
* @return float
*/
public function getFondDeCaisseAvant() {
return $this->fondDeCaisseAvant;
}
/**
* Set fondDeCaisseApres.
*
* @param float $fondDeCaisseApres
*
* @return Festival
*/
public function setFondDeCaisseApres( $fondDeCaisseApres ) {
$this->fondDeCaisseApres = $fondDeCaisseApres;
return $this;
}
/**
* Get fondDeCaisseApres.
*
* @return float
*/
public function getFondDeCaisseApres() {
return $this->fondDeCaisseApres;
}
/**
* Set chiffreAffaire.
*
* @param float $chiffreAffaire
*
* @return Festival
*/
public function setChiffreAffaire( $chiffreAffaire ) {
$this->chiffreAffaire = $chiffreAffaire;
return $this;
}
/**
* Get chiffreAffaire.
*
* @return float
*/
public function getChiffreAffaire() {
return $this->chiffreAffaire;
}
/**
* Set fraisInscription.
*
* @param string|null $fraisInscription
*
* @return Festival
*/
public function setFraisInscription( $fraisInscription = null ) {
$this->fraisInscription = $fraisInscription;
return $this;
}
/**
* Get fraisInscription.
*
* @return string|null
*/
public function getFraisInscription() {
return $this->fraisInscription;
}
/**
* Set fraisHebergement.
*
* @param string|null $fraisHebergement
*
* @return Festival
*/
public function setFraisHebergement( $fraisHebergement = null ) {
$this->fraisHebergement = $fraisHebergement;
return $this;
}
/**
* Get fraisHebergement.
*
* @return string|null
*/
public function getFraisHebergement() {
return $this->fraisHebergement;
}
/**
* Set fraisTransport.
*
* @param string|null $fraisTransport
*
* @return Festival
*/
public function setFraisTransport( $fraisTransport = null ) {
$this->fraisTransport = $fraisTransport;
return $this;
}
/**
* Get fraisTransport.
*
* @return string|null
*/
public function getFraisTransport() {
return $this->fraisTransport;
}
/**
* Set fraisRepas.
*
* @param string|null $fraisRepas
*
* @return Festival
*/
public function setFraisRepas( $fraisRepas = null ) {
$this->fraisRepas = $fraisRepas;
return $this;
}
/**
* Get fraisRepas.
*
* @return string|null
*/
public function getFraisRepas() {
return $this->fraisRepas;
}
}

430
v1/old/Entity/Festival.php~ Executable file
View file

@ -0,0 +1,430 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="festival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class Festival {
use Commentable;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @var \stdClass
*
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival", cascade={"remove"})
*/
private $sellRecords;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\SerieFestival", inversedBy="festivals")
*/
private $serieFestival;
/**
* @var
* @ORM\Column(name="fond_de_caisse_avant", type="float")
*/
private $fondDeCaisseAvant;
/**
* @var
* @ORM\Column(name="fond_de_caisse_apres", type="float")
*/
private $fondDeCaisseApres;
/**
* @var
* @ORM\Column(name="chiffre_affaire", type="float")
*/
private $chiffreAffaire;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisInscription;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisHebergement;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisTransport;
/**
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $fraisRepas;
public function __toString() {
return $this->getName();
}
/**
* @return mixed
*/
public function getSerieFestival()
{
return $this->serieFestival;
}
/**
* @param mixed $serieFestival
*/
public function setSerieFestival($serieFestival)
{
$this->serieFestival = $serieFestival;
}
/**
* array usable by js
* @return array
*/
public function makeArray(){
$sellRecords = $this->getSellRecords();
$soldItems = [];
foreach ( $sellRecords as $sell_record ) {
foreach ( $sell_record->getProductsSold() as $sold ) {
if(!isset($soldItems[$sold->getProduct()->getId()])){
$soldItems[$sold->getProduct()->getId()] = 0;
}
$soldItems[$sold->getProduct()->getId()]++;
}
}
return [
'id' => $this->getId(),
'name' => $this->getName(),
'commentaire' => $this->getComment(),
'dateCreation' => $this->getDateCreation(),
'chiffreAffaire' => $this->getChiffreAffaire(),
'clientsCount' => count($this->getSellRecords()),
'fondDeCaisseAvant' => $this->getFondDeCaisseAvant(),
'fondDeCaisseApres' => $this->getFondDeCaisseApres(),
'sold' => $soldItems,
];
}
public function recalculateChiffreAffaire() {
$sellings = $this->getSellRecords();
$newChiffreAffaire = 0;
foreach ( $sellings as $selling ) {
$newChiffreAffaire += $selling->getAmount();
}
$this->setChiffreAffaire( $newChiffreAffaire );
return $this;
}
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Festival
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set dateCreation
*
* @param \DateTime $dateCreation
*
* @return Festival
*/
public function setDateCreation( $dateCreation ) {
$this->dateCreation = $dateCreation;
return $this;
}
/**
* Get dateCreation
*
* @return \DateTime
*/
public function getDateCreation() {
return $this->dateCreation;
}
/**
* Set sellRecords
*
* @param \stdClass $sellRecords
*
* @return Festival
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords
*
* @return \stdClass
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Constructor
*/
public function __construct() {
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return Festival
*/
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords->removeElement( $sellRecord );
}
/**
* Set user.
*
* @param \AppBundle\Entity\User|null $user
*
* @return Festival
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return \AppBundle\Entity\User|null
*/
public function getUser() {
return $this->user;
}
/**
* Set fondDeCaisseAvant.
*
* @param float $fondDeCaisseAvant
*
* @return Festival
*/
public function setFondDeCaisseAvant( $fondDeCaisseAvant ) {
$this->fondDeCaisseAvant = $fondDeCaisseAvant;
return $this;
}
/**
* Get fondDeCaisseAvant.
*
* @return float
*/
public function getFondDeCaisseAvant() {
return $this->fondDeCaisseAvant;
}
/**
* Set fondDeCaisseApres.
*
* @param float $fondDeCaisseApres
*
* @return Festival
*/
public function setFondDeCaisseApres( $fondDeCaisseApres ) {
$this->fondDeCaisseApres = $fondDeCaisseApres;
return $this;
}
/**
* Get fondDeCaisseApres.
*
* @return float
*/
public function getFondDeCaisseApres() {
return $this->fondDeCaisseApres;
}
/**
* Set chiffreAffaire.
*
* @param float $chiffreAffaire
*
* @return Festival
*/
public function setChiffreAffaire( $chiffreAffaire ) {
$this->chiffreAffaire = $chiffreAffaire;
return $this;
}
/**
* Get chiffreAffaire.
*
* @return float
*/
public function getChiffreAffaire() {
return $this->chiffreAffaire;
}
/**
* Set fraisInscription.
*
* @param string|null $fraisInscription
*
* @return Festival
*/
public function setFraisInscription( $fraisInscription = null ) {
$this->fraisInscription = $fraisInscription;
return $this;
}
/**
* Get fraisInscription.
*
* @return string|null
*/
public function getFraisInscription() {
return $this->fraisInscription;
}
/**
* Set fraisHebergement.
*
* @param string|null $fraisHebergement
*
* @return Festival
*/
public function setFraisHebergement( $fraisHebergement = null ) {
$this->fraisHebergement = $fraisHebergement;
return $this;
}
/**
* Get fraisHebergement.
*
* @return string|null
*/
public function getFraisHebergement() {
return $this->fraisHebergement;
}
/**
* Set fraisTransport.
*
* @param string|null $fraisTransport
*
* @return Festival
*/
public function setFraisTransport( $fraisTransport = null ) {
$this->fraisTransport = $fraisTransport;
return $this;
}
/**
* Get fraisTransport.
*
* @return string|null
*/
public function getFraisTransport() {
return $this->fraisTransport;
}
/**
* Set fraisRepas.
*
* @param string|null $fraisRepas
*
* @return Festival
*/
public function setFraisRepas( $fraisRepas = null ) {
$this->fraisRepas = $fraisRepas;
return $this;
}
/**
* Get fraisRepas.
*
* @return string|null
*/
public function getFraisRepas() {
return $this->fraisRepas;
}
}

212
v1/old/Entity/Product.php Normal file
View file

@ -0,0 +1,212 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use AppBundle\Traits\Sellable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
*/
class Product {
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* number of items available
* @ORM\Column(name="stock_count", type="integer")
*/
private $stockCount;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* url for image
* @ORM\Column(type="string", length=256, nullable=true)
*/
private $image;
/**
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
*/
private $category;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product", cascade={"remove"})
*/
private $productsSold;
use Sellable;
use Commentable;
/**
* Get id.
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return Product
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set image.
*
* @param string|null $image
*
* @return Product
*/
public function setImage( $image = null ) {
$this->image = $image;
return $this;
}
/**
* Get image.
*
* @return string|null
*/
public function getImage() {
return $this->image;
}
/**
* Set category.
*
* @param \AppBundle\Entity\ProductCategory|null $category
*
* @return Product
*/
public function setCategory( \AppBundle\Entity\ProductCategory $category = null ) {
$this->category = $category;
return $this;
}
/**
* Get category.
*
* @return \AppBundle\Entity\ProductCategory|null
*/
public function getCategory() {
return $this->category;
}
/**
* Set user.
*
* @param \AppBundle\Entity\User|null $user
*
* @return Product
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return \AppBundle\Entity\User|null
*/
public function getUser() {
return $this->user;
}
/**
* Set stockCount.
*
* @param int $stockCount
*
* @return Product
*/
public function setStockCount( $stockCount ) {
$this->stockCount = $stockCount;
return $this;
}
/**
* Get stockCount.
*
* @return int
*/
public function getStockCount() {
return $this->stockCount;
}
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return Product
*/
public function addProductsSold( \AppBundle\Entity\User $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold( \AppBundle\Entity\User $productsSold ) {
return $this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
}

212
v1/old/Entity/Product.php~ Executable file
View file

@ -0,0 +1,212 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use AppBundle\Traits\Sellable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
*/
class Product {
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* number of items available
* @ORM\Column(name="stock_count", type="integer")
*/
private $stockCount;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* url for image
* @ORM\Column(type="string", length=256, nullable=true)
*/
private $image;
/**
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
*/
private $category;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product", cascade={"remove"})
*/
private $productsSold;
use Sellable;
use Commentable;
/**
* Get id.
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return Product
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set image.
*
* @param string|null $image
*
* @return Product
*/
public function setImage( $image = null ) {
$this->image = $image;
return $this;
}
/**
* Get image.
*
* @return string|null
*/
public function getImage() {
return $this->image;
}
/**
* Set category.
*
* @param \AppBundle\Entity\ProductCategory|null $category
*
* @return Product
*/
public function setCategory( \AppBundle\Entity\ProductCategory $category = null ) {
$this->category = $category;
return $this;
}
/**
* Get category.
*
* @return \AppBundle\Entity\ProductCategory|null
*/
public function getCategory() {
return $this->category;
}
/**
* Set user.
*
* @param \AppBundle\Entity\User|null $user
*
* @return Product
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return \AppBundle\Entity\User|null
*/
public function getUser() {
return $this->user;
}
/**
* Set stockCount.
*
* @param int $stockCount
*
* @return Product
*/
public function setStockCount( $stockCount ) {
$this->stockCount = $stockCount;
return $this;
}
/**
* Get stockCount.
*
* @return int
*/
public function getStockCount() {
return $this->stockCount;
}
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return Product
*/
public function addProductsSold( \AppBundle\Entity\User $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\User $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold( \AppBundle\Entity\User $productsSold ) {
return $this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
}

View file

@ -0,0 +1,198 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductCategoryRepository")
*/
class ProductCategory {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Product", mappedBy="category", cascade={"remove"})
*/
private $products;
/**
* @ORM\OneToMany(targetEntity="ProductSold", mappedBy="product", cascade={"remove"})
*/
private $productsSold;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", mappedBy="categories")
*/
private $users;
public function __toString() {
return $this->getName() . ' (' . count( $this->getProducts() ) . ' produits)';
}
/**
* @param $userId
*
* @return bool
*/
public function hasUser( $userId ) {
foreach ( $this->getUsers() as $user ) {
if ( $user->getId() === $userId ) {
return true;
}
}
return false;
}
/**
* @return mixed
*/
public function getUsers() {
return $this->users;
}
/**
* @param mixed $users
*/
public function setUsers( $users ) {
$this->users = $users;
}
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/
public function getId() {
return $this->id;
}
/**
* @param mixed $id
*/
public function setId( $id ) {
$this->id = $id;
}
/**
* @return mixed
*/
public function getName() {
return $this->name;
}
/**
* @param mixed $name
*/
public function setName( $name ) {
$this->name = $name;
}
/**
* Constructor
*/
public function __construct() {
$this->products = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add product
*
* @param \AppBundle\Entity\Product $product
*
* @return ProductCategory
*/
public function addProduct( \AppBundle\Entity\Product $product ) {
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \AppBundle\Entity\Product $product
*/
public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product );
}
/**
* Add user
*
* @param \AppBundle\Entity\User $user
*
* @return ProductCategory
*/
public function addUser( \AppBundle\Entity\User $user ) {
$this->users[] = $user;
return $this;
}
/**
* Remove user
*
* @param \AppBundle\Entity\User $user
*/
public function removeUser( \AppBundle\Entity\User $user ) {
$this->users->removeElement( $user );
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return ProductCategory
*/
public function addProductsSold(\AppBundle\Entity\ProductSold $productsSold)
{
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
{
return $this->productsSold->removeElement($productsSold);
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold()
{
return $this->productsSold;
}
}

View file

@ -0,0 +1,198 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductCategoryRepository")
*/
class ProductCategory {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Product", mappedBy="category", cascade={"remove"})
*/
private $products;
/**
* @ORM\OneToMany(targetEntity="ProductSold", mappedBy="product", cascade={"remove"})
*/
private $productsSold;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", mappedBy="categories")
*/
private $users;
public function __toString() {
return $this->getName() . ' (' . count( $this->getProducts() ) . ' produits)';
}
/**
* @param $userId
*
* @return bool
*/
public function hasUser( $userId ) {
foreach ( $this->getUsers() as $user ) {
if ( $user->getId() === $userId ) {
return true;
}
}
return false;
}
/**
* @return mixed
*/
public function getUsers() {
return $this->users;
}
/**
* @param mixed $users
*/
public function setUsers( $users ) {
$this->users = $users;
}
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/
public function getId() {
return $this->id;
}
/**
* @param mixed $id
*/
public function setId( $id ) {
$this->id = $id;
}
/**
* @return mixed
*/
public function getName() {
return $this->name;
}
/**
* @param mixed $name
*/
public function setName( $name ) {
$this->name = $name;
}
/**
* Constructor
*/
public function __construct() {
$this->products = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add product
*
* @param \AppBundle\Entity\Product $product
*
* @return ProductCategory
*/
public function addProduct( \AppBundle\Entity\Product $product ) {
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \AppBundle\Entity\Product $product
*/
public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product );
}
/**
* Add user
*
* @param \AppBundle\Entity\User $user
*
* @return ProductCategory
*/
public function addUser( \AppBundle\Entity\User $user ) {
$this->users[] = $user;
return $this;
}
/**
* Remove user
*
* @param \AppBundle\Entity\User $user
*/
public function removeUser( \AppBundle\Entity\User $user ) {
$this->users->removeElement( $user );
}
/**
* Add productsSold.
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return ProductCategory
*/
public function addProductsSold(\AppBundle\Entity\ProductSold $productsSold)
{
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold.
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
{
return $this->productsSold->removeElement($productsSold);
}
/**
* Get productsSold.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold()
{
return $this->productsSold;
}
}

View file

@ -0,0 +1,169 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use AppBundle\Traits\Sellable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
*/
class ProductSold {
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\Column(type="string", length=256)
*/
private $image;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="productsSold")
*/
private $user;
/**
* the stack of products for one client at one time
* @ORM\ManyToOne(targetEntity="SellRecord", inversedBy="productsSold")
*/
public $sellRecords;
/**
* references the product from whom this line is inspired
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold")
*/
private $product;
use Sellable;
use Commentable;
/**
* Set sellRecords.
*
* @param \AppBundle\Entity\SellRecord|null $sellRecords
*
* @return ProductSold
*/
public function setSellRecords( \AppBundle\Entity\SellRecord $sellRecords = null ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords.
*
* @return \AppBundle\Entity\SellRecord|null
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Set product.
*
* @param \AppBundle\Entity\Product|null $product
*
* @return ProductSold
*/
public function setProduct( \AppBundle\Entity\Product $product = null ) {
$this->product = $product;
return $this;
}
/**
* Get product.
*
* @return \AppBundle\Entity\Product|null
*/
public function getProduct() {
return $this->product;
}
/**
* Get id.
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return ProductSold
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set image.
*
* @param string $image
*
* @return ProductSold
*/
public function setImage( $image ) {
$this->image = $image;
return $this;
}
/**
* Get image.
*
* @return string
*/
public function getImage() {
return $this->image;
}
/**
* Set user.
*
* @param \AppBundle\Entity\User|null $user
*
* @return ProductSold
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return \AppBundle\Entity\User|null
*/
public function getUser() {
return $this->user;
}
}

169
v1/old/Entity/ProductSold.php~ Executable file
View file

@ -0,0 +1,169 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use AppBundle\Traits\Sellable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
*/
class ProductSold {
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\Column(type="string", length=256)
*/
private $image;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="productsSold")
*/
private $user;
/**
* the stack of products for one client at one time
* @ORM\ManyToOne(targetEntity="SellRecord", inversedBy="productsSold")
*/
public $sellRecords;
/**
* references the product from whom this line is inspired
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold")
*/
private $product;
use Sellable;
use Commentable;
/**
* Set sellRecords.
*
* @param \AppBundle\Entity\SellRecord|null $sellRecords
*
* @return ProductSold
*/
public function setSellRecords( \AppBundle\Entity\SellRecord $sellRecords = null ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords.
*
* @return \AppBundle\Entity\SellRecord|null
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Set product.
*
* @param \AppBundle\Entity\Product|null $product
*
* @return ProductSold
*/
public function setProduct( \AppBundle\Entity\Product $product = null ) {
$this->product = $product;
return $this;
}
/**
* Get product.
*
* @return \AppBundle\Entity\Product|null
*/
public function getProduct() {
return $this->product;
}
/**
* Get id.
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return ProductSold
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set image.
*
* @param string $image
*
* @return ProductSold
*/
public function setImage( $image ) {
$this->image = $image;
return $this;
}
/**
* Get image.
*
* @return string
*/
public function getImage() {
return $this->image;
}
/**
* Set user.
*
* @param \AppBundle\Entity\User|null $user
*
* @return ProductSold
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return \AppBundle\Entity\User|null
*/
public function getUser() {
return $this->user;
}
}

View file

@ -0,0 +1,247 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\SellRecordRepository")
*/
class SellRecord {
use Commentable;
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* gender of the client
* @ORM\Column( type = "string", nullable=true )
*/
private $gender;
/**
* liste des produits de la vente
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords", cascade={"remove", "persist","detach"})
*/
private $productsSold;
/**
* creation date
* @ORM\Column(type="datetime")
*/
private $date;
/**
* total
* @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
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Festival",inversedBy="sellRecords")
*/
private $festival;
/**
* owner of the selling account
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords")
*/
private $user;
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* @return mixed
*/
public function getId() {
return $this->id;
}
/**
* @param mixed $id
*/
public function setId( $id ) {
$this->id = $id;
}
/**
* Set date
*
* @param \DateTime $date
*
* @return SellRecord
*/
public function setDate( $date ) {
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate() {
return $this->date;
}
/**
* Set amount
*
* @param string $amount
*
* @return SellRecord
*/
public function setAmount( $amount ) {
$this->amount = $amount;
return $this;
}
/**
* Get amount
*
* @return string
*/
public function getAmount() {
return $this->amount;
}
/**
* Set paidByClient
*
* @param string $paidByClient
*
* @return SellRecord
*/
public function setPaidByClient( $paidByClient ) {
$this->paidByClient = $paidByClient;
return $this;
}
/**
* Get paidByClient
*
* @return string
*/
public function getPaidByClient() {
return $this->paidByClient;
}
/**
* Add productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return SellRecord
*/
public function addProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
/**
* Set festival
*
* @param \AppBundle\Entity\Festival $festival
*
* @return SellRecord
*/
public function setFestival( \AppBundle\Entity\Festival $festival = null ) {
$this->festival = $festival;
return $this;
}
/**
* Get festival
*
* @return \AppBundle\Entity\Festival
*/
public function getFestival() {
return $this->festival;
}
/**
* Set user
*
* @param \AppBundle\Entity\User $user
*
* @return SellRecord
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \AppBundle\Entity\User
*/
public function getUser() {
return $this->user;
}
/**
* Set gender.
*
* @param string|null $gender
*
* @return SellRecord
*/
public function setGender($gender = null)
{
$this->gender = $gender;
return $this;
}
/**
* Get gender.
*
* @return string|null
*/
public function getGender()
{
return $this->gender;
}
}

247
v1/old/Entity/SellRecord.php~ Executable file
View file

@ -0,0 +1,247 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\SellRecordRepository")
*/
class SellRecord {
use Commentable;
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* gender of the client
* @ORM\Column( type = "string", nullable=true )
*/
private $gender;
/**
* liste des produits de la vente
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords", cascade={"remove", "persist","detach"})
*/
private $productsSold;
/**
* creation date
* @ORM\Column(type="datetime")
*/
private $date;
/**
* total
* @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
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Festival",inversedBy="sellRecords")
*/
private $festival;
/**
* owner of the selling account
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords")
*/
private $user;
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* @return mixed
*/
public function getId() {
return $this->id;
}
/**
* @param mixed $id
*/
public function setId( $id ) {
$this->id = $id;
}
/**
* Set date
*
* @param \DateTime $date
*
* @return SellRecord
*/
public function setDate( $date ) {
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate() {
return $this->date;
}
/**
* Set amount
*
* @param string $amount
*
* @return SellRecord
*/
public function setAmount( $amount ) {
$this->amount = $amount;
return $this;
}
/**
* Get amount
*
* @return string
*/
public function getAmount() {
return $this->amount;
}
/**
* Set paidByClient
*
* @param string $paidByClient
*
* @return SellRecord
*/
public function setPaidByClient( $paidByClient ) {
$this->paidByClient = $paidByClient;
return $this;
}
/**
* Get paidByClient
*
* @return string
*/
public function getPaidByClient() {
return $this->paidByClient;
}
/**
* Add productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return SellRecord
*/
public function addProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold->removeElement( $productsSold );
}
/**
* Get productsSold
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductsSold() {
return $this->productsSold;
}
/**
* Set festival
*
* @param \AppBundle\Entity\Festival $festival
*
* @return SellRecord
*/
public function setFestival( \AppBundle\Entity\Festival $festival = null ) {
$this->festival = $festival;
return $this;
}
/**
* Get festival
*
* @return \AppBundle\Entity\Festival
*/
public function getFestival() {
return $this->festival;
}
/**
* Set user
*
* @param \AppBundle\Entity\User $user
*
* @return SellRecord
*/
public function setUser( \AppBundle\Entity\User $user = null ) {
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \AppBundle\Entity\User
*/
public function getUser() {
return $this->user;
}
/**
* Set gender.
*
* @param string|null $gender
*
* @return SellRecord
*/
public function setGender($gender = null)
{
$this->gender = $gender;
return $this;
}
/**
* Get gender.
*
* @return string|null
*/
public function getGender()
{
return $this->gender;
}
}

View file

@ -0,0 +1,163 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="serieFestival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class SerieFestival {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="serieFestival")
*/
private $festivals;
/**
* @var \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="seriesFestivals")
*/
private $user;
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getFestivals()
{
return $this->festivals;
}
/**
* @param mixed $festivals
*/
public function setFestivals($festivals)
{
$this->festivals = $festivals;
}
/**
* @return \DateTime
*/
public function getDateCreation()
{
return $this->dateCreation;
}
/**
* @param \DateTime $dateCreation
*/
public function setDateCreation($dateCreation)
{
$this->dateCreation = $dateCreation;
}
/**
* Constructor
*/
public function __construct()
{
$this->festivals = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return SerieFestival
*/
public function addFestival(\AppBundle\Entity\Festival $festival)
{
$this->festivals[] = $festival;
return $this;
}
/**
* Remove festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeFestival(\AppBundle\Entity\Festival $festival)
{
return $this->festivals->removeElement($festival);
}
}

View file

@ -0,0 +1,130 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="serieFestival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class SerieFestival {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="serieFestival")
*/
private $festivals;
/**
* @var \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="seriesFestivals")
*/
private $user;
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getFestivals()
{
return $this->festivals;
}
/**
* @param mixed $festivals
*/
public function setFestivals($festivals)
{
$this->festivals = $festivals;
}
/**
* @return \DateTime
*/
public function getDateCreation()
{
return $this->dateCreation;
}
/**
* @param \DateTime $dateCreation
*/
public function setDateCreation($dateCreation)
{
$this->dateCreation = $dateCreation;
}
}

65
v1/old/Entity/Stuff.php~ Executable file
View file

@ -0,0 +1,65 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Stuff
*
* @ORM\Table(name="stuff")
* @ORM\Entity(repositoryClass="AppBundle\Repository\StuffRepository")
*/
class Stuff
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="truc", type="string", length=255)
*/
private $truc;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set truc
*
* @param string $truc
*
* @return Stuff
*/
public function setTruc($truc)
{
$this->truc = $truc;
return $this;
}
/**
* Get truc
*
* @return string
*/
public function getTruc()
{
return $this->truc;
}
}

552
v1/old/Entity/User.php Normal file
View file

@ -0,0 +1,552 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
/**
* User
*
* @ORM\Table(name="custom_user")
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
*/
class User extends BaseUser {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
private $twitterAccessToken;
/**
* @ORM\Column(name="disqus_id", type="string", length=255, nullable=true)
*/
private $disqusId;
private $disqusAccessToken;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/
private $googleId;
/**
* @ORM\Column(name="mastodon_id", type="string", length=255, nullable=true)
*/
private $mastodonId;
private $googleAccessToken;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
*/
private $categories;
/**
* templates products
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Product", mappedBy="user")
*/
private $products;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="user")
*/
private $productsSold;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user")
*/
private $festivals;
/**
* series of festivals
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SerieFestival", mappedBy="user")
*/
private $seriesFestivals;
/**
* current festival we are recording sellings for
* @ORM\OneToOne(targetEntity="AppBundle\Entity\Festival")
*/
private $activeFestival;
//expenses previsionnel configs
/**
* @ORM\Column(name="averageMonthlyEarnings", type="float", nullable=true)
*/
private $averageMonthlyEarnings;
/**
* available money, for previsionnel calculation
* @ORM\Column(name="disponibility", type="float", nullable=true)
*/
private $disponibility;
/**
* expenses by kind, for previsionnel
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ExpenseKind", mappedBy="user")
*/
private $expenses;
/**
* @return mixed
*/
public function getAverageMonthlyEarnings()
{
return $this->averageMonthlyEarnings;
}
/**
* @param mixed $averageMonthlyEarnings
*/
public function setAverageMonthlyEarnings($averageMonthlyEarnings)
{
$this->averageMonthlyEarnings = $averageMonthlyEarnings;
}
/**
* @return mixed
*/
public function getDisponibility()
{
return $this->disponibility;
}
/**
* @param mixed $disponibility
*/
public function setDisponibility($disponibility)
{
$this->disponibility = $disponibility;
}
/**
* @return mixed
*/
public function getSeriesFestivals()
{
return $this->seriesFestivals;
}
/**
* @param mixed $seriesFestivals
*/
public function setSeriesFestivals($seriesFestivals)
{
$this->seriesFestivals = $seriesFestivals;
}
/**
* @return mixed
*/
public function getExpenses()
{
return $this->expenses;
}
/**
* @param mixed $expenses
*/
public function setExpenses($expenses)
{
$this->expenses = $expenses;
}
/**
* @return mixed
*/
public function getProductsSold() {
return $this->productsSold;
}
/**
* @return mixed
*/
public function addProductsSold( $product ) {
return $this->productsSold[] = $product;
}
/**
* @param mixed $productsSold
*/
public function setProductsSold( $productsSold ) {
$this->productsSold = $productsSold;
}
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord", mappedBy="user")
*/
private $sellRecords;
/**
* @return mixed
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function addSellRecords( $sellRecords ) {
$this->sellRecords[] = $sellRecords;
}
/**
* @return mixed
*/
public function getGoogleAccessToken() {
return $this->googleAccessToken;
}
/**
* @param mixed $googleAccessToken
*/
public function setGoogleAccessToken( $googleAccessToken ) {
$this->googleAccessToken = $googleAccessToken;
}
/**
* @return mixed
*/
public function getDisqusAccessToken() {
return $this->disqusAccessToken;
}
/**
* @param mixed $disqusAccessToken
*/
public function setDisqusAccessToken( $disqusAccessToken ) {
$this->disqusAccessToken = $disqusAccessToken;
}
/**
* @return mixed
*/
public function getTwitterAccessToken() {
return $this->twitterAccessToken;
}
/**
* @param mixed $twitterAccessToken
*/
public function setTwitterAccessToken( $TwitterAccessToken ) {
$this->twitterAccessToken = $TwitterAccessToken;
}
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/
public function getCategories() {
return $this->categories;
}
/**
* @param mixed $categories
*/
public function setCategories( $categories ) {
$this->categories = $categories;
}
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set googleId
*
* @param string $googleId
*
* @return User
*/
public function setGoogleId( $googleId ) {
$this->googleId = $googleId;
return $this;
}
/**
* Get googleId
*
* @return string
*/
public function getGoogleId() {
return $this->googleId;
}
/**
* Add product
*
* @param \AppBundle\Entity\Product $product
*
* @return User
*/
public function addProduct( \AppBundle\Entity\Product $product ) {
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \AppBundle\Entity\Product $product
*/
public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product );
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold->removeElement( $productsSold );
}
/**
* Add category
*
* @param \AppBundle\Entity\ProductCategory $category
*
* @return User
*/
public function addCategory( \AppBundle\Entity\ProductCategory $category ) {
$this->categories[] = $category;
return $this;
}
/**
* Remove category
*
* @param \AppBundle\Entity\ProductCategory $category
*/
public function removeCategory( \AppBundle\Entity\ProductCategory $category ) {
$this->categories->removeElement( $category );
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return User
*/
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords->removeElement( $sellRecord );
}
/**
* Add festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return User
*/
public function addFestival( \AppBundle\Entity\Festival $festival ) {
$this->festivals[] = $festival;
return $this;
}
/**
* Remove festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeFestival( \AppBundle\Entity\Festival $festival ) {
return $this->festivals->removeElement( $festival );
}
/**
* Get festivals.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getFestivals() {
return $this->festivals;
}
/**
* Set activeFestival.
*
* @param \AppBundle\Entity\Festival|null $activeFestival
*
* @return User
*/
public function setActiveFestival( \AppBundle\Entity\Festival $activeFestival = null ) {
$this->activeFestival = $activeFestival;
return $this;
}
/**
* Get activeFestival.
*
* @return \AppBundle\Entity\Festival|null
*/
public function getActiveFestival() {
return $this->activeFestival;
}
/**
* Set twitterId.
*
* @param string|null $twitterId
*
* @return User
*/
public function setTwitterId( $twitterId = null ) {
$this->twitterId = $twitterId;
return $this;
}
/**
* Get twitterId.
*
* @return string|null
*/
public function getTwitterId() {
return $this->twitterId;
}
/**
* Set disqusId.
*
* @param string|null $disqusId
*
* @return User
*/
public function setDisqusId( $disqusId = null ) {
$this->disqusId = $disqusId;
return $this;
}
/**
* Get disqusId.
*
* @return string|null
*/
public function getDisqusId() {
return $this->disqusId;
}
/**
* Set mastodonId.
*
* @param string|null $mastodonId
*
* @return User
*/
public function setMastodonId($mastodonId = null)
{
$this->mastodonId = $mastodonId;
return $this;
}
/**
* Get mastodonId.
*
* @return string|null
*/
public function getMastodonId()
{
return $this->mastodonId;
}
/**
* Add seriesFestival.
*
* @param \AppBundle\Entity\SerieFestival $seriesFestival
*
* @return User
*/
public function addSeriesFestival(\AppBundle\Entity\SerieFestival $seriesFestival)
{
$this->seriesFestivals[] = $seriesFestival;
return $this;
}
/**
* Remove seriesFestival.
*
* @param \AppBundle\Entity\SerieFestival $seriesFestival
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeSeriesFestival(\AppBundle\Entity\SerieFestival $seriesFestival)
{
return $this->seriesFestivals->removeElement($seriesFestival);
}
/**
* Add expense.
*
* @param \AppBundle\Entity\ExpenseKind $expense
*
* @return User
*/
public function addExpense(\AppBundle\Entity\ExpenseKind $expense)
{
$this->expenses[] = $expense;
return $this;
}
/**
* Remove expense.
*
* @param \AppBundle\Entity\ExpenseKind $expense
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeExpense(\AppBundle\Entity\ExpenseKind $expense)
{
return $this->expenses->removeElement($expense);
}
}

476
v1/old/Entity/User.php~ Executable file
View file

@ -0,0 +1,476 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
/**
* User
*
* @ORM\Table(name="custom_user")
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
*/
class User extends BaseUser {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
private $twitterAccessToken;
/**
* @ORM\Column(name="disqus_id", type="string", length=255, nullable=true)
*/
private $disqusId;
private $disqusAccessToken;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/
private $googleId;
/**
* @ORM\Column(name="mastodon_id", type="string", length=255, nullable=true)
*/
private $mastodonId;
private $googleAccessToken;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
*/
private $categories;
/**
* templates products
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Product", mappedBy="user")
*/
private $products;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="user")
*/
private $productsSold;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user")
*/
private $festivals;
/**
* series of festivals
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SerieFestival", mappedBy="user")
*/
private $seriesFestivals;
/**
* current festival we are recording sellings for
* @ORM\OneToOne(targetEntity="AppBundle\Entity\Festival")
*/
private $activeFestival;
//expenses previsionnel configs
/**
* @ORM\Column(name="averageMonthlyEarnings", type="float", nullable=true)
*/
private $averageMonthlyEarnings;
/**
* available money, for previsionnel calculation
* @ORM\Column(name="disponibility", type="float", nullable=true)
*/
private $disponibility;
/**
* expenses by kind, for previsionnel
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ExpenseKind", mappedBy="user")
*/
private $expenses;
/**
* @return mixed
*/
public function getAverageMonthlyEarnings()
{
return $this->averageMonthlyEarnings;
}
/**
* @param mixed $averageMonthlyEarnings
*/
public function setAverageMonthlyEarnings($averageMonthlyEarnings)
{
$this->averageMonthlyEarnings = $averageMonthlyEarnings;
}
/**
* @return mixed
*/
public function getDisponibility()
{
return $this->disponibility;
}
/**
* @param mixed $disponibility
*/
public function setDisponibility($disponibility)
{
$this->disponibility = $disponibility;
}
/**
* @return mixed
*/
public function getSeriesFestivals()
{
return $this->seriesFestivals;
}
/**
* @param mixed $seriesFestivals
*/
public function setSeriesFestivals($seriesFestivals)
{
$this->seriesFestivals = $seriesFestivals;
}
/**
* @return mixed
*/
public function getExpenses()
{
return $this->expenses;
}
/**
* @param mixed $expenses
*/
public function setExpenses($expenses)
{
$this->expenses = $expenses;
}
/**
* @return mixed
*/
public function getProductsSold() {
return $this->productsSold;
}
/**
* @return mixed
*/
public function addProductsSold( $product ) {
return $this->productsSold[] = $product;
}
/**
* @param mixed $productsSold
*/
public function setProductsSold( $productsSold ) {
$this->productsSold = $productsSold;
}
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord", mappedBy="user")
*/
private $sellRecords;
/**
* @return mixed
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function addSellRecords( $sellRecords ) {
$this->sellRecords[] = $sellRecords;
}
/**
* @return mixed
*/
public function getGoogleAccessToken() {
return $this->googleAccessToken;
}
/**
* @param mixed $googleAccessToken
*/
public function setGoogleAccessToken( $googleAccessToken ) {
$this->googleAccessToken = $googleAccessToken;
}
/**
* @return mixed
*/
public function getDisqusAccessToken() {
return $this->disqusAccessToken;
}
/**
* @param mixed $disqusAccessToken
*/
public function setDisqusAccessToken( $disqusAccessToken ) {
$this->disqusAccessToken = $disqusAccessToken;
}
/**
* @return mixed
*/
public function getTwitterAccessToken() {
return $this->twitterAccessToken;
}
/**
* @param mixed $twitterAccessToken
*/
public function setTwitterAccessToken( $TwitterAccessToken ) {
$this->twitterAccessToken = $TwitterAccessToken;
}
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/
public function getCategories() {
return $this->categories;
}
/**
* @param mixed $categories
*/
public function setCategories( $categories ) {
$this->categories = $categories;
}
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set googleId
*
* @param string $googleId
*
* @return User
*/
public function setGoogleId( $googleId ) {
$this->googleId = $googleId;
return $this;
}
/**
* Get googleId
*
* @return string
*/
public function getGoogleId() {
return $this->googleId;
}
/**
* Add product
*
* @param \AppBundle\Entity\Product $product
*
* @return User
*/
public function addProduct( \AppBundle\Entity\Product $product ) {
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \AppBundle\Entity\Product $product
*/
public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product );
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold->removeElement( $productsSold );
}
/**
* Add category
*
* @param \AppBundle\Entity\ProductCategory $category
*
* @return User
*/
public function addCategory( \AppBundle\Entity\ProductCategory $category ) {
$this->categories[] = $category;
return $this;
}
/**
* Remove category
*
* @param \AppBundle\Entity\ProductCategory $category
*/
public function removeCategory( \AppBundle\Entity\ProductCategory $category ) {
$this->categories->removeElement( $category );
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return User
*/
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords->removeElement( $sellRecord );
}
/**
* Add festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return User
*/
public function addFestival( \AppBundle\Entity\Festival $festival ) {
$this->festivals[] = $festival;
return $this;
}
/**
* Remove festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeFestival( \AppBundle\Entity\Festival $festival ) {
return $this->festivals->removeElement( $festival );
}
/**
* Get festivals.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getFestivals() {
return $this->festivals;
}
/**
* Set activeFestival.
*
* @param \AppBundle\Entity\Festival|null $activeFestival
*
* @return User
*/
public function setActiveFestival( \AppBundle\Entity\Festival $activeFestival = null ) {
$this->activeFestival = $activeFestival;
return $this;
}
/**
* Get activeFestival.
*
* @return \AppBundle\Entity\Festival|null
*/
public function getActiveFestival() {
return $this->activeFestival;
}
/**
* Set twitterId.
*
* @param string|null $twitterId
*
* @return User
*/
public function setTwitterId( $twitterId = null ) {
$this->twitterId = $twitterId;
return $this;
}
/**
* Get twitterId.
*
* @return string|null
*/
public function getTwitterId() {
return $this->twitterId;
}
/**
* Set disqusId.
*
* @param string|null $disqusId
*
* @return User
*/
public function setDisqusId( $disqusId = null ) {
$this->disqusId = $disqusId;
return $this;
}
/**
* Get disqusId.
*
* @return string|null
*/
public function getDisqusId() {
return $this->disqusId;
}
}

0
v1/old/TEST Executable file
View file

7
v1/old/app/.htaccess Executable file
View file

@ -0,0 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>

7
v1/old/app/AppCache.php Executable file
View file

@ -0,0 +1,7 @@
<?php
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
class AppCache extends HttpCache
{
}

58
v1/old/app/AppKernel.php Executable file
View file

@ -0,0 +1,58 @@
<?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel {
public function registerBundles() {
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new CaisseBliss\AppBundle(),
new FOS\UserBundle\FOSUserBundle(),
// new Http\HttplugBundle\HttplugBundle(),
// new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
];
if ( in_array( $this->getEnvironment(), [ 'dev', 'test' ], true ) ) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
if ( 'dev' === $this->getEnvironment() ) {
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}
return $bundles;
}
public function getRootDir() {
return __DIR__;
}
public function getCacheDir() {
return dirname( __DIR__ ) . '/var/cache/' . $this->getEnvironment();
}
public function getLogDir() {
return dirname( __DIR__ ) . '/var/logs';
}
public function registerContainerConfiguration( LoaderInterface $loader ) {
$loader->load( function ( ContainerBuilder $container ) {
$container->setParameter( 'container.autowiring.strict_mode', true );
$container->setParameter( 'container.dumper.inline_class_loader', true );
$container->addObjectResource( $this );
} );
$loader->load( $this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml' );
}
}

View file

@ -0,0 +1,5 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block fos_user_content %}
TODO changer le pass
{% endblock fos_user_content %}

View file

@ -0,0 +1,3 @@
formulaire de changement de pass

View file

@ -0,0 +1,6 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block fos_user_content %}
<p>check mail</p>
{% endblock fos_user_content %}

View file

@ -0,0 +1,11 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block fos_user_content %}
<p>enregistrement confirmé</p>
{% if targetUrl %}
<p>
retour enregistrement
</p>
{% endif %}
{% endblock fos_user_content %}

View file

@ -0,0 +1,12 @@
{% block subject %}
{%- autoescape false -%}
{{ 'registration.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }}
{%- endautoescape -%}
{% endblock %}
{% block body_text %}
{% autoescape false %}
{{ 'registration.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }}
{% endautoescape %}
{% endblock %}
{% block body_html %}{% endblock %}

View file

@ -0,0 +1,22 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block fos_user_content %}
<div class="row">
<div class="col-xs-6">
<h1>Enregistrer un nouveau compte</h1>
TODO
</div>
<div class="col-xs-6">
ou bien,
{#<a class="btn btn-info" href="{{ path('fos_user_security_login') }}">se connecter.</a>#}
<a class="btn btn-info" href="#">
Mot de passe oublié?
</a>
</div>
</div>
{% endblock fos_user_content %}

View file

@ -0,0 +1,4 @@
enregistrer un compte
<br>
envoyer

View file

@ -0,0 +1,14 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block fos_user_content %}
<div class="row">
<div class="col-xs-6">
<h1>Mot de passe oublié</h1>
reset TODO
</div>
<div class="col-xs-6">
ou bien,
{#<a class="btn btn-info" href="{{ path('fos_user_security_login') }}">se connecter.</a>#}
</div>
</div>
{% endblock fos_user_content %}

View file

@ -0,0 +1,73 @@
{% extends "@FOSUser/layout.html.twig" %}
{% block fos_user_content %}
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="padded">
<h1>
<i class="fa fa-key"></i>
Se connecter
</h1>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="visible-xs">
<hr>
</div>
<div class="padded">
<p>
<a class="btn btn-info btn-block" href="#">
Créer un compte
</a>
<a class="btn btn-warning btn-block" href="#">
Mot de passe oublié?
</a>
<a href="#" id="demo_login_btn" class="btn btn-block btn-primary">
<i class="fa fa-arrow-circle-right"></i>
Se connecter à la démo</a>
</p>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
<div class="padded">
{% if error %}
<div class="alert alert-info">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form action="#" method="post">
{% if csrf_token %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
{% endif %}
<div>
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" class="input-lg" name="_username" value="{{ last_username }}"
required="required"
autocomplete="username"/>
</div>
<div>
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" class="input-lg" name="_password" required="required"
autocomplete="current-password"/>
</div>
<div class="padded-v">
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
</div>
<input class="btn btn-success btn-block btn-lg" type="submit" id="_submit" name="_submit"
value="{{ 'security.login.submit'|trans }}"/>
</form>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,22 @@
{% if error %}
<div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<form action="#" method="post">
{% if csrf_token %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
{% endif %}
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required"
autocomplete="username"/>
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required" autocomplete="current-password"/>
<br>
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<br>
<input class="btn btn-primary btn-block" type="submit" id="_submit" name="_submit"
value="{{ 'security.login.submit'|trans }}"/>
</form>

View file

@ -0,0 +1,19 @@
{% extends 'base.html.twig' %}
{% block title %}Caisse{% endblock %}
{% block bigMain %}
{% include 'default/header.html.twig' %}
<section class="bg-girl padded login-fosub">
<div class="container">
<div class="row justify-content-md-center align-items-center">
<div class="col-md-auto">
<fieldset class="bg-shader pull-left form-group padded">
{% block fos_user_content %}{% endblock %}
</fieldset>
</div>
</div>
</div>
</section>
{% include 'default/footer.html.twig' %}
{% endblock %}

View file

@ -0,0 +1,498 @@
<?php
/*
* This file is part of the HWIOAuthBundle package.
*
* (c) Hardware.Info <opensource@hardware.info>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace HWI\Bundle\OAuthBundle\Controller;
use HWI\Bundle\OAuthBundle\Event\FilterUserResponseEvent;
use HWI\Bundle\OAuthBundle\Event\FormEvent;
use HWI\Bundle\OAuthBundle\Event\GetResponseUserEvent;
use HWI\Bundle\OAuthBundle\HWIOAuthEvents;
use HWI\Bundle\OAuthBundle\OAuth\ResourceOwnerInterface;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;
use HWI\Bundle\OAuthBundle\Security\Core\Exception\AccountNotLinkedException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AccountStatusException;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\SecurityEvents;
/**
* @author Alexander <iam.asm89@gmail.com>
*/
class ConnectController extends Controller {
private $tokenManager;
public function __construct( CsrfTokenManagerInterface $tokenManager = null ) {
$this->tokenManager = new CsrfTokenManager();
}
/**
* Action that handles the login 'form'. If connecting is enabled the
* user will be redirected to the appropriate login urls or registration forms.
*
* @param Request $request
*
* @throws \LogicException
*
* @return Response
*/
public function connectAction( Request $request ) {
// var_dump( "override" );
// var_dump( $this->tokenManager );
// die();
$csrf_token = $this->tokenManager
? $this->tokenManager->getToken( 'authenticate' )->getValue()
: null;
$connect = $this->container->getParameter( 'hwi_oauth.connect' );
$hasUser = $this->getUser() ? $this->isGranted( $this->container->getParameter( 'hwi_oauth.grant_rule' ) ) : false;
$error = $this->getErrorForRequest( $request );
// if connecting is enabled and there is no user, redirect to the registration form
if ( $connect && ! $hasUser && $error instanceof AccountNotLinkedException ) {
$key = time();
$session = $request->getSession();
$session->set( '_hwi_oauth.registration_error.' . $key, $error );
return $this->redirectToRoute( 'hwi_oauth_connect_registration', [ 'key' => $key ] );
}
if ( $error ) {
if ( $error instanceof AuthenticationException ) {
$error = $error->getMessageKey();
} else {
$error = $error->getMessage();
}
}
$csrf_token = '';
return $this->render( '@HWIOAuth/Connect/login.html.twig',
[
'csrf_token' => $csrf_token,
'error' => $error,
] );
}
/**
* Shows a registration form if there is no user logged in and connecting
* is enabled.
*
* @param Request $request a request
* @param string $key key used for retrieving the right information for the registration form
*
* @return Response
*
* @throws NotFoundHttpException if `connect` functionality was not enabled
* @throws AccessDeniedException if any user is authenticated
* @throws \RuntimeException
*/
public function registrationAction( Request $request, $key ) {
$connect = $this->container->getParameter( 'hwi_oauth.connect' );
if ( ! $connect ) {
throw new NotFoundHttpException();
}
$hasUser = $this->isGranted( $this->container->getParameter( 'hwi_oauth.grant_rule' ) );
if ( $hasUser ) {
throw new AccessDeniedException( 'Cannot connect already registered account.' );
}
$session = $request->getSession();
$error = $session->get( '_hwi_oauth.registration_error.' . $key );
$session->remove( '_hwi_oauth.registration_error.' . $key );
if ( ! $error instanceof AccountNotLinkedException ) {
throw new \RuntimeException( 'Cannot register an account.',
0,
$error instanceof \Exception ? $error : null );
}
$userInformation = $this
->getResourceOwnerByName( $error->getResourceOwnerName() )
->getUserInformation( $error->getRawToken() );
/* @var $form FormInterface */
if ( $this->container->getParameter( 'hwi_oauth.fosub_enabled' ) ) {
// enable compatibility with FOSUserBundle 1.3.x and 2.x
if ( interface_exists( 'FOS\UserBundle\Form\Factory\FactoryInterface' ) ) {
$form = $this->container->get( 'hwi_oauth.registration.form.factory' )->createForm();
} else {
$form = $this->container->get( 'hwi_oauth.registration.form' );
}
} else {
$form = $this->container->get( 'hwi_oauth.registration.form' );
}
$formHandler = $this->container->get( 'hwi_oauth.registration.form.handler' );
if ( $formHandler->process( $request, $form, $userInformation ) ) {
$event = new FormEvent( $form, $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::REGISTRATION_SUCCESS, $event );
$this->container->get( 'hwi_oauth.account.connector' )->connect( $form->getData(), $userInformation );
// Authenticate the user
$this->authenticateUser( $request,
$form->getData(),
$error->getResourceOwnerName(),
$error->getAccessToken() );
if ( null === $response = $event->getResponse() ) {
if ( $targetPath = $this->getTargetPath( $session ) ) {
$response = $this->redirect( $targetPath );
} else {
$response = $this->render( '@HWIOAuth/Connect/registration_success.html.twig',
[
'userInformation' => $userInformation,
] );
}
}
$event = new FilterUserResponseEvent( $form->getData(), $request, $response );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::REGISTRATION_COMPLETED, $event );
return $response;
}
// reset the error in the session
$session->set( '_hwi_oauth.registration_error.' . $key, $error );
$event = new GetResponseUserEvent( $form->getData(), $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::REGISTRATION_INITIALIZE, $event );
if ( $response = $event->getResponse() ) {
return $response;
}
return $this->render( '@HWIOAuth/Connect/registration.html.twig',
[
'key' => $key,
'form' => $form->createView(),
'userInformation' => $userInformation,
] );
}
/**
* Connects a user to a given account if the user is logged in and connect is enabled.
*
* @param Request $request the active request
* @param string $service name of the resource owner to connect to
*
* @throws \Exception
*
* @return Response
*
* @throws NotFoundHttpException if `connect` functionality was not enabled
* @throws AccessDeniedException if no user is authenticated
*/
public function connectServiceAction( Request $request, $service ) {
$connect = $this->container->getParameter( 'hwi_oauth.connect' );
if ( ! $connect ) {
throw new NotFoundHttpException();
}
$hasUser = $this->isGranted( $this->container->getParameter( 'hwi_oauth.grant_rule' ) );
if ( ! $hasUser ) {
throw new AccessDeniedException( 'Cannot connect an account.' );
}
// Get the data from the resource owner
$resourceOwner = $this->getResourceOwnerByName( $service );
$session = $request->getSession();
$key = $request->query->get( 'key', time() );
if ( $resourceOwner->handles( $request ) ) {
$accessToken = $resourceOwner->getAccessToken(
$request,
$this->container->get( 'hwi_oauth.security.oauth_utils' )->getServiceAuthUrl( $request, $resourceOwner )
);
// save in session
$session->set( '_hwi_oauth.connect_confirmation.' . $key, $accessToken );
} else {
$accessToken = $session->get( '_hwi_oauth.connect_confirmation.' . $key );
}
// Redirect to the login path if the token is empty (Eg. User cancelled auth)
if ( null === $accessToken ) {
if ( $this->container->getParameter( 'hwi_oauth.failed_use_referer' ) && $targetPath = $this->getTargetPath( $session,
'failed_target_path' ) ) {
return $this->redirect( $targetPath );
}
return $this->redirectToRoute( $this->container->getParameter( 'hwi_oauth.failed_auth_path' ) );
}
// Show confirmation page?
if ( ! $this->container->getParameter( 'hwi_oauth.connect.confirmation' ) ) {
return $this->getConfirmationResponse( $request, $accessToken, $service );
}
// Symfony <3.0 BC
/** @var $form FormInterface */
$form = method_exists( 'Symfony\Component\Form\AbstractType', 'getBlockPrefix' )
? $this->createForm( FormType::class )
: $this->createForm( 'form' );
// Handle the form
$form->handleRequest( $request );
if ( $form->isSubmitted() && $form->isValid() ) {
return $this->getConfirmationResponse( $request, $accessToken, $service );
}
$event = new GetResponseUserEvent( $this->getUser(), $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::CONNECT_INITIALIZE, $event );
if ( $response = $event->getResponse() ) {
return $response;
}
return $this->render( '@HWIOAuth/Connect/connect_confirm.html.twig',
[
'key' => $key,
'service' => $service,
'form' => $form->createView(),
'userInformation' => $resourceOwner->getUserInformation( $accessToken ),
] );
}
/**
* @param Request $request
* @param string $service
*
* @throws NotFoundHttpException
*
* @return RedirectResponse
*/
public function redirectToServiceAction( Request $request, $service ) {
try {
$authorizationUrl = $this->container->get( 'hwi_oauth.security.oauth_utils' )->getAuthorizationUrl( $request,
$service );
} catch ( \RuntimeException $e ) {
throw new NotFoundHttpException( $e->getMessage(), $e );
}
// Check for a return path and store it before redirect
if ( $request->hasSession() ) {
// initialize the session for preventing SessionUnavailableException
$session = $request->getSession();
$session->start();
foreach ( $this->container->getParameter( 'hwi_oauth.firewall_names' ) as $providerKey ) {
$sessionKey = '_security.' . $providerKey . '.target_path';
$sessionKeyFailure = '_security.' . $providerKey . '.failed_target_path';
$param = $this->container->getParameter( 'hwi_oauth.target_path_parameter' );
if ( ! empty( $param ) && $targetUrl = $request->get( $param ) ) {
$session->set( $sessionKey, $targetUrl );
}
if ( $this->container->getParameter( 'hwi_oauth.failed_use_referer' ) && ! $session->has( $sessionKeyFailure ) && ( $targetUrl = $request->headers->get( 'Referer' ) ) && $targetUrl !== $authorizationUrl ) {
$session->set( $sessionKeyFailure, $targetUrl );
}
if ( $this->container->getParameter( 'hwi_oauth.use_referer' ) && ! $session->has( $sessionKey ) && ( $targetUrl = $request->headers->get( 'Referer' ) ) && $targetUrl !== $authorizationUrl ) {
$session->set( $sessionKey, $targetUrl );
}
}
}
return $this->redirect( $authorizationUrl );
}
/**
* Get the security error for a given request.
*
* @param Request $request
*
* @return string|\Exception
*/
protected function getErrorForRequest( Request $request ) {
$authenticationErrorKey = Security::AUTHENTICATION_ERROR;
$session = $request->getSession();
if ( $request->attributes->has( $authenticationErrorKey ) ) {
$error = $request->attributes->get( $authenticationErrorKey );
} elseif ( null !== $session && $session->has( $authenticationErrorKey ) ) {
$error = $session->get( $authenticationErrorKey );
$session->remove( $authenticationErrorKey );
} else {
$error = '';
}
return $error;
}
/**
* Get a resource owner by name.
*
* @param string $name
*
* @return ResourceOwnerInterface
*
* @throws NotFoundHttpException if there is no resource owner with the given name
*/
protected function getResourceOwnerByName( $name ) {
foreach ( $this->container->getParameter( 'hwi_oauth.firewall_names' ) as $firewall ) {
$id = 'hwi_oauth.resource_ownermap.' . $firewall;
if ( ! $this->container->has( $id ) ) {
continue;
}
$ownerMap = $this->container->get( $id );
if ( $resourceOwner = $ownerMap->getResourceOwnerByName( $name ) ) {
return $resourceOwner;
}
}
throw new NotFoundHttpException( sprintf( "No resource owner with name '%s'.", $name ) );
}
/**
* Generates a route.
*
* @deprecated since version 0.4. Will be removed in 1.0.
*
* @param string $route Route name
* @param array $params Route parameters
* @param bool $absolute absolute url or note
*
* @return string
*/
protected function generate( $route, array $params = [], $absolute = false ) {
@trigger_error( 'The ' . __METHOD__ . ' method is deprecated since version 0.4 and will be removed in 1.0. Use Symfony\Bundle\FrameworkBundle\Controller\Controller::generateUrl instead.',
E_USER_DEPRECATED );
return $this->container->get( 'router' )->generate( $route, $params, $absolute );
}
/**
* Authenticate a user with Symfony Security.
*
* @param Request $request
* @param UserInterface $user
* @param string $resourceOwnerName
* @param string $accessToken
* @param bool $fakeLogin
*/
protected function authenticateUser(
Request $request,
UserInterface $user,
$resourceOwnerName,
$accessToken,
$fakeLogin = true
) {
try {
$this->container->get( 'hwi_oauth.user_checker' )->checkPreAuth( $user );
$this->container->get( 'hwi_oauth.user_checker' )->checkPostAuth( $user );
} catch ( AccountStatusException $e ) {
// Don't authenticate locked, disabled or expired users
return;
}
$token = new OAuthToken( $accessToken, $user->getRoles() );
$token->setResourceOwnerName( $resourceOwnerName );
$token->setUser( $user );
$token->setAuthenticated( true );
$this->get( 'security.token_storage' )->setToken( $token );
if ( $fakeLogin ) {
// Since we're "faking" normal login, we need to throw our INTERACTIVE_LOGIN event manually
$this->container->get( 'event_dispatcher' )->dispatch(
SecurityEvents::INTERACTIVE_LOGIN,
new InteractiveLoginEvent( $request, $token )
);
}
}
/**
* @param SessionInterface $session
*
* @return string|null
*/
private function getTargetPath( SessionInterface $session ) {
foreach ( $this->container->getParameter( 'hwi_oauth.firewall_names' ) as $providerKey ) {
$sessionKey = '_security.' . $providerKey . '.target_path';
if ( $session->has( $sessionKey ) ) {
return $session->get( $sessionKey );
}
}
return null;
}
/**
* @param Request $request The active request
* @param array $accessToken The access token
* @param string $service Name of the resource owner to connect to
*
* @return Response
*
* @throws NotFoundHttpException if there is no resource owner with the given name
*/
private function getConfirmationResponse( Request $request, array $accessToken, $service ) {
/** @var $currentToken OAuthToken */
$currentToken = $this->container->get( 'security.token_storage' )->getToken();
/** @var $currentUser UserInterface */
$currentUser = $currentToken->getUser();
/** @var $resourceOwner ResourceOwnerInterface */
$resourceOwner = $this->getResourceOwnerByName( $service );
/** @var $userInformation UserResponseInterface */
$userInformation = $resourceOwner->getUserInformation( $accessToken );
$event = new GetResponseUserEvent( $currentUser, $request );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::CONNECT_CONFIRMED, $event );
$this->container->get( 'hwi_oauth.account.connector' )->connect( $currentUser, $userInformation );
if ( $currentToken instanceof OAuthToken ) {
// Update user token with new details
$newToken =
is_array( $accessToken ) &&
( isset( $accessToken[ 'access_token' ] ) || isset( $accessToken[ 'oauth_token' ] ) ) ?
$accessToken : $currentToken->getRawToken();
$this->authenticateUser( $request, $currentUser, $service, $newToken, false );
}
if ( null === $response = $event->getResponse() ) {
if ( $targetPath = $this->getTargetPath( $request->getSession() ) ) {
$response = $this->redirect( $targetPath );
} else {
$response = $this->render( '@HWIOAuth/Connect/connect_success.html.twig',
[
'userInformation' => $userInformation,
'service' => $service,
] );
}
}
$event = new FilterUserResponseEvent( $currentUser, $request, $response );
$this->get( 'event_dispatcher' )->dispatch( HWIOAuthEvents::CONNECT_COMPLETED, $event );
return $response;
}
}

View file

@ -0,0 +1,94 @@
{% extends '@HWIOAuth/layout.html.twig' %}
{% block bigMain %}
{% include 'default/header.html.twig' %}
<section class="bg-girl padded login-hwioauth">
<div class="container">
<div class="row justify-content-md-center align-items-center">
<div class="col-md-auto">
<fieldset class="bg-shader pull-left form-group padded">
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="row">
<div class="col-xs-12 col-sm-6">
<h1>
<i class="fa fa-key"></i>
Se connecter
</h1>
{#<div class="alert alert-info">#}
{#En raison de maintenance technique, seul le login via twitter fonctionne#}
{#actuellement.#}
{#</div>#}
{% if error %}
<div class="alert alert-danger">
{{ error|trans }}
</div>
{% endif %}
<form action="#" method="post">
{% if csrf_token is defined %}
csrf_token : {{ csrf_token }}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
{% else %}
<div class="alert alert-danger">
PAS DE TOKEN
</div>
{% endif %}
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username"
value="" required="required"
autocomplete="username"/>
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password"
required="required"
autocomplete="current-password"/>
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<input type="submit" id="_submit" name="_submit"
value="{{ 'security.login.submit'|trans }}"/>
</form>
</div>
<div class="col-xs-12 col-sm-6">
{#<p>#}
{#<a class="btn btn-info" href="{{ path('fos_user_resetting_request') }}">#}
{#Mot de passe oublié?#}
{#</a>#}
{#</p>#}
<p>
<a class="btn btn-info btn-block"
href="#">
Créer un compte
</a>
</p>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6">
{#{% block hwi_oauth_content %}#}
{#<h1>oauth login</h1>#}
{#{% if error is defined and error %}#}
{#<div class="alert alert-danger pull-left">{{ error|trans }}</div>#}
{#{% endif %}#}
{#<a class="btn btn-default btn-{{ "twitter" }}"#}
{#href="{{ hwi_oauth_login_url("twitter") }}">#}
{#<i class="fa fa-{{ "twitter" }}"></i>#}
{#{{ "twitter" | trans({}, 'HWIOAuthBundle') }}#}
{#</a>#}
{#{% endblock hwi_oauth_content %}#}
</div>
</div>
</fieldset>
</div>
</div>
</div>
</section>
{% include 'default/footer.html.twig' %}
{% endblock %}

View file

@ -0,0 +1,41 @@
{% extends '::default/index.html.twig' %}
{% block title %}Login{% endblock %}
{% block body %}
<h2>Le login</h2>
<div class="row">
<div class="col-xs-6">
{% if error %}
<div>{{ error|trans }}</div>
{% endif %}
<form action="#" method="post">
{% if csrf_token is defined %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token }}"/>
{% else %}
PAS DE TOKEN CSRF
{% endif %}
<label for="username">{{ 'security.login.username'|trans }}</label>
<input type="text" id="username" name="_username" value="" required="required"
autocomplete="username"/>
<label for="password">{{ 'security.login.password'|trans }}</label>
<input type="password" id="password" name="_password" required="required"
autocomplete="current-password"/>
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
<input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}"/>
</form>
</div>
<div class="col-xs-6">
{#{% block hwi_oauth_content %}#}
{#{% endblock %}#}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,57 @@
{% trans_default_domain 'messages' %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="google-signin-client_id"
content="938689189350-frtrg93bnva4b3p7c1al880mi3ts5i35.apps.googleusercontent.com">
<title>{% block title %} {% trans %}menu.title{% endtrans %} - Fiche de compte dynamique{% endblock %}</title>
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
{% endblock %}
</head>
<body>
{% block navigation %}
{% endblock %}
<div id="bodyland">
{% block bigMain %}
{% include 'default/header.html.twig' %}
<div class="row">
<div class="col-xs-12 col-sm-9 col-sm-offset-3 col-md-9 col-md-offset-3">
{% block body %}
{% endblock %}
</div>
</div>
{% include 'default/footer.html.twig' %}
{% endblock %}
</div>
{% block javascripts %}
<script src="{{ asset('build/app.js') }}"></script>
<!-- Matomo -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "https://piwik.cipherbliss.com/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', '1']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.defer = true;
g.src = u + 'piwik.js';
s.parentNode.insertBefore(g, s);
})();
</script>
<!-- End Matomo Code -->
{% endblock %}
</body>
</html>

View file

@ -0,0 +1,48 @@
<div class="product-values marged-v">
<div class="row">
<div class="col-xs-12 col-md-4 text-center product-values-block">
<i class="fa fa-check-circle fa-3x"></i>
<h2 class="text-center">{% trans %}home.specs.free{% endtrans %}</h2>
<p>{% trans %}home.specs.free_text{% endtrans %}</p>
</div>
<div class="col-xs-12 col-md-4 text-center product-values-block">
<i class="fa fa-random fa-3x"></i>
<h2>{% trans %}home.specs.flex{% endtrans %}</h2>
<p>{% trans %}home.specs.flex_text{% endtrans %}</p>
</div>
<div class="col-xs-12 col-md-4 text-center product-values-block">
<i class="fa fa-truck fa-3x"></i>
<h2>{% trans %}home.specs.portable{% endtrans %}</h2>
<p>{% trans %}home.specs.portable_text{% endtrans %}</p>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-4 text-center product-values-block">
<i class="fa fa-rotate-left fa-3x"></i>
<h2>{% trans %}home.specs.open{% endtrans %}</h2>
<p>{% trans %}home.specs.open_text{% endtrans %}
<ul>
<li>
<a href="https://framagit.org/tykayn/caisse-bliss">gitlab.</a>
</li>
<li>
<a href="https://www.cipherbliss.com">CipherBliss</a>
</li>
</ul>
</p>
</div>
<div class="col-xs-12 col-md-4 text-center product-values-block">
<i class="fa fa-pie-chart fa-3x"></i>
<h2>{% trans %}home.specs.stats{% endtrans %}</h2>
<p>
{% trans %}home.specs.stats_text{% endtrans %}
</p>
</div>
<div class="col-xs-12 col-md-4 text-center product-values-block">
<i class="fa fa-heart-o fa-3x"></i>
<h2>{% trans %}home.specs.data{% endtrans %}</h2>
<p>{% trans %}home.specs.data_text{% endtrans %}</p>
</div>
</div>
</div>

View file

@ -0,0 +1,27 @@
<footer class="big-footer text-center navbar-inverse navbar-footer ">
<sub class="footer-note text-center">
{% trans %}global.made_by{% endtrans %}
<a href="https://mastodon.cipherbliss.com/@tykayn">
<i class="fa fa-share-alt"></i>
Tykayn -
</a>
<a href="https://www.cipherbliss.com">
<i class="fa fa-world"></i>
Cipher Bliss
</a>
<a href="https://framagit.org/tykayn/caisse-bliss">
<i class="fa fa-gitlab"></i>
sources de la Caisse Bliss
</a>
-
<a href="https://framagit.org/tykayn/caisse-bliss/blob/master/LICENSE">
<i class="fa fa-file-text"></i>
Licence AGPL v3
</a>
-
<a href="mailto:contact@cipherbliss.com">
<i class="fa fa-envelope-o"></i>
contact
</a>
</sub>
</footer>

View file

@ -0,0 +1,27 @@
<div class="header-block">
<div class="nav padded">
<div class="row">
<div class="col-xs-12">
{% include 'default/login-choices.html.twig' %}
</div>
</div>
<div class="nav-elements">
{% if app.request.hasPreviousSession %}
{% for type, messages in app.session.flashBag.all %}
{% for message in messages %}
<div class="{{ type }}">
{{ message|trans({}, 'FOSUserBundle') }}
</div>
{% endfor %}
{% endfor %}
{% endif %}
<div>
{% block fos_user_content %}
{% endblock fos_user_content %}
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,6 @@
{% extends 'base.html.twig' %}
{% block bigMain %}
{% include 'default/main-screen.html.twig' %}
{% endblock %}

View file

@ -0,0 +1,181 @@
{% block loginchoices %}
<div class="loginland ">
<div class="login-choices">
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
<div class="row">
<div class="col-xs-12 col-sm-9">
<div id="menu-dashboard">
<ul class="nav">
<li>
<a href="{{ path('homepage') }}" class="btn btn-default logo-home">
<i class="fa fa-home"></i>
{% trans %}menu.title{% endtrans %}
</a>
</li>
<li>
<a class="btn {% if app.request.attributes.get('_route') == 'dashboard' %}
btn-success
{% else %}
btn-default
{% endif %}" href="{{ path('dashboard') }}">
<i class="fa fa-list"></i>
{% trans %}menu.dashboard{% endtrans %}
</a>
</li>
<li>
<a class="btn {% if app.request.attributes.get('_route') == 'productcategory_index' %}
btn-success
{% else %}
btn-default
{% endif %} "
href="{{ path('productcategory_index') }}">
<i class="fa fa-file-archive-o"></i>
{% trans %}menu.categories{% endtrans %}
<span class="badge">
{{ app.user.categories|length }}
</span>
</a>
</li>
<li>
<a class="btn {% if app.request.attributes.get('_route') == 'product_index' %}
btn-success
{% else %}
btn-default
{% endif %} "
href="{{ path('product_index') }}"
>
<i class="fa fa-gears"></i>
{% trans %}menu.products{% endtrans %}
<span class="badge">
{{ app.user.products|length }}
</span>
</a>
</li>
<li>
<a id="menu_festivals" class="btn {% if app.request.attributes.get('_route') == 'festival_index' %}
btn-success
{% else %}
btn-default
{% endif %}
" href='{{ path('festival_index') }}'
>
<i class="fa fa-th-large"></i>
{% trans %}menu.festivals{% endtrans %}
<span class="badge">
{{ app.user.festivals|length }}
</span>
</a>
</li>
<li>
<a id="menu_series" class="btn {% if app.request.attributes.get('_route') == 'seriefestival_index' %}
btn-success
{% else %}
btn-default
{% endif %}
" href='{{ path('seriefestival_index') }}'
>
<i class="fa fa-th-large"></i>
{% trans %}menu.series{% endtrans %}
<span class="badge">
{{ app.user.seriesFestivals|length }}
</span>
</a>
</li>
<li>
<a class="btn {% if app.request.attributes.get('_route') == 'history' %}
btn-success
{% else %}
btn-default
{% endif %}" href="{{ path('history') }}"
>
<i class="fa fa-clock-o"></i>
{% trans %}menu.history{% endtrans %}
</a>
</li>
<li>
<a class="btn {% if app.request.attributes.get('_route') == 'import' %}
btn-success
{% else %}
btn-default
{% endif %}" href="{{ path('import') }}"
>
<i class="fa fa-arrow-circle-o-up"></i>
{% trans %}menu.import{% endtrans %}
</a>
</li>
<li>
<a id="menu_previsionnel" class="btn {% if app.request.attributes.get('_route') == 'previsionnel' %}
btn-success
{% else %}
btn-default
{% endif %}" href="{{ path('previsionnel') }}"
>
<i class="fa fa-forward"></i>
{% trans %}menu.future{% endtrans %}
</a>
</li>
<li>
<a href="#" id="introjs_start">
<i class="fa fa-play"></i>
{# {% trans %}menu.introjs{% endtrans %}#}
Visite guidée
</a>
{% if app.user.username == 'demo' %}
<div class="text-warning alert-sm marged ">
<i class="fa fa-info-circle"></i>
<sub> Ceci est un compte de démonstration. Créez votre compte personnel dès
maintenant. </sub>
</div>
{% endif %}
</li>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-3 text-sm-left text-md-right user-info-part">
<button class="btn btn-default visible-xs pull-right" id="menu_button">
<i class="fa fa-bars"></i>
Menu
</button>
{% trans %}user.greet{% endtrans %}
<a href="#" class="user-info-link">
<i class="fa fa-user"></i>
{{ app.user.username }}
</a>
|
<a class="btn btn-default" href="#">
{% trans %}layout.logout{% endtrans %}
</a>
</div>
</div>
{% else %}
<div class="text-right pull-right">
<a class="btn btn-primary"
href="#">
<i class="fa fa-key"></i>
{{ 'layout.login'|trans }}</a>
<a class="btn btn-default"
href="#">Inscription
</a>
</div>
{% endif %}
</div>
</div>
{% endblock loginchoices %}

View file

@ -0,0 +1,100 @@
{% block bigMain %}
{% include 'default/header.html.twig' %}
{% block body %}
<div class="main-screen" id="homepage">
<div id="welcome">
<section class="bg-accessories">
<div class="bg-shader">
<div class="container main-section">
<div class="row">
<div class="col-xs-12 padded-v">
<h1 class="text-center">
{#<i class="fa fa-circle-o-notch logo-main"></i>#}
{% trans %}menu.title{% endtrans %}
</h1>
</div>
<div class="col-xs-12 col-md-6 padded-v">
<div class="description">
{% trans %}home.main_description{% endtrans %}
</div>
</div>
<div class="try col-xs-12 col-md-6">
<br>
<div class="row">
<div class=" padded text-right">
<a class="btn btn-primary"
href="#"
class="btn btn-primary">
{% trans %}home.try{% endtrans %}
</a>
</div>
<div class="hint padded">
<sub>{% trans %}home.demo_hint{% endtrans %}</sub>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<section class="bg-girl">
<div class="bg-shader">
<div class="container">
{% include 'default/description-app.html.twig' %}
<div class="try">
<fieldset class="bg-dark padded">
<div class="row">
<div class="col-xs-12 col-sm-6">
<a class="btn btn-primary" href="{{ path('dashboard') }}"
class="btn btn-success">
{% trans %}home.try{% endtrans %}
</a>
<p>
{% trans %}home.demo_hint{% endtrans %}
</p>
</div>
<div class="col-xs-12 col-sm-6">
<a class="btn btn-primary" href="#">
<i class="fa fa-user"></i>
{% trans %}layout.register{% endtrans %}
</a>
</div>
</div>
</fieldset>
</div>
</div>
</div>
</section>
<section class="bg-color">
<div id="contact" class="text-center">
<i class="fa fa-envelope-open-o"></i>
contactez-moi pour tout renseignement:
<a href="mailto:contact@cipherbliss.com"> par email</a>
, Telegram
<a href="https://t.me/tykayn">
@tykayn
</a>
, ou sur Mastodon
<a href="https://mastodon.cipherbliss.com/@tykayn">
<img src="https://en.gravatar.com/userimage/53061325/811d383aa2ebb8d2d83baab7da5f4a7b.jpeg"
alt="avatar Mastodon" width="50" height="50"> @tykayn
</a>
</div>
</section>
</div>
{% endblock %}
{% include 'default/footer.html.twig' %}
{% endblock %}

View file

@ -0,0 +1,15 @@
{% extends 'base.html.twig' %}
{% block bigMain %}
<div style="padding:2rem;">
<h1>tadam test de mail</h1>
<p>
le contenu Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus doloremque exercitationem
provident quae quod soluta sunt velit. Architecto, assumenda deserunt expedita laudantium nemo voluptatem.
Atque commodi est iste itaque mollitia. Consequatur cumque cupiditate eveniet facilis illo illum impedit
itaque omnis placeat quaerat, quia quidem ratione saepe similique sunt veniam veritatis.
</p>
</div>
{% endblock %}

View file

@ -0,0 +1,25 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Festival edit</h1>
{{ form_start(edit_form) }}
{{ form_widget(edit_form) }}
<input type=submit value=" Envoyer
"/>
{{ form_end(edit_form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('festival_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,95 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="row heading-of-list">
<div class="col-xs-6">
<h1>Festivals</h1></div>
<div class="col-xs-6">
<a class="btn btn-primary" href="{{ path('festival_new') }}">Nouveau festival</a>
</div>
</div>
<table class="table-responsive table-striped table table-bordered table-light">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Datecreation</th>
<th>Tous Frais</th>
<th>Clients</th>
<th>fond caisse avant</th>
<th>fond caisse apres</th>
<th>chiffre affaire</th>
<th>fond caisse + CA</th>
<th>diff</th>
<th>bénefices CA - frais</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for festival in festivals %}
<tr
{% if app.user.activeFestival and (app.user.activeFestival.id == festival.id) %}
class="bg-success"
{% endif %}
>
<td>
<a class="btn btn-primary"
href="{{ path('festival_show', { 'id': festival.id }) }}">{{ festival.id }}</a>
</td>
<td>{{ festival.name }}</td>
<td>{% if festival.dateCreation %}{{ festival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
<td>{{ festival.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement }}
 €
</td>
<td>{{ festival.sellRecords|length }}</td>
<td>{{ festival.fondDeCaisseAvant }}€</td>
<td>{{ festival.fondDeCaisseApres }}€</td>
<td>{{ festival.chiffreAffaire }}€</td>
<td>{{ festival.fondDeCaisseAvant + festival.chiffreAffaire }}€</td>
<td
class="{% if (festival.chiffreAffaire - festival.fondDeCaisseApres) != 0 %}
bg-warning
{% else %}
bg-success
{% endif %}"
>{{ festival.chiffreAffaire - festival.fondDeCaisseApres }}
</td>
<td>{{ festival.chiffreAffaire - (festival.fraisInscription + festival.fraisTransport + festival.fraisRepas + festival.fraisHebergement ) }}</td>
<td>
{% if app.user.activeFestival and (app.user.activeFestival.id == festival.id) %}
<span class="badge badge-success">
Actuel
</span>
{% else %}
<a class="btn btn-success" href="{{ path('set_active_festival', { 'id': festival.id }) }}">
choisir comme actuel
</a>
{% endif %}
{% if festival.user|length %}
{% for u in festival.user %}
<span class="badge badge-info">{{ u.username }}</span>
{% endfor %}
{% else %}
<div class="alert alert-info">
pas d'owner.
</div>
{% endif %}
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">
<i class="fa fa-pencil"></i>
Modifier
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-primary" href="{{ path('festival_new') }}">Nouveau festival</a>
{% endblock %}

View file

@ -0,0 +1,16 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Festival creation</h1>
{{ form_start(form) }}
{{ form_widget(form) }}
<input class="btn btn-primary btn-block" type="submit" value="Créer" />
{{ form_end(form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('festival_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,39 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Festival</h1>
<table class="table-responsive table-striped table table-bordered table-light">
<tbody>
<tr>
<th>Id</th>
<td>{{ festival.id }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ festival.name }}</td>
</tr>
<tr>
<th>Datecreation</th>
<td>{% if festival.dateCreation %}{{ festival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
</tr>
</tbody>
</table>
<ul>
<li>
<a class="btn btn-primary" href="{{ path('festival_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
<li>
<a class="btn btn-primary" href="{{ path('festival_edit', { 'id': festival.id }) }}">edit</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1 @@
<h1>Privacy</h1>

View file

@ -0,0 +1 @@
<h1>Terms of service</h1>

View file

@ -0,0 +1,26 @@
{% verbatim %}
<div id="choice-categories" class="choice-categories well" ng-if="categories.length">
<h2>
<i class="fa-eye fa"></i>
Visibilité des
{{ categories.length - categoriesVisibleCount() }} /
{{ categories.length }} catégories
</h2>
<div ng-repeat="c in categories">
<div class="btn btn-block"
ng-class="{'btn-success': !c.hidden}"
ng-click="c.hidden = !c.hidden">
{{ c.name }}
<span ng-if="c.hidden">(caché)</span>
</div>
</div>
</div>
<div class="well" ng-if="!categories.length">
<i class="fa fa-info"></i>
Aucune catégorie enregistrée
</div>
{% endverbatim %}

View file

@ -0,0 +1,64 @@
{% verbatim %}
<div class="current-selling">
<hr>
<form>
<div class="new-display">
<div class="row">
</div>
<div class="row">
<div class="col-xs-12 col-sm-6">
<button class="btn btn-warning btn-remove-all marged-v" ng-click="removeAll()" ng-disable="!CurrentSellingTotal()">
<i class="fa fa-trash"></i> enlever tout
</button>
</div>
</div>
<div ng-repeat="group in activeSellingFiltered track by $index">
<div class="row">
<div class="col-xs-2">
<span class="btn btn-warning remove-item"
ng-click="removeGroupeProducts(group.groupId)">
<i class="fa fa-trash"></i>
</span>
</div>
<div class="col-xs-10">
<input class="group-name" type="text" ng-model="group.name">
</div>
</div>
<div class="row">
<div class="col-xs-7 col-xs-offset-2 ">
<span ng-if="group.count > 1">
<strong>
{{group.unitPrice}}
€ </strong>
</span>
<span class="badge badge-default" ng-if="group.count">
<i class="fa fa-times"></i> {{group.count}}
</span>
</div>
<div class="col-xs-3 text-right">
<strong>
{{group.totalPrice}}
€ </strong>
</div>
</div>
</div>
</div>
<hr>
{% endverbatim %}
{% include 'logged/angular/totals.html.twig' %}
{% include 'logged/angular/validate-button.html.twig' %}
{% include 'logged/angular/pause-selling.html.twig' %}
</form>
</div>
</div>

View file

@ -0,0 +1,40 @@
{% verbatim %}
<div class="horizontal-land">
<div class="super-large" style="min-width: {{(1+categories.length) * 400}}px">
<div class="category-listing one-category col-xs-12 col-sm-4 " ng-repeat="c in categories"
ng-if="! c.hidden">
<h2 ng-class="{'hidden':c.hidden}" class="title">
{{ c.name }}
</h2>
<div class="product-listing" >
<span ng-repeat="p in c.products track by p.id"
class="product-box"
>
<button class="product-button text-left" ng-class="{ 'active' : p.enabled}" ng-click="addProduct( p )">
<img class="product-image" src="{{p.image}}" alt="image" ng-if="p.image.length">
<span class="product-name">
{{ p.name }}
</span>
<span class="badge">
{{ p.price }}
</span>
<span class="badge badge-default" ng-if="show_config.stock_count">
{{ p.stockCount }}
</span>
<span class="badge badge-success" ng-if="show_config.sold">
<i class="fa fa-tick"></i>
{{ countProductsSoldForActiveFestival[p.id] }}
</span>
</button>
<button class="express-button" ng-if="show_config.expressSelling" ng-click="expressSell(p)" title="achat express sans compléter les infos du client">
<i class="fa fa-shopping-cart"></i>
</button>
</span>
</div>
</div>
</div>
</div>
{% endverbatim %}

View file

@ -0,0 +1,30 @@
<!--ok loading done-->
<div id="loaded" ng-if="initLoadDone">
<!--caisse IHM-->
<div id="load_ok">
<div id="listing-products" class="listing-products col-xs-12 col-md-8">
{% include 'logged/angular/messages.html.twig' %}
{% include 'logged/angular/listing-products.html.twig' %}
</div>
<div id="sellings" class="sellings col-xs-12 col-md-4">
<div class="list-sell" ng-class="{'bg-success text-success': sellingOk }">
{% include 'logged/angular/validate-button.html.twig' %}
{% if app.user.products |length %}
{% include 'logged/angular/current.html.twig' %}
{% endif %}
{#{% include 'logged/angular/paused.html.twig' %}#}
</div>
</div>
</div>
<div id="other_time">
{% include 'logged/angular/recent.html.twig' %}
</div>
<div class="col-xs-12 col-md-4 col-md-offset-8">
{% include 'logged/angular/categ-options.html.twig' %}
</div>
</div>

View file

@ -0,0 +1,42 @@
{% verbatim %}
<div id="messages">
<div id="no-categories" class="alert alert-info" ng-if="!categories.length">
<i class="fa fa-info"></i>
Vous n'avez pas encore enregistré de <strong>catégorie de produit</strong>, ajoutez-en donc.
</div>
<div id="no-products" class="alert alert-info" ng-if="!productsFromDB.length">
<i class="fa fa-info"></i>
Vous n'avez pas encore enregistré de <strong>produit</strong>, ajoutez-en donc.
</div>
{% endverbatim %}
<div>
{% if app.user.activeFestival is null %}
<div id="no-products" class="alert alert-info" ng-if="!productsFromDB.length">
<i class="fa fa-info"></i>
Sélectionnez un <strong>festival</strong> pour grouper vos ventes clients par évènement.
</div>
{% endif %}
</div>
{% if not (app.user.products |length) %}
<div class="alert alert-info" ng-if="!productsFromDB.length && initLoadDone">
<i class="fa fa-info"></i>
Créez facilement vos catégories de produits et vos produits juste en écrivant un nom par ligne dans
<a class="link" href="{{ path('import') }}">
<button>
l'interface d'importation simplifiée
</button>
</a>
</div>
<hr>
{% endif %}
{% verbatim %}
<!--end messages warning-->
</div>
{% endverbatim %}

View file

@ -0,0 +1,8 @@
{% verbatim %}
<!--<div class="col">-->
<!--<button class="btn btn-default" id="pause_selling" ng-click="pauseSelling()">-->
<!--<i class="fa fa-clock"></i>-->
<!--Pause-->
<!--</button>-->
<!--</div>-->
{% endverbatim %}

View file

@ -0,0 +1,15 @@
{% verbatim %}
<div class="selling-on-hold">
<h4>
Ventes en pause
</h4>
<ul>
<li ng-repeat="list in pausedSellings track by $index"
ng-click="setBackPausedSelling(list, $index)">
{{ $index }}) {{ list.products.length }} produits, <strong>
{{ sumOfList(list) }}€ </strong>
</li>
</ul>
<hr>
</div>
{% endverbatim %}

View file

@ -0,0 +1,8 @@
<div class="selling-history">
{% verbatim %}
<div ng-repeat="s in recentSelling track by $index">
{{s.id}} )
{{s.amount}}
</div>
{% endverbatim %}
</div>

View file

@ -0,0 +1,33 @@
{% verbatim %}
<div class="">
<div class="row clickable" >
<div class="col-xs-12 col-sm-6 text-right">
<h3 ng-click="setRightAmountPaid()">Total: </h3>
</div>
<div class="col-xs-12 col-sm-6 text-right">
<h3 ng-click="setRightAmountPaid()">
<strong>
{{ CurrentSellingTotal() }}
</strong>€
</h3>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div >
Le client paie:
</div>
<div >
<input class="text-right" type="number" id="paid_amount" ng-model="paidAmount">
</div>
</div>
</div>
<div class="alert alert-success" ng-if="paidAmount && CurrentSellingTotal() - paidAmount <=0">
<h3>Rendu: {{ -1*(CurrentSellingTotal() - paidAmount) }} €</h3>
</div>
<div class="alert alert-warning" ng-if="paidAmount && CurrentSellingTotal() - paidAmount >0">
<h3>il manque: {{ CurrentSellingTotal() - paidAmount }} €</h3>
</div>
</div>
{% endverbatim %}

View file

@ -0,0 +1,13 @@
{% verbatim %}
<button class="btn btn-primary btn-block validate_selling" ng-click="sendForm(event)"
ng-disabled="!paidAmount">
<i class="fa fa-check"></i>
<span ng-if="paidAmount && CurrentSellingTotal() - paidAmount <=0">
Valider
</span>
<span ng-if="paidAmount && CurrentSellingTotal() - paidAmount >0">
<i class="fa fa-warning"></i>
</span>
</button>
{% endverbatim %}

View file

@ -0,0 +1,11 @@
<div class="caisse-main-box">
{% verbatim %}
<div id="not_loaded" ng-if="!initLoadDone">
<div class="well text-center">
<i class="fa fa-refresh fa-spin fa-3x"></i> Chargement en cours de vos produits
</div>
</div>
{% endverbatim %}
{% include 'logged/angular/loaded-caisse.html.twig' %}
</div>

View file

@ -0,0 +1,25 @@
{% verbatim %}
<!-- client actuel infos-->
<div id="client-now" class="client-now padded">
<i class="fa fa-user"></i>
<label for="sellingComment">
Client actuel: {{ activeSelling.length }} produit<span ng-if="activeSelling.length!=1">s</span>
</label>
<button type="button" class="deleter pull-right" ng-click="sellingComment = ''">
<i class="fa fa-times"></i>
</button>
<input type="text"
class="form-control"
aria-label="Note about the client"
id="sellingComment"
aria-describedby="selling-comment"
ng-model="sellingComment"
ng-model-options="{ updateOn: 'keyup' , allowInvalid: true}"
name="sellingComment"
autofocus="autofocus"
placeholder="nom ou commentaire">
</div>
{% endverbatim %}

View file

@ -0,0 +1,38 @@
{% extends 'base.html.twig' %}
{% block body %}
{% verbatim %}
<div id="caisse-now" class=""
ng-app="caisse"
ng-controller="CaisseCtrl as MainCtrl">
<div class="caisse-main row-fluid" >
<div class="col-xs-12 ">
<!-- ligne d'informations-->
{% endverbatim %}
{% include 'logged/listing-options.html.twig' %}
{% include 'logged/festival-infos.html.twig' %}
{# </div>#}
<div class="col-xs-12">
{% include 'logged/customer.html.twig' %}
{% verbatim %}
</div>
<!--états de sauvegarde-->
<div class="selling-ok alert-success alert block" ng-if="sellingOk" ng-click="sellingOk = false">
<i class="fa fa-save"></i>
Sauvegardé! WOHOOOOOO +{{recentSellings[recentSellings.length -1].amount}}
</div>
<div class="selling-ok alert-error alert block" ng-if="sellingError" ng-click="sellingError = false">
<i class="fa fa-warning"></i>
Problème de sauvegarde (pas de réseau ?)
</div>
{% endverbatim %}
{% include 'logged/caisse-main.html.twig' %}
{% verbatim %}
{% endverbatim %}
</div>
{% endblock %}

View file

@ -0,0 +1,25 @@
<div id="festival-current_info">
<a class="btn " href=" {{ path('festival_index') }}">
<i class="fa fa-th-large"></i>
Festival:
{% verbatim %}
{{activeFestival.name}}
</a>
<!-- <input type="text" ng-model="activeFestival.name" placeholder="nom du festival">-->
<!-- <input class="pull-right" type="text" ng-model="activeFestival.commentaire" placeholder="commentaire">-->
<span class="badge" title="fond de caisse + chiffre d'affaire. veillez à vider votre fond de caisse ailleurs lorsqu'il devient trop important, par exemple au dela de 200€" ng-class="{'badge-warning': activeFestival.fondDeCaisseAvant + activeFestival.chiffreAffaire > 200}">
<i class="fa fa-archive"></i>
{{ activeFestival.fondDeCaisseAvant + activeFestival.chiffreAffaire}} €
</span>
<span class="badge badge-success">
CA {{ activeFestival.chiffreAffaire }}
<span ng-if="sellingOk">
<i class="fa fa-check-circle-o"></i>
</span>
</span>
<span class="badge badge-success">
{{ activeFestival.clientsCount }} <i class="fa fa-user"></i>
</span>
{% endverbatim %}
</div>

View file

@ -0,0 +1,75 @@
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script>
var dataPoints = [
{% for pair in statisticsSoldProducts %}
{
label: "{{ pair.name }}",
x: {{ pair.count }},
y: {{ pair.count }}
},
{% endfor %}
];
var dataPointsChiffreAffaire = [
{% for pair in statisticsSoldProducts %}
{
label: "{{ pair.name }}",
x: {{ pair.value }},
y: {{ pair.value }}
},
{% endfor %}
];
var dataPointsFestivals = [
{% for pair in statisticsFestivals %}
{
label: "{{ pair.name }} {{ pair.date|date('Y-m-d') }} , {{ pair.chiffreAffaire }} €",
y: {{ pair.chiffreAffaire }} ,
countClients : "{{ pair.clients_count }} clients"
},
{% endfor %}
];
console.log(dataPointsFestivals);
var chartFestival = new CanvasJS.Chart("chartContainerstatisticsFestivals", {
title:{
text: "Chiffre d'affaire par festival"
},
animationEnabled: true,
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "column",
dataPoints: dataPointsFestivals
}
]
});
console.log('dataPointsFestivals', dataPointsFestivals);
chartFestival.render();
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "Volume de produits vendus"
},
animationEnabled: true,
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "pie",
dataPoints: dataPoints
}
]
});
chart.render();
var chartContainerChiffreAffaire = new CanvasJS.Chart("chartContainerChiffreAffaire", {
title:{
text: "Valeur en euros des produits vendus"
},
animationEnabled: true,
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "pie",
dataPoints: dataPointsChiffreAffaire
}
]
});
chartContainerChiffreAffaire.render();
</script>

View file

@ -0,0 +1,156 @@
{% extends 'base.html.twig' %}
{% block body %}
<div id="wrapper">
<div id="container" class="container">
<div class="row">
<h1>Historique</h1>
</div>
<div class="row">
<div class="col-xs-12">
<div class="sells">
<div class="row">
<div class="col-xs-12 col-sm-4">
<h2>
<i class="fa fa-users"></i>
<span class="chiffre key-figure">
{{ allSellings }}
</span>
Clients
</h2>
</div>
<div class="col-xs-12 col-sm-4">
<h2>
<i class="fa fa-euro"></i>
<span class="chiffre key-figure">
{{ chiffreAffaires }}
</span>
Chiffre d'affaires
</h2>
</div>
<div class="col-xs-12 col-sm-4">
<h2>
<i class="fa fa-shopping-cart"></i>
<span class="chiffre key-figure">
{% if allSellings %}
{{ (chiffreAffaires / (allSellings))|round }}
{% else %}
?
{% endif %}
</span>
€ panier moyen
</h2>
</div>
</div>
<div>
</div>
</div>
</div>
<div class="col-xs-12 ">
<h2>Exporter toutes vos données</h2>
<a class="btn btn-success" href="{{ path('export_all') }}">
<i class="fa fa-file-excel-o fa-3x"></i>
en format csv
</a
><a class="btn btn-success" href="{{ path('export_all_json') }}">
<i class="fa fa-file-code-o fa-3x"></i>
en JSON
</a>
</div>
</div>
<hr>
<h2 class="text-center">Statistiques de ventes </h2>
<div id="chartContainer" style="display: inline-block; height: 300px; width: 49%;"></div>
<div id="chartContainerChiffreAffaire" style="display: inline-block; height: 300px; width: 49%;"></div>
<h2> {{ statisticsFestivals |length }} Festival
{% if statisticsFestivals |length >1 %}
s
{% endif %}</h2>
<div id="chartContainerstatisticsFestivals"
style="display: inline-block; height: 300px; width: 100%;"></div>
</div>
<hr>
<div id="last-sellings">
<div class="row">
<div class="col-xs-12">
<div class="table">
<div class="row-fluid">
<div class="col-xs-12">
<h2>
{{ recentSells |length }} Dernières ventes
</h2>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<td>n°</td>
<td>date</td>
<td>commentaire</td>
<td>produits</td>
<td>montant</td>
<td>Actions</td>
</tr>
</thead>
<tbody>
{% for vente in recentSells %}
<tr>
<td> {{ vente.id }}</td>
<td> {{ vente.date |date('Y-m-d H:i:s') }}</td>
<td>{{ vente.comment }}</td>
<td class="text-right">
{% if vente.productsSold |length >1 %}
<strong>
{{ vente.productsSold |length }}
</strong> produits
{% else %}
{% if vente.productsSold and vente.productsSold.0 is defined %}
{{ vente.productsSold.0.name }}
{% endif %}
{% endif %}
</td>
<td class="text-right">
{{ vente.amount }}
</td>
<td>
<a href="{{ path('sellrecord_delete',{id: vente.id }) }}"
class="btn btn-warning pull-right">
<i class="fa fa-trash"></i>
</a>
</td>
</tr> {% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% include ':logged:history-script.html.twig' %}
</div>
{% endblock %}

View file

@ -0,0 +1,39 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Importation, création en masse</h1>
<div class="row">
<div class="col-xs-12 ">
{% include 'logged/mass-register.html.twig' %}
</div>
<div class="col-xs-12">
<h2>
Importer votre historique de ventes
</h2>
<div class="alert alert-warning">
<i class="fa fa-warning"></i>
Fonctionnalité en cours de création
</div>
{# 1)#}
{# <a class="btn btn-success" href="{{ asset('modele_import_caisse.csv') }}">#}
{# <i class="fa fa-file-o fa-3x"></i>#}
{# Télécharger le fichier de modèle#}
{# </a>#}
{# <hr>#}
{# 2) Remplir votre modèle avec vos ventes#}
{# <hr>#}
{# 3) à faire#}
{#<form action="{{ path('import') }}" method="post">#}
{#<fieldset>#}
{#Importer votre modèle rempli#}
{#<input disabled type="file" name="fichier_import">#}
{#<input disabled class="btn btn-primary btn-block" type="submit" value="importer votre historique">#}
{#</fieldset>#}
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,48 @@
<div id="festival-listing-options">
{% verbatim %}
<!-- options-->
<div class="row marged-v" ng-if="simpleDisplay">
<button class="btn btn-success" ng-click="toggleSimpleDisplay()">
<i class="fa fa-bars"></i> Affichage simple <i class="fa fa-check-circle"></i>
</button>
</div>
<div class="row marged-v" ng-if="! simpleDisplay">
<div class="col-xs-12 col-md-6" id="main_options">
<button class="btn btn-disabled" ng-click="toggleSimpleDisplay()">
<i class="fa fa-bars"></i> Affichage simple
</button>
<button
title="la vente express vous permet d'enregistrer une vente pour un seul article sans remplir le formulaire de détail"
class="btn"
ng-class="{'btn-success': show_config.expressSelling, 'btn-disabled':! show_config.expressSelling}"
ng-click="show_config.expressSelling = !show_config.expressSelling">
<i class="fa fa-shopping-cart"></i>
vente express
<span ng-if=show_config.show_config.expressSelling>
<i class="fa fa-check-circle"></i></span>
</button>
<button
title="montrer le nombre d'objets restants dans les stocks"
class="btn"
ng-class="{'btn-success': show_config.stock_count, 'btn-disabled':!show_config.stock_count}"
ng-click="show_config.stock_count = !show_config.stock_count">
<i class="fa fa-shopping-cart"></i>
stocks
<span ng-if=show_config.stock_count>
<i class="fa fa-check-circle"></i></span>
</button>
<button
title="montrer le nombre d'objets restants dans les stocks"
class="btn"
ng-class="{'btn-success': show_config.sold, 'btn-disabled':!show_config.sold}"
ng-click="show_config.sold = !show_config.sold">
<i class="fa fa-shopping-cart"></i>
vendus
<span ng-if=show_config.sold>
<i class="fa fa-check-circle"></i>
</span>
</button>
</div>
</div>
{% endverbatim %}
</div>

View file

@ -0,0 +1,49 @@
<div id="mass-register">
<form action="{{ path('mass_create') }}" method="post">
<div class="row">
<div class="col-xs-12 col-sm-6">
<blockquote>
<strong>Vous pouvez copier et adapter cet exemple: </strong>
<pre id="example_mass_import">
catégorie: livre
les moutaines;5€
la laine des moutons;6€
star wars spécial noël;7€
catégorie: poster
super bannière A2;10€
Sébastien Chabal sexy;10€
catégorie: dessin à la demande
dessin A4 crayon;20€
dessin A4 aquarelle;150€
</pre>
<a href="#filling_zone" id="use_example">
<i class="fa fa-arrow-down"></i>
Utiliser l'exemple
</a>
</blockquote>
</div>
<div class="col-xs-12 col-sm-6">
<div class="well" id="filling_zone">
<label for="produits">
<h3>
Créez vos produits et leur catégorie en masse, un par ligne.
</h3>
Séparez le nom du produit de son prix avec un point virgule. vous n'êtes pas obligé de préciser
le symbole € pour le prix. Utilisez une virgule ou un point pour faire des prix à virgule. Si le
nom de catégorie existe déjà, le produit sera associé avec celle-ci.
</label>
<textarea style="width: 100%;" name="produits" id="produits" cols="30" rows="10"
placeholder="catégorie et produits">
catégorie: livre
mon livre ; 5€
</textarea>
<input class="btn btn-primary btn-block" type="submit" value="créer en masse">
</div>
</div>
</div>
</form>
</div>

View file

@ -0,0 +1,8 @@
{% extends 'base.html.twig' %}
{% block body %}
<div id="wrapper">
<h1>Appli angular embarquée</h1>
<script href="{{ asset('/assets/js/build-frontend-submodule/main.js') }}"></script>
<div ng-app="tktest"></div>
</div>
{% endblock %}

View file

@ -0,0 +1,281 @@
{% extends 'base.html.twig' %}
{% block body %}
{% verbatim %}
<div id="wrapper">
<div class="previsionnel"
ng-app="caisse"
ng-controller="previsionnelCtrl as pCtrl"
>
<div class="row">
<div class="col-xs-12 col-lg-6">
<h1>Prévisionnel</h1>
</div>
<div class="col-xs-12 col-lg-6">
<div ng-if="config.initialLoadingDone && config.loading">
<i class="fa fa-spin fa-refresh"></i>
Chargement
</div>
<div ng-if="config.initialLoadingDone && !config.loading">
Modifications sauvegardées
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="config well">
<h2>
Configuration
</h2>
<div class="row">
<div class="col-xs-12 col-sm-6">
<p >
<label for="dispo">
Euros disponibles au départ:
</label>
<input
id="dispo"
class="big-number"
type="number"
ng-model="config.disponibility"
ng-change="save()"
ng-model-options="{ debounce: config.debounceTime }">
<br>
<label for="gains">
Gains moyen par mois:
</label>
<input type="number"
class="big-number"
id="gains"
ng-model="config.averageMonthlyEarnings"
ng-change="save()"
ng-model-options="{ debounce: config.debounceTime }">
</p>
<p>
Gérer délais de paiement
<input type="checkbox" ng-model="config.showDelays">
Gérer répétitions
<input type="checkbox" ng-model="config.showRepeats">
</p>
</div>
<div class="col-xs-12 col-sm-6">
<p>
<strong>
Dépenses mensuelles:
<span class="big-number">
{{ sumMonthlyExpenses() }}
</span>
</strong>
</p>
<p>
<strong>
Bénef mensuel: <span class="big-number">{{ config.averageMonthlyEarnings - sumMonthlyExpenses() }} €</span>
</strong>
</p>
<p>
Crédit mensuel réalisable (33% des gains moyens par mois): {{ config.averageMonthlyEarnings * 0.33 |number }}
</p>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-lg-7 postes">
<h2>
{{expenses.length}} Postes de dépenses mensuelles
<button ng-click="addExpense()">+</button>
</h2>
<p class="desc">
Indiquez les catégories de dépenses mensuelles que vous faites pour faire évoluer la
simulation de budget restant dans plusieurs mois.
</p>
<table class="exepanse-table">
<thead>
<tr>
<td class="padded" >
Nom
</td>
<td class="padded" ng-if="config.showDelays">
débute dans X mois
</td>
<td class="padded" ng-if="config.showRepeats">
mois répétitions
</td>
<td class="padded" ng-if="config.showRepeats">
prix répétitions
</td>
<td class="padded" >
prix mensuel
</td>
<td class="padded" >
prix annuel
</td>
<td class="padded" >
activé
</td>
</tr>
</thead>
<tbody>
</tbody>
<tr ng-repeat="e in expenses ">
<td>
<input type="text" ng-model="e.name" ng-change="save()" ng-model-options="{ debounce: config.debounceTime }">
</td>
<td ng-if="config.showDelays">
<input type="number" ng-model="e.delay" ng-change="save()" ng-model-options="{ debounce: config.debounceTime }">
</td>
<td ng-if="config.showRepeats">
<input type="number" ng-model="e.repeat" ng-change="save()" ng-model-options="{ debounce: config.debounceTime }">
</td>
<td ng-if="config.showRepeats" class="text-right padded">
{{ e.repeat * e.amount }}
</td>
<td>
<input type="number" ng-model="e.amount" ng-change="save()" ng-model-options="{ debounce: config.debounceTime }">
</td>
<td class="text-right padded">
<strong>
{{ e.amount * 12 }}
</strong>
</td>
<td class="padded">
<input type="checkbox" ng-model="e.enabled" ng-change="save()" ng-model-options="{ debounce: config.debounceTime }">
</td>
</tr>
</table>
<div class="well examples-depenses">
<strong>
Exemples de postes de dépenses à ajouter:
</strong>
{% endverbatim %}
{{ "
appartement
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
abonnement protonmail VPN
abonnement service audio, vidéo
carburant véhicule
donations
médecin
chat
chien
licorne"|nl2br }}
{% verbatim %}
</div>
</div>
<div class="col-sm-12 col-lg-5">
<h2>Simulation sur {{config.lines}} mois</h2>
<div class="" id="simulationPrevision" style="display: inline-block; height: 300px; width: 90%;">(graphique)</div>
<!--block to insert the graph-->
<div class="well big-number" ng-if="config.monthsBeforeNoMoney && config.monthsBeforeNoMoney <= config.lines">
<i class="fa fa-warning"></i>
Ce sera la dèche dans {{config.monthsBeforeNoMoney}} mois
</div>
<div ng-if=" ! config.monthsBeforeNoMoney" class="bg-success padded">
cool ! votre plan est supportable dans le temps
</div>
<table>
<thead>
<tr >
<td class="padded" >
Month in the future
</td>
<td class="padded" >
date
</td>
<td class="padded" >
Dépenses
</td>
<td class="padded" >
Disponibilité
</td>
</trclass>
</thead>
<tbody>
<tr ng-repeat="line in previsionTable" >
<td>
<div ng-if="line.available > config.warningThershold"
class=" bgsuccess padded ">
{{ $index }}
</div>
<div ng-if="line.available > 0 && line.available < config.warningThershold"
class="bgwarning padded ">
{{ $index }} bientôt la dèche
</div>
<div ng-if="line.available < 0"
class="bgdanger padded ">
{{ $index }} DAMNED pu de pognon!
</div>
</td>
<td>
-
</td>
<td class="text-right ">
{{ line.expense }}
</td>
<td class="text-right"
ngClass="{'bgdanger' : line.available < 0 }">
<strong>
{{ line.available}}
</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>-->
<script>
var dataPoints = {{graphPointsPrevision}} ;
var chartContainerChiffreAffaire = new CanvasJS.Chart("simulationPrevision", {
title:{
text: "Euros disponibles dans le temps"
},
animationEnabled: true,
data: [
{
// Change type to "doughnut", "line", "splineArea", etc.
type: "splineArea",
dataPoints: dataPoints
}
]
});
chartContainerChiffreAffaire.render();
</script>
{% endverbatim %}
{% endblock %}

View file

@ -0,0 +1,24 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Product edit</h1>
{{ form_start(edit_form) }}
{{ form_widget(edit_form) }}
<input type="submit" value="Edit"/>
{{ form_end(edit_form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('product_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,74 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="row heading-of-list">
<div class="col-xs-6">
<h1>Produits</h1></div>
<div class="col-xs-6">
<a class="btn btn-primary pull-right" href="{{ path('product_new') }}">Nouveau produit</a>
<span class="hint alert alert-info pull-right">
astuce: Utilisez
<strong>
<a href="{{ path('import') }}">
l'import de masse
</a>
</strong>
pour créer plusieurs produits et catégories à la fois
</span>
</div>
</div>
<table class="table-responsive table-striped table table-bordered table-light">
<thead class="bg-dark">
<tr>
<th>Id</th>
<th>Category</th>
<th>Name</th>
<th>Image</th>
<th>Price</th>
<th>Stocks</th>
<th>Vendus</th>
<th>Comment</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for product in products %}
<tr>
<td>
<a class="btn btn-primary btn-block"
href="{{ path('product_show', { 'id': product.id }) }}">{{ product.id }}</a>
</td>
<td>
<a class="btn btn-primary btn-block"
href="{{ path('productcategory_edit', { 'id': product.category.id }) }}">
{{ product.category.name }}
</a>
</td>
<td>
<a class="btn btn-default btn-block" href="{{ path('product_edit', { 'id': product.id }) }}">
{{ product.name }}
</a>
</td>
<td>{{ product.image }}</td>
<td>{{ product.price }}</td>
<td>{{ product.stockCount }}</td>
<td>{{ product.productsSold | length }}</td>
<td>{{ product.comment }}</td>
<td>
<a class="btn btn-default" href="{{ path('product_edit', { 'id': product.id }) }}">
<i class="fa fa-pencil"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-primary" href="{{ path('product_new') }}">Nouveau produit</a>
{% endblock %}

View file

@ -0,0 +1,19 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Product creation</h1>
{{ form_start(form) }}
{{ form_widget(form) }}
<input type="submit" class="btn btn-primary btn-block" value="Créer"/>
{{ form_end(form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('product_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,47 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Product</h1>
<table class="table-responsive table-striped table table-bordered table-light">
<tbody>
<tr>
<th>Id</th>
<td>{{ product.id }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ product.name }}</td>
</tr>
<tr>
<th>Image</th>
<td>{{ product.image }}</td>
</tr>
<tr>
<th>Price</th>
<td>{{ product.price }}</td>
</tr>
<tr>
<th>Comment</th>
<td>{{ product.comment }}</td>
</tr>
</tbody>
</table>
<ul>
<li>
<a class="btn btn-primary" href="{{ path('product_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
<li>
<a class="btn btn-primary" href="{{ path('product_edit', { 'id': product.id }) }}">edit</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1 @@
essai qui marche

View file

@ -0,0 +1,41 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Catégorie <strong> {{ productCategory.name }} </strong></h1>
<div class="row">
<div class="col-xs-12 col-sm-6">
{{ form_start(edit_form) }}
{{ form_widget(edit_form) }}
<input type="submit" value="Edit"/>
{{ form_end(edit_form) }}
<div class="padded">
<ul>
<li>
<a class="btn btn-primary btn-block" href="{{ path('productcategory_index') }}"> <i
class="fa fa-arrow-left"></i> Retour à la liste</a>
</li>
<li>
{{ form_start(delete_form) }}
<input class="btn btn-warning btn-block" type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<h2>{{ productCategory.products|length }} Produits associés</h2>
<div class="listing">
{% for p in productCategory.products %}
<a class="btn btn-default btn-block" href="{{ path('product_edit', { 'id': p.id }) }}">
{{ p.name }}
</a>
{% endfor %}
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,49 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="row heading-of-list">
<div class="col-xs-6">
<h1>Catégorie de produit</h1></div>
<div class="col-xs-6">
<a class="btn btn-primary" href="{{ path('productcategory_new') }}">Nouvelle catégorie</a>
</div>
</div>
<table class="table-responsive table-striped table table-bordered table-light">
<thead>
<tr>
<th>Id</th>
<th>Nom</th>
<th>Produits</th>
<th>Vendus</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for productCategory in productCategories %}
<tr>
<td>
<a class="btn btn-primary"
href="{{ path('productcategory_show', { 'id': productCategory.id }) }}">{{ productCategory.id }}</a>
</td>
<td><a class="btn btn-default btn-block"
href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">
{{ productCategory.name }}
</a></td>
<td>{{ productCategory.products|length }}</td>
<td>{{ productCategory.productsSold|length }}</td>
<td>
<a class="btn btn-primary"
href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">
<i class="fa fa-pencil"></i>
edit
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-primary" href="{{ path('productcategory_new') }}">Nouvelle catégorie</a>
{% endblock %}

View file

@ -0,0 +1,16 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Création de catégorie de produit</h1>
{{ form_start(form) }}
{{ form_widget(form) }}
<input type="submit" class="btn btn-primary btn-block" value="Créer" />
{{ form_end(form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('productcategory_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,32 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Productcategory</h1>
<table class="table-responsive table-striped table table-bordered table-light">
<tbody>
<tr>
<th>Id</th>
<td>{{ productCategory.id }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ productCategory.name }}</td>
</tr>
</tbody>
</table>
<ul>
<li>
<a class="btn btn-primary" href="{{ path('productcategory_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
</li>
<li>
<a class="btn btn-primary" href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">edit</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Sellrecord edit</h1>
{{ form_start(edit_form) }}
{{ form_widget(edit_form) }}
<input type="submit" value="Edit" />
{{ form_end(edit_form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('sellrecord_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,54 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="row heading-of-list">
<div class="col-xs-6">
<h1>Enregistrements de ventes</h1>
</div>
<div class="col-xs-6">
<a class="btn btn-primary" href="{{ path('sellrecord_new') }}">Nouvel enregistrement</a>
</div>
</div>
<table class="table-responsive table-striped table table-bordered table-light">
<thead>
<tr>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for sellRecord in sellRecords %}
<tr>
<td>
<a class="btn btn-primary"
href="{{ path('sellrecord_show', { 'date': sellRecord.date }) }}">{{ sellRecord.date }}</a>
</td>
<td>
<ul>
<li>
<a class="btn btn-primary"
href="{{ path('sellrecord_show', { 'date': sellRecord.date }) }}">voir
</a>
</li>
<li>
<a class="btn btn-primary"
href="{{ path('sellrecord_edit', { 'date': sellRecord.date }) }}">
<i class="fa fa-pencil"></i>
</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a class="btn btn-primary" href="{{ path('sellrecord_new') }}">Nouveau sellRecord</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,19 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Sellrecord creation</h1>
{{ form_start(form) }}
{{ form_widget(form) }}
<input type="submit" class="btn btn-primary btn-block" value="Créer"/>
{{ form_end(form) }}
<ul>
<li>
<a class="btn btn-primary" href="{{ path('sellrecord_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,31 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Sellrecord</h1>
<table class="table-responsive table-striped table table-bordered table-light">
<tbody>
<tr>
<th>Date</th>
<td>{% if sellRecord.date %}{{ sellRecord.date|date('Y-m-d H:i:s') }}{% endif %}</td>
</tr>
</tbody>
</table>
<ul>
<li>
<a class="btn btn-primary" href="{{ path('sellrecord_index') }}">
<i class="fa fa-arrow-left"></i>
Retour à la liste
</a>
</li>
<li>
<a class="btn btn-primary" href="{{ path('sellrecord_edit', { 'date': sellRecord.date }) }}">edit</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Seriefestival edit</h1>
{{ form_start(edit_form) }}
{{ form_widget(edit_form) }}
<input type="submit" value="Edit" />
{{ form_end(edit_form) }}
<ul>
<li>
<a href="{{ path('seriefestival_index') }}">Back to the list</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,55 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="row heading-of-list">
<div class="col-xs-6">
<h1>Série de Festivals</h1>
<div class="well">
une série de festival vous permet d'obtenir des statistiques sur plusieurs évènements à la fois. et de comparer
des coûts et bénéfices d'une édition à une autre.
</div>
</div>
<div class="col-xs-6">
<a class="btn btn-primary" href="{{ path('seriefestival_new') }}">Nouvelle série</a>
</div>
</div>
<table>
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Datecreation</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for serieFestival in serieFestivals %}
<tr>
<td>
<a href="{{ path('seriefestival_show', { 'id': serieFestival.id }) }}">{{ serieFestival.id }}</a>
</td>
<td>{{ serieFestival.name }}</td>
<td>{% if serieFestival.dateCreation %}{{ serieFestival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
<td>
<ul>
<li>
<a href="{{ path('seriefestival_show', { 'id': serieFestival.id }) }}">show</a>
</li>
<li>
<a href="{{ path('seriefestival_edit', { 'id': serieFestival.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a class="btn btn-primary" href="{{ path('seriefestival_new') }}">Nouvelle série</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,16 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Création de série de festival</h1>
{{ form_start(form) }}
{{ form_widget(form) }}
<input type="submit" value="Create"/>
{{ form_end(form) }}
<ul>
<li>
<a href="{{ path('seriefestival_index') }}">Retour à la liste</a>
</li>
</ul>
{% endblock %}

View file

@ -0,0 +1,36 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>Seriefestival</h1>
<table>
<tbody>
<tr>
<th>Id</th>
<td>{{ serieFestival.id }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ serieFestival.name }}</td>
</tr>
<tr>
<th>Datecreation</th>
<td>{% if serieFestival.dateCreation %}{{ serieFestival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
</tr>
</tbody>
</table>
<ul>
<li>
<a href="{{ path('seriefestival_index') }}">Back to the list</a>
</li>
<li>
<a href="{{ path('seriefestival_edit', { 'id': serieFestival.id }) }}">Edit</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}

85
v1/old/app/config/config.yml Executable file
View file

@ -0,0 +1,85 @@
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: fr
framework:
#esi: ~
translator: { fallbacks: ['%locale%'] }
secret: '%secret%'
router:
resource: '%kernel.project_dir%/app/config/routing.yml'
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
default_locale: '%locale%'
trusted_hosts: ~
session:
# https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
fragments: ~
http_method_override: true
assets: ~
php_errors:
log: true
templating:
engines: ['twig']
# Twig Configuration
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
server_version: '%server_version%'
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
mapping_types:
enum: string
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: '%kernel.project_dir%/var/data/data.sqlite'
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: '%database_path%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
# spool: { type: memory }
encryption: '%mailer_encryption%'
port: '%mailer_port%'
#fos user bundle
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: AppBundle\Entity\User
registration:
confirmation:
enabled: true
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"

View file

@ -0,0 +1,41 @@
imports:
- { resource: config.yml }
framework:
router:
resource: '%kernel.project_dir%/app/config/routing_dev.yml'
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
channels: ['!event']
console:
type: console
process_psr_3_messages: false
channels: ['!event', '!doctrine', '!console']
# To follow logs in real time, execute the following command:
# `bin/console server:log -vv`
server_log:
type: server_log
process_psr_3_messages: false
host: 127.0.0.1:9911
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
#swiftmailer:
# delivery_addresses: ['me@example.com']

View file

@ -0,0 +1,22 @@
imports:
- { resource: config.yml }
#doctrine:
# orm:
# metadata_cache_driver: apc
# result_cache_driver: apc
# query_cache_driver: apc
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
console:
type: console
process_psr_3_messages: false

Some files were not shown because too many files have changed in this diff Show more