|
|
@ -3,11 +3,15 @@ import { useState } from 'react';
|
|
|
|
import { CheckIcon } from '@heroicons/react/20/solid';
|
|
|
|
import { CheckIcon } from '@heroicons/react/20/solid';
|
|
|
|
import { Button } from '@tih/ui';
|
|
|
|
import { Button } from '@tih/ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { useCompanyOptions } from '~/components/shared/CompaniesTypeahead';
|
|
|
|
|
|
|
|
import { useJobTitleOptions } from '~/components/shared/JobTitlesTypeahead';
|
|
|
|
import type { Month } from '~/components/shared/MonthYearPicker';
|
|
|
|
import type { Month } from '~/components/shared/MonthYearPicker';
|
|
|
|
import MonthYearPicker from '~/components/shared/MonthYearPicker';
|
|
|
|
import MonthYearPicker from '~/components/shared/MonthYearPicker';
|
|
|
|
|
|
|
|
|
|
|
|
import CompanyTypeahead from '../typeahead/CompanyTypeahead';
|
|
|
|
import CompanyTypeahead from '../typeahead/CompanyTypeahead';
|
|
|
|
import LocationTypeahead from '../typeahead/LocationTypeahead';
|
|
|
|
import LocationTypeahead, {
|
|
|
|
|
|
|
|
useLocationOptions,
|
|
|
|
|
|
|
|
} from '../typeahead/LocationTypeahead';
|
|
|
|
import RoleTypeahead from '../typeahead/RoleTypeahead';
|
|
|
|
import RoleTypeahead from '../typeahead/RoleTypeahead';
|
|
|
|
|
|
|
|
|
|
|
|
import type { Location } from '~/types/questions';
|
|
|
|
import type { Location } from '~/types/questions';
|
|
|
@ -43,6 +47,10 @@ export default function CreateQuestionEncounterForm({
|
|
|
|
startOfMonth(new Date()),
|
|
|
|
startOfMonth(new Date()),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { data: allCompanyOptions } = useCompanyOptions('');
|
|
|
|
|
|
|
|
const { data: allLocationOptions } = useLocationOptions('');
|
|
|
|
|
|
|
|
const allRoleOptions = useJobTitleOptions('');
|
|
|
|
|
|
|
|
|
|
|
|
if (submitted) {
|
|
|
|
if (submitted) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="font-md flex items-center gap-1 rounded-full border bg-slate-50 py-1 pl-2 pr-3 text-sm text-slate-500">
|
|
|
|
<div className="font-md flex items-center gap-1 rounded-full border bg-slate-50 py-1 pl-2 pr-3 text-sm text-slate-500">
|
|
|
@ -53,7 +61,7 @@ export default function CreateQuestionEncounterForm({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
<div className="flex items-center gap-2 flex-wrap">
|
|
|
|
<p className="text-md text-slate-600">
|
|
|
|
<p className="text-md text-slate-600">
|
|
|
|
I saw this question {step <= 1 ? 'at' : step === 2 ? 'for' : 'on'}
|
|
|
|
I saw this question {step <= 1 ? 'at' : step === 2 ? 'for' : 'on'}
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
@ -62,8 +70,8 @@ export default function CreateQuestionEncounterForm({
|
|
|
|
<CompanyTypeahead
|
|
|
|
<CompanyTypeahead
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
placeholder="Company"
|
|
|
|
placeholder="Company"
|
|
|
|
// TODO: Fix suggestions and set count back to 3
|
|
|
|
suggestedCount={3}
|
|
|
|
suggestedCount={0}
|
|
|
|
suggestedOptions={allCompanyOptions}
|
|
|
|
onSelect={({ value: company }) => {
|
|
|
|
onSelect={({ value: company }) => {
|
|
|
|
setSelectedCompany(company);
|
|
|
|
setSelectedCompany(company);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
@ -79,7 +87,8 @@ export default function CreateQuestionEncounterForm({
|
|
|
|
<LocationTypeahead
|
|
|
|
<LocationTypeahead
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
placeholder="Location"
|
|
|
|
placeholder="Location"
|
|
|
|
suggestedCount={0}
|
|
|
|
suggestedCount={3}
|
|
|
|
|
|
|
|
suggestedOptions={allLocationOptions}
|
|
|
|
onSelect={(location) => {
|
|
|
|
onSelect={(location) => {
|
|
|
|
setSelectedLocation(location);
|
|
|
|
setSelectedLocation(location);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
@ -95,7 +104,8 @@ export default function CreateQuestionEncounterForm({
|
|
|
|
<RoleTypeahead
|
|
|
|
<RoleTypeahead
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
placeholder="Role"
|
|
|
|
placeholder="Role"
|
|
|
|
suggestedCount={0}
|
|
|
|
suggestedCount={3}
|
|
|
|
|
|
|
|
suggestedOptions={allRoleOptions}
|
|
|
|
onSelect={({ value: role }) => {
|
|
|
|
onSelect={({ value: role }) => {
|
|
|
|
setSelectedRole(role);
|
|
|
|
setSelectedRole(role);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|