2023-06-28 12:55:24 +00:00
|
|
|
"use client";
|
|
|
|
|
|
2023-02-13 12:41:30 +00:00
|
|
|
import {
|
|
|
|
|
SimpleForm,
|
|
|
|
|
Create,
|
|
|
|
|
FormDataConsumer,
|
|
|
|
|
SelectInput,
|
|
|
|
|
BooleanInput,
|
|
|
|
|
ReferenceInput,
|
|
|
|
|
required,
|
|
|
|
|
CreateProps,
|
|
|
|
|
} from "react-admin";
|
|
|
|
|
import TwilioLanguages from "./twilio-languages";
|
|
|
|
|
import {
|
|
|
|
|
PromptInput,
|
|
|
|
|
VoiceInput,
|
|
|
|
|
AvailableNumbersInput,
|
|
|
|
|
populateNumber,
|
|
|
|
|
} from "./shared";
|
|
|
|
|
import MicInput from "./MicInput";
|
|
|
|
|
|
2023-03-15 12:17:43 +00:00
|
|
|
const VoiceLineCreate = (props: CreateProps) => (
|
|
|
|
|
<Create {...props} title="Create Voice Line" transform={populateNumber}>
|
|
|
|
|
<SimpleForm>
|
|
|
|
|
<ReferenceInput
|
|
|
|
|
label="Provider"
|
|
|
|
|
source="providerId"
|
|
|
|
|
reference="voiceProviders"
|
|
|
|
|
validate={[required()]}
|
|
|
|
|
>
|
|
|
|
|
<SelectInput optionText={(p) => `${p.kind}: ${p.name}`} />
|
|
|
|
|
</ReferenceInput>
|
|
|
|
|
<FormDataConsumer subscription={{ values: true }}>
|
|
|
|
|
{AvailableNumbersInput}
|
|
|
|
|
</FormDataConsumer>
|
|
|
|
|
<SelectInput
|
|
|
|
|
source="language"
|
|
|
|
|
choices={TwilioLanguages.languages}
|
|
|
|
|
validate={[required()]}
|
|
|
|
|
/>
|
|
|
|
|
<FormDataConsumer subscription={{ values: true }}>
|
|
|
|
|
{VoiceInput}
|
|
|
|
|
</FormDataConsumer>
|
2023-02-13 12:41:30 +00:00
|
|
|
|
2023-03-15 12:17:43 +00:00
|
|
|
<FormDataConsumer subscription={{ values: true }}>
|
|
|
|
|
{PromptInput}
|
|
|
|
|
</FormDataConsumer>
|
|
|
|
|
<BooleanInput source="audioPromptEnabled" />
|
|
|
|
|
<MicInput source="promptAudio" />
|
|
|
|
|
</SimpleForm>
|
|
|
|
|
</Create>
|
|
|
|
|
);
|
2023-02-13 12:41:30 +00:00
|
|
|
|
|
|
|
|
export default VoiceLineCreate;
|