|
@@ -25,25 +25,25 @@ discard block |
|
|
block discarded – undo |
|
25
|
25
|
|
|
26
|
26
|
) {} |
|
27
|
27
|
|
|
28
|
|
- #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: ['GET'])] |
|
29
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
28
|
+ #[Route('/products/purchasing-suggestion', name: 'purchasing_suggestion', methods: [ 'GET' ]) ] |
|
|
29
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
30
|
30
|
public function getPurchasingSuggestion(Request $request): JsonResponse |
|
31
|
31
|
{ |
|
32
|
|
- $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
|
32
|
+ $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
33
|
33
|
$data = $this->productService->getPurchasingSuggestion($company); |
|
34
|
34
|
return new JsonResponse($data); |
|
35
|
35
|
} |
|
36
|
36
|
|
|
37
|
|
- #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: ['POST'])] |
|
38
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
37
|
+ #[Route('/products/purchasing-suggestion/print', name: 'purchasing_suggestion_print', methods: [ 'POST' ]) ] |
|
|
38
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
39
|
39
|
public function printPurchasingSuggestion(Request $request): JsonResponse |
|
40
|
40
|
{ |
|
41
|
41
|
try { |
|
42
|
42
|
$data = json_decode($request->getContent(), true); |
|
43
|
43
|
$device = $this->manager->getRepository(Device::class)->findOneBy([ |
|
44
|
|
- 'device' => $data['device'] |
|
|
44
|
+ 'device' => $data[ 'device' ] |
|
45
|
45
|
]); |
|
46
|
|
- $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
|
46
|
+ $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
47
|
47
|
$printData = $this->productService->purchasingSuggestionPrintData($company, $device); |
|
48
|
48
|
|
|
49
|
49
|
return new JsonResponse($this->hydratorService->item(Spool::class, $printData->getId(), "spool_item:read"), Response::HTTP_OK); |
|
@@ -52,26 +52,26 @@ discard block |
|
|
block discarded – undo |
|
52
|
52
|
} |
|
53
|
53
|
} |
|
54
|
54
|
|
|
55
|
|
- #[Route('/products/inventory', name: 'products_inventory', methods: ['GET'])] |
|
56
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
55
|
+ #[Route('/products/inventory', name: 'products_inventory', methods: [ 'GET' ]) ] |
|
|
56
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
57
|
57
|
public function getProductsInventory(Request $request): JsonResponse |
|
58
|
58
|
{ |
|
59
|
|
- $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
|
59
|
+ $company = $this->manager->getRepository(People::class)->find($request->get('company')); |
|
60
|
60
|
$data = $this->productService->getProductsInventory($company); |
|
61
|
61
|
return new JsonResponse($data); |
|
62
|
62
|
} |
|
63
|
63
|
|
|
64
|
|
- #[Route('/products/inventory/print', name: 'products_inventory_print', methods: ['POST'])] |
|
65
|
|
- #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")] |
|
|
64
|
+ #[Route('/products/inventory/print', name: 'products_inventory_print', methods: [ 'POST' ]) ] |
|
|
65
|
+ #[Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") ] |
|
66
|
66
|
public function print(Request $request): JsonResponse |
|
67
|
67
|
{ |
|
68
|
68
|
try { |
|
69
|
69
|
$data = json_decode($request->getContent(), true); |
|
70
|
70
|
$device = $this->manager->getRepository(Device::class)->findOneBy([ |
|
71
|
|
- 'device' => $data['device'] |
|
|
71
|
+ 'device' => $data[ 'device' ] |
|
72
|
72
|
]); |
|
73
|
73
|
|
|
74
|
|
- $company = $this->manager->getRepository(People::class)->find($data['people']); |
|
|
74
|
+ $company = $this->manager->getRepository(People::class)->find($data[ 'people' ]); |
|
75
|
75
|
$printData = $this->productService->productsInventoryPrintData($company, $device); |
|
76
|
76
|
return new JsonResponse($this->hydratorService->item(Spool::class, $printData->getId(), "spool_item:read"), Response::HTTP_OK); |
|
77
|
77
|
} catch (Exception $e) { |