import React from 'react';
import CustomFormSection from "../../../../components/UI/Forms/CustomFormSection/CustomFormSection";
import {LookupOption} from "../../../../models/Ked/Vevaiosi";
import {SelectField} from "./fields";

interface Props {
    // the signer's AFM (string, from GET /lookups); '' while nothing is selected
    value: number | string
    options: LookupOption[]
    error?: string
    disabled: boolean
    onChange: (v: string) => void
}

/**
 * Ε. Υπογράφων.
 * Note: the sections go Α, Β, Γ, Ε (no Δ). Check against Figma whether that is intentional.
 */
const SignatorySection = ({value, options, error, disabled, onChange}: Props) => (
    <CustomFormSection theme={"default"}>
        <h3 className="vf-section-title">Ε. Υπογράφων</h3>
        <div className="row">
            <div className="col-12 col-md-6">
                {/* asString: the AFM must not go through Number() */}
                <SelectField asString label="ΥΠΟΓΡΑΦΩΝ" required value={value} disabled={disabled}
                             options={options} error={error} onChange={onChange}/>
            </div>
        </div>
    </CustomFormSection>
);

export default SignatorySection;