Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 58
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
BackstockController
0.00% covered (danger)
0.00%
0 / 58
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 pageBackStock
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
 pageEvents
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
 pageNotes
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
 pageReports
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace BuyerKiosk\Backstock\Controllers;
4
5
6use BuyerKiosk\Backstock\BackstockFactory;
7class BackstockController extends \BuyerKiosk\Core\Controllers\BaseController
8{
9
10    private $bsFactory;
11    private $store;
12
13    public function __construct($app, \Store $store)
14    {
15        parent::__construct($app);
16        $this->store = $store;
17        $this->bsFactory = new BackstockFactory($store);
18    }
19
20    public function pageBackStock()
21    {
22        $buyerArray = getBuyersArray($this->bsFactory->getStore());
23
24        $this->_app->render('backstock/home.html', [
25            'page' => [
26                'author' => $this->_app->site->author,
27                'title' => "Backstock Management",
28                'description' => "Manage your backstock inventory and bins",
29                'alerts' => $this->_app->alerts->getAndClearMessages(),
30                'active_page' => ""
31            ],
32            'groups' => $this->_app->user->getGroups(),
33            'binCount' => count($this->bsFactory->getAllBins()),
34            'bins' => $this->bsFactory->getAllBins(),
35            'store' => getStoreInfo($this->bsFactory->getStore()),
36            "buyers" => $buyerArray,
37            'debug' => true
38        ]);
39    }
40
41    /**
42     * Seasonal Events page
43     */
44    public function pageEvents()
45    {
46        $buyerArray = getBuyersArray($this->store);
47
48        $this->_app->render('backstock/events.html', [
49            'page' => [
50                'author' => $this->_app->site->author,
51                'title' => "Seasonal Events",
52                'description' => "Manage seasonal events and inventory preparation",
53                'alerts' => $this->_app->alerts->getAndClearMessages(),
54                'active_page' => "events"
55            ],
56            'groups' => $this->_app->user->getGroups(),
57            'store' => getStoreInfo($this->store),
58            'buyers' => $buyerArray
59        ]);
60    }
61
62    /**
63     * Team Notes page
64     */
65    public function pageNotes()
66    {
67        $buyerArray = getBuyersArray($this->store);
68
69        $this->_app->render('backstock/notes.html', [
70            'page' => [
71                'author' => $this->_app->site->author,
72                'title' => "Team Notes",
73                'description' => "Team communication and notes for backstock",
74                'alerts' => $this->_app->alerts->getAndClearMessages(),
75                'active_page' => "notes"
76            ],
77            'groups' => $this->_app->user->getGroups(),
78            'store' => getStoreInfo($this->store),
79            'buyers' => $buyerArray
80        ]);
81    }
82
83    /**
84     * Reports & Analytics page
85     */
86    public function pageReports()
87    {
88        $buyerArray = getBuyersArray($this->store);
89
90        $this->_app->render('backstock/reports.html', [
91            'page' => [
92                'author' => $this->_app->site->author,
93                'title' => "Backstock Reports & Analytics",
94                'description' => "View backstock reports and analytics",
95                'alerts' => $this->_app->alerts->getAndClearMessages(),
96                'active_page' => "reports"
97            ],
98            'groups' => $this->_app->user->getGroups(),
99            'store' => getStoreInfo($this->store),
100            'buyers' => $buyerArray
101        ]);
102    }
103}