Skip to content

Commit

Permalink
Update package.json, index.js, and 3 more files...
Browse files Browse the repository at this point in the history
  • Loading branch information
FDT2k committed Apr 5, 2022
1 parent 0f306ce commit 4bcea7a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/react-bia-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "@karsegard/react-bia-manager",
"version": "1.0.14",
"version": "1.0.15",
"description": "",
"author": "FDT2k",
"license": "MIT",
Expand Down
Expand Up @@ -16,7 +16,7 @@ export const Component = props => {

<LayoutFlex justBetween>
<div>{t('Nom')}: {safe_string('lastname',patient)} - {t('Prénom')}: {safe_string('firstname',patient)} </div>
<div>{t('Date de naissance')}: {dateSysToHuman(safe_path('1970-01-01','birthdate',patient))} - ({patient.age} ans)</div>
<div>{t('Date de naissance')}: {dateSysToHuman(safe_path('1970-01-01','birthdate',patient))} - ({patient.age || ''} ans)</div>
</LayoutFlex>
</>

Expand Down
Expand Up @@ -24,7 +24,7 @@ export const Component = props => {

const {t,dateSysToHuman} = useTranslation();


console.log(customPrintHeader);
return (
<Grid
className="report"
Expand Down
Expand Up @@ -130,7 +130,6 @@ export const FakeBackendContainer = Component => (props) => {

<Component
{...rest}
customPrintHeader="/test/1_2.jpeg"
handlers={handlers}
/>
)
Expand Down
68 changes: 35 additions & 33 deletions packages/react-electron/src/App/Features/Editor/index.js
@@ -1,46 +1,48 @@
import React,{useState,useEffect} from 'react';
import { EditorFeature,PatientHeaderFeature} from '@karsegard/react-bia-manager';
import React, { useState, useEffect } from 'react';
import { EditorFeature, PatientHeaderFeature } from '@karsegard/react-bia-manager';
import { ReduxEditor } from '@karsegard/react-bia-manager';
//import { EditorWithBackend } from '@karsegard/react-bia-manager';
import {useBackend,useConfirm,useTranslation} from '@karsegard/react-bia-manager'
import {editorModule} from '@/Store'
import { useBackend, useConfirm, useTranslation } from '@karsegard/react-bia-manager'
import { editorModule } from '@/Store'



const Editor = ReduxEditor(editorModule,EditorFeature)
const Editor = ReduxEditor(editorModule, EditorFeature)


const PatientHeader = props => {
const {data,...rest} = props
const handleAction= action=> {
const { data, ...rest } = props
const handleAction = action => {

window.location.href="#/subject/"+data.uuid
window.location.href = "#/subject/" + data.uuid
}
return <PatientHeaderFeature data={data} {...rest} actions={['edit']} handleAction={handleAction}/>
return <PatientHeaderFeature data={data} {...rest} actions={['edit']} handleAction={handleAction} />
}

const EditorWithBackend = (props) => {
const { get_subject,save_subject_mesures,save_subject, get_mesure,delete_mesure,get_custom_header } = useBackend();
const { get_subject, save_subject_mesures, save_subject, get_mesure, delete_mesure, get_custom_header } = useBackend();
const { isConfirmed } = useConfirm();
const [header,setHeader] = useState();
const [header, setHeader] = useState();

const {t} = useTranslation();
const { handlers: {handleGoBack: _handleGoBack, ..._handlers}, ...rest } = props;
const { t } = useTranslation();

const { handlers: { handleGoBack: _handleGoBack, ..._handlers }, ...rest } = props;

const handleFetch = async patient_id => {
return get_subject(patient_id)
}

useEffect(() => {
get_custom_header().then(res=>{
console.log('header',res);
setHeader('data:image/jpeg;base64,'+res);
get_custom_header().then(res => {
console.log('header', res);
if (res && res != "") {
setHeader('data:image/jpeg;base64,' + res);
}
});
});
const handleSave = async(subject,current_mesure_id) => {
const handleSave = async (subject, current_mesure_id) => {

let result = save_subject_mesures(subject);
let result = save_subject_mesures(subject);
}

const handleMesureOpen = async (value, idx, editor_status) => {
Expand All @@ -50,37 +52,37 @@ const EditorWithBackend = (props) => {
return undefined;
}

const handleMesureCreate = async (patient_id,editor_status) => {
const handleMesureCreate = async (patient_id, editor_status) => {
if (editor_status === false) {
return await isConfirmed(t("The changes you made will not be saved, continue ?"))
}
return undefined;
}

const handleMesureDelete = async (patient_id,idx) => {
const handleMesureDelete = async (patient_id, idx) => {
const confirmed = await isConfirmed(t("Are you sure that you want to delete this ?"));
if (confirmed) {
return delete_mesure(patient_id,idx);
return delete_mesure(patient_id, idx);
}

return false;
return false;
}

const handleSaveSubject = async (subject)=> {
const handleSaveSubject = async (subject) => {

return save_subject({...subject,mesures:[]});
return save_subject({ ...subject, mesures: [] });
}


const handleGoBack = async (editor_status)=>{

const handleGoBack = async (editor_status) => {
if (editor_status === false) {
let result = await isConfirmed(t("The changes you made will not be saved, continue ?"))
if(result !==false){
let result = await isConfirmed(t("The changes you made will not be saved, continue ?"))
if (result !== false) {
_handleGoBack();

}
}else {
_handleGoBack();
} else {
_handleGoBack();

}
}
Expand Down Expand Up @@ -108,7 +110,7 @@ const EditorWithBackend = (props) => {
}

export default props => {
const {params} = props;
const { params } = props;
return (<>
<EditorWithBackend {...params} handlers={{handleGoBack:_=> window.location.href='#/search'}}/></>)
<EditorWithBackend {...params} handlers={{ handleGoBack: _ => window.location.href = '#/search' }} /></>)
}

0 comments on commit 4bcea7a

Please sign in to comment.