Beispiel #1
0
 def get(self, employeeKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         employee = EmployeeService.get(employeeKeyUrlSafe)
         template_values = {
             'employeeName' : employee.employeeName,
             'employeeKeyUrlSafe' : employeeKeyUrlSafe
         }
         template = JINJA_ENVIRONMENT.get_template('partials/employeeEdit.html')
         self.response.write(template.render(template_values))
     else:
         self.redirect('/')
Beispiel #2
0
 def get(self, employeeKeyUrlSafe):
     user = Authorization.isAuthenticated()
     if user:
         try:
             dateFrom = CalendarDetail.dateFrom
         except:
             dateFrom = DateService.getFirstDateOfMonth().strftime('%m/%d/%Y')
         try:
             dateTo = CalendarDetail.dateTo
         except:
             dateTo = DateService.getLastDateOfMonth().strftime('%m/%d/%Y')
         employee = EmployeeService.get(employeeKeyUrlSafe)
         clients = ClientService.getAll()
         lineItems = LineItemService.getAllInRangeForEmployee(employeeKeyUrlSafe, clients, dateFrom, dateTo)
         if lineItems == None:
             lineItems = []
         lineItemDates = []
         for lineItem in lineItems:
             if lineItem.dateOfService not in lineItemDates:
                 lineItemDates.append(lineItem.dateOfService)
         calendarLineItemViewModels = []
         for lineItemDate in lineItemDates:
             lineItemServices = []
             for lineItem in lineItems:
                 if lineItem.dateOfService == lineItemDate:
                     lineItemServices.append(lineItem.service)
             calendarLineItemViewModel = CalendarLineItem(lineItemDate, lineItemServices)
             calendarLineItemViewModels.append(calendarLineItemViewModel)
         template_values = {
             'dateFrom' : dateFrom,
             'dateTo' : dateTo,
             'employee' : employee,
             'calendarLineItemViewModels' : calendarLineItemViewModels
         }
         template = JINJA_ENVIRONMENT.get_template('partials/calendarDetail.html')
         self.response.write(template.render(template_values))
     else:
         self.redirect('/')