Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: validation fix and move code #54

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions app/components.registry.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
import BasicInfoCard from "./components/basicInfo/BasicInfoCard";
import ProfileBasicSkeleton from "./components/basicInfo/ProfileBasicSkeleton";
import ClinicCard from "./components/clinic/ClinicCard";
import ProfileClinicSkeleton from "./components/clinic/ProfileClinicSkeleton";
import ContactInfoCard from "./components/contactInfo/ContactInfoCard";
import ProfileContactSkeleton from "./components/contactInfo/ProfileContactSkeleton";
import EducationCard from "./components/education/EducationCard";
import ProfileEducationSkeleton from "./components/education/ProfileEducationSkeleton";
import ExperienceCard from "./components/experience/ExperienceCard";
import ProfileExperienceSkeleton from "./components/experience/ProfileExperienceSkeleton";
import ProfileRegistrationSkeleton from "./components/registration/ProfileRegistrationSkeleton";
import RegistrationCard from "./components/registration/RegistrationCard";
import UserProfile from "./components/UserProfile";

export const ComponentsRegistry = {
BasicInfoCard : { comp: BasicInfoCard },
ProfileBasicSkeleton : { comp: ProfileBasicSkeleton },
ProfileClinicSkeleton : { comp: ProfileClinicSkeleton },
ProfileContactSkeleton : { comp: ProfileContactSkeleton },
ProfileEducationSkeleton : { comp: ProfileEducationSkeleton },
ProfileExperienceSkeleton : { comp: ProfileExperienceSkeleton },
ProfileRegistrationSkeleton: { comp: ProfileRegistrationSkeleton },
UserProfile : { comp: UserProfile },
clinicCard : { comp: ClinicCard },
contactInfoCard : { comp: ContactInfoCard },
educationCard : { comp: EducationCard },
experienceCard : { comp: ExperienceCard },
registrationCard : { comp: RegistrationCard }
BasicInfoCard : { comp: BasicInfoCard },
ProfileBasicSkeleton : { comp: ProfileBasicSkeleton },
ProfileContactSkeleton : { comp: ProfileContactSkeleton },
ProfileEducationSkeleton : { comp: ProfileEducationSkeleton },
ProfileExperienceSkeleton: { comp: ProfileExperienceSkeleton },
UserProfile : { comp: UserProfile },
contactInfoCard : { comp: ContactInfoCard },
educationCard : { comp: EducationCard },
experienceCard : { comp: ExperienceCard },
};
190 changes: 74 additions & 116 deletions app/components/UserProfile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/* eslint-disable etc/no-commented-out-code */
import { useState, useEffect } from "react";

import {
AppContainerLayout,
CoreBox,
CoreCard,
CoreCardContent,
CoreComponent,
CoreDivider,
CoreForm,
CoreGrid,
Expand Down Expand Up @@ -76,123 +79,78 @@ function UserProfile() {

<CoreDivider />

{auth?.role?.role &&
auth?.role?.role.toLowerCase() === "doctor" && (
<CoreForm
coreId="registrationInfo"
formId={FORM_IDS.__PROFILE_REGISTRATION}
allowDelete={false}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={formsMode[FORM_IDS.__PROFILE_REGISTRATION]}
/>
)}
<CoreBox>
<CoreComponent
componentName="AppSpecificProfileSection" />
</CoreBox>

{auth?.role?.role &&
auth?.role?.role.toLowerCase() === "doctor" && (
<CoreForm
arrayView={true}
coreId="clinicInfo"
formId={FORM_IDS.__PROFILE_CLINIC}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={formsMode[FORM_IDS.__PROFILE_CLINIC]}
arrayDataLimit={2}
query={{
_defaultFilter: encodeURIComponent(
JSON.stringify({ personId: profile?.basic?.id })
),
}}
/>
)}

{auth?.role?.role &&
auth?.role?.role.toLowerCase() === "doctor" && <CoreDivider />}

{auth?.role?.role &&
auth?.role?.role.toLowerCase() !== "patient" && (
<CoreForm
arrayView={true}
coreId="educationInfo"
formId={FORM_IDS.__PROFILE_EDUCATION}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={formsMode[FORM_IDS.__PROFILE_EDUCATION]}
arrayDataLimit={2}
query={{
_defaultFilter: encodeURIComponent(
JSON.stringify({ personId: profile?.basic?.id })
),
}}
/>
)}

{auth?.role?.role &&
auth?.role?.role.toLowerCase() !== "patient" && (
<CoreForm
arrayView={true}
coreId="experienceInfo"
formId={FORM_IDS.__PROFILE_EXPERIENCE}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={formsMode[FORM_IDS.__PROFILE_EXPERIENCE]}
arrayDataLimit={2}
query={{
_defaultFilter: encodeURIComponent(
JSON.stringify({ personId: profile?.basic?.id })
),
}}
// --- afterCreateError={() => {
// alert("CREATE error hook");
// }}
// afterEditError={() => {
// alert("EDIT error hook");
// }}
// afterDeleteError={() => {
// alert("DELETE error hook");
// }}
// afterCreateSuccess={() => {
// alert("CREATE success hook");
// }}
// afterEditSuccess={() => {
// alert("EDIT success hook");
// }}
// afterDeleteSuccess={() => {
// alert("DELETE success hook");
// }}
/>
)}

{auth?.role?.role &&
auth?.role?.role.toLowerCase() === "patient" && (
<CoreForm
arrayView={true}
formId={FORM_IDS.__CREATE_PATIENT}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={FORM_VIEW_MODE}
/>
)}
<CoreForm
arrayView={true}
coreId="educationInfo"
formId={FORM_IDS.__PROFILE_EDUCATION}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={formsMode[FORM_IDS.__PROFILE_EDUCATION]}
arrayDataLimit={2}
query={{
_defaultFilter: encodeURIComponent(
JSON.stringify({ personId: profile?.basic?.id })
),
}}
/>

<CoreForm
arrayView={true}
coreId="experienceInfo"
formId={FORM_IDS.__PROFILE_EXPERIENCE}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={formsMode[FORM_IDS.__PROFILE_EXPERIENCE]}
arrayDataLimit={2}
query={{
_defaultFilter: encodeURIComponent(
JSON.stringify({ personId: profile?.basic?.id })
),
}}
// --- afterCreateError={() => {
// alert("CREATE error hook");
// }}
// afterEditError={() => {
// alert("EDIT error hook");
// }}
// afterDeleteError={() => {
// alert("DELETE error hook");
// }}
// afterCreateSuccess={() => {
// alert("CREATE success hook");
// }}
// afterEditSuccess={() => {
// alert("EDIT success hook");
// }}
// afterDeleteSuccess={() => {
// alert("DELETE success hook");
// }}
/>

{/* <CoreForm
arrayView={true}
formId={FORM_IDS.__CREATE_PATIENT}
gridProps={{
gridSize: {
sm: 6,
xs: 12,
},
}}
mode={FORM_VIEW_MODE}
/> */}
</CoreGrid>
</CoreCardContent>
</CoreCard>
Expand Down
72 changes: 0 additions & 72 deletions app/components/clinic/ClinicCard.js

This file was deleted.

24 changes: 0 additions & 24 deletions app/components/clinic/ProfileClinicSkeleton.js

This file was deleted.

17 changes: 0 additions & 17 deletions app/components/registration/ProfileRegistrationSkeleton.js

This file was deleted.

Loading
Loading