-
Notifications
You must be signed in to change notification settings - Fork 0
/
Requirements.svelte
108 lines (98 loc) · 2.45 KB
/
Requirements.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<style>
h2 {
margin: 4%;
}
</style>
<script context="module" >
const alsoSearchFor = {
Beds: {
keywords: ["bed", "beds"],
checked: true,
icon: ["fas", "bed"]
},
ICU: {
keywords: ["icu"],
checked: true,
icon: ["fas", "procedures"]
},
Oxygen: {
keywords: ["oxygen"],
checked: true,
icon: ["fas", "lungs"]
},
Ventilator: {
keywords: ["ventilator", "ventilators"],
checked: true,
icon: ["fas", "heartbeat"]
},
Tests: {
keywords: ["test", "tests", "testing"],
checked: false,
icon: ["fas", "vial"]
},
Fabiflu: {
keywords: ["fabiflu","favipiravir"],
checked: false,
icon: ["fas", "pills"]
},
Remdesivir: {
keywords: ["remdesivir"],
checked: false,
icon: ["fas", "tablets"]
},
Tocilizumab: {
keywords: ["tocilizumab"],
checked: false,
icon: ["fas", "capsules"]
},
Plasma: {
keywords: ["plasma"],
checked: false,
icon: ["fas", "tint"]
},
Food: {
keywords: ["tiffin", "food"],
checked: false,
icon: ["fas", "utensils"]
}
};
import { library } from "@fortawesome/fontawesome-svg-core";
import { fas } from "@fortawesome/free-solid-svg-icons";
import { requirementStore } from "./store.js";
import { Col, Container, Row, Card } from "sveltestrap";
import { FontAwesomeIcon } from "fontawesome-svelte";
library.add(fas);
function selectReq(element) {
console.log(element);
document.getElementById(element).children[0].checked = "checked";
}
var requirements = [];
export function getRequirements() {
//alsoSearchFor = Array(alsoSearchFor);
//console.log(typeof alsoSearchFor);
//console.log(aSF);
var asfKeys = Object.keys(alsoSearchFor);
requirements = asfKeys.map(key =>
alsoSearchFor[key].checked ? alsoSearchFor[key].keywords.join(" ") : null
);
return requirements.join(" ").trim();
}
</script>
<Card>
<div style="margin:4%">
<h2>Requirements</h2>
<Container>
<Row cols="2">
{#each Object.keys(alsoSearchFor) as item (item)}
<Col>
<div id={"select"+item} class='check' >
<input on:click={getRequirements} bind:checked={alsoSearchFor[item].checked} type="checkbox" />
<FontAwesomeIcon icon={alsoSearchFor[item].icon} />
<label for={`alsoSearchFor-${item}`}>{item}</label>
</div>
</Col>
{/each}
</Row>
</Container>
</div>
</Card>