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

report implemented #34

Merged
merged 1 commit into from
May 16, 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
7 changes: 7 additions & 0 deletions components/ui/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type AvailableIcons =
| "ArrowsPointingOut"
| "Anexo"
| "Bars3"
| "Calendar"
| "Check"
| "ChevronLeft"
| "ChevronRight"
Expand All @@ -15,13 +16,17 @@ export type AvailableIcons =
| "Diners"
| "Discord"
| "Discount"
| "Dizziness"
| "Download"
| "Elo"
| "Ecanna"
| "Edit"
| "Facebook"
| "FilterList"
| "Focus"
| "Heart"
| "Hungry"
| "Headache"
| "Instagram"
| "Info"
| "QRicon"
Expand All @@ -33,6 +38,7 @@ export type AvailableIcons =
| "Mastercard"
| "Message"
| "MedCanna"
| "Nausea"
| "Phone"
| "Profile"
| "Pix"
Expand All @@ -43,6 +49,7 @@ export type AvailableIcons =
| "ShoppingCart"
| "Secure"
| "Star"
| "Sleep"
| "Tiktok"
| "Drop"
| "Trash"
Expand Down
53 changes: 53 additions & 0 deletions components/ui/MedicationEffectsCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import Icon, { AvailableIcons } from "./Icon.tsx";

export type AvailableEffects =
| "hunger"
| "sleep"
| "focus"
| "headache"
| "dizziness"
| "nausea";

const symbolName: Record<string, { icon: AvailableIcons; name: string }> = {
"hunger": {
icon: "Hungry",
name: "Fome",
},
"sleep": {
icon: "Sleep",
name: "Sono",
},
"focus": {
icon: "Focus",
name: "Foco",
},
"headache": {
icon: "Headache",
name: "Enxaqueca",
},
"dizziness": {
icon: "Update",
name: "Tontura",
},
"nausea": {
icon: "Nausea",
name: "Enjôo",
},
};

interface Props {
id: AvailableEffects;
}

const MedicationEffectsCard = ({ id }: Props) => {
return (
<div id="efeito" class="flex flex-col items-center justify-center gap-2">
<div class="h-16 w-16 bg-[#eeeeee] flex items-center justify-center rounded-md">
<Icon id={symbolName[id].icon} size={48} />
</div>
<span>{symbolName[id].name}</span>
</div>
);
};

export default MedicationEffectsCard;
287 changes: 287 additions & 0 deletions components/ui/PrescriberPatientTreatmentReport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
/**
* This component was made to control if user is logged in to access pages
*/
// import type { SectionProps } from "deco/types.ts";
// import { useUI } from "../../sdk/useUI.ts";
import { useEffect, useState } from "preact/hooks";
import { invoke } from "../../runtime.ts";
import PageWrap from "./PageWrap.tsx";
import Icon from "./Icon.tsx";
import { useUI } from "../../sdk/useUI.ts";
import type { DocListType } from "./MyDocs.tsx";
import Modal from "./Modal.tsx";
import { IS_BROWSER } from "$fresh/runtime.ts";
import type { Patient, Treatment } from "./PrescriberPatients.tsx";
import MedicationEffectsCard from "./MedicationEffectsCard.tsx";
import TreatmentCard from "./TreatmentCard.tsx";
import Chart from "deco-sites/ecannadeco/islands/FreshChart.tsx";
import { format } from "datetime";

export type Address = {
cep: string;
number: string;
complement: string;
addressType: string;
};

function PrescriberPatientTreatmentReport() {
const [isLoading, setIsLoading] = useState(false);
const [deleting, setDeleting] = useState(false);
const [isLoadingUsers, setIsLoadingUsers] = useState(false);
const [updating, setUpdating] = useState(false);
const [emailSearch, setEmailSearch] = useState("");
const [associationName, setAssociationName] = useState("");
const [associationCnpj, setAssociationCnpj] = useState("");
const [associationLogo, setAssociationLogo] = useState("");
const [createType, setCreateType] = useState<"user" | "association">(
"association",
);
const [limit, setLimit] = useState<number>();
const [hasNextPage, setHasNextPage] = useState<boolean>(false);
const [hasPrevPage, setHasPrevPage] = useState<boolean>(false);
const [page, setPage] = useState<number>();
const [totalPages, setTotalPages] = useState<number>();
const [treatment, setTreatment] = useState<Treatment>(
{
updated_at: "2024-05-14T14:29:09.024+00:00",
medication: [{
name: "CBD 3000mg - Abrapango",
dosage: "3 gotas 2x/ dia",
}, {
name: "THC 50mg - Abrapango",
dosage: "3 gotas 2x/ dia",
}],
entries: [{
created_at: "2024-05-14T14:29:09.024+00:00",
desiredEffects: [{
effect: {
name: "Fome",
},
intensity: 4,
}, {
effect: {
name: "Sono",
},
intensity: 3,
}],
undesiredEffects: [{
effect: {
name: "Dor de Cabeça",
},
intensity: 4,
}, {
effect: {
name: "Tontura",
},
intensity: 3,
}],
}],
current: true,
prescriber: {
name: "Dra. Endy Lacet",
registryType: "CRO",
registry: "0000000",
},
patient: {
name: "Célio Marcos",
},
},
);

return (
<PageWrap>
{isLoading
? <span class="loading loading-spinner text-green-600"></span>
: (
<div class="flex flex-col gap-8 w-full">
<div class="flex justify-between">
<h3 class="text-2xl text-[#8b8b8b] text-center">
Relatório de Tratamento
</h3>
</div>
<div>
<div class="bg-white rounded-md shadow flex items-center justify-center gap-10 p-3">
<div class="flex gap-2 items-center">
<Icon id="Calendar" size={18} />
<span>09/05/2024</span>
</div>
<span>a</span>
<div class="flex gap-2 items-center">
<Icon id="Calendar" size={18} />
<span>09/05/2024</span>
</div>
</div>
</div>
<div>
<TreatmentCard treatment={treatment!} />
</div>
<div class="flex flex-col">
<h3 class="text-sm text-[#8b8b8b] mb-2">
Efeitos Desejados Relatados
</h3>
<div
class={`flex flex-col gap-6 p-3 bg-[#ffffff] rounded-md text-[10px] sm:text-xs md:text-sm shadow`}
>
<div class="flex gap-8">
<MedicationEffectsCard id="hunger" />
<MedicationEffectsCard id="sleep" />
<MedicationEffectsCard id="focus" />
</div>
<div class="collapse collapse-arrow border border-base-300 bg-base-200">
<input type="checkbox" />
<div class="collapse-title text-xl font-medium">
<span class="underline text-sm">Histórico dos efeitos</span>
</div>
<div class="collapse-content flex flex-col gap-[48px]">
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Fome - 09/05/2024 a 09/05/2024",
data: [4, 6, 8, 7],
borderColor: "#32b541",
borderWidth: 1,
},
],
}}
/>
</div>
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Sono - 09/05/2024 a 09/05/2024",
data: [5, 6, 4, 8],
borderColor: "#32b541",
borderWidth: 1,
},
],
}}
/>
</div>
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Foco - 09/05/2024 a 09/05/2024",
data: [4, 4, 2, 6],
borderColor: "#32b541",
borderWidth: 1,
},
],
}}
/>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col">
<h3 class="text-sm text-[#8b8b8b] mb-2">
Efeitos Indesejados Relatados
</h3>
<div
class={`flex flex-col gap-6 p-3 bg-[#ffffff] rounded-md text-[10px] sm:text-xs md:text-sm shadow`}
>
<div class="flex gap-8">
<MedicationEffectsCard id="headache" />
<MedicationEffectsCard id="nausea" />
</div>
<div class="collapse collapse-arrow border border-base-300 bg-base-200">
<input type="checkbox" />
<div class="collapse-title text-xl font-medium">
<span class="underline text-sm">Histórico dos efeitos</span>
</div>
<div class="collapse-content flex flex-col gap-[48px]">
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Dor de Cabeça - 09/05/2024 a 09/05/2024",
data: [2, 6, 5, 4],
borderColor: "#d93939",
borderWidth: 1,
},
],
}}
/>
</div>
<div>
<Chart
type="line"
options={{
scales: { y: { beginAtZero: true } },
}}
data={{
labels: [
"01/04",
"02/04",
"12/05",
`${format(new Date(), "dd/MM")}`,
],
datasets: [
{
label: "Enjôo - 09/05/2024 a 09/05/2024",
data: [4, 2, 1, 3],
borderColor: "#d93939",
borderWidth: 1,
},
],
}}
/>
</div>
</div>
</div>
</div>
</div>
</div>
)}
</PageWrap>
);
}

export default PrescriberPatientTreatmentReport;
Loading
Loading