## $Id: interfaces.py 12536 2015-02-01 07:30:33Z henrik $ ## ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## from zope import schema from datetime import datetime from zc.sourcefactory.basic import BasicSourceFactory from waeup.ikoba.interfaces import IIkobaObject from waeup.ikoba.customers.interfaces import ( ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract, validate_email) from waeup.ikoba.customers.vocabularies import ( ConCatProductSource, CustomerDocumentSource, nats_vocab) from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber from waeup.ikoba.products.productoptions import ProductOptionField from ikobacustom.pcn.interfaces import MessageFactory as _ from ikobacustom.pcn.interfaces import LGASource def year_range(): curr_year = datetime.now().year return range(curr_year - 2, curr_year + 5) class PracticeSource(BasicSourceFactory): """A source for categories of practice. """ def getValues(self): return [ 'academic', 'administrative', 'distribution', 'importation', 'manufacturing', 'retail and dispensing', 'wholesale', ] class IPCNCustomer(ICustomer): """Representation of a customer. """ date_of_birth = FormattedDate( title = _(u'Date of Birth'), required = True, show_year = True, ) # Customer document interfaces class IPCNCustomerJPGDocument(ICustomerDocument): """A customer jpg document. """ class IPCNCustomerPDFDocument(ICustomerPDFDocument): """A customer pdf document. """ # Customer contract interfaces class IRONContract(IContract): """A Retention of Name contract. """ state_of_origin = schema.Choice( vocabulary = nats_vocab, title = _(u'State of Origin'), required = False, ) lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = True, ) year_qualification = schema.Choice( title = _(u'Year of Qualification'), required = True, values = year_range(), ) res_address = schema.Text( title = _(u'Residential Address'), required = True, ) res_address = schema.Text( title = _(u'Residential Address'), required = False, ) work_address = schema.Text( title = _(u'Work Address'), required = False, ) work_email = schema.ASCIILine( title = _(u'Work Email Address'), required = False, constraint=validate_email, ) work_phone = PhoneNumber( title = _(u'Work Phone'), description = u'', required = False, ) categories_practice = schema.List( title = _(u'Categories of Practice'), value_type = schema.Choice(source=PracticeSource()), required = False, default = [], ) superintendent = schema.Bool( title= _('Superintendent'), description= _('Tick box if you are a superintendent pharamcist.'), required = False, ) #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = False, # ) class IRONContractOfficialUse(IIkobaObject): """Interface for editing RON official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IRONContractProcess(IRONContract, IRONContractOfficialUse): """Interface for processing RON data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IRONContractEdit(IRONContract): """Interface for editing RON data by customers. """ #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = True, # ) class IROPContract(IContract): """A Registration of Premises contract. """ premises_address = schema.Text( title = _(u'Name and Address of Pharmaceutical Premises'), required = True, ) categories_practice = schema.List( title = _(u'Categories of Practice'), value_type = schema.Choice(source=PracticeSource()), required = False, default = [], ) premises_certificate = schema.TextLine( title = _(u'Last Premises Certificate'), description= _('If an old premises, state the last premises certificate number issued with date.'), required = False, ) date_of_qualification = FormattedDate( title = _(u'Date of Qualification'), required = False, show_year = True, ) res_address = schema.Text( title = _(u'Residential Address'), required = False, ) last_license_number = schema.TextLine( title = _(u'Last Annual License Number'), required = False, ) superintendent = schema.Bool( title= _('Superintendent'), description= _('Tick box if you were a superintendent pharamcist last year.'), required = False, ) work_address = schema.Text( title = _(u'Full Time Employment Address'), description= _('Enter work address if you were not a superintendent pharamcist last year.'), required = False, ) pharmacists_directors= schema.TextLine( title = _(u'Pharmacist Directors'), description = _(u'Full name of directors and their profession as in Form C.O.7'), required = False, ) other_directors= schema.TextLine( title = _(u'Other Directors'), description = _(u'Full name of directors and their profession as in Form C.O.7'), required = False, ) #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = False, # ) class IROPContractOfficialUse(IIkobaObject): """Interface for editing ROP official use data. """ inspected = schema.Bool( title = _('Inspected'), description = _('Has the premises been duly inspected?'), required = False, ) recommended = schema.Bool( title = _('Recommended'), description= _('Is the premises recommended?'), required = False, ) official_in_state = schema.TextLine( title = _(u'Name of Official in the State'), required = False, ) class IROPContractProcess(IROPContract, IROPContractOfficialUse): """Interface for processing RON data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IROPContractEdit(IROPContract): """Interface for editing RON data by customers. """ #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = True, # )