<?php

namespace WpBookingEventAdmin\app\views\orderstatus;

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

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