<?php

namespace WpBookingHotelAdminWooPanel\app\views\orders;

use WpBookingHotel\Html\ToolBar;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Mvc\View\View;
use WpBookingHotel\Factory as FactoryAlias;

class OrdersView extends View
{
    public function display($tpl)
    {
        $modelTour = Model::getInstance("order");
        $input = FactoryAlias::getInput();
        switch ($tpl) {
            case "form":
                ToolBar::setTitle('Edit order');
                ToolBar::apply("order.apply");
                ToolBar::save("order.save");
                ToolBar::cancel("order.cancel");
                ToolBar::back_to_list("order.back_to_list");
                $model = Model::getInstance("order");
                $oder_id = $input->getInt('id');
                $this->item = $model->getItem($oder_id);
                $this->form = $model->getForm();
                break;
            case "list":
                ToolBar::delete("order.delete_list");
                $model = Model::getInstance("orders");
                $this->list = $model->getList();
                break;
        }
        return parent::display($tpl);
    }
}