1 | ## $Id: interfaces.py 16385 2021-01-25 12:37:04Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | |
---|
19 | from zope import schema |
---|
20 | from waeup.kofa.interfaces import validate_email, IKofaObject |
---|
21 | from waeup.kofa.students.vocabularies import StudyLevelSource |
---|
22 | from kofacustom.nigeria.students.interfaces import ( |
---|
23 | INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, |
---|
24 | INigeriaStudentPersonal, INigeriaStudentPersonalEdit, |
---|
25 | INigeriaStudentStudyLevel, |
---|
26 | INigeriaStudentStudyCourse, INigeriaCourseTicket, |
---|
27 | INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, |
---|
28 | ) |
---|
29 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
30 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
31 | |
---|
32 | class ICustomStudentBase(INigeriaStudentBase): |
---|
33 | """Representation of student base data. |
---|
34 | """ |
---|
35 | |
---|
36 | library = schema.Bool( |
---|
37 | title = _(u'Library Id Card'), |
---|
38 | default = False, |
---|
39 | required = False, |
---|
40 | ) |
---|
41 | |
---|
42 | email2 = schema.ASCIILine( |
---|
43 | title = _(u'Institution Email'), |
---|
44 | required = False, |
---|
45 | constraint=validate_email, |
---|
46 | ) |
---|
47 | |
---|
48 | ICustomStudentBase['email2'].order = ICustomStudentBase[ |
---|
49 | 'phone'].order |
---|
50 | ICustomStudentBase['phone'].order = ICustomStudentBase[ |
---|
51 | 'email'].order |
---|
52 | |
---|
53 | class IMedicalHistory(IKofaObject): |
---|
54 | """Students Medical History Questionnaire. |
---|
55 | """ |
---|
56 | |
---|
57 | medical_updated = schema.Datetime( |
---|
58 | title = _(u'Last updated'), |
---|
59 | required = False, |
---|
60 | readonly = False, |
---|
61 | ) |
---|
62 | |
---|
63 | # History of Symptoms |
---|
64 | |
---|
65 | fever = schema.Bool( |
---|
66 | title = _(u'Fever'), |
---|
67 | default = False, |
---|
68 | required = True, |
---|
69 | ) |
---|
70 | |
---|
71 | headaches = schema.Bool( |
---|
72 | title = _(u'Headaches'), |
---|
73 | default = False, |
---|
74 | required = True, |
---|
75 | ) |
---|
76 | |
---|
77 | catarrh = schema.Bool( |
---|
78 | title = _(u'Catarrh'), |
---|
79 | default = False, |
---|
80 | required = True, |
---|
81 | ) |
---|
82 | |
---|
83 | cough = schema.Bool( |
---|
84 | title = _(u'Cough'), |
---|
85 | default = False, |
---|
86 | required = True, |
---|
87 | ) |
---|
88 | |
---|
89 | sore_throat = schema.Bool( |
---|
90 | title = _(u'Sore throat'), |
---|
91 | default = False, |
---|
92 | required = True, |
---|
93 | ) |
---|
94 | |
---|
95 | breathing = schema.Bool( |
---|
96 | title = _(u'Difficulty with breathing'), |
---|
97 | default = False, |
---|
98 | required = True, |
---|
99 | ) |
---|
100 | |
---|
101 | sneezing = schema.Bool( |
---|
102 | title = _(u'Sneezing'), |
---|
103 | default = False, |
---|
104 | required = True, |
---|
105 | ) |
---|
106 | |
---|
107 | weakness = schema.Bool( |
---|
108 | title = _(u'Weakness/tiredness'), |
---|
109 | default = False, |
---|
110 | required = True, |
---|
111 | ) |
---|
112 | |
---|
113 | body_pains = schema.Bool( |
---|
114 | title = _(u'Body pains'), |
---|
115 | default = False, |
---|
116 | required = True, |
---|
117 | ) |
---|
118 | |
---|
119 | smell = schema.Bool( |
---|
120 | title = _(u'Loss of smell (inability to smell)'), |
---|
121 | default = False, |
---|
122 | required = True, |
---|
123 | ) |
---|
124 | |
---|
125 | taste = schema.Bool( |
---|
126 | title = _(u'Loss of taste'), |
---|
127 | default = False, |
---|
128 | required = True, |
---|
129 | ) |
---|
130 | |
---|
131 | # Medical History |
---|
132 | |
---|
133 | asthma = schema.Bool( |
---|
134 | title = _(u'Asthma'), |
---|
135 | default = False, |
---|
136 | required = True, |
---|
137 | ) |
---|
138 | |
---|
139 | hypertension = schema.Bool( |
---|
140 | title = _(u'Hypertension'), |
---|
141 | default = False, |
---|
142 | required = True, |
---|
143 | ) |
---|
144 | |
---|
145 | diabetes = schema.Bool( |
---|
146 | title = _(u'Diabetes'), |
---|
147 | default = False, |
---|
148 | required = True, |
---|
149 | ) |
---|
150 | |
---|
151 | obesity = schema.Bool( |
---|
152 | title = _(u'Obesity'), |
---|
153 | default = False, |
---|
154 | required = True, |
---|
155 | ) |
---|
156 | |
---|
157 | others = schema.TextLine( |
---|
158 | title = _(u'Others'), |
---|
159 | required = False, |
---|
160 | ) |
---|
161 | |
---|
162 | medicines = schema.TextLine( |
---|
163 | title = _(u'Are you on a regular medication? If yes, list the medicines'), |
---|
164 | required = False, |
---|
165 | ) |
---|
166 | |
---|
167 | # Travel History |
---|
168 | |
---|
169 | lagos_abuja = schema.Bool( |
---|
170 | title = _(u'Have you travelled to Lagos or Abuja in the last two weeks?'), |
---|
171 | default = False, |
---|
172 | required = True, |
---|
173 | ) |
---|
174 | |
---|
175 | outside = schema.Bool( |
---|
176 | title = _(u'Have you travelled outside the country in the last 4 weeks?'), |
---|
177 | default = False, |
---|
178 | required = True, |
---|
179 | ) |
---|
180 | |
---|
181 | # History of contact/infection |
---|
182 | |
---|
183 | company_suspected = schema.Bool( |
---|
184 | title = _(u'Were you in the company of a suspected case of COVID 19 in the last two weeks?'), |
---|
185 | default = False, |
---|
186 | required = True, |
---|
187 | ) |
---|
188 | |
---|
189 | company_confirmed = schema.Bool( |
---|
190 | title = _(u'Were you in the company of a confirmed case of COVID 19 in the last two weeks?'), |
---|
191 | default = False, |
---|
192 | required = True, |
---|
193 | ) |
---|
194 | |
---|
195 | positive = schema.Bool( |
---|
196 | title = _(u'Have you had a positive COVID 19 test done?'), |
---|
197 | default = False, |
---|
198 | required = True, |
---|
199 | ) |
---|
200 | |
---|
201 | negative = schema.Bool( |
---|
202 | title = _(u'Have you had a negative COVID 19 test done?'), |
---|
203 | default = False, |
---|
204 | required = True, |
---|
205 | ) |
---|
206 | |
---|
207 | vaccination = schema.Bool( |
---|
208 | title = _(u'Have you had COVID 19 vaccination?'), |
---|
209 | default = False, |
---|
210 | required = True, |
---|
211 | ) |
---|
212 | |
---|
213 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
---|
214 | """Student personal data. |
---|
215 | """ |
---|
216 | |
---|
217 | parent_email = schema.ASCIILine( |
---|
218 | title = _(u'Parent Email'), |
---|
219 | required = False, |
---|
220 | constraint=validate_email, |
---|
221 | ) |
---|
222 | |
---|
223 | class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit): |
---|
224 | """Interface for editing personal data by students. |
---|
225 | """ |
---|
226 | |
---|
227 | parent_email = schema.ASCIILine( |
---|
228 | title = _(u'Parent Email'), |
---|
229 | required = False, |
---|
230 | constraint=validate_email, |
---|
231 | ) |
---|
232 | |
---|
233 | class ICustomUGStudentClearance(INigeriaUGStudentClearance): |
---|
234 | """Representation of ug student clearance data. |
---|
235 | """ |
---|
236 | |
---|
237 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
238 | """Representation of pg student clearance data. |
---|
239 | """ |
---|
240 | |
---|
241 | class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance, |
---|
242 | ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory): |
---|
243 | """Representation of a student. |
---|
244 | """ |
---|
245 | |
---|
246 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
247 | """A container for student study levels. |
---|
248 | """ |
---|
249 | |
---|
250 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
251 | """A container for course tickets. |
---|
252 | """ |
---|
253 | |
---|
254 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
255 | """A student payment via payment gateways. |
---|
256 | |
---|
257 | This Interface does not inherit from IStudentOnlinePayment. |
---|
258 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
259 | """ |
---|
260 | |
---|
261 | p_current = schema.Bool( |
---|
262 | title = _(u'Current Session Payment'), |
---|
263 | default = True, |
---|
264 | required = False, |
---|
265 | ) |
---|
266 | |
---|
267 | p_level = schema.Choice( |
---|
268 | title = _(u'Payment Level'), |
---|
269 | source = StudyLevelSource(), |
---|
270 | required = False, |
---|
271 | ) |
---|
272 | |
---|
273 | staff_rebate = schema.Bool( |
---|
274 | title = _(u'Staff Rebate Payment'), |
---|
275 | default = False, |
---|
276 | required = False, |
---|
277 | ) |
---|
278 | |
---|
279 | rebate_amount = schema.Float( |
---|
280 | title = _(u'Rebate'), |
---|
281 | default = 0.0, |
---|
282 | required = False, |
---|
283 | readonly = False, |
---|
284 | ) |
---|
285 | |
---|
286 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
287 | 'p_session'].order |
---|
288 | |
---|
289 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
290 | """A course ticket. |
---|
291 | """ |
---|
292 | |
---|
293 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
294 | """Representation of a student. Skip regular reg_number validation. |
---|
295 | """ |
---|
296 | |
---|
297 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
298 | """Representation of a student. Skip regular matric_number validation. |
---|
299 | """ |
---|