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

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