|
@@ -19,44 +19,44 @@ |
|
|
block discarded – undo |
|
19
|
19
|
private ProductService $productService |
|
20
|
20
|
) {} |
|
21
|
21
|
|
|
22
|
|
- #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: ['GET'])] |
|
23
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
22
|
+ #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: [ 'GET' ]) ] |
|
|
23
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
24
|
24
|
public function getPurchasingSuggestion(Request $request): JsonResponse |
|
25
|
25
|
{ |
|
26
|
|
- $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
|
26
|
+ $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
27
|
27
|
$data = $this->productService->getPurchasingSuggestion($company); |
|
28
|
28
|
return new JsonResponse($data); |
|
29
|
29
|
} |
|
30
|
30
|
|
|
31
|
|
- #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: ['POST'])] |
|
32
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
31
|
+ #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: [ 'POST' ]) ] |
|
|
32
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
33
|
33
|
public function printPurchasingSuggestion(Request $request): JsonResponse |
|
34
|
34
|
{ |
|
35
|
35
|
$data = json_decode($request->getContent(), true); |
|
36
|
|
- $printType = $data['print-type']; |
|
37
|
|
- $deviceType = $data['device-type']; |
|
38
|
|
- $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
|
36
|
+ $printType = $data[ 'print-type' ]; |
|
|
37
|
+ $deviceType = $data[ 'device-type' ]; |
|
|
38
|
+ $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
39
|
39
|
$printData = $this->productService->purchasingSuggestionPrintData($company, $printType, $deviceType); |
|
40
|
40
|
return new JsonResponse($printData); |
|
41
|
41
|
} |
|
42
|
42
|
|
|
43
|
|
- #[Route('/products/inventory', name: 'products_inventory', methods: ['GET'])] |
|
44
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
43
|
+ #[Route('/products/inventory', name: 'products_inventory', methods: [ 'GET' ]) ] |
|
|
44
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
45
|
45
|
public function getProductsInventory(Request $request): JsonResponse |
|
46
|
46
|
{ |
|
47
|
|
- $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
|
47
|
+ $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
48
|
48
|
$data = $this->productService->getProductsInventory($company); |
|
49
|
49
|
return new JsonResponse($data); |
|
50
|
50
|
} |
|
51
|
51
|
|
|
52
|
|
- #[Route('/products/inventory/print', name: 'products_inventory_print', methods: ['POST'])] |
|
53
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
52
|
+ #[Route('/products/inventory/print', name: 'products_inventory_print', methods: [ 'POST' ]) ] |
|
|
53
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
54
|
54
|
public function print(Request $request): JsonResponse |
|
55
|
55
|
{ |
|
56
|
56
|
$data = json_decode($request->getContent(), true); |
|
57
|
|
- $printType = $data['print-type']; |
|
58
|
|
- $deviceType = $data['device-type']; |
|
59
|
|
- $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
|
57
|
+ $printType = $data[ 'print-type' ]; |
|
|
58
|
+ $deviceType = $data[ 'device-type' ]; |
|
|
59
|
+ $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
60
|
60
|
$printData = $this->productService->productsInventoryPrintData($company, $printType, $deviceType); |
|
61
|
61
|
return new JsonResponse($printData); |
|
62
|
62
|
} |