<?php

namespace WpBookingHotelAdminWooPanel\app\views\sms;

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

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