@@ -80,8 +74,6 @@
-
-
{% block javascripts %}
{% endblock %}
diff --git a/composer.lock b/composer.lock
index 8ac1510..77f4b41 100644
--- a/composer.lock
+++ b/composer.lock
@@ -138,16 +138,16 @@
},
{
"name": "doctrine/annotations",
- "version": "1.13.2",
+ "version": "1.13.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
- "reference": "5b668aef16090008790395c02c893b1ba13f7e08"
+ "reference": "648b0343343565c4a056bfc8392201385e8d89f0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08",
- "reference": "5b668aef16090008790395c02c893b1ba13f7e08",
+ "url": "https://api.github.com/repos/doctrine/annotations/zipball/648b0343343565c4a056bfc8392201385e8d89f0",
+ "reference": "648b0343343565c4a056bfc8392201385e8d89f0",
"shasum": ""
},
"require": {
@@ -159,9 +159,10 @@
"require-dev": {
"doctrine/cache": "^1.11 || ^2.0",
"doctrine/coding-standard": "^6.0 || ^8.1",
- "phpstan/phpstan": "^0.12.20",
+ "phpstan/phpstan": "^1.4.10 || ^1.8.0",
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5",
- "symfony/cache": "^4.4 || ^5.2"
+ "symfony/cache": "^4.4 || ^5.2",
+ "vimeo/psalm": "^4.10"
},
"type": "library",
"autoload": {
@@ -204,9 +205,9 @@
],
"support": {
"issues": "https://github.com/doctrine/annotations/issues",
- "source": "https://github.com/doctrine/annotations/tree/1.13.2"
+ "source": "https://github.com/doctrine/annotations/tree/1.13.3"
},
- "time": "2021-08-05T19:00:23+00:00"
+ "time": "2022-07-02T10:48:51+00:00"
},
{
"name": "doctrine/cache",
@@ -309,26 +310,27 @@
},
{
"name": "doctrine/collections",
- "version": "1.6.8",
+ "version": "1.8.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
- "reference": "1958a744696c6bb3bb0d28db2611dc11610e78af"
+ "reference": "2b44dd4cbca8b5744327de78bafef5945c7e7b5e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/collections/zipball/1958a744696c6bb3bb0d28db2611dc11610e78af",
- "reference": "1958a744696c6bb3bb0d28db2611dc11610e78af",
+ "url": "https://api.github.com/repos/doctrine/collections/zipball/2b44dd4cbca8b5744327de78bafef5945c7e7b5e",
+ "reference": "2b44dd4cbca8b5744327de78bafef5945c7e7b5e",
"shasum": ""
},
"require": {
+ "doctrine/deprecations": "^0.5.3 || ^1",
"php": "^7.1.3 || ^8.0"
},
"require-dev": {
- "doctrine/coding-standard": "^9.0",
- "phpstan/phpstan": "^0.12",
+ "doctrine/coding-standard": "^9.0 || ^10.0",
+ "phpstan/phpstan": "^1.4.8",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.1.5",
- "vimeo/psalm": "^4.2.1"
+ "vimeo/psalm": "^4.22"
},
"type": "library",
"autoload": {
@@ -372,9 +374,9 @@
],
"support": {
"issues": "https://github.com/doctrine/collections/issues",
- "source": "https://github.com/doctrine/collections/tree/1.6.8"
+ "source": "https://github.com/doctrine/collections/tree/1.8.0"
},
- "time": "2021-08-10T18:51:53+00:00"
+ "time": "2022-09-01T20:12:10+00:00"
},
{
"name": "doctrine/common",
@@ -839,34 +841,31 @@
},
{
"name": "doctrine/event-manager",
- "version": "1.1.1",
+ "version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
- "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
+ "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
- "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
+ "url": "https://api.github.com/repos/doctrine/event-manager/zipball/eb2ecf80e3093e8f3c2769ac838e27d8ede8e683",
+ "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
- "doctrine/common": "<2.9@dev"
+ "doctrine/common": "<2.9"
},
"require-dev": {
- "doctrine/coding-standard": "^6.0",
- "phpunit/phpunit": "^7.0"
+ "doctrine/coding-standard": "^9",
+ "phpstan/phpstan": "~1.4.10 || ^1.5.4",
+ "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
+ "vimeo/psalm": "^4.22"
},
"type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
@@ -913,7 +912,7 @@
],
"support": {
"issues": "https://github.com/doctrine/event-manager/issues",
- "source": "https://github.com/doctrine/event-manager/tree/1.1.x"
+ "source": "https://github.com/doctrine/event-manager/tree/1.1.2"
},
"funding": [
{
@@ -929,7 +928,7 @@
"type": "tidelift"
}
],
- "time": "2020-05-29T18:28:51+00:00"
+ "time": "2022-07-27T22:18:11+00:00"
},
{
"name": "doctrine/inflector",
@@ -2969,29 +2968,33 @@
},
{
"name": "phpoption/phpoption",
- "version": "1.8.1",
+ "version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
- "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15"
+ "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15",
- "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15",
+ "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab",
+ "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab",
"shasum": ""
},
"require": {
- "php": "^7.0 || ^8.0"
+ "php": "^7.2.5 || ^8.0"
},
"require-dev": {
- "bamarni/composer-bin-plugin": "^1.4.1",
- "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8"
+ "bamarni/composer-bin-plugin": "^1.8",
+ "phpunit/phpunit": "^8.5.28 || ^9.5.21"
},
"type": "library",
"extra": {
+ "bamarni-bin": {
+ "bin-links": true,
+ "forward-command": true
+ },
"branch-alias": {
- "dev-master": "1.8-dev"
+ "dev-master": "1.9-dev"
}
},
"autoload": {
@@ -3024,7 +3027,7 @@
],
"support": {
"issues": "https://github.com/schmittjoh/php-option/issues",
- "source": "https://github.com/schmittjoh/php-option/tree/1.8.1"
+ "source": "https://github.com/schmittjoh/php-option/tree/1.9.0"
},
"funding": [
{
@@ -3036,7 +3039,7 @@
"type": "tidelift"
}
],
- "time": "2021-12-04T23:24:31+00:00"
+ "time": "2022-07-30T15:51:26+00:00"
},
{
"name": "prestashop/prestashop-webservice-lib",
@@ -3630,7 +3633,7 @@
},
{
"name": "symfony/deprecation-contracts",
- "version": "v2.5.1",
+ "version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
@@ -3677,7 +3680,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
},
"funding": [
{
@@ -3697,16 +3700,16 @@
},
{
"name": "symfony/http-client",
- "version": "v5.4.9",
+ "version": "v5.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
- "reference": "dc0b15e42b762c040761c1eb9ce86a55d47cf672"
+ "reference": "596fd752f00e0205d895cd6b184d135c27bb5d6a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-client/zipball/dc0b15e42b762c040761c1eb9ce86a55d47cf672",
- "reference": "dc0b15e42b762c040761c1eb9ce86a55d47cf672",
+ "url": "https://api.github.com/repos/symfony/http-client/zipball/596fd752f00e0205d895cd6b184d135c27bb5d6a",
+ "reference": "596fd752f00e0205d895cd6b184d135c27bb5d6a",
"shasum": ""
},
"require": {
@@ -3764,7 +3767,7 @@
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/http-client/tree/v5.4.9"
+ "source": "https://github.com/symfony/http-client/tree/v5.4.13"
},
"funding": [
{
@@ -3780,20 +3783,20 @@
"type": "tidelift"
}
],
- "time": "2022-05-21T08:57:05+00:00"
+ "time": "2022-09-08T18:41:21+00:00"
},
{
"name": "symfony/http-client-contracts",
- "version": "v2.5.1",
+ "version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client-contracts.git",
- "reference": "1a4f708e4e87f335d1b1be6148060739152f0bd5"
+ "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/1a4f708e4e87f335d1b1be6148060739152f0bd5",
- "reference": "1a4f708e4e87f335d1b1be6148060739152f0bd5",
+ "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70",
+ "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70",
"shasum": ""
},
"require": {
@@ -3842,7 +3845,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.1"
+ "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.2"
},
"funding": [
{
@@ -3858,20 +3861,20 @@
"type": "tidelift"
}
],
- "time": "2022-03-13T20:07:29+00:00"
+ "time": "2022-04-12T15:48:08+00:00"
},
{
"name": "symfony/mime",
- "version": "v5.4.9",
+ "version": "v5.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
- "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e"
+ "reference": "bb2ccf759e2b967dcd11bdee5bdf30dddd2290bd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e",
- "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e",
+ "url": "https://api.github.com/repos/symfony/mime/zipball/bb2ccf759e2b967dcd11bdee5bdf30dddd2290bd",
+ "reference": "bb2ccf759e2b967dcd11bdee5bdf30dddd2290bd",
"shasum": ""
},
"require": {
@@ -3925,7 +3928,7 @@
"mime-type"
],
"support": {
- "source": "https://github.com/symfony/mime/tree/v5.4.9"
+ "source": "https://github.com/symfony/mime/tree/v5.4.13"
},
"funding": [
{
@@ -3941,7 +3944,7 @@
"type": "tidelift"
}
],
- "time": "2022-05-21T10:24:18+00:00"
+ "time": "2022-09-01T18:18:29+00:00"
},
{
"name": "symfony/monolog-bundle",
@@ -4900,16 +4903,16 @@
},
{
"name": "symfony/service-contracts",
- "version": "v2.5.1",
+ "version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
- "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
+ "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
- "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
+ "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
+ "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
"shasum": ""
},
"require": {
@@ -4963,7 +4966,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
+ "source": "https://github.com/symfony/service-contracts/tree/v2.5.2"
},
"funding": [
{
@@ -4979,7 +4982,7 @@
"type": "tidelift"
}
],
- "time": "2022-03-13T20:07:29+00:00"
+ "time": "2022-05-30T19:17:29+00:00"
},
{
"name": "symfony/swiftmailer-bundle",
@@ -5223,12 +5226,12 @@
"target-dir": "TFox/MpdfPortBundle",
"source": {
"type": "git",
- "url": "https://github.com/tasmanianfox/MpdfPortBundle.git",
+ "url": "https://github.com/dontpullthis/MpdfPortBundle.git",
"reference": "6e865db434266409000f2340454ba039d47046cf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/tasmanianfox/MpdfPortBundle/zipball/6e865db434266409000f2340454ba039d47046cf",
+ "url": "https://api.github.com/repos/dontpullthis/MpdfPortBundle/zipball/6e865db434266409000f2340454ba039d47046cf",
"reference": "6e865db434266409000f2340454ba039d47046cf",
"shasum": ""
},
@@ -5271,23 +5274,23 @@
"pdf"
],
"support": {
- "issues": "https://github.com/tasmanianfox/MpdfPortBundle/issues",
- "source": "https://github.com/tasmanianfox/MpdfPortBundle/tree/master"
+ "issues": "https://github.com/dontpullthis/MpdfPortBundle/issues",
+ "source": "https://github.com/dontpullthis/MpdfPortBundle/tree/1.3.2"
},
"time": "2017-07-10T09:28:25+00:00"
},
{
"name": "twig/twig",
- "version": "v2.15.1",
+ "version": "v2.15.3",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
- "reference": "3b7cedb2f736899a7dbd0ba3d6da335a015f5cc4"
+ "reference": "ab402673db8746cb3a4c46f3869d6253699f614a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/3b7cedb2f736899a7dbd0ba3d6da335a015f5cc4",
- "reference": "3b7cedb2f736899a7dbd0ba3d6da335a015f5cc4",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/ab402673db8746cb3a4c46f3869d6253699f614a",
+ "reference": "ab402673db8746cb3a4c46f3869d6253699f614a",
"shasum": ""
},
"require": {
@@ -5342,7 +5345,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
- "source": "https://github.com/twigphp/Twig/tree/v2.15.1"
+ "source": "https://github.com/twigphp/Twig/tree/v2.15.3"
},
"funding": [
{
@@ -5354,7 +5357,7 @@
"type": "tidelift"
}
],
- "time": "2022-05-17T05:46:24+00:00"
+ "time": "2022-09-28T08:40:08+00:00"
},
{
"name": "willdurand/jsonp-callback-validator",
diff --git a/src/AppBundle/Controller/ProductController.php b/src/AppBundle/Controller/ProductController.php
index f43fd39..2822683 100644
--- a/src/AppBundle/Controller/ProductController.php
+++ b/src/AppBundle/Controller/ProductController.php
@@ -55,12 +55,10 @@ public function indexAction(Request $request)
$productCount = $repo->queryStock($this->getUser())->select("count(p.id)")->getQuery()->getSingleScalarResult();
$pageLength = 20;
- $pageCount = ceil($productCount / $pageLength);
return $this->render('AppBundle:Product:index.html.twig', array(
'productCount' => $productCount,
- 'pageLength' => $pageLength,
- 'pageCount' => $pageCount
+ 'pageLength' => $pageLength
));
}
@@ -433,7 +431,7 @@ public function deleteAction($id)
$em->remove($em->getReference(Product::class, $id));
$em->flush();
- return $this->redirectToRoute('product_index');
+ return new Response();
}
/**
diff --git a/src/AppBundle/Controller/VueProductController.php b/src/AppBundle/Controller/VueProductController.php
index be94164..8ce9478 100644
--- a/src/AppBundle/Controller/VueProductController.php
+++ b/src/AppBundle/Controller/VueProductController.php
@@ -26,6 +26,7 @@
use Symfony\Component\HttpFoundation\Request;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
+use AppBundle\Entity\ProductAttributeRelation;
/**
* This controller will replace the ProductController gradually
@@ -35,15 +36,98 @@
class VueProductController extends FOSRestController
{
/**
- * @Rest\Get("/{offset}/{limit}/{sort}/{order}")
- * @Rest\View(serializerGroups={"vue:products"})
+ * @Rest\Get("/index")
+ * @Rest\View(serializerGroups={"product:index"})
*/
- public function indexAction(Request $request, $offset, $limit, $sort, $order)
+ public function indexAction(Request $request)
{
$repo = $this->getDoctrine()->getRepository(Product::class);
- $products = $repo->queryStock($this->getUser(), $offset, $limit, $sort, $order)->getQuery()->getResult();
+ $searchContainer = new \AppBundle\Helper\IndexSearchContainer($this->getUser(), Product::class);
+ $searchContainer->query = $request->get('query');
+ $searchContainer->availability = $request->get('availability');
+ $searchContainer->status = $request->get('status') ? $this->getDoctrine()->getManager()->find('AppBundle:ProductStatus', $request->get('status')) : null;
+ $searchContainer->type = $request->get('type') ? $this->getDoctrine()->getManager()->find('AppBundle:ProductType', $request->get('type')) : null;
+ $searchContainer->location = $request->get('location') ? $this->getDoctrine()->getManager()->find('AppBundle:Location', $request->get('location')) : null;
+
+ $offset = $request->get('offset');
+ $limit = $request->get('limit');
+ $sort = $request->get('sort');
+
+ if ($searchContainer->isSearchable())
+ {
+ $products = $repo->querySearch($searchContainer, $offset, $limit, $sort)->getQuery()->getResult();
+ }
+ else
+ {
+ $products = $repo->queryStock($this->getUser(), $offset, $limit, $sort)->getQuery()->getResult();
+ }
return $products;
}
+
+ /**
+ * @Rest\Get("/meta")
+ * @Rest\View(serializerGroups={"product:meta"})
+ */
+ public function metaAction(Request $request)
+ {
+ $productStatuses = $this->getDoctrine()->getRepository('AppBundle:ProductStatus')->findBy([], ['name' => 'ASC']);
+ $productTypes = $this->getDoctrine()->getRepository('AppBundle:ProductType')->findBy([], ['name' => 'ASC']);
+ $locations = $this->getDoctrine()->getRepository('AppBundle:Location')->findMine($this->getUser());
+
+ return array(
+ 'productStatuses' => $productStatuses,
+ 'productTypes' => $productTypes,
+ 'locations' => $locations
+ );
+ }
+
+ /**
+ * @Rest\Get("/edit/{productId}")
+ * @Rest\View(serializerGroups={"product:edit"})
+ */
+ public function editAction(Request $request, $productId)
+ {
+ /** @var \AppBundle\Repository\ProductRepository */
+ $repo = $this->getDoctrine()->getRepository('AppBundle:Product');
+
+ if ($productId == 0)
+ {
+ $product = new Product();
+ }
+ else
+ {
+ /** @var Product */
+ $product = $repo->find($productId);
+ }
+
+ $repo->generateProductAttributeRelations($product);
+
+ return $product;
+ }
+
+ /**
+ * @Rest\Get("/checklist/{productId}")
+ * @Rest\View(serializerGroups={"product:checklist"})
+ */
+ public function checklistAction(Request $request, $productId)
+ {
+ $product = $this->getDoctrine()->getRepository('AppBundle:Product')->find($productId);
+
+ return $product->getPurchaseOrderRelation();
+ }
+
+ /**
+ * @Rest\Get("/attributable/{productId}/{attributeId}")
+ * @Rest\View(serializerGroups={"product:attributable"})
+ */
+ public function attributableProductsAction(Request $request, $productId, $attributeId)
+ {
+ $product = $this->getDoctrine()->getManager()->find('AppBundle:Product', $productId);
+ $attribute = $this->getDoctrine()->getManager()->find('AppBundle:Attribute', $attributeId);
+ $products = $this->getDoctrine()->getRepository('AppBundle:Product')->findAttributableProducts($product, $attribute);
+
+ return $products;
+ }
}
diff --git a/src/AppBundle/Entity/ACompany.php b/src/AppBundle/Entity/ACompany.php
index 6287e66..a4b9094 100644
--- a/src/AppBundle/Entity/ACompany.php
+++ b/src/AppBundle/Entity/ACompany.php
@@ -58,7 +58,7 @@ abstract class ACompany
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
protected $name;
diff --git a/src/AppBundle/Entity/AFile.php b/src/AppBundle/Entity/AFile.php
index c1ddcd9..9e02f40 100644
--- a/src/AppBundle/Entity/AFile.php
+++ b/src/AppBundle/Entity/AFile.php
@@ -23,6 +23,7 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation as Serialize;
/**
* @ORM\Entity
@@ -48,6 +49,7 @@ public function __construct($originalClientFilename, $uniqueServerFilename) {
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
+ * @Serialize\Groups({"product:edit"})
*/
private $id;
@@ -55,6 +57,7 @@ public function __construct($originalClientFilename, $uniqueServerFilename) {
* @var string
*
* @ORM\Column(type="string", length=255, nullable=false)
+ * @Serialize\Groups({"product:edit"})
*/
private $originalClientFilename;
diff --git a/src/AppBundle/Entity/AOrder.php b/src/AppBundle/Entity/AOrder.php
index 7cc3346..8201541 100644
--- a/src/AppBundle/Entity/AOrder.php
+++ b/src/AppBundle/Entity/AOrder.php
@@ -47,7 +47,7 @@ public function __construct() {
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
protected $id;
@@ -55,7 +55,7 @@ public function __construct() {
* @var string
*
* @ORM\Column(type="string", length=16, unique=true, nullable=true)
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
protected $orderNr;
@@ -71,7 +71,7 @@ public function __construct() {
* @var \DateTime
*
* @ORM\Column(type="datetime")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
protected $orderDate;
@@ -88,7 +88,7 @@ public function __construct() {
*
* @ORM\ManyToOne(targetEntity="OrderStatus")
* @ORM\JoinColumn(name="status_id", referencedColumnName="id")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
protected $status;
diff --git a/src/AppBundle/Entity/AService.php b/src/AppBundle/Entity/AService.php
index 84f0e14..8880a04 100644
--- a/src/AppBundle/Entity/AService.php
+++ b/src/AppBundle/Entity/AService.php
@@ -23,6 +23,7 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation as Serialize;
/**
* @ORM\Table(name="aservice")
@@ -51,6 +52,7 @@ public function __construct(ProductOrderRelation $productOrderRelation) {
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
+ * @Serialize\Groups({"product:checklist"})
*/
protected $id;
@@ -58,6 +60,7 @@ public function __construct(ProductOrderRelation $productOrderRelation) {
* @var int Use constants
*
* @ORM\Column(type="integer", nullable=false)
+ * @Serialize\Groups({"product:checklist"})
*/
protected $status;
@@ -73,6 +76,7 @@ public function __construct(ProductOrderRelation $productOrderRelation) {
* @var string
*
* @ORM\Column(type="text", nullable=true)
+ * @Serialize\Groups({"product:checklist"})
*/
protected $description;
diff --git a/src/AppBundle/Entity/AStatus.php b/src/AppBundle/Entity/AStatus.php
index d7a597e..8ec3ed1 100644
--- a/src/AppBundle/Entity/AStatus.php
+++ b/src/AppBundle/Entity/AStatus.php
@@ -23,7 +23,7 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
-
+use JMS\Serializer\Annotation as Serialize;
/**
* @ORM\MappedSuperclass
@@ -36,6 +36,7 @@ abstract class AStatus
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
+ * @Serialize\Groups({"product:meta", "product:edit"})
*/
protected $id;
@@ -50,6 +51,7 @@ abstract class AStatus
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
+ * @Serialize\Groups({"product:meta"})
*/
protected $name;
diff --git a/src/AppBundle/Entity/Attribute.php b/src/AppBundle/Entity/Attribute.php
index 21cad9a..bcee17b 100644
--- a/src/AppBundle/Entity/Attribute.php
+++ b/src/AppBundle/Entity/Attribute.php
@@ -51,7 +51,7 @@ public function __construct() {
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $id;
@@ -75,7 +75,7 @@ public function __construct() {
* @var string
*
* @ORM\Column(type="string", length=255, unique=true)
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
* @
*/
private $name;
@@ -92,7 +92,7 @@ public function __construct() {
* @var int Use constants
*
* @ORM\Column(type="integer", nullable=true)
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $type;
@@ -119,7 +119,7 @@ public function __construct() {
* @var ArrayCollection|AttributeOption[] To use when type is SELECT
*
* @ORM\OneToMany(targetEntity="AttributeOption", mappedBy="attribute", cascade={"all"})
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $options;
@@ -127,7 +127,7 @@ public function __construct() {
* @var bool If true, the ProductAttributeRelation can use quantity, meaning quantity per unit
*
* @ORM\Column(type="boolean", nullable=false, options={"default" : false})
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $hasQuantity = false;
diff --git a/src/AppBundle/Entity/AttributeOption.php b/src/AppBundle/Entity/AttributeOption.php
index 8594568..33f8d2f 100644
--- a/src/AppBundle/Entity/AttributeOption.php
+++ b/src/AppBundle/Entity/AttributeOption.php
@@ -23,6 +23,7 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation as Serialize;
use Doctrine\Common\Collections\ArrayCollection;
/**
@@ -44,6 +45,7 @@ public function __construct(Attribute $attribute) {
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $id;
@@ -58,6 +60,7 @@ public function __construct(Attribute $attribute) {
* @var string
*
* @ORM\Column(name="name", type="string", length=255, unique=false)
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
* @
*/
private $name;
diff --git a/src/AppBundle/Entity/Location.php b/src/AppBundle/Entity/Location.php
index 22cb423..c053ab6 100644
--- a/src/AppBundle/Entity/Location.php
+++ b/src/AppBundle/Entity/Location.php
@@ -48,14 +48,14 @@ public function __construct() {
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:meta", "product:edit"})
*/
private $id;
/**
* @var string
* @ORM\Column(name="name", type="string", length=255, unique=true)
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:meta"})
*/
private $name;
diff --git a/src/AppBundle/Entity/Product.php b/src/AppBundle/Entity/Product.php
index 66ebc6a..6d03946 100644
--- a/src/AppBundle/Entity/Product.php
+++ b/src/AppBundle/Entity/Product.php
@@ -62,7 +62,7 @@ public function preUpdate()
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:edit", "product:attributable"})
*/
private $id;
@@ -78,7 +78,7 @@ public function preUpdate()
* @var string
*
* @ORM\Column(type="string", length=16)
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:edit"})
*/
private $sku;
@@ -86,7 +86,7 @@ public function preUpdate()
* @var string
*
* @ORM\Column(type="string", length=255)
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:edit", "product:attributable"})
*/
private $name;
@@ -95,7 +95,7 @@ public function preUpdate()
*
* @ORM\ManyToOne(targetEntity="ProductType")
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:edit"})
*/
private $type;
@@ -103,7 +103,7 @@ public function preUpdate()
* @var string
*
* @ORM\Column(type="text", nullable=true)
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $description;
@@ -111,7 +111,7 @@ public function preUpdate()
* @var int Standard sales price, in eurocents, per unit
*
* @ORM\Column(type="integer", nullable=true)
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:edit"})
*/
private $price;
@@ -120,7 +120,7 @@ public function preUpdate()
*
* @ORM\ManyToOne(targetEntity="Location", inversedBy="products")
* @ORM\JoinColumn(name="location_id", referencedColumnName="id", nullable=false)
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:edit"})
*/
private $location;
@@ -145,14 +145,14 @@ public function preUpdate()
*
* @ORM\ManyToOne(targetEntity="ProductStatus", fetch="EAGER")
* @ORM\JoinColumn(name="status_id", referencedColumnName="id")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $status;
/**
* @var ArrayCollection|ProductAttributeRelation[]
* @ORM\OneToMany(targetEntity="ProductAttributeRelation", mappedBy="product", cascade={"all"}, orphanRemoval=true)
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:edit"})
*/
private $attributeRelations;
@@ -192,7 +192,7 @@ public function preUpdate()
* @var Stock
*
* @ORM\OneToOne(targetEntity="Stock", mappedBy="product")
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index"})
*/
private $stock;
@@ -513,7 +513,7 @@ public function getUpdatedAt()
/**
* @Serialize\VirtualProperty()
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:edit"})
* @return ProductOrderRelation Relation to purchase order
*/
public function getPurchaseOrderRelation()
@@ -526,6 +526,8 @@ function($r) {
}
/**
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:edit"})
* @return Collection|ProductOrderRelation[] Relations to sales orders
*/
public function getSalesOrderRelations()
@@ -539,6 +541,9 @@ function($r) {
/**
* Standard prices multiplied by Quantities of (selected) attributes and/or attributed products
+ *
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:edit"})
* @return double
*/
public function getTotalStandardPriceOfAttributes()
@@ -554,6 +559,28 @@ public function getTotalStandardPriceOfAttributes()
}
/**
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:index"})
+ * @return string proxy which will be filled with Vue and Axios
+ */
+ public function getServicesDone() {
+ return '...';
+ }
+
+ /**
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:index"})
+ * @return string for use in views tooltips
+ */
+ public function getTasksCount() {
+ if ($this->type && $this->getType()->getTasks()->count())
+ return $this->getType()->getTasks()->count();
+ return 0;
+ }
+
+ /**
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:index"})
* @return string for use in views tooltips
*/
public function getAttributesList() {
diff --git a/src/AppBundle/Entity/ProductAttributeRelation.php b/src/AppBundle/Entity/ProductAttributeRelation.php
index a03da80..43e84e8 100644
--- a/src/AppBundle/Entity/ProductAttributeRelation.php
+++ b/src/AppBundle/Entity/ProductAttributeRelation.php
@@ -23,6 +23,7 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation as Serialize;
/**
* @ORM\Table(name="product_attribute")
@@ -41,6 +42,7 @@ public function __construct(Product $product, Attribute $attribute) {
* @var string Text, File path or Option text; depends on type of attribute
*
* @ORM\Column(type="string", length=255, nullable=true)
+ * @Serialize\Groups({"product:edit"})
*/
private $value;
@@ -67,6 +69,7 @@ public function __construct(Product $product, Attribute $attribute) {
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Attribute", inversedBy="productRelations")
* @ORM\JoinColumn(name="attribute_id", referencedColumnName="id", nullable=false)
+ * @Serialize\Groups({"product:edit"})
*/
private $attribute;
@@ -74,6 +77,7 @@ public function __construct(Product $product, Attribute $attribute) {
* @var int
*
* @ORM\Column(type="integer", nullable=true)
+ * @Serialize\Groups({"product:edit"})
*/
private $quantity;
@@ -185,12 +189,14 @@ public function __toString(){
/**
* Get files of product and attribute
*
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:edit"})
* @return \Doctrine\Common\Collections\Collection|ProductAttributeFile[]
*/
public function getFiles()
{
if ($this->attribute->getType() != Attribute::TYPE_FILE)
- throw new \Exception("Attribute must be of type File.");
+ return array();
$fileIds = explode(",", $this->value);
$fileIds = array_map('intval', $fileIds);
@@ -234,7 +240,7 @@ public function getQuantity()
#endregion
/**
- * @return AttributeOption
+ * @return AttributeOption|bool
*/
public function getSelectedOption()
{
@@ -249,6 +255,9 @@ function (AttributeOption $o) {
/**
* Standard price multiplied by Quantity of (selected) attribute or attributed product
+ *
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:edit"})
* @return double
*/
public function getTotalStandardPrice()
@@ -272,4 +281,14 @@ public function getTotalStandardPrice()
return $price;
}
+
+ /**
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:edit"})
+ * @return int|null
+ */
+ public function getValueProductId()
+ {
+ return $this->valueProduct ? $this->valueProduct->getId() : null;
+ }
}
diff --git a/src/AppBundle/Entity/ProductOrderRelation.php b/src/AppBundle/Entity/ProductOrderRelation.php
index f5020ca..7220c0b 100644
--- a/src/AppBundle/Entity/ProductOrderRelation.php
+++ b/src/AppBundle/Entity/ProductOrderRelation.php
@@ -48,7 +48,7 @@ public function __construct(Product $product, AOrder $order) {
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:edit", "product:checklist"})
*/
private $id;
@@ -65,6 +65,7 @@ public function __construct(Product $product, AOrder $order) {
*
* @ORM\ManyToOne(targetEntity="AOrder", inversedBy="productRelations", fetch="EAGER")
* @ORM\JoinColumn(name="order_id", referencedColumnName="id", nullable=false)
+ * @Serialize\Groups({"product:edit"})
*/
private $order;
@@ -72,6 +73,7 @@ public function __construct(Product $product, AOrder $order) {
* @var int Actual quantity of this product in this order
*
* @ORM\Column(type="integer", nullable=true)
+ * @Serialize\Groups({"product:edit"})
*/
private $quantity;
@@ -215,6 +217,10 @@ public function removeService(AService $service)
$this->services->removeElement($service);
}
+ /**
+ * @Serialize\VirtualProperty()
+ * @Serialize\Groups({"product:checklist"})
+ */
public function getServices()
{
return $this->services;
@@ -222,7 +228,7 @@ public function getServices()
/**
* @Serialize\VirtualProperty()
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:checklist"})
*/
public function getServicesDone() {
$servicesDone = $this->services->filter(function (AService $service) {
diff --git a/src/AppBundle/Entity/ProductType.php b/src/AppBundle/Entity/ProductType.php
index 45e396f..e06103d 100644
--- a/src/AppBundle/Entity/ProductType.php
+++ b/src/AppBundle/Entity/ProductType.php
@@ -48,7 +48,7 @@ public function __construct() {
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"api:purchaseorders"})
+ * @Serialize\Groups({"api:purchaseorders", "product:meta", "product:edit"})
*/
private $id;
@@ -64,7 +64,7 @@ public function __construct() {
* @var string
*
* @ORM\Column(name="name", type="string", length=255, unique=true)
- * @Serialize\Groups({"api:purchaseorders", "vue:products"})
+ * @Serialize\Groups({"api:purchaseorders", "product:index", "product:meta"})
*/
private $name;
@@ -105,7 +105,7 @@ public function __construct() {
*
* @ORM\ManyToMany(targetEntity="Task", inversedBy="productTypes")
* @ORM\JoinTable(name="product_type_task")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $tasks;
diff --git a/src/AppBundle/Entity/PurchaseOrder.php b/src/AppBundle/Entity/PurchaseOrder.php
index 3522355..db92014 100644
--- a/src/AppBundle/Entity/PurchaseOrder.php
+++ b/src/AppBundle/Entity/PurchaseOrder.php
@@ -41,6 +41,7 @@ class PurchaseOrder extends AOrder
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Supplier")
* @ORM\JoinColumn(name="supplier_id", referencedColumnName="id")
* @Serialize\MaxDepth(depth=1)
+ * @Serialize\Groups({"product:edit"})
*/
private $supplier;
diff --git a/src/AppBundle/Entity/SalesOrder.php b/src/AppBundle/Entity/SalesOrder.php
index 013308f..723c572 100644
--- a/src/AppBundle/Entity/SalesOrder.php
+++ b/src/AppBundle/Entity/SalesOrder.php
@@ -23,6 +23,7 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
+use JMS\Serializer\Annotation as Serialize;
use AppBundle\Entity\Customer;
/**
@@ -69,6 +70,7 @@ class SalesOrder extends AOrder
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Customer")
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
+ * @Serialize\Groups({"product:edit"})
*/
private $customer;
diff --git a/src/AppBundle/Entity/Stock.php b/src/AppBundle/Entity/Stock.php
index c8750e6..30a3e6a 100644
--- a/src/AppBundle/Entity/Stock.php
+++ b/src/AppBundle/Entity/Stock.php
@@ -48,35 +48,35 @@ private function __construct() {}
/**
* @var int
* @ORM\Column(type="integer")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $purchased;
/**
* @var int
* @ORM\Column(type="integer")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $stock;
/**
* @var int
* @ORM\Column(type="integer")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $saleable;
/**
* @var int
* @ORM\Column(type="integer")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $hold;
/**
* @var int
* @ORM\Column(type="integer")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $sold;
diff --git a/src/AppBundle/Entity/Task.php b/src/AppBundle/Entity/Task.php
index 165c598..87a3573 100644
--- a/src/AppBundle/Entity/Task.php
+++ b/src/AppBundle/Entity/Task.php
@@ -44,7 +44,7 @@ public function __construct() {
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
- * @Serialize\Groups({"vue:products"})
+ * @Serialize\Groups({"product:index"})
*/
private $id;
@@ -59,6 +59,7 @@ public function __construct() {
* @var string
*
* @ORM\Column(type="string", length=255)
+ * @Serialize\Groups({"product:index"})
*/
private $name;
diff --git a/src/AppBundle/Form/ChecklistForm.php b/src/AppBundle/Form/ChecklistForm.php
deleted file mode 100644
index 2dcba90..0000000
--- a/src/AppBundle/Form/ChecklistForm.php
+++ /dev/null
@@ -1,60 +0,0 @@
-add('services', CollectionType::class, [
- 'entry_type' => ChecklistServiceForm::class,
- 'entry_options' => ['label' => false],
- 'label' => false,
- ])
- ->add('save', SubmitType::class, [
- 'attr' => ['class' => 'btn-success btn-120']
- ]);
- }
-
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => ProductOrderRelation::class,
- 'csrf_protection' => true,
- 'csrf_field_name' => '_token',
- 'csrf_token_id' => 'ProductOrderRelation',
- ));
- }
-}
diff --git a/src/AppBundle/Form/ChecklistServiceForm.php b/src/AppBundle/Form/ChecklistServiceForm.php
deleted file mode 100644
index f66d8e8..0000000
--- a/src/AppBundle/Form/ChecklistServiceForm.php
+++ /dev/null
@@ -1,82 +0,0 @@
-addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
-
- $form = $event->getForm();
-
- /** @var AService */
- $service = $event->getData();
-
- $form
- ->add('status', ChoiceType::class, [
- 'attr' => ['class' => 'service-status'],
- 'choices' => [
- 'Todo' => AService::STATUS_TODO,
- 'Hold' => AService::STATUS_HOLD,
- 'Busy' => AService::STATUS_BUSY,
- 'Cancel' => AService::STATUS_CANCEL,
- 'Done' => AService::STATUS_DONE
- ]])
- ->add('done', CheckboxType::class, [
- 'mapped' => false,
- 'required' => false,
- 'data' => $service->getStatus() == AService::STATUS_DONE,
- 'attr' => ['class' => 'service-done']])
- ->add('description', TextareaType::class, ['required' => false]);
- });
- }
-
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => AService::class,
- ));
- }
-}
diff --git a/src/AppBundle/Form/IndexBulkEditForm.php b/src/AppBundle/Form/IndexBulkEditForm.php
index c9ff939..e20c9bc 100644
--- a/src/AppBundle/Form/IndexBulkEditForm.php
+++ b/src/AppBundle/Form/IndexBulkEditForm.php
@@ -29,30 +29,21 @@
use AppBundle\Entity\AOrder;
use Symfony\Component\OptionsResolver\OptionsResolver;
+/**
+ * For order bulk edit only
+ * Product bulk edit form is handled by Vue these days
+ */
class IndexBulkEditForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$index = $builder->getData();
- if ($options['index_class'] == Product::class)
- {
- $choices = [
- 'With selected lines...' => '',
- 'Edit status' => 'status',
- 'Print barcodes' => 'barcodes',
- 'Print price cards' => 'pricecards',
- 'Print checklists' => 'checklists'
- ];
- }
- else // Order
- {
- $choices = [
- 'With selected lines...' => '',
- 'Edit status' => 'status',
- 'Print orders' => 'orders'
- ];
- }
+ $choices = [
+ 'With selected lines...' => '',
+ 'Edit status' => 'status',
+ 'Print orders' => 'orders'
+ ];
$builder
->setMethod('GET')
diff --git a/src/AppBundle/Form/IndexSearchForm.php b/src/AppBundle/Form/IndexSearchForm.php
index d0c2f9c..2354b42 100644
--- a/src/AppBundle/Form/IndexSearchForm.php
+++ b/src/AppBundle/Form/IndexSearchForm.php
@@ -32,6 +32,10 @@
use Doctrine\ORM\EntityRepository;
use AppBundle\Helper\IndexSearchContainer;
+/**
+ * For order index search only
+ * Product index search form is handled by Vue these days
+ */
class IndexSearchForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -59,46 +63,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'Leveranciers' => 'supplier'
]]);
}
- elseif ($container->className == \AppBundle\Entity\Product::class)
- {
- $builder
- ->add('status', EntityType::class, [
- 'class' => 'AppBundle:ProductStatus',
- 'choice_label' => 'name',
- 'placeholder' => 'All statuses',
- 'required' => false,
- 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('x')->orderBy("x.name", "ASC"); }
- ])
- ->add('producttype', EntityType::class, [
- 'class' => 'AppBundle:ProductType',
- 'choice_label' => 'name',
- 'placeholder' => 'All types',
- 'required' => false,
- 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('x')->orderBy("x.name", "ASC"); }
- ])
- ->add('location', EntityType::class, [
- 'class' => 'AppBundle:Location',
- 'choice_label' => 'name',
- 'placeholder' => 'All locations',
- 'required' => false,
- 'query_builder' => function (EntityRepository $er) use ($container) {
- $qb = $er->createQueryBuilder('x')->orderBy("x.name", "ASC");
- /** @var IndexSearchContainer $container */
- if ($container->user->hasRole("ROLE_LOCAL") || $container->user->hasRole("ROLE_LOGISTICS"))
- $qb = $qb->where('x.id IN (:locationIds)')->setParameter('locationIds', $container->user->getLocationIds());
- return $qb;
- }
- ])
- ->add('availability', ChoiceType::class, array(
- 'placeholder' => 'All availability',
- 'required' => false,
- 'choices' => [
- 'In stock' => 'stock',
- 'On hold' => 'hold',
- 'For sale' => 'saleable',
- 'Sold' => 'sold'
- ]));
- }
else
{
$builder->add('partner', EntityType::class, [
diff --git a/src/AppBundle/Form/ProductAttributeRelationForm.php b/src/AppBundle/Form/ProductAttributeRelationForm.php
deleted file mode 100644
index f319fb5..0000000
--- a/src/AppBundle/Form/ProductAttributeRelationForm.php
+++ /dev/null
@@ -1,137 +0,0 @@
-addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
-
- $form = $event->getForm();
-
- /** @var ProductAttributeRelation */
- $relation = $event->getData();
-
- // loading proper attribute type
- if ($relation->getAttribute())
- {
- switch ($relation->getAttribute()->getType())
- {
- case Attribute::TYPE_FILE:
- $form->add('valueFiles', FileType::class, ['mapped' => false, 'required' => false, 'label' => 'Attachment'])
- ->add('value', HiddenType::class, ['mapped' => false, 'required' => false]);
- break;
- case Attribute::TYPE_PRODUCT:
- $form->add('valueProduct', EntityType::class, [
- 'query_builder' => function (\Doctrine\ORM\EntityRepository $er) use ($relation)
- {
- /** @var ProductAttributeRelation $relation */
- if ($pt = $relation->getAttribute()->getProductTypeFilter())
- {
- $qb = $er->createQueryBuilder('p')
- ->where("p.type = :pt2")
- ->setParameter("pt2", $pt);
- }
- else
- {
- $qb = $er->createQueryBuilder('p')
- ->join("p.type", "t")
- ->where('t.isAttribute = true');
- }
-
- $qb = $qb->andWhere("p.type <> :pt" )
- ->setParameter("pt", $relation->getProduct()->getType())
- ->orderBy('p.sku', 'ASC');
-
- return $qb->orderBy("p.name", "ASC");
- },
- 'class' => 'AppBundle:Product',
- 'choice_label' => 'name',
- 'required' => false,
- 'label' => 'Part'
- ]);
-
- if ($relation->getAttribute()->getHasQuantity())
- $form->add('quantity', IntegerType::class);
-
- break;
- case Attribute::TYPE_SELECT:
- $form->add('value', ChoiceType::class, [
- 'choices' => $this->getAttributeOptions($relation->getAttribute()),
- 'required' => false,
- 'label' => 'Select'
- ]);
- break;
- case Attribute::TYPE_TEXT:
- $form->add('value', TextType::class, [
- 'label' => 'Description',
- 'required' => false,
- ]);
- break;
- }
- }
- });
- }
-
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => ProductAttributeRelation::class
- ));
- }
-
- private function getAttributeOptions(Attribute $attribute)
- {
- $options = $attribute->getOptions();
- $arr = array();
-
- foreach ($options as $option)
- {
- /** @var AttributeOption $option */
- $arr[$option->getName()] = $option->getId();
- }
-
- return $arr;
- }
-}
diff --git a/src/AppBundle/Form/ProductBulkEditForm.php b/src/AppBundle/Form/ProductBulkEditForm.php
deleted file mode 100644
index 8bed717..0000000
--- a/src/AppBundle/Form/ProductBulkEditForm.php
+++ /dev/null
@@ -1,88 +0,0 @@
-getData();
-
- $builder
- ->add('products', EntityType::class, [
- 'class' => Product::class,
- 'choice_label' => function(Product $p) {
- return $p->getSku() . ' - ' . $p->getName();
- },
- 'choices' => $products,
- 'data' => $products,
- 'multiple' => true,
- 'expanded' => false,
- 'attr' => ['class' => 'multiselect'],
- 'required' => true])
- ->add('status', EntityType::class, [
- 'class' => 'AppBundle:ProductStatus',
- 'choice_label' => 'name',
- 'required' => false,
- 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('x')->orderBy("x.name", "ASC"); }
- ])
- ->add('location', EntityType::class, [
- 'class' => 'AppBundle:Location',
- 'choice_label' => 'name',
- 'required' => false,
- 'query_builder' => function (EntityRepository $er) use ($user) {
- $qb = $er->createQueryBuilder('x')->orderBy("x.name", "ASC");
- /** @var \AppBundle\Entity\User $user */
- if ($user->hasRole("ROLE_LOCAL") || $user->hasRole("ROLE_LOGISTICS"))
- $qb = $qb->where('x.id IN (:locationIds)')->setParameter('locationIds', $user->getLocationIds());
- return $qb;
- }
- ])
- ->add('save', SubmitType::class, [
- 'attr' => ['class' => 'btn-success btn-120']
- ]);
- }
-
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'csrf_protection' => true,
- 'csrf_field_name' => '_token',
- 'csrf_token_id' => 'productsbulkedit',
- ));
-
- $resolver->setRequired(array('user'));
- }
-}
diff --git a/src/AppBundle/Form/ProductForm.php b/src/AppBundle/Form/ProductForm.php
deleted file mode 100644
index 9122d38..0000000
--- a/src/AppBundle/Form/ProductForm.php
+++ /dev/null
@@ -1,105 +0,0 @@
-add('sku', TextType::class, [
- 'required' => false,
- 'attr'=> ['placeholder' => 'Keep empty for autogeneration', 'class' => 'focus']
- ])
- ->add('name', TextType::class)
- ->add('price', MoneyType::class, [
- 'required' => false,
- 'label' => 'Retail price'
- ])
- ->add('description', TextType::class, [
- 'required' => false
- ])
- ->add('type', EntityType::class, [
- 'class' => 'AppBundle:ProductType',
- 'choice_label' => 'name',
- 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('x')->orderBy("x.name", "ASC"); }
- ])
- ->add('status', EntityType::class, [
- 'class' => 'AppBundle:ProductStatus',
- 'choice_label' => 'name',
- 'required' => false,
- 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('x')->orderBy("x.name", "ASC"); }
- ])
- ->add('attributeRelations', CollectionType::class, [
- 'entry_type' => ProductAttributeRelationForm::class,
- 'entry_options' => ['label' => false],
- 'label' => 'Attributes',
- ])
- ->add('location', EntityType::class, [
- 'class' => 'AppBundle:Location',
- 'choice_label' => 'name',
- 'required' => true,
- 'placeholder' => '',
- 'query_builder' => function (EntityRepository $er) use ($user) {
- $qb = $er->createQueryBuilder('x')->orderBy("x.name", "ASC");
- /** @var \AppBundle\Entity\User $user */
- if ($user->hasRole("ROLE_LOCAL") || $user->hasRole("ROLE_LOGISTICS"))
- $qb = $qb->where('x.id IN (:locationIds)')->setParameter('locationIds', $user->getLocationIds());
- return $qb;
- }
- ])
- ->add('save', SubmitType::class, [
- 'attr' => ['class' => 'btn-success btn-120']
- ]);
- }
-
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => Product::class,
- 'csrf_protection' => true,
- 'csrf_field_name' => '_token',
- 'csrf_token_id' => 'customer',
- ));
-
- $resolver->setRequired(array('user'));
- }
-}
diff --git a/src/AppBundle/Form/ProductSplitForm.php b/src/AppBundle/Form/ProductSplitForm.php
deleted file mode 100644
index 44d22e9..0000000
--- a/src/AppBundle/Form/ProductSplitForm.php
+++ /dev/null
@@ -1,95 +0,0 @@
- 2) {
- $choices = [
- 'Split part of stock to new bundle' => 'split_stockpart',
- 'Individualize part of stock' => 'individualize_stockpart',
- 'Individualize whole stock' => 'individualize_stock',
- 'Individualize whole bundle' => 'individualize_bundle'
- ];
- }
- elseif ($options['stock'] == 2) {
- $choices = [
- 'Individualize stock' => 'individualize_stock',
- 'Individualize whole bundle' => 'individualize_bundle'
- ];
- }
- else {
- $choices = ['Individualize whole bundle' => 'individualize_bundle'];
- }
-
- $builder->add('how', ChoiceType::class, array(
- 'choices' => $choices));
-
- if ($options['stock'] > 2) {
- $builder->add('quantity', IntegerType::class, [
- 'attr' => ['min' => 1, 'max' => $options['stock'] - 1]
- ]);
- }
-
- $builder
- ->add('status', EntityType::class, [
- 'class' => 'AppBundle:ProductStatus',
- 'choice_label' => 'name',
- 'required' => true,
- 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('x')->orderBy("x.name", "ASC"); }
- ])
- ->add('newSku', CheckboxType::class, [
- 'required' => false,
- 'label' => 'Create new SKU(s)'
- ])
- ->add('split', SubmitType::class, [
- 'attr' => ['class' => 'btn-success btn-120']
- ]);
- }
-
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'csrf_protection' => true,
- 'csrf_field_name' => '_token',
- 'csrf_token_id' => 'splitproduct',
- ));
-
- $resolver->setRequired(array('stock'));
- }
-}
diff --git a/src/AppBundle/Repository/LocationRepository.php b/src/AppBundle/Repository/LocationRepository.php
index e95feb0..14a1359 100644
--- a/src/AppBundle/Repository/LocationRepository.php
+++ b/src/AppBundle/Repository/LocationRepository.php
@@ -23,9 +23,19 @@
namespace AppBundle\Repository;
use AppBundle\Entity\Location;
+use AppBundle\Entity\User;
class LocationRepository extends \Doctrine\ORM\EntityRepository
{
+ public function findMine(User $user)
+ {
+ if ($user->hasRole("ROLE_LOCAL") || $user->hasRole("ROLE_LOGISTICS"))
+ return $this->findBy(array("id" => $user->getLocationIds()), array('name' => 'ASC'));
+ else
+ return $this->findBy(array(), array('id' => 'ASC'));
+ }
+
+
/** @return Location|null */
public function findOneByZipcode($zipcode)
{
diff --git a/src/AppBundle/Repository/ProductRepository.php b/src/AppBundle/Repository/ProductRepository.php
index 46f7ad8..a7fb018 100644
--- a/src/AppBundle/Repository/ProductRepository.php
+++ b/src/AppBundle/Repository/ProductRepository.php
@@ -23,6 +23,7 @@
namespace AppBundle\Repository;
use AppBundle\Entity\AOrder;
+use AppBundle\Entity\Attribute;
use AppBundle\Entity\Product;
use AppBundle\Entity\ProductStatus;
use AppBundle\Entity\User;
@@ -60,61 +61,63 @@ public function findMine(User $user)
* This function searches in fields: Id, Sku, Name
*/
/** @return \Doctrine\ORM\QueryBuilder */
- public function querySearch(\AppBundle\Helper\IndexSearchContainer $search, $offset = 0, $limit = null)
+ public function querySearch(\AppBundle\Helper\IndexSearchContainer $search, $offset = 0, $limit = null, $sort = "p_id")
{
$qb = $this->_em->createQueryBuilder()
->select('p')
- ->from(Product::class, 'o')
- ->join(Stock::class, 's', "WITH", "p.id=s.id")
- ->orderBy("p.id", "DESC")
+ ->from(Product::class, 'p')
+ ->join("p.stock", 's')
+ ->orderBy(str_replace('_', '.', $sort), $sort == "p_id" ? "DESC" : "ASC")
->setFirstResult($offset);
if ($limit)
$qb = $qb->setMaxResults($limit);
if ($search->user->hasRole("ROLE_LOCAL") || $search->user->hasRole("ROLE_LOGISTICS"))
- $qb = $qb->andWhere('IDENTITY(o.location) IN (:locationIds)')->setParameter('locationIds', $search->user->getLocationIds());
+ $qb = $qb->andWhere('IDENTITY(p.location) IN (:locationIds)')->setParameter('locationIds', $search->user->getLocationIds());
if ($search->query)
{
if (is_numeric($search->query))
{
- $qb = $qb->andWhere("o.id = :query OR o.sku = :query")->setParameter("query", $search->query);
+ $qb = $qb->andWhere("p.id = :query OR p.sku = :query")->setParameter("query", $search->query);
}
else
{
- $qb = $qb->andWhere("o.name LIKE :queryLike OR o.sku = :query")->setParameter("query", $search->query)->setParameter("queryLike", '%'.$search->query.'%');
+ $qb = $qb->andWhere("p.name LIKE :queryLike OR p.sku = :query")->setParameter("query", $search->query)->setParameter("queryLike", '%'.$search->query.'%');
}
}
if ($search->location)
- $qb = $qb->andWhere("o.location = :location")->setParameter("location", $search->location);
+ $qb = $qb->andWhere("p.location = :location")->setParameter("location", $search->location);
elseif ($search->user->hasRole("ROLE_LOCAL") || $search->user->hasRole("ROLE_LOGISTICS"))
- $qb = $qb->andWhere('IDENTITY(o.location) IN (:locationIds)')->setParameter('locationIds', $search->user->getLocationIds());
+ $qb = $qb->andWhere('IDENTITY(p.location) IN (:locationIds)')->setParameter('locationIds', $search->user->getLocationIds());
if ($search->status)
- $qb = $qb->andWhere("o.status = :status")->setParameter("status", $search->status);
+ $qb = $qb->andWhere("p.status = :status")->setParameter("status", $search->status);
if ($search->producttype)
- $qb = $qb->andWhere("o.type = :producttype")->setParameter("producttype", $search->producttype);
+ $qb = $qb->andWhere("p.type = :producttype")->setParameter("producttype", $search->producttype);
if ($search->availability)
- $qb = $qb->andWhere("o.".$search->availability." > 0");
+ $qb = $qb->andWhere("s.".$search->availability." > 0");
+
+ $sql = $qb->getQuery()->getSQL();
return $qb;
}
/** @return \Doctrine\ORM\QueryBuilder */
- public function queryStock(User $user, $offset = 0, $limit = null, $sort = "p.id", $order = "DESC")
+ public function queryStock(User $user, $offset = 0, $limit = null, $sort = "p_id")
{
$qb = $this->_em->createQueryBuilder()
->select('p')
->from(Product::class, 'p')
- ->join(Stock::class, 's', "WITH", "p.id=s.id")
- //->leftJoin(Location::class, 'l')
- //->leftJoin(ProductType::class, "t")
+ ->join("p.stock", 's')
+ ->leftJoin("p.location", 'l')
+ ->leftJoin("p.type", "t")
->where("s.stock>0")
- ->orderBy($sort, $order)
+ ->orderBy(str_replace('_', '.', $sort), $sort == "p_id" ? "DESC" : "ASC")
->setFirstResult($offset);
if ($limit)
@@ -197,6 +200,7 @@ public function findByBarcodeSearchQuery(\AppBundle\Helper\IndexSearchContainer
}
public function findLastUpdated(User $user) {
+
$qb = $this->getEntityManager()->createQueryBuilder()
->from("AppBundle:Product", "o")
->select("o")
@@ -209,6 +213,28 @@ public function findLastUpdated(User $user) {
return $qb->getQuery()->getResult();
}
+ public function findAttributableProducts(Product $product, Attribute $attribute) {
+
+ if ($pt = $attribute->getProductTypeFilter())
+ {
+ $qb = $this->createQueryBuilder('p')
+ ->where("p.type = :pt2")
+ ->setParameter("pt2", $pt);
+ }
+ else
+ {
+ $qb = $this->createQueryBuilder('p')
+ ->join("p.type", "t")
+ ->where('t.isAttribute = true');
+ }
+
+ $qb = $qb->andWhere("p.type <> :pt" )
+ ->setParameter("pt", $product->getType())
+ ->orderBy('p.name', 'ASC');
+
+ return $qb->getQuery()->getResult();
+ }
+
public function generateProductAttributeRelations(Product $product)
{
if (!$product->getType())
diff --git a/src/AppBundle/Resources/views/Product/bulkedit.html.twig b/src/AppBundle/Resources/views/Product/bulkedit.html.twig
deleted file mode 100644
index 4038992..0000000
--- a/src/AppBundle/Resources/views/Product/bulkedit.html.twig
+++ /dev/null
@@ -1,16 +0,0 @@
-{% extends "::base.html.twig" %}
-
-{% block body %}
-
Product bulk edit
-
- {% if success %}
-
The products are saved successfully.
- {% elseif success is same as(false) %}
-
The products could not be saved. Please check details below.
- {% endif %}
-
- {{ form_start(form) }}
- {{ form_widget(form) }}
- {{ form_end(form) }}
-
-{% endblock %}
\ No newline at end of file
diff --git a/src/AppBundle/Resources/views/Product/checklist.ajax.twig b/src/AppBundle/Resources/views/Product/checklist.ajax.twig
deleted file mode 100644
index 5323d8f..0000000
--- a/src/AppBundle/Resources/views/Product/checklist.ajax.twig
+++ /dev/null
@@ -1,59 +0,0 @@
-
-{{ form_start(form, {'action': formAction, 'attr': {'class': 'ajax-form', 'target': '#modalSplitter .modal-content' }}) }}
-
-
-
-
-
- {% if success %}
-
- {% elseif success is same as(false) %}
-
The checklist could not be saved due to an unknown error.
- {% endif %}
-
- {% for formService in form.services %}
-
-
-
- {% endfor %}
-
-
- {{ form_widget(form.save) }}
-
Print
-
Close
-
-
-
-
-{{ form_end(form) }}
-
-
-
diff --git a/src/AppBundle/Resources/views/Product/edit.ajax.twig b/src/AppBundle/Resources/views/Product/edit.ajax.twig
deleted file mode 100644
index 37c3c88..0000000
--- a/src/AppBundle/Resources/views/Product/edit.ajax.twig
+++ /dev/null
@@ -1,241 +0,0 @@
-
-{{ form_start(form, {'action': formAction, 'attr': {'class': 'ajax-form', 'target': '#modalEditor .modal-content'}}) }}
-
-
-
-
-
- {% if success %}
-
The product is saved successfully.
- {% elseif success is same as(false) %}
-
The product could not be saved. Please check details below.
- {% endif %}
-
-
-
-
- {% if product.sku %}
-
- {% else %}
- {{ form_row(form.sku) }}
- {% endif %}
-
- {{ form_row(form.name) }}
- {{ form_row(form.description) }}
- {{ form_row(form.price) }}
-
-
-
- {{ form_row(form.type) }}
- {{ form_row(form.location) }}
- {{ form_row(form.status) }}
-
-
-
-
-
-
- {% trans %}Attributes{% endtrans %}
-
-
-
- {% for formRelation in form.attributeRelations %}
-
-
-
- {{ formRelation.vars.data.attribute.name }}
-
-
- {% if formRelation.vars.data.attribute.type == 2 %}{# Files #}
-
- {% for file in formRelation.vars.data.files %}
-
-
-
-
-
- {% if file.originalClientFilename|slice(-3)|lower == "jpg" or file.originalClientFilename|slice(-3)|lower == "png" or file.originalClientFilename|slice(-3)|lower == "gif" %}
-
- {% endif %}
-
-
-
- {% endfor %}
-
- {{ form_widget(formRelation.value, { 'attr': {'class': 'file-name'}}) }}
- {{ form_widget(formRelation.valueFiles, { 'attr': {'class': 'file-input'}}) }}
- {% elseif formRelation.vars.data.attribute.type == 3 %}{# Product #}
-
- {% else %}
- {{ form_widget(formRelation.value) }}
- {% endif %}
-
-
- € {{ formRelation.vars.data.totalStandardPrice|number_format(2, ',', '.') }}
-
-
-
- {% else %}
- No attributes available for products of this type. Please ask your manager to relate attributes to product types.
- {% endfor %}
-
-
-
-
-
-
- {% trans %}Orders{% endtrans %}
-
-
-
-
-
- Order nr
- Order date
- Supplier/Customer
- Status
- Quantity
-
-
-
-
- {% if product.purchaseOrderRelation %}
-
-
- {{ product.purchaseOrderRelation.order.orderNr }}
- {{ product.purchaseOrderRelation.order.orderDate|date("Y-m-d") }}
- From: {{ product.purchaseOrderRelation.order.supplier.name|default("") }}
- {{ product.purchaseOrderRelation.order.status.name|default("") }}
- {{ product.purchaseOrderRelation.quantity }}
-
-
- {% endif %}
- {% for salesOrderRelation in product.salesOrderRelations %}
-
-
- {{ salesOrderRelation.order.orderNr }}
- {{ salesOrderRelation.order.orderDate|date("Y-m-d") }}
- To: {{ salesOrderRelation.order.customer.name|default("") }}
- {{ salesOrderRelation.order.status.name|default("") }}
- {{ salesOrderRelation.quantity }}
-
-
- {% endfor %}
-
-
-
-
-
-
- {{ form_widget(form.save) }}
- {% if (product.id > 0) %}
-
Print
- {% if product.getStock().getSaleable() > 0 %}
-
Sell
- {% endif %}
- {% endif %}
-
Close
- {% if (refId) %}
-
Back
- {% endif %}
-
-
-
-
-{{ form_widget(form._token) }}
-{{ form_end(form, {'render_rest': false}) }}
-
-
-
-
diff --git a/src/AppBundle/Resources/views/Product/index.html.twig b/src/AppBundle/Resources/views/Product/index.html.twig
index a228ca6..809ff73 100644
--- a/src/AppBundle/Resources/views/Product/index.html.twig
+++ b/src/AppBundle/Resources/views/Product/index.html.twig
@@ -1,3 +1,5 @@
+{# Built with Vue! #}
+
{% extends 'base.html.twig' %}
{% block body %}
@@ -6,7 +8,6 @@
{% endblock %}
diff --git a/src/AppBundle/Resources/views/Product/split.ajax.twig b/src/AppBundle/Resources/views/Product/split.ajax.twig
deleted file mode 100644
index 0cb8e26..0000000
--- a/src/AppBundle/Resources/views/Product/split.ajax.twig
+++ /dev/null
@@ -1,39 +0,0 @@
-
-{{ form_start(form, {'action': formAction, 'attr': {'class': 'ajax-form', 'target': '#modalSplitter .modal-content' }}) }}
-
-
-
-
-
- {% if success %}
-
- {% elseif success is same as(false) %}
-
The product could not be split. Please check details below.
- {% endif %}
-
-
- Enter the desired values for the separated and new product bundle (or set of individual products).
-
-
- {{ form_widget(form) }}
-
-
-
-{{ form_end(form) }}
-
-
-
diff --git a/src/AppBundle/Resources/views/PurchaseOrder/edit.html.twig b/src/AppBundle/Resources/views/PurchaseOrder/edit.html.twig
index 010b02a..3d4dc80 100644
--- a/src/AppBundle/Resources/views/PurchaseOrder/edit.html.twig
+++ b/src/AppBundle/Resources/views/PurchaseOrder/edit.html.twig
@@ -188,7 +188,7 @@
{{ form_widget(formRelation.price) }}
{{ form_widget(formRelation.quantity) }}
-
+
{% else %}
@@ -265,10 +265,10 @@
$('select[name="purchase_order_form[newProduct]"]').change(function () {
if ($(this).val()) {
- $("#modalEditor .modal-content").load('{{ path('product_new', { 'purchaseOrderId': order.id }) }}/0/' + $(this).val(), function () {
+ $("#modalOrderEditor .modal-content").load('{{ path('product_new', { 'purchaseOrderId': order.id }) }}/0/' + $(this).val(), function () {
focusBarcodeInput();
});
- $("#modalEditor").modal('show');
+ $("#modalOrderEditor").modal('show');
}
});
diff --git a/src/AppBundle/Resources/views/SalesOrder/edit.html.twig b/src/AppBundle/Resources/views/SalesOrder/edit.html.twig
index 81e2a2d..ff1b2b3 100644
--- a/src/AppBundle/Resources/views/SalesOrder/edit.html.twig
+++ b/src/AppBundle/Resources/views/SalesOrder/edit.html.twig
@@ -183,7 +183,7 @@
{% if (order.repair) %}
-
+
{% endif %}
{% if ( order.id > 0) %}
@@ -296,10 +296,10 @@
$('select[name="sales_order_form[newProduct]"]').change(function () {
if ($(this).val()) {
- $("#modalEditor .modal-content").load('{{ path('product_new', { 'purchaseOrderId': order.backingPurchaseOrder.id, 'salesOrderId': order.id }) }}/' + $(this).val(), function () {
+ $("#modalOrderEditor .modal-content").load('{{ path('product_new', { 'purchaseOrderId': order.backingPurchaseOrder.id, 'salesOrderId': order.id }) }}/' + $(this).val(), function () {
focusBarcodeInput();
});
- $("#modalEditor").modal('show');
+ $("#modalOrderEditor").modal('show');
}
});
@@ -309,10 +309,10 @@
$('select[name="sales_order_form[newProduct]"]').change(function () {
if ($(this).val()) {
- $("#modalEditor .modal-content").load('{{ path('product_new', { 'purchaseOrderId': 0, 'salesOrderId': order.id }) }}/' + $(this).val(), function () {
+ $("#modalOrderEditor .modal-content").load('{{ path('product_new', { 'purchaseOrderId': 0, 'salesOrderId': order.id }) }}/' + $(this).val(), function () {
focusBarcodeInput();
});
- $("#modalEditor").modal('show');
+ $("#modalOrderEditor").modal('show');
}
});
diff --git a/src/AppBundle/Resources/vue/ProductStock/App.vue b/src/AppBundle/Resources/vue/ProductStock/App.vue
index 9fef199..d3e191b 100644
--- a/src/AppBundle/Resources/vue/ProductStock/App.vue
+++ b/src/AppBundle/Resources/vue/ProductStock/App.vue
@@ -1,91 +1,173 @@
+
+
+
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/Index.vue b/src/AppBundle/Resources/vue/ProductStock/components/Index.vue
new file mode 100644
index 0000000..6e3add3
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/Index.vue
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/Pagination.vue b/src/AppBundle/Resources/vue/ProductStock/components/Pagination.vue
new file mode 100644
index 0000000..c404e22
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/Pagination.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/SearchForm.vue b/src/AppBundle/Resources/vue/ProductStock/components/SearchForm.vue
new file mode 100644
index 0000000..3571a49
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/SearchForm.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalBulkEditStatus.vue b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalBulkEditStatus.vue
new file mode 100644
index 0000000..8c978e1
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalBulkEditStatus.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
Product bulk edit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalChecklist.vue b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalChecklist.vue
new file mode 100644
index 0000000..9fa8e32
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalChecklist.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalChecklistService.vue b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalChecklistService.vue
new file mode 100644
index 0000000..8e03bfe
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalChecklistService.vue
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalEdit.vue b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalEdit.vue
new file mode 100644
index 0000000..12176fc
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalEdit.vue
@@ -0,0 +1,347 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalSplit.vue b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalSplit.vue
new file mode 100644
index 0000000..6ca6ff8
--- /dev/null
+++ b/src/AppBundle/Resources/vue/ProductStock/components/modals/ModalSplit.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
diff --git a/web/js/ajax-form.js b/web/js/ajax-form.js
deleted file mode 100644
index 5539e53..0000000
--- a/web/js/ajax-form.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-Generic converter from normal form to ajax form
-Author: Jorrit Steetskamp
-
-*/
-
-$(document).on("submit", '.ajax-form', function (e) {
- e.preventDefault();
- var form = $(e.target);
- $.ajax({
- url: form.attr('action'),
- type: 'POST',
- data: $(this).serialize(),
- success: function (data) {
- var target = form.attr('target');
- $(target).html(data);
- },
- error: function (jqXHR, textStatus, errorThrown) {
- document.body.innerHTML = jqXHR.responseText;
- }
- });
-});
\ No newline at end of file
diff --git a/web/js/ajax-modal.js b/web/js/ajax-modal.js
deleted file mode 100644
index 17c462e..0000000
--- a/web/js/ajax-modal.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-
-Generic converter from normal anchor to modal opener
-Author: Jorrit Steetskamp
-
-*/
-
-$(document).on("click", '.btn-modal', function (e) {
- e.preventDefault();
- var a = $(e.currentTarget);
- var target = a.data('target');
- $(target + " .modal-content").load(a.attr('href'), function () {
- $(target).modal('show');
- });
-
-});
\ No newline at end of file
diff --git a/web/js/scripts.js b/web/js/scripts.js
index 76bed2e..d14872f 100644
--- a/web/js/scripts.js
+++ b/web/js/scripts.js
@@ -15,18 +15,6 @@ $(document).ready(function () {
buttonClass: 'btn'
});
- $('#index_bulk_edit_form_action').change(function (e) {
-
- var form = $('form[name="index_bulk_edit_form"]');
-
- if ($(this).val() != "status")
- form.attr('target', '_blank')
- else
- form.attr('target', '')
-
- form.submit();
- });
-
$('.btn-selectall').click(function (e) {
$('input[name^="index_bulk_edit_form[index]"]').each(function() {
$(this).prop('checked', true);