<?php

namespace App\View\Components;

use Illuminate\View\Component;

class CurrencyForm extends Component
{
    private  const URL_CREATE_CURRENCY = '/admin/create-currency';
    private  const URL_UPDATE_CURRENCY = '/admin/update-currency';
    private  const NAME_FORM = "Currency";
    public $especiality;
    public $action = self::URL_CREATE_CURRENCY;
    public $name = self::NAME_FORM;
    public $new;
    public $redirectToCreatePayment;
    /**
     * Create a new component instance.
     *
     * @return void
     */
    public function __construct($isUpdate = false,$redirectToCreatePayment = false)
    {
        $this->new = (!$isUpdate);
        $this->redirectToCreatePayment = $redirectToCreatePayment;
        if($isUpdate)
            $this->action =  self::URL_UPDATE_CURRENCY;
    }


    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\Contracts\View\View|\Closure|string
     */
    public function render()
    {
        return view('components.currency-form',[
            "name"=>$this->name,
            "action"=>$this->action,
            "id"=>$this->name,
            "new"=>$this->new,
            "redirectToCreatePayment"=>$this->redirectToCreatePayment
        ]);
    }
}
