
import React from "react";

import Base from './../base';

import { Link } from 'react-router-dom';

import { Tag } from 'antd';

class FinancialYear extends Base {

    constructor() {
        super();

        this.fields = [

            {
                field: 'description',
                caption: 'Description',
            },

            {
                field: 'start_date',
                caption: 'Start Date',
                type: 'date'
            },

            {
                field: 'end_date',
                caption: 'End Date',
                type: 'date'
            },


            {
                field: 'active',
                caption: 'Active',
                type: 'boolean'
            },
        ];

        // this.columns = ;
    }

    get getEndpoint() {
        return 'financial-years';
    }

    get path() {
        return `financial-years`;
    }

    get getName() {
        return this.modelName + `s`;
    }

    get modelName() {
        return `financial-year`;
    }

    disableAddModal() {
        return false;
    }

    disableAdd() {
        return false;
    }


    get columns() {
        return [

            {
                field: 'description',
                caption: 'Description',
            },

            {
                field: 'start_date',
                caption: 'Start Date',
                type: 'date'
            },

            {
                field: 'end_date',
                caption: 'End Date',
                type: 'date'
            },


            {
                field: 'active',
                caption: 'Active',
                type: 'boolean'
            },
        ];
    }


    /**
     * Card Component for Staff
     *
     * @param {*} record
     * @returns
     */
    Card = (record) => {
        return (
            <Link className="booking-card" to={`/collections/${record['id']}`}>
                <div className="card">
                    <h2 className="">{record.caption}</h2>

                    <h3 className="title">{record.description}</h3>

                    <p className="address">
                        Collected on {record.created_at}
                        <Tag color="magenta">{record['Consultant Name']}</Tag>
                    </p>
                </div>
            </Link>
        );
    };

}

export default FinancialYear;


