<?php
defined('_WPBOOKINGPRO_EXEC') or die;
if(!class_exists("WpBookingPro_ReportView")) {
    /**
     * Class WpBookingPro_ReportView
     */
    class WpBookingPro_ReportView extends WooBookingView
    {
        /**
         * @var
         */
        public $item;

        /**
         * @param null $tpl
         * @return false|string
         * @throws Exception
         */
        public function display($tpl = null)
        {
            $modelCategory = $this->getModel('category');
            $input = Factory::getInput();
            switch ($tpl) {
                case "item":
                    $id = 2;
                    $this->item = $modelCategory->getItem($id);
                    $this->form = $modelCategory->getForm();
                    break;
                case "form":
                    $id = $input->getInt('id', 0);
                    $this->item = $modelCategory->getItem($id);
                    $this->form = $modelCategory->getForm();
                    break;
                case "list":
                default:
                    $modelCategories = $this->getModel('categories');
                    $this->filterForm = $modelCategories->getFilterForm();
                    $this->list = $modelCategories->getList();
                    break;
            }
            return parent::display($tpl);
        }
    }
}