diff --git a/blocnote/apps/financialInputs/templates/financialInputs/index.html b/blocnote/apps/financialInputs/templates/financialInputs/index.html index a208ffd677a8cd67f3633d461e4d272e2ac62027..fb9b3c1c742759ca80ccb5d2f91116edec81f795 100644 --- a/blocnote/apps/financialInputs/templates/financialInputs/index.html +++ b/blocnote/apps/financialInputs/templates/financialInputs/index.html @@ -49,6 +49,7 @@ {% include "financialInputs/customerPreference.html" %} +Go Back {% endblock %} {% block scripts %} diff --git a/blocnote/apps/financialInputs/urls.py b/blocnote/apps/financialInputs/urls.py index ce55b448c3ba52ec85c79e4b01602416bed513a1..e668ab6afc0940f56db14ae625d6b88371fb8fd9 100644 --- a/blocnote/apps/financialInputs/urls.py +++ b/blocnote/apps/financialInputs/urls.py @@ -2,6 +2,7 @@ from django.conf.urls import url from . import views +app_name = 'financial-inputs' urlpatterns = [ url(r'^$', views.Index.as_view(), name='index'), url(r'^finance-overview/$', views.BlocNoteHeader.as_view(), name='header'), diff --git a/blocnote/apps/landingPage/__init__.py b/blocnote/apps/landingPage/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/blocnote/apps/landingPage/admin.py b/blocnote/apps/landingPage/admin.py new file mode 100644 index 0000000000000000000000000000000000000000..8c38f3f3dad51e4585f3984282c2a4bec5349c1e --- /dev/null +++ b/blocnote/apps/landingPage/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/blocnote/apps/landingPage/apps.py b/blocnote/apps/landingPage/apps.py new file mode 100644 index 0000000000000000000000000000000000000000..e8bedb831ae21ac720a013e74ca6afa2c3934764 --- /dev/null +++ b/blocnote/apps/landingPage/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class LandingpageConfig(AppConfig): + name = 'landingPage' diff --git a/blocnote/apps/landingPage/migrations/__init__.py b/blocnote/apps/landingPage/migrations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/blocnote/apps/landingPage/models.py b/blocnote/apps/landingPage/models.py new file mode 100644 index 0000000000000000000000000000000000000000..71a836239075aa6e6e4ecb700e9c42c95c022d91 --- /dev/null +++ b/blocnote/apps/landingPage/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/blocnote/apps/landingPage/templates/landingPage/index.html b/blocnote/apps/landingPage/templates/landingPage/index.html new file mode 100644 index 0000000000000000000000000000000000000000..c1d74dac6fe04761467ce24a8cfd390c69e8bd8e --- /dev/null +++ b/blocnote/apps/landingPage/templates/landingPage/index.html @@ -0,0 +1,60 @@ +{% extends 'base.html' %} +{% load staticfiles %} +{% block content %} +
+

+ BLOCNOTE +

+
+ + + + + + + + + {% if if_completed %} + + + + + + + + + {% else %} + + + + + + + + + {% endif %} + +
OptionsStatus
+ Financial Inputs + Complete
+ Preliminary Finance + OK
+ Financial Inputs + + {% if if_started %} + Started but not complete. + {% else %} + Not Started. + {% endif %} +
+ Preliminary Finance + +
    + {% for item in not_saved_list %} +
  • Please fill {{ item }}
  • + {% endfor %} +
+
+
+
+{% endblock %} diff --git a/blocnote/apps/landingPage/tests.py b/blocnote/apps/landingPage/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce503c2dd97ba78597f6ff6e4393132753573f6 --- /dev/null +++ b/blocnote/apps/landingPage/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/blocnote/apps/landingPage/urls.py b/blocnote/apps/landingPage/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..e92c33f8a9fb58f5374828a2b5d35865e9ae0e86 --- /dev/null +++ b/blocnote/apps/landingPage/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls import url + +from . import views + +app_name = 'landingPage' +urlpatterns = [ + url(r'^$', views.Index.as_view(), name='index'), +] diff --git a/blocnote/apps/landingPage/views.py b/blocnote/apps/landingPage/views.py new file mode 100644 index 0000000000000000000000000000000000000000..0e2608cabb7292042ecc2dd329a2c618ad917a19 --- /dev/null +++ b/blocnote/apps/landingPage/views.py @@ -0,0 +1,61 @@ +"""Define the views for the landing page for a building.""" +from django.shortcuts import render +from django.views import View + +from blocnote.apps.financialInputs.models import FinancingOverview +from blocnote.apps.financialInputs.models import BillsOverview +from blocnote.apps.financialInputs.models import CustomerPreference +from blocnote.apps.financialInputs.models import CashBalance +from blocnote.apps.financialInputs.models import IncomeStatement +from blocnote.apps.financialInputs.models import LoanOptions + + +class Index(View): + """Show the page with the urls for other apps.""" + + models = [ + FinancingOverview, + BillsOverview, + CustomerPreference, + CashBalance, + IncomeStatement, + LoanOptions, + ] + + model_names_map = { + FinancingOverview: 'Proforma Inputs', + BillsOverview: 'Bills Overview', + CustomerPreference: 'Customer Preference', + CashBalance: 'Cash Balance', + IncomeStatement: 'Income Statment', + LoanOptions: 'Loan Options' + } + + def get(self, request, building_id): + """HTTP GET request. + + Display links to the inputs, budget simulation and preliminary and full analysis pages. + """ + not_saved_list = self.check_inputs(building_id) + if_completed = True + if_started = False + if not_saved_list: + if_completed = False + if len(not_saved_list) < len(self.models): + if_started = True + context = { + 'building_id': building_id, + 'if_started': if_started, + 'if_completed': if_completed, + 'not_saved_list': not_saved_list, + } + return render(request, 'landingPage/index.html', context=context) + + def check_inputs(self, building_id): + """Check if all inputs have been filled out.""" + not_saved = [] + for model in self.models: + model_object = model.objects.filter(building_id=building_id) + if not model_object: + not_saved.append(self.model_names_map[model]) + return not_saved diff --git a/blocnote/apps/preliminaryFinance/templates/preliminaryFinance/index.html b/blocnote/apps/preliminaryFinance/templates/preliminaryFinance/index.html index 787a01a7909d6254c7958776c872a1e9801472f4..f07eb5ae28d7cfc2328b3d8b68df3ac341b9efd6 100644 --- a/blocnote/apps/preliminaryFinance/templates/preliminaryFinance/index.html +++ b/blocnote/apps/preliminaryFinance/templates/preliminaryFinance/index.html @@ -14,6 +14,7 @@
{% include "preliminaryFinance/scenario.html" %}
+Go Back {% endblock %} {% block scripts %} diff --git a/blocnote/apps/preliminaryFinance/urls.py b/blocnote/apps/preliminaryFinance/urls.py index 6bd796e289919f27e4211cbe8b568708c2bdfa9f..42d6fe8a04707ed7370526d31b5fb1437f16901c 100644 --- a/blocnote/apps/preliminaryFinance/urls.py +++ b/blocnote/apps/preliminaryFinance/urls.py @@ -2,6 +2,7 @@ from django.conf.urls import url from . import views +app_name = 'preliminary-finance' urlpatterns = [ url(r'^$', views.Index.as_view(), name='index'), url(r'^scenario/$', views.Scenarios.as_view(), name='scenario'), diff --git a/blocnote/settings.py b/blocnote/settings.py index ad0f38ba6eb035d735a16a396cb342291af75f20..44905a660b1c9a81e2f94be4884139bbbabff605 100644 --- a/blocnote/settings.py +++ b/blocnote/settings.py @@ -43,6 +43,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'blocnote.apps.financialInputs', 'blocnote.apps.preliminaryFinance', + 'blocnote.apps.landingPage', ] MIDDLEWARE = [ diff --git a/blocnote/urls.py b/blocnote/urls.py index d8c2845780794a6ded7b8564f44e2e24b6bba7d2..965a5959245db7cde783620aa24837056a858a8e 100644 --- a/blocnote/urls.py +++ b/blocnote/urls.py @@ -20,5 +20,6 @@ urlpatterns = [ url('', admin.site.urls), url(r'^buildings/(?P[0-9]+)/preliminary-finance/', include('blocnote.apps.preliminaryFinance.urls')), url(r'^buildings/(?P[0-9]+)/financial-inputs/', include('blocnote.apps.financialInputs.urls')), + url(r'^buildings/(?P[0-9]+)/', include('blocnote.apps.landingPage.urls')), url(r'^admin/', admin.site.urls), ]