source: main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/applicants/browser.py @ 10822

Last change on this file since 10822 was 10800, checked in by Henrik Bettermann, 11 years ago

Issoufou's suggested workflow:

  1. Apply for service (new customer who wants a connection at his residence)
  2. Ekodisco has the capacity to provide that services (approval)
  3. Applicant is now customer, can pay for the services and select the type of meter he wants...
  4. Customer now login and try to pay base on the type of meter he has
  5. Customer can login and print his receipts.

That means we need different entities: applicants and customers. Customers are the students in Kofa.

Step 1 and 2 are implemented in this revision. 3-4 will follow.

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1## $Id: browser.py 10800 2013-11-28 09:23:57Z henrik $
2##
3## Copyright (C) 2011 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"""UI components for basic applicants and related components.
19"""
20import grok
21from hurry.workflow.interfaces import IWorkflowState
22from zope.formlib.textwidgets import BytesDisplayWidget
23from waeup.kofa.applicants.browser import (
24    ApplicantRegistrationPage, ApplicantsContainerPage)
25from waeup.kofa.applicants.pdf import PDFApplicationSlip
26from kofacustom.ekodisco.applicants.interfaces import (
27    ICustomApplicant, ICustomApplicantEdit)
28from kofacustom.nigeria.applicants.browser import (
29    NigeriaApplicantDisplayFormPage,
30    ApplicantDisplayFormPage,
31    ApplicantManageFormPage,
32    ApplicantEditFormPage)
33
34
35from kofacustom.ekodisco.applicants.workflow import STARTED
36
37from kofacustom.ekodisco.interfaces import MessageFactory as _
38
39class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
40    """A display view for applicant data.
41    """
42    grok.template('applicantdisplaypage')
43
44    form_fields = grok.AutoFields(ICustomApplicant).omit(
45        'locked', 'course_admitted', 'password', 'suspended',
46        'course2', 'notice', 'student_id', 'sex')
47
48    form_fields['perm_address'].custom_widget = BytesDisplayWidget
49    form_fields['service_address'].custom_widget = BytesDisplayWidget
50
51class CustomApplicantManageFormPage(ApplicantManageFormPage):
52    """A full edit view for applicant data.
53    """
54    grok.template('applicanteditpage')
55
56    form_fields = grok.AutoFields(ICustomApplicant).omit(
57        'course2', 'notice', 'student_id', 'sex')
58    form_fields['applicant_id'].for_display = True
59
60class CustomApplicantEditFormPage(ApplicantEditFormPage):
61    """An applicant-centered edit view for applicant data.
62    """
63    grok.template('applicanteditpage')
64
65    form_fields = grok.AutoFields(ICustomApplicantEdit).omit(
66        'locked', 'course_admitted', 'student_id',
67        'suspended', 'course2', 'notice', 'sex'
68        )
69    form_fields['applicant_id'].for_display = True
70    form_fields['reg_number'].for_display = True
71
72    submit_state = STARTED
73
74    @property
75    def display_actions(self):
76        state = IWorkflowState(self.context).getState()
77        actions = [[],[]]
78        if state == STARTED:
79            actions = [[_('Save'), _('Final Submit')], []]
80        return actions
81
82class CustomPDFApplicationSlip(PDFApplicationSlip):
83    """Bypass NigeriaPDFApplicationSlip
84    """
Note: See TracBrowser for help on using the repository browser.