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

        /**
         * @param null $tpl
         * @return false|string
         * @throws Exception
         */
        public function display($tpl = null)
        {
            $modelorder_package = $this->getModel('order_package');
            $input = Factory::getInput();
            switch ($tpl) {
                case "item":
                    break;
                case "form":
                    $id = $input->getInt('id');
                    $this->item = $modelorder_package->getItem(1);
                    $this->form = $modelorder_package->getForm();
                    break;
                case "order_detail":
                    $id = $input->getInt('id');
                    $modelOderDetail = WoobookingModel::getInstance('OrderDetail');
                    $this->item = $modelOderDetail->getItem($id);
                    $this->form = $modelOderDetail->getForm();
                    break;
                case "list":
                default:
                    $tpl = "list";
                    $modelOrderStatus = $this->getModel('orderStatus');
                    $this->list_order_status = $modelOrderStatus->getList();
                    $this->list = $modelorder_package->getList();
                    break;
            }
            return parent::display($tpl);
        }
    }
}