<?php

namespace WpBookingProAdminWooPanel\app\views\orderstatus;

use WpBookingPro\Html\ToolBar;
use WpBookingPro\Mvc\Model\Model;
use WpBookingPro\Mvc\View\View;
use WpBookingPro\Factory as FactoryAlias;
use WpBookingProAdminWooPanel\app\helpers\AdminHelper;

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();
                $this->permission = AdminHelper::setPermission();
                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);
    }
}