call to backend and setup angular
This commit is contained in:
parent
b560b768ae
commit
d1ea133d76
@ -1,25 +1,41 @@
|
||||
<div class="caisse-main row">
|
||||
<div class="listing-products col-9">
|
||||
<div class="caisse-main row"
|
||||
ng-app="caisse"
|
||||
ng-controller="CaisseCtrl"
|
||||
>
|
||||
{% verbatim %}
|
||||
<div class="alert">
|
||||
test stuff: {{ stuff[0] }}.
|
||||
<br>compte: {{ stuff.length }}.
|
||||
</div>
|
||||
<div class="well">
|
||||
{{productsFromDB.length}}
|
||||
</div>
|
||||
{% endverbatim %}
|
||||
<div class="listing-products col-xs-9">
|
||||
{% for c in categories %}
|
||||
<h2>
|
||||
|
||||
{{ c.name }}
|
||||
</h2>
|
||||
{% for p in c.products %}
|
||||
<button class="btn btn-default">
|
||||
<button class="btn btn-default"
|
||||
ng-click="addProduct({{ p.id }})">
|
||||
{{ p.name }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="sellings col-3">
|
||||
<div class="sellings col-xs-3">
|
||||
<div class="current-selling">
|
||||
<form action="">
|
||||
<ul>
|
||||
<li>title x1 xxx€</li>
|
||||
</ul>
|
||||
<h3>Total: xxx€</h3>
|
||||
{% verbatim %}
|
||||
|
||||
<li ng-repeat="p in activeSelling">
|
||||
{{p.name}} x1 {{p.price}}€
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Total: {{CurrentSellingTotal}}€</h3>
|
||||
{% endverbatim %}
|
||||
<input type="number" id="paid_amount">
|
||||
<h3>Rendu: xxxx€</h3>
|
||||
<div class="row">
|
||||
@ -55,9 +71,17 @@
|
||||
<h4>
|
||||
Ventes récentes
|
||||
</h4>
|
||||
{% if recentSells %}
|
||||
<ul>
|
||||
<li>h:m:s xxxx€</li>
|
||||
{% for s in recentSells %}
|
||||
<li>{{ s.date|date('Y/m/d H:i:s') }} {{ s.amount }}€</li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
{% else %}
|
||||
aucune
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
21
app/Resources/views/sellrecord/edit.html.twig
Normal file
21
app/Resources/views/sellrecord/edit.html.twig
Normal 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 href="{{ path('sellrecord_index') }}">Back to the list</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_start(delete_form) }}
|
||||
<input type="submit" value="Delete">
|
||||
{{ form_end(delete_form) }}
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
37
app/Resources/views/sellrecord/index.html.twig
Normal file
37
app/Resources/views/sellrecord/index.html.twig
Normal file
@ -0,0 +1,37 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Sellrecords list</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for sellRecord in sellRecords %}
|
||||
<tr>
|
||||
<td><a href="{{ path('sellrecord_show', { 'date': sellRecord.date }) }}">{{ sellRecord.date }}</a></td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ path('sellrecord_show', { 'date': sellRecord.date }) }}">show</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('sellrecord_edit', { 'date': sellRecord.date }) }}">edit</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ path('sellrecord_new') }}">Create a new sellRecord</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
16
app/Resources/views/sellrecord/new.html.twig
Normal file
16
app/Resources/views/sellrecord/new.html.twig
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Sellrecord creation</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<input type="submit" value="Create" />
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ path('sellrecord_index') }}">Back to the list</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
28
app/Resources/views/sellrecord/show.html.twig
Normal file
28
app/Resources/views/sellrecord/show.html.twig
Normal file
@ -0,0 +1,28 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Sellrecord</h1>
|
||||
|
||||
<table>
|
||||
<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 href="{{ path('sellrecord_index') }}">Back to the list</a>
|
||||
</li>
|
||||
<li>
|
||||
<a 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 %}
|
@ -1,3 +1,7 @@
|
||||
app_sell_record:
|
||||
resource: "@AppBundle/Controller/SellRecordController.php"
|
||||
type: annotation
|
||||
|
||||
hwi_oauth_redirect:
|
||||
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
|
||||
prefix: /connect
|
||||
@ -26,3 +30,11 @@ app:
|
||||
type: annotation
|
||||
fos_user:
|
||||
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
|
||||
|
||||
get_my_products:
|
||||
path: /get-my-products
|
||||
defaults: { _controller: AppBundle:Default:getMyProducts }
|
||||
|
||||
add_selling:
|
||||
path: /add-selling
|
||||
defaults: { _controller: AppBundle:Default:addSelling }
|
||||
|
@ -1,2 +1,4 @@
|
||||
require('../css/app.scss');
|
||||
require('../../node_modules/jquery/dist/jquery.min');
|
||||
require('../../node_modules/angular/angular.min.js');
|
||||
require('./parts/main.js');
|
||||
|
@ -1,2 +1,70 @@
|
||||
console.log('hello console for main.js');
|
||||
var stuff = ['initialstuff'];
|
||||
angular
|
||||
.module('caisse', [])
|
||||
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
|
||||
$scope.productsFromDB = [
|
||||
{id: 1, name: "truc 1", price: 8, category: 1},
|
||||
{id: 2, name: "truc 2", price: 2, category: 1},
|
||||
{id: 3, name: "truc 3", price: 4, category: 2},
|
||||
{id: 4, name: "truc 4", price: 1, category: 2},
|
||||
];
|
||||
$scope.pausedSelling = [];
|
||||
$scope.activeSelling = [];
|
||||
$scope.CurrentSellingTotal = $scope.activeSelling.reduce(function (a, b) {
|
||||
return a + b.price;
|
||||
}, 0);
|
||||
|
||||
$scope.stuff = stuff;
|
||||
$scope.setActiveSelling = function (selling) {
|
||||
$scope.activeSelling = selling;
|
||||
};
|
||||
$scope.pauseSelling = function (selling) {
|
||||
$scope.pausedSelling.push(selling);
|
||||
};
|
||||
$scope.addProduct = function (id) {
|
||||
let found = $scope.productsFromDB.find({id: id});
|
||||
if (found) {
|
||||
$scope.productsToRecord.push(found);
|
||||
}
|
||||
};
|
||||
$scope.fetchProductsFromDB = function () {
|
||||
console.log('fetch products...');
|
||||
$http.get('get-my-products').then((data) => {
|
||||
|
||||
console.log('ok');
|
||||
$scope.productsFromDB = data;
|
||||
}, (err) => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
$scope.init = (function () {
|
||||
$scope.fetchProductsFromDB();
|
||||
})();
|
||||
$scope.logtest = function () {
|
||||
console.log('log test ok');
|
||||
};
|
||||
$scope.sendForm = function () {
|
||||
let lesParams = {};
|
||||
$http({
|
||||
method: 'POST',
|
||||
url : '/add-selling',
|
||||
data : lesParams // pass in data as strings
|
||||
}).then(function (rep) {
|
||||
console.log(rep);
|
||||
if (!rep.success) {
|
||||
// if not successful, bind errors to error variables
|
||||
$scope.errors = rep.errors;
|
||||
} else {
|
||||
// if successful, bind success message to message
|
||||
$scope.successMessage = rep.data.message;
|
||||
// changer le type de bout de phrase demandé
|
||||
$scope.formData["tykayn_portfoliobundle_cadexqphrasepart[type]"]["$viewValue"] = 'nouveauType';
|
||||
}
|
||||
}, function (rep) {
|
||||
console.log('nope! ', rep.data);
|
||||
})
|
||||
;
|
||||
};
|
||||
}]);
|
||||
|
||||
|
@ -8,7 +8,9 @@
|
||||
"webpack-notifier": "^1.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular": "1.5",
|
||||
"bootstrap": "^4.0.0",
|
||||
"font-awesome": "^4.7.0"
|
||||
"font-awesome": "^4.7.0",
|
||||
"jquery": "1.19"
|
||||
}
|
||||
}
|
||||
|
@ -39,19 +39,29 @@ class DefaultController extends Controller {
|
||||
$m = $this->getDoctrine()->getManager();
|
||||
$currentUser = $this->getUser();
|
||||
$categRepo = $m->getRepository( 'AppBundle:ProductCategory' );
|
||||
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
|
||||
$categories = $categRepo->findAll();
|
||||
$csrfToken = $this->tokenManager
|
||||
? $this->tokenManager->getToken( 'authenticate' )->getValue()
|
||||
: null;
|
||||
$recentSells = $sellingRepo->findBy( [], [ 'id' => 'desc' ], 0, 5 );
|
||||
|
||||
// replace this example code with whatever you need
|
||||
return $this->render( 'logged/dashboard.html.twig',
|
||||
[
|
||||
'categories' => $categories,
|
||||
'currentUser' => $currentUser,
|
||||
'csrf_token' => $csrfToken,
|
||||
|
||||
'recentSells' => $recentSells,
|
||||
'base_dir' => realpath( $this->getParameter( 'kernel.project_dir' ) ) . DIRECTORY_SEPARATOR,
|
||||
] );
|
||||
}
|
||||
|
||||
public function getMyProductsAction() {
|
||||
return new JsonResponse( [
|
||||
[ 'id' => 1, "name" => 'truc', "category" => 1, "price" => 9 ],
|
||||
// [ 'id' => 2, name => 'truc2', category => 1, price => 4 ],
|
||||
// [ id => 3, name => 'truc3', category => 2, price => 1 ],
|
||||
] );
|
||||
}
|
||||
|
||||
public function addSellingAction() {
|
||||
return new JsonResponse( [ "message" => "ok" ] );
|
||||
}
|
||||
}
|
||||
|
136
src/AppBundle/Controller/SellRecordController.php
Normal file
136
src/AppBundle/Controller/SellRecordController.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use AppBundle\Entity\SellRecord;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Sellrecord controller.
|
||||
*
|
||||
* @Route("sellrecord")
|
||||
*/
|
||||
class SellRecordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Lists all sellRecord entities.
|
||||
*
|
||||
* @Route("/", name="sellrecord_index")
|
||||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$sellRecords = $em->getRepository('AppBundle:SellRecord')->findAll();
|
||||
|
||||
return $this->render('sellrecord/index.html.twig', array(
|
||||
'sellRecords' => $sellRecords,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new sellRecord entity.
|
||||
*
|
||||
* @Route("/new", name="sellrecord_new")
|
||||
* @Method({"GET", "POST"})
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$sellRecord = new Sellrecord();
|
||||
$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', array('date' => $sellRecord->getDate()));
|
||||
}
|
||||
|
||||
return $this->render('sellrecord/new.html.twig', array(
|
||||
'sellRecord' => $sellRecord,
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and displays a sellRecord entity.
|
||||
*
|
||||
* @Route("/{date}", name="sellrecord_show")
|
||||
* @Method("GET")
|
||||
*/
|
||||
public function showAction(SellRecord $sellRecord)
|
||||
{
|
||||
$deleteForm = $this->createDeleteForm($sellRecord);
|
||||
|
||||
return $this->render('sellrecord/show.html.twig', array(
|
||||
'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)
|
||||
{
|
||||
$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', array('date' => $sellRecord->getDate()));
|
||||
}
|
||||
|
||||
return $this->render('sellrecord/edit.html.twig', array(
|
||||
'sellRecord' => $sellRecord,
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a sellRecord entity.
|
||||
*
|
||||
* @Route("/{date}", name="sellrecord_delete")
|
||||
* @Method("DELETE")
|
||||
*/
|
||||
public function deleteAction(Request $request, SellRecord $sellRecord)
|
||||
{
|
||||
$form = $this->createDeleteForm($sellRecord);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->remove($sellRecord);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('sellrecord_index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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', array('date' => $sellRecord->getDate())))
|
||||
->setMethod('DELETE')
|
||||
->getForm()
|
||||
;
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ namespace AppBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
|
||||
*/
|
||||
class Product {
|
||||
/**
|
||||
@ -88,4 +88,45 @@ class Product {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace AppBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ProductCategoryRepository")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductCategoryRepository")
|
||||
*/
|
||||
class ProductCategory {
|
||||
/**
|
||||
@ -67,4 +67,32 @@ class ProductCategory {
|
||||
$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 );
|
||||
}
|
||||
}
|
||||
|
@ -13,14 +13,36 @@ class SellRecord {
|
||||
*/
|
||||
private $products;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(name="id")
|
||||
*/
|
||||
private $id;
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $date;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="decimal", scale=2, nullable=true)
|
||||
*/
|
||||
private $amount;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAmount() {
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $amount
|
||||
*/
|
||||
public function setAmount( $amount ) {
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@ -57,9 +79,9 @@ class SellRecord {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $date
|
||||
* @param \DateTime $date
|
||||
*/
|
||||
public function setDate( $date ) {
|
||||
public function setDate( \DateTime $date ) {
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ namespace AppBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\SellRecordRepository")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\SellRecordRepository")
|
||||
*/
|
||||
class SellRecord {
|
||||
/**
|
||||
@ -21,6 +21,8 @@ class SellRecord {
|
||||
*/
|
||||
private $date;
|
||||
|
||||
private $amount;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -63,4 +63,3 @@ class Stuff
|
||||
return $this->truc;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,4 +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;
|
||||
}
|
||||
}
|
||||
|
36
src/AppBundle/Form/SellRecordType.php
Normal file
36
src/AppBundle/Form/SellRecordType.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class SellRecordType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('products');
|
||||
}/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'AppBundle\Entity\SellRecord'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'appbundle_sellrecord';
|
||||
}
|
||||
|
||||
|
||||
}
|
13
src/AppBundle/Repository/StuffRepository.php
Normal file
13
src/AppBundle/Repository/StuffRepository.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Repository;
|
||||
|
||||
/**
|
||||
* StuffRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class StuffRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
55
src/AppBundle/Tests/Controller/SellRecordControllerTest.php
Normal file
55
src/AppBundle/Tests/Controller/SellRecordControllerTest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class SellRecordControllerTest extends WebTestCase
|
||||
{
|
||||
/*
|
||||
public function testCompleteScenario()
|
||||
{
|
||||
// Create a new client to browse the application
|
||||
$client = static::createClient();
|
||||
|
||||
// Create a new entry in the database
|
||||
$crawler = $client->request('GET', '/sellrecord/');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /sellrecord/");
|
||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
||||
|
||||
// Fill in the form and submit it
|
||||
$form = $crawler->selectButton('Create')->form(array(
|
||||
'appbundle_sellrecord[field_name]' => 'Test',
|
||||
// ... other fields to fill
|
||||
));
|
||||
|
||||
$client->submit($form);
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// Check data in the show view
|
||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
||||
|
||||
// Edit the entity
|
||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
||||
|
||||
$form = $crawler->selectButton('Update')->form(array(
|
||||
'appbundle_sellrecord[field_name]' => 'Foo',
|
||||
// ... other fields to fill
|
||||
));
|
||||
|
||||
$client->submit($form);
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// Check the element contains an attribute with value equals "Foo"
|
||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
||||
|
||||
// Delete the entity
|
||||
$client->submit($crawler->selectButton('Delete')->form());
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// Check the entity has been delete on the list
|
||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
@ -132,6 +132,10 @@ amdefine@>=0.0.4:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
|
||||
angular@1.5:
|
||||
version "1.5.11"
|
||||
resolved "https://registry.yarnpkg.com/angular/-/angular-1.5.11.tgz#8c5ba7386f15965c9acf3429f6881553aada30d6"
|
||||
|
||||
ansi-html@0.0.7:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e"
|
||||
@ -2943,6 +2947,10 @@ isstream@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
|
||||
jquery@1.19:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
|
||||
|
||||
js-base64@^2.1.8, js-base64@^2.1.9:
|
||||
version "2.4.3"
|
||||
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582"
|
||||
|
Loading…
Reference in New Issue
Block a user