Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from OnrampLab/issue-1-ivr-settings-page
Browse files Browse the repository at this point in the history
chore(pages): add render textarea according to setting names
  • Loading branch information
moon-brillar authored Oct 28, 2019
2 parents df93c8e + d7403bd commit 019f12c
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/modules/ivr/pages/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Form, Input, Card, Divider, message, Typography, Table, InputNumber, Popconfirm, Row} from 'antd';
import { IvrSettingsService } from '@onr/ivr/services';
import { IvrSettingsResponseRowData } from '../services/api/Interface';
import TextArea from 'antd/lib/input/TextArea';

const { Text } = Typography;

Expand All @@ -11,10 +12,13 @@ const EditableContext = React.createContext();


const EditableCell: React.FC = (props: any) => {
console.log(props)
const getInput = () => {
// if (props.inputType === 'number') {
// return <InputNumber />;
// }

if (props.inputType === 'textArea') {
return <TextArea rows={5} />;
}

return <Input />;
}

Expand Down Expand Up @@ -65,7 +69,8 @@ const SettingsTableComponent: React.FC = (props: any) => {
...col,
onCell: record => ({
record,
inputType: col.dataIndex === 'value' ? 'number' : 'text',
inputType: getInputType(record.name),

dataIndex: col.dataIndex,
title: col.title,
editing: isEditing(record),
Expand Down Expand Up @@ -129,6 +134,20 @@ const SettingsTableComponent: React.FC = (props: any) => {
return columns;
}

const getInputType = name => {
let inputType;
switch(name) {
case 'appointment_reminder_sms_content':
case 'appointment_IVR_message_recording_file':
case 'transfer_message':
inputType = 'textArea';
break;
default:
inputType = 'input';
}
return inputType;
}

const isEditing = record => record.id === editingKey;

const cancel = () => {
Expand Down

0 comments on commit 019f12c

Please sign in to comment.