From 06e1dcbb024e3814529ff3d8840434c3d23eea23 Mon Sep 17 00:00:00 2001 From: Kayn Ty Date: Wed, 4 Apr 2018 17:42:27 +0200 Subject: [PATCH] include entities and repos --- .../HWIOAuthBundle/views/layout.html.twig | 65 ++++++++- app/Resources/views/base.html.twig | 16 +-- app/Resources/views/default/footer.html.twig | 1 + .../views/default/main-screen.html.twig | 70 ++++------ .../views/logged/caisse-main.html.twig | 59 ++++++++ .../views/logged/dashboard.html.twig | 27 ++++ .../Resources/views}/product/index.html.twig | 0 .../Resources/views}/product/test.html.twig | 0 app/config/security.yml | 1 + .../Controller/DefaultController.php | 33 +++-- src/AppBundle/Entity/Product.php | 132 ++++++++++++++++++ .../Entity/Product.php~} | 2 +- src/AppBundle/Entity/ProductCategory.php | 98 +++++++++++++ .../Entity/ProductCategory.php~} | 3 +- src/{ => AppBundle}/Entity/SellRecord.php | 4 +- src/AppBundle/Entity/SellRecord.php~ | 66 +++++++++ src/AppBundle/Entity/Stuff.php | 65 +++++++++ src/AppBundle/Entity/Stuff.php~ | 66 +++++++++ src/AppBundle/Entity/User.php | 31 +++- src/AppBundle/Entity/User.php~ | 39 ++++++ .../Repository/ProductCategoryRepository.php | 12 ++ .../Repository/ProductRepository.php | 12 ++ .../Repository/SellRecordRepository.php | 12 ++ src/AppBundle/Repository/UserRepository.php | 3 +- src/Entity/.gitignore | 0 src/Entity/User/User.php | 24 ---- templates/base.html.twig | 20 --- templates/pdf/content.html.twig | 19 --- templates/pdf/footer.html.twig | 1 - templates/pdf/header.html.twig | 1 - templates/pdf/table-of-contents.xml.twig | 1 - 31 files changed, 741 insertions(+), 142 deletions(-) create mode 100644 app/Resources/views/logged/caisse-main.html.twig create mode 100644 app/Resources/views/logged/dashboard.html.twig rename {templates => app/Resources/views}/product/index.html.twig (100%) rename {templates => app/Resources/views}/product/test.html.twig (100%) create mode 100644 src/AppBundle/Entity/Product.php rename src/{Entity/Product.php => AppBundle/Entity/Product.php~} (97%) mode change 100755 => 100644 create mode 100644 src/AppBundle/Entity/ProductCategory.php rename src/{Entity/ProductCategory.php => AppBundle/Entity/ProductCategory.php~} (97%) mode change 100755 => 100644 rename src/{ => AppBundle}/Entity/SellRecord.php (88%) mode change 100755 => 100644 create mode 100644 src/AppBundle/Entity/SellRecord.php~ create mode 100644 src/AppBundle/Entity/Stuff.php create mode 100644 src/AppBundle/Entity/Stuff.php~ create mode 100644 src/AppBundle/Entity/User.php~ create mode 100644 src/AppBundle/Repository/ProductCategoryRepository.php create mode 100644 src/AppBundle/Repository/ProductRepository.php create mode 100644 src/AppBundle/Repository/SellRecordRepository.php delete mode 100755 src/Entity/.gitignore delete mode 100755 src/Entity/User/User.php delete mode 100755 templates/base.html.twig delete mode 100755 templates/pdf/content.html.twig delete mode 100755 templates/pdf/footer.html.twig delete mode 100755 templates/pdf/header.html.twig delete mode 100755 templates/pdf/table-of-contents.xml.twig diff --git a/app/Resources/HWIOAuthBundle/views/layout.html.twig b/app/Resources/HWIOAuthBundle/views/layout.html.twig index 242afc8e..30905d7c 100644 --- a/app/Resources/HWIOAuthBundle/views/layout.html.twig +++ b/app/Resources/HWIOAuthBundle/views/layout.html.twig @@ -1,8 +1,63 @@ {% extends '::default/index.html.twig' %} {% block title %}Login{% endblock %} - {% block body %} -

Le login

- {% block hwi_oauth_content %} - {% endblock hwi_oauth_content %} - {% endblock body %} +{% block body %} +

Le login

+
+
+
+ {##} + {#{{ form_rest(form) }}#} + {% if error %} +
{{ error|trans({}, 'FOSUserBundle') }}
+ {% endif %} +
+ + {% if last_sername is defined %} + + {% else %} + + {% endif %} + + +
+ +
+ + +
+ + +
+ + + + +
+
+ + {% trans %}Forgot your password + ?{% endtrans %} +
+ + {% trans %}You don't have an account + ?{% endtrans %} +
+ +
+
+
+ {#{% block hwi_oauth_content %}#} + {#{% endblock hwi_oauth_content %}#} +
+
+ + +{% endblock body %} diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index df672d38..acf68dff 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -1,19 +1,19 @@ - - - {% block title %}Welcome!{% endblock %} + + {% block title %}Fiche de compte dynamique{% endblock %} {% block stylesheets %} {% endblock %} - -{% block bigMain %} -
- {% block navigation %}{% endblock %} - {% block body %}{% endblock %} +{% block navigation %} + {% include 'default/login-choices.html.twig' %} +{% endblock %} +{% block body %} +
+ Votre caisse mobile en ligne
{% endblock %} {% block javascripts %} diff --git a/app/Resources/views/default/footer.html.twig b/app/Resources/views/default/footer.html.twig index 1d14f6d3..63f5cf44 100644 --- a/app/Resources/views/default/footer.html.twig +++ b/app/Resources/views/default/footer.html.twig @@ -7,4 +7,5 @@ contact + - Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }} diff --git a/app/Resources/views/default/main-screen.html.twig b/app/Resources/views/default/main-screen.html.twig index 5d3e9cc8..fb5c537b 100644 --- a/app/Resources/views/default/main-screen.html.twig +++ b/app/Resources/views/default/main-screen.html.twig @@ -1,50 +1,38 @@
-
+

- Welcome to - Symfony {{ constant('Symfony\\Component\\HttpKernel\\Kernel::VERSION') }} + Caisse

-
- +
+ Votre caisse mobile en ligne
+
+
+
+ +

Gratuit

+

Gérez votre comptabilité de stand en ligne sans dépenser un rond. Plus besoin de transporter un + inventaire et des feuilles de calcul faites à l'arrache.

+
+
+ +

Flexible

+

Modifiez vos produits à la volée, soyez plusieurs à gérer la caisse si vous le souhaitez, changez de + responsable en cours de journée.

+
+
+ +

Portable

+

Fait pour être utilisé sur les marchés et les salons. Votre gestion des stocks n'en sera que + simplifiée.

+
+
+
+
diff --git a/app/Resources/views/logged/caisse-main.html.twig b/app/Resources/views/logged/caisse-main.html.twig new file mode 100644 index 00000000..33530c7c --- /dev/null +++ b/app/Resources/views/logged/caisse-main.html.twig @@ -0,0 +1,59 @@ +
+
+ {% for c in categories %} + {{ c.title }} + {% for p in c.products %} + {{ p.title }} + {% endfor %} + {% endfor %} +
+
+
+
+
    +
  • title x1 xxx€
  • +
+

Total: xxx€

+ + +

Rendu: xxxx€

+
+
+ +
+
+ +
+
+ + +
+
+
+
+

+ Ventes en pause +

+ +
    +
  • h:m:s xxxx€
  • +
+
+
+
+

+ Ventes récentes +

+
    +
  • h:m:s xxxx€
  • +
+
+
+ +
diff --git a/app/Resources/views/logged/dashboard.html.twig b/app/Resources/views/logged/dashboard.html.twig new file mode 100644 index 00000000..7dd3c9f0 --- /dev/null +++ b/app/Resources/views/logged/dashboard.html.twig @@ -0,0 +1,27 @@ +{% extends 'base.html.twig' %} +{% trans_default_domain 'FOSUserBundle' %} +{% block body %} +
+
+ +
+

Caisse

+ {% include 'logged/caisse-main.html.twig' %} +
+
+

Catégories

+
+
+

Produits

+
+
+

Historique

+
+
+
+{% endblock %} diff --git a/templates/product/index.html.twig b/app/Resources/views/product/index.html.twig similarity index 100% rename from templates/product/index.html.twig rename to app/Resources/views/product/index.html.twig diff --git a/templates/product/test.html.twig b/app/Resources/views/product/test.html.twig similarity index 100% rename from templates/product/test.html.twig rename to app/Resources/views/product/test.html.twig diff --git a/app/config/security.yml b/app/config/security.yml index c98045b1..7c6b4c3e 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -30,6 +30,7 @@ security: #form_login: ~ secured_area: anonymous: ~ + logout_on_user_change: true oauth: resource_owners: facebook: "/login/check-facebook" diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php index dc1c1a96..9bf1ab36 100644 --- a/src/AppBundle/Controller/DefaultController.php +++ b/src/AppBundle/Controller/DefaultController.php @@ -25,22 +25,25 @@ class DefaultController extends Controller { } /** - * @Route("/test-ajax-request", name="test_ajax") + * @Route("/dashboard", name="dashboard") */ - public function testAjaxAction( Request $request ) { - $req = $request->request; - var_dump( $request->getMethod() ); - var_dump( $request->isXmlHttpRequest() ); - if ( $request->isXmlHttpRequest() ) { - var_dump( $request->get( 'data' ) ); - } - $recieved = $request->request->get( 'data' ); -// var_dump( $request->request ); - $json = [ - 'test' => 'it works', - 'recieved' => $recieved, - ]; + public function dashboardAction( Request $request ) { + $m = $this->getDoctrine()->getManager(); + $currentUser = $this->getUser(); + $categRepo = $m->getRepository( 'AppBundle:ProductCategory' ); + $categories = $categRepo->findAll(); + $csrfToken = $this->tokenManager + ? $this->tokenManager->getToken( 'authenticate' )->getValue() + : null; - return new JsonResponse( $json ); + // replace this example code with whatever you need + return $this->render( 'logged/dashboard.html.twig', + [ + 'categories' => $categories, + 'currentUser' => $currentUser, + 'csrf_token' => $csrfToken, + + 'base_dir' => realpath( $this->getParameter( 'kernel.project_dir' ) ) . DIRECTORY_SEPARATOR, + ] ); } } diff --git a/src/AppBundle/Entity/Product.php b/src/AppBundle/Entity/Product.php new file mode 100644 index 00000000..89ccaf3e --- /dev/null +++ b/src/AppBundle/Entity/Product.php @@ -0,0 +1,132 @@ +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; + } + + /** + * @return mixed + */ + public function getPrice() { + return $this->price; + } + + /** + * @param mixed $price + */ + public function setPrice( $price ) { + $this->price = $price; + } + + /** + * @return mixed + */ + public function getCategory() { + return $this->category; + } + + /** + * @param ProductCategory $category + */ + public function setCategory( ProductCategory $category ) { + $this->category = $category; + } + /** + * Constructor + */ + public function __construct() + { + $this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add sellRecord + * + * @param \AppBundle\Entity\SellRecord $sellRecord + * + * @return Product + */ + 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); + } + + /** + * Get sellRecords + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getSellRecords() + { + return $this->sellRecords; + } +} diff --git a/src/Entity/Product.php b/src/AppBundle/Entity/Product.php~ old mode 100755 new mode 100644 similarity index 97% rename from src/Entity/Product.php rename to src/AppBundle/Entity/Product.php~ index e0c3fe79..7387d6a3 --- a/src/Entity/Product.php +++ b/src/AppBundle/Entity/Product.php~ @@ -1,6 +1,6 @@ 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 ); + } +} diff --git a/src/Entity/ProductCategory.php b/src/AppBundle/Entity/ProductCategory.php~ old mode 100755 new mode 100644 similarity index 97% rename from src/Entity/ProductCategory.php rename to src/AppBundle/Entity/ProductCategory.php~ index 963badb8..b7e3dcac --- a/src/Entity/ProductCategory.php +++ b/src/AppBundle/Entity/ProductCategory.php~ @@ -1,8 +1,9 @@ id; + } + + /** + * @param mixed $id + */ + public function setId( $id ) { + $this->id = $id; + } + + /** + * @return mixed + */ + public function getProducts() { + return $this->products; + } + + /** + * @param mixed $products + */ + public function setProducts( $products ) { + $this->products = $products; + } + + /** + * @return mixed + */ + public function getDate() { + return $this->date; + } + + /** + * @param mixed $date + */ + public function setDate( $date ) { + $this->date = $date; + } + +} diff --git a/src/AppBundle/Entity/Stuff.php b/src/AppBundle/Entity/Stuff.php new file mode 100644 index 00000000..3ac9bf39 --- /dev/null +++ b/src/AppBundle/Entity/Stuff.php @@ -0,0 +1,65 @@ +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; + } +} diff --git a/src/AppBundle/Entity/Stuff.php~ b/src/AppBundle/Entity/Stuff.php~ new file mode 100644 index 00000000..7d67b4ec --- /dev/null +++ b/src/AppBundle/Entity/Stuff.php~ @@ -0,0 +1,66 @@ +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; + } +} + diff --git a/src/AppBundle/Entity/User.php b/src/AppBundle/Entity/User.php index 27ffe1b1..bf42a330 100644 --- a/src/AppBundle/Entity/User.php +++ b/src/AppBundle/Entity/User.php @@ -21,6 +21,12 @@ class User extends BaseUser { */ protected $id; + /** + * @ORM\Column(name="google_id", type="string", length=255, nullable=true) + */ + private $googleId; + + private $googleAccessToken; /** * Get id @@ -30,5 +36,28 @@ class User extends BaseUser { 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; + } +} diff --git a/src/AppBundle/Entity/User.php~ b/src/AppBundle/Entity/User.php~ new file mode 100644 index 00000000..0e2fb4c2 --- /dev/null +++ b/src/AppBundle/Entity/User.php~ @@ -0,0 +1,39 @@ +id; + } +} diff --git a/src/AppBundle/Repository/ProductCategoryRepository.php b/src/AppBundle/Repository/ProductCategoryRepository.php new file mode 100644 index 00000000..c2a7deab --- /dev/null +++ b/src/AppBundle/Repository/ProductCategoryRepository.php @@ -0,0 +1,12 @@ +id = $id; - } - - public function getId(): UserIdInterface - { - return $this->id; - } -} diff --git a/templates/base.html.twig b/templates/base.html.twig deleted file mode 100755 index f32d4c0a..00000000 --- a/templates/base.html.twig +++ /dev/null @@ -1,20 +0,0 @@ - - - - - {% block title %}Fiche de compte dynamique{% endblock %} - {% block stylesheets %} - - {% endblock %} - - -{% block body %} -
- Votre caisse mobile en ligne -
-{% endblock %} -{% block javascripts %} - -{% endblock %} - - diff --git a/templates/pdf/content.html.twig b/templates/pdf/content.html.twig deleted file mode 100755 index 87ca951c..00000000 --- a/templates/pdf/content.html.twig +++ /dev/null @@ -1,19 +0,0 @@ -
- - le contenu -

Page 1

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci dicta dolores eligendi facilis in inventore - libero, maiores modi, natus nesciunt nostrum quae quas quasi sit unde vel veniam veritatis voluptas!

-
-
-

Page 2

-

etur adipisicing elit. Alias autem beatae dolorum impedit incidunt iusto necessitatibus, nulla perspiciatis - placeat repellat, suscipit vel! Aspernatur commodi consequuntur delectus dolore doloribus eaque exercitationem - incidunt inventore ipsum libero molestiae nesciunt non nostrum nulla, numquam porro, possimus quia quibusdam - ratione recusandae sed sunt totam veniam.

-
- diff --git a/templates/pdf/footer.html.twig b/templates/pdf/footer.html.twig deleted file mode 100755 index 28d89a82..00000000 --- a/templates/pdf/footer.html.twig +++ /dev/null @@ -1 +0,0 @@ -footer tadam diff --git a/templates/pdf/header.html.twig b/templates/pdf/header.html.twig deleted file mode 100755 index 44f607ad..00000000 --- a/templates/pdf/header.html.twig +++ /dev/null @@ -1 +0,0 @@ -header hopla diff --git a/templates/pdf/table-of-contents.xml.twig b/templates/pdf/table-of-contents.xml.twig deleted file mode 100755 index 4adc209d..00000000 --- a/templates/pdf/table-of-contents.xml.twig +++ /dev/null @@ -1 +0,0 @@ -