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

        /**
         * @param null $tpl
         * @return false|string
         * @throws Exception
         */
        public function display($tpl = null)
        {
            $input = Factory::getInput();
            switch ($tpl) {
                case "config_list":
                    $modelBlock = WoobookingModel::getInstance('block');
                    $this->form = $modelBlock->getFormConfigBlock('service', $tpl);
                    break;
                case "form":
                    $id = $input->getInt('id', 0);
                    $modelEvent = WoobookingModel::getInstance('event');
                    $this->item = $modelEvent->getItem($id);
                    $this->form = $modelEvent->getForm();
                    break;
                case "config_training":
                    break;
                case "list":
                default:
                    $input = Factory::getInput();
                    $modeCarts = WoobookingModel::getInstance('carts');
                    $this->list = $modeCarts->getList();
                    break;
            }
            return parent::display($tpl);
        }
    }
}