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

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