
import React from "react";

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

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

import { Tag } from 'antd';

class Roles extends Base {
    constructor() {
        super();

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

        // this.columns = ;
    }

    get getEndpoint() {
        return 'roles';
    }

    get path() {
        return `roles`;
    }

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

    get modelName() {
        return `role`;
    }

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

    /**
     * Get the data from the table
     */
    // get = (queries) => {

    //     return this.getMethod(queries).then((result) => {

    //         return Promise.all(result.collections.map(this.loadStaff)).then((result) => {

    //             return { collections: result };

    //         })
    //     })
    // }


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

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

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

    // AddComponent = () => <CollectionAdd model={this} staff={Staffs} />;
}

export default Roles;
