<?php

namespace TourOperatorProAdmin\app\views\payment;

use TourOperatorPro\Html\ToolBar;
use TourOperatorPro\Mvc\Model\Model;
use TourOperatorPro\Mvc\View\View;
use TourOperatorPro\Factory as FactoryAlias;
use TourOperatorProAdmin\app\helpers\CustomizeHelper;

class PaymentView extends View
{
    public function display($tpl)
    {

        $input = FactoryAlias::getInput();
        $modelPayment = Model::getInstance("payment");
        $input = FactoryAlias::getInput();
        switch ($tpl) {
            case "list":
                ToolBar::setTitle('Edit payment');
                ToolBar::add('payment.add_payment');
                ToolBar::delete("payment.delete_list");
                ToolBar::_clone("payment.clone_list");
                $model = Model::getInstance("payments");
                $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);
    }
}