Skip to content

Commit

Permalink
feat: removed program from service and organization form
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-merlin committed Jan 18, 2025
1 parent ff6b056 commit 29c0f67
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 66 deletions.
26 changes: 0 additions & 26 deletions src/components/forms/OrganizationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import LocationForm from './LocationForm';
import PhoneForm from './PhoneForm';
import Phone from '../../interface/model/Phone';
import { phoneTableColumns } from '../../data/PhoneData';
import Program from '../../interface/model/Program';
import ProgramForm from './ProgramForm';
import { programTableColumns } from '../../data/ServicesData';
import ContactForm from './ContactForm';
import Contact from '../../interface/model/Contact';
import { contactTableColumns } from '../../data/ContactData';
Expand All @@ -39,7 +36,6 @@ const OrganizationForm = ({ organizations }: OrganizationFormProps) => {
const [currentStep, setCurrentStep] = useState<number>(5);
const [locations, setLocations] = useState<Location[]>([]);
const [phones, setPhones] = useState<Phone[]>([]);
const [programs, setPrograms] = useState<Program[]>([]);
const [contacts, setContacts] = useState<Contact[]>([]);
const [form] = Form.useForm();

Expand Down Expand Up @@ -343,28 +339,6 @@ const OrganizationForm = ({ organizations }: OrganizationFormProps) => {
/>
),
},
{
title: 'Program',
content: (
<CollapsibleFormSelectTable
formLabel="Add a new Program"
selectLabel="Select an existing Program"
customForm={
<ProgramForm parentForm={form} setPrograms={setPrograms} />
}
parentForm={form}
dropdownLabel="Program Name"
dropdownName="Program Name"
dropdownPlaceholder="Select a Program"
emptyText="Programs"
options={programs.map((program) => {
return { value: program.id, label: program.name };
})}
tableColumns={programTableColumns || []}
dataSource={programs}
/>
),
},
{
title: 'Schedule',
content: (
Expand Down
40 changes: 0 additions & 40 deletions src/components/forms/ServiceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { Button, Form, Input, Modal, Select, Steps } from 'antd';
import Response from '../../interface/Response';
import Organization from '../../interface/model/Organization';
import { getAllOrganizations } from '../../api/lib/organizations';
import ProgramForm from './ProgramForm';
import Program from '../../interface/model/Program';
import { getAllPrograms } from '../../api/lib/programs';
import { programTableColumns } from '../../data/ServicesData';
import CollapsibleFormSelectTable from '../CollapsibleFormSelectTable';
import RequiredDocument from '../../interface/model/RequiredDocument';
import CollapsibleFormTable from '../CollapsibleFormTable';
Expand All @@ -28,7 +24,6 @@ const ServiceForm = () => {
const [showServiceModal, setShowServiceModal] = useState<boolean>(false);
const [currentStep, setCurrentStep] = useState<number>(8);
const [organizations, setOrganizations] = useState<Organization[]>([]);
const [programs, setPrograms] = useState<Program[]>([]);
const [requiredDocuments, setRequiredDocuments] = useState<
RequiredDocument[]
>([]);
Expand All @@ -38,18 +33,6 @@ const ServiceForm = () => {
const [form] = Form.useForm();

useEffect(() => {
const fetchPrograms = async () => {
try {
const response = await getAllPrograms();
const data = response.data as Response<Program[]>;
data.contents?.forEach((program) => {
setPrograms((prev) => [...prev, program]);
});
setPrograms(data.contents || []);
} catch (error) {
console.error(error);
}
};
const fetchOrganizations = async () => {
try {
const response = await getAllOrganizations();
Expand All @@ -59,7 +42,6 @@ const ServiceForm = () => {
console.error(error);
}
};
fetchPrograms();
fetchOrganizations();
}, []);

Expand Down Expand Up @@ -219,28 +201,6 @@ const ServiceForm = () => {
</Form>
),
},
{
title: 'Program',
content: (
<CollapsibleFormSelectTable
formLabel="Add a new Program"
customForm={
<ProgramForm parentForm={form} setPrograms={setPrograms} />
}
parentForm={form}
selectLabel="Add an existing Program"
dropdownLabel="Program Name"
dropdownName="Program Name"
dropdownPlaceholder="Select a Program"
emptyText="Programs"
options={programs.map((program) => {
return { value: program.id, label: program.name };
})}
tableColumns={programTableColumns || []}
dataSource={programs}
/>
),
},
{
title: 'Documents',
content: (
Expand Down

0 comments on commit 29c0f67

Please sign in to comment.