1 | ## $Id: interfaces.py 12485 2015-01-18 08:59:35Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2014 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 datetime import datetime |
---|
21 | from waeup.ikoba.customers.interfaces import ( |
---|
22 | ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract, |
---|
23 | validate_email) |
---|
24 | from waeup.ikoba.customers.vocabularies import ( |
---|
25 | ConCatProductSource, CustomerDocumentSource, nats_vocab) |
---|
26 | from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber |
---|
27 | from waeup.ikoba.products.productoptions import ProductOptionField |
---|
28 | from ikobacustom.pcn.interfaces import MessageFactory as _ |
---|
29 | from ikobacustom.pcn.interfaces import LGASource |
---|
30 | |
---|
31 | def year_range(): |
---|
32 | curr_year = datetime.now().year |
---|
33 | return range(curr_year - 2, curr_year + 5) |
---|
34 | |
---|
35 | class IPCNCustomer(ICustomer): |
---|
36 | """Representation of a customer. |
---|
37 | |
---|
38 | """ |
---|
39 | |
---|
40 | # Customer document interfaces |
---|
41 | |
---|
42 | |
---|
43 | class IPCNCustomerJPGDocument(ICustomerDocument): |
---|
44 | """A customer jpg document. |
---|
45 | |
---|
46 | """ |
---|
47 | |
---|
48 | class IPCNCustomerPDFDocument(ICustomerPDFDocument): |
---|
49 | """A customer pdf document. |
---|
50 | |
---|
51 | """ |
---|
52 | |
---|
53 | # Customer contract interfaces |
---|
54 | |
---|
55 | class IRONContract(IContract): |
---|
56 | """A Retention Of Name contract. |
---|
57 | |
---|
58 | """ |
---|
59 | |
---|
60 | date_of_birth = FormattedDate( |
---|
61 | title = _(u'Date of Birth'), |
---|
62 | required = True, |
---|
63 | show_year = True, |
---|
64 | ) |
---|
65 | |
---|
66 | state_of_origin = schema.Choice( |
---|
67 | vocabulary = nats_vocab, |
---|
68 | title = _(u'State of Origin'), |
---|
69 | required = False, |
---|
70 | ) |
---|
71 | |
---|
72 | lga = schema.Choice( |
---|
73 | source = LGASource(), |
---|
74 | title = _(u'State / LGA'), |
---|
75 | required = True, |
---|
76 | ) |
---|
77 | |
---|
78 | year_qualification = schema.Choice( |
---|
79 | title = _(u'Year of Qualification'), |
---|
80 | required = True, |
---|
81 | values = year_range(), |
---|
82 | ) |
---|
83 | |
---|
84 | res_address = schema.Text( |
---|
85 | title = _(u'Residential Address'), |
---|
86 | required = True, |
---|
87 | ) |
---|
88 | |
---|
89 | res_address = schema.Text( |
---|
90 | title = _(u'Residential Address'), |
---|
91 | required = False, |
---|
92 | ) |
---|
93 | |
---|
94 | work_address = schema.Text( |
---|
95 | title = _(u'Work Address'), |
---|
96 | required = False, |
---|
97 | ) |
---|
98 | |
---|
99 | work_email = schema.ASCIILine( |
---|
100 | title = _(u'Work Email Address'), |
---|
101 | required = False, |
---|
102 | constraint=validate_email, |
---|
103 | ) |
---|
104 | |
---|
105 | work_phone = PhoneNumber( |
---|
106 | title = _(u'Work Phone'), |
---|
107 | description = u'', |
---|
108 | required = False, |
---|
109 | ) |
---|
110 | |
---|
111 | category_practice = schema.TextLine( |
---|
112 | title = _(u'Category of Practice'), |
---|
113 | description = _(u'academic, retail and dispensing, hospital, administrative, wholesale, importation, manufacturing, etc.'), |
---|
114 | required = False, |
---|
115 | ) |
---|
116 | |
---|
117 | superintendent = schema.Bool( |
---|
118 | title= _('Superintendent'), |
---|
119 | description= _('Tick box if you are a superintendent pharamcist.'), |
---|
120 | required = False, |
---|
121 | ) |
---|
122 | |
---|
123 | #document_object = schema.Choice( |
---|
124 | # title = _(u'Document'), |
---|
125 | # source = CustomerDocumentSource(), |
---|
126 | # required = False, |
---|
127 | # ) |
---|
128 | |
---|
129 | class IRONContractProcess(IRONContract): |
---|
130 | """Interface for processing RON data. |
---|
131 | """ |
---|
132 | |
---|
133 | product_options = schema.List( |
---|
134 | title = _(u'Options/Fees'), |
---|
135 | value_type = ProductOptionField(), |
---|
136 | required = False, |
---|
137 | readonly = False, |
---|
138 | default = [], |
---|
139 | ) |
---|
140 | |
---|
141 | class IRONContractEdit(IRONContract): |
---|
142 | """Interface for editing RON data by customers. |
---|
143 | |
---|
144 | """ |
---|
145 | |
---|
146 | product_object = schema.Choice( |
---|
147 | title = _(u'Product'), |
---|
148 | source = ConCatProductSource(), |
---|
149 | required = True, |
---|
150 | ) |
---|
151 | |
---|
152 | #document_object = schema.Choice( |
---|
153 | # title = _(u'Document'), |
---|
154 | # source = CustomerDocumentSource(), |
---|
155 | # required = True, |
---|
156 | # ) |
---|