<?php

namespace WpBookingEventAdmin\app\views\appointment;

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

class AppointmentView extends View
{
    public function display($tpl)
    {
        $modelAppointment = Model::getInstance("appointment");
        $input = FactoryAlias::getInput();
        switch ($tpl) {
            case "list":
                $model = Model::getInstance("appointments");
                $this->list = $model->getList();
                $modelOrderStatus = Model::getInstance('orderstatuss');
                $this->list_order_status = $modelOrderStatus->getList();
                break;
            case "form":
                ToolBar::setTitle('Appointment Detail');
                ToolBar::back_to_list("appointment.back_to_list");
                $id = $input->getInt('id', 0);
                $this->item = $modelAppointment->getItem($id);
                break;
        }
        return parent::display($tpl);
    }
}