import * as React from "react";
import { FormView as CoreFormView } from "../../Controls/FormView";
import { RecordField } from "src/Models";

export class FormView extends React.Component<any, any> {
    // private fieldsControl: FieldsControl;
    constructor(props: any) {
        super(props);
    }

    private _setColWidth(id: any): string {
        switch (id) {
            case 155: {
                return " ms-Grid-col ms-sm12 ms-lg6";
            }
            case 156: {
                return " ms-Grid-col ms-sm12 ms-lg6";
            }
            //   case 157: {
            //     return "ms-Grid-col ms-sm12 ms-lg6";
            //   }
            case 159: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 163: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 164: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 165: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 175: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 176: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 189: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 191: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 227: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }
            case 228: {
                return "ms-Grid-col ms-sm12 ms-lg6";
            }


            default: {
                return "ms-Grid-col ms-sm12 ms-lg12";
            }
        }
    }

    public render(): JSX.Element {

        if (this.props.Record.fields) {
            debugger;
            this.props.Record.fields.forEach((field: RecordField) => {

                if (field.id == 0)
                    field.hidden = true;

            });

        }

        return (
            <div>
                <i className="fal fa-tasks" style={{ float: 'right', fontSize: 40, padding: '5px 20px 0 0', opacity: .4 }}></i>

                <CoreFormView setColWidth={this._setColWidth.bind(this)}  {...this.props}></CoreFormView>
            </div>
        );
    }
}