<?php

namespace TourOperatorProAdmin\app\views\orderdetail;

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

class OrderdetailView extends View
{
    public function display($tpl)
    {
        $modelOrderdetail = Model::getInstance("orderdetails");
        $input = FactoryAlias::getInput();
        switch ($tpl) {
            case "list":
                ToolBar::add("orderdetail.add");
                ToolBar::delete("orderdetail.delete_list");
                ToolBar::_clone("orderdetail.clone_list");
                $model = Model::getInstance("orderdetail");
                $this->list = $model->getList();
            case "form":
                ToolBar::setTitle('Edit OrderDetail');
                ToolBar::apply("orderdetail.apply");
                ToolBar::save("orderdetail.save");
                ToolBar::cancel("orderdetail.cancel");
                ToolBar::back_to_list("orderdetail.back_to_list");
                $id = $input->getInt('id', 0);
                $this->item = $modelOrderdetail->getItem($id);
                $this->form = $modelOrderdetail->getForm();
                break;
        }
        return parent::display($tpl);
    }
}