Skip to content

Commit

Permalink
Added service providers, barriers became measures
Browse files Browse the repository at this point in the history
  • Loading branch information
driver-deploy-2 committed Nov 16, 2024
1 parent eb5b65b commit 73c1809
Show file tree
Hide file tree
Showing 17 changed files with 849 additions and 339 deletions.
6 changes: 6 additions & 0 deletions packages/gui/src/components/crime-script-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const CrimeScriptPage: MeiosisComponent = () => {
geoLocations = [],
transports = [],
products = [],
partners = [],
serviceProviders = [],
} = model;
id = m.route.param('id') || currentCrimeScriptId || (crimeScripts.length > 0 ? crimeScripts[0].id : '');
const crimeScript =
Expand Down Expand Up @@ -97,6 +99,8 @@ export const CrimeScriptPage: MeiosisComponent = () => {
geoLocations,
transports,
products,
partners,
serviceProviders,
})
: m(CrimeScriptViewer, {
crimeScript,
Expand All @@ -106,6 +110,8 @@ export const CrimeScriptPage: MeiosisComponent = () => {
locations,
geoLocations,
products,
partners,
serviceProviders,
curActIdx,
curPhaseIdx,
update: actions.update,
Expand Down
35 changes: 23 additions & 12 deletions packages/gui/src/components/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,31 @@ export const Layout: MeiosisComponent = () => {
]),
]
),
m('.container', { style: 'padding-top: 5px' }, children),
m(
'a',
{
href: 'https://www.tno.nl',
target: '_blank',
style: {
position: 'fixed',
bottom: '0',
right: '10px',
},
},
m('img[width=100][height=50][alt=TNO website][title=TNO website].right', { src: tno })
'.container',
{ style: 'padding-top: 5px' },
children,
m(
'.row',
m(
'.col.s12',
m(
'a',
{
href: 'https://www.tno.nl',
target: '_blank',
// style: {
// position: 'fixed',
// bottom: '0',
// right: '10px',
// },
},
m('img[width=100][height=50][alt=TNO website][title=TNO website].right', { src: tno })
)
)
)
),
,
]),
];
},
Expand Down
47 changes: 20 additions & 27 deletions packages/gui/src/components/settings-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { deepCopy, FormAttributes, LayoutForm } from 'mithril-ui-form';
import { Collapsible, FlatButton, Tabs } from 'mithril-materialized';
import { attrForm, AttributeType } from '../models/forms';
import { TextInputWithClear } from './ui/text-input-with-clear';
import { sortByLabel } from '../utils';

export const SettingsPage: MeiosisComponent = () => {
let edit = false;
Expand Down Expand Up @@ -47,10 +48,8 @@ export const SettingsPage: MeiosisComponent = () => {
transports = [],
locations = [],
geoLocations = [],
opportunities = [],
indicators = [],
barriers = [],
partners = [],
serviceProviders = [],
} = model;

const labelFilter = attributeFilter ? attributeFilter.toLowerCase() : undefined;
Expand All @@ -65,6 +64,13 @@ export const SettingsPage: MeiosisComponent = () => {
'person',
cast.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
[
'serviceProviders',
t('SERVICE_PROVIDERS'),
'serviceProviders',
'business',
serviceProviders.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
[
'attributes',
t('ATTRIBUTES'),
Expand Down Expand Up @@ -100,34 +106,13 @@ export const SettingsPage: MeiosisComponent = () => {
'location_on',
geoLocations.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
[
'opportunities',
t('OPPORTUNITIES'),
'opportunities',
'lightbulb',
opportunities.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
[
'indicators',
t('INDICATORS'),
'indicators',
'light_mode',
indicators.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
[
'partners',
t('PARTNERS'),
'partners',
'handshake', // groups
partners.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
[
'barriers',
t('BARRIERS'),
'barriers',
'block',
barriers.filter((a) => !labelFilter || (a.label && a.label.toLowerCase().includes(labelFilter))),
],
] as Array<
[id: AttributeType, label: string, type: AttributeType, iconName: string, attrs: Array<Hierarchical & Labeled>]
>;
Expand Down Expand Up @@ -156,6 +141,14 @@ export const SettingsPage: MeiosisComponent = () => {
if (edit) {
storedModel = deepCopy(model);
} else {
model.cast?.sort(sortByLabel);
model.serviceProviders?.sort(sortByLabel);
model.attributes?.sort(sortByLabel);
model.products?.sort(sortByLabel);
model.transports?.sort(sortByLabel);
model.locations?.sort(sortByLabel);
model.geoLocations?.sort(sortByLabel);
model.partners?.sort(sortByLabel);
actions.saveModel(model);
}
},
Expand All @@ -172,14 +165,14 @@ export const SettingsPage: MeiosisComponent = () => {
}),
],
m(Tabs, {
tabWidth: 'fixed',
tabWidth: 'auto',
tabs: tabs.map(([id, label, type, iconName, attr]) => {
return {
id: label.replace('è', 'e'),
title: `${attr.length ? `${attr.length} ` : ''}${label}`,
vnode: edit
? m(LayoutForm, {
form: attrForm(id, label, type === 'barriers' ? partners : attr, type),
form: attrForm(id, label, attr, type),
obj: model,
} as FormAttributes<any>)
: m(AttrView, {
Expand Down Expand Up @@ -215,7 +208,7 @@ const AttrView: FactoryComponent<{
.sort((a, b) => a.label?.localeCompare(b.label))
.map((c) => {
const searchResults = crimeScripts.reduce((acc, cs, crimeScriptIdx) => {
cs.stages?.forEach(({ ids }) => {
cs.stages?.forEach(({ ids = [] }) => {
ids.forEach((actId) => {
const actIdx = acts.findIndex((a) => a.id === actId);
if (actIdx < 0) return;
Expand Down
Loading

0 comments on commit 73c1809

Please sign in to comment.