<?php

namespace TourOperatorProAdminWooPanel\app\views\orders;

use TourOperatorPro\Html\ToolBar;
use TourOperatorPro\Mvc\Model\Model;
use TourOperatorPro\Mvc\View\View;
use TourOperatorPro\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);
    }
}