BottleInfoPresenter.tsx
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import React from 'react';
import HighCharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';
import Modal from '../../components/Modal';
import * as styled from './BottleInfoStyled';
const plus = '/static/img/plus.png';
interface BottleInfoProps {
bottleInfo : {
feedbackList : any[];
medicine : any;
bottleId : number;
takeMedicineHist : any[];
};
chartOption : any;
takeMedicineHist : any[];
medicineInfoModal : boolean;
modalType : string;
onViewTakeHist : () => void;
onViewMedicineInfo : () => void;
setMedicineInfoModal : (arg0 : boolean) => void;
feedback : string;
onSetFeedback : React.ChangeEventHandler<HTMLTextAreaElement>;
fdbType : string;
setFdbType : (arg0 : string) => void;
onSubmitFeedback : () => void;
}
const BottleInfoPresenter = (props : BottleInfoProps) => {
return (
<styled.Container>
{
props.medicineInfoModal ?
<Modal onModalClose = {() => props.setMedicineInfoModal(false)}>
<>
<styled.ModalTypeButtonWrapper>
<styled.ModalTypeButton
isSelect = {props.modalType === 'hist'}
onClick = {props.onViewTakeHist}
>
복용 기록
</styled.ModalTypeButton>
<styled.ModalTypeButton
isSelect = {props.modalType === 'info'}
onClick = {props.onViewMedicineInfo}
>
약 정보
</styled.ModalTypeButton>
</styled.ModalTypeButtonWrapper>
{
props.modalType === 'hist' ?
<>
<styled.MedicineNameWrapper>
<styled.MedicineName>{`복용 기록`}</styled.MedicineName>
<styled.MedicineName style = {{color : '#343434', fontSize : 15, marginTop : 4,}}>{`전체 : ${props.takeMedicineHist.length}건`}</styled.MedicineName>
</styled.MedicineNameWrapper>
<styled.MedicineInfoWrapper>
{
props.takeMedicineHist.map((hist : any) => {
return (
<styled.HistWrapper
key = {hist._id}
>
<styled.HistDtmWrapper>
<styled.HistInfoEachWrapper style = {{fontSize : 11}}>복용 날짜</styled.HistInfoEachWrapper>
<styled.HistDtm>{hist.takeDate}</styled.HistDtm>
</styled.HistDtmWrapper>
<styled.HistInfoWrapper>
<styled.HistInfoEachWrapper>
복용량
<styled.HistInfoEach>{hist.dosage}회분</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
<styled.HistInfoEachWrapper>
약병 내 온도
<styled.HistInfoEach>{hist.temperature}℃</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
<styled.HistInfoEachWrapper>
약병 내 습도
<styled.HistInfoEach>{hist.humidity}%</styled.HistInfoEach>
</styled.HistInfoEachWrapper>
</styled.HistInfoWrapper>
</styled.HistWrapper>
)
})
}
</styled.MedicineInfoWrapper>
</> :
<>
<styled.MedicineNameWrapper>
<styled.MedicineName>{props.bottleInfo.medicine.name}</styled.MedicineName>
<styled.MedicineName style = {{color : '#343434', fontSize : 15, marginTop : 4,}}>{props.bottleInfo.medicine.company}</styled.MedicineName>
</styled.MedicineNameWrapper>
<styled.MedicineInfoWrapper>
<styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoTitle>효능</styled.MedicineEachInfoTitle>
<styled.MedicineEachInfo>{props.bottleInfo.medicine.target}</styled.MedicineEachInfo>
</styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoTitle>복용 정보</styled.MedicineEachInfoTitle>
<styled.MedicineEachInfo>{props.bottleInfo.medicine.dosage}</styled.MedicineEachInfo>
</styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoTitle style = {{color : '#FF3F3F', fontWeight : 'bold'}}>주의 사항</styled.MedicineEachInfoTitle>
<styled.MedicineEachInfo style = {{color : '#9B0000'}}>{props.bottleInfo.medicine.warn}</styled.MedicineEachInfo>
</styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoWrapper>
<styled.MedicineEachInfoTitle style = {{color : '#FF3F3F', fontWeight : 'bold'}}>부작용</styled.MedicineEachInfoTitle>
<styled.MedicineEachInfo style = {{color : '#9B0000'}}>{props.bottleInfo.medicine.antiEffect}</styled.MedicineEachInfo>
</styled.MedicineEachInfoWrapper>
</styled.MedicineInfoWrapper>
</>
}
</>
</Modal> : null
}
<styled.ChartAndFeedbackWrapper>
<styled.ChartWrapper>
<styled.MedicineDetailViewButtonWrapper>
<styled.MedicineDetailViewButton
onClick = {() => props.setMedicineInfoModal(true)}
>
<styled.MedicineDetailViewButtonImg src = {plus}/>
</styled.MedicineDetailViewButton>
</styled.MedicineDetailViewButtonWrapper>
<HighchartsReact
highCharts = {HighCharts}
options = {props.chartOption}
/>
</styled.ChartWrapper>
<styled.FeedbackWrapper>
<styled.FeedbackInfoTitle>피드백 내역</styled.FeedbackInfoTitle>
{
props.bottleInfo.feedbackList.map((feedback : any) => {
return (
<styled.FeedbackEachItemWrapper
key = {feedback._id}
>
<styled.FeedbackType fdbType = {feedback.fdbType}/>
<styled.FeedbackTitle>{feedback.feedback}</styled.FeedbackTitle>
<styled.FeedbackDtm>등록일<br/>{feedback.fdbDtm}</styled.FeedbackDtm>
</styled.FeedbackEachItemWrapper>
)
})
}
</styled.FeedbackWrapper>
</styled.ChartAndFeedbackWrapper>
<styled.NewFeedbackRegWrapper>
<styled.NewFeedbackRegInput
value = {props.feedback}
onChange = {props.onSetFeedback}
/>
<styled.NewFeedbackButtonWrapper>
<styled.NewFeedbackTypeButtonWrapper>
<styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButton
valueType = 'RECOMMEND'
selected = {props.fdbType === 'RECOMMEND'}
onClick = {() => props.setFdbType('RECOMMEND')}
/>
<styled.NewFeedbackTypeButtonText>권고</styled.NewFeedbackTypeButtonText>
</styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButton
valueType = 'CAUTION'
selected = {props.fdbType === 'CAUTION'}
onClick = {() => props.setFdbType('CAUTION')}
/>
<styled.NewFeedbackTypeButtonText>주의</styled.NewFeedbackTypeButtonText>
</styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButton
valueType = 'WARN'
selected = {props.fdbType === 'WARN'}
onClick = {() => props.setFdbType('WARN')}
/>
<styled.NewFeedbackTypeButtonText>경고</styled.NewFeedbackTypeButtonText>
</styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButtonEachWrapper>
<styled.NewFeedbackTypeButton
valueType = 'CRITICAL'
selected = {props.fdbType === 'CRITICAL'}
onClick = {() => props.setFdbType('CRITICAL')}
/>
<styled.NewFeedbackTypeButtonText>치명</styled.NewFeedbackTypeButtonText>
</styled.NewFeedbackTypeButtonEachWrapper>
</styled.NewFeedbackTypeButtonWrapper>
<styled.NewFeedbackRegButton
onClick = {props.onSubmitFeedback}
>
<styled.NewFeedbackRegButtonText>피드백<br/>등록</styled.NewFeedbackRegButtonText>
</styled.NewFeedbackRegButton>
</styled.NewFeedbackButtonWrapper>
</styled.NewFeedbackRegWrapper>
</styled.Container>
);
};
export default BottleInfoPresenter;