Skip to content

Commit

Permalink
feat: ✨ wrapped componenet with Layout and fragment
Browse files Browse the repository at this point in the history
wrapped componenet with Layout and fragment

ref: #23
  • Loading branch information
irkfaisal committed Mar 21, 2024
1 parent 8fb1b97 commit d3cc49f
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 176 deletions.
14 changes: 10 additions & 4 deletions app/components/BaseChemicals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { CoreTypographyBody1 } from "@wrappid/core";

export default function BaseChemicals() {
return (<CoreTypographyBody1>Base Chemicals</CoreTypographyBody1>);
import { CoreTypographyBody1, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

Check failure on line 1 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'

Check failure on line 2 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
export default function BaseChemicals() {

Check failure on line 3 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
return (

Check failure on line 4 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
<>

Check failure on line 5 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>

Check failure on line 6 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
<CoreTypographyBody1>Base Chemicals</CoreTypographyBody1>

Check failure on line 7 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
</CoreLayoutItem>

Check failure on line 8 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
</>

Check failure on line 9 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
)

Check failure on line 10 in app/components/BaseChemicals.js

View workflow job for this annotation

GitHub Actions / Validate app code style

Expected linebreaks to be 'LF' but found 'CRLF'
}
14 changes: 10 additions & 4 deletions app/components/Departments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { CoreTypographyBody1 } from "@wrappid/core";

export default function Departments() {
return (<CoreTypographyBody1>Departments</CoreTypographyBody1>);
import { CoreTypographyBody1, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

export default function Departments() {
return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>
<CoreTypographyBody1>Departments</CoreTypographyBody1>
</CoreLayoutItem>
</>
);
}
40 changes: 22 additions & 18 deletions app/components/LanguageDataManager.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { coreUseParams, CoreDataTable, CoreBox } from "@wrappid/core";

import LanguageEditorForm from "./LanguageEditorForm";

export default function LanguageDataManager() {
const { key } = coreUseParams();

return (
<CoreBox>
<CoreDataTable
hideForm={true}
entity={"DefaultStringValues"}
preRenderDetailsPaneComponent={LanguageEditorForm}
filterQuery={{ filter: key ? { key } : null }}
/>
</CoreBox>
);
}
import { coreUseParams, CoreDataTable, CoreBox, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

import LanguageEditorForm from "./LanguageEditorForm";

export default function LanguageDataManager() {
const { key } = coreUseParams();

return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>
<CoreBox>
<CoreDataTable
hideForm={true}
entity={"DefaultStringValues"}
preRenderDetailsPaneComponent={LanguageEditorForm}
filterQuery={{ filter: key ? { key } : null }}
/>
</CoreBox>
</CoreLayoutItem>
</>
);
}
116 changes: 60 additions & 56 deletions app/components/MasterData.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,60 @@
import React from "react";

import { coreUseNavigate, coreUseParams, CoreDataTable } from "@wrappid/core";

import { RoutesRegistry } from "../routes.registry";

export default function MasterData() {
const navigate = coreUseNavigate();
const { parentID } = coreUseParams();
const [filter, setFilter] = React.useState({ parentId: { eq: null } });

React.useEffect(() => {
let filterTemp = filter;

// eslint-disable-next-line no-console
console.log("MOUNT parent", parentID);
if (parentID) {
filterTemp.parentId.eq = parentID;
} else {
filterTemp.parentId.eq = null;
}
setFilter(filterTemp);
}, [parentID]);

const onChildClick = (data) => {
navigate("/" + RoutesRegistry.MASTER_DATA + "/" + data.id);
};

// eslint-disable-next-line no-console
console.log("FILTER", filter);
return (
<CoreDataTable
entity="LayeredMasterData"
filterQuery={{ filter: filter }}
createFormID="newMasterData"
updateFormID="newMasterData"
rowActions={[
{
action: onChildClick,
hide : (data) => {
// eslint-disable-next-line no-console
console.log("CHECKING CHILD", data);
if (data.id && data.Children && data.Children.length > 0) {
return false;
} else {
return true;
}
},
icon : "chevron_right",
label: "Go to child",
type : "action",
},
]}
/>
);
}
import React from "react";

import { coreUseNavigate, coreUseParams, CoreDataTable, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

import { RoutesRegistry } from "../routes.registry";

export default function MasterData() {
const navigate = coreUseNavigate();
const { parentID } = coreUseParams();
const [filter, setFilter] = React.useState({ parentId: { eq: null } });

React.useEffect(() => {
let filterTemp = filter;

// eslint-disable-next-line no-console
console.log("MOUNT parent", parentID);
if (parentID) {
filterTemp.parentId.eq = parentID;
} else {
filterTemp.parentId.eq = null;
}
setFilter(filterTemp);
}, [parentID]);

const onChildClick = (data) => {
navigate("/" + RoutesRegistry.MASTER_DATA + "/" + data.id);
};

// eslint-disable-next-line no-console
console.log("FILTER", filter);
return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>
<CoreDataTable
entity="LayeredMasterData"
filterQuery={{ filter: filter }}
createFormID="newMasterData"
updateFormID="newMasterData"
rowActions={[
{
action: onChildClick,
hide: (data) => {
// eslint-disable-next-line no-console
console.log("CHECKING CHILD", data);
if (data.id && data.Children && data.Children.length > 0) {
return false;
} else {
return true;
}
},
icon: "chevron_right",
label: "Go to child",
type: "action",
},
]}
/>
</CoreLayoutItem>
</>
);
}
16 changes: 11 additions & 5 deletions app/components/MedicalTestData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { CoreTypographyBody1 } from "@wrappid/core";

export default function MedicalTestData() {
return <CoreTypographyBody1>Medical Test Data</CoreTypographyBody1>;
}
import { CoreTypographyBody1, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

export default function MedicalTestData() {
return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>
<CoreTypographyBody1>Medical Test Data</CoreTypographyBody1>
</CoreLayoutItem>
</>
)
}
101 changes: 52 additions & 49 deletions app/components/MedicineDatabase.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
import { CoreDivider, CoreTypographyBody1, CoreDataTable } from "@wrappid/core";

export default function MedicineDatabase() {
return (
<>
<CoreTypographyBody1>
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
</CoreTypographyBody1>

<CoreDivider />

<CoreDataTable entity={"Medicines"} />

<CoreDivider />

<CoreTypographyBody1>
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
</CoreTypographyBody1>
</>
);
}
import { CoreDivider, CoreTypographyBody1, CoreDataTable, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

export default function MedicineDatabase() {
return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>

<CoreTypographyBody1>
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
</CoreTypographyBody1>

<CoreDivider />

<CoreDataTable entity={"Medicines"} />

<CoreDivider />

<CoreTypographyBody1>
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
CoreTypographyBody1. Fusce mattis egestas risus, in euismod odio
tincidunt in. Maecenas ut ultricies quam. Curabitur sit amet diam a
magna rhoncus posuere quis eu sem. Donec nec convallis ipsum. Donec
euismod, ex vel maximus tincidunt, lacus libero faucibus nulla, eu
scelerisque nisi metus at mi. Phasellus luctus in magna id finibus.
</CoreTypographyBody1>
</CoreLayoutItem>
</>
);
}
16 changes: 11 additions & 5 deletions app/components/MedicineTestData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { CoreDataTable } from "@wrappid/core";

export default function MedicineTestData() {
return <CoreDataTable entity={"TestMedicine"} />;
}
import { CoreDataTable, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

export default function MedicineTestData() {
return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>
<CoreDataTable entity={"TestMedicine"} />
</CoreLayoutItem>
</>
)
}
16 changes: 11 additions & 5 deletions app/components/SupportedLanguages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { CoreDataTable } from "@wrappid/core";

export default function SupportedLanguages() {
return <CoreDataTable entity="SupportedLanguages" enableCreate={true} />;
}
import { CoreDataTable, CoreLayoutItem, AppContainerLayout } from "@wrappid/core";

export default function SupportedLanguages() {
return (
<>
<CoreLayoutItem id={AppContainerLayout.PLACEHOLDER.CONTENT}>
<CoreDataTable entity="SupportedLanguages" enableCreate={true} />
</CoreLayoutItem>
</>
);
}
31 changes: 1 addition & 30 deletions app/routes.registry.js
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
export const RoutesRegistry = {
BASE_CHEMICALS : "chemical/base",
CHEMICAL_COMPOSITIONS : "chemical/compositions",
DEPARTMENTS : "departments",
DRUG_DATA_MANAGEMENT : "drug_data_management",
EDIT_SUGGESTIONS : "edit_suggestions",
HELP_DOCUMENTS : "help_documents",
INUSE_DRUG_DATA : "inuse_drug_data",
INUSE_MEDICAL_TEST_DATA : "inuse_medical_test_data",
MASTER_DATA : "masterData/all",
MASTER_DATA_TYPES : "masterData/types",
MASTER_DATA_TYPE_SPECIFIC : "masterData/all/:parentID",
MASTER_DATA_TYPE_SPECIFIC_CROWDSOURCED: "masterData/crowdsourced/:parentID",
MASTER_DATA_TYPE_SPECIFIC_SCRAPED : "masterData/scraped/:parentID",
MDM : "mdm",
MEDICAL_TEST_DATA_MANAGEMENT : "medical_test_data_management",
MEDICINES : "medicine/all",
MEDICINE_COMPANIES : "medicine/companies",
MEDICINE_DATA : "medicine_data",
MEDICINE_DATABASE : "medicine_database",
MEDICINE_DETAILS : "medicine/details",
MEDICINE_PACKAGES : "medicine/packages",
MTDM_EDIT_SUGGESTIONS : "mtdm_edit_suggestions",
PROSPECTED_DOCTORS : "prospected_doctors",
SCRAPED_DRUG_DATA : "scraped_drug_data",
SCRAPED_MEDICAL_TEST_DATA : "scraped_medical_test_data",
SCRAPED_MEDICINES : "medicine/scraped",
STRING_TABLE : "string_table",
STRING_TABLE_FILTERED : "string_table/:key",
};
export const RoutesRegistry = {};

0 comments on commit d3cc49f

Please sign in to comment.