<?php
namespace WpBookingEventAdmin\app\controllers;
use WpBookingEvent\Factory;
use WpBookingEvent\Utilities\Utility as UtilityAlias;
use WpBookingEvent\Mvc\Controller\ControllerForm as ControllerFormAlias;
use WpBookingEvent\Mvc\Model\Model;

defined('_WPBOOKINGEVENT_EXEC') or die;
class PaymentController extends ControllerFormAlias
{
    public $view = "payment";

    public function delete($id = 0)
    {
        return parent::delete($id); // TODO: Change the autogenerated stub
    }
    public function ajax_create_payment_by_payment_name()
    {
        
        $paymentModel = Model::getInstance('payment');
        $input = Factory::getInput();
        $data = $input->getData();
        $payment_name = isset($data['payment'])?$data['payment']:'';
        if(trim($payment_name) != '') {
            $payment = $paymentModel->create_payment_by_payment_name($payment_name);
            $this->redirect(UtilityAlias::getBackendGoToLink($this->view.".form",array("id"=>$payment->id)));
            return $payment;
        }
    }
}
