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

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