argous 1.2.222 → 1.2.224
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +36 -1
- package/dist/components/ArgousComplexTable/ArgousComplexTable.d.ts +9 -1
- package/dist/components/ArgousComplexTable/ArgousComplexTable.js +7 -7
- package/dist/components/BarraFerramentas/BarraFerramentas.d.ts +4 -1
- package/dist/components/BarraFerramentas/BarraFerramentas.js +48 -26
- package/dist/components/Document/Icons.d.ts +193 -0
- package/dist/components/Document/Icons.js +269 -0
- package/dist/components/Document/ModalVisualizacaoDocumentos.d.ts +8 -0
- package/dist/components/Document/ModalVisualizacaoDocumentos.js +84 -0
- package/dist/components/Document/Visualizacao.d.ts +12 -0
- package/dist/components/Document/Visualizacao.js +205 -0
- package/dist/components/Document/icons/ai.svg +20 -0
- package/dist/components/Document/icons/audio.svg +16 -0
- package/dist/components/Document/icons/avi.svg +15 -0
- package/dist/components/Document/icons/css.svg +47 -0
- package/dist/components/Document/icons/csv.svg +37 -0
- package/dist/components/Document/icons/dbf.svg +30 -0
- package/dist/components/Document/icons/doc.svg +47 -0
- package/dist/components/Document/icons/dwg.svg +32 -0
- package/dist/components/Document/icons/exe.svg +20 -0
- package/dist/components/Document/icons/file.svg +11 -0
- package/dist/components/Document/icons/fla.svg +23 -0
- package/dist/components/Document/icons/html.svg +23 -0
- package/dist/components/Document/icons/image.svg +16 -0
- package/dist/components/Document/icons/iso.svg +40 -0
- package/dist/components/Document/icons/jpg.svg +33 -0
- package/dist/components/Document/icons/js.svg +40 -0
- package/dist/components/Document/icons/json.svg +45 -0
- package/dist/components/Document/icons/mod.svg +41 -0
- package/dist/components/Document/icons/mp3.svg +36 -0
- package/dist/components/Document/icons/mp4.svg +25 -0
- package/dist/components/Document/icons/pdf.svg +35 -0
- package/dist/components/Document/icons/png.svg +30 -0
- package/dist/components/Document/icons/ppt.svg +31 -0
- package/dist/components/Document/icons/psd.svg +50 -0
- package/dist/components/Document/icons/rtf.svg +35 -0
- package/dist/components/Document/icons/search.svg +20 -0
- package/dist/components/Document/icons/svg.svg +34 -0
- package/dist/components/Document/icons/txt.svg +29 -0
- package/dist/components/Document/icons/video.svg +17 -0
- package/dist/components/Document/icons/xls.svg +31 -0
- package/dist/components/Document/icons/xml.svg +25 -0
- package/dist/components/Document/icons/zip.svg +24 -0
- package/dist/components/Document/icons/zip1.svg +18 -0
- package/dist/components/Document/index.d.ts +3 -0
- package/dist/components/Document/index.js +21 -0
- package/dist/components/Programa/Annotations/Annotation.d.ts +19 -0
- package/dist/components/Programa/Annotations/Annotation.js +316 -0
- package/dist/components/Programa/Annotations/AnnotationsList.d.ts +3 -0
- package/dist/components/Programa/Annotations/AnnotationsList.js +50 -0
- package/dist/components/Programa/Annotations/Input/FileInput.d.ts +6 -0
- package/dist/components/Programa/Annotations/Input/FileInput.js +147 -0
- package/dist/components/Programa/Annotations/Input/Input.d.ts +3 -0
- package/dist/components/Programa/Annotations/Input/Input.js +218 -0
- package/dist/components/Programa/Annotations/Input/PrivacySelection.d.ts +7 -0
- package/dist/components/Programa/Annotations/Input/PrivacySelection.js +65 -0
- package/dist/components/Programa/Annotations/Input/ReplyInformation.d.ts +5 -0
- package/dist/components/Programa/Annotations/Input/ReplyInformation.js +78 -0
- package/dist/components/Programa/Annotations/Input/UsersAutocomplete.d.ts +7 -0
- package/dist/components/Programa/Annotations/Input/UsersAutocomplete.js +139 -0
- package/dist/components/Programa/Annotations/index.d.ts +23 -0
- package/dist/components/Programa/Annotations/index.js +195 -0
- package/dist/components/Programa/Annotations/utils.d.ts +18 -0
- package/dist/components/Programa/Annotations/utils.js +46 -0
- package/dist/components/Programa/Programa.d.ts +3 -1
- package/dist/components/Programa/Programa.js +20 -6
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +1 -0
- package/dist/utils/index.d.ts +47 -0
- package/dist/utils/index.js +104 -4
- package/lib/api/index.js +24 -6
- package/lib/components/ArgousComplexTable/ArgousComplexTable.d.ts +9 -1
- package/lib/components/ArgousComplexTable/ArgousComplexTable.js +6 -4
- package/lib/components/BarraFerramentas/BarraFerramentas.d.ts +4 -1
- package/lib/components/BarraFerramentas/BarraFerramentas.js +92 -50
- package/lib/components/Document/Icons.js +169 -0
- package/lib/components/Document/ModalVisualizacaoDocumentos.js +64 -0
- package/lib/components/Document/Visualizacao.js +104 -0
- package/lib/components/Document/icons/ai.svg +20 -0
- package/lib/components/Document/icons/audio.svg +16 -0
- package/lib/components/Document/icons/avi.svg +15 -0
- package/lib/components/Document/icons/css.svg +47 -0
- package/lib/components/Document/icons/csv.svg +37 -0
- package/lib/components/Document/icons/dbf.svg +30 -0
- package/lib/components/Document/icons/doc.svg +47 -0
- package/lib/components/Document/icons/dwg.svg +32 -0
- package/lib/components/Document/icons/exe.svg +20 -0
- package/lib/components/Document/icons/file.svg +11 -0
- package/lib/components/Document/icons/fla.svg +23 -0
- package/lib/components/Document/icons/html.svg +23 -0
- package/lib/components/Document/icons/image.svg +16 -0
- package/lib/components/Document/icons/iso.svg +40 -0
- package/lib/components/Document/icons/jpg.svg +33 -0
- package/lib/components/Document/icons/js.svg +40 -0
- package/lib/components/Document/icons/json.svg +45 -0
- package/lib/components/Document/icons/mod.svg +41 -0
- package/lib/components/Document/icons/mp3.svg +36 -0
- package/lib/components/Document/icons/mp4.svg +25 -0
- package/lib/components/Document/icons/pdf.svg +35 -0
- package/lib/components/Document/icons/png.svg +30 -0
- package/lib/components/Document/icons/ppt.svg +31 -0
- package/lib/components/Document/icons/psd.svg +50 -0
- package/lib/components/Document/icons/rtf.svg +35 -0
- package/lib/components/Document/icons/search.svg +20 -0
- package/lib/components/Document/icons/svg.svg +34 -0
- package/lib/components/Document/icons/txt.svg +29 -0
- package/lib/components/Document/icons/video.svg +17 -0
- package/lib/components/Document/icons/xls.svg +31 -0
- package/lib/components/Document/icons/xml.svg +25 -0
- package/lib/components/Document/icons/zip.svg +24 -0
- package/lib/components/Document/icons/zip1.svg +18 -0
- package/lib/components/Document/index.d.ts +3 -0
- package/lib/components/Document/index.js +3 -0
- package/lib/components/Programa/Annotations/Annotation.js +274 -0
- package/lib/components/Programa/Annotations/AnnotationsList.js +30 -0
- package/lib/components/Programa/Annotations/Input/FileInput.js +96 -0
- package/lib/components/Programa/Annotations/Input/Input.js +190 -0
- package/lib/components/Programa/Annotations/Input/PrivacySelection.js +72 -0
- package/lib/components/Programa/Annotations/Input/ReplyInformation.js +86 -0
- package/lib/components/Programa/Annotations/Input/UsersAutocomplete.js +122 -0
- package/lib/components/Programa/Annotations/index.js +136 -0
- package/lib/components/Programa/Annotations/utils.js +30 -0
- package/lib/components/Programa/Programa.d.ts +3 -1
- package/lib/components/Programa/Programa.js +20 -5
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.js +3 -1
- package/lib/utils/index.ts +112 -0
- package/package.json +3 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ArgousAvatar } from '../../../../components';
|
|
2
|
+
import { ANNOTATION_DATE_INDEX, ANNOTATION_TEXT_INDEX, ANNOTATION_USER_INDEX } from '../Annotation';
|
|
3
|
+
import { AVATAR_SIZE, AnswerIcon, EXTRA_SMALL_SIZE, MEDIUM_GREY_COLOR, SMALL_SIZE, UNIMED_GREEN_COLOR } from '../utils';
|
|
4
|
+
import { Typography, makeStyles } from '@material-ui/core';
|
|
5
|
+
import moment from 'moment';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const useStyles = makeStyles(theme => ({
|
|
10
|
+
replyInformation: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
alignItems: 'flex-end',
|
|
14
|
+
gap: SMALL_SIZE,
|
|
15
|
+
'&>div:nth-child(1)': {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
gap: SMALL_SIZE,
|
|
18
|
+
'&>h6': {
|
|
19
|
+
fontWeight: 500,
|
|
20
|
+
lineHeight: 1
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
'&>div:nth-child(2)': {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
gap: SMALL_SIZE,
|
|
27
|
+
'&>div:nth-child(1)': {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
justifyContent: 'flex-end',
|
|
30
|
+
gap: SMALL_SIZE,
|
|
31
|
+
'&>div:nth-child(1)': {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'flex-end',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
gap: EXTRA_SMALL_SIZE,
|
|
37
|
+
'&>h6': {
|
|
38
|
+
lineHeight: 1
|
|
39
|
+
},
|
|
40
|
+
'&>p': {
|
|
41
|
+
lineHeight: 1,
|
|
42
|
+
fontSize: '.75rem',
|
|
43
|
+
fontWeight: 500,
|
|
44
|
+
color: MEDIUM_GREY_COLOR(theme.palette.type)
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
'&>div:nth-child(2)': {
|
|
48
|
+
width: AVATAR_SIZE,
|
|
49
|
+
height: AVATAR_SIZE
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const ReplyInformation = ({ selectedAnnotation }) => {
|
|
58
|
+
|
|
59
|
+
const classes = useStyles();
|
|
60
|
+
const text = selectedAnnotation[ANNOTATION_TEXT_INDEX];
|
|
61
|
+
const user = { id: (selectedAnnotation[ANNOTATION_USER_INDEX]?.[0] || -1), name: (selectedAnnotation[ANNOTATION_USER_INDEX]?.[1] || '') };
|
|
62
|
+
const date = (selectedAnnotation[ANNOTATION_DATE_INDEX]) ? moment(selectedAnnotation[ANNOTATION_DATE_INDEX]).format('DD/MM/YYYY HH:mm:ss') : '';
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
return <div className={classes.replyInformation}>
|
|
66
|
+
<div>
|
|
67
|
+
<AnswerIcon color={UNIMED_GREEN_COLOR} size={16} />
|
|
68
|
+
<Typography variant='subtitle1'>Respondendo</Typography>
|
|
69
|
+
</div>
|
|
70
|
+
<div>
|
|
71
|
+
<div>
|
|
72
|
+
<div>
|
|
73
|
+
<Typography variant='subtitle2'>{user.name}</Typography>
|
|
74
|
+
<Typography variant='body2'>{date}</Typography>
|
|
75
|
+
</div>
|
|
76
|
+
<ArgousAvatar alt={`${user.name}-avatar`} idUsuario={user.id} nome={user.name} />
|
|
77
|
+
</div>
|
|
78
|
+
<div>
|
|
79
|
+
<Typography variant='body2' align='right'>{text}</Typography>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
export default ReplyInformation;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { searchUsers } from '../../../../api';
|
|
2
|
+
import { ArgousAvatar } from '../../../../components';
|
|
3
|
+
import { formataNome } from '../../../../utils';
|
|
4
|
+
import { setError } from '../../../../utils/api';
|
|
5
|
+
import { EXTRA_SMALL_SIZE, LARGE_SIZE, SMALL_SIZE } from '../utils';
|
|
6
|
+
import { Chip, TextField, makeStyles } from '@material-ui/core';
|
|
7
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const useStyles = makeStyles({
|
|
12
|
+
userAutocomplete: {
|
|
13
|
+
maxWidth: '100%'
|
|
14
|
+
},
|
|
15
|
+
usersAutocompleteInput: {
|
|
16
|
+
'&>div>input': {
|
|
17
|
+
minWidth: '137px !important',
|
|
18
|
+
padding: `${EXTRA_SMALL_SIZE}px !important`
|
|
19
|
+
},
|
|
20
|
+
'& .MuiAutocomplete-inputRoot[class*="MuiFilledInput-root"] .MuiAutocomplete-endAdornment': {
|
|
21
|
+
right: EXTRA_SMALL_SIZE
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
usersAutocompleteChip: {
|
|
25
|
+
height: LARGE_SIZE,
|
|
26
|
+
borderRadius: 0,
|
|
27
|
+
margin: EXTRA_SMALL_SIZE,
|
|
28
|
+
'&>span': {
|
|
29
|
+
padding: `0 ${SMALL_SIZE}px`
|
|
30
|
+
},
|
|
31
|
+
'&>svg': {
|
|
32
|
+
margin: `0 ${EXTRA_SMALL_SIZE}px 0 0`
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const UsersAutocomplete = ({ value = [], onChange = () => '', disabled = false }) => {
|
|
39
|
+
|
|
40
|
+
const classes = useStyles();
|
|
41
|
+
const [search, setSearch] = useState('');
|
|
42
|
+
const [users, setUsers] = useState([]);
|
|
43
|
+
|
|
44
|
+
async function getUsers(dsFiltroNome) {
|
|
45
|
+
const res = await searchUsers({ dsFiltroNome });
|
|
46
|
+
if (res.users?.length) setUsers(res.users || []);
|
|
47
|
+
else setError(res.dsErro);
|
|
48
|
+
}
|
|
49
|
+
useEffect(() => getUsers(search), [search]);
|
|
50
|
+
|
|
51
|
+
function handleOnChange (event, value, reason, details) {
|
|
52
|
+
(onChange) && onChange(event, value, reason, details);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Autocomplete
|
|
58
|
+
{...{ value, disabled }}
|
|
59
|
+
multiple
|
|
60
|
+
onChange={handleOnChange}
|
|
61
|
+
options={users.filter(user => value.indexOf(user) < 0)}
|
|
62
|
+
getOptionLabel={option => formataNome(option[1])}
|
|
63
|
+
getOptionSelected={(option, value) => (option?.[0] === value?.[0])}
|
|
64
|
+
noOptionsText='Não encontrado'
|
|
65
|
+
openText='Abrir'
|
|
66
|
+
closeText='Fechar'
|
|
67
|
+
clearText='Limpar'
|
|
68
|
+
renderTags={(value, getTagProps) => (
|
|
69
|
+
value.map((option, index) => {
|
|
70
|
+
|
|
71
|
+
const id = option?.[0];
|
|
72
|
+
const name = option?.[1];
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Chip
|
|
77
|
+
icon={(
|
|
78
|
+
<ArgousAvatar
|
|
79
|
+
alt={`${name} avatar`}
|
|
80
|
+
idUsuario={id}
|
|
81
|
+
nome={name}
|
|
82
|
+
style={{ height: 30, width: 30, margin: `0 0 0 ${EXTRA_SMALL_SIZE}px` }}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
label={option[1] || option}
|
|
86
|
+
{...getTagProps({ index })}
|
|
87
|
+
className={classes.usersAutocompleteChip}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
})
|
|
91
|
+
)}
|
|
92
|
+
renderInput={params => (
|
|
93
|
+
<TextField
|
|
94
|
+
id={params.id}
|
|
95
|
+
variant='filled'
|
|
96
|
+
placeholder='Selecione usuários'
|
|
97
|
+
fullWidth={params.fullWidth}
|
|
98
|
+
size={params.size}
|
|
99
|
+
disabled={params.disabled}
|
|
100
|
+
InputLabelProps={params.InputLabelProps}
|
|
101
|
+
InputProps={{
|
|
102
|
+
...params.InputProps,
|
|
103
|
+
disableUnderline: true,
|
|
104
|
+
style: {
|
|
105
|
+
height: '100%',
|
|
106
|
+
borderRadius: 4,
|
|
107
|
+
padding: `${EXTRA_SMALL_SIZE}px 62px ${EXTRA_SMALL_SIZE}px ${EXTRA_SMALL_SIZE}px`
|
|
108
|
+
}
|
|
109
|
+
}}
|
|
110
|
+
inputProps={params.inputProps}
|
|
111
|
+
value={search}
|
|
112
|
+
onChange={e => setSearch(e.target.value)}
|
|
113
|
+
className={classes.usersAutocompleteInput}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
className={classes.userAutocomplete}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
export default UsersAutocomplete;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import AnnotationsList from './AnnotationsList';
|
|
2
|
+
import Input from './Input/Input';
|
|
3
|
+
import { CloseIcon, EXTRA_SMALL_SIZE, MEDIUM_SIZE } from './utils';
|
|
4
|
+
import { getProgramAnnotations } from '../../../api';
|
|
5
|
+
import { useStore } from '../../../utils';
|
|
6
|
+
import { CircularProgress, Dialog, IconButton, Typography, makeStyles } from '@material-ui/core';
|
|
7
|
+
import React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
8
|
+
import { useImmerReducer } from 'use-immer';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const useStyles = makeStyles(() => ({
|
|
12
|
+
dialogContainer: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
gap: MEDIUM_SIZE,
|
|
16
|
+
padding: MEDIUM_SIZE,
|
|
17
|
+
overflowY: 'auto'
|
|
18
|
+
},
|
|
19
|
+
dialogHeader: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
alignItems: 'flex-start',
|
|
22
|
+
justifyContent: 'space-between',
|
|
23
|
+
gap: MEDIUM_SIZE,
|
|
24
|
+
'&>h6': {
|
|
25
|
+
lineHeight: 1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
dialogHeaderActions: {
|
|
29
|
+
position: 'relative',
|
|
30
|
+
'&>button': {
|
|
31
|
+
zIndex: 1,
|
|
32
|
+
padding: EXTRA_SMALL_SIZE
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
dialogHeaderLoading: {
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
inset: 0,
|
|
38
|
+
zIndex: 0
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const initialStateLoading = {
|
|
44
|
+
main: false,
|
|
45
|
+
save: false,
|
|
46
|
+
file: false
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const initialStateList = {
|
|
50
|
+
annotations: []
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const initialState = {
|
|
54
|
+
selectedAnnotation: [],
|
|
55
|
+
list: initialStateList,
|
|
56
|
+
loading: initialStateLoading,
|
|
57
|
+
printScreen: {}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const reducer = (state = initialState, { type, property, field, value }) => {
|
|
61
|
+
switch (type) {
|
|
62
|
+
default:
|
|
63
|
+
if (type && property && field) state[type][property][field] = value;
|
|
64
|
+
else if (type && field) state[type][field] = value;
|
|
65
|
+
else if (field) state[field] = value;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const AnnotationsContext = createContext(initialState);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
const Annotations = ({ open, proceed, onClose, code, pgTitle, annotationParameters, openAnnotationParameters }) => {
|
|
74
|
+
|
|
75
|
+
const classes = useStyles();
|
|
76
|
+
const { usuarioLogado: loggedUser } = useStore();
|
|
77
|
+
const dialogRef = useRef(null);
|
|
78
|
+
const [state, dispatch] = useImmerReducer(reducer, initialState);
|
|
79
|
+
const { loading, list } = state;
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const handleDialogClose = useCallback((event) => {
|
|
83
|
+
(proceed) && proceed();
|
|
84
|
+
(onClose) && onClose(event);
|
|
85
|
+
}, [proceed, onClose]);
|
|
86
|
+
|
|
87
|
+
const getAnnotations = useCallback(async (code) => {
|
|
88
|
+
dispatch({ type: 'loading', field: 'main', value: true });
|
|
89
|
+
|
|
90
|
+
const response = await getProgramAnnotations({ pgCode: code, ctrlPgn: {} });
|
|
91
|
+
(response?.status) && dispatch({ type: 'list', field: 'annotations', value: (response?.list || []) });
|
|
92
|
+
|
|
93
|
+
dispatch({ type: 'loading', field: 'main', value: false });
|
|
94
|
+
}, [dispatch]);
|
|
95
|
+
useEffect(() => getAnnotations(code), [code, getAnnotations]);
|
|
96
|
+
|
|
97
|
+
const scrollDialogToBottom = (event) => {
|
|
98
|
+
if (!dialogRef.current) return;
|
|
99
|
+
dialogRef.current.children[2].children[0].scroll({ top: dialogRef.current.offsetHeight, behavior: 'smooth' });
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const contextValues = useMemo(() => ({
|
|
103
|
+
...state,
|
|
104
|
+
code,
|
|
105
|
+
pgTitle,
|
|
106
|
+
loggedUser,
|
|
107
|
+
dialogRef,
|
|
108
|
+
annotationParameters,
|
|
109
|
+
openAnnotationParameters,
|
|
110
|
+
scrollDialogToBottom,
|
|
111
|
+
handleDialogClose,
|
|
112
|
+
dispatch
|
|
113
|
+
}), [code, pgTitle, annotationParameters, openAnnotationParameters, loggedUser, state, handleDialogClose, dispatch]);
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
return <AnnotationsContext.Provider value={contextValues}>
|
|
117
|
+
<Dialog {...{ open }} maxWidth='lg' disableRestoreFocus disableEnforceFocus ref={dialogRef} onClose={handleDialogClose}>
|
|
118
|
+
<div className={classes.dialogContainer}>
|
|
119
|
+
<div className={classes.dialogHeader}>
|
|
120
|
+
<Typography variant='h6'>Anotações {pgTitle}</Typography>
|
|
121
|
+
<div className={classes.dialogHeaderActions}>
|
|
122
|
+
<IconButton onClick={handleDialogClose}>
|
|
123
|
+
<CloseIcon />
|
|
124
|
+
</IconButton>
|
|
125
|
+
{(loading.main) && <CircularProgress color='secondary' size={34} className={classes.dialogHeaderLoading} />}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
{(!!list.annotations.length) && <AnnotationsList />}
|
|
129
|
+
<Input />
|
|
130
|
+
</div>
|
|
131
|
+
</Dialog>
|
|
132
|
+
</AnnotationsContext.Provider>;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
export default Annotations;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BsCheck2All } from 'react-icons/bs';
|
|
3
|
+
import { IoMdGlobe } from 'react-icons/io';
|
|
4
|
+
import { IoArrowUndoSharp, IoClose, IoLockClosed } from 'react-icons/io5';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const EXTRA_SMALL_SIZE = 5;
|
|
8
|
+
export const SMALL_SIZE = (EXTRA_SMALL_SIZE * 2);
|
|
9
|
+
export const MEDIUM_SIZE = (SMALL_SIZE * 2);
|
|
10
|
+
export const LARGE_SIZE = (MEDIUM_SIZE * 2);
|
|
11
|
+
export const AVATAR_SIZE = 33;
|
|
12
|
+
|
|
13
|
+
export const UNIMED_GREEN_COLOR = '#00995D';
|
|
14
|
+
export const LIGHT_GREY_COLOR = type => `rgba(${(type === 'light') ? '0, 0, 0' : '255, 255, 255'}, .12)`;
|
|
15
|
+
export const MEDIUM_GREY_COLOR = type => `rgba(${(type === 'light') ? '0, 0, 0' : '255, 255, 255'}, .6)`;
|
|
16
|
+
|
|
17
|
+
export const ViewedIcon = props => <BsCheck2All {...props} />;
|
|
18
|
+
export const AnswerIcon = props => <IoArrowUndoSharp {...props} />;
|
|
19
|
+
export const CloseIcon = props => <IoClose {...props} />;
|
|
20
|
+
|
|
21
|
+
export const privacyTypeOptions = [
|
|
22
|
+
['0', 'Público', IoMdGlobe],
|
|
23
|
+
['1', 'Privado', IoLockClosed]
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const ELLIPSIS_TEXT_STYLE = {
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
whiteSpace: 'nowrap',
|
|
29
|
+
textOverflow: 'ellipsis'
|
|
30
|
+
};
|
|
@@ -23,7 +23,9 @@ export interface ProgramaProps extends BoxProps {
|
|
|
23
23
|
bfHabFavorito: boolean,
|
|
24
24
|
bfTitulo: string,
|
|
25
25
|
linkCompartilhamento: string,
|
|
26
|
-
className: string
|
|
26
|
+
className: string,
|
|
27
|
+
annotationParameters?: object,
|
|
28
|
+
openAnnotationParameters?: (event: Event, parameters: object) => void
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
declare function Programa(props: ProgramaProps): JSX.Element
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import BarraFerramentas from './../BarraFerramentas';
|
|
2
|
+
import Annotations from './Annotations';
|
|
2
3
|
import PageCodeEasterEgg from './PageCodeEasterEgg';
|
|
3
4
|
import * as argous from '../../actions';
|
|
4
5
|
import { getProgram, toggleFavorite } from '../../api';
|
|
6
|
+
import { useModal } from '../../utils';
|
|
5
7
|
import { Box, CircularProgress, Paper, Typography, useTheme } from '@material-ui/core';
|
|
6
8
|
import PropTypes from 'prop-types';
|
|
7
9
|
import React, { useEffect, useState } from 'react';
|
|
8
10
|
import { FaExclamationTriangle } from 'react-icons/fa';
|
|
9
11
|
import { connect } from 'react-redux';
|
|
10
12
|
|
|
13
|
+
|
|
14
|
+
const initialStateToolbarLoading = {
|
|
15
|
+
annotations: false
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
|
|
11
19
|
function Programa({
|
|
12
20
|
code,
|
|
13
21
|
children,
|
|
@@ -38,14 +46,20 @@ function Programa({
|
|
|
38
46
|
rightSidebar,
|
|
39
47
|
setRightSidebar,
|
|
40
48
|
setAddProgramWidget,
|
|
49
|
+
annotationParameters = {},
|
|
50
|
+
openAnnotationParameters = () => '',
|
|
41
51
|
fields: _,
|
|
42
52
|
...props
|
|
43
53
|
}) {
|
|
54
|
+
|
|
55
|
+
const theme = useTheme();
|
|
56
|
+
const { createModal } = useModal();
|
|
57
|
+
const annotationsModal = createModal(Annotations);
|
|
44
58
|
const [programa, setPrograma] = useState({});
|
|
45
59
|
const [favoriteAnimationInsert, setFavoriteAnimationInsert] = useState(false);
|
|
46
60
|
const [favoriteAnimationRemove, setFavoriteAnimationRemove] = useState(false);
|
|
61
|
+
const [toolbarLoading/*, setToolbarLoading*/] = useState(initialStateToolbarLoading);
|
|
47
62
|
|
|
48
|
-
const theme = useTheme();
|
|
49
63
|
|
|
50
64
|
useEffect(() => {
|
|
51
65
|
(async () => {
|
|
@@ -53,13 +67,15 @@ function Programa({
|
|
|
53
67
|
const res = await getProgram(code);
|
|
54
68
|
// TODO prever aqui tempo de bloqueio diferenciado
|
|
55
69
|
if (res.pgmOk) setPrograma({ ...res.pgmDd, loaded: true, habWidget: res.habWidget });
|
|
56
|
-
else setPrograma(p => ({ ...p, dsErro: res.dsErro, loaded: true }));
|
|
70
|
+
else setPrograma(p => ({ ...p, dsErro: res.dsErro, loaded: true }));
|
|
57
71
|
programDidMount && programDidMount();
|
|
58
72
|
})();
|
|
59
73
|
return () => setCurrentProgram(undefined);
|
|
60
74
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
75
|
}, []);
|
|
62
76
|
|
|
77
|
+
const openAnnotations = async (event) => await annotationsModal({ ...programa, code, annotationParameters, openAnnotationParameters });
|
|
78
|
+
|
|
63
79
|
const addFavorite = () => {
|
|
64
80
|
const path = window.location.pathname;
|
|
65
81
|
toggleFavorite({ link: path }).then(res => {
|
|
@@ -87,7 +103,7 @@ function Programa({
|
|
|
87
103
|
return existIn.length > 0 ? 'active' : '';
|
|
88
104
|
};
|
|
89
105
|
|
|
90
|
-
let { pgHint, pgTitle, pnlTitle, dsErro, loaded } = programa;
|
|
106
|
+
let { pgHint, pgTitle, pnlTitle, dsErro, loaded, habWidget, snAnotacaoPrograma } = programa;
|
|
91
107
|
|
|
92
108
|
if (title !== undefined) pgTitle = title;
|
|
93
109
|
if (hint !== undefined) pgHint = hint;
|
|
@@ -125,8 +141,7 @@ function Programa({
|
|
|
125
141
|
favoriteAnimationRemove={favoriteAnimationRemove}
|
|
126
142
|
threads={threads}
|
|
127
143
|
currentProgram={code}
|
|
128
|
-
|
|
129
|
-
{...{ addWidget }}
|
|
144
|
+
{...{ addWidget, habWidget, snAnotacaoPrograma, openAnnotations, toolbarLoading }}
|
|
130
145
|
/>
|
|
131
146
|
{dsErro ? (
|
|
132
147
|
<Box textAlign='center' >
|
package/lib/components/index.js
CHANGED
package/lib/utils/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serverAction } from './api';
|
|
1
2
|
import { getStore } from './store';
|
|
2
3
|
import { getFileFromLink, headers } from '../api';
|
|
3
4
|
import { ModalProviderContext } from '../components/ConfirmModal/ModalProvider';
|
|
@@ -6,8 +7,10 @@ import { ActionType, ArgousType } from '../types';
|
|
|
6
7
|
import { useTheme } from '@material-ui/core';
|
|
7
8
|
import * as colors from '@material-ui/core/colors';
|
|
8
9
|
import { ChartOptions } from 'chart.js';
|
|
10
|
+
import DomToImage from 'dom-to-image';
|
|
9
11
|
import { BasicModalProps } from 'lib/components';
|
|
10
12
|
import { isNumber } from 'lodash';
|
|
13
|
+
import moment from 'moment';
|
|
11
14
|
import React, { useRef, useEffect, useContext, useState } from 'react';
|
|
12
15
|
|
|
13
16
|
|
|
@@ -386,4 +389,113 @@ export function cpfTest(cpf: (string|number)) {
|
|
|
386
389
|
if (rest !== parseInt(cpf.substring(10, 11))) return false;
|
|
387
390
|
|
|
388
391
|
return true;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
interface PrintScreenParameters {
|
|
395
|
+
/**
|
|
396
|
+
* Event
|
|
397
|
+
*/
|
|
398
|
+
event?: Event,
|
|
399
|
+
/**
|
|
400
|
+
* Element id
|
|
401
|
+
*/
|
|
402
|
+
id: string,
|
|
403
|
+
/**
|
|
404
|
+
* Auto download
|
|
405
|
+
*/
|
|
406
|
+
download: boolean
|
|
407
|
+
}
|
|
408
|
+
export const printScreen = async ({ event, id = 'root', download = false }: PrintScreenParameters): Promise<object> => {
|
|
409
|
+
let status = false;
|
|
410
|
+
let file;
|
|
411
|
+
let linkElement;
|
|
412
|
+
|
|
413
|
+
const element = document.getElementById(id);
|
|
414
|
+
if (element) {
|
|
415
|
+
|
|
416
|
+
const dataUrl = await DomToImage.toPng(element);
|
|
417
|
+
if (dataUrl) {
|
|
418
|
+
linkElement = document.createElement('a');
|
|
419
|
+
linkElement.download = `print_screen_${moment(new Date()).format('DD-MM-YYYY_HH:mm:ss')}.png`;
|
|
420
|
+
linkElement.href = dataUrl;
|
|
421
|
+
|
|
422
|
+
const blob = dataUrlToBlob(dataUrl);
|
|
423
|
+
if (blob) file = new File([blob], linkElement.download, { type: blob.type });
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
(linkElement && file) && (status = true);
|
|
428
|
+
(linkElement && download) && linkElement.click();
|
|
429
|
+
|
|
430
|
+
return { event, status, file, element, link: linkElement };
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
interface GeraLogInterface {
|
|
434
|
+
(
|
|
435
|
+
/**
|
|
436
|
+
* Id do documento
|
|
437
|
+
*/
|
|
438
|
+
idDocumento: number,
|
|
439
|
+
/**
|
|
440
|
+
* Descrição
|
|
441
|
+
*/
|
|
442
|
+
descricao: string,
|
|
443
|
+
/**
|
|
444
|
+
* Tipo de ação
|
|
445
|
+
*
|
|
446
|
+
* 1 - Upload
|
|
447
|
+
* 2 - Alteração
|
|
448
|
+
* 3 - Consulta
|
|
449
|
+
*/
|
|
450
|
+
tpAcao: string,
|
|
451
|
+
/**
|
|
452
|
+
* Token do sistema
|
|
453
|
+
*/
|
|
454
|
+
tokenSistema?: string
|
|
455
|
+
): Promise<void>
|
|
456
|
+
}
|
|
457
|
+
export const geraLog: GeraLogInterface = async (idDocumento, descricao, tpAcao, tokenSistema) => {
|
|
458
|
+
if (!getStore()?.getState()?.argous?.usuarioLogado?.idUsuario) return;
|
|
459
|
+
await serverAction('geraLog', { idDocumento, descricao, tpAcao }, 'CtrlDocumentos', false, tokenSistema);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export const printUrl = async (url: string): Promise<void> => {
|
|
463
|
+
const res = await fetch(url);
|
|
464
|
+
const file = await res.blob();
|
|
465
|
+
let iframe = document.createElement('iframe');
|
|
466
|
+
document.body.appendChild(iframe);
|
|
467
|
+
iframe.style.display = 'none';
|
|
468
|
+
iframe.src = window.URL.createObjectURL(file);
|
|
469
|
+
iframe.onload = () => {
|
|
470
|
+
setTimeout(() => {
|
|
471
|
+
iframe.focus();
|
|
472
|
+
iframe?.contentWindow?.print();
|
|
473
|
+
}, 1);
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
declare global {
|
|
478
|
+
interface Window {
|
|
479
|
+
clipboardData: any;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
export function stopPrntScr(e: KeyboardEvent) {
|
|
483
|
+
if (e.key === 'PrintScreen') {
|
|
484
|
+
e.preventDefault();
|
|
485
|
+
e.stopPropagation();
|
|
486
|
+
try {
|
|
487
|
+
window.clipboardData.setData('text', 'Access Restricted');
|
|
488
|
+
} catch (err) {}
|
|
489
|
+
}
|
|
490
|
+
let inpFld = document.createElement('input');
|
|
491
|
+
inpFld.setAttribute('value', '.');
|
|
492
|
+
inpFld.setAttribute('width', '0');
|
|
493
|
+
inpFld.style.height = '0px';
|
|
494
|
+
inpFld.style.width = '0px';
|
|
495
|
+
inpFld.style.border = '0px';
|
|
496
|
+
document.body.appendChild(inpFld);
|
|
497
|
+
inpFld.select();
|
|
498
|
+
document.execCommand('copy');
|
|
499
|
+
inpFld.remove();
|
|
500
|
+
return false;
|
|
389
501
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "argous",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.224",
|
|
4
4
|
"description": "Argous.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Carlos Schneider",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"chart.js": "^2.9.4",
|
|
38
38
|
"clsx": "^1.1.1",
|
|
39
39
|
"date-fns": "^2.19.0",
|
|
40
|
+
"dom-to-image": "^2.6.0",
|
|
40
41
|
"eslint": "^7.22.0",
|
|
41
42
|
"eslint-config-react-app": "^6.0.0",
|
|
42
43
|
"eslint-plugin-flowtype": "^5.4.0",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"chart.js": "*",
|
|
77
78
|
"clsx": "*",
|
|
78
79
|
"date-fns": "*",
|
|
80
|
+
"dom-to-image": "*",
|
|
79
81
|
"immer": "*",
|
|
80
82
|
"lodash": "*",
|
|
81
83
|
"moment": "*",
|