import React from 'react';
import { __ } from '@wordpress/i18n';
import { head } from 'ramda';

// store
import { useStoreValue } from '../../store';

// components
import AllDomandeBeneficiarioTableAsync from './components/AllDomandeBeneficiarioTableAsync';

const DomandeBeneficiario = () => {
    const chosenCompanyId = useStoreValue('chosenCompanyId');
    const companies = useStoreValue('companies');
    const company = head(companies.filter(o => o.id === chosenCompanyId));

    return(
        <div className="appPage">
            <div className="appPage__pageHeader">
                <h1>{__('Archivio domande', 'gepafin')}</h1>
                {company ? <span className="companyName">{company.companyName}</span> : null}
            </div>

            <div className="appPage__spacer"></div>

            <div className="appPageSection">
                <AllDomandeBeneficiarioTableAsync
                    statuses={['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION', 'SUBMIT',
                    'APPOINTMENT', 'NDG', 'ADMISSIBLE', 'AWAITING_TECHNICAL_EVALUATION', 'TECHNICAL_EVALUATION',
                        'AWAITING_CONTRACT', 'CONTRACT_SIGNED']}/>
            </div>
        </div>
    )
}

export default DomandeBeneficiario;