<?php

namespace WpBookingHotelAdminWooPanel\app\views\payment;

use WpBookingHotel\Html\ToolBar;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Mvc\View\View;
use WpBookingHotel\Factory as FactoryAlias;
use WpBookingHotelAdmin\app\helpers\CustomizeHelper;

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