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

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