/** * Author: Thilina Hasantha */ import ReactCustomFieldAdapter from '../../../api/ReactCustomFieldAdapter'; /** * AssetTypeAdapter */ class CommonCustomFieldAdapter extends ReactCustomFieldAdapter { getDataMapping() { return [ 'id', 'name', 'type', 'field_type', 'field_label', 'display', 'display_order', ]; } getHeaders() { return [ { sTitle: 'ID', bVisible: false }, { sTitle: 'Name' }, { sTitle: 'Object Type' }, { sTitle: 'Field Type' }, { sTitle: 'Field Label' }, { sTitle: 'Display Status' }, { sTitle: 'Priority' }, ]; } getTableColumns() { return [ { title: 'Name', dataIndex: 'name', sorter: true, }, { title: 'Object Type', dataIndex: 'type', sorter: true, }, { title: 'Field Label', dataIndex: 'field_label', }, { title: 'Field Type', dataIndex: 'field_type', }, { title: 'Display Status', dataIndex: 'display', sorter: true, }, { title: 'Priority', dataIndex: 'display_order', sorter: true, }, ]; } setTypes(tables) { this.types = tables; } getFormFields() { return [ ['id', { label: 'ID', type: 'hidden' }], ['field_label', { label: 'Field Label', type: 'text', validation: '' }], ['type', { label: 'Object Type', type: 'select2', source: this.types, }, ], ['field_type', { label: 'Field Type', type: 'select', source: [['text', 'Text Field'], ['textarea', 'Text Area'], ['select', 'Select'], ['select2', 'Select2'], ['select2multi', 'Multi Select'], ['fileupload', 'File Upload'], ['date', 'Date'], ['datetime', 'Date Time'], ['time', 'Time'], ['signature', 'Signature']] }], ['field_validation', { label: 'Validation', type: 'select2', validation: 'none', sort: 'none', 'null-label': 'Required', 'allow-null': true, source: [['none', 'None'], ['number', 'Number'], ['numberOrEmpty', 'Number or Empty'], ['float', 'Decimal'], ['email', 'Email'], ['emailOrEmpty', 'Email or Empty']], }], ['field_options', { label: 'Field Options', type: 'datagroup', form: [ ['label', { label: 'Label', type: 'text', validation: '' }], ['value', { label: 'Value', type: 'text', validation: 'none' }], ], html: '