import React from "react";


import { Base } from './../';

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

import { Tag } from 'antd';

import LookupValuesAdd from './../../../lib/models/lookup-values/components/lookup-values-add/lookup-values-add';

class LookupValue extends Base {

    constructor() {
        super();

        this.fields = [
            {
                field: 'name',
                caption: 'Name',
            },
            {
                field: 'description',
                caption: 'Description',
            },
        ];

        // this.columns = ;
    }

    get getEndpoint() {
        return 'lookup_values';
    }

    get path() {
        return `lookup_values`;
    }

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

    get modelName() {
        return `lookup_value`;
    }

    disableAdd() {
        return false;
    }

    disableAddModal() {
        return false;
    }

    get columns() {
        return [
            {
                caption: 'Name',
                field: 'name',
                key: 'name',
            },
            {
                caption: 'Description',
                field: 'description',
                key: 'description',
            },

            {
                caption: 'Value',
                field: 'value',
                key: 'value',
            },
            {
                caption: 'Date',
                field: 'created_at',
                key: 'created_at',
            },
        ];
    }

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

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

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

    ModalAddComponent = (props) => <LookupValuesAdd model={this} {...props} />;
}

export default LookupValue;
