def index(self): default_alert = model.Company.foxAlert() if default_alert == False: default_alert = { 'title': "Give us feedback!", 'message': render('/foxhelper/default.html') } c.alert = default_alert return render('/foxhelper/index.html')
def activate(self, id): if request.environ.get('REMOTE_USER'): redirect('/signout#/activate/{0}'.format(id)) c.activation_code = 'fake' if model.Manager.get_user_by_activation_code(id): c.activation_code = id return render('/activate.html')
def manage(self): c.menuAccount = 'on' c.manager = model.Manager.get_manager_with_username(request.environ.get("REMOTE_USER")) c.created = c.manager.created.strftime("%B %d, %Y") c.propertiesOwned = len(request.environ.get('PROPERTY_LIST')) c.propertyLabel = c.propertiesOwned == 1 and 'property' or 'properties' return render('/account_manage.html')
def index(self, propertyId=None): if propertyId: c.curPropId = propertyId c.curPropName = model.Property.get_name_by_id(propertyId) c.menuProperty = 'on' c.foxAlert = False return render('/users.html')
def manage(self): c.menuCompany = 'on' companyid = request.environ.get('COMPANY_ID') company = model.Company.get(companyid) c.name = company.name c.street = company.street or '[no street entered]' c.location = company.city and company.state and company.zip \ and '{0}, {1}, {2}'.format(company.city,company.state,company.zip) \ or '[no location entered]' c.phone = company.phone or '[no phone entered]' c.email = company.email or '[no email entered]' superuser = model.Company.get_superuser() c.superuser = superuser['name'] c.is_superuser = superuser['username'] == request.environ.get('REMOTE_USER') and 1 or 0 c.properties = model.Company.get_properties() c.propertyLabel = len(c.properties) == 1 and 'property' or 'properties' c.companyId = request.environ.get('COMPANY_ID') # stats active_leases = model.Lease.totalActiveLeasesInCompany(companyid) total_units = model.Company.totalUnitsInCompany(companyid) occupancy = total_units > 0 and (active_leases * 100 / total_units) or 0 c.companyCreated = company.created.strftime('%B %d, %Y') c.totalUnits = total_units c.totalTenants = model.Tenant_lease.totalTenantsInCompany(companyid) c.occupancy = "{0}%".format( occupancy and occupancy or 1 ) return render('/company_manage.html')
def index(self): default_alert = model.Company.foxAlert() if default_alert == False: default_alert = { 'title': "Need help?", 'message': "Email Rentfox at {0}. I'll get back to you within 24 hours.".format(settings.EMAIL_SUPPORT) } c.alert = default_alert return render('/foxhelper/index.html')
def add(self, id): c.leaseId = id lease = model.Lease.get(id) unit = model.Unit.get_unit(lease.unitid) property = model.Property.get_property(unit.propertyid) c.unit = property.name if property.type == 'single' else '{0} #{1}'.format(property.name, unit.label) c.unitId = lease.unitid c.page_title = 'Add Tenant' return render('/tenant_add.html')
def setup(self, id=None, unitId=None): if id: c.curPropId = id c.curPropName = model.Property.get_name_by_id(id) c.unitId = unitId c.curPropId = id c.page_title = 'Property Setup' c.foxAlert = False return render('/property_setup.html')
def view(self, id): c.unit = model.Unit.get_unit(id) c.property = model.Property.get_property( c.unit.propertyid ) c.property.photo = c.property.thumbid and model.Photo.path(c.property.thumbid) or '' c.floorplan = model.Floorplan.get(c.unit.floorplanid) if not c.floorplan: redirect_to(protocol=settings.PROTOCOL, controller='property', action='setup', id=c.unit.propertyid, unitId=c.unit.id) c.floorplan.photo = c.floorplan.thumbid and model.Photo.path( c.floorplan.thumbid ) or '' c.curPropId = c.property.id c.curPropName = c.property.name c.page_title = c.curPropName + ' #' + c.unit.label c.foxAlert = False return render('/unit_view.html')
def index(self): companyid = request.environ.get('COMPANY_ID') proplist = model.Property.get_properties_of_username(request.environ.get('REMOTE_USER')) properties = [] for prop in proplist: active_leases = model.Lease.totalActiveLeasesInProperty(prop.id) total_units = model.Property.totalUnits(prop.id) occupancy = total_units > 0 and (active_leases * 100 / total_units) or 0 properties.append({ 'id': prop.id, 'name': prop.name, 'type': prop.type, 'photo': prop.thumbid and model.Photo.path(prop.thumbid) or '', 'totalUnits': total_units, 'totalTenants': model.Tenant_lease.totalActiveTenantsInProperty(prop.id), 'percentOccupied': "{0}%".format( occupancy ) }) active_leases = model.Lease.totalActiveLeasesInCompany(companyid) total_units = model.Company.totalUnitsInCompany(companyid) occupancy = total_units > 0 and (active_leases * 100 / total_units) or 0 c.properties = properties c.totalUnits = total_units c.totalTenants = model.Tenant_lease.totalTenantsInCompany(companyid) c.occupancy = "{0}%".format( occupancy ) this_month = date.today().month c.rentPaid = model.Company.totalRentPaidInMonth(2010,this_month) c.rentDue = model.Company.totalActiveLeasesInMonth(2010,this_month) rent_percent = c.rentDue > 0 and (c.rentPaid * 100 / c.rentDue) or 0 c.rentPercent = '{0}%'.format(rent_percent) c.currentMonth = datetime.date.today().strftime('%B') c.menuDashboard = 'on' c.menuCompany = 'off' c.menuAccount = 'off' c.menuUsers = 'off' c.menuHelp = 'off' c.menuSubmenu = False c.menuRecord = 'off' c.menuProperty = 'off' c.menuUnits = 'off' c.menuReports = 'off' c.menuContacts = 'off' return render('/dashboard.html')
def unitContact(self, id): c.unitId = id c.tenantList = [] tenants = model.Tenant_lease.get_tenants_from_unit(id) for tenant in tenants: obj = { 'name': tenant.first_name + ' ' + tenant.last_name, 'phone': tenant.phone, 'email': tenant.email } c.tenantList.append(obj) if len(c.tenantList) == 0: c.unit = model.Unit.get_unit(id) return render('/foxhelper/unitContact.html')
def lateRent(self, id): transInfo = id.split('+') transUnit = transInfo[0] formonth = int(transInfo[1]) foryear = int(transInfo[2]) record = model.Transaction.get_rent_info(transUnit,formonth,foryear) rent = record[0] due = record[1] latefee = record[2] interval = record[3] grace = record[4] date = record[5] day = date.day month = date.month year = date.year target = due + grace if day > target: if interval != 1: c.totalFee = '%.2f' % latefee else: payDate = datetime.date(year,month,day) dueDate = datetime.date(foryear,formonth,due) dayDiff = payDate - dueDate dayDiff = dayDiff.days if dayDiff > 0: result = dayDiff * latefee; c.totalFee = '%.2f' % result; else: c.totalFee = '%.2f' % 0; else: c.totalFee = '%.2f' % 0 c.rentReceivedDate = date.strftime("%m/%d/%Y") c.due = due c.formonth = formonth c.foryear = foryear c.latefee = latefee c.interval = interval c.grace = grace return render('/foxhelper/lateRent.html')
def view(self, id=None): c.property = model.Property.get_property(id) if c.property.type == 'single': unit = model.Unit.get_unit_with_propertyid('Unit', id) redirect_to(protocol=settings.PROTOCOL, controller='unit', action='view', id=unit.id) c.property.photo = c.property.thumbid and model.Photo.path(c.property.thumbid) or '' c.curPropId = id c.curPropName = c.property.name if not id or not c.property: abort(404) this_month = datetime.date.today().month c.rentPaid = model.Property.totalRentPaidInMonth(id, 2010, this_month) c.rentDue = model.Property.totalActiveLeasesInMonth(id, 2010, this_month) rent_percent = c.rentDue > 0 and (c.rentPaid * 100 / c.rentDue) or 0 c.rentPercent = '{0}%'.format(rent_percent) c.currentMonth = datetime.date.today().strftime('%B') c.page_title = c.curPropName return render('/property_view.html')
def homepage(self): if request.environ.get("REMOTE_USER"): redirect("/dashboard") return render('/homepage.html')
def index(self): c.q = request.GET['q'] return render('/search.html')
def newPassword(self, id): c.key = id return render('/new_password.html')
def cancelled(self): c.support_email = settings.EMAIL_SUPPORT return render('/cancelled.html')
def view(self, id): tenant = model.Tenant.get(id) c.tenantId = tenant.id c.tenantResidences = model.Tenant_lease.getUnitsByTenantId(id) c.page_title = tenant.first_name + ' ' + tenant.last_name return render('/tenant_view.html')
def transactions(self): c.page_title = 'Ledger' return render('/reports_transactions.html')
def ajaxerror(self): return render('/foxhelper/ajaxerror.html')
def message(self): return render('/foxhelper/message.html')
def units(self, id=None): c.menuSubmenu = 0 self._selectMenu('units') c.page_title = 'Units' return render('/property_units.html')
def record(self): c.menuSubmenu = 0 self._selectMenu('record') c.page_title = 'Record Rent' return render('/property_record.html')
def endLease(self): return render('/foxhelper/endLease.html')
def index(self): c.foxAlert = False return render("/contacts.html")
def confirm(self): return render('/foxhelper/confirm.html')
def renameType(self): return render('/foxhelper/renameType.html')
def signout(self): return render('/signin.html')
def index(self): c.menuHelp = "on" return render("/help.html")
def signin(self): c.path = '/dashboard' return render('/signin.html')