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

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