<?php

namespace WpBookingProAdmin\app\views\sms;

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

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