@uxland-admin/ps-medication-plan
Advanced tools
Comparing version 1.2.6 to 1.2.7
@@ -5,20 +5,5 @@ import isAsyncStateStale from "@uxland/uxl-redux/is-async-stale"; | ||
import { store } from '@uxland/uxl-prism/store'; | ||
import { createAsyncActions } from "@uxland/uxl-redux/create-async-actions"; | ||
import { icsFetchClient } from "@uxland-admin/ics-process-core/ics-fetch-client"; | ||
import { patientContextSelector } from "@uxland-admin/ics-process-core/patient-context/patient-context-selector"; | ||
export const asyncAction = async (action, fn, store, meta) => { | ||
let started = window.performance.now(); | ||
let actions = createAsyncActions(action); | ||
try { | ||
store.dispatch({ type: actions.started, meta: meta }); | ||
let result = await fn(); | ||
store.dispatch({ type: actions.succeeded, payload: result, meta: meta }); | ||
} | ||
catch (e) { | ||
store.dispatch({ type: actions.failed, payload: e, meta: meta }); | ||
} | ||
finally { | ||
store.dispatch({ type: actions.ended, payload: { elapsed: window.performance.now() - started }, meta: meta }); | ||
} | ||
}; | ||
import { performAsyncAction } from '@uxland/uxl-redux/perform-async-action'; | ||
export const fetchMedicationPlan = () => { | ||
@@ -30,5 +15,5 @@ let patientContext = patientContextSelector(store.getState()); | ||
let uri = `/patient/${patientContext.center}/${patientContext.patient}/${patientContext.case}/${patientContext.movement}/medication`; | ||
return asyncAction(FETCH_MEDICATION_PLAN, () => icsFetchClient.fetch(uri), store); | ||
return performAsyncAction(FETCH_MEDICATION_PLAN, () => icsFetchClient.fetch(uri), store); | ||
} | ||
} | ||
}; |
import { html } from '@polymer/lit-element'; | ||
export default html `<style>#app-container{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column;flex:1;height:100vh}:host{display:-ms-flexbox;display:-webkit-flex;display:flex}.medication{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex:1;-webkit-flex:1;flex:1;padding:8px 16px;border-bottom:1px solid #eceff1}medication-content{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex:1;-webkit-flex:1;flex:1;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}medication-info{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column}medication-date{font-size:.9286rem;color:#37464D;opacity:.7;text-transform:lowercase}medication-name{font:1rem;line-height:1.286rem;font-weight:500;color:#37464D;text-transform:lowercase}medication-name:first-letter{text-transform:uppercase}medication-dosage{font-size:.9286rem;color:#37464D;opacity:.7;text-transform:lowercase}.chronic{color:#FF5252;margin-left:4px} | ||
export default html `<style>#app-container{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column;flex:1;height:100vh}:host{display:-ms-flexbox;display:-webkit-flex;display:flex}.medication{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex:1;-webkit-flex:1;flex:1;padding:8px 16px;border-bottom:1px solid #eceff1}medication-content{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex:1;-webkit-flex:1;flex:1;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}medication-info{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column}medication-date{font-size:.8571rem;color:rgba(0,0,0,0.54);text-transform:lowercase}medication-name{font:1rem;line-height:1.286rem;font-weight:500;color:rgba(0,0,0,0.87);text-transform:lowercase}medication-name:first-letter{text-transform:uppercase}medication-dosage{font-size:.8571rem;color:rgba(0,0,0,0.54);text-transform:lowercase}.chronic{color:#FF5252;margin-left:4px} | ||
</style>`; |
import { html } from '@polymer/lit-element/lit-element'; | ||
import { repeat } from 'lit-html/directives/repeat'; | ||
import { when } from 'lit-html/directives/when'; | ||
import '../ip-ps-mp-item/ip-ps-mp-item'; | ||
@@ -9,29 +8,31 @@ import '@uxland/uxl-progress-indicator/uxl-progress-indicator'; | ||
<medication-widget> | ||
${when(props.showContent, () => html ` | ||
<medication-highlights> | ||
<div class="highlight"> | ||
<div class="highlight-value">${props.items.length}</div> | ||
<div class="highlight-label">${props.localize(`${moduleName}.highlights.total`)}</div> | ||
</div> | ||
<div class="highlight"> | ||
<div class="highlight-value">${props.lastMonthCount}</div> | ||
<div class="highlight-label">${props.localize(`${moduleName}.highlights.lastMonth`)}</div> | ||
</div> | ||
<div class="highlight"> | ||
<div class="highlight-value chronic">${props.chronicMedicationCount}</div> | ||
<div class="highlight-label">${props.localize(`${moduleName}.highlights.chronic`)}</div> | ||
</div> | ||
</medication-highlights> | ||
<uxl-progress-indicator .active="${props.isFetching}" .text="${props.localize(`${moduleName}.busy`)}"> | ||
<div class="medication-list"> | ||
<div class="container-list maximized"> | ||
${repeat(props.items, medicine => html `<ip-ps-mp-item .medicine="${medicine}"></ip-ps-mp-item>`)} | ||
${props.showContent | ||
? html ` | ||
<medication-highlights> | ||
<div class="highlight"> | ||
<div class="highlight-value">${props.items.length}</div> | ||
<div class="highlight-label">${props.localize(`${moduleName}.highlights.total`)}</div> | ||
</div> | ||
</div> | ||
</uxl-progress-indicator>`, () => html ` | ||
<no-content-message> | ||
<p class="empty">${props.localize(`${moduleName}.empty`)}</p> | ||
</no-content-message>`)} | ||
<div class="highlight"> | ||
<div class="highlight-value">${props.lastMonthCount}</div> | ||
<div class="highlight-label">${props.localize(`${moduleName}.highlights.lastMonth`)}</div> | ||
</div> | ||
<div class="highlight"> | ||
<div class="highlight-value chronic">${props.chronicMedicationCount}</div> | ||
<div class="highlight-label">${props.localize(`${moduleName}.highlights.chronic`)}</div> | ||
</div> | ||
</medication-highlights> | ||
<uxl-progress-indicator .active="${props.isFetching}" .text="${props.localize(`${moduleName}.busy`)}"> | ||
<div class="medication-list"> | ||
<div class="container-list maximized"> | ||
${repeat(props.items, medicine => html `<ip-ps-mp-item .medicine="${medicine}"></ip-ps-mp-item>`)} | ||
</div> | ||
</div> | ||
</uxl-progress-indicator>` | ||
: html ` | ||
<no-content-message> | ||
<p class="empty">${props.localize(`${moduleName}.empty`)}</p> | ||
</no-content-message>`} | ||
</medication-widget>`; | ||
export const template = innerTemplate; |
import { html } from '@polymer/lit-element/lit-element'; | ||
import { repeat } from 'lit-html/directives/repeat'; | ||
import { when } from 'lit-html/directives/when'; | ||
import '../ip-ps-mp-item/ip-ps-mp-item'; | ||
@@ -10,11 +9,13 @@ import '@uxland/uxl-progress-indicator/uxl-progress-indicator'; | ||
<uxl-progress-indicator ?active="${props.isFetching}" .active="${props.isFetching}" .text="${props.localize(`${moduleName}.busy`)}"> | ||
${when(props.showContent, () => html `<div class="medication-list"> | ||
<div class="container-list"> | ||
${repeat(props.items, medicine => html `<ip-ps-mp-item .medicine="${medicine}"></ip-ps-mp-item> | ||
</div> | ||
</div>`)}`, () => html `<no-content-message> | ||
<p class="empty">${props.localize(`${moduleName}.empty`)}</p> | ||
</no-content-message>`)} | ||
${props.showContent | ||
? html `<div class="medication-list"> | ||
<div class="container-list"> | ||
${repeat(props.items, medicine => html `<ip-ps-mp-item .medicine="${medicine}"></ip-ps-mp-item> | ||
</div> | ||
</div>`)}` | ||
: html `<no-content-message> | ||
<p class="empty">${props.localize(`${moduleName}.empty`)}</p> | ||
</no-content-message>`}; | ||
</uxl-progress-indicator> | ||
</medication-widget>`; | ||
export const template = innerTemplate; |
@@ -14,4 +14,4 @@ import * as tslib_1 from "tslib"; | ||
} | ||
get emptyData() { | ||
return !this.isFetching && !this.items; | ||
render() { | ||
return html `${CSS} ${TEMPLATE(this)}`; | ||
} | ||
@@ -21,5 +21,2 @@ get showContent() { | ||
} | ||
render() { | ||
return html `${CSS} ${TEMPLATE(this)}`; | ||
} | ||
}; | ||
@@ -26,0 +23,0 @@ tslib_1.__decorate([ |
@@ -82,5 +82,3 @@ declare module '@uxland-admin/ps-medication-plan/constants' { | ||
declare module '@uxland-admin/ps-medication-plan/app/medication-plan-list/fetch-medication-plan' { | ||
import { Store } from "redux"; | ||
export const asyncAction: <T = any>(action: string, fn: () => Promise<T>, store: Store<any, import("redux").AnyAction>, meta?: any) => Promise<void>; | ||
export const fetchMedicationPlan: () => Promise<void>; | ||
export const fetchMedicationPlan: () => any; | ||
@@ -151,8 +149,7 @@ } | ||
activeChanged(current: boolean): void; | ||
render(): import("lit-html/lib/template-result").TemplateResult; | ||
items: MedicationPlanItem[]; | ||
isFetching: boolean; | ||
chronicMedicationCount: number; | ||
readonly emptyData: boolean; | ||
readonly showContent: boolean; | ||
render(): import("lit-html/lib/template-result").TemplateResult; | ||
} | ||
@@ -183,5 +180,1 @@ export {}; | ||
} | ||
declare module '@uxland-admin/ps-medication-plan/domain/medication-plan-item' { | ||
export const removableItemSpec: any; | ||
} |
{ | ||
"name": "@uxland-admin/ps-medication-plan", | ||
"description": "ICS Process - Patient Summary - Medication Plan", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
30001
23
510