@uxland-admin/ip-patient-header
Advanced tools
Comparing version 1.0.6 to 1.0.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 fetchPatientHeader = () => { | ||
@@ -30,5 +15,5 @@ let patientContext = patientContextSelector(store.getState()); | ||
let uri = `/patient/${patientContext.center}/${patientContext.patient}/${patientContext.case}/${patientContext.movement}/header`; | ||
return asyncAction(FETCH_PATIENT_HEADER, () => icsFetchClient.fetch(uri), store); | ||
return performAsyncAction(FETCH_PATIENT_HEADER, () => icsFetchClient.fetch(uri), store); | ||
} | ||
} | ||
}; |
import { html } from '@polymer/lit-element'; | ||
export default html `<style>mwc-fab{--mdc-theme-secondary: #00bcd4}mwc-button{--mdc-theme-primary: #26c5da}mwc-checkbox{--mdc-theme-secondary: #26c5da}#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}.patient-header-container{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex-align:center;-webkit-align-items:center;align-items:center;color:#37464D}.username{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex-align:center;-webkit-align-items:center;align-items:center;padding-right:12px;line-height:1rem}.username div{margin-right:6px}.userData{font-weight:300;line-height:1rem;font-size:.8571rem;margin-left:6px}p{margin:0}.sanize{text-transform:lowercase}.sanize:first-letter{text-transform:uppercase} | ||
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}.patient-header-container{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex-align:center;-webkit-align-items:center;align-items:center;color:#37464D}.username{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex-align:center;-webkit-align-items:center;align-items:center;padding-right:12px;line-height:1rem}.username div{margin-right:6px}.userData{font-weight:300;line-height:1rem;font-size:.8571rem;margin-left:6px}p{margin:0}.sanize{text-transform:lowercase}.sanize:first-letter{text-transform:uppercase} | ||
</style>`; |
@@ -6,6 +6,6 @@ import { html } from '@polymer/lit-element/lit-element'; | ||
<div class="patient-header-container"> | ||
<div class="username"><div class="sanize">${props.patientData.name}</div> <div class="sanize">${props.patientData.firstSurname}</div> <div class="sanize">${props.patientData.secondSurname}</div></p> | ||
<div class="username"> | ||
<div class="sanize">${props.patientData.name}</div> <div class="sanize">${props.patientData.firstSurname}</div> <div class="sanize">${props.patientData.secondSurname}</div></p> | ||
<p class="userData">${props.localize(props.patientData.gender == 'male' ? 'ip-patient-header.patientData.genderMale' : 'ip-patient-header.patientData.genderFemale')}, ${props.computeRelativeTime(props.patientData.birthDate)}</p> | ||
</div>` : html ``} | ||
`; | ||
</div>` : html ``}`; | ||
export const template = innerTemplate; |
@@ -78,9 +78,7 @@ declare module '@uxland-admin/ip-patient-header/constants' { | ||
declare module '@uxland-admin/ip-patient-header/app/patient-header/fetch-patient-header' { | ||
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 fetchPatientHeader: () => Promise<void>; | ||
export const fetchPatientHeader: () => Promise<any>; | ||
} | ||
declare module '@uxland-admin/ip-patient-header/components/ip-ph/ip-ph-styles' { | ||
const _default: import("@polymer/lit-element/node_modules/lit-html/lib/template-result").TemplateResult; | ||
const _default: import("lit-html/lib/template-result").TemplateResult; | ||
export default _default; | ||
@@ -100,3 +98,3 @@ | ||
patientData: AsyncState<Patient>; | ||
render(): import("@polymer/lit-element/node_modules/lit-html/lib/template-result").TemplateResult; | ||
render(): import("lit-html/lib/template-result").TemplateResult; | ||
computeRelativeTime(date: any): string; | ||
@@ -103,0 +101,0 @@ } |
{ | ||
"name": "@uxland-admin/ip-patient-header", | ||
"description": "ICS Process - Patient Header", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
12769
208